@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
@@ -1,96 +0,0 @@
1
- <!-- SPDX-FileCopyrightText: 2025-2026 Tyrone Ross, Jr <46267523+tyroneross@users.noreply.github.com> | SPDX-License-Identifier: Apache-2.0 -->
2
-
3
- # Intent exploration prompt templates
4
-
5
- Loaded ON DEMAND by the orchestrator when its LLM judges intent genuinely ambiguous during Phase 1 Step B (`skills/build-loop/references/intent-capability-pack.md` § Intent restatement protocol). Never auto-fires on regex detection. Never invoked on concrete goals — the auto-execute fast path skips this file entirely.
6
-
7
- Each template covers one common ambiguity shape and produces the structure required by Step B of the protocol. The templates are scaffolding — the LLM fills them in from the actual goal + intent.md + repo context. Each section header in the output is fixed; the body is adaptive.
8
-
9
- ---
10
-
11
- ## Pattern 1 — vague-verb ("explore", "figure out", "see if", "look into", "play with", "think about")
12
-
13
- The goal uses an investigative verb without a concrete target. Interpret as: "the user wants something investigated, but the exact deliverable is open."
14
-
15
- Restate as one of:
16
-
17
- - "Survey X and produce a one-page summary of <observed state, recommended action>"
18
- - "Run a non-destructive scan of X and write findings to `.build-loop/research/`"
19
- - "Read X and answer the implicit question: <one-sentence inferred question>"
20
-
21
- **Approach options to consider:**
22
-
23
- 1. **Inventory pass** — list what exists, no judgments. Fastest. Tradeoff: user still has to decide.
24
- 2. **Inventory + recommendation** — list + opinion on best path. More work. Tradeoff: opinion may not match user's constraints.
25
- 3. **Inventory + small-experiment** — list + a tiny actionable change to validate one option. Most useful when the cost of the experiment is low.
26
-
27
- **Default**: option 2 unless the repo shows zero prior similar work (then option 1).
28
-
29
- ---
30
-
31
- ## Pattern 2 — branching-or ("X or Y" as competing paths)
32
-
33
- The goal names two candidate paths. Interpret as: "the user already sees two options and wants help choosing or hybridizing."
34
-
35
- **Important judgment**: most "or" phrases in goal text are NOT this pattern. "Verify the endpoint returns 200 or 404" is enumeration, not branching. "Fix the auth flow where the token expires or rotates" is conjunction, not branching. Only fire this template when the LLM judges the "or" to genuinely separate two competing implementation paths.
36
-
37
- Restate as: "Recommend X or Y for <restated underlying goal>, with the evidence that drove the choice."
38
-
39
- **Approach options:**
40
-
41
- 1. **Adopt the cheaper option** — explicitly. Tradeoff: locked-in if requirements grow.
42
- 2. **Adopt the more general option** — explicitly. Tradeoff: more work now.
43
- 3. **Hybrid** — name the smallest combination that gets the user-value of both. Often the right answer when the user already named two options.
44
-
45
- **Default**: option 3 if the two options aren't mutually exclusive; otherwise the one with fewer foreclosed future capabilities (per `pay-it-forward-arch.md`).
46
-
47
- ---
48
-
49
- ## Pattern 3 — creative-open ("brainstorm", "design from scratch", "greenfield", "open-ended")
50
-
51
- The goal explicitly invites generative work. Interpret as: "the user wants the design space mapped before any code lands."
52
-
53
- Restate as: "Map the design space for <target>, recommend a starting point, name the cuts."
54
-
55
- **Approach options:**
56
-
57
- 1. **Reference-driven** — find 2-3 existing implementations of similar things in the repo or known canon, adapt. Lowest risk.
58
- 2. **Constraint-driven** — list the hard constraints (perf, scope, user surface, scalability), derive the simplest design that satisfies all. Best when constraints are sharp.
59
- 3. **Smallest-viable-version** — pick the smallest thing that delivers the named user value, ship, iterate. Default for creative-open scope without sharp constraints.
60
-
61
- **Default**: option 3 unless the repo has 2+ obvious reference patterns (then option 1).
62
-
63
- ---
64
-
65
- ## Pattern 4 — hedge-phrase ("something like", "kind of", "sort of", "maybe", "not sure")
66
-
67
- The goal uses hedging language. Interpret as: "the user has a fuzzy idea and wants the orchestrator to pin it down."
68
-
69
- Restate as: "The fuzzy idea is most likely <concrete restatement>; restated for clarity."
70
-
71
- **Approach options:**
72
-
73
- 1. **Smallest concrete version** — pick the most defensible concrete interpretation, build that. Tradeoff: may not be what the user actually pictured.
74
- 2. **2-option preview** — name two interpretations, build the smaller as a probe. Tradeoff: more setup, more learning.
75
- 3. **Defer until clarified** — if the smallest concrete version doesn't exist, return early with assumptions tagged and the orchestrator's confidence remains medium. The user reads the run report and re-dispatches with a sharpened goal.
76
-
77
- **Default**: option 1. Option 3 only when no concrete interpretation is defensible (rare).
78
-
79
- ---
80
-
81
- ## Output assembly (when Step B fires)
82
-
83
- After selecting the template(s) — multiple may apply — fill in the `.build-loop/intent.md` sections per the protocol in `intent-capability-pack.md` § Intent restatement protocol § Step B:
84
-
85
- 1. `## Approach options` — 1-3 from the templates above, recommended first
86
- 2. `## Recommended path` — option number + 1-sentence reason
87
- 3. `## Scope cuts considered` — list 1-2 things being excluded
88
- 4. `## Open assumptions (TAG:ASSUMED)` — every leap the LLM made (per Step C)
89
-
90
- Mirror compact summary into `.build-loop/state.json.intent` per Step D. Phase 2 Plan consumes the restated intent and approach options; the fork-on-uncertainty rule consumes the options when confidence stays medium/low.
91
-
92
- ## Why these templates and not others
93
-
94
- Distills the core mechanism of `superpowers:brainstorming` — explore intent + propose options + name assumptions BEFORE implementation — into a build-loop-compatible, non-interactive form. The user-facing dialogue loop is replaced with explicit assumption-tagging and routing to the run report, matching build-loop's `feedback_advisory_checks_are_automated` rule and the auto-execute-on-confidence preference.
95
-
96
- The four patterns are the ones that recur in goal text. They are NOT exhaustive — when the LLM judges genuine ambiguity that doesn't match any of the four shapes, it improvises options + tradeoffs + assumptions in the same output structure. The templates are a reference, not a gate.
@@ -1,72 +0,0 @@
1
- <!-- SPDX-FileCopyrightText: 2025-2026 Tyrone Ross, Jr <46267523+tyroneross@users.noreply.github.com> | SPDX-License-Identifier: Apache-2.0 -->
2
-
3
- # Leadership & Initiative — orchestrator operating doctrine
4
-
5
- How the orchestrator (and any build-loop session) takes initiative and makes decisions in the user's best interest. This is **synthesized guidance**, not a rulebook to recite — drawn from intent-based leadership (Marquet, *Turn the Ship Around!*), USMC mission command / Commander's Intent (MCDP-1), and product-owner decision-making (two-way vs one-way doors). It operationalizes the existing machinery: `intent.md` is the Commander's Intent; `autonomy_gate.py` is the two-door classifier; `do-branch-surface-policy.md` is the action ladder; `question_timeout.py` is act-then-inform under a clock.
6
-
7
- ## The stance
8
-
9
- **Own the outcome, not the task.** You are the GM of this build, not a ticket-taker. If a subtask blocks the goal, route around it — don't surface the obstacle as a question. Surface only what genuinely threatens the *outcome* or is irreversible.
10
-
11
- **`intent.md` is your operating license.** When you understand *why* the work exists and *what end state is required*, you may depart from any specific plan when reality deviates and still serve the mission. Internalize intent deeply enough to improvise correctly. If `intent.md` is thin, enrich it (research + memory) before acting on ambiguity — don't act blind, don't freeze.
12
-
13
- **Intent over permission.** The default is *action absent veto*, not *stasis absent approval*. Say "I'm doing X (because Y)" and proceed — don't ask "may I X?" for reversible, in-scope work. Report after, not before. (This is the standing user preference — see `prefer: always go for the improvement`.)
14
-
15
- **Decide at 70%.** Act when you have ~70–80% of the information you wish you had; the cost of a timely imperfect, *reversible* decision is almost always lower than the cost of hesitation. Reporting uncertainty as a reason to stop is a calibration error, not humility — make the call, note the assumption (`TAG:ASSUMED`), keep moving.
16
-
17
- **Disagree and commit.** If you have reservations but the user chose a direction, execute it *fully* and log the dissent. Partial/half-hearted execution is the worst outcome — it pays the cost of both compliance and resistance.
18
-
19
- ## The decision-escalation ladder
20
-
21
- Run top-down; stop at the first rung that resolves. **Never skip to "ask the human" while a lower rung is unexhausted.**
22
-
23
- 1. **Goal known + reversible + in scope → decide and act.** Inform after. No permission. (`autonomy_gate` = `auto`/SAFE → execute on main.)
24
-
25
- 2. **Goal ambiguous → self-resolve first.** Query, in order: (a) **memory** — `build-loop-memory`, prior run records, decisions, lessons (`context_bootstrap.py`); (b) **the code / repo / docs**; (c) **the web** — `build-loop:research` / the research plugin for anything current or external. Resolve it without surfacing if the answer is findable.
26
-
27
- 3. **Self-research insufficient → consult peers.** Ask coordinator/peer agents (Rally Point), or dispatch a subagent for a specific perspective or domain read. Cheap and fast — exhaust this before escalating to the human.
28
-
29
- 4. **Peers can't resolve → convene a *relevant* persona panel.** Simulate the affected stakeholders (the actual user, the downstream consumer, the security reviewer, the on-call operator) to pressure-test options. **Personas must be relevant to the decision** — don't convene a generic panel; pick the 2–4 voices whose interests the decision actually touches. Choose the option that best serves `intent.md`.
30
-
31
- 5. **At every rung — pursue parallel work and alternatives before idling.** If path A is blocked, advance path B. If a reasonable alternative exists, take it rather than wait. Never emit "I'm waiting on X" without simultaneously moving Y. Blocking on one path while an unblocked path sits idle is pure waste.
32
-
33
- 6. **Only here — pause and ask the human.** The single mandatory gate: the decision is **irreversible (one-way door), production/user-affecting, or contradicts a stated constraint** (`autonomy_gate` → `confirm`/`block`; `classify_action` → PRODUCTION; plan `user_impact: major`). For these, prefer the reversible framing if one exists; otherwise wait. In autonomous/long mode, even these wait indefinitely (`question_timeout.py` `production_hold`) — they never auto-decide.
34
-
35
- ## Reversible vs irreversible — classify before every decision (takes seconds)
36
-
37
- - **Two-way door (reversible):** move fast, correct later. Almost all code, refactors, doc edits, experiments. → decide+act. For *risky-but-reversible* work, isolate to a worktree/branch with a merge-back plan, then proceed without asking.
38
- - **One-way door (irreversible / high blast-radius):** destructive data delete with no backup, a deploy that immediately affects external users, leaking a secret, a stated-constraint violation. → rung 6. Slow down, confirm.
39
-
40
- Applying the wrong process to either type is the real failure mode — one-way-door caution on a two-way-door task trains the user to expect overhead on routine work.
41
-
42
- **Reversibility is context-dependent — judge the actual undo cost, don't pattern-match the verb.** A "release" or "publish" is *not* automatically one-way. A version release is a **two-way door** when you control the registry, the prior version tag is a one-command rollback, and there are no external auto-consumers (e.g. a private/own marketplace with `autoUpdate: false` — re-point to the prior tag or `git revert`). It edges toward one-way only when external parties auto-consume the published artifact in a window you can't recall. Ask "what does undoing this actually cost?" — if the answer is "revert a commit / re-point a tag," it's two-way; act.
43
-
44
- ## Token / effort posture — gauge it, default to the user's signal
45
-
46
- Read whether the user wants **expansive** (keep going, spend tokens, make the session count, unwind later) or **conservative** (quick, cheap, minimal). Signals:
47
-
48
- - **Expansive:** "keep going", "don't stop", "spend tokens", "make it count", "be thorough", "use workers/subagents", "go for the improvement", pushing more scope each turn.
49
- - **Conservative:** "quick", "just", "small", "cheap", "conserve", "don't over-engineer", "minimal", hesitation about cost.
50
- - **Ambiguous → infer from session momentum + standing preference, and state your read.** When expansive: fan out parallel workers, use branches/worktrees for risky-but-reversible work (merge back when done), and prefer doing over asking. When conservative: smallest effective action, fewer/no subagents, confirm before large fan-outs.
51
-
52
- State the posture you're operating under when it materially shapes the turn ("operating expansive — spending tokens, using N workers") so the user can correct it cheaply.
53
-
54
- ## Parallel-work doctrine (decentralized execution)
55
-
56
- - Decompose into **MECE** chunks (disjoint file ownership) so workers don't collide; the orchestrator owns git (single-writer) and workers never commit.
57
- - Fan-out width follows `scripts/parallelism.py effective_max_implementers` (cap 4 per the user's standing rule unless raised). Prefer 2–4 focused workers over one mega-prompt for independent work; one worker for a single fact-find.
58
- - **Risky-but-reversible parallel work → isolated worktrees, merge back.** Two writers on one worktree race on HEAD/index — isolate, then collapse to main at close (Phase D / `collapse_run.py`).
59
- - Workers return condensed structured results; the orchestrator (Thinking tier) synthesizes and verifies — cheaper-tier output is never trusted unchecked.
60
-
61
- ## Anti-patterns
62
-
63
- - **Asking permission for reversible work** — inverts the two-door framework; trains the user to expect overhead.
64
- - **Idling while parallel work exists** — surfacing "waiting on X" without advancing Y.
65
- - **Reporting uncertainty as a stop** — 70% is a green light, not a blocker.
66
- - **Escalating at the wrong altitude** — asking the human what memory, the code, the web, a peer, or a persona panel could answer.
67
- - **Partial execution while disagreeing** — log dissent and execute fully, or don't execute; never the mushy middle.
68
- - **Convening an irrelevant persona panel** — generic voices add noise; only the stakeholders the decision touches.
69
-
70
- ## Attribution
71
-
72
- Principles distilled from: Marquet, *Turn the Ship Around!* (intent-based leadership); USMC MCDP-1 *Warfighting* + Commander's Intent / mission command; Bezos one-way/two-way-door + "disagree and commit". Synthesized as guidance — used for *how to decide*, not copied. This doc is loaded by the orchestrator's "Keep going until done" policy and pairs with `do-branch-surface-policy.md` (the mechanical action ladder) and `autonomy_gate.py` (the gate of record).
@@ -1,313 +0,0 @@
1
- <!-- SPDX-FileCopyrightText: 2025-2026 Tyrone Ross, Jr <46267523+tyroneross@users.noreply.github.com> | SPDX-License-Identifier: Apache-2.0 -->
2
-
3
- # Memory — Global and Project-Scoped (full protocol)
4
-
5
- > Loaded from `skills/build-loop/SKILL.md` summary. Contains the full memory system: global vs project stores, routing rules, and read/write policies.
6
-
7
- ## Memory — Global and Project-Scoped
8
-
9
- Build-loop maintains one canonical long-term memory store at `~/dev/git-folder/build-loop-memory/`. Every build reads canonical indexes/folders; writes go to exactly one lane based on scope.
10
-
11
- ### Recall-optimized memory discipline
12
-
13
- Canonical reference: `build-loop-memory/references/2026-06-11-memory-discipline-prompt.md` (`version: 2026-06-11.1`). Apply it to every non-trivial memory-relevant read or write.
14
-
15
- Operational contract:
16
-
17
- - Recall first for significant repo work, debugging, planning, and any memory write. Read the store-root `INDEX.md` first, then project context such as `projects/<slug>/context/CONTEXT.md` and generated `CURRENT.*`, plus `constitution.md` / `MEMORY.md` where present. Search `indexes/INDEX.jsonl`, scan `chronology.jsonl`, read the matching lane, and verify any remembered file/flag/API/script still exists before relying on it.
18
- - Write only durable facts that aid future recall: decisions + rationale, lessons, reusable references, gotchas, experiment results, product opportunities, and durable operational patterns. Do not write restated code, git-derivable facts, transient status, or handoff-only state.
19
- - Before writing, search `indexes/INDEX.jsonl` for an existing slug/title, update instead of duplicating, then check `indexes/duplicates.jsonl` after indexing. Use title and `description` as the recall hooks.
20
- - Do not hand-write project decisions. Use `scripts/write_decision/__main__.py`; it writes the decision lane and updates that lane's `INDEX.md` / update ledger. Generated master-index reachability is still incomplete for new `projects/<slug>/decisions/` files, so verify decisions through `memory_facade` or the decision lane until the scanner/map split is reconciled.
21
- - Current reference gap: `memory_writer.py` has `research` as a project sublane but not `references`; `reference_capture` writes to `projects/<slug>/research/`, while `build-loop-memory/scripts/rebuild_memory_indexes.py` scans `references/` and not `research/`. For generated-index recall today, write `type: reference` content under `projects/<slug>/lessons/references/`, or update both writer and indexer to agree on `references` or `research`.
22
- - After any memory write, run the relevant host index/check step when mutation is in scope and verify the entry is reachable from the proper recall surface: `INDEX.jsonl` for generated-index lanes, decision lane/index or `memory_facade` for decisions, or the host system's equivalent.
23
-
24
- **Cross-project memory**: `build-loop-memory/lessons/` plus the sibling top-level lanes `design/`, `debugging/`, and `product/`
25
-
26
- - Applies across every project this user builds.
27
- - Examples: "Deployment to Vercel uses `vercel deploy --prebuilt` when `ENABLE_AUTH=true`"; "Neon is the default Postgres for Next.js 16 projects"; "TestFlight upload uses ASC API key from `~/.appstoreconnect/private_keys/`"; "User prefers zero-dep scripts over package additions".
28
- - Structure: one file per fact/lesson/tool-discovery. Generated recall indexes live in `build-loop-memory/indexes/`.
29
- - Types: `tool`, `deployment`, `library-choice`, `user-preference`, `pattern`.
30
-
31
- **Project memory**: `build-loop-memory/projects/<slug>/` (slug derived via `scripts/_paths.derive_slug_from_cwd`)
32
-
33
- - Applies only to the current project.
34
- - Examples: "This app's design system lives in `src/styles/tokens.css`, not Tailwind"; "Routes under `/admin/` require `requireAdmin()` guard"; "The `custom_themes` table has a user_id VarChar bug from 2026-04-13 — see migration note".
35
- - Same lane structure as top level: `decisions/`, `lessons/`, `debugging/`, `design/`, `product/`, and related domain folders.
36
- - Types: `design`, `convention`, `gotcha`, `decision`, `contract`.
37
-
38
- ### Routing rule (always ask this question)
39
-
40
- **"Would this apply to a different project?"**
41
-
42
- - **Yes** → top-level canonical lane (`build-loop-memory/lessons/`, `design/`, `debugging/`, or `product/`). Deployment tools, library choices, general user preferences, reusable patterns.
43
- - **No** → project canonical lane (`build-loop-memory/projects/<slug>/...`). Design tokens, internal APIs, project-specific gotchas, per-repo conventions.
44
- - **Ambiguous** → ask the user once, then save. Don't guess.
45
-
46
- ### Artifact lanes & segmentation (issues / backlog / lessons)
47
-
48
- Three work/knowledge artifact types, each with a clear WRITE → READ → TRACK lane. **Every lane is repo-segmented; the segmentation is mechanical, not discretionary** — so work on repo X never reads or writes repo Y's items.
49
-
50
- | Artifact | Write (where) | Read / Track | Lifetime |
51
- |---|---|---|---|
52
- | **issues** | `<repo>/.build-loop/issues/<id>.md` — current-run bugs | Phase 5 Iterate drains them; repo-local so inherently scoped | short-lived (resolve → delete) |
53
- | **backlog** | durable: `build-loop-memory/projects/<slug>/backlog.md` (slug folder = repo scope); active: `<repo>/.build-loop/backlog/<id>.md` | read before planning self-work; Phase 5 drains active items | long-lived |
54
- | **backlog-archive** | `build-loop-memory/projects/<slug>/backlog-archive.md` | closed/moved/superseded items land here **with rationale + ref** — never deleted silently | durable |
55
- | **lessons** | `projects/<slug>/lessons/` (project) OR top-level `lessons/` (cross-project, stored `_unscoped`) — via `memory_writer.py` | `context_bootstrap` recall scopes to `(slug OR _unscoped)` — never other projects | durable |
56
-
57
- **Segmentation contract (binding):**
58
- - The **slug folder** (`projects/<slug>/`) is the repo key; the **`repo` + `branch` frontmatter** on each issue/backlog item is the explicit scope tag (template: `templates/backlog-item.md`). Both must agree.
59
- - When working repo X on branch B, **read and write only** items where `repo == X` (and `branch == B` or unscoped). A cross-repo item discovered mid-work is recorded in **its** repo's scope, **never** the current repo's tracker.
60
- - **No shared/freeform cross-repo trackers.** (The retired `OPEN-ITEMS.md` was exactly this anti-pattern — one file that accreted rows from unrelated app repos into build-loop's scope. Replaced by the slug-segmented `projects/<slug>/backlog.md`.)
61
- - Reads are already enforced: `context_bootstrap` queue reads are repo-local `.build-loop/`, and lessons recall passes the resolved `project` so the query scopes to `(project OR _unscoped)` — `project=None` (all-projects) is never used for current-work context.
62
-
63
- ### When to write memory
64
-
65
- - User states a preference or convention: save immediately.
66
- - A build surfaces a new tool/library/deployment pattern worth reusing: save after Review-F.
67
- - A project-specific gotcha or decision emerges: save during Review-F Report.
68
- - Do NOT save: ephemeral task details, things already derivable from code or git log, state that changes per build.
69
-
70
- ### When to read memory
71
-
72
- - Always during Phase 1 ASSESS.
73
- - Before deploying: check global deployment memory.
74
- - Before UI work: check project design memory.
75
- - Before adopting a new library: check global library-choice memory.
76
-
77
- ## Cross-session memory propagation + provenance schema (multi-process / multi-host)
78
-
79
- Multiple build-loop sessions can run concurrently. Two scripts own the cross-session model end-to-end:
80
-
81
- - `scripts/memory_writer.py` — canonical WRITER. Adds provenance frontmatter and appends to the index in one atomic operation.
82
- - `scripts/memory_index.py` — append-only discovery log in the selected canonical lane.
83
- - `scripts/memory_update_ledger.py` — global append-only audit/freshness log for the whole configured memory root.
84
-
85
- ### Provenance frontmatter (every memory file)
86
-
87
- ```yaml
88
- ---
89
- name: <slug>
90
- description: <one-line summary>
91
- type: tool | deployment | library-choice | user-preference | pattern | feedback | reference | design | convention | gotcha | decision | contract
92
- source_repo: "<git remote url or null>"
93
- source_workdir: "<abs path>"
94
- source_run_id: "run_<UTC>_<hash>"
95
- source_host: "claude_code | codex | gemini | other"
96
- cross_repo_validated: false # flips to true once a DIFFERENT repo applies it
97
- applied_in_repos: [] # appended entries: {repo, workdir, run_id, applied_at}
98
- created_at: "ISO8601 UTC"
99
- last_updated_at: "ISO8601 UTC"
100
- ---
101
- ```
102
-
103
- ### Writer side — use the canonical writer for normal memory writes
104
-
105
- **Top-level (cross-project) write** — `--scope top-level` routes to `build-loop-memory/lessons/` (or a sibling lane when `--file <lane>/x.md` is used):
106
-
107
- ```
108
- python3 ${CLAUDE_PLUGIN_ROOT}/scripts/memory_writer.py \
109
- --scope top-level \
110
- write \
111
- --file "<rel-path>" \
112
- --name "<slug>" \
113
- --description "<one-line>" \
114
- --type feedback \
115
- --run-id "$RUN_ID" \
116
- --workdir "$PWD" \
117
- --host claude_code \
118
- --body-file /tmp/memory-body.md
119
- ```
120
-
121
- **Project-scoped write** — `--scope project --project <slug>` routes to `build-loop-memory/projects/<slug>/lessons/` (or a sublane when `--file <sublane>/x.md` is used):
122
-
123
- ```
124
- python3 ${CLAUDE_PLUGIN_ROOT}/scripts/memory_writer.py \
125
- --scope project --project "$PROJECT_SLUG" \
126
- write \
127
- --file "<rel-path>" \
128
- --name "<slug>" \
129
- --description "<one-line>" \
130
- --type gotcha \
131
- --run-id "$RUN_ID" \
132
- --workdir "$PWD" \
133
- --host claude_code \
134
- --body-file /tmp/memory-body.md
135
- ```
136
-
137
- The writer auto-detects `source_repo` from the workdir's git remote, appends a row to the lane-local `INDEX.jsonl`, appends a row to the global update ledger at `indexes/updates.jsonl`, and (on update) preserves `created_at` + `applied_in_repos` so cross-repo validation history survives edits. Direct writes are repair/fallback work only: use them only when no canonical writer exists or the current task is explicitly a memory-system repair, then run the host index/check step and verify reachability.
138
-
139
- ### Codex cross-repo write guard
140
-
141
- When using Codex `apply_patch`, path resolution is relative to the active
142
- workspace, not to a shell command `workdir`. If a memory artifact belongs in a
143
- different repo such as `build-loop-memory`, use one of these safe paths:
144
-
145
- - Prefer `scripts/memory_writer.py` for normal memory writes.
146
- - If direct repair is unavoidable, pass absolute target paths to `apply_patch`.
147
- - Before moving a generated file that already appeared in a Codex file card,
148
- leave an openable pointer, mirror, or stub at the old path and update any
149
- dependent indexes/links. Do not strand UI/Finder file cards at missing paths.
150
- - After a move, verify both the canonical destination and every old path that a
151
- user-facing file card, index, or markdown link still references.
152
-
153
- ### Reader side — surface peer writes via INDEX.jsonl
154
-
155
- Between phases (or at every M2 heartbeat), tail since your last check:
156
-
157
- ```
158
- python3 ${CLAUDE_PLUGIN_ROOT}/scripts/memory_index.py tail \
159
- --since "$LAST_INDEX_CHECK_TS" \
160
- --exclude-run-id "$RUN_ID" \
161
- --json
162
- ```
163
-
164
- For each row:
165
- 1. Read the underlying memory file.
166
- 2. If `source_workdir` ≠ this `$PWD` AND `source_repo` ≠ this repo's git remote — tag `[CROSS-REPO — requires scrutiny]` in the phase brief.
167
- 3. Surface to the user with the memory's `description` field as the hook.
168
-
169
- ### Store side — global update ledger
170
-
171
- Every canonical memory mutation should also append one JSONL row to:
172
-
173
- ```
174
- <memory-root>/indexes/updates.jsonl
175
- ```
176
-
177
- This is the store-wide ledger. It is not a replacement for lane-local `INDEX.jsonl`; the two logs have different jobs:
178
-
179
- | Log | Scope | Primary job |
180
- |---|---|---|
181
- | `<lane>/INDEX.jsonl` | One memory lane | Peer discovery inside that lane |
182
- | `indexes/updates.jsonl` | Whole memory root | Audit trail, freshness baseline, repair inventory |
183
-
184
- Row schema:
185
-
186
- ```json
187
- {
188
- "ts": "2026-06-01T12:00:00Z",
189
- "schema_version": 1,
190
- "event_id": "<sha256-prefix>",
191
- "project": "build-loop",
192
- "lane": "decisions",
193
- "action": "write",
194
- "path": "projects/build-loop/decisions/0001-example.md",
195
- "writer": "write_decision.py",
196
- "run_id": "run_...",
197
- "source_repo": "<git remote or omitted>",
198
- "source_workdir": "<absolute workdir or omitted>",
199
- "source_commit": "<repo HEAD represented by this memory update>",
200
- "source_host": "codex",
201
- "memory_id": "0001",
202
- "summary": "Short human hook",
203
- "sha256": "<content hash when available>",
204
- "metadata": {}
205
- }
206
- ```
207
-
208
- `memory_writer.py`, `write_decision.py`, and `append_milestone.py` emit this ledger row automatically. Direct writes to memory files should be treated as legacy or repair work because they bypass provenance, discovery, and freshness.
209
-
210
- CLI:
211
-
212
- ```
213
- python3 ${CLAUDE_PLUGIN_ROOT}/scripts/memory_update_ledger.py tail \
214
- --project "$PROJECT_SLUG" \
215
- --limit 20 \
216
- --json
217
- ```
218
-
219
- ### Trust gradient — mark-applied flow
220
-
221
- When a memory written elsewhere is successfully applied in the current repo, record it:
222
-
223
- ```
224
- python3 ${CLAUDE_PLUGIN_ROOT}/scripts/memory_writer.py mark-applied \
225
- --file "<rel-path>" \
226
- --applying-repo "$THIS_REPO_REMOTE" \
227
- --applying-workdir "$PWD" \
228
- --applying-run-id "$RUN_ID"
229
- ```
230
-
231
- Appends to `applied_in_repos[]` (deduped by `(repo, workdir)`) and flips `cross_repo_validated` to `true` once at least one applying repo differs from the source. Memories with `cross_repo_validated: true` AND `len(applied_in_repos) >= 2` have earned higher trust — independently verified to hold across distinct repos. Surface that distinction in Phase 1 Assess briefs as `[VALIDATED — applied in N repos]`.
232
-
233
- ### Migration — existing memory files
234
-
235
- `memory_writer.py migrate` is an idempotent backfill that adds provenance frontmatter to existing memory files. Safe to re-run; skips any file that already has all required provenance keys.
236
-
237
- ```
238
- python3 ${CLAUDE_PLUGIN_ROOT}/scripts/memory_writer.py migrate \
239
- --run-id "$RUN_ID" \
240
- --workdir "$PWD" \
241
- --host claude_code \
242
- --dry-run # inspect first; remove the flag to apply
243
- ```
244
-
245
- Run once after this version of build-loop is installed; the migration completes immediately for memory dirs of ordinary size (the user's global memory at ~80 files migrates in well under a second).
246
-
247
- ### Concurrency
248
-
249
- - `memory_writer.py write` — atomic tmpfile + os.replace; the memory file IS the lock.
250
- - `memory_index.py append` — `fcntl.flock(LOCK_EX)` on `INDEX.jsonl.lock`; multi-writer safe across hosts.
251
- - `memory_update_ledger.py append` — `fcntl.flock(LOCK_EX)` on `updates.jsonl.lock`; append-only and multi-writer safe.
252
-
253
- ## Append-only milestones (anti-rewrite-drift)
254
-
255
- ### The problem this solves
256
-
257
- "Current state" files that are rewritten in place rot: the writer overwrites without fully reading, summaries drift from reality, and no one can tell which run produced a given snapshot. The fix is append-only by construction — a log that can only grow forward.
258
-
259
- ### What gets appended and when
260
-
261
- Every build-loop run appends a single milestone record at **Review-G** via `scripts/append_milestone.py`. Each record captures what shipped and the repo HEAD sha at write time.
262
-
263
- The milestone (durable `milestones.jsonl` in build-loop-memory) is **distinct from** `state.json.runs[]`, which Phase 6 Learn scans for pain signals. The orchestrator's Review-G writes both; an **inline run or the closeout** writes neither unless it calls them explicitly. So at run-close, in addition to the milestone, record the run for Learn with `python3 scripts/append_run.py --workdir "$PWD" --run-id <id> --goal "..." --outcome <done|partial|blocked>` (append-only, idempotent on `run_id`; capture `--manual-intervention "<phase>:<note>"` for any step the user had to re-prompt). Without it, inline work never reaches the `runs[] >= 3` Learn threshold. See `references/phase-6-learn.md` §Detect.
264
-
265
- JSONL contract (frozen — sibling staleness-check reads this):
266
-
267
- ```
268
- <memory-root>/projects/<slug>/milestones.jsonl
269
- ```
270
-
271
- Each line:
272
-
273
- ```json
274
- {"ts": "2026-05-30T12:00:00Z", "commit": "<sha>", "repo": "<dir-name>", "summary": "<what shipped>", "run_id": "<id|null>"}
275
- ```
276
-
277
- ### How to append
278
-
279
- ```
280
- python3 ${CLAUDE_PLUGIN_ROOT}/scripts/append_milestone.py \
281
- --workdir "$PWD" \
282
- --summary "feat: shipped auth + dashboard" \
283
- --run-id "$RUN_ID" \
284
- --json
285
- ```
286
-
287
- `--commit` and `--project` override the defaults (git HEAD and slug derived from `--workdir`). `--memory-root` overrides the default `~/dev/git-folder/build-loop-memory`.
288
-
289
- Output: `{"appended": true, "path": "...", "line": "..."}` on success; `{"appended": false, "reason": "..."}` on fail-soft (non-git workdir, unwritable root). Exit 0 in both cases.
290
-
291
- Idempotency: if the last line already has the same `commit` AND `summary`, the call is a no-op. Safe to re-run on retry.
292
-
293
- ### The core principle: pointer not duplicate
294
-
295
- The milestone log is the **durable, never-rewritten** record of project progress. Other memory files (`lessons/`, `decisions/`, etc.) remain the authoritative content store. The milestone is a pointer — "at this commit, this run shipped this" — not a duplicated copy of their content.
296
-
297
- > The rewrite-in-place pattern is what rots. Append-only logs + pointers resist drift by construction: you can always `tail` to see the latest state, `grep` to find when something shipped, and the sibling staleness-check can compare the latest milestone commit against the current HEAD to detect stale memory instantly.
298
-
299
- Decisions use the existing `decisions/` lane (also append-only files, one file per decision). The milestone log adds the run-level "what shipped" layer that `decisions/` doesn't track.
300
-
301
- ### Staleness detection
302
-
303
- `memory_staleness_check.py` now prefers the latest `source_commit` in `indexes/updates.jsonl` for the current project, then falls back to the latest milestone's `commit` field. It compares that baseline against `git rev-parse HEAD` in the project workdir. If HEAD has moved past the last memory update by the configured commit threshold, the project's memory is potentially stale and Phase 1 Assess should flag it.
304
-
305
- Impact:
306
-
307
- - A decision, lesson, migration, mark-applied, or milestone can refresh the memory baseline when it records `source_commit`.
308
- - Older memory stores without `indexes/updates.jsonl` keep working because milestone fallback is unchanged.
309
- - A stale warning means "no durable memory update has been recorded for this project at or near HEAD"; it does not prove every individual memory file is stale.
310
-
311
- ### Concurrency
312
-
313
- `fcntl.flock(LOCK_EX)` on `milestones.jsonl.lock` — same pattern as `memory_index.py`. Multi-writer safe.
@@ -1,96 +0,0 @@
1
- <!-- SPDX-FileCopyrightText: 2025-2026 Tyrone Ross, Jr <46267523+tyroneross@users.noreply.github.com> | SPDX-License-Identifier: Apache-2.0 -->
2
-
3
- # Modular Systems Pack
4
-
5
- Use this pack on every non-trivial build. It makes modular, scalable structure the default while allowing a simpler or more integrated approach when that better serves the use case.
6
-
7
- ## Default
8
-
9
- Build-loop should prefer systems that are:
10
-
11
- - **Modular**: each module hides one important design decision behind a stable interface.
12
- - **Scalable**: the design can grow in data volume, user volume, feature count, or team ownership without immediate redesign.
13
- - **MECE**: task groups, file ownership, and agent scopes are mutually exclusive and collectively exhaustive.
14
- - **Pyramid-structured**: plans, handoffs, reports, and repo organization lead with the governing thought, then supporting groups, then details.
15
-
16
- This is a default, not dogma. The goal is durable user value, not extra architecture.
17
-
18
- ## Exception Rule
19
-
20
- Do not add modularity for its own sake. Choose a simpler or more integrated approach when:
21
-
22
- - The change is a one-off script, short-lived migration, or isolated fix.
23
- - A new boundary would add indirection without reducing real complexity.
24
- - A performance hot path needs a tightly integrated implementation.
25
- - The repo is small and the added module structure would obscure the core workflow.
26
- - The product need is intentionally limited and extra optionality would confuse users.
27
-
28
- When taking an exception, record:
29
-
30
- ```text
31
- MODULARITY EXCEPTION: <why simpler/integrated is better for this use case>
32
- ```
33
-
34
- ## MECE File And Agent Partition
35
-
36
- Phase 2 Plan must partition work so every changed file has exactly one owner and every required responsibility has an owner.
37
-
38
- For each task group, use this packet:
39
-
40
- ```md
41
- Group: <name>
42
- Dimension: <domain | layer | workflow | bounded context | adapter | test surface>
43
- Owns files: <paths>
44
- Does not own: <paths handled elsewhere>
45
- Interface contract: <exports/events/API/schema it may change>
46
- Integration checkpoint: <command or review step>
47
- Intent link: <north-star or user-value rule this group supports>
48
- ```
49
-
50
- MECE checks:
51
-
52
- - No overlap: a file or interface is not owned by two agents unless the plan defines a handoff point.
53
- - No gaps: every required behavior, state, migration, test, and user-facing surface has an owner.
54
- - One dimension per level: avoid mixing domains, layers, and workflows in the same grouping level.
55
- - Stable interfaces: agents can change internals, but cross-group contracts are explicit.
56
- - Integration checkpoint: every boundary has a test, build, visual check, schema check, or reviewer step.
57
-
58
- ## Modular Design Heuristics
59
-
60
- - Hide volatile decisions behind small interfaces: data shape, provider choice, algorithm, storage, rendering strategy, or external API.
61
- - Prefer high cohesion: code that changes for the same reason lives together.
62
- - Prefer loose coupling: callers depend on published interfaces, not internal data structures or side effects.
63
- - Design around business/domain capabilities when the system is large enough for domains to matter.
64
- - Keep boundaries small enough to understand and large enough to own a useful capability.
65
- - Separate deploy/runtime config from code when values vary by environment.
66
- - Preserve directness when extra layers make the core workflow harder to read, test, or operate.
67
-
68
- ## Pyramid Structure
69
-
70
- Use pyramid structure for plans, reports, repo notes, and agent handoffs:
71
-
72
- 1. Governing thought: the one decision, result, or recommendation.
73
- 2. MECE key lines: 3-5 non-overlapping supporting claims or work groups.
74
- 3. Evidence/details: commands, files, risks, interfaces, and validation.
75
-
76
- For repo structure, this means names should communicate purpose, folders should group by one clear dimension, and cross-cutting utilities should stay genuinely shared rather than becoming a junk drawer.
77
-
78
- ## Review Gates
79
-
80
- Critic and final review should flag:
81
-
82
- - Avoidable tight coupling or weak cohesion.
83
- - Hidden cross-file ownership overlap between agents.
84
- - Missing owner for a required behavior, state, migration, test, or user-facing surface.
85
- - Abstraction added without user, scalability, testability, security, or maintainability benefit.
86
- - Simplification that collapses a boundary needed for accuracy, security, scale, testability, or future optionality.
87
- - Missing `MODULARITY EXCEPTION` when the plan intentionally chooses an integrated shortcut.
88
-
89
- ## Source Basis
90
-
91
- - Parnas, "On the Criteria to Be Used in Decomposing Systems into Modules" (CACM, 1972): https://cacm.acm.org/research/on-the-criteria-to-be-used-in-decomposing-systems-into-modules/
92
- - AWS Well-Architected REL04-BP02, "Implement loosely coupled dependencies": https://docs.aws.amazon.com/wellarchitected/2024-06-27/framework/rel_prevent_interaction_failure_loosely_coupled_system.html
93
- - Microsoft Azure Architecture Center, domain analysis for microservices: https://learn.microsoft.com/en-us/azure/architecture/microservices/model/domain-analysis
94
- - Microsoft Azure Architecture Center, design principles for Azure applications: https://learn.microsoft.com/en-gb/azure/architecture/guide/design-principles/
95
- - Twelve-Factor App config guidance: https://12factor.net/config
96
- - MECE framework overview: https://www.casestar.io/guides/mece