@tyroneross/build-loop 0.36.1 → 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 +10 -4
  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 +55 -1
  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 +22 -9
  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
@@ -1,140 +1,52 @@
1
- <!-- PROVENANCE: op=search reference for `build-loop:debugging-memory` (ADR-01 op-routing). Folded from skills/debugging/memory/SKILL.md (former skill name build-loop:debugging-memory-search, v0.1.0) on 2026-07-02, pool-consolidation Inc 5. Drift-check vs upstream retired (native, adapted; no canonical upstream). Former provenance for record: source=claude-code-debugger/skills/debugging-memory/SKILL.md source_hash=5c4ee5ada781107e7def92abeca4d51fc0efc61700f7cf43e948da34f4c0681d -->
1
+ <!-- PROVENANCE: op=search reference for build-loop:debugging-memory. Native core refreshed from @tyroneross/claude-code-debugger v1.9.0 at 74cc2cc96ce7c212a81d41b85143dc1fc9094bc3 on 2026-08-25. -->
2
2
 
3
3
  <!-- SPDX-FileCopyrightText: 2025-2026 Tyrone Ross, Jr <46267523+tyroneross@users.noreply.github.com> | SPDX-License-Identifier: Apache-2.0 -->
4
4
 
5
- # Debugging Memory Workflow (Native, Sourced)
5
+ # Native Debugging Memory Search
6
6
 
7
- Memory-first debugging. Core principle: **never solve the same bug twice**. Native to build-loop; initially adapted from the debugger workflow lineage. Search local `.build-loop/issues/` first, then use standalone Coding Debugger for cross-project memory only when that plugin is installed.
7
+ Build Loop owns this debugger. It does not require the standalone Coding Debugger package or MCP server. Search and store both use the project's structured `.claude/memory/` root.
8
8
 
9
- > **Op-routing note**: this is the `op: "search"` reference for `build-loop:debugging-memory` — the memory LOOKUP step. Callers invoke `Skill("build-loop:debugging-memory") with input { op: "search", symptom, domain? }`; this file holds the lookup procedure the workflow delegates to (ADR-01).
9
+ ## Invoke
10
10
 
11
- ## When to Activate
11
+ Before investigating a bug, run:
12
12
 
13
- - Phase 1 Assess: pull recent project incident context for orientation (`list-recent` intent)
14
- - Phase 4 Review-B Validate: on every criterion failure with an error-like signal — read logs first, synthesize symptom, search memory
15
- - Phase 5 Iterate: at the start of every Iterate attempt, re-search with the new symptom (failure may have shifted shape after a fix)
13
+ ```bash
14
+ node "${CLAUDE_PLUGIN_ROOT}/bin/build-loop-debugger.js" search "<symptom>" \
15
+ --threshold 0.6 --workdir "$PWD"
16
+ ```
16
17
 
17
- ## Memory-First Approach
18
+ The command returns JSON with `memory_root`, `debugger_core_version`, and a verdict:
18
19
 
19
- Before investigating any bug, check debugging memory with the symptom description.
20
+ - `KNOWN_FIX`: direct-apply only if the strict gate passes.
21
+ - `LIKELY_MATCH`: use the incident as a hypothesis and run the normal fix loop.
22
+ - `WEAK_SIGNAL`: consider the result, but investigate fresh.
23
+ - `NO_MATCH`: investigate fresh and store the verified result afterward.
20
24
 
21
- The search returns a **verdict** with matching incidents and patterns when structured memory is available. File-backed fallback returns a degraded local verdict with the same action shape.
25
+ ## Strict direct-apply gate
22
26
 
23
- **Verdict-based decision tree:**
27
+ All three checks must pass:
24
28
 
25
- 1. **KNOWN_FIX**: Apply the documented fix directly only when the strict direct-apply gate (below) passes; otherwise adapt the prior incident as a hypothesis and route to the standard fix flow
26
- 2. **LIKELY_MATCH**: Review the past incident, use it as a starting point never direct-apply
27
- 3. **WEAK_SIGNAL**: Consider loosely related incidents, but investigate fresh
28
- 4. **NO_MATCH**: Proceed with standard debugging via `build-loop:debug-loop`, then document the solution after
29
+ 1. At least one recorded file exists at the same relative path.
30
+ 2. Recorded dependency versions match the current project within minor version. Missing version evidence fails this check.
31
+ 3. A second signal matches: error class, callsite, or a corroborating log entry.
29
32
 
30
- ### Direct-apply gate (KNOWN_FIX only)
33
+ React-hook, performance, and "increase a limit" fixes never direct-apply because they are context-sensitive.
31
34
 
