@fenglimg/fabric-shared 2.2.0-rc.1 → 2.2.0-rc.11

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.
@@ -11,7 +11,7 @@ import {
11
11
  KnowledgeTypeSchema,
12
12
  LayerSchema,
13
13
  MaturitySchema,
14
- PROPOSED_REASON_DESCRIPTIONS,
14
+ PROPOSED_REASON_DESCRIPTIONS_BY_LOCALE,
15
15
  ProposedReasonSchema,
16
16
  StableIdSchema,
17
17
  annotateIntentRequestSchema,
@@ -42,7 +42,7 @@ import {
42
42
  recallInputSchema,
43
43
  recallOutputSchema,
44
44
  structuredWarningSchema
45
- } from "../chunk-JEXTOQVV.js";
45
+ } from "../chunk-5AKCRBKJ.js";
46
46
  export {
47
47
  FabExtractKnowledgeInputSchema,
48
48
  FabExtractKnowledgeInputShape,
@@ -56,7 +56,7 @@ export {
56
56
  KnowledgeTypeSchema,
57
57
  LayerSchema,
58
58
  MaturitySchema,
59
- PROPOSED_REASON_DESCRIPTIONS,
59
+ PROPOSED_REASON_DESCRIPTIONS_BY_LOCALE,
60
60
  ProposedReasonSchema,
61
61
  StableIdSchema,
62
62
  annotateIntentRequestSchema,
@@ -1,3 +1,5 @@
1
+ import { L as Locale } from '../types-qg4xXVuT.js';
2
+
1
3
  /**
2
4
  * Canonical Fabric bootstrap content + marker constants — single source of truth
3
5
  * consumed by both `fabric install` (writer) and the server-side doctor (drift
@@ -9,11 +11,19 @@
9
11
  * strings. The canonical body is fixed for all projects — no interpolation —
10
12
  * and intentionally zh-CN-hybrid per locked clarification 3.
11
13
  *
12
- * IMPORTANT: the {@link BOOTSTRAP_CANONICAL} body is byte-locked. Do not edit
13
- * casually — downstream drift detection asserts byte-identical equality, and
14
- * the published-package version becomes the contract between Fabric CLI and
15
- * any Fabric server.
14
+ * IMPORTANT: the {@link BOOTSTRAP_CANONICAL_ZH} / {@link BOOTSTRAP_CANONICAL_EN}
15
+ * bodies are byte-locked. Do not edit casually — downstream drift detection
16
+ * asserts byte-identical equality, and the published-package version becomes
17
+ * the contract between Fabric CLI and any Fabric server.
18
+ *
19
+ * Content-layer i18n: the bootstrap body follows the unified language flow
20
+ * (`resolveGlobalLocale`). `fabric install` and the doctor drift comparator
21
+ * both select the locale-appropriate body via {@link resolveBootstrapCanonical}
22
+ * — an en-locale machine writes/compares the EN body, a zh-CN machine the ZH
23
+ * body. There is NO bare locale-agnostic `BOOTSTRAP_CANONICAL` anymore; every
24
+ * consumer must resolve a locale (clean-slate, no ambiguous default).
16
25
  */
26
+
17
27
  /**
18
28
  * HTML-comment marker pair delimiting the managed Fabric bootstrap section.
19
29
  * Both writer (idempotent in-place replace) and uninstall helper match these
@@ -21,14 +31,6 @@
21
31
  */
22
32
  declare const BOOTSTRAP_MARKER_BEGIN = "<!-- fabric:bootstrap:begin -->";
23
33
  declare const BOOTSTRAP_MARKER_END = "<!-- fabric:bootstrap:end -->";
24
- /**
25
- * Legacy marker pair from rc.12-rc.18 era (when the managed section was
26
- * branded "Fabric Knowledge Base"). Retained here for one-time migration
27
- * detection only: rc.19 install path scans for legacy markers, strips the
28
- * legacy region, and rewrites with the new bootstrap markers.
29
- */
30
- declare const LEGACY_KB_MARKER_BEGIN = "<!-- fabric:knowledge-base:begin -->";
31
- declare const LEGACY_KB_MARKER_END = "<!-- fabric:knowledge-base:end -->";
32
34
  /**
33
35
  * Regex matching the entire managed bootstrap section, markers inclusive,
34
36
  * with an optional preceding blank-line separator (so re-install / uninstall
@@ -38,19 +40,44 @@ declare const LEGACY_KB_MARKER_END = "<!-- fabric:knowledge-base:end -->";
38
40
  */
39
41
  declare const BOOTSTRAP_REGEX: RegExp;
40
42
  /**
41
- * Legacy-marker variant used for one-time migration detection during rc.19
42
- * install — same shape as {@link BOOTSTRAP_REGEX} but targets the older
43
- * `knowledge-base` marker pair.
44
- */
45
- declare const LEGACY_KB_REGEX: RegExp;
46
- /**
47
- * Canonical bootstrap body — byte-locked per rc.19 locked clarification 3.
43
+ * Canonical bootstrap body (zh-CN) byte-locked per rc.19 locked clarification 3.
48
44
  * Rendered into the managed block between {@link BOOTSTRAP_MARKER_BEGIN} and
49
- * {@link BOOTSTRAP_MARKER_END} by `fabric install` across all three supported
50
- * clients (Claude Code, Cursor, Codex CLI).
45
+ * {@link BOOTSTRAP_MARKER_END} by `fabric install` (via
46
+ * {@link resolveBootstrapCanonical}) on a zh-CN machine, across both
47
+ * supported clients (Claude Code, Codex CLI).
51
48
  *
52
49
  * Length guarantee: ≥ 800 bytes (rc.24: grew from ≥400 with cite-contract syntax).
53
50
  */
54
- declare const BOOTSTRAP_CANONICAL = "# Fabric Bootstrap\n\n\u672C\u9879\u76EE\u4F7F\u7528 Fabric \u7BA1\u7406\u8DE8\u5BA2\u6237\u7AEF AI \u77E5\u8BC6\u4E0E\u884C\u4E3A\u89C4\u5219\u3002\u672C\u6587\u4EF6\u7531 `fabric install` \u540C\u6B65\u5230\u4E09\u7AEF managed block,**\u4E0D\u8981\u624B\u52A8\u7F16\u8F91\u4E09\u7AEF\u7684 block**,\u53EA\u6539\u8FD9\u91CC + \u91CD\u8DD1 `fabric install`\u3002\n\n## For Developers\n\n\u8FD9\u4E2A\u6587\u4EF6\u662F **AI \u5BA2\u6237\u7AEF\u7684\u7B56\u7565\u4E0E\u89C4\u7EA6\u914D\u7F6E**,\u4E0D\u662F dev onboarding\u3002\u4F60\u4E0D\u9700\u8981\u8BFB Self-archive / Cite / Phase 0.4 \u7B49\u7EC6\u8282\u3002\n\u4F5C\u4E3A dev \u4F60\u53EA\u9700\u8981:\u5728\u6BCF\u4E2A repo \u8DD1\u4E00\u6B21 `fabric install`,\u51FA\u95EE\u9898\u8DD1 `fabric doctor`,\u5728 `.fabric/knowledge/<type>/` \u4E0B\u5199 markdown\u3002\n**\u4E25\u7981\u624B\u52A8\u7F16\u8F91 `.fabric/agents.meta.json`** \u2014 \u6D3E\u751F\u72B6\u6001\u7531 engine \u91CD\u5EFA\u3002\n\n## 5 \u5206\u949F\u4E0A\u624B (Dev Quickstart)\n\n**Fabric \u662F\u4EC0\u4E48**:\u8DE8\u5BA2\u6237\u7AEF(Claude Code / Codex CLI / Cursor)\u7684 AI \u77E5\u8BC6\u5C42\u3002\u628A\u56E2\u961F/\u9879\u76EE\u7684 **decisions / pitfalls / guidelines / models / processes** \u5B58\u4E3A markdown,hook \u81EA\u52A8 surface \u7ED9 AI,\u8BA9 AI \u4E0D\u7528\u6BCF\u6B21\u91CD\u5B66\u3002\n\n**\u4F60\u8981\u505A\u7684 (DO)** vs **engine \u81EA\u52A8\u7684 (DON'T \u624B\u52A8)**:\n\n| \u4F60 DO | \u4F60 DON'T |\n| --- | --- |\n| \u6BCF\u4E2A repo \u8DD1\u4E00\u6B21 `fabric install` | \u624B\u7F16 `.fabric/agents.meta.json` |\n| \u5F02\u5E38\u65F6\u8DD1 `fabric doctor` (--fix \u81EA\u6108) | \u624B\u7F16 `.claude/hooks/` \u4E0B `.cjs` |\n| \u5728 `.fabric/knowledge/<type>/` \u4E0B\u5199 markdown | \u64CD\u5FC3 Phase 0.4 / E3 / cite policy |\n| `npm install -g @fenglimg/fabric-cli@latest` \u5347\u7EA7 | \u80CC 35 \u6761 doctor lint \u4EE3\u7801 |\n\n**4 \u6B65\u5FAA\u73AF**: `fabric install` (\u4E00\u6B21) \u2192 AI \u6B63\u5E38\u5DE5\u4F5C (hook on session start + edit) \u2192 AI \u63D0\u8BAE\u6761\u76EE\u5165 `.fabric/knowledge/pending/` \u2192 \u7528 `fabric-review` skill \u6216 `fabric doctor --fix` \u5BA1\u6838\u5F52\u6863\u3002\n\n**\u771F\u4F8B**:\u67D0 sprite \u9ED1\u8FB9 root cause \u662F `atlas.premultiplyAlpha` flag \u53CD\u5411 \u2014 \u5199\u8FDB `.fabric/knowledge/pitfalls/` \u540E,\u4E0B\u6B21\u540C\u7C7B\u95EE\u9898 AI \u81EA\u52A8 reference\u3002\n\n\u5B8C\u6574 maintainer \u7248\u89C1 `docs/USER-QUICKSTART.md`\u3002\n\n## \u884C\u4E3A\u89C4\u5219\n- **\u4FEE\u6539\u4EFB\u4F55\u6587\u4EF6\u524D**:\u4F18\u5148\u5355\u6B65 `fab_recall(paths=[<\u88AB\u6539\u6587\u4EF6>])` \u2014\u2014 \u4E00\u6B21\u8C03\u7528\u76F4\u63A5\u62FF\u56DE\u6240\u6709\u76F8\u5173 KB \u6B63\u6587(rc.37+ \u9ED8\u8BA4\u8DEF\u5F84,\u7701\u6389\u624B\u52A8\u6311 id \u7684\u73AF\u8282)\u3002**\u4EC5\u5F53\u5355\u6B65\u62C9\u56DE\u7684\u6B63\u6587\u8FC7\u591A\u3001\u5BFC\u81F4\u4E0A\u4E0B\u6587\u8FC7\u8F7D\u9700\u7CBE\u786E\u88C1\u526A\u566A\u97F3\u65F6**\u624D\u8D70\u4E24\u6B65:\u5148 `fab_plan_context(paths=[...])` \u62FF `selection_token` + \u9876\u5C42 `candidates[]`(\u4ECE `candidates[].stable_id` \u6311),\u518D `fab_get_knowledge_sections({ selection_token, ai_selected_stable_ids: [<id>...] })` \u53D6\u6B63\u6587\u3002\n- **`.fabric/agents.meta.json` \u4E25\u7981\u624B\u52A8\u7F16\u8F91**;engine \u4F1A\u81EA\u52A8\u540C\u6B65\u6D3E\u751F\u72B6\u6001,\u663E\u5F0F reconcile \u8DD1 `fabric doctor --fix`\u3002\n\n## \u77E5\u8BC6\u5E93(KB)\n- **Discovery**:SessionStart hook \u5217 broad-scoped \u6761\u76EE(\u542B personal layer `KP-*` \u6761\u76EE,\u5F15\u7528\u65B9\u5F0F\u76F8\u540C);edit \u6587\u4EF6\u65F6 PreToolUse hook \u53EF\u80FD\u89E6\u53D1 narrow hint\u3002\n- **Usage**:\u5E38\u6001\u8D70\u5355\u6B65 `fab_recall(paths=[...])` \u4E00\u6B21\u62FF\u56DE\u76F8\u5173 KB \u6B63\u6587\u3002\u4EC5\u5F53\u5355\u6B65\u6B63\u6587\u8FC7\u591A\u81F4\u4E0A\u4E0B\u6587\u8FC7\u8F7D\u3001\u9700\u7CBE\u786E\u88C1\u526A\u566A\u97F3\u65F6\u624D\u4E24\u6B65:`fab_plan_context(paths=[...])` \u8FD4\u56DE `selection_token` + \u9876\u5C42 `candidates[]`,\u518D `fab_get_knowledge_sections({ selection_token, ai_selected_stable_ids: [<\u4ECE candidates[].stable_id \u6311>...] })` \u62C9\u5168\u6587;`selection_token` \u5FC5\u987B\u6765\u81EA\u6700\u8FD1\u4E00\u6B21 `fab_plan_context`,\u4E0D\u53EF\u51ED\u7A7A\u7F16\u9020\u3002\n- **session_id**: \u8C03\u7528 `fab_recall` / `fab_plan_context` \u65F6, \u52A1\u5FC5\u628A\u5F53\u524D client session id \u4F5C\u4E3A `session_id` \u53C2\u6570\u4F20\u5165(Claude Code \u7684 session id \u5728 stdin payload \u4E2D, Codex \u7684\u5BF9\u5E94 identifier \u540C\u7406)\u3002\u8FD9\u80FD\u8BA9 `fabric doctor --archive-history` \u4E0E archive-hint hook \u51C6\u786E\u8BC6\u522B\u8DE8\u4F1A\u8BDD debt \u72B6\u6001\u3002\n- **Write flows**:`fabric-archive` / `fabric-review` / `fabric-import` \u4E09\u4E2A Skills\u3002\n- **Language**:\u6E32\u67D3\u6309 `.fabric/fabric-config.json` \u7684 `fabric_language` \u5B57\u6BB5\u3002\n- **Archive cadence nudge** (rc.36): \u6BCF\u5B8C\u6210 5+ \u6B21 Edit / \u663E\u8457 decision \u540E,\u5728\u5408\u9002\u56DE\u5408\u4E3B\u52A8 propose \u8C03 `fabric-archive` skill \u2014 archive \u6CA1\u5EFA\u7ACB\u9891\u7387\u4F1A\u8BA9 KB \u6162\u901F\u6B7B\u6389\u3002\n- **Review backlog nudge** (rc.36): `.fabric/knowledge/pending/` \u7D2F\u79EF >10 \u6761\u65F6,\u5728\u5408\u9002\u56DE\u5408\u4E3B\u52A8 propose \u8C03 `fabric-review` skill \u6279\u91CF\u5BA1,\u907F\u514D draft \u5361\u6B7B\u3002\n\n## Self-archive policy (v2.0.0-rc.37 NEW-2: \u7B80\u5316 4 \u4FE1\u53F7 \u2192 2 \u5927\u7C7B)\n\n- **\u89E6\u53D1** (\u672C\u4F1A\u8BDD\u51FA\u73B0\u4EE5\u4E0B\u4EFB\u4E00\u4FE1\u53F7, \u5728\u8BE5 turn \u56DE\u590D\u672B\u5C3E\u81EA\u4E3B\u8C03\u7528 `fabric-archive` skill, \u8D70 AI \u81EA\u89E6\u53D1\u5165\u53E3 E3_ai_self_trigger):\n 1. **User-driven normative** \u2014 \u7528\u6237\u6D88\u606F\u4E2D\u663E\u5F0F\u8868\u8FBE normative \u610F\u56FE: `\u4EE5\u540E` / `always` / `never` / `from now on` / `\u4E0B\u6B21\u6CE8\u610F` / `\u8BB0\u4E00\u4E0B` / `\u6C38\u8FDC\u4E0D\u8981`, OR \u7528\u6237\u5728 \u22652 \u5019\u9009\u95F4\u6743\u8861\u540E\u7ED9\u51FA rationale \u9501\u5B9A\u65B9\u5411, OR \u7528\u6237\u62D2\u4E86\u67D0\u5EFA\u8BAE**\u5E76**\u8BF4\u4E86\u539F\u56E0 (\u62D2\u7EDD\u7406\u7531\u672C\u8EAB\u662F\u77E5\u8BC6)\n 2. **Wrong-turn-and-revert** \u2014 AI \u5C1D\u8BD5 path X, \u53CD\u601D\u540E\u6539\u8D70 path Y (\u5C24\u5176\u5F53 path X \u662F\u975E\u663E\u7136\u8E29\u5751); \u6DB5\u76D6\u6280\u672F\u51B3\u7B56\u53CD\u8F6C + \u5DE5\u5177/\u8303\u5F0F\u5207\u6362 + \u5931\u8D25\u91CD\u8BD5\u3002Anchor: \u4E00\u5B9A\u6709\"\u5426\u5B9A+\u66FF\u4EE3\"\u7684\u4E24\u6B65\u7ED3\u6784, \u4E0D\u662F\u5355\u7EAF\u63A2\u7D22\u5931\u8D25\n\n \u8001 4-state (Normative / Decision-confirmation / Explicit-dismissal / Wrong-turn) \u73B0\u5408\u5E76: \u524D 3 \u4E2A\u5168\u662F\"\u7528\u6237\u6D88\u606F\u4E2D\u663E\u5F0F\u8868\u8FBE\"\u6027\u8D28, \u6298\u6210 1 \u7C7B; \u7B2C 4 \u662F\"AI \u81EA\u5DF1\u7684\u53CD\u601D\u8DEF\u5F84\", \u72EC\u7ACB 1 \u7C7B\u3002\u4E24\u7C7B\u5404\u81EA\u7684\u672C\u8D28\u5224\u522B\u4E0D\u53D8, \u89E6\u53D1\u9762\u6CA1\u53D8\u7A84\u3002\n\n- **Anti-trigger** (\u660E\u786E\u4E0D\u89E6\u53D1):\n - \u7528\u6237\u7EAF\u8BE2\u95EE (\u65E0 normative \u8868\u8FBE)\n - \u7B80\u5355 refactor / typo fix\n - AI \u81EA\u5DF1\u4EA7\u751F\u7684'\u6D1E\u5BDF' (\u5FC5\u987B\u7531\u7528\u6237\u6D88\u606F\u4E2D\u4FE1\u53F7\u6216 AI \u81EA\u5DF1\u7684 wrong-turn \u89E6\u53D1, \u4E0D\u662F\u51ED\u7A7A\"\u6211\u5B66\u5230\u4E86\"\u6027\u8D28)\n\n- **Anti-loop \u4E09\u6761\u9632\u62A4**:\n - \u540C turn \u6700\u591A\u81EA\u8C03 1 \u6B21\n - \u540C session \u540C outcome \u4E0D\u91CD\u590D (\u82E5 user_dismissed, \u672C\u4F1A\u8BDD\u4E0D\u518D\u81EA\u8C03\u76F8\u540C\u4E3B\u9898)\n - Phase 2.5 viability gate \u515C\u5E95 (skill \u5185\u90E8\u4ECD\u8DD1 gate, AI \u5224\u9519\u4E0D\u4F1A\u4E71\u5199 pending)\n\n- **\u5448\u73B0\u6A21\u677F** (turn \u672B\u5C3E\u63D2\u5165, \u4E24\u884C: \u5148 marker \u884C\u4F9B Phase 1.5 \u68C0\u6D4B, \u518D user-facing \u63D0\u793A):\n ```\n self-archive policy triggered by signal: <User-driven normative|Wrong-turn-and-revert>\n \u987A\u624B\u5F52\u6863: \u6CE8\u610F\u5230\u4F60\u8BF4 `<\u89E6\u53D1\u77ED\u8BED>`, \u5DF2\u8C03\u7528 fabric-archive \u6293 N \u6761\u5019\u9009 \u2192 .fabric/knowledge/pending/...\n \u82E5\u4E0D\u8BE5\u8BB0, \u7B54 '\u64A4\u9500' \u6211\u4F1A\u8C03 fab_review reject\u3002\n ```\n \u7B2C\u4E00\u884C\u662F Phase 1.5 Trigger Gate \u8BC6\u522B E3 \u5165\u53E3\u7684 structured marker (verbatim \u5B57\u7B26\u4E32 `self-archive policy triggered by signal`, \u540E\u63A5\u5192\u53F7 + \u89E6\u53D1\u4FE1\u53F7\u540D)\u3002\u7B2C\u4E8C\u884C\u8D77\u662F\u7ED9\u7528\u6237\u770B\u7684\u4E2D\u6587\u63D0\u793A\u3002\u4E24\u884C\u90FD\u5FC5\u987B\u51FA\u73B0; \u7F3A marker \u884C Phase 1.5 \u65E0\u6CD5\u8DEF\u7531\u5230 E3_ai_self_trigger\u3002\n\n Backward compat: Phase 1.5 entry-point regex \u540C\u65F6\u8BC6\u522B\u8001 4 \u4E2A\u4FE1\u53F7\u540D (Normative / Wrong-turn-and-revert / Decision confirmation / Explicit dismissal) \u4E0E\u65B0 2 \u5927\u7C7B\u540D, \u65E7 session marker \u4ECD\u80FD\u6B63\u786E\u8DEF\u7531\u3002\n\n## Cite policy (v2.0.0-rc.37 NEW-1: \u7B80\u5316 4-state \u2192 2-state)\n\n- **\u89E6\u53D1**: \u505A edit / decide / propose plan \u4E4B\u524D,**\u56DE\u590D\u9996\u884C**\u5FC5\u987B\u5199 `KB: <id> (<\u22648\u5B57 \u7528\u6CD5>) [applied|dismissed:<reason>]` \u6216 `KB: none [<reason>]`\u3002\n- **`[applied]` \u9A8C\u8BC1\u4E49\u52A1**: \u5F15\u7528\u4EFB\u4F55 id \u524D\u5FC5\u987B\u5148\u7528 fab_recall (\u6216\u4E24\u6B65 fab_plan_context \u2192 fab_get_knowledge_sections) \u5B9E\u9645\u6293 KB body, \u9632\u6B62\u7F16\u9020 id\u3002\u9A8C\u8BC1\u4E0D\u901A\u8FC7 = \u4E0D\u80FD cite\u3002\n- **store \u524D\u7F00 (v2.1, \u591A store)**: \u5F53 read-set \u542B\u591A\u4E2A store \u4E14\u540C\u4E00 local id \u5728\u591A store \u95F4 shadow \u65F6,cite \u5FC5\u987B store-qualified: `KB: <store-alias>:<id> ...`(\u5982 `KB: team:KT-DEC-0001 (auth) [applied]`);alias \u7528\u6237\u81EA\u5B9A/canonical,\u5E95\u5C42 UUID\u3002\u5355 store \u6216\u65E0\u6B67\u4E49\u65F6\u88F8 `KB: <id>` \u4ECD valid\u3002personal-only \u6761\u76EE cite \u8FDB\u56E2\u961F\u4EA7\u7269=\u5F3A warning(\u63A5 P2 \u5199\u8DEF\u5F84\u9632\u6CC4\u6F0F R5#3)\u3002\n- **contract \u8BED\u6CD5**: decisions/pitfalls \u7C7B `[applied]` cite \u5C3E\u6BB5\u52A0 contract: `\u2192 <operator> [<operator> ...]`,operator \u2208 {`edit:<glob>` `!edit:<glob>` `require:<symbol>` `forbid:<symbol>` `skip:<reason>`}\u3002\u4F8B:`KB: K-001 (auth) [applied] \u2192 edit:src/auth/**/*.ts !edit:src/legacy/**`\u3002\n- **skip reason \u8BCD\u5178**: `sequencing | conditional | semantic | aesthetic | architectural | other:<text>`\u3002\n- **type \u8DEF\u7531**: models \u7C7B\u5F15\u7528\u4E3A reference cite,\u4E0D\u9700\u8981 contract;guidelines/processes \u7C7B\u6682\u4E0D\u5F3A\u5236,\u63A8\u540E LLM-judge\u3002\n- **\u7528\u6237\u53E3\u5934\u63D0\u89C4\u5219\u6CA1\u7ED9 id**: \u5148\u8C03 `fab_recall(paths)` \u6216 `fab_extract_knowledge` \u53CD\u67E5\u3002\n- **dismissed reason**: \u679A\u4E3E `scope-mismatch | outdated | not-applicable | other:<text>`\u3002\n- **`KB: none` sentinel**: \u679A\u4E3E\u4E24\u79CD\u5408\u89C4\u7406\u7531\u2014\u2014`[no-relevant]` \u5DF2\u8C03 `fab_recall` / `fab_plan_context`(\u6216 hook \u8F93\u51FA\u53EF\u89C1)\u4F46\u65E0\u53EF\u7528\u6761\u76EE;`[not-applicable]` \u5F53\u524D\u52A8\u4F5C\u4E0D\u5728 cite \u8303\u56F4(\u7EAF\u63A2\u7D22 / Bash \u53EA\u8BFB / \u7528\u6237\u95EE\u7B54)\u3002\u88F8 `KB: none`(\u65E0\u540E\u7F00)\u4ECD\u7136 valid,\u5F52\u7C7B\u4E3A `[unspecified]`(legacy \u517C\u5BB9,\u9F13\u52B1\u540E\u7EED\u8865\u6CE8)\u3002\n- **\u7A3D\u6838**: `fabric doctor --cite-coverage [--since=7d] [--client=cc|codex|all]` \u8F93\u51FA cite \u8986\u76D6\u7387,\u542B `KB: none` sentinel \u62C6\u5206\u3002\u672C\u89C4\u5219\u4E0D\u963B\u65AD\u4F60\u5DE5\u4F5C,\u53EA\u8BB0\u5F55\u3002\n- **Backward compat**: \u89E3\u6790\u5668\u540C\u65F6\u63A5\u53D7\u8001 4-state tags (`planned` / `recalled` / `chained-from <id>`) \u2014 \u90FD\u6620\u5C04\u5230 `[applied]` \u8BED\u4E49,gradually \u8FC1\u5230\u65B0\u7B80\u5316\u5F62\u6001\u5373\u53EF,\u65E7 session \u7559\u4E0B\u7684 cite \u4ECD\u7136\u8BA1\u5165 cite-coverage\u3002\n- **\u5B8C\u6574\u53C2\u8003\u4E0B\u6C89** (v2.2 SK5): contract operator / skip\u00B7dismissed \u8BCD\u5178 / \u7C7B\u578B\u8DEF\u7531 / \u7A3D\u6838\u53E3\u5F84 / **\u88C1\u51B3\u9636\u68AF** (AI\u81EA\u51B3 \u2192 \u591A-LLM \u542B\u96F6\u4E0A\u4E0B\u6587\u51B7\u8BC4 \u2192 \u975E\u963B\u585E\u961F\u5217) \u7684\u6743\u5A01\u8BE6\u53C2\u5728 `fabric-review` skill \u7684 `ref/cite-contract.md` \u2014\u2014 bootstrap \u53EA\u7559\u53EF\u6267\u884C core,\u6CBB\u7406\u7EC6\u8282\u5F52 ref \u4E0D\u518D\u6491\u5927 bootstrap\u3002\n";
51
+ declare const BOOTSTRAP_CANONICAL_ZH = "# Fabric Bootstrap\n\n\u672C\u9879\u76EE\u4F7F\u7528 Fabric \u7BA1\u7406\u8DE8\u5BA2\u6237\u7AEF AI \u77E5\u8BC6\u4E0E\u884C\u4E3A\u89C4\u5219\u3002\u672C\u6587\u4EF6\u7531 `fabric install` \u540C\u6B65\u5230\u4E24\u7AEF managed block,**\u4E0D\u8981\u624B\u52A8\u7F16\u8F91\u4E24\u7AEF\u7684 block**,\u53EA\u6539\u8FD9\u91CC + \u91CD\u8DD1 `fabric install`\u3002\n\n## For Developers\n\n\u8FD9\u4E2A\u6587\u4EF6\u662F **AI \u5BA2\u6237\u7AEF\u7684\u7B56\u7565\u4E0E\u89C4\u7EA6\u914D\u7F6E**,\u4E0D\u662F dev onboarding\u3002\u4F60\u4E0D\u9700\u8981\u8BFB Self-archive / Cite / Phase 0.4 \u7B49\u7EC6\u8282\u3002\n\u4F5C\u4E3A dev \u4F60\u53EA\u9700\u8981:\u5728\u6BCF\u4E2A repo \u8DD1\u4E00\u6B21 `fabric install`,\u7528 `fabric store bind <alias>` / `fabric store switch-write <alias>` \u63A5\u5165\u5199\u5165 store,\u51FA\u95EE\u9898\u8DD1 `fabric doctor`\u3002\n**\u4E25\u7981\u624B\u52A8\u7F16\u8F91 `.fabric/agents.meta.json`** \u2014 \u6D3E\u751F\u72B6\u6001\u7531 engine \u91CD\u5EFA\u3002\n\n## 5 \u5206\u949F\u4E0A\u624B (Dev Quickstart)\n\n**Fabric \u662F\u4EC0\u4E48**:\u8DE8\u5BA2\u6237\u7AEF(Claude Code / Codex CLI)\u7684 AI \u77E5\u8BC6\u5C42\u3002\u628A\u56E2\u961F/\u9879\u76EE\u7684 **decisions / pitfalls / guidelines / models / processes** \u5B58\u4E3A markdown,hook \u81EA\u52A8 surface \u7ED9 AI,\u8BA9 AI \u4E0D\u7528\u6BCF\u6B21\u91CD\u5B66\u3002\n\n**\u4F60\u8981\u505A\u7684 (DO)** vs **engine \u81EA\u52A8\u7684 (DON'T \u624B\u52A8)**:\n\n| \u4F60 DO | \u4F60 DON'T |\n| --- | --- |\n| \u6BCF\u4E2A repo \u8DD1\u4E00\u6B21 `fabric install` | \u624B\u7F16 `.fabric/agents.meta.json` |\n| \u5F02\u5E38\u65F6\u8DD1 `fabric doctor` (--fix \u81EA\u6108) | \u624B\u7F16 `.claude/hooks/` \u4E0B `.cjs` |\n| \u7528 `fabric-archive` / `fabric-review` / `fabric store ...` \u7BA1\u7406 store-backed knowledge | \u624B\u5199\u4EFB\u4F55\u975E store knowledge \u6839 |\n| `npm install -g @fenglimg/fabric-cli@latest` \u5347\u7EA7 | \u80CC 35 \u6761 doctor lint \u4EE3\u7801 |\n\n**4 \u6B65\u5FAA\u73AF**: `fabric install` (\u4E00\u6B21) \u2192 \u7ED1\u5B9A\u5E76\u9009\u62E9\u5199\u5165 store \u2192 AI \u6B63\u5E38\u5DE5\u4F5C (hook on session start + edit) \u2192 AI \u901A\u8FC7 MCP \u5199\u5165\u5F53\u524D write store \u7684 pending \u6761\u76EE\u5E76\u8FD4\u56DE `pending_path` \u2192 \u7528 `fabric-review` skill \u5BA1\u6838\u3002\n\n**\u771F\u4F8B**:\u67D0 sprite \u9ED1\u8FB9 root cause \u662F `atlas.premultiplyAlpha` flag \u53CD\u5411 \u2014 \u5F52\u6863\u8FDB store \u7684 `knowledge/pitfalls/` \u540E,\u4E0B\u6B21\u540C\u7C7B\u95EE\u9898 AI \u81EA\u52A8 reference\u3002\n\n\u5B8C\u6574 maintainer \u7248\u89C1 `docs/USER-QUICKSTART.md`\u3002\n\n## \u884C\u4E3A\u89C4\u5219\n- **\u4FEE\u6539\u4EFB\u4F55\u6587\u4EF6\u524D**:\u5148 `fab_recall(paths=[<\u88AB\u6539\u6587\u4EF6>])` \u2014\u2014 \u4E00\u6B21\u8C03\u7528\u62FF\u56DE\u76F8\u5173 KB \u7684\u63CF\u8FF0 + \u539F\u751F\u8BFB\u53D6\u8DEF\u5F84(`paths[].path`)\u3002`fab_recall` \u4E0D\u518D\u6295\u9012\u6B63\u6587;\u9700\u8981\u67D0\u6761\u6B63\u6587\u65F6\u76F4\u63A5\u5BF9\u5176 `paths[].path` \u505A\u539F\u751F Read(`Read <store>/knowledge/<type>/<id>--*.md`),\u8FD9\u4F1A\u88AB PostToolUse hook \u8BB0\u4E3A `knowledge_body_read`\u3002lean \u9ED8\u8BA4:\u63CF\u8FF0+\u7D22\u5F15\u5DF2\u591F\u53D1\u73B0\u6761\u76EE,\u6B63\u6587\u6309\u9700\u8BFB\u4E00\u6B21,\u4E0D\u6BCF\u8F6E\u91CD\u704C(KT-GLD-0005)\u3002\n- **`.fabric/agents.meta.json` \u4E25\u7981\u624B\u52A8\u7F16\u8F91**;engine \u4F1A\u81EA\u52A8\u540C\u6B65\u6D3E\u751F\u72B6\u6001,\u663E\u5F0F reconcile \u8DD1 `fabric doctor --fix`\u3002\n\n## \u77E5\u8BC6\u5E93(KB)\n- **Discovery**:SessionStart hook \u5217 broad-scoped \u6761\u76EE(\u6761\u76EE\u6309 `semantic_scope` \u5206\u4E09\u5C42:`team` \u56E2\u961F\u901A\u7528 / `project:<id>` \u672C\u9879\u76EE\u4E13\u5C5E(\u4EC5\u5728\u7ED1\u5B9A\u8BE5\u9879\u76EE\u7684\u4ED3\u5E93\u6D6E\u73B0)/ `personal` \u4E2A\u4EBA `KP-*`,\u4E09\u8005\u5F15\u7528\u65B9\u5F0F\u76F8\u540C);edit \u6587\u4EF6\u65F6 PreToolUse hook \u53EF\u80FD\u89E6\u53D1 narrow hint\u3002\n- **Usage**:\u8D70\u5355\u6B65 `fab_recall(paths=[...])` \u4E00\u6B21\u62FF\u56DE\u76F8\u5173 KB \u7684\u63CF\u8FF0 + \u8BFB\u53D6\u8DEF\u5F84;\u9700\u8981\u67D0\u6761\u6B63\u6587\u65F6\u5BF9\u5176 `paths[].path` \u505A\u539F\u751F Read \u53D6\u56DE(\u4E0D\u518D\u8D70 MCP \u4E8C\u6B21\u53D6\u6B63\u6587)\u3002\n- **session_id**: \u8C03\u7528 `fab_recall` \u65F6, \u52A1\u5FC5\u628A\u5F53\u524D client session id \u4F5C\u4E3A `session_id` \u53C2\u6570\u4F20\u5165(Claude Code \u7684 session id \u5728 stdin payload \u4E2D, Codex \u7684\u5BF9\u5E94 identifier \u540C\u7406)\u3002\u8FD9\u80FD\u8BA9 `fabric doctor --archive-history` \u4E0E `fabric-hint.cjs` Stop hook \u51C6\u786E\u8BC6\u522B\u8DE8\u4F1A\u8BDD debt \u72B6\u6001\u3002\n- **Skills (7)**:\u5199\u6D41\u7A0B `fabric-archive` / `fabric-review` / `fabric-import`;store \u6D41\u7A0B `fabric-store` / `fabric-sync` / `fabric-connect`;\u8BCA\u65AD `fabric-audit`\u3002\n- **Language**:\u6E32\u67D3\u6309 `.fabric/fabric-config.json` \u7684 `fabric_language` \u5B57\u6BB5\u3002\n- **Archive cadence nudge** (rc.36): \u6BCF\u5B8C\u6210\u4E00\u6279 Edit(\u9ED8\u8BA4 ~20 \u6B21, \u4E0E Stop hook \u9608\u503C config `archive_edit_threshold` \u4E00\u81F4)/ \u663E\u8457 decision \u540E,\u5728\u5408\u9002\u56DE\u5408\u4E3B\u52A8 propose \u8C03 `fabric-archive` skill \u2014 archive \u6CA1\u5EFA\u7ACB\u9891\u7387\u4F1A\u8BA9 KB \u6162\u901F\u6B7B\u6389\u3002\n- **Review backlog nudge** (rc.36): \u9700\u8981\u5224\u65AD pending backlog \u65F6\u8D70 `fab_review action=\"list\"` \u6216 `fabric-review` \u8FD4\u56DE\u7684 `pending_path`;\u4E0D\u8981 glob \u9879\u76EE\u672C\u5730 `.fabric/knowledge/pending`\u3002\u5F53\u53EF\u89C1 pending \u7D2F\u79EF >10 \u6761\u65F6,\u5728\u5408\u9002\u56DE\u5408\u4E3B\u52A8 propose \u8C03 `fabric-review` skill \u6279\u91CF\u5BA1,\u907F\u514D draft \u5361\u6B7B\u3002\n\n## Self-archive policy (v2.0.0-rc.37 NEW-2: \u7B80\u5316 4 \u4FE1\u53F7 \u2192 2 \u5927\u7C7B)\n\n- **\u89E6\u53D1** (\u672C\u4F1A\u8BDD\u51FA\u73B0\u4EE5\u4E0B\u4EFB\u4E00\u4FE1\u53F7, \u5728\u8BE5 turn \u56DE\u590D\u672B\u5C3E\u81EA\u4E3B\u8C03\u7528 `fabric-archive` skill, \u8D70 AI \u81EA\u89E6\u53D1\u5165\u53E3 E3_ai_self_trigger):\n 1. **User-driven normative** \u2014 \u7528\u6237\u6D88\u606F\u4E2D\u663E\u5F0F\u8868\u8FBE normative \u610F\u56FE: `\u4EE5\u540E` / `always` / `never` / `from now on` / `\u4E0B\u6B21\u6CE8\u610F` / `\u8BB0\u4E00\u4E0B` / `\u6C38\u8FDC\u4E0D\u8981`, OR \u7528\u6237\u5728 \u22652 \u5019\u9009\u95F4\u6743\u8861\u540E\u7ED9\u51FA rationale \u9501\u5B9A\u65B9\u5411, OR \u7528\u6237\u62D2\u4E86\u67D0\u5EFA\u8BAE**\u5E76**\u8BF4\u4E86\u539F\u56E0 (\u62D2\u7EDD\u7406\u7531\u672C\u8EAB\u662F\u77E5\u8BC6)\n 2. **Wrong-turn-and-revert** \u2014 AI \u5C1D\u8BD5 path X, \u53CD\u601D\u540E\u6539\u8D70 path Y (\u5C24\u5176\u5F53 path X \u662F\u975E\u663E\u7136\u8E29\u5751); \u6DB5\u76D6\u6280\u672F\u51B3\u7B56\u53CD\u8F6C + \u5DE5\u5177/\u8303\u5F0F\u5207\u6362 + \u5931\u8D25\u91CD\u8BD5\u3002Anchor: \u4E00\u5B9A\u6709\"\u5426\u5B9A+\u66FF\u4EE3\"\u7684\u4E24\u6B65\u7ED3\u6784, \u4E0D\u662F\u5355\u7EAF\u63A2\u7D22\u5931\u8D25\n\n \u8001 4-state (Normative / Decision-confirmation / Explicit-dismissal / Wrong-turn) \u73B0\u5408\u5E76: \u524D 3 \u4E2A\u5168\u662F\"\u7528\u6237\u6D88\u606F\u4E2D\u663E\u5F0F\u8868\u8FBE\"\u6027\u8D28, \u6298\u6210 1 \u7C7B; \u7B2C 4 \u662F\"AI \u81EA\u5DF1\u7684\u53CD\u601D\u8DEF\u5F84\", \u72EC\u7ACB 1 \u7C7B\u3002\u4E24\u7C7B\u5404\u81EA\u7684\u672C\u8D28\u5224\u522B\u4E0D\u53D8, \u89E6\u53D1\u9762\u6CA1\u53D8\u7A84\u3002\n\n- **Anti-trigger** (\u660E\u786E\u4E0D\u89E6\u53D1):\n - \u7528\u6237\u7EAF\u8BE2\u95EE (\u65E0 normative \u8868\u8FBE)\n - \u7B80\u5355 refactor / typo fix\n - AI \u81EA\u5DF1\u4EA7\u751F\u7684'\u6D1E\u5BDF' (\u5FC5\u987B\u7531\u7528\u6237\u6D88\u606F\u4E2D\u4FE1\u53F7\u6216 AI \u81EA\u5DF1\u7684 wrong-turn \u89E6\u53D1, \u4E0D\u662F\u51ED\u7A7A\"\u6211\u5B66\u5230\u4E86\"\u6027\u8D28)\n\n- **Anti-loop \u4E09\u6761\u9632\u62A4**:\n - \u540C turn \u6700\u591A\u81EA\u8C03 1 \u6B21\n - \u540C session \u540C outcome \u4E0D\u91CD\u590D (\u82E5 user_dismissed, \u672C\u4F1A\u8BDD\u4E0D\u518D\u81EA\u8C03\u76F8\u540C\u4E3B\u9898)\n - Phase 2.5 viability gate \u515C\u5E95 (skill \u5185\u90E8\u4ECD\u8DD1 gate, AI \u5224\u9519\u4E0D\u4F1A\u4E71\u5199 pending)\n\n- **\u5448\u73B0\u6A21\u677F** (turn \u672B\u5C3E\u63D2\u5165, \u4E24\u884C: \u5148 marker \u884C\u4F9B Phase 1.5 \u68C0\u6D4B, \u518D user-facing \u63D0\u793A):\n ```\n self-archive policy triggered by signal: <User-driven normative|Wrong-turn-and-revert>\n \u987A\u624B\u5F52\u6863: \u6CE8\u610F\u5230\u4F60\u8BF4 `<\u89E6\u53D1\u77ED\u8BED>`, \u5DF2\u8C03\u7528 fabric-archive \u6293 N \u6761\u5019\u9009 \u2192 \u5F53\u524D write store \u7684 knowledge/pending/...\n \u82E5\u4E0D\u8BE5\u8BB0, \u7B54 '\u64A4\u9500' \u6211\u4F1A\u8C03 fab_review reject\u3002\n ```\n \u7B2C\u4E00\u884C\u662F Phase 1.5 Trigger Gate \u8BC6\u522B E3 \u5165\u53E3\u7684 structured marker (verbatim \u5B57\u7B26\u4E32 `self-archive policy triggered by signal`, \u540E\u63A5\u5192\u53F7 + \u89E6\u53D1\u4FE1\u53F7\u540D)\u3002\u7B2C\u4E8C\u884C\u8D77\u662F\u7ED9\u7528\u6237\u770B\u7684\u4E2D\u6587\u63D0\u793A\u3002\u4E24\u884C\u90FD\u5FC5\u987B\u51FA\u73B0; \u7F3A marker \u884C Phase 1.5 \u65E0\u6CD5\u8DEF\u7531\u5230 E3_ai_self_trigger\u3002\n\n Backward compat: Phase 1.5 entry-point regex \u540C\u65F6\u8BC6\u522B\u8001 4 \u4E2A\u4FE1\u53F7\u540D (Normative / Wrong-turn-and-revert / Decision confirmation / Explicit dismissal) \u4E0E\u65B0 2 \u5927\u7C7B\u540D, \u65E7 session marker \u4ECD\u80FD\u6B63\u786E\u8DEF\u7531\u3002\n\n## Cite policy (v2.1 \u2464 recall-based: \u81EA\u52A8\u8BB0\u8D26\u4F18\u5148, \u9996\u884C KB: \u53EF\u9009 override)\n\n- **\u6838\u5FC3 (recall-first \u81EA\u52A8\u8BB0\u8D26)**: \u6539\u4EFB\u4F55\u6587\u4EF6\u524D\u5148 `fab_recall(paths=[<\u88AB\u6539\u6587\u4EF6>])`\u3002\u7CFB\u7EDF\u6309\"\u672C session \u8FD1\u671F recall \u547D\u4E2D\u7684 path \u4E0E\u7F16\u8F91\u76EE\u6807\u91CD\u53E0\"\u81EA\u52A8\u628A\u53EC\u56DE\u7684 KB \u5173\u8054\u4E3A\u8BE5\u6B21 edit \u7684\u5F15\u7528 \u2014\u2014 **\u65E0\u9700\u624B\u5199\u56DE\u590D\u9996\u884C**\u3002PreToolUse hook \u5728\u68C0\u6D4B\u4E0D\u5230\u76F8\u5173 recall \u65F6\u7ED9\u4E00\u6761\u8F6F nudge(nudge \u975E gate,\u5B88 KT-DEC-0007);\u6539\u524D recall \u8FC7(\u6216\u5DF2\u624B\u5199 cite)\u5373\u9759\u9ED8\u3002\u4E3A\u4EC0\u4E48\u4E0D\u518D\u903C\u9996\u884C:\u5148\u60F3\u540E\u8BF4,recall \u624D\u662F\u5F15\u7528\u53D1\u751F\u7684\u771F\u5B9E\u4FE1\u53F7,\u624B\u5199\u9996\u884C\u8FDD\u80CC CoT \u4E14 `KB: none` \u9003\u9038\u4F7F\u65E7\u89C4\u5219\u5F62\u540C\u865A\u8BBE\u3002\n- **\u53EF\u9009 override (\u9996\u884C KB:)**: \u4ECD\u53EF\u5728\u56DE\u590D\u9996\u884C\u624B\u5199 `KB: <id> (<\u22648\u5B57 \u7528\u6CD5>) [applied|dismissed:<reason>]` \u6216 `KB: none [<reason>]` \u6765\u663E\u5F0F\u6807\u6CE8/\u7CBE\u786E\u5316\u5F15\u7528;cite-line \u89E3\u6790\u5668\u4FDD\u7559(\u5411\u540E\u517C\u5BB9),\u65E7\u4E60\u60EF\u4E0D\u7834\u3002\n- **`[applied]` \u9A8C\u8BC1\u4E49\u52A1**: \u5F15\u7528\u4EFB\u4F55 id(\u81EA\u52A8\u6216\u624B\u5199)\u7684\u524D\u63D0\u662F\u5148\u7528 fab_recall \u5B9E\u9645\u6293\u56DE KB(\u5E76\u6309\u9700\u5BF9\u5176\u6B63\u6587\u8DEF\u5F84\u505A\u539F\u751F Read), \u9632\u6B62\u7F16\u9020 id\u3002\u9A8C\u8BC1\u4E0D\u901A\u8FC7 = \u4E0D\u80FD cite\u3002\n- **store \u524D\u7F00 (v2.1, \u591A store)**: \u5F53 read-set \u542B\u591A\u4E2A store \u4E14\u540C\u4E00 local id \u5728\u591A store \u95F4 shadow \u65F6,cite \u5FC5\u987B store-qualified: `KB: <store-alias>:<id> ...`(\u5982 `KB: team:KT-DEC-0001 (auth) [applied]`);alias \u7528\u6237\u81EA\u5B9A/canonical,\u5E95\u5C42 UUID\u3002\u5355 store \u6216\u65E0\u6B67\u4E49\u65F6\u88F8 `KB: <id>` \u4ECD valid\u3002personal-only \u6761\u76EE cite \u8FDB\u56E2\u961F\u4EA7\u7269=\u5F3A warning(\u63A5 P2 \u5199\u8DEF\u5F84\u9632\u6CC4\u6F0F R5#3)\u3002\n- **contract \u8BED\u6CD5**: decisions/pitfalls \u7C7B `[applied]` cite \u5C3E\u6BB5\u52A0 contract: `\u2192 <operator> [<operator> ...]`,operator \u2208 {`edit:<glob>` `!edit:<glob>` `require:<symbol>` `forbid:<symbol>` `skip:<reason>`}\u3002\u4F8B:`KB: K-001 (auth) [applied] \u2192 edit:src/auth/**/*.ts !edit:src/legacy/**`\u3002\n- **skip reason \u8BCD\u5178**: `sequencing | conditional | semantic | aesthetic | architectural | other:<text>`\u3002\n- **type \u8DEF\u7531**: models \u7C7B\u5F15\u7528\u4E3A reference cite,\u4E0D\u9700\u8981 contract;guidelines/processes \u7C7B\u6682\u4E0D\u5F3A\u5236,\u63A8\u540E LLM-judge\u3002\n- **\u7528\u6237\u53E3\u5934\u63D0\u89C4\u5219\u6CA1\u7ED9 id**: \u5148\u8C03 `fab_recall(paths)` \u6216 `fab_extract_knowledge` \u53CD\u67E5\u3002\n- **dismissed reason**: \u679A\u4E3E `scope-mismatch | outdated | not-applicable | other:<text>`\u3002\n- **`KB: none` sentinel**: \u679A\u4E3E\u4E24\u79CD\u5408\u89C4\u7406\u7531\u2014\u2014`[no-relevant]` \u5DF2\u8C03 `fab_recall`(\u6216 hook \u8F93\u51FA\u53EF\u89C1)\u4F46\u65E0\u53EF\u7528\u6761\u76EE;`[not-applicable]` \u5F53\u524D\u52A8\u4F5C\u4E0D\u5728 cite \u8303\u56F4(\u7EAF\u63A2\u7D22 / Bash \u53EA\u8BFB / \u7528\u6237\u95EE\u7B54)\u3002\u88F8 `KB: none`(\u65E0\u540E\u7F00)\u4ECD\u7136 valid,\u5F52\u7C7B\u4E3A `[unspecified]`(legacy \u517C\u5BB9,\u9F13\u52B1\u540E\u7EED\u8865\u6CE8)\u3002\n- **\u7A3D\u6838**: `fabric doctor --cite-coverage [--since=7d] [--client=cc|codex|all]` \u8F93\u51FA cite \u8986\u76D6\u7387,\u542B `KB: none` sentinel \u62C6\u5206\u3002\u672C\u89C4\u5219\u4E0D\u963B\u65AD\u4F60\u5DE5\u4F5C,\u53EA\u8BB0\u5F55\u3002\n- **Clean-slate (\u65E0 backward compat)**: \u89E3\u6790\u5668\u53EA\u8BA4 `applied` / `dismissed` / `none` \u4E09\u6001;\u4EFB\u4F55\u65E0\u6CD5\u8BC6\u522B\u7684\u8001 tag (`planned` / `recalled` / `chained-from <id>`) \u4E00\u5F8B\u964D\u7EA7\u4E3A `none`(`chained-from` \u7684\u5185\u5D4C id \u4ECD\u88AB\u62A2\u6551\u4E3A sibling cite_id)\u3002\u65E7 session \u7559\u4E0B\u7684 legacy cite \u4EE5 `none` \u8BA1\u5165 cite-coverage\u3002\n- **\u5B8C\u6574\u53C2\u8003\u4E0B\u6C89** (v2.2 SK5): contract operator / skip\u00B7dismissed \u8BCD\u5178 / \u7C7B\u578B\u8DEF\u7531 / \u7A3D\u6838\u53E3\u5F84 / **\u88C1\u51B3\u9636\u68AF** (AI\u81EA\u51B3 \u2192 \u591A-LLM \u542B\u96F6\u4E0A\u4E0B\u6587\u51B7\u8BC4 \u2192 \u975E\u963B\u585E\u961F\u5217) \u7684\u6743\u5A01\u8BE6\u53C2\u5728 `fabric-review` skill \u7684 `ref/cite-contract.md` \u2014\u2014 bootstrap \u53EA\u7559\u53EF\u6267\u884C core,\u6CBB\u7406\u7EC6\u8282\u5F52 ref \u4E0D\u518D\u6491\u5927 bootstrap\u3002\n";
52
+ /**
53
+ * Canonical bootstrap body (en) — the English parallel of
54
+ * {@link BOOTSTRAP_CANONICAL_ZH}. Structurally parallel (same H2 section count,
55
+ * same protected tokens: command names, `fab_*` calls, `KB:` syntax, marker
56
+ * literals, file paths, skill names, enum values) per the content-layer parity
57
+ * gate (G-PARITY) and KT-GLD-0002 (translate prose, keep routing keys / tokens
58
+ * in English). Byte-locked: a zh-CN machine never sees this body and an en
59
+ * machine never sees the ZH one, but both are install/doctor contracts.
60
+ */
61
+ declare const BOOTSTRAP_CANONICAL_EN = "# Fabric Bootstrap\n\nThis project uses Fabric to manage cross-client AI knowledge and behavior rules. This file is synced into the managed block on both clients by `fabric install` \u2014 **do not hand-edit the block on any client**; edit here + re-run `fabric install`.\n\n## For Developers\n\nThis file is the **AI client's policy & convention config**, not dev onboarding. You don't need to read the Self-archive / Cite / Phase 0.4 details.\nAs a dev you only need to: run `fabric install` once per repo, use `fabric store bind <alias>` / `fabric store switch-write <alias>` to wire up a write store, and run `fabric doctor` when something breaks.\n**Never hand-edit `.fabric/agents.meta.json`** \u2014 derived state is rebuilt by the engine.\n\n## Dev Quickstart\n\n**What Fabric is**: a cross-client (Claude Code / Codex CLI) AI knowledge layer. Store the team/project **decisions / pitfalls / guidelines / models / processes** as markdown; hooks surface them to the AI automatically so it doesn't re-learn every time.\n\n**What you DO** vs **what the engine does (DON'T hand-edit)**:\n\n| You DO | You DON'T |\n| --- | --- |\n| Run `fabric install` once per repo | Hand-edit `.fabric/agents.meta.json` |\n| Run `fabric doctor` (--fix self-heals) on trouble | Hand-edit `.cjs` under `.claude/hooks/` |\n| Use `fabric-archive` / `fabric-review` / `fabric store ...` to manage store-backed knowledge | Hand-write any non-store knowledge root |\n| `npm install -g @fenglimg/fabric-cli@latest` to upgrade | Memorize the 35 doctor lint codes |\n\n**4-step loop**: `fabric install` (once) \u2192 bind and pick a write store \u2192 AI works normally (hook on session start + edit) \u2192 the AI writes pending entries into the current write store via MCP and returns a `pending_path` \u2192 review with the `fabric-review` skill.\n\n**Real example**: a sprite black-edge root cause was the `atlas.premultiplyAlpha` flag being inverted \u2014 once archived into the store's `knowledge/pitfalls/`, the AI auto-references it next time a similar issue shows up.\n\nSee `docs/USER-QUICKSTART.md` for the full maintainer version.\n\n## Behavior Rules\n- **Before modifying any file**: first `fab_recall(paths=[<file-being-edited>])` \u2014\u2014 a single call returns the relevant KB descriptions + native read paths (`paths[].path`). `fab_recall` no longer delivers bodies; when you need a body, do a native Read of its `paths[].path` (`Read <store>/knowledge/<type>/<id>--*.md`), which the PostToolUse hook records as `knowledge_body_read`. Lean default: descriptions + index already suffice to discover entries; read a body once on demand, don't re-inject it every turn (KT-GLD-0005).\n- **Never hand-edit `.fabric/agents.meta.json`**; the engine syncs derived state automatically \u2014 run `fabric doctor --fix` for an explicit reconcile.\n\n## Knowledge Base (KB)\n- **Discovery**: the SessionStart hook lists broad-scoped entries (scoped by `semantic_scope` across three tiers: `team` team-wide / `project:<id>` this-project-only (surfaces only in repos bound to that project) / `personal` `KP-*`, all three referenced the same way); editing a file may trigger a narrow hint via the PreToolUse hook.\n- **Usage**: go one-step `fab_recall(paths=[...])` to fetch the relevant KB descriptions + read paths in one call; when you need a body, do a native Read of its `paths[].path` (no second MCP round-trip for the body).\n- **session_id**: when calling `fab_recall`, always pass the current client session id as the `session_id` argument (Claude Code's session id is in the stdin payload; Codex's corresponding identifier likewise). This lets `fabric doctor --archive-history` and the `fabric-hint.cjs` Stop hook track cross-session debt accurately.\n- **Skills (7)**: write flow `fabric-archive` / `fabric-review` / `fabric-import`; store flow `fabric-store` / `fabric-sync` / `fabric-connect`; diagnostics `fabric-audit`.\n- **Language**: rendered per the `fabric_language` field in `.fabric/fabric-config.json`.\n- **Archive cadence nudge** (rc.36): after each batch of edits (default ~20, matching the Stop hook threshold config `archive_edit_threshold`) / a significant decision, proactively propose the `fabric-archive` skill at a suitable turn \u2014 without an archive cadence the KB slowly dies.\n- **Review backlog nudge** (rc.36): to judge the pending backlog, go through `fab_review action=\"list\"` or the `pending_path` returned by `fabric-review`; don't glob the project-local `.fabric/knowledge/pending`. When the visible pending count exceeds 10, proactively propose the `fabric-review` skill at a suitable turn to batch-review and avoid draft deadlock.\n\n## Self-archive policy (v2.0.0-rc.37 NEW-2: simplified 4 signals \u2192 2 classes)\n\n- **Trigger** (when any of the following signals appears this session, autonomously invoke the `fabric-archive` skill at the end of that turn, via the AI self-trigger entry E3_ai_self_trigger):\n 1. **User-driven normative** \u2014 the user's message explicitly expresses normative intent: `\u4EE5\u540E` / `always` / `never` / `from now on` / `\u4E0B\u6B21\u6CE8\u610F` / `\u8BB0\u4E00\u4E0B` / `\u6C38\u8FDC\u4E0D\u8981`, OR the user locks a direction with rationale after weighing \u22652 candidates, OR the user rejects a suggestion **and** states a reason (the rejection reason itself is knowledge)\n 2. **Wrong-turn-and-revert** \u2014 the AI tries path X, then after reflection switches to path Y (especially when path X is a non-obvious pitfall); covers technical-decision reversals + tool/paradigm switches + failed retries. Anchor: there is always a two-step \"negate + replace\" structure, not mere exploratory failure\n\n The old 4-state set (Normative / Decision-confirmation / Explicit-dismissal / Wrong-turn) is now merged: the first 3 are all \"explicitly expressed in the user's message\" and fold into 1 class; the 4th is \"the AI's own reflective path\" and stands alone as 1 class. Each class's underlying test is unchanged; the trigger surface did not narrow.\n\n- **Anti-trigger** (explicitly does NOT trigger):\n - Pure user questions (no normative expression)\n - Simple refactor / typo fix\n - AI's own 'insights' (must be triggered by a signal in the user's message or the AI's own wrong-turn, not a baseless \"I learned something\")\n\n- **Anti-loop, 3 guards**:\n - At most 1 self-invocation per turn\n - No repeat for the same outcome in the same session (if user_dismissed, don't self-invoke the same topic again this session)\n - Phase 2.5 viability gate as backstop (the skill still runs the gate internally, so a misjudgment won't write junk pending)\n\n- **Presentation template** (insert at the end of the turn, two lines: first the marker line for Phase 1.5 detection, then the user-facing prompt):\n ```\n self-archive policy triggered by signal: <User-driven normative|Wrong-turn-and-revert>\n Archived along the way: noticed you said `<trigger phrase>`, invoked fabric-archive to capture N candidates \u2192 the current write store's knowledge/pending/...\n If this shouldn't be recorded, reply 'undo' and I'll call fab_review reject.\n ```\n The first line is the structured marker the Phase 1.5 Trigger Gate uses to route the E3 entry (verbatim string `self-archive policy triggered by signal`, followed by a colon + the trigger signal name). From the second line on it's the user-facing prompt. Both lines MUST appear; without the marker line Phase 1.5 cannot route to E3_ai_self_trigger.\n\n Backward compat: the Phase 1.5 entry-point regex recognises both the old 4 signal names (Normative / Wrong-turn-and-revert / Decision confirmation / Explicit dismissal) and the new 2 class names, so markers from old sessions still route correctly.\n\n## Cite policy (v2.1 \u2464 recall-based: auto-accounting first, optional first-line KB: override)\n\n- **Core (recall-first auto-accounting)**: before changing any file, run `fab_recall(paths=[<file-being-edited>])` first. The system auto-associates the recalled KB as that edit's citation by \"paths recall-hit recently this session overlap the edit target\" \u2014\u2014 **no need to hand-write a first reply line**. The PreToolUse hook gives a soft nudge when it detects no relevant recall (nudge, not a gate, per KT-DEC-0007); having recalled before the edit (or already hand-written a cite) keeps it silent. Why no longer force a first line: think-then-speak, recall is the real signal that a citation happened, hand-writing a first line violates CoT and the `KB: none` escape hatch made the old rule toothless.\n- **Optional override (first-line KB:)**: you may still hand-write `KB: <id> (<\u22648-char usage>) [applied|dismissed:<reason>]` or `KB: none [<reason>]` as the first reply line to explicitly annotate/refine the citation; the cite-line parser is retained (backward compatible), old habits aren't broken.\n- **`[applied]` verification duty**: citing any id (auto or hand-written) requires first actually fetching the KB via fab_recall (and a native Read of its body path when needed), to prevent fabricated ids. Verification failing = you cannot cite.\n- **store prefix (v2.1, multi-store)**: when the read-set spans multiple stores and the same local id is shadowed across stores, the cite MUST be store-qualified: `KB: <store-alias>:<id> ...` (e.g. `KB: team:KT-DEC-0001 (auth) [applied]`); the alias is user-defined/canonical, the underlying id a UUID. A bare `KB: <id>` is still valid for a single store or no ambiguity. Citing a personal-only entry into a team artifact = strong warning (ties into the P2 write-path leak guard R5#3).\n- **contract syntax**: for decisions/pitfalls-type `[applied]` cites, append a contract tail: `\u2192 <operator> [<operator> ...]`, operator \u2208 {`edit:<glob>` `!edit:<glob>` `require:<symbol>` `forbid:<symbol>` `skip:<reason>`}. E.g. `KB: K-001 (auth) [applied] \u2192 edit:src/auth/**/*.ts !edit:src/legacy/**`.\n- **skip reason dictionary**: `sequencing | conditional | semantic | aesthetic | architectural | other:<text>`.\n- **type routing**: a models-type citation is a reference cite, no contract needed; guidelines/processes types are not yet enforced, deferred to an LLM-judge.\n- **user mentions a rule verbally without an id**: first call `fab_recall(paths)` or `fab_extract_knowledge` to look it up.\n- **dismissed reason**: enum `scope-mismatch | outdated | not-applicable | other:<text>`.\n- **`KB: none` sentinel**: two compliant reasons \u2014\u2014 `[no-relevant]` you called `fab_recall` (or hook output is visible) but no usable entry; `[not-applicable]` the current action is not in cite scope (pure exploration / read-only Bash / user Q&A). A bare `KB: none` (no suffix) is still valid, classified as `[unspecified]` (legacy compatible, annotating later is encouraged).\n- **audit**: `fabric doctor --cite-coverage [--since=7d] [--client=cc|codex|all]` reports cite coverage, including the `KB: none` sentinel breakdown. This rule does not block your work, it only records.\n- **Clean-slate (no backward compat)**: the parser recognises only the three states `applied` / `dismissed` / `none`; any unrecognised legacy tag (`planned` / `recalled` / `chained-from <id>`) degrades to `none` (`chained-from`'s embedded id is still rescued as a sibling cite_id). Legacy cites left by old sessions count toward cite-coverage as `none`.\n- **Full reference offloaded** (v2.2 SK5): the authoritative details for contract operators / skip\u00B7dismissed dictionaries / type routing / audit semantics / **adjudication ladder** (AI self-decide \u2192 multi-LLM incl. zero-context cold review \u2192 non-blocking queue) live in the `fabric-review` skill's `ref/cite-contract.md` \u2014\u2014 bootstrap keeps only the executable core, governance detail goes to ref so it doesn't bloat bootstrap.\n";
62
+ /**
63
+ * Locale-keyed canonical bodies. The single content-layer source consumers
64
+ * (install writer, doctor drift comparator) select from via
65
+ * {@link resolveBootstrapCanonical}.
66
+ */
67
+ declare const BOOTSTRAP_CANONICAL_BY_LOCALE: Record<Locale, string>;
68
+ /**
69
+ * Resolve the locale-appropriate canonical bootstrap body. Defaults to the
70
+ * machine-wide language flow ({@link resolveGlobalLocale}); pass an explicit
71
+ * locale only when the caller already resolved one (e.g. an install pipeline
72
+ * stage that resolved it once and threads it down).
73
+ */
74
+ declare function resolveBootstrapCanonical(locale?: Locale): string;
75
+ /**
76
+ * If `body` byte-equals some locale's canonical bootstrap body, return that
77
+ * locale; otherwise null. Used by the doctor drift comparator to distinguish a
78
+ * locale-switched-but-otherwise-canonical snapshot (suggest reinstall) from a
79
+ * genuinely hand-edited / stale one (fixable drift) — see G-PARITY C2.
80
+ */
81
+ declare function matchBootstrapCanonicalLocale(body: string): Locale | null;
55
82
 
56
- export { BOOTSTRAP_CANONICAL, BOOTSTRAP_MARKER_BEGIN, BOOTSTRAP_MARKER_END, BOOTSTRAP_REGEX, LEGACY_KB_MARKER_BEGIN, LEGACY_KB_MARKER_END, LEGACY_KB_REGEX };
83
+ export { BOOTSTRAP_CANONICAL_BY_LOCALE, BOOTSTRAP_CANONICAL_EN, BOOTSTRAP_CANONICAL_ZH, BOOTSTRAP_MARKER_BEGIN, BOOTSTRAP_MARKER_END, BOOTSTRAP_REGEX, matchBootstrapCanonicalLocale, resolveBootstrapCanonical };
@@ -1,18 +1,21 @@
1
1
  import {
2
- BOOTSTRAP_CANONICAL,
2
+ BOOTSTRAP_CANONICAL_BY_LOCALE,
3
+ BOOTSTRAP_CANONICAL_EN,
4
+ BOOTSTRAP_CANONICAL_ZH,
3
5
  BOOTSTRAP_MARKER_BEGIN,
4
6
  BOOTSTRAP_MARKER_END,
5
7
  BOOTSTRAP_REGEX,
6
- LEGACY_KB_MARKER_BEGIN,
7
- LEGACY_KB_MARKER_END,
8
- LEGACY_KB_REGEX
9
- } from "../chunk-TX2XZ7AW.js";
8
+ matchBootstrapCanonicalLocale,
9
+ resolveBootstrapCanonical
10
+ } from "../chunk-BDJQIOQO.js";
11
+ import "../chunk-2GLIAZ5M.js";
10
12
  export {
11
- BOOTSTRAP_CANONICAL,
13
+ BOOTSTRAP_CANONICAL_BY_LOCALE,
14
+ BOOTSTRAP_CANONICAL_EN,
15
+ BOOTSTRAP_CANONICAL_ZH,
12
16
  BOOTSTRAP_MARKER_BEGIN,
13
17
  BOOTSTRAP_MARKER_END,
14
18
  BOOTSTRAP_REGEX,
15
- LEGACY_KB_MARKER_BEGIN,
16
- LEGACY_KB_MARKER_END,
17
- LEGACY_KB_REGEX
19
+ matchBootstrapCanonicalLocale,
20
+ resolveBootstrapCanonical
18
21
  };
@@ -1,2 +1,2 @@
1
- export { e as AgentsActivationTier, a as AgentsIdentitySource, b as AgentsLayer, d as AgentsMeta, g as AgentsMetaCountersEnvelope, h as AgentsMetaKnowledgeTypeCounters, A as AgentsMetaNode, i as AgentsMetaNodeActivation, c as AgentsTopologyType, j as AiLedgerEntry, k as AuditMode, C as ClientPaths, D as DefaultLayerFilter, F as FabricConfig, l as FabricLanguage, m as HumanLedgerEntry, H as HumanLockEntry, L as LedgerEntry, M as McpPayloadLimits, R as RuleDescription, n as RuleDescriptionIndexItem } from '../index-J3Xn5h2J.js';
1
+ export { a as AgentsIdentitySource, c as AgentsMeta, d as AgentsMetaCountersEnvelope, e as AgentsMetaKnowledgeTypeCounters, A as AgentsMetaNode, b as AgentsTopologyType, g as AiLedgerEntry, h as AuditMode, C as ClientPaths, D as DefaultLayerFilter, F as FabricConfig, i as FabricLanguage, j as HumanLedgerEntry, H as HumanLockEntry, L as LedgerEntry, M as McpPayloadLimits, R as RuleDescription, k as RuleDescriptionIndexItem } from '../index-D_gT1CEA.js';
2
2
  import 'zod';
@@ -0,0 +1,8 @@
1
+ type Locale = "en" | "zh-CN";
2
+ interface Messages {
3
+ [key: string]: string;
4
+ }
5
+ type TranslationKey = string;
6
+ type Translator = (key: TranslationKey, vars?: Record<string, string>) => string;
7
+
8
+ export type { Locale as L, Messages as M, Translator as T, TranslationKey as a };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fenglimg/fabric-shared",
3
- "version": "2.2.0-rc.1",
3
+ "version": "2.2.0-rc.11",
4
4
  "description": "Fabric shared types — Zod schemas, i18n, atomic-write helpers, MCP payload guard, error classes. Consumed by @fenglimg/fabric-server + @fenglimg/fabric-cli.",
5
5
  "license": "MIT",
6
6
  "author": "wangzhichao <fenglimg90@gmail.com>",
@@ -83,6 +83,7 @@
83
83
  "build": "tsup src/index.ts src/i18n/index.ts src/types/index.ts src/node.ts src/node/atomic-write.ts src/node/mcp-payload-guard.ts src/errors/index.ts src/schemas/api-contracts.ts src/templates/bootstrap-canonical.ts --format esm --dts --clean",
84
84
  "dev": "tsup src/index.ts src/i18n/index.ts src/types/index.ts src/node.ts src/node/atomic-write.ts src/node/mcp-payload-guard.ts src/errors/index.ts src/schemas/api-contracts.ts src/templates/bootstrap-canonical.ts --format esm --dts --watch",
85
85
  "test": "vitest run",
86
- "test:coverage": "vitest run --coverage"
86
+ "test:coverage": "vitest run --coverage",
87
+ "test:smoke": "vitest run --config vitest.smoke.config.ts"
87
88
  }
