@tyroneross/build-loop 0.36.0 → 0.43.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 (270) hide show
  1. package/.agents/plugins/marketplace.json +2 -2
  2. package/.claude-plugin/marketplace.json +3 -3
  3. package/.claude-plugin/plugin.json +1 -1
  4. package/.codex-plugin/plugin.json +1 -1
  5. package/.cursor/rules/build-loop-surface.mdc +12 -11
  6. package/.cursor/rules/skill-index.mdc +33 -0
  7. package/AGENTS.md +213 -34
  8. package/README.md +99 -31
  9. package/agents/advisor.md +4 -4
  10. package/agents/alignment-checker.md +2 -2
  11. package/agents/architecture-scout.md +4 -4
  12. package/agents/build-orchestrator.md +38 -36
  13. package/agents/database-assessor.md +11 -5
  14. package/agents/design-contract-specialist.md +8 -8
  15. package/agents/fact-checker.md +13 -3
  16. package/agents/fix-critique.md +2 -2
  17. package/agents/independent-auditor.md +60 -7
  18. package/agents/leak-scanner.md +82 -0
  19. package/agents/overfitting-reviewer.md +2 -2
  20. package/agents/plan-critic.md +1 -1
  21. package/agents/promotion-reviewer.md +5 -5
  22. package/agents/retrospective-synthesizer.md +138 -35
  23. package/agents/scope-auditor.md +82 -11
  24. package/agents/security-reviewer.md +56 -2
  25. package/agents/self-improvement-architect.md +17 -3
  26. package/agents/transcript-pattern-miner.md +5 -5
  27. package/agents/ui-validator.md +1 -1
  28. package/bin/build-loop-debugger.js +143 -0
  29. package/bin/build-loop-install.js +1 -4
  30. package/bin/build-loop-load-probe.js +345 -0
  31. package/codex-skills/build-loop/SKILL.md +28 -6
  32. package/commands/feedback.md +37 -0
  33. package/dist/src/interactive-verifier.d.ts +1 -14
  34. package/dist/src/interactive-verifier.d.ts.map +1 -1
  35. package/dist/src/interactive-verifier.js +6 -113
  36. package/dist/src/interactive-verifier.js.map +1 -1
  37. package/dist/src/quality.d.ts +5 -0
  38. package/dist/src/quality.d.ts.map +1 -0
  39. package/dist/src/quality.js +81 -0
  40. package/dist/src/quality.js.map +1 -0
  41. package/dist/src/storage.d.ts.map +1 -1
  42. package/dist/src/storage.js +37 -3
  43. package/dist/src/storage.js.map +1 -1
  44. package/docs/agent-surface-policy.md +35 -31
  45. package/docs/memory-setup.md +19 -0
  46. package/hooks/git/pre-push +65 -4
  47. package/hooks/hooks.json +95 -38
  48. package/hooks/pre-commit +20 -1
  49. package/hooks/pre-edit-rally-point.sh +10 -3
  50. package/hooks/session-start-codex-hook-trust.sh +30 -0
  51. package/hooks/session-start-git-hooks.sh +3 -1
  52. package/hooks/session-start-rally-point.sh +52 -4
  53. package/hooks/session-start-worktree-gc.sh +47 -94
  54. package/hooks/stop-transcript-sweep.sh +173 -0
  55. package/hooks/test_closeout.sh +14 -2
  56. package/package.json +8 -7
  57. package/scripts/README.md +1 -1
  58. package/scripts/_paths.py +65 -0
  59. package/scripts/groundwork_exchange.py +1012 -0
  60. package/scripts/install_memory.py +33 -1
  61. package/scripts/lessons_index/ingest.py +13 -2
  62. package/scripts/lessons_index/query.py +36 -13
  63. package/scripts/memory_context/__init__.py +108 -14
  64. package/scripts/memory_graph/__init__.py +5 -1
  65. package/scripts/project_resolver.py +42 -36
  66. package/scripts/sync_plugin_cache.py +37 -2
  67. package/skills/agent-rally-point/SKILL.md +46 -0
  68. package/skills/api-registry-bridge/SKILL.md +1 -1
  69. package/skills/architecture/dead/SKILL.md +1 -1
  70. package/skills/architecture/impact/SKILL.md +1 -1
  71. package/skills/architecture/review/SKILL.md +1 -1
  72. package/skills/architecture/rules/SKILL.md +3 -3
  73. package/skills/architecture/scan/SKILL.md +1 -1
  74. package/skills/architecture/trace/SKILL.md +1 -1
  75. package/skills/attribution-standard/SKILL.md +6 -6
  76. package/skills/auto-decision-capture/SKILL.md +31 -2
  77. package/skills/auto-finding-capture/SKILL.md +28 -1
  78. package/skills/build-loop/SKILL.md +131 -23
  79. package/skills/build-loop/fallbacks.md +16 -21
  80. package/skills/build-loop/phases/ui-validation.md +2 -2
  81. package/skills/build-loop/references/advisor-dispatch-ladder.md +1 -1
  82. package/skills/build-loop/references/apple-native-planning.md +1 -1
  83. package/skills/build-loop/references/autonomous-and-per-commit-modes.md +11 -5
  84. package/skills/build-loop/references/autonomy-dashboard.md +115 -0
  85. package/skills/build-loop/references/capability-routing.md +24 -2
  86. package/skills/build-loop/references/coordination.md +24 -6
  87. package/skills/build-loop/references/experiment-results-template.md +15 -3
  88. package/skills/build-loop/references/leadership.md +1 -1
  89. package/skills/build-loop/references/memory.md +14 -3
  90. package/skills/build-loop/references/modular-systems-pack.md +8 -0
  91. package/skills/build-loop/references/output-style.md +86 -0
  92. package/skills/build-loop/references/phase-1-assess.md +102 -2
  93. package/skills/build-loop/references/phase-2-plan.md +9 -1
  94. package/skills/build-loop/references/phase-3-execute.md +5 -2
  95. package/skills/build-loop/references/phase-4-review.md +85 -8
  96. package/skills/build-loop/references/phase-5-iterate.md +76 -8
  97. package/skills/build-loop/references/phase-6-learn.md +10 -17
  98. package/skills/build-loop/references/privileged-request-broker.md +254 -0
  99. package/skills/build-loop/references/resource-aware-execution.md +183 -0
  100. package/skills/build-loop/references/self-recursive-dev.md +2 -2
  101. package/skills/build-loop/references/status-output-format.md +207 -0
  102. package/skills/build-loop/references/verify-dispatch.md +56 -2
  103. package/skills/building-with-deepagents/SKILL.md +1 -1
  104. package/skills/claim-scope/SKILL.md +185 -0
  105. package/skills/color-engine/SKILL.md +103 -0
  106. package/skills/color-engine/_core.py +464 -0
  107. package/skills/color-engine/color_engine.py +175 -0
  108. package/skills/cost-rca/SKILL.md +61 -0
  109. package/skills/data-plane-worktrees/SKILL.md +139 -0
  110. package/skills/data-plane-worktrees/agents/openai.yaml +4 -0
  111. package/skills/database-practice/SKILL.md +200 -0
  112. package/skills/database-practice/references/diagnostic-queries.sql +126 -0
  113. package/skills/database-practice/references/vector-and-graph-tuning.md +208 -0
  114. package/skills/database-practice/scripts/db_table_map.py +1244 -0
  115. package/skills/database-practice/scripts/test_db_table_map.py +514 -0
  116. package/skills/debug-loop/SKILL.md +36 -6
  117. package/skills/debugging-memory/SKILL.md +32 -430
  118. package/skills/debugging-memory/references/pattern-extraction.md +4 -4
  119. package/skills/debugging-memory/references/search.md +32 -120
  120. package/skills/debugging-memory/references/store.md +32 -126
  121. package/skills/debugging-memory/references/subagent-integration.md +1 -1
  122. package/skills/decision-queue/SKILL.md +251 -0
  123. package/skills/decision-queue/assets/template.html +1242 -0
  124. package/skills/decision-queue/references/example-large-queue-batching.md +164 -0
  125. package/skills/decision-queue/scripts/regen_template_constants.py +160 -0
  126. package/skills/defenseclaw-bridge/SKILL.md +2 -2
  127. package/skills/defenseclaw-bridge/references/dc-config-mapping.md +2 -9
  128. package/skills/drain-proposals/SKILL.md +53 -0
  129. package/skills/focused-loop-builder/SKILL.md +31 -0
  130. package/skills/focused-loop-builder/references/spec-format.md +27 -0
  131. package/skills/handoff/SKILL.md +169 -8
  132. package/skills/ibr-bridge/SKILL.md +4 -1
  133. package/skills/knowledge/SKILL.md +26 -14
  134. package/skills/knowledge/references/review-mode.md +2 -3
  135. package/skills/knowledge/templates/madr-minimal.md +1 -1
  136. package/skills/mcp-builder/SKILL.md +1 -1
  137. package/skills/model-bakeoff/SKILL.md +48 -10
  138. package/skills/model-tiering/SKILL.md +92 -31
  139. package/skills/native-ax-driver/SKILL.md +38 -5
  140. package/skills/native-ax-driver/scripts/native_driver.py +278 -22
  141. package/skills/native-ax-driver/scripts/test_native_driver.py +227 -0
  142. package/skills/optimize/SKILL.md +1 -1
  143. package/skills/plugin-builder/SKILL.md +48 -1
  144. package/skills/plugin-builder/references/build-loop-phase-guidance.md +3 -4
  145. package/skills/plugin-builder/references/distribution.md +13 -2
  146. package/skills/plugin-builder/references/plugin-hygiene-lessons.md +2 -2
  147. package/skills/plugin-tests/SKILL.md +2 -2
  148. package/skills/recursive-retrospective/SKILL.md +1 -1
  149. package/skills/repo-closeout/SKILL.md +17 -0
  150. package/skills/repo-closeout/agents/openai.yaml +4 -0
  151. package/skills/repo-maintenance/SKILL.md +179 -0
  152. package/skills/repo-maintenance/agents/openai.yaml +4 -0
  153. package/skills/repo-maintenance/references/pre-public-hygiene.md +134 -0
  154. package/skills/repo-maintenance/references/repository-taxonomy.md +161 -0
  155. package/skills/repo-maintenance/references/safety-protocol.md +106 -0
  156. package/skills/repo-maintenance/references/stack-profiles.md +138 -0
  157. package/skills/repo-maintenance/scripts/audit_repo_maintenance.py +1198 -0
  158. package/skills/repo-maintenance/scripts/test_audit_repo_maintenance.py +506 -0
  159. package/skills/repository-intelligence/SKILL.md +189 -0
  160. package/skills/repository-intelligence/agents/openai.yaml +4 -0
  161. package/skills/repository-intelligence/references/assessment-rubric.md +88 -0
  162. package/skills/repository-intelligence/scripts/repository_inventory.py +347 -0
  163. package/skills/research/SKILL.md +12 -2
  164. package/skills/root-cause-analysis/SKILL.md +1 -1
  165. package/skills/runtime-parity-verification/SKILL.md +36 -1
  166. package/skills/security-methodology/SKILL.md +23 -10
  167. package/skills/security-methodology/references/agentic-handoff-templates.md +220 -0
  168. package/skills/security-methodology/references/cross-source-matrix.md +1 -1
  169. package/skills/security-methodology/references/owasp-agentic-top-10.md +1 -1
  170. package/skills/security-scan/SKILL.md +55 -15
  171. package/skills/self-improve/SKILL.md +70 -50
  172. package/skills/silent-assumptions/SKILL.md +341 -0
  173. package/skills/silent-assumptions/references/elicitation-detectors.md +342 -0
  174. package/skills/spec-writing/SKILL.md +128 -24
  175. package/skills/spec-writing/scripts/check_checklist.py +114 -15
  176. package/skills/ui-design/SKILL.md +6 -4
  177. package/skills/ui-design/references/color-engine.md +132 -0
  178. package/skills/ui-design/references/design-preferences-from-owned-apps.md +8 -8
  179. package/skills/ui-design/references/ui-guidance-sources.md +1 -1
  180. package/skills/ui-design/references/universal-design-principles.alt.md +2 -2
  181. package/plugin-artifacts/codex/.codex-plugin/plugin.json +0 -41
  182. package/plugin-artifacts/codex/AGENTS.md +0 -560
  183. package/plugin-artifacts/codex/BUILD-ARTIFACT.md +0 -5
  184. package/plugin-artifacts/codex/LICENSE +0 -202
  185. package/plugin-artifacts/codex/README.md +0 -313
  186. package/plugin-artifacts/codex/assets/build-loop-plugin-icon.png +0 -0
  187. package/plugin-artifacts/codex/docs/agent-surface-policy.md +0 -63
  188. package/plugin-artifacts/codex/references/advisor-dispatch-ladder.md +0 -62
  189. package/plugin-artifacts/codex/references/agent-role-taxonomy.md +0 -135
  190. package/plugin-artifacts/codex/references/autonomous-and-per-commit-modes.md +0 -161
  191. package/plugin-artifacts/codex/references/autonomy-config.md +0 -231
  192. package/plugin-artifacts/codex/references/backlog-system.md +0 -285
  193. package/plugin-artifacts/codex/references/capability-routing.md +0 -231
  194. package/plugin-artifacts/codex/references/codex-subagents.md +0 -106
  195. package/plugin-artifacts/codex/references/coordination-file-template.md +0 -181
  196. package/plugin-artifacts/codex/references/coordination-rules.md +0 -552
  197. package/plugin-artifacts/codex/references/dogfood-reload-checkpoint.md +0 -112
  198. package/plugin-artifacts/codex/references/halt-and-ask-protocol.md +0 -102
  199. package/plugin-artifacts/codex/references/implementer-envelope-schema.md +0 -302
  200. package/plugin-artifacts/codex/references/intent-capability-pack.md +0 -257
  201. package/plugin-artifacts/codex/references/intent-exploration-prompts.md +0 -96
  202. package/plugin-artifacts/codex/references/leadership.md +0 -72
  203. package/plugin-artifacts/codex/references/memory-systems.md +0 -261
  204. package/plugin-artifacts/codex/references/memory.md +0 -313
  205. package/plugin-artifacts/codex/references/model-tier-mapping.md +0 -296
  206. package/plugin-artifacts/codex/references/modular-systems-pack.md +0 -96
  207. package/plugin-artifacts/codex/references/phase-1-assess.md +0 -249
  208. package/plugin-artifacts/codex/references/phase-2-plan.md +0 -86
  209. package/plugin-artifacts/codex/references/phase-3-execute.md +0 -49
  210. package/plugin-artifacts/codex/references/phase-4-review.md +0 -341
  211. package/plugin-artifacts/codex/references/phase-5-iterate.md +0 -72
  212. package/plugin-artifacts/codex/references/phase-6-learn.md +0 -58
  213. package/plugin-artifacts/codex/references/recent-design-structures.md +0 -274
  214. package/plugin-artifacts/codex/references/research-trigger-policy.md +0 -140
  215. package/plugin-artifacts/codex/references/runtime-smoke-triggers.md +0 -42
  216. package/plugin-artifacts/codex/references/self-review.md +0 -234
  217. package/plugin-artifacts/codex/references/single-writer-commit-protocol.md +0 -90
  218. package/plugin-artifacts/codex/references/task-capture-policy.md +0 -68
  219. package/plugin-artifacts/codex/references/ui-io-contract.md +0 -116
  220. package/plugin-artifacts/codex/references/ui-spotcheck-protocol.md +0 -65
  221. package/plugin-artifacts/codex/references/verify-dispatch.md +0 -85
  222. package/plugin-artifacts/codex/skills/build-loop/SKILL.md +0 -381
  223. package/plugin-artifacts/codex/skills/build-loop/detect-plugins.mjs +0 -82
  224. package/plugin-artifacts/codex/skills/build-loop/eval-guide.md +0 -65
  225. package/plugin-artifacts/codex/skills/build-loop/fallbacks.md +0 -549
  226. package/plugin-artifacts/codex/skills/build-loop/phases/fact-check.md +0 -42
  227. package/plugin-artifacts/codex/skills/build-loop/phases/ui-validation.md +0 -267
  228. package/plugin-artifacts/codex/skills/build-loop/references/advisor-dispatch-ladder.md +0 -62
  229. package/plugin-artifacts/codex/skills/build-loop/references/apple-native-planning.md +0 -439
  230. package/plugin-artifacts/codex/skills/build-loop/references/autonomous-and-per-commit-modes.md +0 -161
  231. package/plugin-artifacts/codex/skills/build-loop/references/capability-routing.md +0 -231
  232. package/plugin-artifacts/codex/skills/build-loop/references/codex-subagents.md +0 -106
  233. package/plugin-artifacts/codex/skills/build-loop/references/coordination.md +0 -161
  234. package/plugin-artifacts/codex/skills/build-loop/references/correction-aware-capture.md +0 -177
  235. package/plugin-artifacts/codex/skills/build-loop/references/experiment-results-template.md +0 -101
  236. package/plugin-artifacts/codex/skills/build-loop/references/independent-auditor.md +0 -72
  237. package/plugin-artifacts/codex/skills/build-loop/references/intent-capability-pack.md +0 -257
  238. package/plugin-artifacts/codex/skills/build-loop/references/intent-exploration-prompts.md +0 -96
  239. package/plugin-artifacts/codex/skills/build-loop/references/leadership.md +0 -72
  240. package/plugin-artifacts/codex/skills/build-loop/references/memory.md +0 -313
  241. package/plugin-artifacts/codex/skills/build-loop/references/modular-systems-pack.md +0 -96
  242. package/plugin-artifacts/codex/skills/build-loop/references/output-style.md +0 -222
  243. package/plugin-artifacts/codex/skills/build-loop/references/pay-it-forward-arch.md +0 -98
  244. package/plugin-artifacts/codex/skills/build-loop/references/phase-1-assess.md +0 -249
  245. package/plugin-artifacts/codex/skills/build-loop/references/phase-2-plan.md +0 -86
  246. package/plugin-artifacts/codex/skills/build-loop/references/phase-3-execute.md +0 -49
  247. package/plugin-artifacts/codex/skills/build-loop/references/phase-4-review.md +0 -341
  248. package/plugin-artifacts/codex/skills/build-loop/references/phase-5-iterate.md +0 -72
  249. package/plugin-artifacts/codex/skills/build-loop/references/phase-6-learn.md +0 -58
  250. package/plugin-artifacts/codex/skills/build-loop/references/recent-design-structures.md +0 -274
  251. package/plugin-artifacts/codex/skills/build-loop/references/refactor-history/ASSESSMENT.md +0 -85
  252. package/plugin-artifacts/codex/skills/build-loop/references/refactor-history/STANDALONE_TEST_RUN.md +0 -149
  253. package/plugin-artifacts/codex/skills/build-loop/references/refactor-history/scenarios/01-simple-bugfix.md +0 -32
  254. package/plugin-artifacts/codex/skills/build-loop/references/refactor-history/scenarios/02-ui-build-with-iteration.md +0 -48
  255. package/plugin-artifacts/codex/skills/build-loop/references/refactor-history/scenarios/03-multi-failure-escalation.md +0 -60
  256. package/plugin-artifacts/codex/skills/build-loop/references/refactor-history/scenarios/04-ui-build-ibr-absent.md +0 -51
  257. package/plugin-artifacts/codex/skills/build-loop/references/refactor-history/scenarios/05-refactor-navgator-absent.md +0 -71
  258. package/plugin-artifacts/codex/skills/build-loop/references/refactor-history/scenarios/06-recurring-bug-debugger-absent.md +0 -52
  259. package/plugin-artifacts/codex/skills/build-loop/references/refactor-history/trace-comparison.md +0 -202
  260. package/plugin-artifacts/codex/skills/build-loop/references/self-recursive-dev.md +0 -77
  261. package/plugin-artifacts/codex/skills/build-loop/references/self-review.md +0 -234
  262. package/plugin-artifacts/codex/skills/build-loop/references/ui-io-contract.md +0 -116
  263. package/plugin-artifacts/codex/skills/build-loop/references/verify-dispatch.md +0 -85
  264. package/plugin-artifacts/codex/skills/build-loop/scanners/audit-design-rules.mjs +0 -476
  265. package/plugin-artifacts/codex/skills/build-loop/scanners/require-visual-evidence.mjs +0 -239
  266. package/plugin-artifacts/codex/skills/build-loop/templates/backlog-item.md +0 -35
  267. package/plugin-artifacts/codex/skills/build-loop/templates/codex-worker-prompt.md +0 -100
  268. package/plugin-artifacts/codex/skills/build-loop/templates/ui-subagent-prompt.md +0 -179
  269. package/plugin-artifacts/codex/skills/build-loop/templates/ux-fix-plan.md +0 -40
  270. package/scripts/build_codex_plugin_artifact.py +0 -321