32
- All three must pass — otherwise downgrade to adapted-plan routing and record `direct_apply_blocked_by`:
35
+ ## Retrieval depth
33
36
 
34
- 1. **file_match**: at least one file in the prior incident's `files_changed` exists in current repo at same relative path
35
- 2. **version_match**: dependency versions in the prior incident match current within minor (semver). If the prior incident's `tags` include a version, compare it to current `package.json`/`requirements.txt`/etc.
36
- 3. **second_signal**: at least one secondary signal — same error class, same callsite line range, or same component layer
37
+ The initial search returns compact matches. Load a full incident only when needed:
37
38
 
38
- Skip direct-apply for any pattern with category `react-hooks`, `performance`, or anything where the fix is "increase value X" — those are context-sensitive.
39
+ ```bash
40
+ node "${CLAUDE_PLUGIN_ROOT}/bin/build-loop-debugger.js" detail <INC_ID> --workdir "$PWD"
41
+ ```
39
42
 
40
- ## Progressive Depth Retrieval
43
+ Announce the search and report whether it found a match. Store the verified outcome through the same native command described in `store.md`.
41
44
 
42
- 1. **Initial search**: local build-loop incident lookup; if standalone Coding Debugger is available, use its `search` tool for cross-project matches
43
- 2. **Drill down**: read the local issue file or, for Coding Debugger matches, use `detail` with the ID
44
- 3. **Outcome tracking**: for Coding Debugger matches, use `outcome` to record whether the fix worked
45
+ ## Lifecycle
45
46
 
46
- ## Visibility
47
+ - Phase 1 Assess: search for relevant project incidents.
48
+ - Review-B failure: search the exact current error before changing code.
49
+ - Each Iterate attempt: search again if the symptom changes.
50
+ - Review-F: store every newly resolved, verified incident.
47
51
 
