@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
@@ -198,7 +198,15 @@ Trusted Publisher settings before the real publish:
198
198
  - Workflow filename exactly matches the publish workflow, for example
199
199
  `publish-npm.yml`.
200
200
  - Environment is blank unless the workflow uses a GitHub environment.
201
- - Allowed actions include `npm publish`.
201
+ - Allowed actions include `npm publish` (stage-only records reject a direct publish).
202
+ - The record EXISTS. `npmjs.com → package → Settings → Trusted publishing` is per
203
+ package and only the web UI (with 2FA) can create it. If the OIDC exchange answers
204
+ `"OIDC token exchange error - package not found"`, there is no record; no workflow
205
+ edit will help. See `../../../references/npm-package-publishing.md`
206
+ §"Diagnosing a trusted-publishing failure" for the exchange probe and the answer table.
207
+ - `package.json#repository.url` exactly matches the GitHub repository.
208
+ - The package already exists on npmjs; trusted publishing cannot create one, so the
209
+ first version of a new package needs a one-time human login.
202
210
 
203
211
  The workflow should use a GitHub-hosted runner, `permissions: id-token: write`,
204
212
  `actions/checkout`, and `actions/setup-node` with `registry-url` set to the
@@ -209,7 +217,10 @@ cache detection is noisy.
209
217
 
210
218
  Run `npm publish --dry-run --provenance --access public --registry=https://registry.npmjs.org`
211
219
  as a packaging check, but do not treat it as proof that the Trusted Publisher
212
- mapping is valid. A real publish can still fail after a successful dry-run when
220
+ mapping is valid. Nor is the `Signed provenance statement` line at publish time:
221
+ with `publishConfig.provenance: true` npm signs before it knows whether the OIDC
222
+ exchange succeeded. A later `E404 Not Found - PUT` is an unauthenticated write masked by
223
+ setup-node's placeholder `NODE_AUTH_TOKEN`, not a missing package. A real publish can still fail after a successful dry-run when
213
224
  the npm package settings do not match the GitHub workflow. After publishing,
214
225
  verify the registry metadata includes
215
226
  `dist.attestations.provenance.predicateType = https://slsa.dev/provenance/v1`.
@@ -48,13 +48,13 @@ Better: use `EnterWorktree` or a separate test project directory for plugin deve
48
48
 
49
49
  **What happened.** Editing hook files under `~/.claude/plugins/cache/rosslabs-ai-toolkit/showcase/0.1.1/hooks/hooks.json` took effect immediately, but the next marketplace sync (pulling the GitHub repo) overwrote the edit with the repo's original file. Hours of debugging lost to the illusion of a persistent fix.
50
50
 
51
- **Rule.** Cache is regenerated from the marketplace's upstream repo. Always edit the source (`~/Desktop/git-folder/RossLabs-AI-Toolkit/plugins/<plugin>/…`), commit, push. If you need an immediate fix in the current session, edit both the source and the cache — the cache copy keeps the session alive until you push, then the next sync reconciles.
51
+ **Rule.** Cache is regenerated from the marketplace's upstream repo. Always edit the source (your local checkout of the marketplace repo, e.g. `<your-checkouts-root>/RossLabs-AI-Toolkit/plugins/<plugin>/…`), commit, push. If you need an immediate fix in the current session, edit both the source and the cache — the cache copy keeps the session alive until you push, then the next sync reconciles.
52
52
 
53
53
  The marketplace repo is the source of truth. Nothing under `~/.claude/plugins/cache/` is authored — it's all generated.
54
54
 
55
55
  ## 5a. The reverse trap: source-only edits don't take effect at runtime
56
56
 
57
- **What happened (2026-04-22, build-loop).** Edited `~/Desktop/git-folder/build-loop/scripts/write_run_entry.py` in the source repo and updated the orchestrator prose to invoke `${CLAUDE_PLUGIN_ROOT}/scripts/write_run_entry.py`. Tests passed. Claimed success. The orchestrator never saw the new script because `${CLAUDE_PLUGIN_ROOT}` resolves to `~/.claude/plugins/cache/<marketplace>/<plugin>/<version>/` — a frozen snapshot that only updates on marketplace sync. Source-only edit = runtime silently runs the old version (or in this case, returns "file not found" and the orchestrator falls back to hand-writing JSON, if it remembers to).
57
+ **What happened (2026-04-22, build-loop).** Edited `<local checkout>/build-loop/scripts/write_run_entry.py` in the source repo and updated the orchestrator prose to invoke `${CLAUDE_PLUGIN_ROOT}/scripts/write_run_entry.py`. Tests passed. Claimed success. The orchestrator never saw the new script because `${CLAUDE_PLUGIN_ROOT}` resolves to `~/.claude/plugins/cache/<marketplace>/<plugin>/<version>/` — a frozen snapshot that only updates on marketplace sync. Source-only edit = runtime silently runs the old version (or in this case, returns "file not found" and the orchestrator falls back to hand-writing JSON, if it remembers to).
58
58
 
59
59
  **Rule.** The full sync cycle is **source → commit → push → marketplace sync → cache**. Any link that breaks leaves the cache stale.
60
60
 
@@ -77,7 +77,7 @@ Don't migrate to pytest, vitest, or Playwright. The stdlib pattern keeps the har
77
77
  ## What this skill does NOT do
78
78
 