@@ -0,0 +1,342 @@
1
+ <!-- SPDX-FileCopyrightText: 2025-2026 Tyrone Ross, Jr <46267523+tyroneross@users.noreply.github.com> | SPDX-License-Identifier: Apache-2.0 -->
2
+
3
+ # The eleven detectors, with the real row each was derived from
4
+
5
+ Every example below is a genuine row from the reference register
6
+ (`.build-loop/decisions/2026-09-01-rosslabs-mockup-audit/` in `ross-labs-astro`),
7
+ which the user ruled on. Where he overrode the default, that is recorded — it is
8
+ the strongest available evidence that the detector found something real rather
9
+ than something tidy.
10
+
11
+ The detectors work on your trajectory, not on your memory of it. Before running
12
+ them, assemble the concrete record: files read, commands run, tools called,
13
+ figures reported, subagents briefed, fixes landed. Then take each detector to
14
+ that list. A detector you cannot point at a specific trajectory entry for did not
15
+ fire; do not write a row for it.
16
+
17
+ ---
18
+
19
+ ## 1. `ambiguous-term` — a word with more than one defensible referent
20
+
21
+ **Scan for:** every noun and adjective in the request that could resolve two
22
+ ways. `latest`, `the main page`, `production`, `the tests`, `recent`, `broken`,
23
+ `the config`. Resolve each one out loud and check whether a different resolution
24
+ was equally defensible.
25
+
26
+ **Stopping rule — materiality.** Applied literally to a 400-word brief this
27
+ yields dozens of terms and drowns the register. Keep a term only when a
28
+ different reading would have changed **what you actually did**. If both readings
29
+ lead to the same action, the ambiguity was never load-bearing. This threshold
30
+ was missing from the first version and an auditor had to invent it; it is now
31
+ the rule, not a judgement call.
32
+
33
+ **Worked row — `latest`, leverage `high`, still unruled.**
34
+ "I read 'latest mockups' as most recently edited, not most recently chosen."
35
+ File modification time picked an 11-file batch from Aug 31. The gallery's own
36
+ selection record (`.mockup-gallery/selected.json`) pointed at April 2026 picks.
37
+ Two records disagreed and the agent silently trusted one.
38
+
39
+ **Why it is high leverage:** the whole audit ran on those files. If the referent
40
+ was wrong, every finding describes the wrong artifact.
41
+
42
+ **The tell:** two sources of truth existed and you consulted one. When a repo
43
+ carries an explicit selection, pin, or lockfile, timestamp recency is a *second*
44
+ answer, not the answer.
45
+
46
+ ---
47
+
48
+ ## 2. `scope-narrowed` — you did N of M and did not say so
49
+
50
+ **Scan for:** every count you executed against the count available. Files read
51
+ vs files present. Viewports tested vs profiles shipped. Routes, samples, date
52
+ ranges, log lines, test cases. Write both numbers down; the gap is the row.
53
+
54
+ **Worked row — `viewports`, leverage `med`, user overrode to "add tablet".**
55
+ "I tested two viewports and called that the risk envelope." Scanned at iPhone 14
56
+ and desktop 1440 on the assumption that narrowest-phone and standard-desktop
57
+ bracket the failure modes between them. Evidence names what was skipped:
58
+ `ipad-air`, `ipad-pro-11`, `iphone-14-pro-max`, `pixel-7`. Tablet widths are
59
+ exactly where column counts and sticky headers break.
60
+
61
+ **The tell:** you described a subset with a word that implies the whole —
62
+ "the mockups", "the viewports", "the tests". Say N of M, or write the row.
63
+
64
+ ---
65
+
66
+ ## 3. `rule-applied-or-waived` — a standard invoked, or passed over
67
+
68
+ **Scan for:** every project rule, standing instruction, or memory you acted on,
69
+ and every one that applied and you did not. Both directions are silent calls.
70
+
71
+ **Worked row — `deadbtn`, leverage `high`, user overrode to "expected in a
72
+ mockup", note: "just fix design do not wire buttons if a mockup".**
73
+ "I called the dead buttons real defects, though your own rule exempts mockups."
74
+ The no-fake-buttons rule was applied as if these were shipping pages; the user's
75
+ own instructions explicitly exempt declared mockups and prototypes. Evidence
76
+ names the exact selectors and sizes.
77
+
78
+ **Why the note matters more than the pick:** the user's note is a standing
79
+ policy for all future mockup work, not a comment on these three buttons.
80
+
81
+ **The tell:** you enforced a rule without checking its exemptions, or skipped
82
+ one because it felt inapplicable. Cite the rule's own carve-outs.
83
+
84
+ ---
85
+
86
+ ## 4. `tool-output-as-truth` — a tool's model of importance became yours
87
+
88
+ **Scan for:** every tool whose severity, ranking, score, or verdict you passed
89
+ through unchanged. Then, separately, every scan that returned nothing.
90
+
91
+ **Worked row — `severity`, leverage `med`, user overrode to "re-rank by user
92
+ impact".** "I accepted the tool's severity ranking instead of ranking by user
93
+ harm." IBR labelled no-handler as error and hick-choice-count as warning; the
94
+ agent reported those labels. But they rank by rule type, not by how badly a user
95
+ is blocked. On mobile the dead menu button removes the only navigation
96
+ affordance on the page, and the tool graded it like any other unwired control.
97
+
98
+ **The second half, easily missed:** a scan that found nothing is not a clean
99
+ result. Reading silence as a pass is itself a silent call, and it is the one
100
+ that hides broken instruments. In this same session a contrast rule returned
101
+ `null` when it could not measure, and null read as "no failures".
102
+
103
+ **The tell:** your output inherits a vocabulary you did not choose.
104
+
105
+ ---
106
+
107
+ ## 5. `number-wrong-basis` — a figure whose inputs are assumed
108
+
109
+ **Scan for:** every number you reported. Name its inputs one at a time and mark
110
+ each measured or assumed. One assumed input contaminates the figure.
111
+
112
+ **Worked row — `whitebg`, leverage `high`, user overrode to "re-measure now by
113
+ hand".** "I reported zero contrast failures using a number I know is partly
114
+ wrong." Ratios were computed for 29–34 elements per page; where an element had a
115
+ transparent background the agent assumed the page was white. Page 09 contains a
116
+ near-black container, so text inside it was measured against the wrong
117
+ background. Evidence quotes the tool's own semantic warning: page luminance
118
+ 1.000, container luminance 0.003.
119
+
120
+ **The tell:** you know the caveat and reported the number anyway, with the caveat
121
+ in a different paragraph. If the basis is wrong, the row belongs here even when
122
+ you disclosed the gap in general terms — this agent had flagged coverage, but
123
+ not *this specific inaccuracy*.
124
+
125
+ ---
126
+
127
+ ## 6. `invented-context` — you filled a field no source supplied
128
+
129
+ **Scan for:** every audience, persona, goal, threshold, deadline, priority, or
130
+ success criterion in your output. Trace each to a source. Anything with no
131
+ source, you invented.
132
+
133
+ **Worked row — `audience`, leverage `high`, user overrode to "panel infers it
134
+ from the page".** "I invented the audience the panel is reviewing for." The
135
+ agent told a five-persona panel the audience was technical practitioners,
136
+ AI-curious professionals, and people evaluating the user's credibility. The user
137
+ never defined an audience. Evidence quotes the dispatch verbatim.
138
+
139
+ **The user's note is the real payload:** "let them discover and don't lead them"
140
+ — a standing instruction about how to brief every future panel.
141
+
142
+ **The tell:** you briefed a subagent. Everything in a brief that did not come
143
+ from the user is invented context, and it propagates before anyone can check it.
144
+ This is why invented context is almost always `high`.
145
+
146
+ ---
147
+
148
+ ## 7. `assumed-workflow` — you optimised for a workflow that may not exist
149
+
150
+ **Scan for:** every optimisation target you chose. Precision vs recall. Speed vs
151
+ thoroughness. Strict vs lenient. Fail-closed vs fail-open. Each implies a
152
+ workflow. Name it and ask whether the user has it.
153
+
154
+ **Also scan every ordering call:** what you ran in parallel, and what you ran
155
+ before what. Ordering decides what information a later step has. Observed case:
156
+ an agent was told to run a synthesis pass *after* reviewing a second opinion,
157
+ ran both concurrently to save a round trip, and the synthesis therefore never
158
+ saw the input it was supposed to consume. It announced "two things in parallel",
159
+ which surfaced the action while leaving the overridden sequencing invisible.
160
+
161
+ **Worked row — `recall`, leverage `high`, user overrode to "recall first".**
162
+ "I first optimised for precision, and you corrected me to recall." The agent
163
+ briefed a build to avoid false positives, assuming a CI gate where noise is
164
+ expensive. The user's note: there is no gate; he uses the tool to improve UI by
165
+ hand and would rather catch issues than miss them. Under human triage, silence
166
+ costs far more than noise.
167
+
168
+ **This row is the reason the skill exists.** The assumption had already shaped a
169
+ code fix's acceptance criteria before it was ever stated out loud.
170
+
171
+ **The tell:** you can name the cost you were minimising but not the process that
172
+ makes it costly.
173
+
174
+ ---
175
+
176
+ ## 8. `static-for-dynamic` — you inspected at rest something that has behaviour
177
+
178
+ **Scan for:** everything you looked at but did not operate. A page not clicked.
179
+ An API described from its schema, not called. A script read, not run. A form not
180
+ submitted. A keyboard path not walked.
181
+
182
+ **Worked row — `static`, leverage `high`, user overrode to "full interaction
183
+ session".** "I scanned the pages at rest and never operated them." Evidence
184
+ enumerates precisely what went untested: keyboard tab order, the declared
185
+ `:focus-visible` ring, `prefers-reduced-motion` behaviour, a `<details>`
186
+ disclosure, every hover state.
187
+
188
+ **The tell:** your finding describes what is rendered, and the user's question
189
+ was whether someone can use it. Those are different questions.
190
+
191
+ ---
192
+
193
+ ## 9. `root-cause-not-swept` — you fixed the instances and not the pattern
194
+
195
+ **Scan for:** every fix **or conclusion** you landed. For each, ask whether you
196
+ searched for other instances of the same shape.
197
+
198
+ **And every fix you declined.** The original scan target was "every fix you
199
+ landed", which makes this detector structurally inert on a read-only session —
200
+ review, audit, research, planning — where nothing lands. Declining to fix a
201
+ defect you found is a call, and it is silent unless you said so. Observed case:
202
+ an agent found a live claim-integrity defect mid-review and queued it rather
203
+ than fixing it, which was the right call and an invisible one.
204
+
205
+ **Worked row — `pattern`, leverage `high`, user overrode to "audit every rule
206
+ for silent skips".** "I fixed the four defects I found and did not check whether
207
+ the pattern repeats." The defect shape was a rule returning null instead of
208
+ reporting that it could not measure. Evidence names the unaudited files carrying
209
+ the same shape: three other presets and the built-in run-all path. A third
210
+ instance was later found by someone else.
211
+
212
+ **The tell:** your fix list matches your discovery list exactly. That is a
213
+ coincidence worth one grep.
214
+
215
+ ---
216
+
217
+ ---
218
+
219
+ ## 10. `source-authority` — you obeyed an instruction without checking who sent it
220
+
221
+ **Added 2026-09-01.** The original nine had no detector for this and it was the
222
+ largest-blast-radius class the audit found.
223
+
224
+ **Scan for:** every instruction you obeyed, sorted by who sent it — the human
225
+ principal, a peer agent, a hook, a file on disk, a tool's output. For each
226
+ non-human source, ask what authority you granted it and whether you verified the
227
+ sender.
228
+
229
+ **Worked row — from the audit transcript, `agent-rally-point`, leverage `high`.**
230
+ Six of nine user-role turns in that session were injected by a peer agent over
231
+ Rally, each stamped `[rally: UNVERIFIED SENDER]`. The repo's own
232
+ `docs/security/TRUST-MODEL.md` states the sender field is self-asserted and
233
+ authenticated by nothing. The agent treated all six as authoritative, including
234
+ "You are GO", "Open Item 1 is DONE (do not duplicate)", and an instruction to
235
+ halt a transfer sequence. In the same session it wrote a lucid explanation of
236
+ why that warning label exists.
237
+
238
+ **Consequence shape:** you did work, or skipped work, on the word of a sender
239
+ nobody authenticated. If the claim was wrong or stale, everything downstream
240
+ inherits it, and the register is the only place the trust decision is visible.
241
+
242
+ **The tell:** you can quote the instruction but not name who authored it, or you
243
+ name the author and never checked. Note the interaction with Filter B: a peer
244
+ agent's instruction never cuts a row as a restatement, because "the user" means
245
+ the human principal. Obeying a peer is a call, not a given.
246
+
247
+ ---
248
+
249
+ ## 11. `irreversible-act` — you did something un-undoable while still deciding
250
+
251
+ **Added 2026-09-01.** This is the inverse of detector 8: detector 8 finds what
252
+ you looked at but did not operate; this finds what you operated and cannot
253
+ un-operate.
254
+
255
+ **Scan for:** every act with no undo. A write to an append-only ledger. A push.
256
+ A dispatch to another agent. A published artifact. A sent message. A released
257
+ lock or a claimed seat. For each, ask whether the decision to do it was settled
258
+ at the moment you did it.
259
+
260
+ **Worked row — from the audit transcript, leverage `high`.** An instruction
261
+ arrived at 07:04:02Z saying "do not edit files, claim work, or change Rally
262
+ state." At 07:04:13Z, eleven seconds later, the agent ran `rally enter`, which
263
+ appended a presence fact to an append-only ledger at seq 14608. The agent's own
264
+ account — that the write committed before the message landed — is true from
265
+ inside its turn and false against the clock.
266
+
267
+ **Consequence shape:** the record now contains something the user asked not to
268
+ be there, and no later decision can remove it.
269
+
270
+ **The tell:** you describe an action in the past tense and cannot describe how to
271
+ undo it. That is the row. Set `"escalate": true` on it — the skill's offer
272
+ threshold surfaces an irreversible consequence immediately, at any score.
273
+
274
+ ---
275
+
276
+ ## Adversarial audit, 2026-09-01 — what changed and why
277
+
278
+ The first nine detectors were run against a real 915KB multi-agent transcript
279
+ from a different repo by an auditor briefed to break the procedure rather than
280
+ confirm it. Results, kept here because they calibrate what this procedure is
281
+ worth:
282
+
283
+ - **28 raw candidates → 14 survivors.** 5 cut as restatements, 5 cut for having
284
+ no writable consequence, 4 cut because the agent had already surfaced the call.
285
+ - **Restatement rate 18%, and the auditor called that a floor**, not a
286
+ measurement, because it knew Filter B before generating and suppressed obvious
287
+ restatements at write time. Treat 18% as the optimistic end.
288
+ - **The three strongest survivors** were: a second-opinion brief that pre-loaded
289
+ the requester's own diagnoses under a "do not re-derive" heading, spending an
290
+ independent review on a critique of the first opinion; a standing rule applied
291
+ to the artifact the user named and waived 25 seconds later on the only prompt
292
+ that actually shipped; and a green verdict issued on a peer's CI fix by a
293
+ session that ran no tests. None appears in any instruction.
294
+
295
+ Five defects it found, all now fixed above or in `SKILL.md`:
296
+
297
+ 1. **Filter B did not define whose words count.** With peer-authored turns
298
+ counted as "the user's", the restatement rate swung 18% → 4% and the
299
+ session's largest assumption disappeared. Now: "the user" is the human
300
+ principal; a peer instruction is a source, and detector 10 covers it.
301
+ 2. **Detector 1 had no stopping rule.** Now: materiality.
302
+ 3. **Leverage `high` did not define "consumed."** Now: handed off, not observed
303
+ being used. Delivery is the line.
304
+ 4. **Filter A demanded a "when" that none of the worked examples exhibited.**
305
+ Now: a condition satisfies it, not only a clock time.
306
+ 5. **Detector 9 was inert on read-only sessions.** Now: conclusions and declined
307
+ work count, not only landed fixes.
308
+
309
+ One class it named remains only partly addressed: **narrated but not flagged**,
310
+ where the agent describes the action while never signalling that a choice with
311
+ alternatives existed. Four of fourteen survivors sat in that grey zone. `SKILL.md`
312
+ Filter B now states that narration does not disqualify a row, but there is no
313
+ mechanical test for it, and a register built by a lenient reader will include
314
+ rows a strict reader would cut.
315
+
316
+ ## Calibration: what this session produced
317
+
318
+ 20 rows from one audit: 8 `high`, 8 `med`, 4 `low`. The user ruled on 14 and
319
+ overrode 12 of those, writing notes on 8. Six rows were left unruled, one of them
320
+ `high` (`latest`).
321
+
322
+ Two numbers worth carrying:
323
+
324
+ - **A 60% override rate** means the defaults were defensible but frequently not
325
+ what he wanted. That is the normal case, not a failure — it is the argument
326
+ for the register.
327
+ - **8 notes on 14 rulings.** More than half the rulings carried free text, and
328
+ several were standing policy rather than a comment on that row. A design that
329
+ captured only the pick would have lost most of the instruction.
330
+
331
+ ## Anti-patterns that make a register worthless
332
+
333
+ - **Restating the brief.** "I audited the mockups because you asked me to audit
334
+ the mockups" is not a silent assumption. Filter B exists for this.
335
+ - **A row with no consequence.** If you cannot say what breaks, for whom, and
336
+ when, delete it. Filter A exists for this.
337
+ - **Vague evidence.** "The scan showed issues" is not evidence. A path, a
338
+ selector, a line number, a PID, a count, or command output is.
339
+ - **Binary options on a non-binary call.** Three of the rows the user overrode
340
+ had a third option, and he picked the third twice.
341
+ - **Leverage rated by difficulty.** The hardest call in a session is often
342
+ `low`. Rate by what consumed it.
@@ -31,6 +31,8 @@ A skill that walks a completeness checklist before producing a build-loop-compat
31
31
 