48
- When this skill activates, always announce it to the user:
49
-
50
- 1. **Before searching**: "Checking debugging memory for similar issues..."
51
- 2. **After search**: "Found X matching incident(s) from past debugging sessions" or "No matching incidents — starting fresh investigation"
52
-
53
- ## Deep Investigation Mode
54
-
55
- For non-trivial issues, escalate to the `build-loop:debug-loop` skill. Trigger is the **verdict category**, not a numeric confidence score:
56
-
57
- - **`KNOWN_FIX`** → apply directly, skip the loop
58
- - **`LIKELY_MATCH`** → enter debug loop (past incidents need verification against current context)
59
- - **`WEAK_SIGNAL`** → enter debug loop (loosely related, fresh investigation needed)
60
- - **`NO_MATCH`** → enter debug loop (no prior knowledge)
61
-
62
- Also enter the debug loop when:
63
- - Initial diagnosis feels superficial
64
- - Previous fix didn't hold
65
- - User explicitly asks for root-cause analysis
66
- - Multiple symptoms suggest a shared cause
67
-
68
- ## Basic Steps (simple, clear-cut issues)
69
-
70
- 1. **Reproduce** — exact steps, environmental factors, minimal repro
71
- 2. **Isolate** — binary search recent changes, disable components, check logs
72
- 3. **Diagnose** — trace execution, examine state, identify offending code
73
- 4. **Fix** — minimal, targeted, no side effects
74
- 5. **Verify** — original repro, related tests, regression check
75
-
76
- ## Incident Documentation
77
-
78
- After fixing a bug, store via `build-loop:debugging-memory` `{op:"store"}`. Required fields: `symptom`, `root_cause`, `fix`. Optional: `category`, `tags`, `files_changed`, `file`.
79
-
80
- ## Quality Indicators
81
-
82
- The memory system scores incidents on:
83
- - Root cause analysis depth (30%)
84
- - Fix documentation completeness (30%)
85
- - Verification status (20%)
86
- - Tags and metadata (20%)
87
-
88
- Target 75%+ quality score for effective future retrieval.
89
-
90
- ## Tagging Strategy
91
-
92
- - Technology: `react`, `typescript`, `api`, `database`
93
- - Category: `logic`, `config`, `dependency`, `performance`
94
- - Symptom type: `crash`, `render`, `timeout`, `validation`
95
-
96
- ## Pattern Recognition
97
-
98
- The memory system extracts patterns when 3+ similar incidents exist. Patterns have higher reliability than individual incidents. When a pattern matches, trust the solution template (90%+ confidence), apply the recommended approach, note caveats.
99
-
100
- ## Optional Coding Debugger Tools
101
-
102
- | Tool | Purpose |
103
- |------|---------|
104
- | `search` | Search memory for similar bugs (returns verdict) |
105
- | `store` | Store a new debugging incident |
106
- | `detail` | Get full incident or pattern details |
107
- | `status` | Show memory statistics |
108
- | `list` | List recent incidents |
109
- | `patterns` | List known fix patterns |
110
- | `outcome` | Record whether a fix worked |
111
-
112
- Use these only when standalone Coding Debugger is installed. Build-loop does not register these MCP tools itself.
113
-
114
- ## Review-F Outcome Feedback
115
-
116
- Closes the memory-first gate's feedback loop. Both required:
117
-
118
- - For each newly resolved Review-B/Iterate failure: invoke `build-loop:debugging-memory` `{op:"store"}` with `{symptom, root_cause, fix, tags: ["build-loop", project, layer], files}`
119
- - For each Review-B memory gate where standalone Coding Debugger supplied a prior `KNOWN_FIX` or `LIKELY_MATCH`: invoke its `outcome` tool with `{incident_id, result: "worked"|"failed"|"modified", notes}` — this trains the optional verdict classifier
120
-
121
- Skipping `outcome` means the optional verdict classifier never improves.
122
-
123
- ## Subagent Integration
124
-
125
- When debugging involves subagents:
126
-
127
- 1. **Pre-query memory once** through `build-loop:debugging-memory` before spawning agents
128
- 2. **Distribute context** — each agent gets relevant subset
129
- 3. **Aggregate findings** — collect insights from all agents
130
- 4. **Store unified incident** — single `build-loop:debugging-memory` `{op:"store"}` call to document combined diagnosis
131
-
132
- Subagents do not inherit Skill or MCP access — pre-load context into their prompt.
133
-
134
- ## Sibling Skills
135
-
136
- - `build-loop:debugging-memory` `{op:"store"}` — write incident after fix
137
- - `build-loop:debugging-memory` `{op:"assess"}` — parallel domain assessment for multi-domain symptoms
138
- - `build-loop:debug-loop` — iterative root-cause analysis with causal-tree investigation
139
-
140
- *Source: adapted from the debugger workflow lineage and maintained as a build-loop-native skill. Drift-checked by `build-loop:sync-skills`.*
52
+ `.build-loop/issues/` remains the executable/open-issue lane. Do not write resolved debugger history there.
@@ -1,145 +1,51 @@
1
- <!-- PROVENANCE: op=store reference for `build-loop:debugging-memory` (ADR-01 op-routing). Folded from skills/debugging/store/SKILL.md (former skill name build-loop:debugging-store, v0.1.0) on 2026-07-02, pool-consolidation Inc 5. Drift-check vs upstream retired (native, adapted; no canonical upstream). Former provenance for record: source=claude-code-debugger/skills/debugging-memory/SKILL.md §Incident-Documentation source_hash=5c4ee5ada781107e7def92abeca4d51fc0efc61700f7cf43e948da34f4c0681d -->
1
+ <!-- PROVENANCE: op=store reference for build-loop:debugging-memory. Native core refreshed from @tyroneross/claude-code-debugger v1.9.0 at 74cc2cc96ce7c212a81d41b85143dc1fc9094bc3 on 2026-08-25. -->
2
2
 
3
3
  <!-- SPDX-FileCopyrightText: 2025-2026 Tyrone Ross, Jr <46267523+tyroneross@users.noreply.github.com> | SPDX-License-Identifier: Apache-2.0 -->
4
4
 
5
- # Debugging Incident Storage
5
+ # Native Debugging Incident Storage
6
6
 
7
- Persist a fixed bug to debugging memory so future builds can recognize recurrence. Native to build-loop; initially adapted from the §"Incident Documentation" workflow in the debugger lineage.
7
+ Persist verified fixes to the same `.claude/memory/` store searched by Build Loop's native debugger.
8
8
 
9
- > **Divergence note**: the standalone debugger does not ship a discrete `store` SKILL.md. Build-loop keeps storage as a native skill because Review-F needs deterministic local persistence even when no MCP server exists.
9
+ ## Required payload
10
10
 
11
- ## When to Activate
11
+ Create a temporary JSON file with:
12
12
 
