@mycodemap/mycodemap 1.9.0 → 2.0.0

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.
Files changed (194) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +138 -928
  3. package/README.zh-CN.md +1096 -0
  4. package/dist/cli/commands/analyze-options.d.ts.map +1 -1
  5. package/dist/cli/commands/analyze-options.js +8 -0
  6. package/dist/cli/commands/analyze-options.js.map +1 -1
  7. package/dist/cli/commands/analyze.d.ts.map +1 -1
  8. package/dist/cli/commands/analyze.js +60 -41
  9. package/dist/cli/commands/analyze.js.map +1 -1
  10. package/dist/cli/commands/benchmark.d.ts +8 -0
  11. package/dist/cli/commands/benchmark.d.ts.map +1 -0
  12. package/dist/cli/commands/benchmark.js +150 -0
  13. package/dist/cli/commands/benchmark.js.map +1 -0
  14. package/dist/cli/commands/deps.d.ts +2 -1
  15. package/dist/cli/commands/deps.d.ts.map +1 -1
  16. package/dist/cli/commands/deps.js +107 -78
  17. package/dist/cli/commands/deps.js.map +1 -1
  18. package/dist/cli/commands/doctor.d.ts +3 -0
  19. package/dist/cli/commands/doctor.d.ts.map +1 -0
  20. package/dist/cli/commands/doctor.js +34 -0
  21. package/dist/cli/commands/doctor.js.map +1 -0
  22. package/dist/cli/commands/query.d.ts +1 -0
  23. package/dist/cli/commands/query.d.ts.map +1 -1
  24. package/dist/cli/commands/query.js +123 -140
  25. package/dist/cli/commands/query.js.map +1 -1
  26. package/dist/cli/doctor/check-agent.d.ts +3 -0
  27. package/dist/cli/doctor/check-agent.d.ts.map +1 -0
  28. package/dist/cli/doctor/check-agent.js +60 -0
  29. package/dist/cli/doctor/check-agent.js.map +1 -0
  30. package/dist/cli/doctor/check-ghost-commands.d.ts +3 -0
  31. package/dist/cli/doctor/check-ghost-commands.d.ts.map +1 -0
  32. package/dist/cli/doctor/check-ghost-commands.js +86 -0
  33. package/dist/cli/doctor/check-ghost-commands.js.map +1 -0
  34. package/dist/cli/doctor/check-native-deps.d.ts +3 -0
  35. package/dist/cli/doctor/check-native-deps.d.ts.map +1 -0
  36. package/dist/cli/doctor/check-native-deps.js +54 -0
  37. package/dist/cli/doctor/check-native-deps.js.map +1 -0
  38. package/dist/cli/doctor/check-workspace-drift.d.ts +3 -0
  39. package/dist/cli/doctor/check-workspace-drift.d.ts.map +1 -0
  40. package/dist/cli/doctor/check-workspace-drift.js +83 -0
  41. package/dist/cli/doctor/check-workspace-drift.js.map +1 -0
  42. package/dist/cli/doctor/formatter.d.ts +20 -0
  43. package/dist/cli/doctor/formatter.d.ts.map +1 -0
  44. package/dist/cli/doctor/formatter.js +91 -0
  45. package/dist/cli/doctor/formatter.js.map +1 -0
  46. package/dist/cli/doctor/index.d.ts +8 -0
  47. package/dist/cli/doctor/index.d.ts.map +1 -0
  48. package/dist/cli/doctor/index.js +9 -0
  49. package/dist/cli/doctor/index.js.map +1 -0
  50. package/dist/cli/doctor/orchestrator.d.ts +3 -0
  51. package/dist/cli/doctor/orchestrator.d.ts.map +1 -0
  52. package/dist/cli/doctor/orchestrator.js +37 -0
  53. package/dist/cli/doctor/orchestrator.js.map +1 -0
  54. package/dist/cli/doctor/types.d.ts +19 -0
  55. package/dist/cli/doctor/types.d.ts.map +1 -0
  56. package/dist/cli/doctor/types.js +4 -0
  57. package/dist/cli/doctor/types.js.map +1 -0
  58. package/dist/cli/index.js +72 -20
  59. package/dist/cli/index.js.map +1 -1
  60. package/dist/cli/interface-contract/commands/analyze.d.ts +3 -0
  61. package/dist/cli/interface-contract/commands/analyze.d.ts.map +1 -0
  62. package/dist/cli/interface-contract/commands/analyze.js +138 -0
  63. package/dist/cli/interface-contract/commands/analyze.js.map +1 -0
  64. package/dist/cli/interface-contract/commands/benchmark.d.ts +3 -0
  65. package/dist/cli/interface-contract/commands/benchmark.d.ts.map +1 -0
  66. package/dist/cli/interface-contract/commands/benchmark.js +107 -0
  67. package/dist/cli/interface-contract/commands/benchmark.js.map +1 -0
  68. package/dist/cli/interface-contract/commands/deps.d.ts +3 -0
  69. package/dist/cli/interface-contract/commands/deps.d.ts.map +1 -0
  70. package/dist/cli/interface-contract/commands/deps.js +129 -0
  71. package/dist/cli/interface-contract/commands/deps.js.map +1 -0
  72. package/dist/cli/interface-contract/commands/doctor.d.ts +3 -0
  73. package/dist/cli/interface-contract/commands/doctor.d.ts.map +1 -0
  74. package/dist/cli/interface-contract/commands/doctor.js +59 -0
  75. package/dist/cli/interface-contract/commands/doctor.js.map +1 -0
  76. package/dist/cli/interface-contract/commands/index.d.ts +9 -0
  77. package/dist/cli/interface-contract/commands/index.d.ts.map +1 -0
  78. package/dist/cli/interface-contract/commands/index.js +18 -0
  79. package/dist/cli/interface-contract/commands/index.js.map +1 -0
  80. package/dist/cli/interface-contract/commands/init.d.ts +3 -0
  81. package/dist/cli/interface-contract/commands/init.d.ts.map +1 -0
  82. package/dist/cli/interface-contract/commands/init.js +87 -0
  83. package/dist/cli/interface-contract/commands/init.js.map +1 -0
  84. package/dist/cli/interface-contract/commands/query.d.ts +3 -0
  85. package/dist/cli/interface-contract/commands/query.d.ts.map +1 -0
  86. package/dist/cli/interface-contract/commands/query.js +185 -0
  87. package/dist/cli/interface-contract/commands/query.js.map +1 -0
  88. package/dist/cli/interface-contract/index.d.ts +22 -0
  89. package/dist/cli/interface-contract/index.d.ts.map +1 -0
  90. package/dist/cli/interface-contract/index.js +41 -0
  91. package/dist/cli/interface-contract/index.js.map +1 -0
  92. package/dist/cli/interface-contract/schema.d.ts +30 -0
  93. package/dist/cli/interface-contract/schema.d.ts.map +1 -0
  94. package/dist/cli/interface-contract/schema.js +72 -0
  95. package/dist/cli/interface-contract/schema.js.map +1 -0
  96. package/dist/cli/interface-contract/types.d.ts +76 -0
  97. package/dist/cli/interface-contract/types.d.ts.map +1 -0
  98. package/dist/cli/interface-contract/types.js +4 -0
  99. package/dist/cli/interface-contract/types.js.map +1 -0
  100. package/dist/cli/output/apply-suggestion.d.ts +12 -0
  101. package/dist/cli/output/apply-suggestion.d.ts.map +1 -0
  102. package/dist/cli/output/apply-suggestion.js +29 -0
  103. package/dist/cli/output/apply-suggestion.js.map +1 -0
  104. package/dist/cli/output/error-codes.d.ts +22 -0
  105. package/dist/cli/output/error-codes.d.ts.map +1 -0
  106. package/dist/cli/output/error-codes.js +82 -0
  107. package/dist/cli/output/error-codes.js.map +1 -0
  108. package/dist/cli/output/errors.d.ts +14 -0
  109. package/dist/cli/output/errors.d.ts.map +1 -0
  110. package/dist/cli/output/errors.js +170 -0
  111. package/dist/cli/output/errors.js.map +1 -0
  112. package/dist/cli/output/index.d.ts +13 -0
  113. package/dist/cli/output/index.d.ts.map +1 -0
  114. package/dist/cli/output/index.js +11 -0
  115. package/dist/cli/output/index.js.map +1 -0
  116. package/dist/cli/output/mode.d.ts +12 -0
  117. package/dist/cli/output/mode.d.ts.map +1 -0
  118. package/dist/cli/output/mode.js +23 -0
  119. package/dist/cli/output/mode.js.map +1 -0
  120. package/dist/cli/output/progress.d.ts +9 -0
  121. package/dist/cli/output/progress.d.ts.map +1 -0
  122. package/dist/cli/output/progress.js +65 -0
  123. package/dist/cli/output/progress.js.map +1 -0
  124. package/dist/cli/output/render.d.ts +11 -0
  125. package/dist/cli/output/render.d.ts.map +1 -0
  126. package/dist/cli/output/render.js +18 -0
  127. package/dist/cli/output/render.js.map +1 -0
  128. package/dist/cli/output/types.d.ts +53 -0
  129. package/dist/cli/output/types.d.ts.map +1 -0
  130. package/dist/cli/output/types.js +14 -0
  131. package/dist/cli/output/types.js.map +1 -0
  132. package/dist/cli/output/wasm-fallback.d.ts +13 -0
  133. package/dist/cli/output/wasm-fallback.d.ts.map +1 -0
  134. package/dist/cli/output/wasm-fallback.js +92 -0
  135. package/dist/cli/output/wasm-fallback.js.map +1 -0
  136. package/dist/cli/tree-sitter-check.d.ts +6 -1
  137. package/dist/cli/tree-sitter-check.d.ts.map +1 -1
  138. package/dist/cli/tree-sitter-check.js +23 -1
  139. package/dist/cli/tree-sitter-check.js.map +1 -1
  140. package/dist/infrastructure/storage/adapters/SQLiteStorage.d.ts.map +1 -1
  141. package/dist/infrastructure/storage/adapters/SQLiteStorage.js +2 -2
  142. package/dist/infrastructure/storage/adapters/SQLiteStorage.js.map +1 -1
  143. package/dist/infrastructure/storage/adapters/sqlite-loader.d.ts +23 -0
  144. package/dist/infrastructure/storage/adapters/sqlite-loader.d.ts.map +1 -0
  145. package/dist/infrastructure/storage/adapters/sqlite-loader.js +210 -0
  146. package/dist/infrastructure/storage/adapters/sqlite-loader.js.map +1 -0
  147. package/dist/orchestrator/types.d.ts +2 -0
  148. package/dist/orchestrator/types.d.ts.map +1 -1
  149. package/dist/orchestrator/types.js.map +1 -1
  150. package/dist/parser/implementations/tree-sitter-loader.d.ts +16 -0
  151. package/dist/parser/implementations/tree-sitter-loader.d.ts.map +1 -0
  152. package/dist/parser/implementations/tree-sitter-loader.js +105 -0
  153. package/dist/parser/implementations/tree-sitter-loader.js.map +1 -0
  154. package/dist/parser/implementations/tree-sitter-parser.d.ts +3 -0
  155. package/dist/parser/implementations/tree-sitter-parser.d.ts.map +1 -1
  156. package/dist/parser/implementations/tree-sitter-parser.js +8 -3
  157. package/dist/parser/implementations/tree-sitter-parser.js.map +1 -1
  158. package/dist/server/mcp/schema-adapter.d.ts +45 -0
  159. package/dist/server/mcp/schema-adapter.d.ts.map +1 -0
  160. package/dist/server/mcp/schema-adapter.js +290 -0
  161. package/dist/server/mcp/schema-adapter.js.map +1 -0
  162. package/dist/server/mcp/server.d.ts.map +1 -1
  163. package/dist/server/mcp/server.js +32 -2
  164. package/dist/server/mcp/server.js.map +1 -1
  165. package/docs/AI_ASSISTANT_SETUP.md +169 -12
  166. package/docs/README.md +40 -1
  167. package/docs/SETUP_GUIDE.md +11 -14
  168. package/docs/ai-guide/COMMANDS.md +68 -10
  169. package/docs/ai-guide/INTEGRATION.md +77 -10
  170. package/docs/ai-guide/OUTPUT.md +295 -2
  171. package/docs/ai-guide/PROMPTS.md +2 -2
  172. package/docs/ai-guide/QUICKSTART.md +28 -1
  173. package/docs/ai-guide/README.md +2 -2
  174. package/docs/archive/ideation/2026-04-15-executable-architecture-constitution-ideation-archive.md +70 -0
  175. package/docs/archive/ideation/2026-04-20-mycodemap-init-enhancements-ideation-archive.md +109 -0
  176. package/docs/archive/ideation/2026-04-22-rules-entry-docs-optimization-consolidated-ideation-archive.md +54 -0
  177. package/docs/ideation/2026-04-15-executable-architecture-constitution-ideation.md +10 -22
  178. package/docs/ideation/2026-04-20-mycodemap-init-enhancements-ideation.md +15 -60
  179. package/docs/ideation/2026-04-22-rules-entry-docs-optimization-consolidated-ideation.md +47 -52
  180. package/docs/ideation/2026-04-29-ux-install-agent-experience-ideation.md +256 -0
  181. package/docs/plans/2026-04-30-install-guide-and-repo-analyzer-design.md +394 -0
  182. package/docs/rules/README.md +1 -0
  183. package/docs/rules/architecture-guardrails.md +2 -1
  184. package/docs/rules/engineering-with-codex-openai.md +1 -1
  185. package/docs/rules/harness.md +106 -0
  186. package/docs/rules/pre-release-checklist.md +28 -0
  187. package/docs/rules/testing.md +51 -0
  188. package/examples/claude/skills/mycodemap-repo-analyzer/SKILL.md +294 -0
  189. package/examples/claude/skills/mycodemap-repo-analyzer/references/analysis-guide.md +166 -0
  190. package/examples/claude/skills/mycodemap-repo-analyzer/references/module-analysis-guide.md +150 -0
  191. package/package.json +7 -4
  192. package/scripts/sync-analyze-docs.js +2 -2
  193. package/scripts/validate-docs.js +113 -16
  194. package/docs/references/tmp.md +0 -527