88
89
  }
@@ -1,102 +0,0 @@
1
- // src/templates/bootstrap-canonical.ts
2
- var BOOTSTRAP_MARKER_BEGIN = "<!-- fabric:bootstrap:begin -->";
3
- var BOOTSTRAP_MARKER_END = "<!-- fabric:bootstrap:end -->";
4
- var LEGACY_KB_MARKER_BEGIN = "<!-- fabric:knowledge-base:begin -->";
5
- var LEGACY_KB_MARKER_END = "<!-- fabric:knowledge-base:end -->";
6
- var BOOTSTRAP_REGEX = /(?:\r?\n){0,2}<!-- fabric:bootstrap:begin -->[\s\S]*?<!-- fabric:bootstrap:end -->/;
7
- var LEGACY_KB_REGEX = /(?:\r?\n){0,2}<!-- fabric:knowledge-base:begin -->[\s\S]*?<!-- fabric:knowledge-base:end -->/;
8
- var BOOTSTRAP_CANONICAL = `# Fabric Bootstrap
9
-
10
- \u672C\u9879\u76EE\u4F7F\u7528 Fabric \u7BA1\u7406\u8DE8\u5BA2\u6237\u7AEF AI \u77E5\u8BC6\u4E0E\u884C\u4E3A\u89C4\u5219\u3002\u672C\u6587\u4EF6\u7531 \`fabric install\` \u540C\u6B65\u5230\u4E09\u7AEF managed block,**\u4E0D\u8981\u624B\u52A8\u7F16\u8F91\u4E09\u7AEF\u7684 block**,\u53EA\u6539\u8FD9\u91CC + \u91CD\u8DD1 \`fabric install\`\u3002
11
-
12
- ## For Developers
13
-
14
- \u8FD9\u4E2A\u6587\u4EF6\u662F **AI \u5BA2\u6237\u7AEF\u7684\u7B56\u7565\u4E0E\u89C4\u7EA6\u914D\u7F6E**,\u4E0D\u662F dev onboarding\u3002\u4F60\u4E0D\u9700\u8981\u8BFB Self-archive / Cite / Phase 0.4 \u7B49\u7EC6\u8282\u3002
15
- \u4F5C\u4E3A dev \u4F60\u53EA\u9700\u8981:\u5728\u6BCF\u4E2A repo \u8DD1\u4E00\u6B21 \`fabric install\`,\u51FA\u95EE\u9898\u8DD1 \`fabric doctor\`,\u5728 \`.fabric/knowledge/<type>/\` \u4E0B\u5199 markdown\u3002
16
- **\u4E25\u7981\u624B\u52A8\u7F16\u8F91 \`.fabric/agents.meta.json\`** \u2014 \u6D3E\u751F\u72B6\u6001\u7531 engine \u91CD\u5EFA\u3002
17
-
18
- ## 5 \u5206\u949F\u4E0A\u624B (Dev Quickstart)
19
-
20
- **Fabric \u662F\u4EC0\u4E48**:\u8DE8\u5BA2\u6237\u7AEF(Claude Code / Codex CLI / Cursor)\u7684 AI \u77E5\u8BC6\u5C42\u3002\u628A\u56E2\u961F/\u9879\u76EE\u7684 **decisions / pitfalls / guidelines / models / processes** \u5B58\u4E3A markdown,hook \u81EA\u52A8 surface \u7ED9 AI,\u8BA9 AI \u4E0D\u7528\u6BCF\u6B21\u91CD\u5B66\u3002
21
-
22
- **\u4F60\u8981\u505A\u7684 (DO)** vs **engine \u81EA\u52A8\u7684 (DON'T \u624B\u52A8)**:
23
-
24
- | \u4F60 DO | \u4F60 DON'T |
25
- | --- | --- |
26
- | \u6BCF\u4E2A repo \u8DD1\u4E00\u6B21 \`fabric install\` | \u624B\u7F16 \`.fabric/agents.meta.json\` |
27
- | \u5F02\u5E38\u65F6\u8DD1 \`fabric doctor\` (--fix \u81EA\u6108) | \u624B\u7F16 \`.claude/hooks/\` \u4E0B \`.cjs\` |
28
- | \u5728 \`.fabric/knowledge/<type>/\` \u4E0B\u5199 markdown | \u64CD\u5FC3 Phase 0.4 / E3 / cite policy |
29
- | \`npm install -g @fenglimg/fabric-cli@latest\` \u5347\u7EA7 | \u80CC 35 \u6761 doctor lint \u4EE3\u7801 |
30
-
31
- **4 \u6B65\u5FAA\u73AF**: \`fabric install\` (\u4E00\u6B21) \u2192 AI \u6B63\u5E38\u5DE5\u4F5C (hook on session start + edit) \u2192 AI \u63D0\u8BAE\u6761\u76EE\u5165 \`.fabric/knowledge/pending/\` \u2192 \u7528 \`fabric-review\` skill \u6216 \`fabric doctor --fix\` \u5BA1\u6838\u5F52\u6863\u3002
32
-
33
- **\u771F\u4F8B**:\u67D0 sprite \u9ED1\u8FB9 root cause \u662F \`atlas.premultiplyAlpha\` flag \u53CD\u5411 \u2014 \u5199\u8FDB \`.fabric/knowledge/pitfalls/\` \u540E,\u4E0B\u6B21\u540C\u7C7B\u95EE\u9898 AI \u81EA\u52A8 reference\u3002
34
-
35
- \u5B8C\u6574 maintainer \u7248\u89C1 \`docs/USER-QUICKSTART.md\`\u3002
36
-
37
- ## \u884C\u4E3A\u89C4\u5219
38
- - **\u4FEE\u6539\u4EFB\u4F55\u6587\u4EF6\u524D**:\u4F18\u5148\u5355\u6B65 \`fab_recall(paths=[<\u88AB\u6539\u6587\u4EF6>])\` \u2014\u2014 \u4E00\u6B21\u8C03\u7528\u76F4\u63A5\u62FF\u56DE\u6240\u6709\u76F8\u5173 KB \u6B63\u6587(rc.37+ \u9ED8\u8BA4\u8DEF\u5F84,\u7701\u6389\u624B\u52A8\u6311 id \u7684\u73AF\u8282)\u3002**\u4EC5\u5F53\u5355\u6B65\u62C9\u56DE\u7684\u6B63\u6587\u8FC7\u591A\u3001\u5BFC\u81F4\u4E0A\u4E0B\u6587\u8FC7\u8F7D\u9700\u7CBE\u786E\u88C1\u526A\u566A\u97F3\u65F6**\u624D\u8D70\u4E24\u6B65:\u5148 \`fab_plan_context(paths=[...])\` \u62FF \`selection_token\` + \u9876\u5C42 \`candidates[]\`(\u4ECE \`candidates[].stable_id\` \u6311),\u518D \`fab_get_knowledge_sections({ selection_token, ai_selected_stable_ids: [<id>...] })\` \u53D6\u6B63\u6587\u3002
39
- - **\`.fabric/agents.meta.json\` \u4E25\u7981\u624B\u52A8\u7F16\u8F91**;engine \u4F1A\u81EA\u52A8\u540C\u6B65\u6D3E\u751F\u72B6\u6001,\u663E\u5F0F reconcile \u8DD1 \`fabric doctor --fix\`\u3002
40
-
41
- ## \u77E5\u8BC6\u5E93(KB)
42
- - **Discovery**:SessionStart hook \u5217 broad-scoped \u6761\u76EE(\u542B personal layer \`KP-*\` \u6761\u76EE,\u5F15\u7528\u65B9\u5F0F\u76F8\u540C);edit \u6587\u4EF6\u65F6 PreToolUse hook \u53EF\u80FD\u89E6\u53D1 narrow hint\u3002
43
- - **Usage**:\u5E38\u6001\u8D70\u5355\u6B65 \`fab_recall(paths=[...])\` \u4E00\u6B21\u62FF\u56DE\u76F8\u5173 KB \u6B63\u6587\u3002\u4EC5\u5F53\u5355\u6B65\u6B63\u6587\u8FC7\u591A\u81F4\u4E0A\u4E0B\u6587\u8FC7\u8F7D\u3001\u9700\u7CBE\u786E\u88C1\u526A\u566A\u97F3\u65F6\u624D\u4E24\u6B65:\`fab_plan_context(paths=[...])\` \u8FD4\u56DE \`selection_token\` + \u9876\u5C42 \`candidates[]\`,\u518D \`fab_get_knowledge_sections({ selection_token, ai_selected_stable_ids: [<\u4ECE candidates[].stable_id \u6311>...] })\` \u62C9\u5168\u6587;\`selection_token\` \u5FC5\u987B\u6765\u81EA\u6700\u8FD1\u4E00\u6B21 \`fab_plan_context\`,\u4E0D\u53EF\u51ED\u7A7A\u7F16\u9020\u3002
44
- - **session_id**: \u8C03\u7528 \`fab_recall\` / \`fab_plan_context\` \u65F6, \u52A1\u5FC5\u628A\u5F53\u524D client session id \u4F5C\u4E3A \`session_id\` \u53C2\u6570\u4F20\u5165(Claude Code \u7684 session id \u5728 stdin payload \u4E2D, Codex \u7684\u5BF9\u5E94 identifier \u540C\u7406)\u3002\u8FD9\u80FD\u8BA9 \`fabric doctor --archive-history\` \u4E0E archive-hint hook \u51C6\u786E\u8BC6\u522B\u8DE8\u4F1A\u8BDD debt \u72B6\u6001\u3002
45
- - **Write flows**:\`fabric-archive\` / \`fabric-review\` / \`fabric-import\` \u4E09\u4E2A Skills\u3002
46
- - **Language**:\u6E32\u67D3\u6309 \`.fabric/fabric-config.json\` \u7684 \`fabric_language\` \u5B57\u6BB5\u3002
47
- - **Archive cadence nudge** (rc.36): \u6BCF\u5B8C\u6210 5+ \u6B21 Edit / \u663E\u8457 decision \u540E,\u5728\u5408\u9002\u56DE\u5408\u4E3B\u52A8 propose \u8C03 \`fabric-archive\` skill \u2014 archive \u6CA1\u5EFA\u7ACB\u9891\u7387\u4F1A\u8BA9 KB \u6162\u901F\u6B7B\u6389\u3002
48
- - **Review backlog nudge** (rc.36): \`.fabric/knowledge/pending/\` \u7D2F\u79EF >10 \u6761\u65F6,\u5728\u5408\u9002\u56DE\u5408\u4E3B\u52A8 propose \u8C03 \`fabric-review\` skill \u6279\u91CF\u5BA1,\u907F\u514D draft \u5361\u6B7B\u3002
49
-
50
- ## Self-archive policy (v2.0.0-rc.37 NEW-2: \u7B80\u5316 4 \u4FE1\u53F7 \u2192 2 \u5927\u7C7B)
51
-
52
- - **\u89E6\u53D1** (\u672C\u4F1A\u8BDD\u51FA\u73B0\u4EE5\u4E0B\u4EFB\u4E00\u4FE1\u53F7, \u5728\u8BE5 turn \u56DE\u590D\u672B\u5C3E\u81EA\u4E3B\u8C03\u7528 \`fabric-archive\` skill, \u8D70 AI \u81EA\u89E6\u53D1\u5165\u53E3 E3_ai_self_trigger):
53
- 1. **User-driven normative** \u2014 \u7528\u6237\u6D88\u606F\u4E2D\u663E\u5F0F\u8868\u8FBE normative \u610F\u56FE: \`\u4EE5\u540E\` / \`always\` / \`never\` / \`from now on\` / \`\u4E0B\u6B21\u6CE8\u610F\` / \`\u8BB0\u4E00\u4E0B\` / \`\u6C38\u8FDC\u4E0D\u8981\`, OR \u7528\u6237\u5728 \u22652 \u5019\u9009\u95F4\u6743\u8861\u540E\u7ED9\u51FA rationale \u9501\u5B9A\u65B9\u5411, OR \u7528\u6237\u62D2\u4E86\u67D0\u5EFA\u8BAE**\u5E76**\u8BF4\u4E86\u539F\u56E0 (\u62D2\u7EDD\u7406\u7531\u672C\u8EAB\u662F\u77E5\u8BC6)
54
- 2. **Wrong-turn-and-revert** \u2014 AI \u5C1D\u8BD5 path X, \u53CD\u601D\u540E\u6539\u8D70 path Y (\u5C24\u5176\u5F53 path X \u662F\u975E\u663E\u7136\u8E29\u5751); \u6DB5\u76D6\u6280\u672F\u51B3\u7B56\u53CD\u8F6C + \u5DE5\u5177/\u8303\u5F0F\u5207\u6362 + \u5931\u8D25\u91CD\u8BD5\u3002Anchor: \u4E00\u5B9A\u6709"\u5426\u5B9A+\u66FF\u4EE3"\u7684\u4E24\u6B65\u7ED3\u6784, \u4E0D\u662F\u5355\u7EAF\u63A2\u7D22\u5931\u8D25
55
-
56
- \u8001 4-state (Normative / Decision-confirmation / Explicit-dismissal / Wrong-turn) \u73B0\u5408\u5E76: \u524D 3 \u4E2A\u5168\u662F"\u7528\u6237\u6D88\u606F\u4E2D\u663E\u5F0F\u8868\u8FBE"\u6027\u8D28, \u6298\u6210 1 \u7C7B; \u7B2C 4 \u662F"AI \u81EA\u5DF1\u7684\u53CD\u601D\u8DEF\u5F84", \u72EC\u7ACB 1 \u7C7B\u3002\u4E24\u7C7B\u5404\u81EA\u7684\u672C\u8D28\u5224\u522B\u4E0D\u53D8, \u89E6\u53D1\u9762\u6CA1\u53D8\u7A84\u3002
57
-
58
- - **Anti-trigger** (\u660E\u786E\u4E0D\u89E6\u53D1):
59
- - \u7528\u6237\u7EAF\u8BE2\u95EE (\u65E0 normative \u8868\u8FBE)
60
- - \u7B80\u5355 refactor / typo fix
61
- - AI \u81EA\u5DF1\u4EA7\u751F\u7684'\u6D1E\u5BDF' (\u5FC5\u987B\u7531\u7528\u6237\u6D88\u606F\u4E2D\u4FE1\u53F7\u6216 AI \u81EA\u5DF1\u7684 wrong-turn \u89E6\u53D1, \u4E0D\u662F\u51ED\u7A7A"\u6211\u5B66\u5230\u4E86"\u6027\u8D28)
62
-
63
- - **Anti-loop \u4E09\u6761\u9632\u62A4**:
64
- - \u540C turn \u6700\u591A\u81EA\u8C03 1 \u6B21
65
- - \u540C session \u540C outcome \u4E0D\u91CD\u590D (\u82E5 user_dismissed, \u672C\u4F1A\u8BDD\u4E0D\u518D\u81EA\u8C03\u76F8\u540C\u4E3B\u9898)
66
- - Phase 2.5 viability gate \u515C\u5E95 (skill \u5185\u90E8\u4ECD\u8DD1 gate, AI \u5224\u9519\u4E0D\u4F1A\u4E71\u5199 pending)
67
-
68
- - **\u5448\u73B0\u6A21\u677F** (turn \u672B\u5C3E\u63D2\u5165, \u4E24\u884C: \u5148 marker \u884C\u4F9B Phase 1.5 \u68C0\u6D4B, \u518D user-facing \u63D0\u793A):
69
- \`\`\`
70
- self-archive policy triggered by signal: <User-driven normative|Wrong-turn-and-revert>
71
- \u987A\u624B\u5F52\u6863: \u6CE8\u610F\u5230\u4F60\u8BF4 \`<\u89E6\u53D1\u77ED\u8BED>\`, \u5DF2\u8C03\u7528 fabric-archive \u6293 N \u6761\u5019\u9009 \u2192 .fabric/knowledge/pending/...
72
- \u82E5\u4E0D\u8BE5\u8BB0, \u7B54 '\u64A4\u9500' \u6211\u4F1A\u8C03 fab_review reject\u3002
73
- \`\`\`
74
- \u7B2C\u4E00\u884C\u662F Phase 1.5 Trigger Gate \u8BC6\u522B E3 \u5165\u53E3\u7684 structured marker (verbatim \u5B57\u7B26\u4E32 \`self-archive policy triggered by signal\`, \u540E\u63A5\u5192\u53F7 + \u89E6\u53D1\u4FE1\u53F7\u540D)\u3002\u7B2C\u4E8C\u884C\u8D77\u662F\u7ED9\u7528\u6237\u770B\u7684\u4E2D\u6587\u63D0\u793A\u3002\u4E24\u884C\u90FD\u5FC5\u987B\u51FA\u73B0; \u7F3A marker \u884C Phase 1.5 \u65E0\u6CD5\u8DEF\u7531\u5230 E3_ai_self_trigger\u3002
75
-
76
- Backward compat: Phase 1.5 entry-point regex \u540C\u65F6\u8BC6\u522B\u8001 4 \u4E2A\u4FE1\u53F7\u540D (Normative / Wrong-turn-and-revert / Decision confirmation / Explicit dismissal) \u4E0E\u65B0 2 \u5927\u7C7B\u540D, \u65E7 session marker \u4ECD\u80FD\u6B63\u786E\u8DEF\u7531\u3002
77
-
78
- ## Cite policy (v2.0.0-rc.37 NEW-1: \u7B80\u5316 4-state \u2192 2-state)
79
-
80
- - **\u89E6\u53D1**: \u505A edit / decide / propose plan \u4E4B\u524D,**\u56DE\u590D\u9996\u884C**\u5FC5\u987B\u5199 \`KB: <id> (<\u22648\u5B57 \u7528\u6CD5>) [applied|dismissed:<reason>]\` \u6216 \`KB: none [<reason>]\`\u3002
81
- - **\`[applied]\` \u9A8C\u8BC1\u4E49\u52A1**: \u5F15\u7528\u4EFB\u4F55 id \u524D\u5FC5\u987B\u5148\u7528 fab_recall (\u6216\u4E24\u6B65 fab_plan_context \u2192 fab_get_knowledge_sections) \u5B9E\u9645\u6293 KB body, \u9632\u6B62\u7F16\u9020 id\u3002\u9A8C\u8BC1\u4E0D\u901A\u8FC7 = \u4E0D\u80FD cite\u3002
82
- - **store \u524D\u7F00 (v2.1, \u591A store)**: \u5F53 read-set \u542B\u591A\u4E2A store \u4E14\u540C\u4E00 local id \u5728\u591A store \u95F4 shadow \u65F6,cite \u5FC5\u987B store-qualified: \`KB: <store-alias>:<id> ...\`(\u5982 \`KB: team:KT-DEC-0001 (auth) [applied]\`);alias \u7528\u6237\u81EA\u5B9A/canonical,\u5E95\u5C42 UUID\u3002\u5355 store \u6216\u65E0\u6B67\u4E49\u65F6\u88F8 \`KB: <id>\` \u4ECD valid\u3002personal-only \u6761\u76EE cite \u8FDB\u56E2\u961F\u4EA7\u7269=\u5F3A warning(\u63A5 P2 \u5199\u8DEF\u5F84\u9632\u6CC4\u6F0F R5#3)\u3002
83
- - **contract \u8BED\u6CD5**: decisions/pitfalls \u7C7B \`[applied]\` cite \u5C3E\u6BB5\u52A0 contract: \`\u2192 <operator> [<operator> ...]\`,operator \u2208 {\`edit:<glob>\` \`!edit:<glob>\` \`require:<symbol>\` \`forbid:<symbol>\` \`skip:<reason>\`}\u3002\u4F8B:\`KB: K-001 (auth) [applied] \u2192 edit:src/auth/**/*.ts !edit:src/legacy/**\`\u3002
84
- - **skip reason \u8BCD\u5178**: \`sequencing | conditional | semantic | aesthetic | architectural | other:<text>\`\u3002
85
- - **type \u8DEF\u7531**: models \u7C7B\u5F15\u7528\u4E3A reference cite,\u4E0D\u9700\u8981 contract;guidelines/processes \u7C7B\u6682\u4E0D\u5F3A\u5236,\u63A8\u540E LLM-judge\u3002
86
- - **\u7528\u6237\u53E3\u5934\u63D0\u89C4\u5219\u6CA1\u7ED9 id**: \u5148\u8C03 \`fab_recall(paths)\` \u6216 \`fab_extract_knowledge\` \u53CD\u67E5\u3002
87
- - **dismissed reason**: \u679A\u4E3E \`scope-mismatch | outdated | not-applicable | other:<text>\`\u3002
88
- - **\`KB: none\` sentinel**: \u679A\u4E3E\u4E24\u79CD\u5408\u89C4\u7406\u7531\u2014\u2014\`[no-relevant]\` \u5DF2\u8C03 \`fab_recall\` / \`fab_plan_context\`(\u6216 hook \u8F93\u51FA\u53EF\u89C1)\u4F46\u65E0\u53EF\u7528\u6761\u76EE;\`[not-applicable]\` \u5F53\u524D\u52A8\u4F5C\u4E0D\u5728 cite \u8303\u56F4(\u7EAF\u63A2\u7D22 / Bash \u53EA\u8BFB / \u7528\u6237\u95EE\u7B54)\u3002\u88F8 \`KB: none\`(\u65E0\u540E\u7F00)\u4ECD\u7136 valid,\u5F52\u7C7B\u4E3A \`[unspecified]\`(legacy \u517C\u5BB9,\u9F13\u52B1\u540E\u7EED\u8865\u6CE8)\u3002
89
- - **\u7A3D\u6838**: \`fabric doctor --cite-coverage [--since=7d] [--client=cc|codex|all]\` \u8F93\u51FA cite \u8986\u76D6\u7387,\u542B \`KB: none\` sentinel \u62C6\u5206\u3002\u672C\u89C4\u5219\u4E0D\u963B\u65AD\u4F60\u5DE5\u4F5C,\u53EA\u8BB0\u5F55\u3002
90
- - **Backward compat**: \u89E3\u6790\u5668\u540C\u65F6\u63A5\u53D7\u8001 4-state tags (\`planned\` / \`recalled\` / \`chained-from <id>\`) \u2014 \u90FD\u6620\u5C04\u5230 \`[applied]\` \u8BED\u4E49,gradually \u8FC1\u5230\u65B0\u7B80\u5316\u5F62\u6001\u5373\u53EF,\u65E7 session \u7559\u4E0B\u7684 cite \u4ECD\u7136\u8BA1\u5165 cite-coverage\u3002
91
- - **\u5B8C\u6574\u53C2\u8003\u4E0B\u6C89** (v2.2 SK5): contract operator / skip\xB7dismissed \u8BCD\u5178 / \u7C7B\u578B\u8DEF\u7531 / \u7A3D\u6838\u53E3\u5F84 / **\u88C1\u51B3\u9636\u68AF** (AI\u81EA\u51B3 \u2192 \u591A-LLM \u542B\u96F6\u4E0A\u4E0B\u6587\u51B7\u8BC4 \u2192 \u975E\u963B\u585E\u961F\u5217) \u7684\u6743\u5A01\u8BE6\u53C2\u5728 \`fabric-review\` skill \u7684 \`ref/cite-contract.md\` \u2014\u2014 bootstrap \u53EA\u7559\u53EF\u6267\u884C core,\u6CBB\u7406\u7EC6\u8282\u5F52 ref \u4E0D\u518D\u6491\u5927 bootstrap\u3002
92
- `;
93
-
94
- export {
95
- BOOTSTRAP_MARKER_BEGIN,
96
- BOOTSTRAP_MARKER_END,
97
- LEGACY_KB_MARKER_BEGIN,
98
- LEGACY_KB_MARKER_END,
99
- BOOTSTRAP_REGEX,
100
- LEGACY_KB_REGEX,
101
- BOOTSTRAP_CANONICAL
102
- };