13
- - Phase 4 Review-F Report: for each Review-B/Iterate failure newly resolved this build, store the incident
14
- - After any `build-loop:debug-loop` run that produced a verified fix
15
- - User asks "save this fix", "remember this bug"
16
-
17
- ## Native Path — Build-Loop Incident Note
18
-
19
- Write one incident note per resolved failure:
20
-
21
- ```bash
22
- mkdir -p .build-loop/issues
23
- ```
24
-
25
- Path:
26
-
27
- ```text
28
- .build-loop/issues/YYYY-MM-DD-<short-slug>.md
29
- ```
30
-
31
- Template:
32
-
33
- ```markdown
34
- # <one-line symptom>
35
-
36
- **Symptom**: <error string, failing command, or observed behavior>
37
- **Root cause**: <technical cause plus first controllable system cause>
38
- **Fix**: <what changed and why>
39
- **Verification**: <commands, tests, or observed proof>
40
- **Files**: <paths touched>
41
- **Tags**: build-loop, <project>, <layer>, <framework>, <symptom-type>
42
- **RCA framework**: <5 Whys | causal tree | fishbone | Kepner-Tregoe | differential diagnosis | falsification>
43
- ```
44
-
45
- **Required**: `symptom`, `root_cause`, `fix`, `verification`. Everything else improves future retrieval.
46
-
47
- ## Optional Mirror — Coding Debugger MCP
48
-
49
- If standalone Coding Debugger is installed and available, mirror the same incident:
50
-
51
- ```
52
- mcp__plugin_coding_debugger__store({
53
- symptom: "user-facing description (≤200 chars, preserves error type/file/key phrase)",
54
- root_cause: "technical explanation of why",
55
- fix: "what was changed",
56
- category: "logic|config|dependency|performance|react-hooks",
57
- tags: ["build-loop", "<project>", "<layer>", "<framework>", "<symptom-type>"],
58
- files_changed: ["path/to/file1.ts", "path/to/file2.ts"],
59
- file: "path/to/primary/problematic/file.ts"
60
- })
61
- ```
62
-
63
- Mirror failure is not a build failure. Report it as "local incident stored; Coding Debugger mirror unavailable."
64
-
65
- ## Tag Discipline
66
-
67
- Always include:
68
- - `"build-loop"` — distinguishes build-orchestrator origins from manual `/build-loop:debug` runs
69
- - Project name (lowercase, slugified)
70
- - Layer (`frontend`, `backend`, `database`, `infra`, `external`)
71
-
72
- Add as relevant:
73
- - Technology: `react`, `typescript`, `python`, `api`, `prisma`
74
- - Category: `logic`, `config`, `dependency`, `performance`
75
- - Symptom type: `crash`, `render`, `timeout`, `validation`
76
-
77
- ## Quality Score Targets
78
-
79
- The memory system scores stored incidents:
80
- - Root cause depth (30%)
81
- - Fix documentation completeness (30%)
82
- - Verification status (20%)
83
- - Tags and metadata (20%)
84
-
85
- Target 75%+. Score below 75% means future searches won't surface this incident reliably — pad the description and tags before storing.
86
-
87
- ## JSON Compatibility Fallback
88
-
89
- If a downstream process requires JSON, write a compatibility copy after the native note:
90
-
91
- **Step 1: Generate incident ID**
92
- ```
93
- INC_<CATEGORY>_YYYYMMDD_HHMMSS_xxxx
94
- ```
95
- where `xxxx` is 4 random alphanumeric characters. Example: `INC_API_20260403_143052_a7b2`.
96
-
97
- **Step 2: Ensure directory exists**
98
- ```bash
99
- mkdir -p .build-loop/debugging/incidents
100
- ```
101
-
102
- **Step 3: Write the JSON**
103
13
  ```json
104
14
  {
105
- "incident_id": "INC_API_20260403_143052_a7b2",
106
- "timestamp": 1735654252000,
107
- "symptom": "User-facing description of the bug",
15
+ "symptom": "Exact user-visible failure or error",
108
16
  "root_cause": {
109
- "description": "Technical explanation",
110
- "file": "path/to/problematic/file.ts",
111
- "category": "logic|config|dependency|performance|react-hooks",
112
- "confidence": 0.85
113
- },
114
- "fix": {
115
- "approach": "What was done",
116
- "changes": [
117
- { "file": "path/to/file.ts", "lines_changed": 10, "change_type": "modify|add|delete", "summary": "..." }
118
- ]
17
+ "description": "Technical cause and first controllable cause",
18
+ "category": "logic",
19
+ "confidence": 0.95
119
20
  },
120
- "verification": {
121
- "status": "verified|unverified",
122
- "regression_tests_passed": true,
123
- "success_criteria_met": true
124
- },
125
- "tags": ["build-loop", "project-name", "layer", "category"],
126
- "files_changed": ["list/of/all/files.ts"],
127
- "quality_score": 0.75
21
+ "fix": "What changed and why",
22
+ "verification": "verified",
23
+ "tags": ["build-loop", "project", "backend", "typescript"],
24
+ "files_changed": ["path/to/file.ts"]
128
25
  }
129
26
  ```
130
27
 