@@ -1,11 +1,14 @@
1
1
  ---
2
2
  date: 2026-04-15
3
+ updated: 2026-04-29
3
4
  topic: executable-architecture-constitution
4
5
  focus: Pivot CodeMap to an "Executable Architecture Constitution" — making design.md a diff-aware, git-history-risk-weighted, CI-enforceable gate
5
6
  ---
6
7
 
7
8
  # Ideation: Executable Architecture Constitution
8
9
 
10
+ > **状态更新(2026-04-29)**:本文档原始包含 7 个想法,其中 #1(Diff-Aware Contract Enforcement)与 #3(Revive Git History Risk Scoring)已实现并归档至 `docs/archive/ideation/2026-04-15-executable-architecture-constitution-ideation-archive.md`。本文档保留剩余 5 项。
11
+
9
12
  ## Codebase Context
10
13
 
11
14
  **Project**: CodeMap — TypeScript CLI tool that generates structured code context for AI/Agents (dependency graphs, symbol maps, etc.). Currently pivoting from "AI code map tool" to "Executable Architecture Constitution" — an architecture contract governance engine.
@@ -28,31 +31,15 @@ focus: Pivot CodeMap to an "Executable Architecture Constitution" — making des
28
31
 
29
32
  ## Ranked Ideas
30
33
 