79
79
  - Runtime testing (live MCP calls, actual `Skill()` invocation) — that's Review-B Validate's job, executed by the orchestrator with the live runtime
80
- - UI testing — for plugins that build UIs, use the orchestrator's build-loop-owned UI validation route (`ui-validator`, project-native tests, screenshots/static scanner). Dispatch IBR only when the user explicitly asks for IBR / Interface Built Right / `.ibr-test.json`.
80
+ - UI testing — for plugins that update, compare, or audit renderable UI designs, follow `../../references/ibr-ui-verification-policy.md`: IBR is primary when installed, with `ui-validator`, project-native tests, screenshots, and the static scanner as supporting/fallback evidence.
81
81
  - Performance / Lighthouse — separate concern, not a plugin metadata issue
82
82
  - Cross-plugin integration — that's the bridge skills' job at runtime
83
83
 
@@ -87,7 +87,7 @@ Don't migrate to pytest, vitest, or Playwright. The stdlib pattern keeps the har
87
87
  - `commands/test.md` — slash-command surface (`/build-loop:test`)
88
88
  - `scripts/collision_scan.py` — the static detector that `test_skill_resolution.py` wraps
89
89
  - `KNOWN-ISSUES.md` 2026-05-02 entry — testing survey across 13 projects that informed this design
90
- - `agents/ui-validator.md` and `skills/build-loop/phases/ui-validation.md` — default UI validation route. IBR's `.ibr-test.json` remains an explicit-only auxiliary format.
90
+ - `agents/ui-validator.md`, `skills/build-loop/phases/ui-validation.md`, and `references/ibr-ui-verification-policy.md` — default UI validation route. Authoring a new `.ibr-test.json` remains plan-authorized or explicit.
91
91
 
92
92
  ## History
93
93
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: recursive-retrospective
3
- description: Run a recursive-learning retrospective on an app/agent/plugin/build-loop project analyze build history, behavior, and current state to extract reusable learning objects and encode them into memory, agents, skills, plugins, evals, preflights, and approval gates. Use after a substantial build, when reviewing a project's trajectory, when deciding preserve/refine/redirect/reset, or when converting a session into durable system improvement. Discovery-first (observe behavior cluster patterns encode learning); RCA is one module, not the whole job.
3
+ description: Deliberate retrospective on one project's full trajectory decide preserve/refine/redirect/reset and encode lessons into memory, agents, skills, evals, and gates. Use when the user asks to review a project's history after a substantial build, or convert a session into durable improvement. Not for the automatic cross-run pattern scan (use `self-improve`).
4
4
  user-invocable: false
5
5
  ---
6
6
 