131
- Write to `.build-loop/debugging/incidents/<incident_id>.json`. Flag `debugger JSON compatibility copy written` in Review-F only if another workflow requested JSON.
28
+ Then run:
29
+
30
+ ```bash
31
+ node "${CLAUDE_PLUGIN_ROOT}/bin/build-loop-debugger.js" store \
32
+ --input /path/to/incident.json --workdir "$PWD"
33
+ ```
34
+
35
+ The command validates and writes `.claude/memory/incidents/<incident-id>.json`, then updates the JSONL and keyword indexes in the same memory root. Delete the temporary input after a successful store.
132
36
 
133
- ## After Storing
37
+ ## Quality requirements
134
38
 
135
- 1. Confirm the local note path.
136
- 2. If standalone Coding Debugger supplied the prior incident, invoke `outcome({incident_id, result: "worked"|"failed"|"modified", notes})` to train its verdict classifier.
137
- 3. If the note lacks verification, enrich it before ending Review-F.
39
+ - Preserve the exact symptom and error class.
40
+ - Explain the root cause, not only the failing line.
41
+ - Record the implemented fix and changed files.
42
+ - Use `verified` only when the reproduction and relevant regression tests pass.
43
+ - Include `build-loop`, project, layer, technology, and symptom tags when applicable.
138
44
 
139
- ## Sibling Skills
45
+ Target a quality score of at least 75%. Do not store speculative diagnoses as verified incidents.
140
46
 
141
- - `build-loop:debugging-memory` `{op:"search"}` (references/search.md) — search memory before debugging
142
- - `build-loop:debugging-memory` `{op:"assess"}` (references/assess.md) — parallel domain assessment
143
- - `build-loop:debug-loop` — full iterative debugging that produces the incident this op stores
47
+ ## After storing
144
48
 