31
- ### 1. Diff-Aware Contract Enforcement
32
- **Description:** Upgrade `mycodemap verify` into a true contract enforcer that scans `src/` code. By default, only validate files touched by `git diff` and their dependency chains. Return non-zero exit codes when `layer_direction`, `forbidden_imports`, or `module_public_api_only` rules are violated.
33
- **Rationale:** This is the core product soul of the pivot. Today `design verify` only checks handoff drift and never touches source code — creating a dangerous false sense of security for users.
34
- **Downsides:** Bridging design.md's text constraints with tree-sitter symbol extraction requires careful engineering for the first rule.
35
- **Confidence:** 90%
36
- **Complexity:** Medium
37
- **Status:** Unexplored
38
-
39
- ### 2. SQLite + In-Memory Graph Storage Migration
34
+ ### 1. SQLite + In-Memory Graph Storage Migration
40
35
  **Description:** Remove the KùzuDB adapter and replace it with `better-sqlite3` for persisting symbol relationships, plus a lightweight in-memory directed graph (Map/Set adjacency list) loaded at startup. The same storage layer should handle code graphs, git blame history, and contract metadata.
41
36
  **Rationale:** KùzuDB installation failures are the top onboarding friction. SQLite's single-file nature turns CodeMap into a version-controllable CLI tool rather than a system requiring database ops.
42
37
  **Downsides:** Must validate startup time and memory footprint against large codebases (target: <1s for 10K files, <200MB RAM).
43
38
  **Confidence:** 85%
44
39
  **Complexity:** Medium-High
45
- **Status:** Unexplored
46
-
47
- ### 3. Revive Git History Risk Scoring (GRAVITY/HEAT/IMPACT)
48
- **Description:** Harden the existing but dormant `calculateRiskScore` in `src/orchestrator/workflow/git-analyzer.ts` and rewire the GRAVITY/HEAT/IMPACT three-dimensional model into `verify` and `impact` outputs.
49
- **Rationale:** Competitors cannot replicate the causal narrative of "who changed this block, what regressions this dependency chain caused before." The formula is already designed — it just needs to be wired up.
50
- **Downsides:** Requires high-quality historical data (rollbacks, incident correlations); young codebases may have weak signal.
51
- **Confidence:** 80%
52
- **Complexity:** Medium
53
- **Status:** Unexplored
40
+ **Status:** Partially Implemented (`better-sqlite3` added to `package.json`, but KùzuDB adapter not yet removed)
54
41
 
55
- ### 4. Auto-Generate design.md from Existing Codebase
42
+ ### 2. Auto-Generate design.md from Existing Codebase
56
43
  **Description:** Instead of asking humans to write `design.md` from scratch, use the existing tree-sitter parser to scan `src/` for module boundaries and public APIs, then generate a baseline contract. Users only review and lock it.
57
44
  **Rationale:** Eliminates the root cause of "docs vs code divergence." If contract generation cost approaches zero, maintenance cost collapses too.
58
45
  **Downsides:** Auto-generated rules may be too permissive or capture too many implementation details; needs smart UX to "lock" which rules matter.
@@ -60,7 +47,7 @@ focus: Pivot CodeMap to an "Executable Architecture Constitution" — making des
60
47
  **Complexity:** Medium
61
48
  **Status:** Unexplored
62
49
 
63
- ### 5. Auto-Generate Architecture Remediation Patches
50
+ ### 3. Auto-Generate Architecture Remediation Patches
64
51
  **Description:** When `verify` finds a module boundary violation, don't just report it — generate a concrete refactoring patch (e.g., "move this import down to the adapter layer").
65
52
  **Rationale:** In the AI era, "errors without fixes" is a half-measure. This was also highlighted in Codex's second opinion as a core element of the coolest version.
66
53
  **Downsides:** Requires semantic understanding beyond import graphs; fully automated fixes risk introducing bugs.
@@ -68,7 +55,7 @@ focus: Pivot CodeMap to an "Executable Architecture Constitution" — making des
68
55
  **Complexity:** High
69
56
  **Status:** Unexplored
70
57
 
71
- ### 6. Self-Healing Design Contract (Drift Approval)
58
+ ### 4. Self-Healing Design Contract (Drift Approval)
72
59
  **Description:** Allow `design.md` to evolve with the code through an approval workflow. When drift is detected, provide `codemap design evolve --approve` to snapshot current code boundaries back into the contract as the new baseline.
73
60
  **Rationale:** Architecture decay is an organizational norm. If contracts forever forbid drift, they get abandoned. A reviewable, approvable evolution mechanism is the only way they survive long-term.
