@fenglimg/fabric-cli 2.0.0-rc.33 → 2.0.0-rc.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{chunk-SRX7WZUG.js → chunk-BATF4PEJ.js} +2 -2
- package/dist/{chunk-PNRWNUFX.js → chunk-XVS4F3P6.js} +105 -4
- package/dist/{config-5CH4EJQ2.js → config-XJIPZNUP.js} +1 -1
- package/dist/{doctor-E26YO67D.js → doctor-2FCRAWDZ.js} +23 -8
- package/dist/index.js +7 -7
- package/dist/{install-YSFVNY3T.js → install-HOTE5BPA.js} +61 -4
- package/dist/{onboard-coverage-6MN3CYHT.js → onboard-coverage-MFCAEBDO.js} +4 -4
- package/dist/{plan-context-hint-CXTLNVSV.js → plan-context-hint-UQLRKGBZ.js} +2 -2
- package/dist/{uninstall-VLLJG7JT.js → uninstall-BIJ5GLEU.js} +1 -1
- package/package.json +3 -4
- package/templates/hooks/cite-policy-evict.cjs +242 -0
- package/templates/hooks/configs/claude-code.json +11 -0
- package/templates/hooks/fabric-hint.cjs +11 -1
- package/templates/hooks/knowledge-hint-broad.cjs +34 -6
- package/templates/hooks/knowledge-hint-narrow.cjs +106 -1
- package/templates/hooks/lib/summary-fallback.cjs +210 -0
- package/templates/skills/fabric-archive/SKILL.md +38 -255
- package/templates/skills/fabric-archive/ref/dry-run-scope.md +16 -0
- package/templates/skills/fabric-archive/ref/e5-cron-recap.md +1 -1
- package/templates/skills/fabric-archive/ref/i18n-policy.md +1 -1
- package/templates/skills/fabric-archive/ref/phase-1-5-onboard.md +10 -10
- package/templates/skills/fabric-import/ref/i18n-policy.md +1 -1
- package/templates/skills/fabric-review/SKILL.md +55 -413
- package/templates/skills/fabric-review/ref/askuserquestion-policy.md +66 -0
- package/templates/skills/fabric-review/ref/i18n-policy.md +1 -1
- package/templates/skills/fabric-review/ref/modify-flow.md +95 -0
- package/templates/skills/fabric-review/ref/output-contract.md +58 -0
- package/templates/skills/fabric-review/ref/per-mode-flows.md +155 -0
- package/templates/skills/fabric-review/ref/semantic-check.md +26 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Modify Sub-Flow, Layer-Flip Rules & Narrowing Imported Entries
|
|
2
|
+
|
|
3
|
+
## Modify Sub-Flow
|
|
4
|
+
|
|
5
|
+
`modify` is the only action that mutates frontmatter or stable_id. It accepts `changes` of shape `{title?, summary?, layer?, maturity?, tags?}`. Server semantics:
|
|
6
|
+
|
|
7
|
+
- **title / summary / tags / maturity changes** → in-place rewrite; stable_id PRESERVED; emits `knowledge_slug_renamed` only when slug derives from title.
|
|
8
|
+
- **layer change** → the ONLY legal stable_id mutation in the system.
|
|
9
|
+
|
|
10
|
+
## Layer-Flip Rules (the only legal stable_id mutation)
|
|
11
|
+
|
|
12
|
+
Triggered when `changes.layer` differs from current entry layer. Server-side transaction:
|
|
13
|
+
|
|
14
|
+
1. Allocate new id under target layer via `KnowledgeIdAllocator.allocate(new_layer, type)` (e.g. KT-D-7 in `team/decisions/` flips to KP-D-3 in `personal/decisions/`).
|
|
15
|
+
2. `git mv <old-layer>/<type>/<old-id>--<slug>.md <new-layer>/<type>/<new-id>--<slug>.md`.
|
|
16
|
+
3. Append `knowledge_layer_changed` event with `{from_layer, to_layer, prior_stable_id, new_stable_id}`.
|
|
17
|
+
4. Server response includes `prior_stable_id` and `new_stable_id` — surface BOTH to the user in the roll-up.
|
|
18
|
+
|
|
19
|
+
Skill responsibilities for layer flip:
|
|
20
|
+
|
|
21
|
+
- BEFORE calling fab_review, surface `AskUserQuestion {options: ["team", "personal"]}` to confirm target layer. The default in the question header should reflect the verbatim layer heuristic (default team unless 强 personal signals dominate). This IS a genuine choice — the user must pick.
|
|
22
|
+
- AFTER server returns, render: `Layer flipped: <prior_stable_id> → <new_stable_id>`. Do NOT silently swallow the id change — downstream agents may have cached the prior id.
|
|
23
|
+
|
|
24
|
+
## Modify Examples
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
// Maturity bump only (no id change)
|
|
28
|
+
mcp__fabric__fab_review({
|
|
29
|
+
action: "modify",
|
|
30
|
+
pending_path: "knowledge/team/decisions/KT-D-0007--single-cjs-hook.md",
|
|
31
|
+
changes: { maturity: "verified" }
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
// Layer flip team → personal (id WILL change)
|
|
35
|
+
mcp__fabric__fab_review({
|
|
36
|
+
action: "modify",
|
|
37
|
+
pending_path: "knowledge/team/guidelines/KT-G-0003--indent-style.md",
|
|
38
|
+
changes: { layer: "personal" }
|
|
39
|
+
})
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Narrowing Imported Entries
|
|
45
|
+
|
|
46
|
+
The fabric-import skill creates pending entries with `relevance_scope=broad` + `relevance_paths=[]` as a deliberate contract — it cannot derive paths from git history. **Narrowing imported entries is fabric-review's responsibility.**
|
|
47
|
+
|
|
48
|
+
### Detection
|
|
49
|
+
|
|
50
|
+
An entry is "import-origin" when `source_sessions[0]` starts with `fabric-import-` (e.g. `fabric-import-2026-05-10`).
|
|
51
|
+
|
|
52
|
+
### Pending mode rendering
|
|
53
|
+
|
|
54
|
+
For each import-origin entry, prepend one warning line to the display block. UX i18n Policy class 1 — roll-up templates; the protected tokens `relevance_scope`, `relevance_paths`, `broad` appear verbatim in BOTH variants:
|
|
55
|
+
|
|
56
|
+
- en: `⚠ Imported (relevance_scope=broad, relevance_paths=[]) — pick 'modify' + say 'narrow to <paths>' to bind scope.`
|
|
57
|
+
- zh-CN: `⚠ Imported (relevance_scope=broad, relevance_paths=[]) — 选择 'modify' 并指定 'narrow to <paths>' 以收紧作用域。`
|
|
58
|
+
|
|
59
|
+
This hint is informational. The user MAY ignore it; broad+[] is a valid final state for cross-cutting knowledge.
|
|
60
|
+
|
|
61
|
+
### Modify follow-up — narrow scope
|
|
62
|
+
|
|
63
|
+
When the user picks `modify` on an import-origin entry, surface AskUserQuestion with an extended option list. UX i18n Policy class 5 — `header` + `question` translated; `options[]` remain English routing keys:
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
// EN
|
|
67
|
+
AskUserQuestion({
|
|
68
|
+
header: "Modify imported entry",
|
|
69
|
+
question: "What aspect of '{title}' to modify?",
|
|
70
|
+
options: ["narrow scope", "edit summary", "change layer", "change maturity", "skip"]
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
// zh-CN
|
|
74
|
+
AskUserQuestion({
|
|
75
|
+
header: "修改 imported 条目",
|
|
76
|
+
question: "要修改 '{title}' 的哪一项?",
|
|
77
|
+
options: ["narrow scope", "edit summary", "change layer", "change maturity", "skip"] // 不翻译
|
|
78
|
+
})
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
When user picks "narrow scope":
|
|
82
|
+
|
|
83
|
+
1. Free-text follow-up. UX i18n Policy class 3 — confirmation prompts:
|
|
84
|
+
- en: `Type relevance_paths (comma-separated globs, e.g. packages/server/src/retry/**, packages/server/src/lib/retry.ts)`
|
|
85
|
+
- zh-CN: `请输入 relevance_paths (逗号分隔的 glob,例如 packages/server/src/retry/**, packages/server/src/lib/retry.ts)`
|
|
86
|
+
2. Call fab_review action="modify" with:
|
|
87
|
+
```ts
|
|
88
|
+
changes: { relevance_scope: "narrow", relevance_paths: [<parsed paths>] }
|
|
89
|
+
```
|
|
90
|
+
3. Display the resolved frontmatter to confirm.
|
|
91
|
+
|
|
92
|
+
### Special cases
|
|
93
|
+
|
|
94
|
+
- **Layer=personal entries**: server auto-degrades narrow → broad+[]; surface the `knowledge_scope_degraded` event back to the user.
|
|
95
|
+
- **Non-import-origin entries**: modify can still narrow (just doesn't show this UX nudge — user types it as a normal modify).
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Output Contract — fabric-review
|
|
2
|
+
|
|
3
|
+
Bilingual roll-up templates + events.jsonl atomicity constraint referenced from SKILL.md.
|
|
4
|
+
|
|
5
|
+
## Roll-up Template
|
|
6
|
+
|
|
7
|
+
After each invocation, the skill MUST produce a brief roll-up to the user. UX i18n Policy class 1 — roll-up templates; render per `fabric_language`. Protected tokens (event-type strings such as `knowledge_promoted` / `knowledge_layer_changed` / `knowledge_rejected` / `knowledge_deferred`, plus `.fabric/events.jsonl`) appear verbatim in BOTH variants:
|
|
8
|
+
|
|
9
|
+
**en variant** (`fabric_language === "en"`):
|
|
10
|
+
|
|
11
|
+
```md
|
|
12
|
+
# Review Summary — mode={pending|topic|health|revisit}
|
|
13
|
+
- Listed: N entries
|
|
14
|
+
- Approved: M (new stable_ids: KT-D-12, KT-G-4, KP-P-2)
|
|
15
|
+
- Rejected: R
|
|
16
|
+
- Modified: U (incl. K layer flips)
|
|
17
|
+
- Deferred: D
|
|
18
|
+
- Skipped: S
|
|
19
|
+
|
|
20
|
+
## Events appended (.fabric/events.jsonl tail)
|
|
21
|
+
- knowledge_promote_started ×M
|
|
22
|
+
- knowledge_promoted ×M
|
|
23
|
+
- knowledge_layer_changed ×K
|
|
24
|
+
- knowledge_rejected ×R
|
|
25
|
+
- knowledge_deferred ×D
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**zh-CN variant** (`fabric_language === "zh-CN"`):
|
|
29
|
+
|
|
30
|
+
```md
|
|
31
|
+
# Review 汇总 — mode={pending|topic|health|revisit}
|
|
32
|
+
- 列出: N 条
|
|
33
|
+
- 已批准: M (新分配 stable_ids: KT-D-12, KT-G-4, KP-P-2)
|
|
34
|
+
- 已驳回: R
|
|
35
|
+
- 已修改: U (含 K 次 layer 切换)
|
|
36
|
+
- 已延后: D
|
|
37
|
+
- 已跳过: S
|
|
38
|
+
|
|
39
|
+
## 追加事件 (.fabric/events.jsonl 末尾)
|
|
40
|
+
- knowledge_promote_started ×M
|
|
41
|
+
- knowledge_promoted ×M
|
|
42
|
+
- knowledge_layer_changed ×K
|
|
43
|
+
- knowledge_rejected ×R
|
|
44
|
+
- knowledge_deferred ×D
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Also surface a one-line `git status` of `.fabric/knowledge/` so the user sees the file moves caused by approve / layer-flip.
|
|
48
|
+
|
|
49
|
+
## events.jsonl Constraint Note
|
|
50
|
+
|
|
51
|
+
Event lines appended to `.fabric/events.jsonl` are subject to POSIX single-write atomicity: only writes ≤ 4KB (`PIPE_BUF`) are guaranteed atomic via `Bash: echo "..." >> file`. Lines exceeding 4KB risk interleaved corruption under concurrent skill + server writes to the same ledger.
|
|
52
|
+
|
|
53
|
+
Skills MUST ensure:
|
|
54
|
+
|
|
55
|
+
- Each event JSON line is a **single line** (no embedded newlines; escape `\n` in any string value).
|
|
56
|
+
- `session_context` and other free-form text fields **self-truncate** to keep the entire serialized line under 4KB. Suggested per-field caps: `session_context` first 500 chars; `source_sessions` cap at 5 entries; `recent_paths` cap at 20 entries; `user_messages_summary` first 500 chars.
|
|
57
|
+
- If approaching the 4KB ceiling after the per-field caps, drop optional fields (e.g. tags / extra metadata) **before** truncating semantic content (the summary / context that carries the actual observation).
|
|
58
|
+
- The promote / reject / modify / defer events listed above are emitted by the MCP server via `appendEventLedgerEvent` and are already length-bounded server-side; this constraint applies to any event the skill itself appends directly to the ledger (rare, but possible for diagnostic markers).
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
# Per-Mode Flows — fabric-review
|
|
2
|
+
|
|
3
|
+
Full bilingual rendering blocks + step-by-step procedures for the four modes referenced from SKILL.md.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Mode: pending — Approve / Reject / Modify Backlog
|
|
8
|
+
|
|
9
|
+
1. Call `fab_review` with `action: "list"`, no filters (or `filters.layer="both"` if user explicitly mentioned both layers).
|
|
10
|
+
2. Server returns `items[]` (each = `{pending_path, type, layer, maturity, tags?, title?, summary?}`).
|
|
11
|
+
3. Before presenting, perform **Semantic Check** (see `ref/semantic-check.md`) by issuing one or more `action: "search"` calls scoped by `filters.type` to surface possible duplicates / contradictions among already-canonical entries.
|
|
12
|
+
4. For each pending item, render a per-item block. v2.0.0-rc.7 T6: render `proposed_reason` (frontmatter) + `## Why proposed` line (body, 1-line enum explanation) + first line of `## Session context` so future-self has full context without re-reading the transcript. UX i18n Policy class 1 — roll-up templates; protected tokens (`pending_path`, `layer`, `team`, `decisions`, `proposed_reason`, `Tags`, etc.) appear verbatim in BOTH variants:
|
|
13
|
+
|
|
14
|
+
**en variant** (`fabric_language === "en"`):
|
|
15
|
+
|
|
16
|
+
```md
|
|
17
|
+
## [type=decisions] [layer=team] pending_path=knowledge/pending/decisions/single-cjs-hook.md
|
|
18
|
+
Title: Single .cjs hook across clients
|
|
19
|
+
Summary: stdout JSON shape is identical across the three clients; one script suffices.
|
|
20
|
+
Maturity: draft Tags: [hook, cli]
|
|
21
|
+
Proposed reason: decision-confirmation — ≥2 alternatives weighed; rationale stated.
|
|
22
|
+
Session context: Session goal: ship Stop-hook for v2 release.
|
|
23
|
+
⚠ Possible duplicate of KT-D-0007 (LLM subjective dup/subsumption judgement; thresholds intentionally not quantified)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**zh-CN variant** (`fabric_language === "zh-CN"`):
|
|
27
|
+
|
|
28
|
+
```md
|
|
29
|
+
## [type=decisions] [layer=team] pending_path=knowledge/pending/decisions/single-cjs-hook.md
|
|
30
|
+
标题: 单 .cjs hook 跨客户端
|
|
31
|
+
摘要: 三客户端 stdout JSON 格式一致,单脚本即可。
|
|
32
|
+
成熟度: draft Tags: [hook, cli]
|
|
33
|
+
Proposed reason: decision-confirmation — ≥2 候选方案经权衡后确认选型。
|
|
34
|
+
Session context: Session goal: ship Stop-hook for v2 release.
|
|
35
|
+
⚠ 可能重复 KT-D-0007 (LLM 主观判断 dup/subsumption;具体阈值不可量化)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The Skill MUST read `proposed_reason` from the pending file's frontmatter (parse the YAML block, key `proposed_reason`) and the `## Why proposed` line / first non-blank line of `## Session context` from the body. If either is missing on a pre-rc.7 pending entry, render the legacy fallback (UX i18n Policy class 1):
|
|
39
|
+
|
|
40
|
+
- en: `Proposed reason: <legacy entry, no reason recorded>` and `Session context: <not recorded>`
|
|
41
|
+
- zh-CN: `Proposed reason: <历史条目,未记录 reason>` 与 `Session context: <未记录>`
|
|
42
|
+
|
|
43
|
+
…so the reviewer can still proceed.
|
|
44
|
+
|
|
45
|
+
5. Surface a per-item AskUserQuestion. UX i18n Policy class 5 — `header` + `question` translated; `options[]` array remain English routing keys:
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
// EN
|
|
49
|
+
AskUserQuestion({
|
|
50
|
+
header: "Review pending entry",
|
|
51
|
+
question: "What action for 'Single .cjs hook across clients'?",
|
|
52
|
+
options: ["approve", "reject", "modify", "defer", "skip"]
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
// zh-CN
|
|
56
|
+
AskUserQuestion({
|
|
57
|
+
header: "审核 pending 条目",
|
|
58
|
+
question: "对 '单 .cjs hook 跨客户端' 执行什么操作?",
|
|
59
|
+
options: ["approve", "reject", "modify", "defer", "skip"] // 不翻译
|
|
60
|
+
})
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
6. Route the user's choice:
|
|
64
|
+
- `approve` → accumulate pending_path into a batch; flush via single `fab_review action="approve"` with `pending_paths=[…]` after the loop ends.
|
|
65
|
+
- `reject` → ask the user for a one-line reason via free-text follow-up; call `fab_review action="reject"` with `pending_paths=[path]` and `reason`.
|
|
66
|
+
- `modify` → see `ref/modify-flow.md`.
|
|
67
|
+
- `defer` → call `fab_review action="defer"` with `pending_paths=[path]`; optional `until` ISO datetime if the user supplies one ("defer 2 weeks" → compute and set).
|
|
68
|
+
- `skip` → no MCP call; move to next item.
|
|
69
|
+
|
|
70
|
+
7. After the loop, display a roll-up: counts by action, list of newly-allocated `stable_id`s (from approve output), and tail of `.fabric/events.jsonl` showing the appended events. See `ref/output-contract.md` for the bilingual rollup template.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Mode: topic — Search & Surface Findings
|
|
75
|
+
|
|
76
|
+
1. Extract the topic keyword(s) from the user's message (e.g. "find about deepMerge" → query="deepMerge").
|
|
77
|
+
2. Call `fab_review action="search"` with `query` and any obvious filters (if user said "team-only" → `filters.layer="team"`).
|
|
78
|
+
3. Server returns `items[]` ranked by relevance — these are entries already in `.fabric/knowledge/{layer}/{type}/` (NOT pending), unless `filters` says otherwise.
|
|
79
|
+
4. Render top-N (cap at `review_topic_result_cap`, config-resolved, default 8) results with title / summary / pending_path.
|
|
80
|
+
5. If the user follow-up indicates intent to act ("approve all", "modify the second one"), pivot into the corresponding pending mode action — the search result already gives the `pending_path` needed for the action.
|
|
81
|
+
6. NEVER surface a per-item AskUserQuestion just for browsing — only when the user signals an action verb.
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Mode: health — Corpus Health & Stale Detection
|
|
86
|
+
|
|
87
|
+
1. Call `fab_review action="list"` with `filters.maturity="draft"` (or no filter for full corpus inspection).
|
|
88
|
+
2. Tail `.fabric/events.jsonl` for layer_changed / demoted / rejected counts in the trailing 30 days.
|
|
89
|
+
3. Compute stale candidates: pending entries with mtime older than `review_stale_pending_days` (config-resolved, default 14) OR maturity=draft entries with no recent evidence-append events.
|
|
90
|
+
4. Render a corpus dashboard. UX i18n Policy class 1 — roll-up templates; render per `fabric_language`:
|
|
91
|
+
|
|
92
|
+
**en variant**:
|
|
93
|
+
|
|
94
|
+
```md
|
|
95
|
+
## Health Overview
|
|
96
|
+
- Pending: 12 entries (oldest 18d) — recommend `defer` or `reject`
|
|
97
|
+
- Drafts: 8 (3 are stale candidates: KP-G-3, KP-G-5, KT-P-9)
|
|
98
|
+
- Layer flips (30d): 2
|
|
99
|
+
- Rejections (30d): 1
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**zh-CN variant**:
|
|
103
|
+
|
|
104
|
+
```md
|
|
105
|
+
## 健康度总览
|
|
106
|
+
- Pending: 12 条 (最旧 18 天) — 建议 `defer` 或 `reject`
|
|
107
|
+
- Drafts: 8 条 (3 条为陈旧候选: KP-G-3, KP-G-5, KT-P-9)
|
|
108
|
+
- Layer 切换 (30 天): 2
|
|
109
|
+
- 已驳回 (30 天): 1
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
5. For each stale candidate, surface AskUserQuestion. UX i18n Policy class 5 — `header` + `question` translated; `options[]` remain English routing keys:
|
|
113
|
+
|
|
114
|
+
```ts
|
|
115
|
+
// EN
|
|
116
|
+
AskUserQuestion({
|
|
117
|
+
header: "Stale entry triage",
|
|
118
|
+
question: "Action for stale entry '{title}'?",
|
|
119
|
+
options: ["defer", "demote", "skip"]
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
// zh-CN
|
|
123
|
+
AskUserQuestion({
|
|
124
|
+
header: "陈旧条目处理",
|
|
125
|
+
question: "对陈旧条目 '{title}' 执行什么操作?",
|
|
126
|
+
options: ["defer", "demote", "skip"] // 不翻译
|
|
127
|
+
})
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Route `defer` → `fab_review action="defer"`, `demote` → `fab_review action="modify"` with `changes.maturity` lowered (or `reject` if the user wants outright removal of a pending entry).
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Mode: revisit — Specific Entry Deep Dive
|
|
135
|
+
|
|
136
|
+
1. The user referenced a specific entry (by id `KT-D-7` or by slug `single-cjs-hook`).
|
|
137
|
+
2. Call `fab_review action="list"` with `filters` narrowed by best-guess fields; if the entry is canonical (has stable_id), `Read` the file directly at `.fabric/knowledge/{layer}/{type}/<id>--<slug>.md`.
|
|
138
|
+
3. Display the full body (frontmatter + content). Tail the events.jsonl for any history events tagged with this stable_id.
|
|
139
|
+
4. Surface AskUserQuestion `{options: ["approve", "modify", "reject", "skip"]}` only if the entry is still pending; for canonical entries the only mutation path is `modify` (incl. layer flip).
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Mode Inference — Examples & Anti-Pattern (companion to SKILL.md table)
|
|
144
|
+
|
|
145
|
+
### Inference Examples (Sample User Messages → Expected Mode)
|
|
146
|
+
|
|
147
|
+
- "review the pending knowledge" → `pending` (Step 1 keyword "review pending")
|
|
148
|
+
- "find anything about deepMerge" → `topic` (Step 1 keyword "find … about")
|
|
149
|
+
- "anything stale in our knowledge base?" → `health` (Step 1 keyword "stale")
|
|
150
|
+
- "look at KT-D-7" → `revisit` (Step 1 keyword "look at <id>")
|
|
151
|
+
- (Stop-hook fired with signal=review, no user typing) → `pending` (Step 3 default, overflow threshold tripped)
|
|
152
|
+
|
|
153
|
+
### Anti-Pattern (Hard Rule restatement)
|
|
154
|
+
|
|
155
|
+
NEVER emit an `AskUserQuestion` whose options include {pending, topic, health, revisit}. The user does not pick the mode. If inference is genuinely ambiguous after all 3 steps, default to `pending` and proceed; the user can always cancel and redirect.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Semantic Check Guidance — fabric-review
|
|
2
|
+
|
|
3
|
+
LLM-assisted duplicate / contradiction / subsumption detection during `pending` mode (and on demand during `topic` mode).
|
|
4
|
+
|
|
5
|
+
> Boundary B (locked): "extraction classification / layer inference / slug naming / mode inference / **semantic dedup** → Skill (LLM); pending file write / frontmatter assembly / idempotency check / counter mgmt / layer-flip transaction / atomic promote → MCP (deterministic)"
|
|
6
|
+
|
|
7
|
+
Semantic check is the LLM's job — the MCP tool does NOT compare meaning.
|
|
8
|
+
|
|
9
|
+
## Procedure
|
|
10
|
+
|
|
11
|
+
For each pending entry to be presented:
|
|
12
|
+
|
|
13
|
+
1. Call `fab_review action="search"` with `query=<title or summary keywords>` and `filters.type=<same type>` to fetch already-canonical entries of the same type.
|
|
14
|
+
2. Compare semantically (LLM judgment, not string match). 三类判断均为 LLM 主观判断 dup/subsumption;具体阈值不可量化(不使用百分比 / 相似度数值伪精度):
|
|
15
|
+
- **Duplicate** — same essential claim. 标题与摘要表达同一核心结论,pending 未提供新证据或新上下文。Flag: `⚠ Possible duplicate of <stable_id>`.
|
|
16
|
+
- **Contradiction** — opposing claims about the same subject. 例:一个 entry 说 "use X",pending 说 "avoid X",且作用域一致。Flag: `⚠ Contradicts <stable_id>`.
|
|
17
|
+
- **Subsumption** — pending fully covered by an existing entry plus extras. Flag: `⚠ Subsumed by <stable_id>; consider modify-to-merge`.
|
|
18
|
+
3. Surface the flag in the per-item display block (see `per-mode-flows.md` pending mode step 4).
|
|
19
|
+
4. The user decides:
|
|
20
|
+
- Still approve → flag is informational; pending becomes canonical alongside the existing entry.
|
|
21
|
+
- Modify-to-harmonize → user supplies edits via `modify` action; consider merging language with the existing entry.
|
|
22
|
+
- Reject as duplicate → reason field MUST cite the existing stable_id (e.g. `reason="duplicate of KT-D-7"`).
|
|
23
|
+
|
|
24
|
+
## What NOT to do
|
|
25
|
+
|
|
26
|
+
DO NOT call `AskUserQuestion` to ask "is this a duplicate?" — the LLM has already judged. The user only chooses among approve / reject / modify, which is a genuine choice.
|