145
- *Source: adapted from the debugger incident-documentation workflow and maintained as a build-loop-native skill. Drift-checked by `build-loop:sync-skills`.*
49
+ 1. Confirm `file_path` exists in the JSON response.
50
+ 2. Search the symptom again and confirm the new incident is discoverable.
51
+ 3. Keep `.build-loop/issues/` for unresolved/executable work; resolved history belongs only in the structured debugger store.
@@ -64,7 +64,7 @@ Skill("build-loop:debugging-memory") with input { op: "search", symptom: "<sympt
64
64
  - Low/no match (<40%): Investigate fresh, document afterward
65
65
 
66
66
  **After fixing a bug:**
67
- Write an incident note to `.build-loop/issues/INC_YYYYMMDD_HHMMSS_xxxx.md`
67
+ Return the verified incident fields to the parent. The parent invokes `build-loop:debugging-memory` with `{ op: "store", ... }`, which writes `.claude/memory/incidents/<incident-id>.json`.
68
68
 
69
69
  This ensures fixes are remembered for future similar issues.
70
70
  ```
@@ -0,0 +1,251 @@
1
+ ---
2
+ name: decision-queue
3
+ description: "Turn pending decisions — Operations Center tasks with status needs_input, a backlog of open questions, anything blocked on the user's judgment — into one interactive page the user answers inline and Claude reads back later. Not for a one-off static report with no response capture; use a plain Artifact instead. Each decision gets a card carrying the choice, why it needs the user, its impact, the options, and a recommendation. Triggers: 'show me the decisions waiting on me', 'what needs my input', 'make a decision queue', 'launch a ui for these open questions'. Not for a judgement call you already made and applied while work continued — that never blocks and belongs in `silent-assumptions`."
4
+ user-invocable: false
5
+ companion_assets:
6
+ - assets/template.html — tested, working page (styling, save/response plumbing, self-publish logic). Copy and adapt; never regenerate from scratch.
7
+ - scripts/regen_template_constants.py — regenerates the HEAD_HTML / SAVE_BAR_HTML self-publish constants from the authored markup. Run it after ANY CSS or save-bar edit; never hand-sync the two copies.
8
+ - references/example-large-queue-batching.md — second worked example (2026-08-26, PersonalLLMWiki planner backlog): the large-queue variant, where items are classified into a few claims and ruled as batches instead of one card per item. Read it before building for a queue of 50+ items.
9
+ ---
10
+
11
+ <!-- SPDX-FileCopyrightText: 2025-2026 Tyrone Ross, Jr <46267523+tyroneross@users.noreply.github.com> | SPDX-License-Identifier: Apache-2.0 -->
12
+
13
+ # Decision Queue
14
+
15
+ Build an interactive Artifact that lists every pending decision as a card —
16
+ decision, why it needs the user, impact, options, recommendation, a response
17
+ control, and a save button — so the user can answer at their own pace and
18
+ Claude can read the answers back on request. Built once (2026-08-25) for
19
+ Operations Center's `needs_input` queue; the pattern generalizes to any set
20
+ of open questions the user names.
21
+
22
+ ## When to use
23
+
24
+ - User asks what's waiting on their input, across Operations Center, a
25
+ backlog, or any other queue of blocked decisions.
26
+ - User wants to *answer* those decisions somewhere durable, not just read
27
+ a report — the defining feature over a plain summary is the save/respond
28
+ loop.
29
+ - Do not use this for a single decision (just ask) or for content with no
30
+ response to capture (use a plain Artifact via `artifact-design`).
31
+
32
+ ## Two shapes, chosen by queue size
33
+
34
+ **One card per decision** is the default and everything below describes it. It
35
+ works while the decisions are few and genuinely distinct.
36
+
37
+ **Batch-claim triage** is the variant for a large queue. Above roughly fifty
38
+ items, a page of one card per item reproduces the overwhelm that made the user
39
+ ask for a page. Classify the items into a few classes instead, give each class
40
+ one falsifiable claim plus the counted evidence for it, and let one ruling
41
+ close the whole class with a drill-in for auditing and per-item override.
42
+
43
+ The test between them is one question: **can you write a single sentence that
44
+ is true of thirty of these items?** If yes, build the batch variant and read
45
+ `references/example-large-queue-batching.md` first — it carries the pyramid
46
+ structure the claims need, the classification trap that cost a rebuild, the
47
+ flat-control CSS the user requires, and a save round-trip test worth copying.
48
+ If no, you do not have batches; build one card per decision.
49
+
50
+ ## Workflow
51
+
52
+ 1. **Gather the decisions.** For Operations Center: `mcp__operations-center__list_tasks`
53
+ filtered to `status: needs_input`. The result is often too large for the
54
+ tool response and gets saved to a file — read it with Python/jq, don't
55
+ try to fit it inline. **Landmine:** `get_task` takes the FULL task id;
56
+ the short 8-char ids shown in the Operations Center startup-hook digest
57
+ are prefixes and `get_task` returns `null` for them. Use `list_tasks`
58
+ and filter by prefix match instead.
59
+
60
+ 2. **Synthesize each item**, one card's worth of fields:
61
+
62
+ | Field | What it answers | Note |
63
+ |---|---|---|
64
+ | `decision` | What action is on the table | Full sentence, not a summary of the situation |
65
+ | `why` | Why THIS needs the user, not an agent | If the source record has no explicit reason, infer from spec/classification and set `whyInferred: true` — the template renders an "inferred" disclaimer, so the honesty marker is never lost |
66
+ | `impact` | What actually changes — app, user, team | Concrete; cite real numbers from the source record when they exist |
67
+ | `options` | 2–4 real choices, lettered A/B/C… | Include the honest cost of "defer"/"reject", not a straw man |
68
+ | `recommendation` | Which option and why | Name the actual tradeoff, don't just restate the option |
69
+
70
+ Write in full sentences with clear predicates — this is a decision
71
+ record the user acts on, not a bullet fragment.
72
+
73
+ 3. **Load `artifact-design`** (required — even though the template supplies
74
+ a working visual treatment, the design-pass discipline still governs
75
+ copy calibration: eyebrow/title/lede text, card language, and whether
76
+ this dataset actually warrants the dashboard treatment over something
77
+ lighter).
78
+
79
+ 4. **Copy `assets/template.html`** to the scratchpad — never hand-roll the
80
+ self-publish plumbing from scratch; see "The one rule that matters"
81
+ below for why that's expensive to get right. Strip the leading `<!-- -->`
82
+ authoring comment block (it must not ship). Edit only the CONTENT ZONE:
83
+
84
+ ```js
85
+ window.__META__ = { eyebrow, title, lede, summaryCells, footer };
86
+ window.__ITEMS__ = [ { id, num, opened, touched, repo, classChip,
87
+ typeLabel, priority, title, decision, why, whyInferred, impact,
88
+ options, recommendation, selected: null, comment: "", respondedAt: null }, ... ];
89
+ ```
90
+
91
+ Leave everything inside `<script id="app-script">` untouched.
92
+
93
+ 5. **Verify before publishing** — cheap and catches real bugs:
94
+
95
+ ```bash
96
+ node --check <extracted app-data + app-script> # syntax
97
+ # render META + ITEMS through the real cardHtml/renderBody functions
98
+ # (see git history of this skill's authoring session for the exact
99
+ # extraction snippet) and confirm it returns non-empty HTML with no
100
+ # thrown exception
101
+ grep -n "document.head.innerHTML\|getElementById(\"save-bar-shell\").outerHTML" *.html
102
+ # any match OUTSIDE an explanatory comment is the landmine below — fix it
103
+ ```
104
+
105
+ 6. **Publish** with `Artifact({ file_path, capabilities: {artifact: {}}, title, description, favicon })`.
106
+ The `artifact` capability is what lets the page save its own responses —
107
+ without it the save button has nothing to call. Load `artifact-capabilities`
108
+ if this is a fresh session that hasn't already loaded it.
109
+
110
+ 7. **Read answers back** on request: `Artifact({ action: "read", url })`.
111
+ The saved HTML contains the string `window.__ITEMS__` **twice** — once
112
+ as the real, live `<script id="app-data">` content, and once more as a
113
+ JS string literal inside `buildDocument()`'s own source (which the
114
+ self-publish logic captures verbatim so the republished page stays
115
+ functional). Parse the **first** occurrence, at the top of the file,
116
+ not whichever regex match comes back first if your extraction spans
117
+ the whole document carelessly.
118
+
119
+ ## The one rule that matters: never capture the live DOM for self-publish
120
+
121
+ The template's `HEAD_HTML` and `SAVE_BAR_HTML` are **hardcoded JS string
122
+ constants**, not `document.head.innerHTML` or `.outerHTML` reads. This is
123
+ not a style preference — it was a real, shipped, user-visible bug
124
+ (2026-08-26): the claude.ai artifact viewer injects its own bootstrap
125
+ script into `<head>` before the page's own script runs. Capturing
126
+ `document.head.innerHTML` at load time sweeps that injected script up
127
+ alongside the page's own `<title>`/`<link>`/`<style>` and bakes it into
128
+ whatever gets saved. On the next load the viewer injects a **second**,
129
+ fresh copy of its own bootstrap on top of the stale one — two competing
130
+ runtime copies collide, and the page's `<style>` tag stops taking effect
131
+ at all (confirmed: totally unstyled, unreadable page after one save/reload
132
+ cycle).
133
+
134
+ The fix that held: write `HEAD_HTML` and `SAVE_BAR_HTML` as literal
135
+ template-literal strings in the script, generated once from the actual
136
+ authored markup and never read from the DOM again. The **only** DOM read
137
+ that is safe in `buildDocument()` is
138
+ `document.getElementById("app-script").outerHTML` — capturing the script's
139
+ own tag, which the platform never modifies, so the running script can
140
+ re-embed itself verbatim in the next version (the "quine" trick that keeps
141
+ the page functional after every save without duplicating the render logic
142
+ as a second string).
143
+
144
+ If you edit the template's CSS or the save-bar markup, the change must land in
145
+ **two** places — the literal markup, and the `HEAD_HTML`/`SAVE_BAR_HTML`
146
+ constants inside `app-script`. **Do not sync them by hand. Run:**
147
+
148
+ ```bash
149
+ python3 skills/decision-queue/scripts/regen_template_constants.py # rewrite
150
+ python3 skills/decision-queue/scripts/regen_template_constants.py --check # CI mode
151
+ ```
152
+
153
+ This section used to say "regenerate with a small script" and ship no script.
154
+ What followed was predictable: `SAVE_BAR_HTML` sat as an empty string against
155
+ 382 characters of real markup, so `buildDocument()` emitted a page with no Save
156
+ button, no status line and no counter — savable exactly once, then broken. Four
157
+ static checks passed the whole time, because none of them ran `buildDocument()`
158
+ and looked at the output. Found and fixed 2026-08-30.
159
+
160
+ `tests/test_decision_queue_template.py` now fails on any drift, and
161
+ `tests/test_decision_queue_render.py` runs the real script under Node and
162
+ asserts on what it renders.
163
+
164
+ ## Every interpolation is escaped — keep it that way
165
+
166
+ The card and header markup is built with the `h` tagged template. It escapes every
167
+ `${...}` it interpolates. To insert markup you built yourself, wrap it: `${raw(cells)}`.
168
+
169
+ ```js
170
+ h`<h2 class="card-title">${item.title}</h2>` // escaped — the default
171
+ h`<div class="queue">${raw(items.map(cardHtml).join(""))}</div>` // deliberate HTML
172
+ ```
173
+
174
+ This is not style. Item fields come from Operations Center tasks, backlog items, and
175
+ peer-authored rally records — text an agent wrote, not text you wrote. Before
176
+ 2026-08-30 the template called `escapeHtml()` at 5 of ~23 interpolation sites, so every
177
+ field added after the first few defaulted to unescaped: `item.title`, `item.decision`,
178
+ `item.why`, `item.impact`, `item.recommendation`, `meta.lede`, and `meta.footer` all
179
+ reached `innerHTML` raw. Rendering one crafted title through that version produced 14
180
+ live `<img onerror>` elements in the reader's page.
181
+
182
+ `h` inverts the default so the unsafe path is the one you have to type on purpose.
183
+ When you add a field to a card, interpolate it and stop — do not reach for `raw()`
184
+ unless the value really is markup you constructed.
185
+
186
+ The same rule covers the data element: `buildDocument()` embeds items through
187
+ `safeJsonForScript()`, not bare `JSON.stringify()`, because `JSON.stringify` does not
188
+ escape `<` — an item containing `</script>` would close the data element early and the
189
+ rest of the document would parse as markup.
190
+
191
+ `scripts/test_decision_queue_template_escaping.py` renders a hostile item through the
192
+ real file and fails if anything executes. It runs in CI. If you restructure the
193
+ `<script id="app-script">` block, update that test's extraction with it.
194
+
195
+ ## Other things the template already handles (don't re-solve these)
196
+
197
+ - **Batched save, not per-keystroke.** Radio/textarea changes update an
198
+ in-memory `items` array; nothing publishes until the Save button fires.
199
+ One `publish()` call per Save click, covering every card at once.
200
+ - **Conflict handling.** A `conflict` rejection means someone else (another
201
+ tab, the user themself) already published — the view reloads to the
202
+ winner automatically. No retry, no merge logic needed.
203
+ - **Read-only detection.** `not_writer` / `not_granted` / `not_declared` /
204
+ `capability_disabled` all collapse to one read-only state: the Save
205
+ button disables itself and says why, rather than pretending to save.
206
+ - **A standing "no longer relevant" response.** `optionsFor()` appends a `×`
207
+ option to every card automatically. Do not author your own — the point is that
208
+ a decision which stopped being a question can be closed without pretending one
209
+ of the real options was chosen.
210
+ - **Staleness chip.** A card whose `touched` date is 14+ days old renders an
211
+ "Untouched N days" chip. This requires `opened`/`touched` to be **ISO dates**
212
+ (`2026-08-30`), not prose like "3 weeks ago" — a non-date is ignored, never
213
+ guessed at.
214
+ - **Draft persistence.** Selections and comments mirror to `localStorage` on
215
+ every change and clear on a successful publish, so closing the tab mid-queue
216
+ no longer loses typed work. A restored draft never overwrites an answer that
217
+ already round-tripped through publish, and the status line says how many cards
218
+ were restored. Every storage access sits in try/catch — the viewer can throw
219
+ on storage during thumbnail capture or with site data blocked.
220
+ - **Filter to unanswered.** A save-bar checkbox hides answered cards through a
221
+ body class. View-only; it never mutates an item.
222
+ - **Radio-group semantics.** Options sit in a `fieldset` with a `legend` naming
223
+ the decision, so a screen reader announces each choice with its question
224
+ attached. `#save-status` carries `role="status" aria-live="polite"`.
225
+
226
+ ## The decision-surface family — one core, several variants
227
+
228
+ Four skills share one job: put a set of calls in front of the user and capture a
229
+ ruling. They differ only in the KIND of call, so they share a core rather than
230
+ forking one — the variant registry (`scripts/decision_surface.py`), the
231
+ interactive page and its save/self-publish plumbing
232
+ (`skills/decision-queue/assets/template.html`), and the durable writer
233
+ (`scripts/write_decision/__main__.py`). **Adding a variant is a registry entry,
234
+ never a fork of the core.**
235
+
236
+ **Choose by the question the user is actually asking, never by name.** An agent
237
+ that picks on name alone reaches for the one it already knows and rebuilds
238
+ something that exists.
239
+
240
+ | Member | Answers | Layer | Does work stop? |
241
+ |---|---|---|---|
242
+ | [`silent-assumptions`](../silent-assumptions/SKILL.md) | "What did you decide without me?" | surface | No — work continued under your default |
243
+ | [`decision-queue`](../decision-queue/SKILL.md) | "What is waiting on me?" | surface | Yes — work has stopped |
244
+ | [`auto-decision-capture`](../auto-decision-capture/SKILL.md) | "What did we already settle, and where is it written down?" | capture | No — fires passively |
245
+ | [`auto-finding-capture`](../auto-finding-capture/SKILL.md) | "What concrete issues has anyone surfaced?" | capture | No — fires passively |
246
+
247
+ `python3 scripts/decision_surface.py` prints this table (`--json` for machines).
248
+ The registry is the one place a member is declared; this table is its prose
249
+ mirror and must match it.
250
+
251
+ **You are here: `decision-queue`.** Reach for `silent-assumptions` instead when the call was ALREADY MADE and applied and work never stopped — that surface exists to reverse a default after the fact, and it must never block.