74
61
  **Downsides:** Requires strict versioning and multi-level approval, otherwise it becomes a channel for "legitimizing tech debt."
@@ -76,7 +63,7 @@ focus: Pivot CodeMap to an "Executable Architecture Constitution" — making des
76
63
  **Complexity:** Medium
77
64
  **Status:** Unexplored
78
65
 
79
- ### 7. MCP `verify_contract` Tool
66
+ ### 5. MCP `verify_contract` Tool
80
67
  **Description:** Wrap the `design verify` JSON output contract as an MCP Server tool for Claude Code / Cursor to call before every code modification.
81
68
  **Rationale:** Minimal engineering investment for maximum ecosystem leverage. Transforms CodeMap from "a CLI developers remember to run" into "infrastructure AI calls by default."
82
69
  **Downsides:** The MCP ecosystem is still early; interface standardization may shift.
@@ -100,3 +87,4 @@ focus: Pivot CodeMap to an "Executable Architecture Constitution" — making des
100
87
  ## Session Log
101
88
 
102
89
  - 2026-04-15: Initial ideation — ~40 candidates generated across 4 frames, 7 survived after adversarial filtering
90
+ - 2026-04-29: #1 and #3 verified as fully implemented and archived
@@ -1,76 +1,36 @@
1
1
  ---
2
2
  date: 2026-04-20
3
+ updated: 2026-04-29
3
4
  topic: mycodemap-init-enhancements
4
- focus: 把 mycodemap init 从“创建根目录配置文件”升级为“项目级 AI 助手基础设施初始化器”
5
+ focus: 把 mycodemap init 从"创建根目录配置文件"升级为"项目级 AI 助手基础设施初始化器"
5
6
  mode: repo-grounded
6
7
  ---
7
8
 
8
9
  # Ideation: mycodemap init enhancements
9
10
 
11
+ > **状态更新(2026-04-29)**:本文档原始包含 6 个想法,其中 #1–#5 已实现并归档至 `docs/archive/ideation/2026-04-20-mycodemap-init-enhancements-ideation-archive.md`。本文档仅保留未实现项 #6 及其相关上下文。
12
+
10
13
  ## Grounding Context
11
14
 
12
15
  ### Codebase Context
13
16
 
14
- - [证据] 当前 `src/cli/commands/init.ts` 主要只处理根目录 `mycodemap.config.json` / `codemap.config.json` 的存在检查、旧配置迁移和默认配置写入。
15
- - [证据] `src/cli/paths.ts` 仍以根目录配置文件作为发现入口,而 `src/cli/config-loader.ts` 的默认 `output` 已转向 `.mycodemap`,但默认 `storage.outputPath` 仍是 `.codemap/storage`。
16
- - [证据] `src/cli/first-run-guide.ts` 已把 marker 放进 `.mycodemap/`,但欢迎语仍把 init 叙述成“初始化配置”而不是“初始化 AI 工作区”。
17
+ - [证据] `src/cli/first-run-guide.ts` 已把 marker 放进 `.mycodemap/`,但欢迎语仍把 init 叙述成"初始化配置"而不是"初始化 AI 工作区"。
17
18
  - [证据] 仓库已经拥有可复用的 `.githooks/`、规则校验脚本、first-run guide、chalk + emoji + 中文 CLI 风格。
18
19
 
19
20
  ### Past Learnings
20
21
 
21
- - [推论] 当前最大的产品问题不是“功能不存在”,而是“看起来成功但其实只做了一部分”。
22
+ - [推论] 当前最大的产品问题不是"功能不存在",而是"看起来成功但其实只做了一部分"。
22
23
  - [推论] 半迁移状态应该被显式解释、对账和修复,而不是继续依赖隐式 fallback。
23
24
  - [证据] 本 phase 已锁定:不自动修改用户 `CLAUDE.md` / `AGENTS.md`,并要求在 `.mycodemap/` 中集中化 config、rules、workflow、logs 等资产。
24
25
 
25
26
  ### External Context
26
27
 
27
- - [推论] 2024–2026 的主流 AI / dev tooling 明显收敛到“双层结构”:隐藏目录存放 tool-owned 资产,显式文件存放 team-owned / shared rules。
28
- - [推论] hooks 安装的成熟心智是 ownership、冲突检测、可逆迁移,而不是静默覆盖。
28
+ - [推论] 2024–2026 的主流 AI / dev tooling 明显收敛到"双层结构":隐藏目录存放 tool-owned 资产,显式文件存放 team-owned / shared rules。
29
29
  - [推论] 最贴近市场共识的做法不是自动改用户上下文文件,而是生成 tool-owned bundle + 明确的人工接入片段。
30
30
 
31
31
  ## Ranked Ideas
32
32
 
33
- ### 1. Init Reconciler Dashboard
34
- **Description:** [推论] 让 `mycodemap init` 先扫描 config / workspace / hooks / rules / first-run 状态,再展示统一状态表并执行勾选后的 reconcile,而不是一上来创建文件。
35
- **Rationale:** [推论] 这是最强的主心智重写:它同时吸收了“状态透明”“半迁移修复”“不新增 sync surface”三条信号,并把 init 从 file-creator 提升为 repo-state reconciler。
36
- **Downsides:** [观点] 需要先定义稳定的状态模型和 CLI 展示格式,否则实现容易碎片化。
37
- **Confidence:** 93%
38
- **Complexity:** Medium
39
- **Status:** Explored
40
-
41
- ### 2. Bootstrap Receipt + Managed Asset Ledger
42
- **Description:** [推论] 每次 init 产出 receipt,并在 `.mycodemap/` 持久化 ledger / manifest,记录配置、hooks、rules、exports、marker 的 ownership、origin、hash、版本、rollback hint 和当前状态。
43
- **Rationale:** [推论] 这是把“看起来成功但其实没做完”变贵的最直接手段,也为后续 rerun、support、sync、future commands 提供统一事实源。
44
- **Downsides:** [观点] 若 schema 设计过重,容易提前抽象;需要克制到“只记录会复用的事实”。
45
- **Confidence:** 90%
46
- **Complexity:** Medium
47
- **Status:** Unexplored
48
-
49
- ### 3. Drift-First Compatibility Bridge
50
- **Description:** [推论] 把根配置、旧 `.codemap/storage`、旧路径 fallback、旧文档心智全部视为显式 drift;init 负责解释旧世界和新 canonical `.mycodemap/config.json` 的关系,并提供 forward / rollback 指引。
51
- **Rationale:** [推论] 这是最直击当下 repo 痛点的方向:它不是再加一个功能,而是修复“根配置 vs `.mycodemap` 工作区”的双中心叙事。
52
- **Downsides:** [观点] 需要同时碰实现、文档和路径叙事;若边界定义不清,会继续扩大兼容负担。
53
- **Confidence:** 91%
54
- **Complexity:** Medium
55
- **Status:** Unexplored
56
-
57
- ### 4. Ownership-Preserving Hook Contract
58
- **Description:** [推论] 把 hooks 从“复制文件”升级为 ownership negotiation:优先用 shim / adapter 指向 `.mycodemap/hooks/` 下的 canonical assets,显式处理 adopt / preserve / manual / conflict / rollback。
59
- **Rationale:** [推论] hooks 是最高杠杆也最高敏感的边界;这个方向兼顾强能力、可逆性和团队信任,且与外部成熟模式一致。
60
- **Downsides:** [观点] Git 环境差异和已有团队 hooks 形态很多,边缘案例会拖高实现复杂度。
61
- **Confidence:** 86%
62
- **Complexity:** Medium-High
63
- **Status:** Unexplored
64
-
65
- ### 5. Rules Link Mode + Assistant Compatibility Pack
66
- **Description:** [推论] 在 `.mycodemap/rules/`、`.mycodemap/exports/`、`.mycodemap/assistants/` 中生成可引用的 rules bundle、copy-paste include blocks、per-tool stubs 和文档片段,而不是自动改 `CLAUDE.md` / `AGENTS.md`。
67
- **Rationale:** [推论] 这条路最贴近行业共识:隐藏目录归工具,显式上下文归团队;同时把多工具接入和文档同步成本一起压低。
68
- **Downsides:** [观点] 用户仍需手动完成最后一步粘贴;若提示文案不够强,可能有人觉得“不够自动化”。
69
- **Confidence:** 88%
70
- **Complexity:** Medium
71
- **Status:** Unexplored
72
-
73
- ### 6. First-Run Concierge + Bootstrap Profiles
33
+ ### 1. First-Run Concierge + Bootstrap Profiles
74
34
  **Description:** [推论] 把 first-run guide 重写成状态驱动的 remediation concierge,并用少量 profile(如 Minimal / Guardrails / Team Ready)承载交互式一键选择。
