@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,285 +0,0 @@
1
- <!-- SPDX-FileCopyrightText: 2025-2026 Tyrone Ross, Jr <46267523+tyroneross@users.noreply.github.com> | SPDX-License-Identifier: Apache-2.0 -->
2
-
3
- # Backlog System — host-agnostic, multi-repo deferred-work tracker
4
-
5
- A backlog is the durable list of wanted-but-not-now work for a repo: deferred
6
- debt, blocked infra, known fixes, pending decisions. This system makes that list
7
- **host-neutral** (any coding agent — Claude, Codex, or other — reads and writes
8
- it the same way), **filesystem-first** (grep + frontmatter, no DB/vector/graph),
9
- and **aggregatable** across all of one user's repos via their personal memory.
10
-
11
- ## Why it is shaped this way
12
-
13
- Five research-grounded principles drive the design (from the memory-architecture
14
- guide; Letta filesystem-memory benchmark; "don't over-engineer"):
15
-
16
- 1. **Canonical truth vs derived index.** The items in `items/` are the truth.
17
- `INDEX.md` is a *generated, rebuildable* view — never hand-edited.
18
- 2. **Metadata-rich items.** Each item carries provenance, evidence,
19
- supersession links, and a TTL (`review_by`) so it can be audited and aged.
20
- 3. **Filesystem-first retrieval.** Reading = `cat BACKLOG.md` → `INDEX.md`, then
21
- `grep` over `items/*.md` frontmatter. No index server, no embeddings.
22
- 4. **Lifecycle ops.** Formation (`new`) → consolidation (`sync` archives
23
- done/dropped, flags stale) → retrieval (`list`, grep) → forgetting
24
- (archive, never delete).
25
- 5. **Governance Level 3.** Every write is logged, timestamped, attributable —
26
- git history + `created`/`updated` stamps + archive-not-delete provide it.
27
-
28
- ## Two scopes (do not conflate)
29
-
30
- | Scope | Path | Lifetime | Shared? |
31
- |---|---|---|---|
32
- | **Per-repo backlog** | `<repo>/.build-loop/backlog/` | Travels with the repo; committed | Team-shareable (in the repo) |
33
- | **Personal memory mirror** | `build-loop-memory/projects/<slug>/backlog/` | Per-user, aggregated across ALL the user's repos | Private to the user |
34
-
35
- The sync is **one-way**: per-repo backlog → personal memory. The per-repo store
36
- is the source of truth; the memory mirror is a cross-repo read view for the user
37
- who downloaded build-loop.
38
-
39
- ## Structure
40
-
41
- ```
42
- <repo>/
43
- ├── BACKLOG.md # repo-root pointer → .build-loop/backlog/INDEX.md
44
- └── .build-loop/backlog/
45
- ├── README.md # what this dir is + how to use it
46
- ├── .gitattributes # INDEX.md merge=ours (resolve by regeneration)
47
- ├── INDEX.md # DERIVED — regenerated by `sync`; do not edit
48
- ├── items/<ID>.md # CANONICAL truth — one file per item
49
- └── archive/<ID>.md # done/dropped items (never deleted)
50
- ```
51
-
52
- `<ID>` = `<PROJSLUG>-<AREA>-<token>` — e.g. `ATOM-SEARCH-mt3k9p7q`. The prefix is
53
- derived from the repo basename; the **token** is a coordination-free,
54
- collision-resistant suffix: 8 Crockford-base32 digits of millisecond time
55
- (so `ls items/` still roughly sorts by creation) followed by 5 digits of
56
- `os.urandom` entropy (so the ID is unique across agents, machines, branches, and
57
- clones with **no shared counter**). Lowercase throughout.
58
-
59
- **Why not the old sequential `-NNN`?** A per-area zero-padded counter is a
60
- single-writer assumption. Two agents in independent worktrees/clones (Claude on
61
- branch A, Codex on branch B) each read their OWN highest-NNN and both minted the
62
- SAME `...-001/002/003` for DIFFERENT items — on `git merge` the identical
63
- filenames/IDs collided or silently lost an item. The token removes the shared
64
- counter entirely. The readability trade-off (IDs gain a ~13-char token suffix
65
- instead of `-001`) is paid back by `INDEX.md`, which is the human-ordered
66
- navigation view; the items themselves are addressed by token.
67
-
68
- **Legacy `-NNN` items still read.** Items minted before this change (and any
69
- hand-authored `-NNN`) remain valid: the ID-shape regex accepts BOTH a token
70
- suffix and a legacy `\d{3,}` suffix, and no parser assumes a numeric tail.
71
- Existing IDs are never rewritten — only NEW items get tokens.
72
-
73
- ## Item schema (frontmatter on every `items/<ID>.md`)
74
-
75
- ```yaml
76
- id: ATOM-SEARCH-001
77
- title: <one line>
78
- status: open # open | in-progress | blocked | deferred | done | dropped
79
- priority: P2 # P0..P3
80
- type: debt # feature | fix | debt | infra | decision | cleanup | research
81
- area: search # free-ish tag; the grep + filter routing key
82
- entities: [pg_trgm, keyword-leg]
83
- gated: db-migration # none | prod-deploy | db-migration | infra | product-decision
84
- provenance: { source: followup, ref: <path/commit/PR#/chat-date> }
85
- evidence: [<commit/PR/retro/followup paths>]
86
- supersedes: null
87
- superseded_by: null
88
- created: 2026-06-16
89
- updated: 2026-06-16
90
- review_by: 2026-07-16 # TTL — surfaced by `sync` when passed
91
- owner: unassigned
92
- ```
93
-
94
- Body sections: `## Context`, `## Acceptance`, `## Notes`.
95
-
96
- Dates are caller-stamped (`--today YYYY-MM-DD` or the `BACKLOG_TODAY` env var,
97
- falling back to the system clock) so the tool runs in harnesses where the clock
98
- is not callable.
99
-
100
- ## Lifecycle / sync contract
101
-
102
- `scripts/backlog.py sync --repo <path>` does three things, in order:
103
-
104
- 1. **Consolidate.** Move every `status: done` / `status: dropped` item from
105
- `items/` to `archive/`. Never deletes. Flags items whose `review_by` has
106
- passed as stale. Warns about `.build-loop/{followup,issues,proposals}` files
107
- not yet referenced by any item's `evidence`/`provenance.ref` (scattered work
108
- not yet triaged into the backlog).
109
- 2. **Regenerate INDEX.** Rebuild `INDEX.md` deterministically from the remaining
110
- items' frontmatter — grouped status → area → priority, with a compact table,
111
- a summary (active count, open P0/P1, stale count, gated count), and a stale
112
- call-out. For a FIXED item set re-rendering is **byte-identical** (no
113
- wall-clock in the body), so `sync` is safe to re-run and diff-clean. The INDEX
114
- write is atomic (temp file + `os.replace`), so a concurrent `sync` by two
115
- agents never leaves a torn file for a reader. **Duplicate-ID guard
116
- (defense in depth):** if two items ever share an `id` (a bad merge, a
117
- hand-edit), `sync` surfaces them LOUDLY in a `## ⚠ Duplicate IDs` section
118
- (id, count, all titles, all paths) instead of silently rendering one — so a
119
- collision that did happen is visible.
120
- 3. **Mirror to personal memory.** Copy active item files (+ a mirror INDEX) into
121
- `build-loop-memory/projects/<slug>/backlog/`. Each mirror file is written
122
- atomically (temp file + `os.replace`), so a parallel session never observes a
123
- half-written file; last-writer-wins (the per-repo backlog is the truth).
124
- Best-effort: if the memory root is absent or unwritable, sync still succeeds
125
- and reports `mirror.skipped`.
126
-
127
- ### INDEX.md merge handling
128
-
129
- `INDEX.md` is fully derived, so two agents that both regenerate it WILL conflict
130
- on `git merge`. The scaffold (via `adopt` AND any backlog materialisation by
131
- `new`/`sync`) drops a `.build-loop/backlog/.gitattributes` with:
132
-
133
- ```gitattributes
134
- INDEX.md merge=ours
135
- ```
136
-
137
- so git resolves the conflict by keeping one side instead of inserting conflict
138
- markers. **On an `INDEX.md` conflict, run `backlog.py sync` — `items/` is the
139
- truth and the INDEX regenerates deterministically.** Item files in `items/`
140
- don't conflict once IDs are unique (token suffix → separate paths), so both
141
- branches' new items survive a merge.
142
-
143
- ## How ANY agent uses it (host-neutral)
144
-
145
- **Read** (no tools required — just the filesystem):
146
- 1. `cat <repo>/BACKLOG.md` → follow the pointer to `INDEX.md`.
147
- 2. `cat <repo>/.build-loop/backlog/INDEX.md` for the grouped view.
148
- 3. `grep -l 'area: search' <repo>/.build-loop/backlog/items/*.md` to find items
149
- by any frontmatter field; read the matching item bodies.
150
-
151
- **Write** (via the pure-stdlib CLI — works under bare `python3`, no host SDK):
152
- ```bash
153
- # create
154
- python3 scripts/backlog.py new --repo <path> --area search --type debt \
155
- --title "pg_trgm for keyword leg" --priority P1 --gated db-migration \
156
- --provenance-source followup --provenance-ref .build-loop/followup/x.md \
157
- --today 2026-06-16
158
- # edit the item body / frontmatter by hand in items/<ID>.md
159
- # then regenerate + mirror
160
- python3 scripts/backlog.py sync --repo <path> --today 2026-06-16
161
- # read
162
- python3 scripts/backlog.py list --repo <path> --status open
163
- ```
164
-
165
- The CLI emits structured JSON (machine-readable) on `new`/`sync`; `list` prints
166
- a text table (or JSON with `--json`). The host LLM reasons over the structured
167
- data + the convention — it never calls a vendor API.
168
-
169
- ## Relationship to existing build-loop surfaces
170
-
171
- - `.build-loop/issues/` — current-run bugs (short-lived). A persistent issue is
172
- triaged INTO the backlog (`new`), then the issue file is referenced as
173
- `evidence`/`provenance.ref` so `sync` stops warning about it.
174
- - `.build-loop/followup/` — iterate-cap overflow. Same triage path.
175
- - `templates/backlog-item.md` + `build-loop-memory/projects/<slug>/backlog.md`
176
- (the legacy single-table durable backlog) remain valid for build-loop's own
177
- self-work tracking; this per-item system is the general, multi-repo surface
178
- and writes its mirror to the `backlog/` *subdir* (no clobber of `backlog.md`).
179
-
180
- ## Phase 1 Assess integration
181
-
182
- `scripts/context_bootstrap.py` surfaces a compact backlog line at Phase 1 Assess
183
- when `.build-loop/backlog/INDEX.md` exists: open P0/P1 count, past-`review_by`
184
- stale count, and gated count. Cheap (reads the generated INDEX summary only) and
185
- non-fatal when the file is absent.
186
-
187
- It also surfaces a one-time **discoverability nudge** (`backlog_discoverability`)
188
- when there's something to act on:
189
-
190
- - **Adoptable** — the repo has scattered work in `.build-loop/{followup,issues}`
191
- but no `INDEX.md` yet → *"Backlog available — run `backlog.py adopt
192
- --dry-run --repo .`"*.
193
- - **Won't travel** — `.build-loop/backlog/` exists but is gitignored → *"Backlog
194
- won't travel — run `adopt --apply` to fix `.gitignore`"*.
195
-
196
- Both are silent when there's nothing to surface, and neither ever raises.
197
-
198
- ## Download & upgrade safety
199
-
200
- This is the contract that makes the backlog safe to **download** with a fresh
201
- build-loop and **upgrade** in place over an existing one. The guiding rule:
202
- *every adoption/upgrade step is additive and reversible; nothing the user
203
- already had is moved, deleted, or rewritten in a lossy way.*
204
-
205
- **1. Additive / never-destructive.** Adoption never touches the existing work
206
- surfaces. `.build-loop/followup/`, `.build-loop/issues/`, `.build-loop/proposals/`,
207
- and the personal `build-loop-memory` store are read-only inputs to `adopt` — an
208
- imported item *links* to its source (`provenance.ref` + `evidence[]` +
209
- `imported_from`); the source file stays exactly where it was as the inbox /
210
- provenance record. `sync` likewise only ever archives (`done`/`dropped` →
211
- `archive/`) and regenerates the derived `INDEX.md`; it never deletes a live item.
212
-
213
- **2. Lazy / opt-in scaffolding.** A repo gets backlog dirs and pointer files
214
- *only* when the user runs `adopt` (or `new`). A downloaded build-loop does not
215
- litter every repo with an empty `backlog/` on first run — the structure
216
- materialises on demand. `adopt --dry-run` (the default) reports exactly what it
217
- *would* create without writing anything, so the user previews before opting in.
218
-
219
- **3. The `.gitignore` dependency — and how `adopt` fixes it.** `.build-loop/` is
220
- gitignored by default (confirmed in both `build-loop` and `sample-app`). That is
221
- correct for transient run state — but it means the backlog would **not commit
222
- and therefore would not travel** with the repo (no team-sharing, lost on a fresh
223
- clone). `adopt` detects this by inspecting `.gitignore` (pure text, no git call)
224
- and, on `--apply`, appends un-ignore rules so the durable backlog escapes the
225
- broad ignore:
226
-
227
- ```gitignore
228
- # build-loop backlog (added by `backlog.py adopt` — keep so the backlog travels)
229
- !.build-loop/backlog/
230
- !.build-loop/backlog/**
231
- !BACKLOG.md
232
- ```
233
-
234
- It reports this loudly (`gitignore.was_ignored: true`, `added: [...]`) and is
235
- idempotent — re-running never appends the block twice. If `.build-loop/` is not
236
- ignored, `adopt` leaves `.gitignore` untouched.
237
-
238
- **4. Idempotent, dry-run-first migration.** `adopt` defaults to a read-only
239
- dry-run; `--apply` executes. Re-running `--apply` is a no-op: each imported item
240
- records `imported_from: <source path>`, and a re-run reads that field across
241
- `items/` **and** `archive/` and skips any source already imported. No duplicate
242
- items, no churned `.gitignore`. Verified contract: `adopt --apply` twice → the
243
- second run's diff (items + `.gitignore`) is empty.
244
-
245
- **5. Schema-version tolerance (forward/back compatible).** Every item carries
246
- `schema_version` (current = `1`). The reader (`read_item`) is deliberately
247
- tolerant: it **defaults missing known fields** and **preserves unknown fields**.
248
- An item written by an *older* build-loop (no `schema_version`) reads back with
249
- defaults filled in; an item written by a *newer* build-loop (carrying fields
250
- this version doesn't know) reads back without error and with those fields intact.
251
- So a backlog written by one build-loop version always reads on another — neither
252
- a downgrade nor an upgrade corrupts or rejects it. Bump `SCHEMA_VERSION` only for
253
- a contract change a reader must actively know about; the tolerant reader absorbs
254
- purely-additive field changes without a bump.
255
-
256
- **6. `build-loop-memory` is the per-user cross-repo long-term store.** The
257
- per-repo backlog travels *with the repo* (committed, team-shareable). `sync`
258
- additionally mirrors active items one-way into
259
- `build-loop-memory/projects/<slug>/backlog/` — the user's private, cross-repo
260
- aggregate view. The mirror writes to the `backlog/` **subdir**, so it never
261
- collides with the legacy single-table `backlog.md`, with `lessons/`, or with
262
- `decisions/` in that project's memory lane. The mirror is additive: its only
263
- delete path is pruning orphaned item mirrors (ID-shaped stems whose source item
264
- was removed), and it never touches a hand-dropped note. If the memory root is
265
- absent or unwritable, `sync` still succeeds and reports `mirror.skipped`.
266
-
267
- **Concurrency note (multi-agent) — two distinct collision classes.**
268
-
269
- 1. **Distributed (cross-worktree/clone/machine).** Independent checkouts share no
270
- filesystem and no counter, so IDs must be collision-free *with zero
271
- coordination*. The token suffix (time-ordered + `os.urandom`) provides exactly
272
- that: two agents in separate worktrees minting in the same area produce
273
- DISJOINT ID sets, so a `git merge` of their `items/` trees lands every item
274
- with nothing clobbered. This is the bug the token scheme fixes — the retired
275
- sequential counter collided here.
276
- 2. **Same-filesystem concurrent processes.** N `new`/`adopt` processes on ONE
277
- filesystem still race on the create. That is handled (kept from the prior fix)
278
- by the `O_EXCL` atomic create: exactly one process can create a given path;
279
- the rest re-mint a fresh token and retry, bounded. So 8 parallel `new` calls
280
- in one area yield 8 distinct files, zero loss.
281
-
282
- Together these make the backlog safe as a shared multi-agent work surface across
283
- both separate checkouts AND concurrent processes — not just a single-writer file.
284
- The INDEX and memory-mirror writes are atomic (temp + `os.replace`) so a reader
285
- never sees a torn derived file.
@@ -1,231 +0,0 @@
1
- <!-- SPDX-FileCopyrightText: 2025-2026 Tyrone Ross, Jr <46267523+tyroneross@users.noreply.github.com> | SPDX-License-Identifier: Apache-2.0 -->
2
-
3
- # Capability Routing (full protocol)
4
-
5
- > Loaded from `skills/build-loop/SKILL.md` summary. Contains the full capability routing table, trigger conditions, and plugin/hook/skill/agent mandatory routing rules.
6
-
7
- ## Capability Routing
8
-
9
- Build-loop prefers repo-owned agents and bundled skills for core loop decisions. External plugins are accelerators only when explicitly requested or when a row below names them as secondary. Each capability has three tiers: **preferred** (build-loop-owned surface) → **secondary** (another installed plugin or skill that can partially cover) → **inline fallback** (guidance text from `fallbacks.md`, injected verbatim into subagent prompts).
10
-
11
- Phase 1 runs `node ${CLAUDE_PLUGIN_ROOT}/skills/build-loop/detect-plugins.mjs` and writes the result to `.build-loop/state.json` under `availablePlugins`. All routing consults that object.
12
-
13
- ### Core loop skills/assets (always check)
14
-
15
- | Skill | Used In | Fallback |
16
- |-------|---------|----------|
17
- | `writing-plans` | Phase 2 (Plan) | Write a structured plan directly: goal, tasks with exact file paths, dependency order, test commands |
18
- | `subagent-driven-development` | Phase 3 (Execute) | Dispatch parallel agents manually using the host's available delegation tool for independent file groups |
19
- | `verification-before-completion` | Phase 4 sub-step G (Report) | Run all test/build/lint commands and confirm output before claiming completion. For app/UI changes this is NOT sufficient alone — also run the runtime UI⇄source-of-truth parity check (`runtime-parity-verification`); compile-green and a screenshot do not prove the running flow works |
20
- | `runtime-parity-verification` | Phase 4 Review-B + Phase 5 Iterate (any `uiTarget != null` or user-visible flow) | Cross-check the rendered/queryable UI against the authoritative backend (DB/API/daemon/tool-state), screen-independently, and keep a validated per-repo smoke. Catches the "action does nothing / not showing / shows empty despite real data / stale projection" class. Drivers: web `ui-validator`; macOS `native-ax-driver` / IBR `scan_macos`; iOS `idb`; agent = tool-result vs rendered output. Reference smoke: easy-terminal `tools/smoke_launch.py` |
21
- | `simplify` (slash: `/simplify`) | Phase 4 sub-step E (Simplify) | Self-review the diff: remove scaffolding, inline single-use helpers, delete dead branches |
22
- | `complexity_detector.py` (accelerator, not a gate) | Phase 4 sub-step E (Simplify) | Diff-scoped stdlib-AST hotspot detector for changed Python; surfaces high-severity hotspots for a simpler rewrite, apply-vs-advise via existing Review-B + independent-auditor. Optional Python aid — the default Simplify pass reasons over the diff language-agnostically (see `phase-4-review.md` §"Sub-step E: Simplify") |
23
- | `build-loop:self-improve` | Phase 6 (Learn) | Scan recent runs for recurring patterns, auto-draft experimental skills/agents with A/B tracking, notify user for keep/remove decisions |
24
- | Intent capability pack | Phases 1-4 | Read `references/intent-capability-pack.md`; write `.build-loop/intent.md`; pass the intent packet to every subagent |
25
- | Modular systems pack | Phases 1-4 | Read `references/modular-systems-pack.md`; partition files/tasks MECE; prefer modular scalable boundaries unless an exception is documented |
26
- | Codex subagent adapter | Phase 3 (Execute, Codex only) | Read `references/codex-subagents.md`; use `templates/codex-worker-prompt.md` for authorized Codex workers |
27
-
28
- ### Spec/Plan author router (intent-driven, ordered)
29
-
30
- This router selects the single skill that AUTHORS the plan/spec/task graph for this run. It is a recommendation that DRIVES Phase 2 — recorded into `state.json.intent.spec_router`, consumed by Phase 2 Plan, never a hard block.
31
-
32
- **Scope — author selection only.** `prd-bridge` is NOT in this router. It is mandatory in Phase 1 step 10 and only *consumes* an existing PRD (`docs/prd-*.md` → `state.json.prd`); it never authors. PRD-context is orthogonal to author selection — keep them separate.
33
-
34
- **Governing rule**: select on intent + goal + context, not on a trigger-word match. A skill's word-overlap activation is not enough to call it (this is why `prd-builder` over-fired during build-loop runs). The router is the intent-side selection; it pairs with the activation-side guard (prd-builder's negative-trigger scope, which excludes in-flight changes and active build-loop runs).
35
-
36
- Signals (all set during Phase 1 Assess):
37
-
38
- - `run_active` — is a build-loop run active? (`true` for any `/build-loop:run` or build-orchestrator dispatch.)
39
- - `plan_status` — `no-plan` | `plan-valid`, from the Phase 2 plan-exists gate (`.build-loop/plan.md` absent/empty + last `plan-verify` result).
40
- - `intent_kind` — `PRD-author` | `build-plan` | `task-graph` | `none`, the LLM's read of what this run needs authored.
41
- - `code_exists` — does the repo have substantive existing code? (Assess maps architecture: new/empty repo → false, existing repo → true.)
42
- - `goal_scope` — `new-app` | `existing-app-change` | `in-build-task-breakdown`.
43
-
44
- The rows are ORDERED — first match wins, so exactly one author is selected and no case matches two. The final default row makes the table exhaustive: every `(run_active, plan_status, intent_kind)` combination matches exactly one row, so nothing falls through.
45
-
46
- | # | Match condition (first true wins) | route_type / action | Author selected | Why |
47
- |---|---|---|---|---|
48
- | 1 | `intent_kind == none` — nothing to author (Q&A, status, trivial, read-only, or advisory-context-only) | `noop` (call nothing) | — (`skill: null`) | no plan/spec/task graph needed |
49
- | 2 | `run_active == false` AND greenfield PRD authoring is explicitly intended (new app with no code, OR `/start-prd` requested for a project) | `call` (or `recommend` outside an interactive session) | `prd-builder` | greenfield authoring + interactive intake; honors prd-builder's negative trigger — never fires inside an active run |
50
- | 3 | `run_active == true` AND `plan_status == no-plan` | `call` | `build-loop:spec-writing` | author the in-build, non-interactive, gated plan for the orchestrator |
51
- | 4 | `run_active == true` AND `plan_status == plan-valid` | `call` | `build-loop:writing-plans` (external) | turn the accepted plan into the task / dependency graph |
52
- | 5 (default) | else (no earlier row matched) — the canonical case is `run_active == false` AND `intent_kind` is `build-plan` or `task-graph`: a direct, out-of-run invocation of plan authoring on an existing repo | `recommend` | `build-loop:spec-writing` | recommend, not auto-call: there is no active run to drive, so surface the author for the lead to run if it chooses |
53
-
54
- The order is the contract: row 1 short-circuits before any author runs; row 2 is the only PRD author and is fenced off from active runs; rows 3 and 4 are mutually exclusive on `plan_status`; row 5 is the exhaustive `else` default that catches every remaining combination — its canonical case is an out-of-run `build-plan`/`task-graph` intent, but as the final row it also absorbs any residual (e.g. an out-of-run non-greenfield `PRD-author`) so no signal combination ever falls through. The table extends to any future author skill — add a row at the right precedence above the default, key it on the same signals, and the system still selects exactly one and records why.
55
-
56
- `build-loop:writing-plans` (row 4) is the **external** `writing-plans` skill from the superpowers plugin — it is not vendored in this repo (`skills/writing-plans/SKILL.md` does not exist here). When it is absent, fall back to the inline "write a structured plan directly" path in the §"Core loop skills/assets" table above.
57
-
58
- > Future refinement (do not over-build now): for monorepos, a `target_code_exists` signal (does the *target sub-path* already have code, vs the repo as a whole) would refine row 2's greenfield test. Out of scope until a monorepo case demands it.
59
-
60
- **Phase 1 record (the consumable contract)**. Phase 1 writes the matched decision into `state.json.intent.spec_router` so a Codex lead (no `Skill()` auto-activation) can consume it deterministically:
61
-
62
- ```json
63
- {
64
- "route_type": "author",
65
- "action": "call" | "recommend" | "noop",
66
- "skill": "build-loop:spec-writing" | "build-loop:writing-plans" | "prd-builder" | null,
67
- "fallback": "<fallbacks.md section or inline guidance> | null",
68
- "matched_row": 1 | 2 | 3 | 4 | 5,
69
- "signals": { "run_active": true, "plan_status": "no-plan", "intent_kind": "build-plan", "code_exists": true, "goal_scope": "existing-app-change" }
70
- }
71
- ```
72
-
73
- `action: "noop"` → `skill: null`, Phase 2 authors nothing from the router (terminal). `action: "recommend"` → `skill` carries the recommended author name (so the lead knows what to run if it chooses); Phase 2 surfaces the recommendation in the report and does NOT auto-call. `action: "call"` → `skill` is non-null and Phase 2 calls it. The three actions are distinct: `call` auto-invokes, `recommend` surfaces-only, `noop` skips.
74
-
75
- **Phase 2 read (the load-bearing wire)**. Phase 2 Plan READS `state.json.intent.spec_router` and acts on `action`/`skill` — it does NOT independently re-decide which author to call. See `references/phase-2-plan.md` step 0.
76
-
77
- ### Phase quick reference
78
-
79
- | # | Phase | Purpose | Sub-steps / key actions |
80
- |---|---|---|---|
81
- | 1 | **Assess** | Understand state + define goal & criteria | detect tools, map architecture, load memory, write `intent.md` + `goal.md` |
82
- | 2 | **Plan** | Break work, identify parallel-safe, optimize | writing-plans skill → dependency graph |
83
- | 3 | **Execute** | Build per plan | parallel subagents, Sonnet default, Opus escalation |
84
- | 4 | **Review** | Critic → Validate → Optimize (opt-in) → Fact-Check → Simplify → Auto-Resolve → Report | sub-steps A-G; B-D can route to Iterate; F drains non-destructive items via autonomy_gate; G runs only on final pass |
85
- | 5 | **Iterate** | Fix Review failures, loop back to Review | max 5x; orchestrator stuck-iteration cascade (evidence-gap repair → memory re-check → parallel assess at 2 fails → causal-tree at 3 fails) |
86
- | 6 | **Learn** | Cross-build pattern detection + experimental skill drafting | optional; requires `runs[] >= 3`; auto-promote opt-in |
87
-
88
- ### Capability routing table
89
-
90
- | Capability | Preferred | Secondary | Inline fallback section |
91
- |---|---|---|---|
92
- | Web UI build | `build-loop:ui-design` + `build-loop:design-contract-specialist` (`trigger_point: phase2-design-direction`) + `calm-precision` + `templates/ui-subagent-prompt.md` | `frontend-design:frontend-design` only when explicitly requested | `fallbacks.md#web-ui` |
93
- | Web UI validation | `ui-validator` agent + `audit-design-rules.mjs` + browser/screenshot artifact | `showcase:capture` for visual evidence | `fallbacks.md#web-ui` |
94
- | Orchestrated UI build | `build-loop:ui-design` → build-loop-owned design direction → implementer fan-out → ui-validator/design-contract reconciliation | explicit user-invoked design tool artifacts passed to `design-contract-specialist` | `fallbacks.md#web-ui` |
95
- | Mobile UI build (`uiTarget: "mobile"` — iOS/watchOS sim) | `build-loop:ui-design` + `build-loop:design-contract-specialist` + `calm-precision` + `apple-dev` | — | `fallbacks.md#mobile-ui` + `fallbacks.md#apple-dev` |
96
- | Mobile UI validation (iOS sim) | `xcrun simctl io booted screenshot` for static; `idb ui tap` for interaction | `showcase:capture` | `fallbacks.md#mobile-ui` |
97
- | macOS desktop UI build (`uiTarget: "macos"`) | `build-loop:ui-design` + `build-loop:design-contract-specialist` + `calm-precision` + `apple-dev` | — | `fallbacks.md#mobile-ui` + `fallbacks.md#apple-dev` |
98
- | macOS desktop UI validation | IBR `scan_macos` when `availablePlugins.ibr == true`; else `native-ax-driver` against the running `.app` (pid-anchored). NEVER `xcrun simctl` (no macOS simulator). NEVER `nm`/`strings` as substitute. | `showcase:capture` for screenshot evidence | `fallbacks.md#mobile-ui` |
99
- | Design system tokens | `design-contract-specialist` reads project token/theme/component files and records the source in `.build-loop/app-contract/ui.md` | — | `fallbacks.md#design-tokens` (reads consumer project's token files — never hardcodes) |
100
- | Recent design structures | `design-contract-specialist` reads `references/recent-design-structures.md` and selects by product/workflow/data fit | explicit design-tool artifacts passed as evidence | `fallbacks.md#web-ui` |
101
- | Screenshot / visual evidence | `showcase:capture`, `showcase:record` | `screenshot` MCP tool | `fallbacks.md#screenshot` |
102
- | Web content fetching (low LLM) | `scraper-app:web-scraper` SDK | — | `fallbacks.md#web-fetch` (flags LLM cost in report) |
103
- | Deep debugging | `build-loop:debug-loop` + `build-loop:debugging-memory` native search/store | standalone Coding Debugger only when explicitly installed for cross-project memory | `fallbacks.md#debug` |
104
- | Bug-pattern memory | `build-loop:debugging-memory` | — | `fallbacks.md#bug-memory` (greps `.build-loop/issues/` + `.bookmark/`) |
105
- | Agent authoring | `agent-builder:agent-builder-anthropic` | `plugin-dev:agent-development` (if plugin work) | `fallbacks.md#agent-authoring` |
106
- | DeepAgents / local-LLM agent work | `build-loop:building-with-deepagents` (SubAgent API, middleware stack, per-agent tool scoping, anti-patterns) | — | Read installed `deepagents` source: `python3 -c 'import deepagents, os; print(os.path.dirname(deepagents.__file__))'` then `graph.py` + `middleware/subagents.py` |
107
- | Structured reports / handoffs | `pyramid-principle:pyramid-short-form` (Review-F reports), `pyramid-long-form` (design docs) | — | `fallbacks.md#structured-writing` (SCQA + MECE skeleton) |
108
- | Hosted-IDE migration (Replit / Lovable / Bolt / v0) | `replit-migrate:migration-scan`, `migrate-web`, `migrate-ios`; MCP tools `migrate_scan`, `migrate_plan_web`, `migrate_plan_native`, `migrate_map_apis`, `migrate_map_models`, `migrate_check_progress` | — | `fallbacks.md#migration` (manual inventory + stack-translation) |
109
- | Prompt authoring / review / audit (system prompts, agent prompts, eval judges) | `prompt-builder:prompt-builder` skill; slash commands `/prompt-builder:optimize`, `/score`, `/compare`, `/save`, `/list`. Calibrates to model tier (T1/T2/T3) and deployment (interactive, backend, rag_pipeline, agent, plugin, eval_judge, personal_mobile). Returns 6-Part-Stack prompt + 5-dim score + diagnosis + `[ASSUMED:]` tags + `TEMPERATURE_HINT` | `prompt-builder` (personal skill, same name, loaded via Skill tool) | `fallbacks.md#prompt` |
110
- | iOS / watchOS / macOS dev + deploy | `apple-dev` personal skill (via `Skill("apple-dev")`) | `replit-migrate:migrate-ios` (when migrating *to* native) | `fallbacks.md#apple-dev` |
111
- | Web deploy verification (Vercel) | Vercel MCP (`mcp.vercel.com` remote OAuth, only if user adds it to `.mcp.json`) | Vercel CLI via `scripts/verify_deploy.py` | `fallbacks.md#web-deploy-verify` |
112
- | Strategic frame / PRD grounding (Assess + Review) | `build-loop:prd-bridge` — reads `docs/prd-*.md` frontmatter (`core_principles`, `load_when`) + Navigation Map + Section Index in Phase 1; verifies diff doesn't violate principles in Phase 5 Fact-Check; recommends `prd-builder` skill if no PRD exists. Falls back to grep on principle keywords if frontmatter parser unavailable. | `prd-builder` skill direct invocation | Phase 1 captures north-star + intent fresh into `intent.md` (existing fallback) |
113
- | Architecture scan / impact trace (Assess + Review) | `build-loop:architecture-scan` (Assess refresh), `build-loop:architecture-impact` (blast-radius), `build-loop:architecture-rules` (Review violation check), `build-loop:architecture-dead` (orphan scan) — read `.navgator/architecture/` JSON; native skills sourced from NavGator with provenance and drift-detection via `build-loop:sync-skills` | `gator:*` commands if installed | Read component → edit → re-read downstream |
114
- | Debugger memory-first gate (Review + Iterate) | `build-loop:debugging-memory` — verdict gate (`KNOWN_FIX` / `LIKELY_MATCH` / `WEAK_SIGNAL` / `NO_MATCH`) with strict direct-apply triple-gate (file + version + secondary signal) and Review-F outcome feedback. Orchestrator owns the when-to-fire policy (Review-B + every Iterate attempt) and routes to this skill. | `build-loop:debug-loop` direct (when memory says enter the loop or 3 same-criterion failures) | `fallbacks.md#debug` |
115
- | Runtime visibility / observability (Assess + reactive Review/Iterate) | `build-loop:logging-tracer` — generates stack-appropriate structured logging / OTel with ephemeral-by-default policy (Mechanism A: `DEBUG_TRACE=1` runtime gate; Mechanism B: `git-stash` throwaway). Invoked reactively when an Iterate attempt flags `evidence_gap: true`. Orchestrator runs the passive Assess scan inline (no skill call needed) and only loads this skill when instrumentation is actually being added. | — | `fallbacks.md#logging-fallback` (inline Tier-1 zero-dep JSON logger per stack) |
116
- | Self-improvement / recurring pattern detection (Phase 6 Learn) | `build-loop:self-improve` — runs after every build; detects recurring failures and manual interventions; drafts experimental skills/agents to `.build-loop/skills/experimental/`. Auto-promote to `.build-loop/skills/active/` requires opt-in (`autoPromote: true`) plus effective non-confounded sample ≥ 8; regressions and inconclusive results write proposals to `.build-loop/proposals/` for user confirmation — never auto-remove. Cross-project promotion via `/build-loop:promote-experiment <name>` | — | Manual review of `.build-loop/state.json.runs[]` |
117
- | Context recovery after compaction | `bookmark:*` commands | — | Re-read last plan file in `.build-loop/` |
118
- | Claude Code plugin authoring / review | `plugin-builder` (personal skill), `plugin-dev:*` family | `build-loop:plugin-hygiene-lessons.md` enforces manifest/hook/marketplace rules in Review-D | Read `plugin-hygiene-lessons.md` verbatim |
119
-
120
- ### Sub-routers (set during Phase 1)
121
-
122
- **UI target**: prefer the most specific match — order matters.
123
-
124
- 1. **macOS desktop (`uiTarget: "macos"`, `platform: "apple"`)** — `*.xcodeproj` or `Package.swift` is present AND any of: (a) project has NO `ios/` directory AND has `Sources/` / `App/` with `*.swift`; (b) Xcode project's `SUPPORTED_PLATFORMS` / deployment target indicates macOS; (c) repo grep shows `import AppKit` or `import SwiftUI` paired with `WindowGroup`/`Window` (macOS scene types) and no `UIKit` import. macOS has no simulator; validation routes to `native-ax-driver` or IBR `scan_macos`, never to `xcrun simctl`.
125
- 2. **iOS/watchOS mobile (`uiTarget: "mobile"`, `platform: "apple"`)** — `ios/` directory present, OR `*.xcodeproj`/`Package.swift` with `UIKit` import / `iOS` deployment target. Validation uses the iOS simulator screenshot path.
126
- 3. **React Native mobile (`uiTarget: "mobile"`, `platform: "react-native"`)** — `app.json` (Expo) or `App.tsx` with `react-native` import.
127
- 4. **Web (`uiTarget: "web"`, `platform: "web"`)** — fallback for everything else with a UI surface.
128
-
129
- Tie-breaker: if signals are mixed (an Apple project with both `ios/` and a macOS target), set `uiTarget: "mobile"` and surface a one-line note in Assess; the build can override via `state.json.uiTarget` if the goal targets the macOS surface.
130
-
131
- **Migration source**: if `.replit` / `replit.nix` present → `migrationSource: "replit"`. Lovable / Bolt / v0 export markers (e.g. `lovable.config`, `bolt.config`, `v0.dev` in comments) → corresponding source. `replit-migrate` skills generalize — load `migration-scan` for any of the above, override hints as needed.
132
-
133
- **Apple deploy**: when `platform: "apple"` AND goal includes "deploy", "TestFlight", or "App Store" → Phase 7/8 invoke `apple-dev` deploy flow using ASC creds from your harness memory store (e.g. `~/.claude/projects/<project-slug>/memory/reference_asc_credentials.md`). Apply deployment policy first: TestFlight/App Store Connect upload/export defaults to `auto`; App Store production release/submission defaults to `confirm`.
134
-
135
- **Web deploy verify**: fires when `.vercel/project.json` or `vercel.json` is present AND the build performed a push/deploy → Phase 4 Review-B invokes `scripts/verify_deploy.py` (preferred-tier upgrade: Vercel MCP only if the user has added it to `.mcp.json`). Infra failures return `skipped`, never block the build.
136
-
137
- ## Trigger Conditions
138
-
139
- Some capabilities should fire proactively based on goal phrasing or files touched. Phase 1 ASSESS sets these flags in `.build-loop/state.json.triggers`, and Phase 4 EXECUTE consults them before dispatching each subagent.
140
-
141
- **pyramid-principle** (structured writing)
142
-
143
- Fires whenever the build produces user-visible prose or professional writing. Even small text should follow pyramid structure, and the logical ordering principle applies to design flow too.
144
-
145
- Trigger if any of:
146
-
147
- - Task touches user-visible text inside the app: copy, microcopy, empty-state messages, error messages, onboarding flow, help content, tooltips, toasts, form labels, email templates, notification text.
148
- - Task creates or edits: `README.md`, `CHANGELOG.md`, `docs/**/*.md`, PR descriptions, release notes, design docs, status updates, exec summaries, handoff documents.
149
- - Goal contains: "write", "draft", "summarize", "document", "one-pager", "brief", "memo", "deck", "slides", "presentation", "status update".
150
- - Designing information architecture or section ordering: use the pyramid logic for top-down flow (governing thought, then MECE key lines, then support).
151
-
152
- Action: load `pyramid-principle:pyramid-principle-core` first for ground rules, then the specific skill matching length and format. If absent, use `fallbacks.md#structured-writing`.
153
-
154
- **prompt-builder** (prompt authoring or audit)
155
-
156
- Fires when prompts are a core part of the product, not when prompts appear incidentally in code comments or test fixtures.
157
-
158
- Trigger if any of:
159
-
160
- - Building or editing prompts that the app sends to an LLM at runtime: document-generation prompts (Example App style), chat-with-user system prompts, voice-interaction prompts (example app style), reranker prompts, eval-judge prompts.
161
- - Robust agent or prompt pipeline present in the product: multi-step prompts, RAG, tool-use flows.
162
- - Semantic search over user queries: use `prompt-builder` to revise the query before embedding or retrieval.
163
- - Authoring a new agent's instructions (the body of an `agents/*.md` file serving as LLM guidance).
164
- - File signals: `prompts/`, `system-prompt.*`, strings passed to `messages[{role:"system"}]`, `anthropic.messages.create`, `openai.chat.completions.create`, prompt templates in `.prompt` or `.txt` held as product assets.
165
- - Goal contains: "system prompt", "agent prompt", "prompt engineering", "rewrite this prompt", "improve this prompt", "audit prompts", "eval judge".
166
-
167
- Existing prompt guardrail: if the task touches an **existing** in-product prompt (not a new one), pause and ask the user before running `prompt-builder`. Prompts are often tuned against real evals; silent rewrites can regress quality. Offer the option, do not auto-apply.
168
-
169
- Action: load `prompt-builder:prompt-builder` (plugin) if installed, else the personal `prompt-builder` skill, else `fallbacks.md#prompt`. For existing-prompt edits, capture before-and-after in `.build-loop/prompts/` with version suffixes so regressions are detectable.
170
-
171
- **building-with-deepagents** (DeepAgents / local-LLM agent work)
172
-
173
- Fires whenever the project uses the open-source `deepagents` package. DeepAgents has subtle API shape (SubAgent dict, middleware stack, per-agent tool scoping) that makes hand-rolled focus modes and flat-tool-list designs silently wrong — small local models exhibit tool-call hallucinations in ways that scoping fixes and prompt injection doesn't.
174
-
175
- Trigger if any of:
176
-
177
- - Repo grep: `from deepagents` or `import deepagents` in any Python source file
178
- - `deepagents` in `pyproject.toml`, `requirements*.txt`, `uv.lock`, or `poetry.lock`
179
- - Goal mentions: "agent", "sub-agent", "subagent", "planner/researcher/writer", "focus mode", "tool-call hallucination", "LangGraph agent", "ChatOllama", "local LLM agent"
180
- - File signals: `create_deep_agent`, `SubAgent`, `AGENT_ROLES`, `agent_focus_prompt`
181
- - Pain symptoms in the conversation: "`<namespace>.<tool>` is not a valid tool", "silent thinking", "model loaded forever", "threads vanish on restart"
182
-
183
- Existing-agent guardrail: treat agent definitions like existing prompts — pause before rewriting, capture before-and-after in `.build-loop/agents/` with version suffixes. Tool scoping changes downstream behavior for every query; regressions are expensive to spot.
184
-
185
- Action: load `build-loop:building-with-deepagents` before any code edit involving agent construction, tool binding, or streaming. The skill's `references/anti-patterns.md` lists 12 concrete bugs we've hit — verify none of your planned changes reintroduce them.
186
-
187
- **Judgment: prompt-builder vs inline prompt**
188
-
189
- Not every prompt needs the full engine. Use `prompt-builder` when the prompt is load-bearing. Craft a simple inline prompt when it is throwaway.
190
-
191
- Use `prompt-builder` when any of these are true:
192
-
193
- - The prompt ships in the product and runs at scale.
194
- - The prompt is sent to end users or generates user-visible output.
195
- - The prompt is part of an agent, eval judge, RAG pipeline, or semantic-search query rewriter.
196
- - Output correctness is measured (evals exist or are planned).
197
- - The prompt will be reused across features, or maintained over time.
198
- - Token cost matters because it runs millions of times.
199
-
200
- Roll your own inline prompt when all of these are true:
201
-
202
- - One-shot usage inside the current build loop (dispatching a subagent, asking Claude to transform a file, generating a migration script).
203
- - Not persisted to the product codebase.
204
- - Output is checked once by the orchestrator, not by an eval.
205
- - A short direct instruction is clearer than a 6-Part Stack.
206
-
207
- Default when uncertain: if the prompt text will exist in the repo after the build, use `prompt-builder`. If it only exists as a line in an orchestrator message during this build, inline is fine.
208
-
209
- ### Plugin / hook / skill / agent work — mandatory
210
-
211
- If Phase 1 detects that the task touches plugin components, Phase 3 must map each task to the authoritative skill below and Phase 4 must load that skill. **Do not infer plugin formats from memory or by reading another plugin's config.**
212
-
213
- | Task surface | Skill (authoritative) | Fallback |
214
- |---|---|---|
215
- | `.claude-plugin/plugin.json` | `plugin-dev:plugin-structure` | Read `RossLabs-AI-Toolkit/LESSONS-LEARNED.md` — paths must start with `./` |
216
- | `hooks/hooks.json` or hook scripts | `plugin-dev:hook-development` + run `plugin-dev/scripts/hook-linter.sh` | Command hooks default; Stop stdout must be valid JSON; advisory/non-blocking unless an explicit safety/security/integrity gate opts into blocking; NO prompt hooks on PostToolUse/Stop/SessionStart |
217
- | Slash commands (`commands/*.md`) | `plugin-dev:command-development` | — |
218
- | Subagents (`agents/*.md`) | `plugin-dev:agent-development` + `RossLabs-AI-Toolkit/agents/` | `fallbacks.md#agent-authoring` |
219
- | MCP servers (`.mcp.json`) | `plugin-dev:mcp-integration` | `.mcp.json` must NOT wrap with `mcpServers` key (Method 1) |
220
- | `~/.claude/settings.json` | `plugin-dev:plugin-settings` | — |
221
- | New skill (SKILL.md) | `plugin-dev:skill-development` + `skill-builder` (personal) | Official skill format; SKILL.md ≤200 lines |
222
- | New plugin end-to-end | `plugin-builder` (personal) → delegates into `plugin-dev:*` | — |
223
-
224
- ### External knowledge — check before coding
225
-
226
- | Source | When | How |
227
- |---|---|---|
228
- | `/cookbook` | Claude API patterns: tool calling, PTC, code execution, Agent SDK, RAG, thinking, structured output, batch, caching | Invoke `/cookbook` or read `reference_claude_cookbook.md` from your harness memory store (`~/.claude/projects/<project-slug>/memory/`) |
229
- | `RossLabs-AI-Toolkit/LESSONS-LEARNED.md` | Any plugin work | Read during Phase 1 ASSESS |
230
- | `context7` MCP | Any library/framework use | `query-docs` / `resolve-library-id` — do NOT code from training data |
231
- | `research` skill | Factual claims, pricing, versions | Run `scripts/research_trigger.py` first; T1 official docs → T4 forums; 2-source minimum |
@@ -1,106 +0,0 @@
1
- <!-- SPDX-FileCopyrightText: 2025-2026 Tyrone Ross, Jr <46267523+tyroneross@users.noreply.github.com> | SPDX-License-Identifier: Apache-2.0 -->
2
-
3
- # Codex Subagent Adapter
4
-
5
- Use this adapter when Build Loop runs inside Codex. It translates Build Loop's host-neutral "parallel subagents" concept into Codex-native delegation without changing Claude Code's `agents/*.md` runtime.
6
-
7
- ## Core Rule
8
-
9
- Codex may use subagents only when the user explicitly authorizes delegation or parallel agent work. Examples: "use subagents", "parallelize this", "delegate", "spin up workers", or `/build-loop --parallel ...`.
10
-
11
- If authorization is absent, keep the work local in the lead Codex session. Still write the same MECE plan and ownership packets, but do not spawn workers.
12
-
13
- ## Role Mapping
14
-
15
- | Build Loop need | Codex role | Use when |
16
- |---|---|---|
17
- | Codebase question | `explorer` | The answer can be read-only, bounded, and returned as facts with file paths. |
18
- | Implementation slice | `worker` | The write set is disjoint from other workers and the interface contract is clear. |
19
- | Phase 4 review passes | lead session inline, or `explorer` if authorized | See the enumerated passes below — the lead owns these whether or not delegation is allowed. |
20
- | Final integration | lead session | The lead must own merge, validation, and final judgment. |
21
-
22
- **Phase 4 review is not one pass — it is a set.** Whether run inline (default) or via an authorized `explorer`, the lead must cover all of these every non-trivial build; do not skip a pass just because Codex lacks a dedicated agent file for it:
23
-
24
- - **Adversarial audit (independent-auditor)** — read the diff against intent/goal/PRD/constitution; verdict `yay`/`nay`/`suggest_correction`/`look_again`. Advisory at chunk close, gating at build scope.
25
- - **Fact-check** — trace every rendered metric (%, $, score, count) to its source; flag absolute claims. *Blocking* when a rendered number is unverifiable.
26
- - **Mock-data scan** — production paths only; lorem/faker/hardcoded/`Math.random()`-in-display. *Blocking* when it renders to the user.
27
- - **Security review** — only when Assess flagged a risk-surface change (auth, network, persistence, secrets, external input); OWASP LLM/Agentic/Web top-10. *Blocking* on critical/high (feeds the exit gate).
28
-
29
- The first row's "read-only, does not block" applies to the adversarial-audit *critic* pass; the fact-check, mock-scan, and security passes CAN block and route to Iterate.
30
-
31
- ## Permission Gate
32
-
33
- Before spawning any Codex subagent:
34
-
35
- 1. Confirm user authorization is explicit in the current request or command flags.
36
- 2. Confirm the task is not on the immediate critical path.
37
- 3. Confirm the subtask has a bounded write set or read-only question.
38
- 4. Confirm the prompt includes a MECE ownership packet.
39
-
40
- If any condition fails, do the work locally.
41
-
42
- ## When Not To Delegate
43
-
44
- - Ambiguous product decisions.
45
- - Final integration or final report.
46
- - Destructive git operations.
47
- - Push/deploy confirmation.
48
- - A task whose result is required before the lead can make the next local move.
49
- - Files already owned by another active worker.
50
- - Cross-file architecture decisions that were not settled in the plan.
51
-
52
- ## Prompt Packet Required
53
-
54
- Every Codex worker prompt must include:
55
-
56
- - `task`: one concrete outcome.
57
- - `owns`: exact files or directories the worker may edit.
58
- - `does_not_own`: files, directories, or responsibilities the worker must avoid.
59
- - `context`: condensed facts from Phase 1 and Phase 2.
60
- - `interface_contract`: functions, routes, schemas, props, CLI flags, or docs the worker must preserve or expose.
61
- - `integration_checkpoint`: what the lead will verify before merging the worker result.
62
- - `validation`: commands the worker should run if feasible.
63
- - `return_format`: changed files, summary, validation, unresolved risks, integration notes.
64
-
65
- Tell every worker: "You are not alone in the codebase. Do not revert edits made by others; adapt around them and report conflicts."
66
-
67
- ## Context Policy
68
-
69
- Prefer explicit prompt packets over full context forks. Use full context only when the worker genuinely needs the thread history to avoid a wrong implementation.
70
-
71
- Shared reads should happen once in the lead session, then be condensed into worker prompts. This keeps workers focused and reduces contradictory interpretations.
72
-
73
- ### Prompt Cache Discipline
74
-
75
- OpenAI prompt caching is automatic, so Build Loop cannot call the cache directly from Codex. The lever the Codex adapter controls is prompt shape: keep the reusable prefix stable, and move volatile task state later.
76
-
77
- For Codex CLI and Codex app runs, put reusable role rules, output contracts, validation expectations, and ownership schema before task-specific facts. Put Rally state, timestamps, command output, diffs, browser comments, thread IDs, worktree metadata, current claims, and task IDs after the stable contract.
78
-
79
- Do not reorder stable sections between worker prompts. Monitoring cached-token counters only detects prefix churn; the improvement comes from preserving the prefix and reducing noisy context before dispatch.
80
-
81
- ## Parallel Pattern
82
-
83
- 1. Lead creates the plan and identifies parallel-safe groups.
84
- 2. Lead spawns only independent sidecar work.
85
- 3. Lead continues non-overlapping local work while workers run.
86
- 4. Lead waits only when blocked on a worker result.
87
- 5. Lead reviews changed files and integrates deliberately.
88
- 6. Lead runs final validation locally.
89
-
90
- ## Return Format
91
-
92
- Workers should finish with:
93
-
94
- ```text
95
- Changed files:
96
- - <path>: <what changed>
97
-
98
- Validation:
99
- - <command or "not run">: <result or reason>
100
-
101
- Integration notes:
102
- - <contract, migration, or ordering notes>
103
-
104
- Unresolved risks:
105
- - <risk or "none known">
106
- ```