32
32
  Walk every item before writing a single line of the plan body. For each item, record the answer (or "N/A with reason") inline in a `<!-- checklist -->` HTML comment block at the top of the plan file so the critic can verify it.
33
33
 
34
+ > **Architectural-class pre-plan alignment (gated).** When the build is **architectural-class** — it introduces new module boundaries, a schema change, or a cross-surface contract — reach a *shared design concept* with the requester (intent-restatement / brainstorming) **before** the plan asset is created, and carry a **required architecture note** in the plan (goal-level design intent, the boundary/contract being established, and why this shape over the alternatives; link the relevant ADRs from Item 12). Peer-reviewed evidence (ICSE 2026) shows architecture documentation *in the loop* substantially improves functional correctness, architectural conformance, and modularity, and that gated + architecture-anchored spec-driven development reverses the codebase-entropy decay that "never read the code" pipelines cause. For non-architectural changes (isolated fix, single-surface feature), skip this note — it is not a universal gate. Source: `build-loop-memory/research/2026-07-06-ai-coding-fundamentals-and-harness-claims.md` (Claim 3).
35
+
34
36
  ### Item 1 — Auth guard utility
35
37
 
36
38
  **Prompt:** Name the auth guard utility used by similar endpoints (e.g., `requireAuth` from `lib/api-auth-guard.ts`). Reject "match existing pattern" without naming it.