@@ -0,0 +1,17 @@
1
+ ---
2
+ name: repo-closeout
3
+ description: "Compatibility alias for Repository Maintenance. Use when an existing prompt or workflow invokes repo-closeout; route all repository structure, artifact, branch, worktree, sibling consolidation, and local-main maintenance work to repo-maintenance. Deprecated: prefer repo-maintenance for new work."
4
+ user-invocable: false
5
+ ---
6
+
7
+ # Repository Closeout Compatibility Alias
8
+
9
+ This identifier is retained for one release so existing prompts keep working.
10
+
11
+ Load and follow the canonical skill and its bundled resources:
12
+
13
+ ```text
14
+ ../repo-maintenance/SKILL.md
15
+ ```
16
+
17
+ Use `repo-maintenance` in new prompts, automation, documentation, and handoffs.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "Repository Maintenance (Legacy Alias)"
3
+ short_description: "Compatibility alias for repo maintenance"
4
+ default_prompt: "Use $build-loop:repo-closeout to route this request to the canonical Repository Maintenance workflow."
@@ -0,0 +1,179 @@
1
+ ---
2
+ name: repo-maintenance
3
+ description: "Audit and evolve repository structure — topology, module boundaries, artifact retention, branch/worktree hygiene, and open-source readiness. Use when the user asks how a repo should be structured, why it has duplicate source, wants generated artifacts cleaned, or wants a repo readied to open-source. Never pushes, deletes unique source, or rewrites history without explicit authorization."
4
+ user-invocable: false
5
+ ---
6
+
7
+ # Repository Maintenance
8
+
9
+ Optimize the repository for the product's real boundaries, then keep it recoverable as worktrees, builds, generated state, and branches evolve. Treat closeout as one phase of maintenance, not the whole workflow.
10
+
11
+ Resolve `REPO_MAINTENANCE_ROOT` to the directory containing this `SKILL.md` before running bundled scripts. Under Claude Code this is normally `${CLAUDE_PLUGIN_ROOT}/skills/repo-maintenance`; under Codex or another host, derive it from the loaded skill path.
12
+
13
+ ## Establish the product and repository contract
14
+
15
+ 1. Read applicable `AGENTS.md`, architecture, build, coordination, and document-lifecycle guidance.
16
+ 2. Check live coordination before editing shared files or refs. Treat notes as provenance, not code proof.
17
+ 3. Identify the product, shipped artifacts, consumers, release boundary, owners, and canonical build/test commands.
18
+ 4. Resolve the canonical Git root, local `main`, upstream, linked worktrees, and nested or sibling repositories.
19
+ 5. Run the read-only baseline:
20
+
21
+ ```bash
22
+ python3 "$REPO_MAINTENANCE_ROOT/scripts/audit_repo_maintenance.py" \
23
+ --repo "$PWD" --base main --json
24
+ ```
25
+
26
+ Read [references/safety-protocol.md](references/safety-protocol.md) before changing structure, refs, worktrees, stashes, or generated directories.
27
+
28
+ For repository-boundary, module, or folder-layout work, read [references/repository-taxonomy.md](references/repository-taxonomy.md). For application-specific, build-system, cache, or generated-layout work, read [references/stack-profiles.md](references/stack-profiles.md). When preparing a repository for open-source publication or external/paid distribution — personal-content and secret scrub, de-tracking internal artifacts, `.git` bloat and history-leak review, and distribution signing — read [references/pre-public-hygiene.md](references/pre-public-hygiene.md). Classify signals before recommending a target structure.
29
+
30
+ ## Classify the repository without forcing one label
31
+
32
+ 1. Record observed application, language, build-system, workspace, runtime, ownership, and release signals.
33
+ 2. Classify portfolio strategy, repository scope, composition, release coupling, runtime deployment, internal organization, and physical layout independently.
34
+ 3. Label heuristic results as inferred with confidence. Directory names and manifests are not product-boundary proof.
35
+ 4. Separate current state from target state and name the smallest transition that addresses measured cost.
36
+ 5. Preserve framework conventions unless changing them has a concrete product, ownership, security, release, build, or navigation benefit.
37
+
38
+ Do not flatten `workspace`, `product monorepo`, `service polyrepo`, and `orchestration repo` into one topology enum. They describe different dimensions. Do not treat agent configuration such as `.claude/` or `.codex/` as product architecture.
39
+
40
+ ## Decide the source of truth from product boundaries
41
+
42
+ Prefer one repository when a component:
43
+
44
+ - ships only with the parent product;
45
+ - changes and verifies in the same release gate;
46
+ - has no independent consumers, version, or ownership boundary;
47
+ - must stay code-identical to a bundled or generated artifact.
48
+
49
+ Keep a separate repository when it has an independent public contract, release cadence, consumers, operational boundary, or ownership/security boundary. Do not preserve a repository split merely because history started that way.
50
+
51
+ Compare a sibling source repository to its proposed in-tree prefix:
52
+
53
+ ```bash
54
+ python3 "$REPO_MAINTENANCE_ROOT/scripts/audit_repo_maintenance.py" \
55
+ --repo "$PWD" --base main \
56
+ --compare-repo /path/to/source-repo \
57
+ --compare-prefix path/inside/current/repo --json
58
+ ```
59
+
60
+ If the sibling head is already an ancestor of `main` and the in-tree prefix has since diverged, the usual disposition is `retire-sibling`, not another merge. Treat comparison output as source-tree evidence only; it is never sufficient retirement authorization. Audit sibling branches, worktrees, stashes, operations, and dirty paths separately before retirement. Preserve unique state under recovery refs.
61
+
62
+ ## Keep structure navigable without ceremonial refactors
63
+
64
+ - Give each shipped capability one canonical source and a thin stable public boundary.
65
+ - Organize internal files by capability or bounded context; use small, well-named modules behind the stable boundary.
66
+ - Keep generated, vendored, cached, and source-owned paths distinguishable.
67
+ - Verify that every generated or bundled artifact has one reproducible writer and a parity gate.
68
+ - Use revisit/churn and agent cost as structure signals. Do not claim that generic cleanup alone improves correctness.
69
+ - Require a concrete product, ownership, dependency, or verification reason for deep-module or repository-boundary changes.
70
+ - Split modules only when a boundary enforces a public contract, dependency direction, ownership/security rule, independent test/release, real reuse, or measured build benefit. Merge them back when scaffolding and coordinated edits dominate.
71
+
72
+ ## Control build and cache accumulation
73
+
74
+ Per-worktree or per-agent build roots are valid isolation. Accumulation without retention is repository hygiene debt. Inventory before deleting:
75
+
76
+ ```bash
77
+ python3 "$REPO_MAINTENANCE_ROOT/scripts/audit_repo_maintenance.py" \
78
+ --repo "$PWD" --base main --artifacts --stale-days 7 --json
79
+ ```
80
+
81
+ The recursive inventory finds matching roots below test modules, worktrees, and agent lanes while pruning descendants of an already-counted artifact root and dependency environments such as `node_modules` and Python virtual environments. It protects canonical top-level `build` and `build-rust` roots by default; use `--protect-artifact` for additional repo-specific roots. Use `--no-default-artifact-protection` only when the repository explicitly defines different canonical roots.
82
+
83
+ Classify each artifact root as `protected`, `active`, `release-artifact`, `recent-cache`, `cleanup-candidate`, or `review-tracked-or-unignored`. Treat `cleanup-candidate` as a stale ignored review candidate; the script does not prove reproducibility. A `release-artifact` contains a high-confidence distributable such as a DMG, package, archive, installer, mobile build, or an app bundle inside a distribution root and requires an explicit retain/archive/remove decision. Ordinary build products such as an `.app` inside an isolated build cache remain governed by cache retention. `active-missing-artifact` means a live process still references an artifact path that no longer exists; stop or reconcile that process before further deletion. Remove only reproducible, ignored, inactive artifacts within the user's authorized scope. Protect the coordinator/final build, active worktree builds, canonical dependency caches, and anything required for current verification.
84
+
85
+ Add a repository retention policy when isolation creates named build roots: naming convention, protected roots, active-process test, age threshold, cleanup owner, and the command that refreshes build-server metadata after pruning.
86
+
87
+ ## Structurally clean a polluted data store
88
+
89
+ The same discipline governs a polluted append-only data store — a log, telemetry corpus, cache, generated dataset, **or a documentation tree an agent writes into** — not just build artifacts. Removing bad records by matching known-bad content is whack-a-mole: it misses the next unknown pollutant and invites repeated "it's clean now" claims that are each wrong (observed: five marker-based passes on one telemetry log, each declared done, each missing more).
90
+
91
+ 1. **Derive one structural signal before deleting anything.** Separate polluted from legitimate by *shape*, not content: a provenance field, an impossible/out-of-registry value, or a context field legitimate data never carries (a `tmp*` temp-dir path, a test-harness cwd, a missing "written by the real path" stamp). A content denylist is acceptable only for a one-time sweep of *known-historical* strings, never as the permanent detector.
92
+ 2. **Classify every record, then prove completeness by re-scan.** Cleanup is done when a full re-scan returns zero suspects — never when the known-bad rows are gone. Eyeballing the tail is how residue survives.
93
+ 3. **Move, never delete.** Quarantine suspects to a sibling archive (`*.quarantined.*`) plus one full pre-clean snapshot, so every removed record is recoverable.
94
+ 4. **Fix the writer, not just the data.** Re-pollution recurs until the source is closed. Add a provenance invariant — *only the production path may write here* (e.g. a live-hook flag; test/ad-hoc writers are suppressed) — and an integrity gate that fails loudly at the earliest boundary (pre-commit/CI) so a regression is caught the next commit, not weeks later. Pair it with an analysis-time quarantine so a consumer never silently computes on corrupted data.
95
+ 5. **Never report the store "clean" while any record is unclassified** — the same rule as unclassified repo state below.
96
+
97
+ **A documentation tree is one of these stores.** The word "data" reads as logs and
98
+ telemetry, so a `docs/` tree full of agent-written plans, RCAs, retrospectives, and
99
+ session handoffs does not look like a polluted store on a careful read — and that
100
+ misread is exactly how one survives. Apply the test by shape, not by name: *does an
101
+ automated writer append here faster than a human curates it?* If yes, it is this
102
+ kind of store, and step 4 binds.
103
+
104
+ Worked case (build-loop, 2026-08-28): a documentation-boundary audit found 122 of 716
105
+ tracked documents were private working material in a public tree. Draining them was
106
+ proposed as a file-archiving pass. But `skills/spec-writing/SKILL.md` instructed every
107
+ run to write its plan into `docs/plans/` and commit it, so 13 of the 122 regenerated on
108
+ the next run. **The archiving pass would have made room, not progress.** Closing the
109
+ writer — plans now go to the gitignored `.build-loop/plans/` — was the step that had to
110
+ come first; `scripts/doc_boundary.py` is the integrity gate that catches a regression at
111
+ the next commit.
112
+
113
+ ## Evolve work safely
114
+
115
+ 1. Use an isolated worktree for material changes when shared-checkout collision is possible.
116
+ 2. Map the change to its capability boundary and enumerate cross-repo consumers before changing contracts or paths.
117
+ 3. Run the narrow verifier during implementation and the canonical verifier on the final integration tip.
118
+ 4. Regenerate bundled outputs only from canonical source; verify code or artifact parity afterward.
119
+ 5. Collapse completed work back to one protected local `main`; remove temporary worktrees and branches only after ancestry or patch-equivalence proof.
120
+
121
+ ## Close completed local work
122
+
123
+ Give every worktree, branch, stash, dirty path set, sibling source, and artifact root exactly one disposition:
124
+
125
+ - `integrate` — unique completed work with review and verification.
126
+ - `redundant` — ancestor of `main` or proven patch-equivalent.
127
+ - `retire-sibling` — imported source whose in-tree canonical copy has evolved.
128
+ - `cleanup-candidate` — reproducible, ignored, inactive generated state past retention.
129
+ - `release-artifact` — distributable output requiring an explicit retain, archive, or remove decision.
130
+ - `active-missing-artifact` — a live process references a removed artifact root; reconcile the process before cleanup.
131
+ - `preserve-only` — incomplete, unrelated, user-owned, or historical material.
132
+ - `blocked` — active ownership, failed verification, conflicts, or unclear provenance.
133
+
134
+ Before mutation, create dated annotated recovery tags for pre-integration `main`, every branch head, and every stash commit under `archive/pre-closeout-YYYY-MM-DD/`. Preserve dirty state including untracked files. Prefer fast-forward integration; re-run the canonical verifier on exact final `main` after the last mutation.
135
+
136
+ ### Grade the base, not the test result
137
+
138
+ Before assigning `integrate` to any branch, score it. A passing suite describes the branch **at its own base**, and says nothing about merging into today's `main`:
139
+
140
+ ```bash
141
+ python3 "${CLAUDE_PLUGIN_ROOT:-.}/scripts/merge_risk.py" --branch <b> --target main \
142
+ --evidence "test suite=pass" --evidence-time <ISO8601 when the suite ran> --json
143
+ # or sweep every local branch, risk-first:
144
+ python3 "${CLAUDE_PLUGIN_ROOT:-.}/scripts/merge_risk.py" --all-branches --json
145
+ ```
146
+
147
+ The load-bearing field is `contested_files` — files the branch changed that `main` **also** changed since the merge-base. When that set is non-empty, `evidence_valid_against_target` is `false` and the verdict is `stale_base_evidence_invalid` (`risk: high`, exit 1). Green evidence supplied alongside contested files makes the verdict more alarming, not less; the script records `evidence_ignored_reason: "produced_at_stale_base"` rather than letting a pass downgrade the risk.
148
+
149
+ Verdicts, in priority order:
150
+
151
+ | Verdict | Risk | Exit | Meaning |
152
+ |---|---|---|---|
153
+ | `stale_base_evidence_invalid` | high | 1 | Contested files — the evidence describes a base that no longer reflects target |
154
+ | `evidence_failing` | high | 1 | Supplied evidence says `fail`; a failure is not ignorable either |
155
+ | `conflict_likely` | high | 1 | `git merge-tree` predicts conflicts |
156
+ | `behind_but_disjoint` | medium | 0 (`--strict`: 1) | Target moved, but not on files this branch touched |
157
+ | `conflict_probe_unavailable` | medium | 1 (`--allow-unprobed`: 0) | The conflict probe could not run — an unobserved probe is not a pass |
158
+ | `mergeable_evidence_current` | low | 0 | Base current, evidence current and passing |
159
+
160
+ `predicted_conflicts` is `null`, never `0`, when the probe is unavailable — and the VERDICT respects that too, not just the field. Both are needed: `None` is falsy in Python, so a scorer that branches on truthiness alone treats "no conflicts" and "never checked" identically and reports the second as mergeable. The script is read-only: no merge, rebase, checkout, or ref write.
161
+
162
+ `stale_base_evidence_invalid` maps to `blocked`, not `integrate`. Rebase or re-verify against current `main` first, then re-score.
163
+
164
+ Observed 2026-08-07: branch `bl/run-938939` passed `cargo build`, `cargo test`, and a Python↔Rust parity suite 5288/5288 — at a base of 2026-07-30, while `main` had since changed those same files twice. A scorer reading "tests pass" as low-risk would have auto-merged it. The rebase produced 5 conflict hunks, and the branch side did not compile against `main` (`E0609`, `E0599`).
165
+
166
+ Clean in dependency order: auxiliary worktrees, contained branches, patch-equivalent branches with recovery proof, archived stashes, stale worktree metadata, then authorized generated artifacts. Never use `git reset --hard` or force-delete unique state as cleanup.
167
+
168
+ ## Report distinct truths
169
+
170
+ Lead with the disposition, then state:
171
+
172
+ 1. canonical source and repository-boundary decision;
173
+ 2. final local `main` commit and verifier evidence;
174
+ 3. worktrees, branches, stashes, sibling repos, and artifacts integrated, retained, or removed;
175
+ 4. recovery namespace and residual risks;
176
+ 5. local-versus-upstream divergence;
177
+ 6. committed, merged locally, pushed, deployed, and runtime-tested status separately.
178
+
179
+ Do not report “merged” for work that exists only on another branch. Do not report “clean” while unique sibling, stash, dirty, or generated state remains unclassified.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "Repository Maintenance"
3
+ short_description: "Audit repo architecture, artifacts, and closeout"
4
+ default_prompt: "Use $build-loop:repo-maintenance to classify the application and build profile, audit repository structure and artifacts, and close completed local work safely."
@@ -0,0 +1,134 @@
1
+ # Pre-Public / Distribution Hygiene
2
+
3
+ Load this phase when a repo is being prepared for **open-source publication or
4
+ paid/external distribution** (any transition from private/solo to external
5
+ consumers). It layers on top of the normal maintenance lifecycle: run the
6
+ artifact/worktree/branch/local-main phases first, then this.
7
+
8
+ The governing question shifts from *"is this repo well-structured?"* to *"is it
9
+ safe and reproducible in a stranger's hands, and does its history leak anything?"*
10
+
11
+ Always read [safety-protocol.md](safety-protocol.md) first. History rewrite and
12
+ force-push are irreversible and gated on explicit authorization.
13
+
14
+ ## 1. Personal content & secrets in the working tree (SAFE)
15
+
16
+ Scan tracked files — never the whole checkout (build caches produce noise):
17
+
18
+ ```bash
19
+ git grep -nI -e '/Users/' -e '/home/' -e "$(whoami)" \
20
+ -e '[A-Za-z0-9._%+-]\+@[A-Za-z0-9.-]\+\.[A-Za-z]\{2,\}' # emails
21
+ git grep -nIE '(api[_-]?key|secret|token|password|BEGIN (RSA|EC|OPENSSH) PRIVATE KEY|ghp_[A-Za-z0-9]{36}|sk-[A-Za-z0-9]{20,}|AKIA[0-9A-Z]{16})'
22
+ ```
23
+
24
+ Then **separate leaks from intentional publisher identity** — the second set stays:
25
+
26
+ | Leave (identity) | Fix (leak) |
27
+ |---|---|
28
+ | SPDX copyright headers (author name/email) | Absolute home paths (`/Users/<you>/…` → `~/…` or `<repo-root>`) |
29
+ | `github.com/<owner>/…` project URLs | Real home paths / usernames in **test fixtures** (violates no-personal-content-in-fixtures) |
30
+ | `com.<owner>.*` bundle IDs / reverse-DNS | Personal machine paths in code **comments** / dead references |
31
+ | Team ID / signing identity in a *distribution* config | Local `file://…` paths in code defaults → repoint to the public URL |
32
+
33
+ Code defaults carrying a home path (e.g. a serialized source-pin URL) may be
34
+ **behavior-safe to change** — trace whether the value is dereferenced or is pure
35
+ metadata, and re-run the test that asserts it. Fix, then re-run the owning test.
36
+
37
+ ## 2. Documentation audience — what may be public at all (SAFE)
38
+
39
+ De-tracking tool state is mechanical; deciding whether a *document* may ship is a
40
+ policy call. The policy is
41
+ [public-repository-documentation-boundary.md](../../../references/public-repository-documentation-boundary.md)
42
+ at the plugin root — §2 is the allow-list, §3 the deny-list, §4 the
43
+ archive-before-removal rule. Read it before keeping or removing any doc. It binds
44
+ public repositories only: a private repo may retain both product documentation and
45
+ internal development records.
46
+
47
+ Grade the tree before arguing about it:
48
+
49
+ ```bash
50
+ python3 <build-loop>/scripts/doc_boundary.py --repo . --json
51
+ ```
52
+
53
+ The classifier reports the policy's own four buckets — `public_current`,
54
+ `private_archived`, `public_removed`, `blocked` — with a `confidence` and the
55
+ matched signal per file. A filename only *seeds* a verdict (policy §3: "Naming is
56
+ evidence, not the decision"); where only the content resolves the audience it
57
+ returns `needs_review` rather than guessing, and those are the ones you read. Exit
58
+ 1 means decided findings; a private or unresolved-visibility repo is reported,
59
+ never failed.
60
+
61
+ Nothing leaves public tracking until the private copy carries a `build-loop-memory`
62
+ receipt (policy §4). Then ignore the artifact **class**, not the file — the
63
+ agent-rally-point `.gitignore` block (`docs/plans/`, `docs/*RCA*.md`,
64
+ `docs/*ASSESSMENT*.md`, `/BACKLOG.md`, `/LESSONS.md`, …) is the worked example — so
65
+ the next agent cannot reintroduce it.
66
+
67
+ ## 3. De-track internal artifacts (SAFE — files stay on disk)
68
+
69
+ `git rm -r --cached` (never delete from disk) + gitignore, for content that
70
+ should not ship publicly:
71
+
72
+ - Tool state: `.navgator/`, `.build-loop/`, `.claude/` scratch, editor/project
73
+ generated dirs — tool artifacts, not source.
74
+ - Captured test evidence / scan dumps (screenshots, AX JSON, e2e logs) — usually
75
+ the *bulk* of leaked personal paths; de-track wholesale beats sanitizing each.
76
+ - **`archive/*.bundle` / history bundles** — a committed git bundle leaks the
77
+ *entire* pre-sanitization history even after a tree scrub. Always de-track.
78
+ - Committed build outputs / vendored binaries → build-from-source instead
79
+ (see stack-profiles.md); a committed binary can drift from or be tampered
80
+ against its source.
81
+
82
+ ## 4. `.git` size: gc BEFORE deciding on a rewrite (SAFE gc / GATED rewrite)
83
+
84
+ Loose-object bloat is usually reclaimable with **no history change**:
85
+
86
+ ```bash
87
+ git count-objects -vH # if `size` (loose) >> `size-pack`, gc wins big
88
+ git gc --prune=2.weeks.ago # grace window keeps recent dangling objects
89
+ ```
90
+
91
+ Only *after* gc, assess whether the remaining pack justifies a history rewrite.
92
+ The stronger argument for a rewrite is usually **privacy** (history still holds
93
+ every personal path/secret ever committed), not size.
94
+
95
+ **Rewrite is GATED — never silent.** Prefer the lowest-risk option:
96
+
97
+ 1. **Fresh-cut public repo** (recommended default): publish a new repo whose root
98
+ is a squash/graft at the sanitized commit. Zero rewrite risk to the private
99
+ repo; clean public history. Best when private history need not travel.
100
+ 2. **`git filter-repo --invert-paths`** on the private repo only when history
101
+ must be preserved public. Before running: `git bundle create ../backup.bundle
102
+ --all` + verify; check whether local `main` is **ahead of `origin`** (a botched
103
+ rewrite with no pushed backup loses unpushed work); every SHA changes and all
104
+ clones/cross-references break. Requires explicit user confirmation.
105
+
106
+ ## 5. Distribution signing / notarization (GATED — needs a credential)
107
+
108
+ Dev builds commonly ship ad-hoc (`CODE_SIGN_IDENTITY="-"`). A distributed build
109
+ needs a real signing identity the maintainer holds — document the runbook, do not
110
+ automate cert install (never touch the login keychain automatically):
111
+
112
+ - Enroll / verify the platform developer program; create the distribution cert
113
+ in the keychain (manual user step).
114
+ - Add signing identity + team to a **distribution config variant**, keeping the
115
+ ad-hoc identity as the dev default.
116
+ - Sign nested binaries (daemons/helpers) with hardened runtime + timestamp →
117
+ submit to the notary service → staple → verify (`spctl -a -vv` on macOS).
118
+
119
+ ## Execution order & tiers
120
+
121
+ 1. **SAFE, now:** gc → grade the docs tree against the boundary policy
122
+ (`doc_boundary.py`) and read every `needs_review` → archive-with-receipt, then
123
+ de-track internal artifacts → de-personalize tracked files
124
+ (fixtures/comments/docs/code-default URLs), each code change re-verified by its
125
+ owning test.
126
+ 2. **GATED:** history-rewrite decision (recommend fresh-cut) — decide only after
127
+ gc; requires confirmation and a backup bundle.
128
+ 3. **DEFER to credential:** write the signing/notarization runbook now; execute
129
+ when the maintainer has the cert in hand.
130
+
131
+ Report the boundary review in the policy's own vocabulary (`public_current` /
132
+ `private_archived` / `public_removed` / `blocked`), then what was de-tracked
133
+ (counts), reclaimed size, residual identity strings intentionally kept, and the
134
+ gated items awaiting a decision.
@@ -0,0 +1,161 @@
1
+ # Repository Taxonomy and Module Boundaries
2
+
3
+ Use this reference when classifying a repository, choosing Git boundaries, changing modules, or evaluating a proposed folder tree. This is a working decision taxonomy, not an industry-standard list of mutually exclusive repository types.
4
+
5
+ ## Contents
6
+
7
+ 1. Classification model
8
+ 2. Mapping common topology labels
9
+ 3. Repository-boundary decision
10
+ 4. Internal organization patterns
11
+ 5. Module-boundary decision
12
+ 6. Evolution and validation
13
+ 7. Output contract
14
+
15
+ ## 1. Classification model
16
+
17
+ Classify each axis independently. A repository can be a product-scoped monorepo, use several language workspaces, contain a modular monolith plus a daemon, and release some packages independently. One label cannot express all of that.
18
+
19
+ | Axis | Values | Question answered |
20
+ | --- | --- | --- |
21
+ | Portfolio strategy | `monorepo`, `polyrepo`, `hybrid` | How is source divided across Git repositories? |
22
+ | Repository scope | `single-component`, `product`, `organization`, `integration-orchestration` | What product or coordination boundary does this repository own? |
23
+ | Composition | `single-package`, `workspace`, `multi-app`, `multi-service`, `package-family`, `mixed` | What independently buildable units are coordinated inside the repository? |
24
+ | Release coupling | `coordinated`, `independent`, `mixed` | Which units version and ship together? |
25
+ | Runtime deployment | `single-deployable`, `modular-monolith`, `multiple-deployables`, `library-package`, `mixed` | What executes or distributes independently? |
26
+ | Internal organization | `technical-layer`, `feature-first`, `domain-oriented`, `layered-feature`, `package-module`, `deployable-first`, `hybrid` | What is the primary grouping dimension inside a unit? |
27
+ | Ownership and risk | team owners, security boundaries, compliance boundaries | Who can change what, and which boundaries must be enforced? |
28
+ | Physical layout | stack-specific paths | How do the selected build systems express these decisions on disk? |
29
+
30
+ Do not infer portfolio strategy from a workspace manifest. Cargo, Gradle, SwiftPM, pnpm, and similar workspaces coordinate packages within a checkout; they do not decide whether the organization uses a monorepo or polyrepo.
31
+
32
+ ## 2. Mapping common topology labels
33
+
34
+ Use familiar labels as shorthand, then expand them into the independent axes above.
35
+
36
+ | Common label | Normalized meaning |
37
+ | --- | --- |
38
+ | Single-project repo | Usually `single-component` scope plus `single-package` composition; may still contain several targets. |
39
+ | Workspace repo | A `workspace` composition signal. Portfolio strategy and repository scope remain undecided. |
40
+ | Product monorepo | `monorepo` portfolio plus `product` scope; composition may be multi-app, multi-service, package-family, or mixed. |
41
+ | Organization monorepo | `monorepo` portfolio plus `organization` scope. Requires strong tooling and ownership controls. |
42
+ | Service-per-repo | Usually `polyrepo` portfolio, service-sized scope, and independent releases. |
43
+ | Package-per-repo | Usually `polyrepo` portfolio, library-package deployment, and independent versioning. |
44
+ | Hybrid portfolio | `hybrid` portfolio; record the rule that determines which units share a repo. |
45
+ | Meta/orchestration repo | `integration-orchestration` scope; source of truth should remain in the repositories it coordinates unless explicitly vendored or generated. |
46
+
47
+ These are useful recurring shapes, not eight values on one axis.
48
+
49
+ ## 3. Repository-boundary decision
50
+
51
+ Start with the product and release boundary, not the current folder tree.
52
+
53
+ Prefer one repository when most of these are true:
54
+
55
+ - units normally change in one user-visible feature or compatibility transaction;
56
+ - the same integration gate is required before release;
57
+ - releases are coordinated and there is no external compatibility promise;
58
+ - one owner and security boundary controls the units;
59
+ - consumers are internal to the same product;
60
+ - atomic changes reduce integration risk more than repository size increases tooling cost.
61
+
62
+ Prefer separate repositories when one or more strong boundaries exist:
63
+
64
+ - independent public contract and semantic versioning;
65
+ - independent external consumers or distribution channel;
66
+ - independent release, availability, security, compliance, or ownership boundary;
67
+ - access control cannot be expressed safely inside one repository;
68
+ - checkout, history, or CI cost remains materially high after ordinary optimization;
69
+ - the unit must evolve without coordinating with the parent product.
70
+
71
+ Use evidence, not repository count aesthetics. Record:
72
+
73
+ 1. product and consumers;
74
+ 2. change coupling from recent history;
75
+ 3. release and compatibility coupling;
76
+ 4. build and test fan-out;
77
+ 5. ownership, access, and operational boundaries;
78
+ 6. migration cost and recovery plan.
79
+
80
+ Monorepo does not mean monolith. Polyrepo does not mean microservices. Repository placement, module boundaries, and runtime deployment are separate decisions.
81
+
82
+ ## 4. Internal organization patterns
83
+
84
+ Choose one primary grouping dimension at each level. Hybrid structures are valid when the transition point is explicit.
85
+
86
+ | Pattern | Best fit | Main risk |
87
+ | --- | --- | --- |
88
+ | Technical-layer | Small, stable applications where flow across UI/domain/data remains easy to trace | Feature changes fan out across distant directories. |
89
+ | Feature-first | Product applications with independently evolving user capabilities | Shared code can become an unowned junk drawer. |
90
+ | Domain-oriented | Complex business rules and durable bounded contexts | Domain ceremony can exceed product complexity. |
91
+ | Layered-feature | Feature ownership with internal UI/domain/data separation | Repeated scaffolding and inconsistent local layers. |
92
+ | Package-module | Enforceable compile, visibility, ownership, or reuse boundaries | Too many modules increase configuration and build-graph overhead. |
93
+ | Deployable-first | Multiple services, workers, apps, or independently operated runtimes | Shared packages can couple deployables invisibly. |
94
+ | Hybrid | Products with genuinely different scales or runtime shapes | Ambiguous transition rules make navigation unpredictable. |
95
+
96
+ For a hybrid, state the rule, for example: `apps/` and `services/` are deployable-first; each deployable is feature-first; reusable contracts live under `packages/`.
97
+
98
+ ## 5. Module-boundary decision
99
+
100
+ Create or retain a module when it provides at least one enforceable benefit:
101
+
102
+ - an independently testable capability or volatile implementation is hidden behind a stable interface;
103
+ - compile-time visibility or dependency direction needs enforcement;
104
+ - ownership or security responsibility differs;
105
+ - reuse is real and already has more than one consumer;
106
+ - change history shows cohesive files repeatedly moving together;
107
+ - independent build caching or release behavior measurably reduces cost.
108
+
109
+ Consolidate modules when configuration, adapters, and boilerplate dominate the capability; boundaries are routinely bypassed; most changes require coordinated edits across them; or no independent consumer, owner, test, or release exists.
110
+
111
+ For every proposed module, record:
112
+
113
+ ```text
114
+ Capability:
115
+ Public contract:
116
+ Hidden decision:
117
+ Consumers:
118
+ Owner:
119
+ Allowed dependencies:
120
+ Verification gate:
121
+ Split trigger:
122
+ Merge-back trigger:
123
+ ```
124
+
125
+ Agent/configuration overlays such as `.claude/`, `.codex/`, or repository-local skills may improve how tools operate on the repository. They are not product modules and must not substitute for runtime architecture, package boundaries, or product documentation.
126
+
127
+ ## 6. Evolution and validation
128
+
129
+ Treat structure as a hypothesis. Prefer the smallest reversible transition that addresses observed cost.
130
+
131
+ Split a package, module, or repository when measured evidence shows growing independent ownership, release, security, consumer, or build boundaries. Merge or flatten when the proposed boundary has no enforceable contract and increases navigation or change fan-out.
132
+
133
+ Validate a structural change with:
134
+
135
+ - the canonical build and targeted tests;
136
+ - dependency-direction or visibility checks;
137
+ - change fan-out on representative recent features;
138
+ - navigation cost: files and manifests needed to understand or edit one capability;
139
+ - generated/bundled artifact parity;
140
+ - release and rollback procedure;
141
+ - checkout, CI, or build metrics when performance was the reason for change.
142
+
143
+ Do not claim correctness improvement from tidiness alone. Cleaner module shape can reduce navigation and maintenance cost; correctness still requires behavior-specific verification.
144
+
145
+ ## 7. Output contract
146
+
147
+ Separate three truth levels:
148
+
149
+ - **Observed** — manifests, paths, Git history, dependency edges, owners, build commands, and releases directly inspected.
150
+ - **Inferred** — likely classification with evidence and confidence; never present a filename heuristic as architectural fact.
151
+ - **Decided** — current or target structure chosen by the product owner, with rationale, migration, and validation gates.
152
+
153
+ Report all applicable axes, the current and target state, the smallest transition, rejected alternatives, and the evidence that would reverse the decision.
154
+
155
+ ## Source basis
156
+
157
+ - Cargo workspaces coordinate related packages through a shared lockfile and target directory: https://doc.rust-lang.org/book/ch14-03-cargo-workspaces.html
158
+ - Android's modularization guide describes benefits and warns about both overly fine and overly coarse granularity: https://developer.android.com/topic/modularization
159
+ - GitHub documents repository size, width, depth, branch, and activity limits as operational constraints: https://docs.github.com/en/repositories/creating-and-managing-repositories/repository-limits
160
+ - Research on multi-repository microservice architecture reconstruction documents the difficulty of maintaining accurate architecture across independently evolving services: https://arxiv.org/abs/2602.08166
161
+ - A systematic grey-literature review describes modular monoliths as an alternative to, and possible transition point toward, microservices: https://arxiv.org/abs/2401.11867