75
35
  **Rationale:** [推论] 这是最低成本修复 mental model 的方法:既改善第一分钟体验,也避免 init 变成一长串低层开关。
76
36
  **Downsides:** [观点] profile 设计如果过粗,会掩盖复杂边界;如果过细,又会退化回问卷。
@@ -82,15 +42,10 @@ mode: repo-grounded
82
42
 
83
43
  | # | Idea | Reason Rejected |
84
44
  |---|------|-----------------|
85
- | 1 | `.mycodemap` as Agent Control Plane | [推论] 更像 framing,总体价值已被 #3 和 #5 吸收 |
86
- | 2 | `Manual Action Needed` as success | [推论] 是 #1 / #2 的成功语义,不值得独立成产品方向 |
87
- | 3 | `Project Safety Contracts` framing | [观点] 叙事强但产品增量弱,更适合后续命名或定位文案 |
88
- | 4 | `Customs Declaration Lanes` | [推论] 是 status receipt 的隐喻版本,重复度高 |
89
- | 5 | `Building Commissioning Sheet` | [推论] 与 Reconciler Dashboard / Drift-First 思路重复 |
90
- | 6 | `Board Game Setup Tray` | [推论] 是 Profiles 的隐喻版,没有新增结构价值 |
91
- | 7 | `Canonical Locator Map` | [观点] 更像 #2 / #3 的内部机制,而非顶层 ideation winner |
92
- | 8 | `Migration Journal + Undo Receipts` | [推论] 很有价值,但已折叠进 #2 的 ledger 方案 |
93
- | 9 | `Capability Matrix for Downstream Commands` | [推论] 值得做,但依赖 #2 的事实层先成立 |
94
- | 10 | `Portable Hook Adapter Contract` | [推论] 作为 hook 方向的底层机制已吸收到 #4 |
95
- | 11 | `Doc Snippet Registry` | [推论] 已并入 #5 的 compatibility pack |
96
- | 12 | `Recovery Partition + Bootloader` | [观点] 类比很强,但太偏实现隐喻,顶层价值已并入 #4 |
45
+ | 1 | `Project Safety Contracts` framing | [观点] 叙事强但产品增量弱,更适合后续命名或定位文案 |
46
+ | 2 | `Board Game Setup Tray` | [推论] 是 Profiles 的隐喻版,没有新增结构价值 |
47
+
48
+ ## Session Log
49
+
50
+ - 2026-04-20: 初始 ideation,6 个候选想法
51
+ - 2026-04-29: #1–#5 已实现并归档;本文档收缩为仅保留未实现项 #6
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  date: 2026-04-22
3
+ updated: 2026-04-29
3
4
  topic: rules-entry-docs-optimization-consolidated
4
5
  focus: 融合两份 2026-04-22 ideation 的最佳部分,形成更强的 rules / AGENTS.md / CLAUDE.md 终稿提案
5
6
  mode: repo-grounded
@@ -10,17 +11,19 @@ sources:
10
11
 
11
12
  # Ideation: Consolidated rules / AGENTS.md / CLAUDE.md optimization
12
13
 
14
+ > **状态更新(2026-04-29)**:本文档原始包含 6 个想法,其中 #1(One Constitution, Two Thin Adapters)已实现并归档至 `docs/archive/ideation/2026-04-22-rules-entry-docs-optimization-consolidated-ideation-archive.md`。本文档保留剩余 5 项。
15
+
13
16
  ## Grounding Context
14
17
 
15
18
  ### Codebase Context
16
19
 
17
- - [证据] 仓库自我定义已经很清楚:`AGENTS.md` 应是“强约束 + 路由”,`CLAUDE.md` 应是“启动清单、检索顺序、最小操作手册”;而且入口文档应该保持短小:`AGENTS.md:3`、`AGENTS.md:14`、`AGENTS.md:15`、`AGENTS.md:329`。
18
- - [证据] 但当前根 `CLAUDE.md` 同时承载了 post-edit 默认验证、路径路由、rule-system 默认值、CLI dogfood、交付清单,已经超过“薄入口”定位:`CLAUDE.md:25`、`CLAUDE.md:43`、`CLAUDE.md:57`、`CLAUDE.md:65`、`CLAUDE.md:80`。
20
+ - [证据] 仓库自我定义已经很清楚:`AGENTS.md` 应是"强约束 + 路由",`CLAUDE.md` 应是"启动清单、检索顺序、最小操作手册";而且入口文档应该保持短小:`AGENTS.md:3`、`AGENTS.md:14`、`AGENTS.md:15`、`AGENTS.md:329`。
21
+ - [证据] 但当前根 `CLAUDE.md` 同时承载了 post-edit 默认验证、路径路由、rule-system 默认值、CLI dogfood、交付清单,已经超过"薄入口"定位:`CLAUDE.md:25`、`CLAUDE.md:43`、`CLAUDE.md:57`、`CLAUDE.md:65`、`CLAUDE.md:80`。
19
22
  - [证据] `.claude/CLAUDE.md` 又额外定义了任务开始前/结束后清单、TDD 流程、禁止行为、commit 策略和 `npm run check:all`,与根 `CLAUDE.md` 形成双入口:`.claude/CLAUDE.md:1`、`.claude/CLAUDE.md:7`、`.claude/CLAUDE.md:33`、`.claude/CLAUDE.md:51`。