@@ -161,10 +163,10 @@ For each new POST/PUT/PATCH route: name the validation library and schema file.
161
163
  ```bash
162
164
  # Verify ID prefixes appear in the plan body
163
165
  grep -E "\bU-[0-9]+\b|\bF-[0-9]+\b|\bD-[0-9]+\b|\bS-[0-9]+\b|\bT-[0-9]+\b|\bA-[0-9]+\b" \
164
- docs/plans/<feature-slug>.md | head -20
166
+ .build-loop/plans/<feature-slug>.md | head -20
165
167
 
166
168
  # Every [P0] line must have at least one T- reference on the same or adjacent line
167
- grep -n "\[P0\]" docs/plans/<feature-slug>.md
169
+ grep -n "\[P0\]" .build-loop/plans/<feature-slug>.md
168
170
  ```
169
171
 
170
172
  The checklist answer must name at least one full trace chain (e.g., `U-01 → F-03 → D-02 → T-07`). If the spec has no P0 items, write "N/A: no P0 scope."
@@ -178,8 +180,8 @@ The checklist answer must name at least one full trace chain (e.g., `U-01 → F-
178
180
  **How to check:**
179
181
 
180
182
  ```bash
181
- grep -n "## Spec Object" docs/plans/<feature-slug>.md
182
- grep -n '```json' docs/plans/<feature-slug>.md | head -5
183
+ grep -n "## Spec Object" .build-loop/plans/<feature-slug>.md
184
+ grep -n '```json' .build-loop/plans/<feature-slug>.md | head -5
183
185
  ```
184
186
 
185
187
  The plan must contain a `## Spec Object (JSON)` section with a fenced JSON block whose top-level keys include `needs`, `features`, and `tests`. If the plan is a one-line doc update with no structured outputs, write "N/A: doc-only change, no spec object required."
@@ -193,9 +195,9 @@ The plan must contain a `## Spec Object (JSON)` section with a fenced JSON block
193
195
  **How to check:**
194
196
 
195
197
  ```bash
196
- grep -n "blocking-test:" docs/plans/<feature-slug>.md
197
- grep -n "\[ASSUMED:\]" docs/plans/<feature-slug>.md
198
- grep -n "## Open Questions" docs/plans/<feature-slug>.md
198
+ grep -n "blocking-test:" .build-loop/plans/<feature-slug>.md
199
+ grep -n "\[ASSUMED:\]" .build-loop/plans/<feature-slug>.md
200
+ grep -n "## Open Questions" .build-loop/plans/<feature-slug>.md
199
201
  ```
200
202
 
201
203
  Each entry in the "Open Questions" section must carry a `blocking-test: T-NN` annotation. Questions without that annotation are invalid — resolve them as `[ASSUMED: ...]` in the spec body instead.
@@ -209,9 +211,9 @@ Each entry in the "Open Questions" section must carry a `blocking-test: T-NN` an
209
211
  **How to check:**
210
212
 
211
213
  ```bash
212
- grep -n "## ADR-" docs/plans/<feature-slug>.md
214
+ grep -n "## ADR-" .build-loop/plans/<feature-slug>.md
213
215
  grep -in "low-reversib\|db choice\|auth provider\|api contract\|public schema" \
214
- docs/plans/<feature-slug>.md
216
+ .build-loop/plans/<feature-slug>.md
215
217
  ```
216
218
 
217
219
  Every "Locked Decision" row tagged as low-reversibility must reference an `ADR-NN` entry. If no low-reversibility decisions exist in this spec, write "N/A: all decisions are reversible."
@@ -225,7 +227,7 @@ Every "Locked Decision" row tagged as low-reversibility must reference an `ADR-N
225
227
  **How to check:**
226
228
 
227
229
  ```bash
228
- grep -in "Analytical lens:" docs/plans/<feature-slug>.md
230
+ grep -in "Analytical lens:" .build-loop/plans/<feature-slug>.md
229
231
  ```
230
232
 
231
233
  The Locked Decisions section must contain a line matching `Analytical lens: <name>` (e.g., `Analytical lens: QFD — need-to-feature mapping`). If multiple lenses apply, list all. Choosing "none / not applicable" is only valid for trivial patches with no user-facing scope.
@@ -234,13 +236,13 @@ The Locked Decisions section must contain a line matching `Analytical lens: <nam
234
236
 
235
237
  ### Item 14 — Coding-agent handoff document
236
238
 
237
- **Prompt:** Generate a coding-agent handoff document (`docs/plans/<slug>.handoff.md`) alongside the plan. Aggregates ADRs + Tests + relevant context with explicit pointers ("When implementing F-08, read ADR-002 and satisfy T-19"). The implementer subagent reads the handoff, not the plan.
239
+ **Prompt:** Generate a coding-agent handoff document (`.build-loop/plans/<slug>.handoff.md`) alongside the plan. Aggregates ADRs + Tests + relevant context with explicit pointers ("When implementing F-08, read ADR-002 and satisfy T-19"). The implementer subagent reads the handoff, not the plan.
238
240
 
239
241
  **How to check:**
240
242
 
241
243
  ```bash
242
- ls docs/plans/<feature-slug>.handoff.md
243
- grep -n "When implementing\|read ADR-\|satisfy T-" docs/plans/<feature-slug>.handoff.md | head -10
244
+ ls .build-loop/plans/<feature-slug>.handoff.md
245
+ grep -n "When implementing\|read ADR-\|satisfy T-" .build-loop/plans/<feature-slug>.handoff.md | head -10
244
246
  ```
245
247
 
246
248
  The sibling `<slug>.handoff.md` file must exist and contain at least one implementation pointer linking a feature ID to an ADR or test ID. If the plan has no P0 features (doc-only), write "N/A: no implementation tasks."
@@ -287,7 +289,7 @@ If the plan adds no UI surface (API/backend only), write "N/A: no UI surface."
287
289
  **How to check:**
288
290
 
289
291
  ```bash
290
- grep -n "risk_reason:" docs/plans/<feature-slug>.md
292
+ grep -n "risk_reason:" .build-loop/plans/<feature-slug>.md
291
293
  ```
292
294
 
293
295
  If `risk_reason:` is present, its value must be exactly one of the five canonical strings above. Any other value causes a BLOCKER in `plan_verify.py` (rule `risk-reason-invalid-value`). If none of the five applies, omit `risk_reason:` entirely — absent is fine; only invalid values are rejected.
@@ -327,7 +329,7 @@ If no UI surface is in scope, write "N/A: no UI surface."
327
329
  **How to check:**
328
330
 
329
331
  ```bash
330
- grep -n "dispatch_tier:" docs/plans/<feature-slug>.md
332
+ grep -n "dispatch_tier:" .build-loop/plans/<feature-slug>.md
331
333
  ```
332
334
 
333
335
  Each value must be exactly one of `script | haiku | sonnet | opus | frontier`. Omit the field for an item whose tier is obvious from context; the checks fire only on a declared tier that fights its task description. (`frontier` never trips a sanity WARN — it is the top judgment tier, never a "waste" smell.)
@@ -372,6 +374,80 @@ If the change adds no new external service, write "N/A: no new external service.
372
374
 
373
375
  ---
374
376
 
377
+ ### Item 20 — Capability gap map (implementation plans)
378
+
379
+ **Gate:** this item fires for non-trivial implementation plans: code changes, workflow changes, migrations, API/schema changes, UI surfaces, hooks/watchers, or anything with a multi-step execution table. If the plan is doc-only, config-only, or a trivial local edit, write "N/A: no implementation capability gap."
380
+
381
+ **Why:** this prevents the planner from describing the desired future while skipping the current source of truth. It makes the build plan answer, explicitly, "what already exists, what target behavior is required, what is missing, and how will we close that gap?"
382
+
383
+ **Prompt:** add a `## Capability Gap Map` section with one row per capability, workflow, or contract the build changes:
384
+
385
+ - **Capability/Workflow** — the user or system capability being changed.
386
+ - **Current source of truth** — file, schema, route, test, doc, or explicit "none found" evidence.
387
+ - **Target behavior** — the desired behavior after the build.
388
+ - **Gap** — what is missing, stale, broken, duplicated, or misaligned.
389
+ - **Build action** — the concrete change that closes the gap.
390
+ - **Owned files/contracts** — exact files, contracts, or APIs the work will touch.
391
+ - **Validation** — the test, command, or manual check that proves closure.
392
+
393
+ **How to check:**
394
+
395
+ ```bash
396
+ grep -n "## Capability Gap Map" .build-loop/plans/<feature-slug>.md
397
+ grep -in "current source of truth\|target behavior\|gap\|validation" .build-loop/plans/<feature-slug>.md
398
+ ```
399
+
400
+ The section should be small enough to guide execution. Do not create a separate gap-closure plan unless the user explicitly asks for a standalone artifact or the gap map is too large for the main plan.
401
+
402
+ ---
403
+
404
+ ### Item 21 — Single-shot build guardrails (implementation plans)
405
+
406
+ **Gate:** this item fires for non-trivial implementation plans. If there is no implementation task, write "N/A: no implementation tasks."
407
+
408
+ **Why:** this captures the failure modes that would cause rework before code is written. A good plan should name the constraints that keep the first implementation attempt from drifting, overbuilding, omitting validation, or regressing adjacent behavior.
409
+
410
+ **Prompt:** add a `## Single-Shot Build Guardrails` section. Each guardrail must be concrete and cite evidence:
411
+
412
+ - **Guardrail** — the rule the implementer must preserve.
413
+ - **Prevents** — the failure mode it blocks.
414
+ - **Evidence/test** — the command, test, existing file, ADR, or acceptance criterion that proves compliance.
415
+
416
+ **How to check:**
417
+
418
+ ```bash
419
+ grep -n "## Single-Shot Build Guardrails" .build-loop/plans/<feature-slug>.md
420
+ grep -in "guardrail\|prevents\|evidence" .build-loop/plans/<feature-slug>.md
421
+ ```
422
+
423
+ Reject generic rules like "keep it simple" unless they cite the exact file, scope boundary, or validation that makes the rule enforceable.
424
+
425
+ ---
426
+
427
+ ### Item 22 — Read-before-edit map (implementation plans)
428
+
429
+ **Gate:** this item fires for non-trivial implementation plans. If there is no implementation task, write "N/A: no implementation tasks."
430
+
431
+ **Why:** this reduces build-from-memory errors. It tells the implementer which files, tests, contracts, or docs must be read before editing each chunk, and why those reads matter.
432
+
433
+ **Prompt:** add a `## Read-Before-Edit Map` section with one row per work item:
434
+
435
+ - **Chunk/Work item** — the commit, feature, or task.
436
+ - **Read first** — exact files, tests, contracts, docs, or search commands.
437
+ - **Why it matters** — the invariant or coupling the read protects.
438
+ - **Edit after** — exact files/directories to modify only after the reads are complete.
439
+
440
+ **How to check:**
441
+
442
+ ```bash
443
+ grep -n "## Read-Before-Edit Map" .build-loop/plans/<feature-slug>.md
444
+ grep -in "read first\|why\|edit after" .build-loop/plans/<feature-slug>.md
445
+ ```
446
+
447
+ The map must be repo-grounded. "Review existing code" is insufficient; name the files or the command that finds them.
448
+
449
+ ---
450
+
375
451
  ## Frontmatter fields used by routing
376
452
 
377
453
  These fields appear in plan or chunk frontmatter and affect orchestrator routing decisions. They are validated by `scripts/plan_verify.py`.
@@ -386,7 +462,7 @@ These fields appear in plan or chunk frontmatter and affect orchestrator routing
386
462
 
387
463
  ## Plan Output Template
388
464
 
389
- After the checklist is complete, write the plan to `docs/plans/<feature-slug>.md` using this structure:
465
+ After the checklist is complete, write the plan to `.build-loop/plans/<feature-slug>.md` using this structure:
390
466
 
391
467
  ```markdown
392
468
  # Plan: <Feature Name>
@@ -409,7 +485,11 @@ Item 14 — Handoff document: <answer>
409
485
  Item 15 — Synthesis dimensions: <answer>
410
486
  Item 16 — Risk reason: <answer>
411
487
  Item 17 — UI input/output contract: <answer>
488
+ Item 18 — Dispatch tier per work item: <answer>
412
489
  Item 19 — Env-var manifest: <answer or "N/A: no new external service">
490
+ Item 20 — Capability gap map: <answer or "N/A: no implementation capability gap">
491
+ Item 21 — Single-shot build guardrails: <answer or "N/A: no implementation tasks">
492
+ Item 22 — Read-before-edit map: <answer or "N/A: no implementation tasks">
413
493
  -->
414
494
 
415
495
  ## Goal
@@ -436,6 +516,24 @@ Item 19 — Env-var manifest: <answer or "N/A: no new external service">
436
516
  | 2 | feat(...): ... | ... | C1 |
437
517
  ...
438
518
 
519
+ ## Capability Gap Map
520
+
521
+ | Capability/Workflow | Current source of truth | Target behavior | Gap | Build action | Owned files/contracts | Validation |
522
+ |---|---|---|---|---|---|---|
523
+ | ... | ... | ... | ... | ... | ... | ... |
524
+
525
+ ## Single-Shot Build Guardrails
526
+
527
+ | Guardrail | Prevents | Evidence/test |
528
+ |---|---|---|
529
+ | ... | ... | ... |
530
+
531
+ ## Read-Before-Edit Map
532
+
533
+ | Chunk/Work item | Read first | Why it matters | Edit after |
534
+ |---|---|---|---|
535
+ | ... | ... | ... | ... |
536
+
439
537
  ## F-Criteria (functional)
440
538
 
441
539
  | Criterion | Pass condition | Grader |
@@ -479,9 +577,9 @@ When the checklist surfaces an unknown that cannot be answered from the plan con
479
577
 
480
578
  Search each of these locations for keywords related to the unknown. Use `grep -ri <keyword>` against each path.
481
579
 
482
- 1. `~/.claude/projects/-Users-tyroneross/memory/` — user-global feedback, reference, pattern files
483
- 2. `~/dev/git-folder/build-loop-memory/` — build-loop global memory (if it exists)
484
- 3. `~/dev/git-folder/build-loop-memory/projects/<slug>/` — project-local memory (slug from `derive_slug_from_cwd`)
580
+ 1. `~/.claude/projects/<slug-for-$HOME>/memory/` — user-global feedback, reference, pattern files, if present. Claude Code derives the slug from an absolute path by replacing every `/` with `-` (e.g. `$HOME` of `/Users/yourname` → `-Users-yourname`); if unsure, glob `~/.claude/projects/*/memory/` and grep across matches
581
+ 2. `<memory-store-root>/` — build-loop global memory (if it exists)
582
+ 3. `<memory-store-root>/projects/<slug>/` — project-local memory (slug from `derive_slug_from_cwd`)
485
583
 
486
584
  **If a feedback, reference, or pattern entry covers the unknown → use it. Mark it `[ASSUMED: from memory/<filename>]`. Done.**
487
585
 
@@ -564,7 +662,7 @@ After writing the plan, run both verifiers before returning. Attempt up to 3 fix
564
662
 
565
663
  ```bash
566
664
  python3 ${CLAUDE_PLUGIN_ROOT}/skills/spec-writing/scripts/check_checklist.py \
567
- --plan docs/plans/<feature-slug>.md --json
665
+ --plan .build-loop/plans/<feature-slug>.md --json
568
666
  ```
569
667
 
570
668
  Exit 0 = checklist complete. Exit 1 = items missing — revise the plan's checklist block and re-run.
@@ -573,7 +671,7 @@ Also run the existing plan-verify script:
573
671
 
574
672
  ```bash
575
673
  python3 ${CLAUDE_PLUGIN_ROOT}/scripts/plan_verify.py \
576
- docs/plans/<feature-slug>.md --repo "$PWD" --json
674
+ .build-loop/plans/<feature-slug>.md --repo "$PWD" --json
577
675
  ```
578
676
 
579
677
  Both must exit 0 before proceeding to Step B.
@@ -601,8 +699,14 @@ The critic's output has `strong_checkpoint_count` (its name for WARN findings th
601
699
 
602
700
  ## Output Convention
603
701
 
604
- 1. Write the plan to `docs/plans/<feature-slug>.md` (create `docs/plans/` if it doesn't exist).
605
- 2. Commit on a docs-only commit with subject `docs(plans): draft <feature-slug> spec` BEFORE any implementation branches are cut.
606
- 3. Copy the plan path into `.build-loop/plan.md` (symlink or copy — copy is fine) so Phase 3 Execute picks it up.
702
+ 1. Write the plan to `.build-loop/plans/<feature-slug>.md` (create `.build-loop/plans/` if it doesn't exist).
703
+ 2. Copy the plan path into `.build-loop/plan.md` (symlink or copy copy is fine) so Phase 3 Execute picks it up.
704
+
705
+ A plan is a run artifact, not a published document. `.build-loop/` is gitignored, so
706
+ the plan stays out of the public tree and needs no docs-only commit. When a plan is
707
+ worth keeping past the run, Review-G promotes it to build-loop-memory through
708
+ `scripts/archive_project_plan.py` — never to `docs/`. Writing plans, retrospectives,
709
+ RCAs, or session handoffs into `docs/` puts private working material in a published
710
+ surface; see `references/public-repository-documentation-boundary.md`.
607
711
 
608
712
  Return the plan path, the checklist answers, and the final verifier JSON to the caller.