20
- - [证据] 文档已经主张“先路由、再按需下钻”和“按改动类型做最小验证”,但根 `CLAUDE.md` 仍保留一套统一 post-edit 命令与固定 checklist,存在叙事冲突:`docs/rules/README.md:19`、`docs/rules/validation.md:5`、`docs/rules/validation.md:29`、`docs/rules/validation.md:31`、`CLAUDE.md:25`。
21
- - [证据] 当前部分验证命令存在“文档真、脚本假”的信任问题:`docs/rules/architecture-guardrails.md` 把 `npm run check:architecture` 列为快速验证,但 `package.json` 中它仍是 `echo` stub;`check:unused` 也是同样情况:`docs/rules/architecture-guardrails.md:24`、`docs/rules/architecture-guardrails.md:29`、`package.json:45`、`package.json:46`、`package.json:48`。
22
- - [证据] 仓库处于过渡态,文档体系与执行面并存新旧结构;历史归档仍在,少量指南仍在根层,官方要求“以实际存在的文件为准”:`AGENTS.md:324`、`AGENTS.md:327`、`AGENTS.md:329`。
23
- - [推论] 因此当前核心问题不是“规则数量不足”,而是“shared truth source 不够清晰 + 入口过载 + 某些执行约束与真实自动化不一致”。
23
+ - [证据] 文档已经主张"先路由、再按需下钻"和"按改动类型做最小验证",但根 `CLAUDE.md` 仍保留一套统一 post-edit 命令与固定 checklist,存在叙事冲突:`docs/rules/README.md:19`、`docs/rules/validation.md:5`、`docs/rules/validation.md:29`、`docs/rules/validation.md:31`、`CLAUDE.md:25`。
24
+ - [证据] 当前部分验证命令存在"文档真、脚本假"的信任问题:`docs/rules/architecture-guardrails.md` 把 `npm run check:architecture` 列为快速验证,但 `package.json` 中它仍是 `echo` stub;`check:unused` 也是同样情况:`docs/rules/architecture-guardrails.md:24`、`docs/rules/architecture-guardrails.md:29`、`package.json:45`、`package.json:46`、`package.json:48`。
25
+ - [证据] 仓库处于过渡态,文档体系与执行面并存新旧结构;历史归档仍在,少量指南仍在根层,官方要求"以实际存在的文件为准":`AGENTS.md:324`、`AGENTS.md:327`、`AGENTS.md:329`。
26
+ - [推论] 因此当前核心问题不是"规则数量不足",而是"shared truth source 不够清晰 + 入口过载 + 某些执行约束与真实自动化不一致"。
24
27
 
25
28
  ### External Context
26
29
 
@@ -32,88 +35,80 @@ sources:
32
35
 
33
36
  ### Synthesis
34
37
 
35
- - [推论] 文档一的强项是“战略方向正确、外部 grounding 充分、结构完整”,文档二的强项是“repo-specific 问题抓得具体、能直接落实施工项”。
36
- - [推论] 更强的终稿不应在两者之间二选一,而应采用“文档一的治理框架 + 文档二的具体问题卡片”。
38
+ - [推论] 文档一的强项是"战略方向正确、外部 grounding 充分、结构完整",文档二的强项是"repo-specific 问题抓得具体、能直接落实施工项"。
39
+ - [推论] 更强的终稿不应在两者之间二选一,而应采用"文档一的治理框架 + 文档二的具体问题卡片"。
37
40
 
38
41
  ## Ranked Ideas
39
42
 
40
- ### 1. One Constitution, Two Thin Adapters
41
- **Description:** [推论] `AGENTS.md` 作为唯一共享治理宪法,专门承载风险分级、证据协议、改动边界、truth-source map、文档职责层次;把根 `CLAUDE.md` 收缩成 Claude/Codex 共用入口路由;把 `.claude/CLAUDE.md` 收缩成 Claude 专属 adapter,优先通过 `@AGENTS.md` 与 `@CLAUDE.md` 引入,而不是重复抄写规则。
42
- **Rationale:** [推论] 这同时解决了“根入口过载”和“双 CLAUDE.md”问题,也最符合 Codex 原生 `AGENTS.md` 与 Claude 官方 import / memory 模型。
43
- **Repo-Specific Leverage:** [证据] 当前双入口问题真实存在:根 `CLAUDE.md:25` 到 `CLAUDE.md:88` 已是一整套执行面,`.claude/CLAUDE.md:7` 到 `.claude/CLAUDE.md:39` 又重复定义任务前后动作。
44
- **Downsides:** [观点] 需要一次性定义清楚三者边界,否则很容易演变成“三份薄文档互相引用但仍然漂移”。
45
- **Confidence:** 97%
46
- **Complexity:** Medium
47
- **Status:** Explored
48
-
49
- ### 2. Validation Router + No Ghost Commands
50
- **Description:** [推论] 把根 `CLAUDE.md` 中“修改后必须执行”改写为 1 屏验证决策树:按改动类型跳转到 `docs/rules/validation.md`;同时禁止在入口与规则文档中引用 `echo` stub 命令,所有写进 quick-start 的命令都必须是真实可运行命令。
51
- **Rationale:** [推论] 这是把 harness 的“最小必要验证”从口号变成真正可信的路由;它还顺手修掉最伤信任的“跑了命令但其实没验证”的问题。
43
+ ### 1. Validation Router + No Ghost Commands
44
+ **Description:** [推论] 把根 `CLAUDE.md` 中"修改后必须执行"改写为 1 屏验证决策树:按改动类型跳转到 `docs/rules/validation.md`;同时禁止在入口与规则文档中引用 `echo` stub 命令,所有写进 quick-start 的命令都必须是真实可运行命令。
45
+ **Rationale:** [推论] 这是把 harness 的"最小必要验证"从口号变成真正可信的路由;它还顺手修掉最伤信任的"跑了命令但其实没验证"的问题。
52
46
  **Repo-Specific Leverage:** [证据] `docs/rules/architecture-guardrails.md:29` 当前推荐 `npm run check:architecture`,但 `package.json:46` 仍是提示安装 dependency-cruiser 的 `echo`;`check:unused` 在 `package.json:48` 也是同类问题。
53
47
  **Downsides:** [观点] 若短期内不想落地真实检查,就必须先从入口与规则文档中移除这些命令,否则只会继续制造假安全感。
54
48
  **Confidence:** 96%
55
49
  **Complexity:** Medium
56
- **Status:** Explored
50
+ **Status:** Partially Implemented(根 `CLAUDE.md` 已改为纯路由,但 `package.json` 与 `docs/rules/architecture-guardrails.md` 中的 ghost commands 仍在)
57
51
 
58
- ### 3. Behavior / Enforcement Split
52
+ ### 2. Behavior / Enforcement Split
59
53
  **Description:** [推论] 明确分层:`AGENTS.md` / `CLAUDE.md` 负责行为与路由;`.claude/settings*.json`、hooks、`scripts/validate-rules.py`、CI 负责确定性 enforcement;`docs/rules/*` 只解释何时触发、如何恢复、失败后果是什么。
60
- **Rationale:** [推论] 这既符合 Claude 官方“behavioral guidance vs technical enforcement”的划分,也与本仓库已有 `report-only` / `soft_gate` / `hard_gate` 设计天然一致。
61
- **Repo-Specific Leverage:** [证据] 根 `CLAUDE.md` 现在同时扮演“行为协议”“默认 gate 配置”“交付 checklist”三种角色:`CLAUDE.md:57`、`CLAUDE.md:61`、`CLAUDE.md:62`、`CLAUDE.md:63`、`CLAUDE.md:80`。
62
- **Downsides:** [观点] 需要重写措辞,让“默认路由/默认验证”与“真正 blocker”区分得非常清楚,否则用户会误会规则被放松。
54
+ **Rationale:** [推论] 这既符合 Claude 官方"behavioral guidance vs technical enforcement"的划分,也与本仓库已有 `report-only` / `soft_gate` / `hard_gate` 设计天然一致。
55
+ **Repo-Specific Leverage:** [证据] 根 `CLAUDE.md` 现在同时扮演"行为协议""默认 gate 配置""交付 checklist"三种角色:`CLAUDE.md:57`、`CLAUDE.md:61`、`CLAUDE.md:62`、`CLAUDE.md:63`、`CLAUDE.md:80`。
56
+ **Downsides:** [观点] 需要重写措辞,让"默认路由/默认验证"与"真正 blocker"区分得非常清楚,否则用户会误会规则被放松。
63
57
  **Confidence:** 93%
64
58
  **Complexity:** Medium
65
- **Status:** Explored
59
+ **Status:** Partially Implemented(行为路由已分离,但缺少 `scripts/validate-rules.py` 等专门 enforcement 工具,部分 enforcement 仍由 `validate-docs.js` 兼任)
66
60
 
67
- ### 4. Path-Scoped Governance for a Transitional Repo
68
- **Description:** [推论] 根入口只维护“如何选规则”的导航,细节继续下沉到按路径加载的文档:Codex 依赖更近的 `AGENTS.md`,Claude 依赖 `.claude/rules/**` 的 `paths:`;同时在根入口显式声明“当前是迁移仓库,MVP3 层级优先,但历史目录仍可能存在”。
69
- **Rationale:** [推论] 这把文档二的“路由覆盖不足”问题与文档一的“progressive disclosure”主张合并起来:根文件不需要越来越长,但路径规则必须覆盖真实项目形态。
70
- **Repo-Specific Leverage:** [证据] 仓库已明确“过渡说明”和“入口文档应保持短小”:`AGENTS.md:324`、`AGENTS.md:327`、`AGENTS.md:329`;根 `CLAUDE.md` 当前路由表仍是高度 layer-centric:`CLAUDE.md:43` 到 `CLAUDE.md:55`。
71
- **Downsides:** [观点] 若没有命名约定和 archive discipline,路径化后会把问题从“根太长”转移成“子规则散落”。
61
+ ### 3. Path-Scoped Governance for a Transitional Repo
62
+ **Description:** [推论] 根入口只维护"如何选规则"的导航,细节继续下沉到按路径加载的文档:Codex 依赖更近的 `AGENTS.md`,Claude 依赖 `.claude/rules/**` 的 `paths:`;同时在根入口显式声明"当前是迁移仓库,MVP3 层级优先,但历史目录仍可能存在"。
63
+ **Rationale:** [推论] 这把文档二的"路由覆盖不足"问题与文档一的"progressive disclosure"主张合并起来:根文件不需要越来越长,但路径规则必须覆盖真实项目形态。
64
+ **Repo-Specific Leverage:** [证据] 仓库已明确"过渡说明"和"入口文档应保持短小":`AGENTS.md:324`、`AGENTS.md:327`、`AGENTS.md:329`;根 `CLAUDE.md` 当前路由表仍是高度 layer-centric:`CLAUDE.md:43` 到 `CLAUDE.md:55`。
65
+ **Downsides:** [观点] 若没有命名约定和 archive discipline,路径化后会把问题从"根太长"转移成"子规则散落"。
72
66
  **Confidence:** 91%
73
67
  **Complexity:** Medium-High
74
- **Status:** Explored
68
+ **Status:** Unexplored(不存在 `.claude/rules/` 目录,无 `paths:` 配置)
75
69
 
76
- ### 5. Live Rulebook + Archive Demotion
77
- **Description:** [推论] 明确标注 live governance surface:只认 `AGENTS.md`、根 `CLAUDE.md`、`.claude/CLAUDE.md`、`docs/rules/README.md` 与活跃规则文档;历史 rollout、模板母本、迁移提案要统一降级为 reference/archive,并在文件头写明“不可作为当前执行真相”。
70
+ ### 4. Live Rulebook + Archive Demotion
71
+ **Description:** [推论] 明确标注 live governance surface:只认 `AGENTS.md`、根 `CLAUDE.md`、`.claude/CLAUDE.md`、`docs/rules/README.md` 与活跃规则文档;历史 rollout、模板母本、迁移提案要统一降级为 reference/archive,并在文件头写明"不可作为当前执行真相"。
78
72
  **Rationale:** [推论] 对 agent 来说,最贵的不是少一条规则,而是不知道哪份文档才是现在真的生效。
79
- **Repo-Specific Leverage:** [证据] 仓库已承认“历史归档仍保留、少量操作指南仍在根层、执行时以实际存在文件为准”:`AGENTS.md:327`。
73
+ **Repo-Specific Leverage:** [证据] 仓库已承认"历史归档仍保留、少量操作指南仍在根层、执行时以实际存在文件为准":`AGENTS.md:327`。
80
74
  **Downsides:** [观点] 这是文档身份治理,不是炫目的功能增强;但如果不做,后续所有瘦身都会被旧文档重新污染。
81
75
  **Confidence:** 92%
82
76
  **Complexity:** Low-Medium
83
- **Status:** Explored
77
+ **Status:** Partially Implemented(`docs/archive/` 目录存在,但并非所有历史文档都被显式标注"不可作为当前执行真相";`docs/ideation/` 中仍有未归档的历史文档)
84
78
 
85
- ### 6. Governance Self-Audit + Generated Shared Tables
86
- **Description:** [推论] 把“规则重复”和“规则自身腐烂”合并成一个治理能力:高频重复表格(如代码红线、职责映射、验证入口)应由单一结构化源生成;并定期审计链接、命令存在性、路径路由覆盖和 live/reference 身份是否一致。
87
- **Rationale:** [推论] 文档二抓住了 repo 的真实维护痛点,而文档一提供了更高层的约束原则;把两者合并后,能防止“今天瘦身,明天重新 drift”。
79
+ ### 5. Governance Self-Audit + Generated Shared Tables
80
+ **Description:** [推论] 把"规则重复"和"规则自身腐烂"合并成一个治理能力:高频重复表格(如代码红线、职责映射、验证入口)应由单一结构化源生成;并定期审计链接、命令存在性、路径路由覆盖和 live/reference 身份是否一致。
81
+ **Rationale:** [推论] 文档二抓住了 repo 的真实维护痛点,而文档一提供了更高层的约束原则;把两者合并后,能防止"今天瘦身,明天重新 drift"。
88
82
  **Repo-Specific Leverage:** [证据] 当前重复与漂移已在多处出现:`AGENTS.md:127`、`docs/rules/engineering-with-codex-openai.md:89`;而命令存在性问题已被 `package.json:46`、`package.json:48` 证明。
89
- **Downsides:** [观点] 这已经逼近“小型文档治理系统”了;若一次做太大,容易反向过度工程化。
83
+ **Downsides:** [观点] 这已经逼近"小型文档治理系统"了;若一次做太大,容易反向过度工程化。
90
84
  **Confidence:** 88%
91
85
  **Complexity:** Medium
92
- **Status:** Explored
86
+ **Status:** Partially Implemented(`scripts/validate-docs.js` 已实现入口文档自动化审计,但无"从单一结构化源生成重复表格"的机制,也无定期审计 package.json stub 命令的能力)
93
87
 
94
88
  ## Recommended Final Direction
95
89
 
96
- - [观点] **首选主轴**:`#1 One Constitution, Two Thin Adapters`
97
- 这是最强的结构性修复,因为它同时吸收了双入口治理、single source of truth、Claude/Codex 双工具共存三类问题。
98
- - [观点] **第二优先级**:`#2 Validation Router + No Ghost Commands`
99
- 这是最强的信任修复,因为它能最快把“文档说一套、命令做一套”的错位消掉。
100
- - [观点] **第三优先级**:`#3 Behavior / Enforcement Split`
101
- 这是最强的长期维护修复,因为它能防止入口文件再次被确定性流程污染。
102
- - [推论] 若只允许保留一个总原则,应是:**根入口只负责“让 agent 知道去哪读、何时验证、谁在阻断”,不负责承载全部细节、全部命令、全部历史。**
90
+ - [观点] **当前首选主轴**:`#2 Validation Router + No Ghost Commands`
91
+ #1 已完成后,这是最强的信任修复:把"文档说一套、命令做一套"的错位消掉。
92
+ - [观点] **第二优先级**:`#3 Behavior / Enforcement Split`
93
+ 这是最强的长期维护修复,防止入口文件再次被确定性流程污染。
94
+ - [观点] **第三优先级**:`#4 Path-Scoped Governance`
95
+ 把路由从根文件进一步下沉到路径作用域,是 progressive disclosure 的下一步。
96
+ - [推论] 若只允许保留一个总原则,应是:**根入口只负责"让 agent 知道去哪读、何时验证、谁在阻断",不负责承载全部细节、全部命令、全部历史。**
103
97
 
104
98
  ## Rejection Summary
105
99
 
106
100
  | # | Idea | Reason Rejected |
107
101
  |---|------|-----------------|
108
- | 1 | `Universal Mega Entry File` | [推论] 与 Codex / Claude 官方“短入口 + 路由 + 作用域加载”方向完全相反。 |
102
+ | 1 | `Universal Mega Entry File` | [推论] 与 Codex / Claude 官方"短入口 + 路由 + 作用域加载"方向完全相反。 |
109
103
  | 2 | `Per-Tool Twin Rulebooks` | [推论] 会把多 agent 共享规则重新复制成两套真相,长期必漂移。 |
110
104
  | 3 | `Everything as Structured YAML First` | [观点] 对重复表格很有价值,但若把全部治理文档都数据化,会过早走向工具化治理。 |
111
105
  | 4 | `Only Fix Ghost Commands` | [推论] 只能修补信任问题,不能解决入口过载与 shared truth source 不清晰。 |
112
106
  | 5 | `Only Merge the Two CLAUDE Files` | [推论] 不触及 `AGENTS.md` / `docs/rules/*` 的职责划分,仍会留下多真相竞争。 |
113
- | 6 | `Archive Nothing, Just Add More Cross Links` | [观点] 交叉链接能缓解迷路,不能解决“哪份文档是 live contract”的根问题。 |
107
+ | 6 | `Archive Nothing, Just Add More Cross Links` | [观点] 交叉链接能缓解迷路,不能解决"哪份文档是 live contract"的根问题。 |
114
108
 
115
109
  ## Session Log
116
110
 
117
111
  - [证据] 2026-04-22:对比 `docs/archive/ideation/2026-04-22-harness-rules-entry-docs-optimization-ideation.md` 与 `docs/archive/ideation/2026-04-22-rules-claude-agents-optimization-ideation.md`,确认前者更强在治理框架与外部 grounding,后者更强在 repo-specific 问题识别。
118
- - [证据] 2026-04-22:补充校验根 `CLAUDE.md`、`.claude/CLAUDE.md`、`package.json`、`docs/rules/architecture-guardrails.md`,把“双入口”“ghost commands”“迁移仓库”三个具体问题收敛进统一提案。
119
- - [推论] 2026-04-22:最终终稿选择“保留文档一的骨架,吸收文档二最具体的实施抓手”,而不是继续保留两份并行 ideation。
112
+ - [证据] 2026-04-22:补充校验根 `CLAUDE.md`、`.claude/CLAUDE.md`、`package.json`、`docs/rules/architecture-guardrails.md`,把"双入口""ghost commands""迁移仓库"三个具体问题收敛进统一提案。
113
+ - [推论] 2026-04-22:最终终稿选择"保留文档一的骨架,吸收文档二最具体的实施抓手",而不是继续保留两份并行 ideation。
114
+ - 2026-04-29:验证 #1 完全实现并归档;更新剩余项状态为 Partially Implemented / Unexplored