@tyroneross/build-loop 0.30.3

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 (389) hide show
  1. package/.agents/plugins/marketplace.json +10 -0
  2. package/.claude-plugin/marketplace.json +38 -0
  3. package/.claude-plugin/plugin.json +30 -0
  4. package/.codex-plugin/plugin.json +41 -0
  5. package/.cursor/rules/build-loop-surface.mdc +22 -0
  6. package/AGENTS.md +498 -0
  7. package/LICENSE +202 -0
  8. package/README.md +403 -0
  9. package/agents/alignment-checker.md +124 -0
  10. package/agents/api-assessor.md +136 -0
  11. package/agents/architecture-scout.md +185 -0
  12. package/agents/assessment-orchestrator.md +163 -0
  13. package/agents/build-orchestrator.md +198 -0
  14. package/agents/database-assessor.md +133 -0
  15. package/agents/design-contract-specialist.md +239 -0
  16. package/agents/fact-checker.md +69 -0
  17. package/agents/fix-critique.md +161 -0
  18. package/agents/frontend-assessor.md +136 -0
  19. package/agents/implementer.md +185 -0
  20. package/agents/independent-auditor.md +143 -0
  21. package/agents/mock-scanner.md +78 -0
  22. package/agents/optimize-runner.md +112 -0
  23. package/agents/overfitting-reviewer.md +96 -0
  24. package/agents/performance-assessor.md +159 -0
  25. package/agents/plan-critic.md +85 -0
  26. package/agents/promotion-reviewer.md +121 -0
  27. package/agents/recurring-pattern-detector.md +248 -0
  28. package/agents/retrospective-synthesizer.md +109 -0
  29. package/agents/root-cause-investigator.md +285 -0
  30. package/agents/scope-auditor.md +121 -0
  31. package/agents/security-reviewer.md +151 -0
  32. package/agents/self-improvement-architect.md +125 -0
  33. package/agents/synthesis-critic.md +99 -0
  34. package/agents/transcript-pattern-miner.md +165 -0
  35. package/agents/ui-validator.md +193 -0
  36. package/codex-skills/build-loop/SKILL.md +20 -0
  37. package/codex-skills/debug-loop/SKILL.md +18 -0
  38. package/codex-skills/handoff/SKILL.md +22 -0
  39. package/codex-skills/knowledge/SKILL.md +21 -0
  40. package/codex-skills/optimize/SKILL.md +18 -0
  41. package/codex-skills/research/SKILL.md +18 -0
  42. package/commands/agent-rally-point.md +301 -0
  43. package/commands/assess.md +41 -0
  44. package/commands/debug.md +20 -0
  45. package/commands/debugger-detail.md +34 -0
  46. package/commands/debugger-scan.md +15 -0
  47. package/commands/debugger-status.md +20 -0
  48. package/commands/debugger.md +32 -0
  49. package/commands/handoff.md +113 -0
  50. package/commands/knowledge-review.md +16 -0
  51. package/commands/optimize.md +31 -0
  52. package/commands/plan-verify.md +39 -0
  53. package/commands/promote-experiment.md +129 -0
  54. package/commands/research.md +22 -0
  55. package/commands/run.md +12 -0
  56. package/commands/self-review.md +51 -0
  57. package/commands/start-prd.md +57 -0
  58. package/commands/test.md +34 -0
  59. package/dist/src/assessment-orchestrator.d.ts +78 -0
  60. package/dist/src/assessment-orchestrator.d.ts.map +1 -0
  61. package/dist/src/assessment-orchestrator.js +304 -0
  62. package/dist/src/assessment-orchestrator.js.map +1 -0
  63. package/dist/src/audit-miner.d.ts +21 -0
  64. package/dist/src/audit-miner.d.ts.map +1 -0
  65. package/dist/src/audit-miner.js +421 -0
  66. package/dist/src/audit-miner.js.map +1 -0
  67. package/dist/src/batch-operations.d.ts +30 -0
  68. package/dist/src/batch-operations.d.ts.map +1 -0
  69. package/dist/src/batch-operations.js +339 -0
  70. package/dist/src/batch-operations.js.map +1 -0
  71. package/dist/src/config.d.ts +83 -0
  72. package/dist/src/config.d.ts.map +1 -0
  73. package/dist/src/config.js +176 -0
  74. package/dist/src/config.js.map +1 -0
  75. package/dist/src/context-engine.d.ts +45 -0
  76. package/dist/src/context-engine.d.ts.map +1 -0
  77. package/dist/src/context-engine.js +135 -0
  78. package/dist/src/context-engine.js.map +1 -0
  79. package/dist/src/debug-wrapper.d.ts +58 -0
  80. package/dist/src/debug-wrapper.d.ts.map +1 -0
  81. package/dist/src/debug-wrapper.js +285 -0
  82. package/dist/src/debug-wrapper.js.map +1 -0
  83. package/dist/src/index.d.ts +31 -0
  84. package/dist/src/index.d.ts.map +1 -0
  85. package/dist/src/index.js +149 -0
  86. package/dist/src/index.js.map +1 -0
  87. package/dist/src/interactive-verifier.d.ts +26 -0
  88. package/dist/src/interactive-verifier.d.ts.map +1 -0
  89. package/dist/src/interactive-verifier.js +435 -0
  90. package/dist/src/interactive-verifier.js.map +1 -0
  91. package/dist/src/lessons.d.ts +59 -0
  92. package/dist/src/lessons.d.ts.map +1 -0
  93. package/dist/src/lessons.js +172 -0
  94. package/dist/src/lessons.js.map +1 -0
  95. package/dist/src/log-reader.d.ts +39 -0
  96. package/dist/src/log-reader.d.ts.map +1 -0
  97. package/dist/src/log-reader.js +291 -0
  98. package/dist/src/log-reader.js.map +1 -0
  99. package/dist/src/logger.d.ts +59 -0
  100. package/dist/src/logger.d.ts.map +1 -0
  101. package/dist/src/logger.js +328 -0
  102. package/dist/src/logger.js.map +1 -0
  103. package/dist/src/parallel-retrieval.d.ts +52 -0
  104. package/dist/src/parallel-retrieval.d.ts.map +1 -0
  105. package/dist/src/parallel-retrieval.js +309 -0
  106. package/dist/src/parallel-retrieval.js.map +1 -0
  107. package/dist/src/pattern-extractor.d.ts +30 -0
  108. package/dist/src/pattern-extractor.d.ts.map +1 -0
  109. package/dist/src/pattern-extractor.js +386 -0
  110. package/dist/src/pattern-extractor.js.map +1 -0
  111. package/dist/src/result-aggregator.d.ts +44 -0
  112. package/dist/src/result-aggregator.d.ts.map +1 -0
  113. package/dist/src/result-aggregator.js +315 -0
  114. package/dist/src/result-aggregator.js.map +1 -0
  115. package/dist/src/retrieval.d.ts +139 -0
  116. package/dist/src/retrieval.d.ts.map +1 -0
  117. package/dist/src/retrieval.js +724 -0
  118. package/dist/src/retrieval.js.map +1 -0
  119. package/dist/src/setup/auto-setup.d.ts +15 -0
  120. package/dist/src/setup/auto-setup.d.ts.map +1 -0
  121. package/dist/src/setup/auto-setup.js +157 -0
  122. package/dist/src/setup/auto-setup.js.map +1 -0
  123. package/dist/src/setup/configure-hooks.d.ts +8 -0
  124. package/dist/src/setup/configure-hooks.d.ts.map +1 -0
  125. package/dist/src/setup/configure-hooks.js +16 -0
  126. package/dist/src/setup/configure-hooks.js.map +1 -0
  127. package/dist/src/setup/create-slash-commands.d.ts +8 -0
  128. package/dist/src/setup/create-slash-commands.d.ts.map +1 -0
  129. package/dist/src/setup/create-slash-commands.js +101 -0
  130. package/dist/src/setup/create-slash-commands.js.map +1 -0
  131. package/dist/src/setup/index.d.ts +8 -0
  132. package/dist/src/setup/index.d.ts.map +1 -0
  133. package/dist/src/setup/index.js +17 -0
  134. package/dist/src/setup/index.js.map +1 -0
  135. package/dist/src/setup/inject-claude-md.d.ts +10 -0
  136. package/dist/src/setup/inject-claude-md.d.ts.map +1 -0
  137. package/dist/src/setup/inject-claude-md.js +150 -0
  138. package/dist/src/setup/inject-claude-md.js.map +1 -0
  139. package/dist/src/setup/uninstall.d.ts +22 -0
  140. package/dist/src/setup/uninstall.d.ts.map +1 -0
  141. package/dist/src/setup/uninstall.js +235 -0
  142. package/dist/src/setup/uninstall.js.map +1 -0
  143. package/dist/src/storage.d.ts +192 -0
  144. package/dist/src/storage.d.ts.map +1 -0
  145. package/dist/src/storage.js +1037 -0
  146. package/dist/src/storage.js.map +1 -0
  147. package/dist/src/string-similarity.d.ts +8 -0
  148. package/dist/src/string-similarity.d.ts.map +1 -0
  149. package/dist/src/string-similarity.js +57 -0
  150. package/dist/src/string-similarity.js.map +1 -0
  151. package/dist/src/traces/adapters/browser.d.ts +69 -0
  152. package/dist/src/traces/adapters/browser.d.ts.map +1 -0
  153. package/dist/src/traces/adapters/browser.js +280 -0
  154. package/dist/src/traces/adapters/browser.js.map +1 -0
  155. package/dist/src/traces/adapters/index.d.ts +23 -0
  156. package/dist/src/traces/adapters/index.d.ts.map +1 -0
  157. package/dist/src/traces/adapters/index.js +67 -0
  158. package/dist/src/traces/adapters/index.js.map +1 -0
  159. package/dist/src/traces/adapters/langchain.d.ts +42 -0
  160. package/dist/src/traces/adapters/langchain.d.ts.map +1 -0
  161. package/dist/src/traces/adapters/langchain.js +151 -0
  162. package/dist/src/traces/adapters/langchain.js.map +1 -0
  163. package/dist/src/traces/adapters/opentelemetry.d.ts +46 -0
  164. package/dist/src/traces/adapters/opentelemetry.d.ts.map +1 -0
  165. package/dist/src/traces/adapters/opentelemetry.js +164 -0
  166. package/dist/src/traces/adapters/opentelemetry.js.map +1 -0
  167. package/dist/src/traces/adapters/sentry.d.ts +58 -0
  168. package/dist/src/traces/adapters/sentry.d.ts.map +1 -0
  169. package/dist/src/traces/adapters/sentry.js +212 -0
  170. package/dist/src/traces/adapters/sentry.js.map +1 -0
  171. package/dist/src/traces/index.d.ts +10 -0
  172. package/dist/src/traces/index.d.ts.map +1 -0
  173. package/dist/src/traces/index.js +45 -0
  174. package/dist/src/traces/index.js.map +1 -0
  175. package/dist/src/traces/storage.d.ts +78 -0
  176. package/dist/src/traces/storage.d.ts.map +1 -0
  177. package/dist/src/traces/storage.js +399 -0
  178. package/dist/src/traces/storage.js.map +1 -0
  179. package/dist/src/traces/summarizer.d.ts +83 -0
  180. package/dist/src/traces/summarizer.d.ts.map +1 -0
  181. package/dist/src/traces/summarizer.js +247 -0
  182. package/dist/src/traces/summarizer.js.map +1 -0
  183. package/dist/src/traces/types.d.ts +365 -0
  184. package/dist/src/traces/types.d.ts.map +1 -0
  185. package/dist/src/traces/types.js +14 -0
  186. package/dist/src/traces/types.js.map +1 -0
  187. package/dist/src/types.d.ts +495 -0
  188. package/dist/src/types.d.ts.map +1 -0
  189. package/dist/src/types.js +27 -0
  190. package/dist/src/types.js.map +1 -0
  191. package/docs/agent-surface-policy.md +45 -0
  192. package/docs/memory-setup.md +226 -0
  193. package/hooks/_arch_scan_bg.py +88 -0
  194. package/hooks/_plugin_drift_check_bg.py +85 -0
  195. package/hooks/_session_start_lib.sh +42 -0
  196. package/hooks/git/pre-push +141 -0
  197. package/hooks/hooks.json +126 -0
  198. package/hooks/post-commit +30 -0
  199. package/hooks/pre-commit +29 -0
  200. package/hooks/pre-edit-apppulse.sh +6 -0
  201. package/hooks/pre-edit-architecture.sh +106 -0
  202. package/hooks/pre-edit-rally-point.sh +92 -0
  203. package/hooks/session-start-apppulse.sh +6 -0
  204. package/hooks/session-start-architecture.sh +10 -0
  205. package/hooks/session-start-git-hooks.sh +12 -0
  206. package/hooks/session-start-plugin-drift.sh +27 -0
  207. package/hooks/session-start-rally-point.sh +44 -0
  208. package/hooks/session-start-retrieval.sh +24 -0
  209. package/hooks/session-start-worktree-gc.sh +105 -0
  210. package/hooks/test_apppulse_hooks.sh +6 -0
  211. package/hooks/test_rally_point_hooks.sh +388 -0
  212. package/hooks/test_sec008_hooks.sh +66 -0
  213. package/package.json +111 -0
  214. package/scripts/README.md +301 -0
  215. package/scripts/_db_url.py +61 -0
  216. package/scripts/_paths.py +445 -0
  217. package/scripts/blm.py +162 -0
  218. package/scripts/blm_api.py +263 -0
  219. package/scripts/check_cache_sync.py +490 -0
  220. package/scripts/embed_backend.py +475 -0
  221. package/scripts/install_memory.py +556 -0
  222. package/scripts/lessons_index/__init__.py +77 -0
  223. package/scripts/lessons_index/__main__.py +135 -0
  224. package/scripts/lessons_index/ingest.py +288 -0
  225. package/scripts/lessons_index/query.py +285 -0
  226. package/scripts/lessons_index/schema.py +114 -0
  227. package/scripts/memory_context/__init__.py +610 -0
  228. package/scripts/memory_graph/__init__.py +393 -0
  229. package/scripts/project_resolver.py +172 -0
  230. package/scripts/prune_codex_plugin_cache.py +23 -0
  231. package/scripts/prune_plugin_cache.py +359 -0
  232. package/scripts/semantic_index/__init__.py +482 -0
  233. package/scripts/semantic_index/_bench_hybrid.py +175 -0
  234. package/scripts/semantic_index/backfill.py +263 -0
  235. package/scripts/semantic_index/hybrid.py +174 -0
  236. package/scripts/semantic_index/test_backfill.py +292 -0
  237. package/scripts/semantic_index/test_hybrid.py +541 -0
  238. package/scripts/sync_navgator_lessons.py +666 -0
  239. package/scripts/sync_plugin_cache.py +388 -0
  240. package/skills/agent-rally-point/SKILL.md +165 -0
  241. package/skills/agent-rally-watcher/SKILL.md +83 -0
  242. package/skills/api-registry-bridge/SKILL.md +59 -0
  243. package/skills/architecture/dead/SKILL.md +56 -0
  244. package/skills/architecture/impact/SKILL.md +88 -0
  245. package/skills/architecture/review/SKILL.md +227 -0
  246. package/skills/architecture/rules/SKILL.md +72 -0
  247. package/skills/architecture/scan/SKILL.md +79 -0
  248. package/skills/architecture/trace/SKILL.md +65 -0
  249. package/skills/attribution-standard/SKILL.md +122 -0
  250. package/skills/authentication/SKILL.md +81 -0
  251. package/skills/authentication/references/better-auth-magic-link.md +135 -0
  252. package/skills/authentication/references/better-auth-setup.md +224 -0
  253. package/skills/authentication/references/google-calendar-sync.md +278 -0
  254. package/skills/authentication/references/google-cloud-console.md +159 -0
  255. package/skills/authentication/references/google-geocoding-directions.md +126 -0
  256. package/skills/authentication/references/google-lessons-example-web-app.md +177 -0
  257. package/skills/authentication/references/google-maps.md +162 -0
  258. package/skills/authentication/references/google-oauth-setup.md +343 -0
  259. package/skills/authentication/references/google-places.md +173 -0
  260. package/skills/authentication/references/lessons-example-web-app-better-auth.md +126 -0
  261. package/skills/authentication/references/resend-email.md +227 -0
  262. package/skills/authentication/references/resend-otp-magic-link.md +153 -0
  263. package/skills/authentication/references/supabase-auth.md +172 -0
  264. package/skills/auto-decision-capture/SKILL.md +419 -0
  265. package/skills/build-loop/SKILL.md +516 -0
  266. package/skills/build-loop/detect-plugins.mjs +82 -0
  267. package/skills/build-loop/eval-guide.md +65 -0
  268. package/skills/build-loop/fallbacks.md +549 -0
  269. package/skills/build-loop/phases/fact-check.md +42 -0
  270. package/skills/build-loop/phases/ui-validation.md +267 -0
  271. package/skills/build-loop/references/apple-native-planning.md +439 -0
  272. package/skills/build-loop/references/capability-routing.md +181 -0
  273. package/skills/build-loop/references/codex-subagents.md +98 -0
  274. package/skills/build-loop/references/coordination.md +161 -0
  275. package/skills/build-loop/references/correction-aware-capture.md +177 -0
  276. package/skills/build-loop/references/independent-auditor.md +72 -0
  277. package/skills/build-loop/references/intent-capability-pack.md +170 -0
  278. package/skills/build-loop/references/intent-exploration-prompts.md +96 -0
  279. package/skills/build-loop/references/leadership.md +72 -0
  280. package/skills/build-loop/references/memory.md +284 -0
  281. package/skills/build-loop/references/modular-systems-pack.md +96 -0
  282. package/skills/build-loop/references/output-style.md +129 -0
  283. package/skills/build-loop/references/pay-it-forward-arch.md +98 -0
  284. package/skills/build-loop/references/phase-1-assess.md +218 -0
  285. package/skills/build-loop/references/phase-2-plan.md +77 -0
  286. package/skills/build-loop/references/phase-3-execute.md +47 -0
  287. package/skills/build-loop/references/phase-4-review.md +310 -0
  288. package/skills/build-loop/references/phase-5-iterate.md +71 -0
  289. package/skills/build-loop/references/phase-6-learn.md +56 -0
  290. package/skills/build-loop/references/recent-design-structures.md +274 -0
  291. package/skills/build-loop/references/refactor-history/ASSESSMENT.md +85 -0
  292. package/skills/build-loop/references/refactor-history/STANDALONE_TEST_RUN.md +149 -0
  293. package/skills/build-loop/references/refactor-history/scenarios/01-simple-bugfix.md +32 -0
  294. package/skills/build-loop/references/refactor-history/scenarios/02-ui-build-with-iteration.md +48 -0
  295. package/skills/build-loop/references/refactor-history/scenarios/03-multi-failure-escalation.md +60 -0
  296. package/skills/build-loop/references/refactor-history/scenarios/04-ui-build-ibr-absent.md +51 -0
  297. package/skills/build-loop/references/refactor-history/scenarios/05-refactor-navgator-absent.md +71 -0
  298. package/skills/build-loop/references/refactor-history/scenarios/06-recurring-bug-debugger-absent.md +52 -0
  299. package/skills/build-loop/references/refactor-history/trace-comparison.md +202 -0
  300. package/skills/build-loop/references/self-recursive-dev.md +77 -0
  301. package/skills/build-loop/references/self-review.md +232 -0
  302. package/skills/build-loop/references/ui-io-contract.md +116 -0
  303. package/skills/build-loop/scanners/audit-design-rules.mjs +476 -0
  304. package/skills/build-loop/scanners/require-visual-evidence.mjs +239 -0
  305. package/skills/build-loop/templates/backlog-item.md +35 -0
  306. package/skills/build-loop/templates/codex-worker-prompt.md +89 -0
  307. package/skills/build-loop/templates/ui-subagent-prompt.md +179 -0
  308. package/skills/build-loop/templates/ux-fix-plan.md +40 -0
  309. package/skills/building-with-deepagents/SKILL.md +195 -0
  310. package/skills/building-with-deepagents/references/anti-patterns.md +141 -0
  311. package/skills/building-with-deepagents/references/api-quick-reference.md +184 -0
  312. package/skills/capabilities/SKILL.md +91 -0
  313. package/skills/debug-loop/SKILL.md +278 -0
  314. package/skills/debug-loop/references/convergence-rules.md +145 -0
  315. package/skills/debug-loop/references/swiftui-macos-clunky-ui-debugger.html +823 -0
  316. package/skills/debugging/assess/SKILL.md +111 -0
  317. package/skills/debugging/debug-loop/SKILL.md +231 -0
  318. package/skills/debugging/memory/SKILL.md +147 -0
  319. package/skills/debugging/store/SKILL.md +153 -0
  320. package/skills/debugging-memory/SKILL.md +440 -0
  321. package/skills/debugging-memory/examples/incident-example.json +67 -0
  322. package/skills/debugging-memory/references/incident-documentation.md +280 -0
  323. package/skills/debugging-memory/references/ios-notification-alarm-playbook.md +300 -0
  324. package/skills/debugging-memory/references/pattern-extraction.md +163 -0
  325. package/skills/debugging-memory/references/subagent-integration.md +312 -0
  326. package/skills/defenseclaw-bridge/SKILL.md +156 -0
  327. package/skills/defenseclaw-bridge/references/dc-config-mapping.md +162 -0
  328. package/skills/defenseclaw-bridge/references/output-format.md +108 -0
  329. package/skills/handoff/SKILL.md +94 -0
  330. package/skills/ibr-bridge/SKILL.md +68 -0
  331. package/skills/knowledge/SKILL.md +127 -0
  332. package/skills/knowledge/references/recall-integration.md +83 -0
  333. package/skills/knowledge/templates/madr-minimal.md +56 -0
  334. package/skills/knowledge-review/SKILL.md +112 -0
  335. package/skills/logging-tracer/SKILL.md +202 -0
  336. package/skills/logging-tracer/references/log-analysis.md +128 -0
  337. package/skills/logging-tracer/references/stack-templates.md +274 -0
  338. package/skills/logging-tracer-bridge/SKILL.md +70 -0
  339. package/skills/mcp-builder/SKILL.md +278 -0
  340. package/skills/mcp-builder/references/mcp-security.md +106 -0
  341. package/skills/model-tiering/SKILL.md +216 -0
  342. package/skills/native-ax-driver/SKILL.md +220 -0
  343. package/skills/native-ax-driver/scripts/layout_fill.py +222 -0
  344. package/skills/native-ax-driver/scripts/native_driver.py +495 -0
  345. package/skills/native-ax-driver/swift/bl-ax-driver/Package.swift +20 -0
  346. package/skills/native-ax-driver/swift/bl-ax-driver/Sources/main.swift +542 -0
  347. package/skills/optimize/SKILL.md +202 -0
  348. package/skills/optimize/profiles.md +61 -0
  349. package/skills/plan-verify/SKILL.md +115 -0
  350. package/skills/plan-verify/test-fixtures/example-app-v20-findings.json +27 -0
  351. package/skills/plan-verify/test-fixtures/example-app-v20.md +42 -0
  352. package/skills/plan-verify/test-fixtures/example-app-v22-findings.json +15 -0
  353. package/skills/plan-verify/test-fixtures/example-app-v22.md +1608 -0
  354. package/skills/plan-verify/test-fixtures/unrelated-good-plan-findings.json +15 -0
  355. package/skills/plan-verify/test-fixtures/unrelated-good-plan.md +55 -0
  356. package/skills/plugin-builder/SKILL.md +329 -0
  357. package/skills/plugin-builder/references/authoritative-sources.md +104 -0
  358. package/skills/plugin-builder/references/build-loop-phase-guidance.md +94 -0
  359. package/skills/plugin-builder/references/components-guide.md +221 -0
  360. package/skills/plugin-builder/references/distribution.md +317 -0
  361. package/skills/plugin-builder/references/dual-host-claude-codex.md +220 -0
  362. package/skills/plugin-builder/references/hooks-reference.md +210 -0
  363. package/skills/plugin-builder/references/manifest-schema.md +111 -0
  364. package/skills/plugin-builder/references/plugin-hygiene-lessons.md +307 -0
  365. package/skills/plugin-tests/SKILL.md +94 -0
  366. package/skills/prd-bridge/SKILL.md +135 -0
  367. package/skills/research/SKILL.md +80 -0
  368. package/skills/security-methodology/SKILL.md +105 -0
  369. package/skills/security-methodology/references/cross-source-matrix.md +77 -0
  370. package/skills/security-methodology/references/mitre-atlas-starter.md +83 -0
  371. package/skills/security-methodology/references/nist-600-1-mapping.md +119 -0
  372. package/skills/security-methodology/references/owasp-agentic-top-10.md +157 -0
  373. package/skills/security-methodology/references/owasp-llm-top-10.md +144 -0
  374. package/skills/security-methodology/references/owasp-web-top-10.md +65 -0
  375. package/skills/self-improve/SKILL.md +298 -0
  376. package/skills/spec-writing/SKILL.md +548 -0
  377. package/skills/spec-writing/scripts/check_checklist.py +478 -0
  378. package/skills/sync-skills/SKILL.md +132 -0
  379. package/skills/telemetry/SKILL.md +66 -0
  380. package/skills/ui-design/SKILL.md +75 -0
  381. package/skills/ui-design/references/design-patterns-multi.md +165 -0
  382. package/skills/ui-design/references/design-preferences-from-owned-apps.md +150 -0
  383. package/skills/ui-design/references/evidence-capture-policy.md +55 -0
  384. package/skills/ui-design/references/ui-guidance-sources.md +330 -0
  385. package/skills/ui-design/references/universal-design-principles.alt.md +182 -0
  386. package/skills/ui-design/references/universal-design-principles.md +419 -0
  387. package/templates/memory/MEMORY.md.template +55 -0
  388. package/templates/memory/constitution.md.template +64 -0
  389. package/templates/memory/manifest.json +47 -0
@@ -0,0 +1,144 @@
1
+ <!-- SPDX-FileCopyrightText: 2025-2026 Tyrone Ross, Jr <46267523+tyroneross@users.noreply.github.com> | SPDX-License-Identifier: Apache-2.0 -->
2
+
3
+ # OWASP Top 10 for LLM Applications (v1.1, 2025)
4
+
5
+ Component-and-content-level risks. Frames the LLM as a component inside a wider application — these risks apply to any LLM-backed feature, agent or otherwise.
6
+
7
+ **Source.** `https://owasp.org/www-project-top-10-for-large-language-model-applications/` — T1, OWASP project page. Retrieved 2026-05-02.
8
+
9
+ ## Reading these tables
10
+
11
+ Each row is one risk. The **Detection patterns** column lists what to grep for in a diff or look for during code review — these are signals, not proofs. Some signals are unambiguous (eval of LLM output → LLM02 + ASI05); most are necessary-not-sufficient and pair with a judgment call about the surrounding code.
12
+
13
+ ## LLM01 — Prompt Injection
14
+
15
+ **What it covers.** Crafted inputs hijack the model's behavior. Two flavors: **direct** (attacker controls the user input) and **indirect** (attacker controls retrieved content, tool output, file contents, or upstream LLM output that the target LLM later reads).
16
+
17
+ **Detection patterns.**
18
+ - Template strings or string concatenation that puts a user-controlled value into a system prompt position. Look for `f"...{user_input}..."`, `` `${...}` `` in template literals, `prompt.format(...)`, or any direct interpolation of unsanitized strings into the request body.
19
+ - Tool output, search results, web content, RAG snippets, file contents, or another agent's output appended to the LLM context with no separator, no provenance tag, and no instruction-vs-data delimiter.
20
+ - A `system` and `user` message constructed from a single concatenated string instead of distinct roles.
21
+ - Use of `system` content sourced from a database or external store without integrity check (poisoned-system-prompt vector).
22
+
23
+ **Adjacent agentic risk.** Pairs with **ASI01** (Agent Goal Hijack) when the prompt-injectable LLM is an agent that takes actions.
24
+
25
+ ## LLM02 — Insecure Output Handling
26
+
27
+ **What it covers.** Treating LLM output as trusted input downstream — XSS, SQL injection, command injection, SSRF, or RCE *because* the application trusts what the model returned.
28
+
29
+ **Detection patterns.**
30
+ - LLM output rendered with `dangerouslySetInnerHTML`, `innerHTML`, `v-html`, or `{@html ...}` without sanitization.
31
+ - LLM output passed to `exec`, `Function(...)`, dynamic `import`, `child_process.exec`, `subprocess.run(..., shell=True)`, `eval`, or any string-to-code path.
32
+ - LLM output concatenated into SQL/NoSQL queries, OS commands, file paths, URLs (especially for `fetch` / `requests.get`), or shell scripts.
33
+ - LLM output used as a redirect target, an Open Graph URL, or a webhook URL without an allowlist.
34
+ - LLM output deserialized via `pickle`, `yaml.load(..., Loader=yaml.Loader)`, `JSON.parse` followed by no schema validation, or any unsafe deserializer.
35
+
36
+ **Adjacent agentic risks.** Pairs with **ASI05** (Unexpected Code Execution) and **ASI08** (Cascading Failures, when the unsanitized output is the input to a downstream agent).
37
+
38
+ ## LLM03 — Training Data Poisoning
39
+
40
+ **What it covers.** Tampered training data corrupts model behavior. For most product teams, the *training* surface is owned by the model provider (OpenAI / Anthropic / etc.), so this risk shifts toward **fine-tuning** and **RAG corpus** poisoning.
41
+
42
+ **Detection patterns.**
43
+ - Fine-tuning data ingested from a user-writable source without curation, sampling review, or provenance tags.
44
+ - RAG corpus ingestion that accepts uploads from end users into a shared index used across users.
45
+ - A mechanism to update embeddings or retrieval weights without an approval gate.
46
+ - Memory or "learned preferences" persisted across sessions for one user but reachable from another user's queries (related to ASI06).
47
+
48
+ **Adjacent agentic risk.** Pairs with **ASI10** (Rogue Agents) at the most severe end — a poisoned fine-tune produces an agent whose alignment drift is invisible at deploy time.
49
+
50
+ ## LLM04 — Model Denial of Service
51
+
52
+ **What it covers.** Resource-exhaustion attacks: token bombs, recursive prompts, expensive tool chains, infinite loops between agents.
53
+
54
+ **Detection patterns.**
55
+ - New LLM call without a `max_tokens` ceiling, request timeout, or per-run budget.
56
+ - New agent loop without an iteration cap.
57
+ - Tool that calls LLM that calls tool, with no circuit breaker.
58
+ - User input length not bounded before being placed in the prompt.
59
+ - Multiple parallel LLM calls without a concurrency cap.
60
+ - Recursive/self-calling agent without a depth limit.
61
+
62
+ **Cost angle.** Cost runaway is the boring twin of DoS — same root cause (no ceiling), different victim (your wallet). Treat them as one finding.
63
+
64
+ ## LLM05 — Supply Chain Vulnerabilities
65
+
66
+ **What it covers.** Compromised model weights, datasets, libraries, plugins, MCP servers, prompt templates, A2A peers. Provenance, pinning, scanning.
67
+
68
+ **Detection patterns.**
69
+ - New `pip install` / `npm install` / `cargo add` of an LLM-adjacent package without a pinned version (`==X.Y.Z` for Python, exact version for npm).
70
+ - New MCP server or plugin pulled from a non-organization source (random GitHub user, npm registry without an internal mirror).
71
+ - Model loaded by name from Hugging Face or similar without a hash pin (organization-confusion attack vector).
72
+ - Skill, agent, or prompt template imported from an external repository without a SHA pin.
73
+ - Generated code (Codex, Cursor, Copilot output) committed without a review pass.
74
+
75
+ **Adjacent agentic risk.** Pairs with **ASI04** (Agentic Supply Chain) and **OWASP Web A06** (Vulnerable & Outdated Components).
76
+
77
+ ## LLM06 — Sensitive Information Disclosure
78
+
79
+ **What it covers.** The model reveals sensitive content from the training set, the system prompt, the context window, or another user's conversation.
80
+
81
+ **Detection patterns.**
82
+ - Secrets (API keys, tokens, DB URLs) injected into the system prompt or request body. Anything matching `sk-`, `Bearer `, `password=`, `api_key=`, or environment variables landing in prompt strings.
83
+ - PII or regulated data (SSN, payment, health) included in prompt context without a redaction pass.
84
+ - A single LLM context shared across users (cache key based on prompt content alone, not user-scoped).
85
+ - LLM output streamed to a log without redaction.
86
+ - Internal tool documentation or schema dumped into the prompt where attackers could exfiltrate it via prompt injection.
87
+
88
+ **Cross-map.** This is the **NIST Data Privacy** + **Information Security** intersection.
89
+
90
+ ## LLM07 — Insecure Plugin Design
91
+
92
+ **What it covers.** Plugins/tools accept LLM-generated input without validation, lack access control, or have over-broad scopes.
93
+
94
+ **Detection patterns.**
95
+ - Tool schema accepts `string` for a parameter that should be a typed enum, validated path, or scoped ID.
96
+ - Tool uses ambient credentials (the agent's keys, not the user's) for an action that should be scoped to a user identity.
97
+ - Tool action that writes/deletes/external-calls without a `requires_human_approval: true` or equivalent gate.
98
+ - Tool that takes a URL/path/SQL string and passes it through to the underlying system without validation.
99
+ - Tool catalog exposes more capabilities to the agent than the workflow needs ("just expose all of GitHub" pattern).
100
+
101
+ **Cross-map.** Heavy overlap with **ASI02** (Tool Misuse) and **ASI03** (Privilege Abuse). When in doubt, cite both LLM07 and ASI02/ASI03 — they're not redundant, they describe the same surface from different angles.
102
+
103
+ ## LLM08 — Excessive Agency
104
+
105
+ **What it covers.** The damaging-action vector. The agent has more functionality, more permissions, or more autonomy than it needs to perform its job, and an attacker (via LLM01) or a confused state turns that into harm.
106
+
107
+ **Detection patterns.**
108
+ - Tool list larger than the role description requires.
109
+ - Permission tier higher than the action class requires (T5 for a read; T4 when no user comms is needed).
110
+ - Autonomy level above what the use case requires (A3 "execute reversible" when A1 "draft" would do).
111
+ - No human-in-the-loop checkpoint at the autonomy/permission boundary where one is plausible.
112
+ - "Just give the agent admin" style provisioning.
113
+
114
+ **Cross-map.** This is the cross-cutting agentic risk in the LLM Top 10. The OWASP Agentic Top 10 (ASI02 + ASI03) replaced and refined this in 2026; both still apply at design-time review.
115
+
116
+ ## LLM09 — Overreliance
117
+
118
+ **What it covers.** A human-in-the-loop reviewer who doesn't critically assess LLM output and approves harm.
119
+
120
+ **Detection patterns.**
121
+ - "Confirm" / "Approve" UX with the model's reasoning displayed prominently and the underlying evidence buried.
122
+ - No diff or provenance shown alongside an LLM-suggested change.
123
+ - Default-yes confirm flows for non-trivial actions.
124
+ - Confidence claims surfaced from the model directly ("I'm 95% sure") without independent calibration.
125
+ - Auto-approval thresholds set against the model's self-reported confidence.
126
+
127
+ **Cross-map.** Pairs with **ASI09** (Human-Agent Trust Exploitation), which is the more pointed framing in the agentic taxonomy.
128
+
129
+ ## LLM10 — Model Theft
130
+
131
+ **What it covers.** Unauthorized access to proprietary model weights or architecture.
132
+
133
+ **Detection patterns.**
134
+ - Public-facing endpoint that returns logits, embeddings, or fine-tuned model state without auth/rate limiting.
135
+ - API key leakage in client-bundled code or git history.
136
+ - Weight files committed to a public repo.
137
+
138
+ **Most product teams don't host weights.** For agent-builder-style apps that consume hosted models (OpenAI, Anthropic, Bedrock, Vertex), LLM10 collapses to "don't leak the API key" — which is LLM06 in practice. Flag it explicitly only when fine-tuned weights or self-hosted models are in play.
139
+
140
+ ## What this file does not contain
141
+
142
+ - Fix code. The agent that finds an LLM01 vulnerability does not patch it; it routes to Iterate with the finding.
143
+ - The full OWASP write-up. For the canonical text, citation, and authority lineage, follow the source URL above.
144
+ - Scoring guidance. Severity is set by `agents/security-reviewer.md` based on exploitability and consequence; this file lists detection signals, not severity heuristics.
@@ -0,0 +1,65 @@
1
+ <!-- SPDX-FileCopyrightText: 2025-2026 Tyrone Ross, Jr <46267523+tyroneross@users.noreply.github.com> | SPDX-License-Identifier: Apache-2.0 -->
2
+
3
+ # OWASP Top 10 (Web) 2025 — relevant subset for LLM-backed apps
4
+
5
+ The web Top 10 still applies under any agent that exposes HTTP endpoints, calls APIs, or processes user-controlled URLs. This file enumerates the four risks that materially overlap with LLM/agentic concerns. The other six (A02 Cryptographic Failures, A04 Insecure Design, A05 Security Misconfiguration, A07 Identification and Authentication Failures, A08 Software and Data Integrity Failures, A09 Security Logging and Monitoring Failures) still apply in their classic form — they're not LLM-specific. This file does not re-enumerate them; the canonical write-up lives at the source.
6
+
7
+ **Source.** `https://owasp.org/www-project-top-ten/` — T1, OWASP project page. Retrieved 2026-05-02.
8
+
9
+ ## A01 — Broken Access Control
10
+
11
+ **Why it matters for agents.** An agent acting on behalf of user A must not access user B's data. Authorization must be enforced **downstream of the LLM** — the LLM cannot be the auth layer. The most common modern failure is "the agent passes a user ID parameter to the tool, the tool trusts that ID."
12
+
13
+ **Detection patterns.**
14
+ - Tool implementation that uses an `agent_supplied_user_id` parameter to scope access without verifying it against the authenticated session/JWT.
15
+ - Endpoint that authenticates the request (good) but doesn't authorize the *target* (the user whose data is being read or written).
16
+ - LLM-generated SQL or query string that includes a tenant/user ID without parameterization or row-level security.
17
+ - Multi-tenant agent deployments where the tenant boundary lives in the prompt ("you are working for tenant X") rather than in the data layer.
18
+ - Public-by-default share links generated by the agent without expiry, scope, or revocation path.
19
+
20
+ **Cross-map.** Pairs with **ASI03** (Identity and Privilege Abuse). A finding that's both A01 and ASI03 is the canonical "the LLM crossed a tenant boundary" failure.
21
+
22
+ ## A03 — Injection
23
+
24
+ **Why it matters for agents.** Classic SQL/command/template injection still applies whenever an LLM-generated string ends up in a query, shell, template, or evaluator. The agentic twist: the attacker doesn't write the injection directly — the attacker writes a prompt that gets the LLM to write the injection.
25
+
26
+ **Detection patterns.**
27
+ - LLM output concatenated into a SQL/NoSQL query (no parameterized queries, no ORM scope).
28
+ - LLM output passed to `subprocess.run(..., shell=True)`, `child_process.exec`, or any string-based shell composition.
29
+ - LLM output rendered through a templating engine that allows expression evaluation (`{{ ... }}` patterns in Jinja-style templates).
30
+ - LLM output used as a path component in `fetch`, `requests.get`, `open`, or any file/URL accessor.
31
+ - LLM output used as part of an LDAP query, XPath, or a serialized binary command frame.
32
+
33
+ **Cross-map.** Pairs with **LLM02** (Insecure Output Handling) and **ASI05** (Unexpected Code Execution). The sequence is: LLM01 enables A03; A03 escalates to ASI05 if RCE is reachable.
34
+
35
+ ## A06 — Vulnerable and Outdated Components
36
+
37
+ **Why it matters for agents.** The agent's surface includes its model SDK, the orchestration framework, the tool plugins, the MCP servers it connects to, the prompt templates it loads. All of those have versions; all of those drift; all of those publish CVEs.
38
+
39
+ **Detection patterns.**
40
+ - New `pip install` / `npm install` / `cargo add` of an LLM-adjacent package without a pinned version.
41
+ - Lockfile not committed alongside the manifest.
42
+ - Dependency on a model SDK or orchestration framework with no upgrade plan and no `dependabot` / `renovate` / equivalent.
43
+ - MCP server pulled from a public registry without an internal mirror or scan.
44
+ - Generated code (Codex, Cursor, Copilot output) committed without a review pass.
45
+
46
+ **Cross-map.** Pairs with **LLM05** (Supply Chain) and **ASI04** (Agentic Supply Chain). LLM05 is the *content* angle (the model could have been poisoned); ASI04 is the *agent system* angle (the entire agent could have been compromised); A06 is the *traditional dependency* angle (CVE in the SDK). All three apply to the same install.
47
+
48
+ ## A10 — Server-Side Request Forgery
49
+
50
+ **Why it matters for agents.** Agents that fetch URLs are SSRF-prone by default. The attacker writes a prompt; the agent decides to fetch a URL; the URL points at internal infrastructure.
51
+
52
+ **Detection patterns.**
53
+ - Tool / endpoint that takes a URL and `fetch`es it with no allowlist, no DNS rebinding protection, no IP-range restriction.
54
+ - Outbound URL constructed from LLM output without validation.
55
+ - Agent that "browses the web" without an egress proxy, allowlist, or scope.
56
+ - Webhook URL stored from user/agent input and called server-side later.
57
+ - Image/file/preview-fetcher that takes a URL parameter and returns the bytes.
58
+
59
+ **Cross-map.** Pairs with **ASI05** (Unexpected Code Execution) when the SSRF reaches an internal RCE-prone endpoint, and with **LLM07** (Insecure Plugin Design) when the SSRF tool is a plugin without scope.
60
+
61
+ ## What this file does not contain
62
+
63
+ - The other six web risks. They apply in classic form; cite the OWASP source URL when one of them is the issue.
64
+ - Guidance on which boundary owns the fix (frontend, gateway, BFF, downstream service). That depends on the project's architecture; this file enumerates risk and detection only.
65
+ - Severity scoring. `agents/security-reviewer.md` assigns severity using the rubric in its own SKILL frontmatter; this file lists detection signals.
@@ -0,0 +1,298 @@
1
+ ---
2
+ name: build-loop:self-improve
3
+ description: Use when Phase 6 Learn fires automatically after Report, the user runs `/build-loop:self-improve`, or asks to "scan recent runs" or "improve build-loop". Scans recent runs for recurring patterns, auto-drafts experimental skills/agents with A/B tracking.
4
+ version: 0.1.0
5
+ user-invocable: false
6
+ ---
7
+
8
+ <!-- SPDX-FileCopyrightText: 2025-2026 Tyrone Ross, Jr <46267523+tyroneross@users.noreply.github.com> | SPDX-License-Identifier: Apache-2.0 -->
9
+
10
+ # Build-Loop Self-Improvement (Phase 6 Learn)
11
+
12
+ This skill runs after Review sub-step F (Report) completes, or on demand. It detects recurring patterns across recent build-loop runs, drafts experimental skills/agents to address them, and notifies the user for keep/remove decisions.
13
+
14
+ **Principle:** auto-draft, notify, experiment, decide based on evidence. User can always remove. A/B comparison is small and focused — one metric, short sample, clear decision rule.
15
+
16
+ ## When This Skill Runs
17
+
18
+ - Automatically at end of every build-loop run (Phase 6 Learn, after Review sub-step F (Report))
19
+ - On demand via `/build-loop:self-improve`
20
+ - Skipped if `.build-loop/state.json.runs` has fewer than 3 entries — not enough signal
21
+
22
+ ## Flow
23
+
24
+ ```
25
+ ┌──────────────────────────────────────────────────────────────┐
26
+ │ Phase 6 Learn: REVIEW (this skill) │
27
+ ├──────────────────────────────────────────────────────────────┤
28
+ │ 1. DETECT → recurring-pattern-detector (Haiku) │
29
+ │ emits patterns[] JSON │
30
+ │ 2. FILTER → keep only confidence:high or count >= threshold │
31
+ │ 3. DRAFT → for each kept pattern: │
32
+ │ self-improvement-architect (Sonnet) │
33
+ │ writes .build-loop/skills/experimental/<name>/ │
34
+ │ 4. SIGNOFF → build-orchestrator (Opus 4.7) reviews each: │
35
+ │ approve, revise, or discard │
36
+ │ 5. TRACK → record baseline in .build-loop/experiments/ │
37
+ │ 6. NOTIFY → synthesize 3-5 line summary to user │
38
+ │ (include removal command + A/B plan) │
39
+ └──────────────────────────────────────────────────────────────┘
40
+ ```
41
+
42
+ ## Steps
43
+
44
+ ### 1. Detect recurring patterns
45
+
46
+ ```
47
+ Agent: recurring-pattern-detector (haiku)
48
+ Input: read .build-loop/state.json
49
+ Output: {scannedRuns, patterns: [...]}
50
+ ```
51
+
52
+ If `patterns.length === 0`, skip to step 6 (notify with "no patterns detected, N runs scanned"). End.
53
+
54
+ ### 2. Filter
55
+
56
+ Keep patterns matching any of:
57
+ - `confidence === "high"`
58
+ - `count >= 4` regardless of confidence
59
+ - `type === "manual_intervention"` (user time is expensive; lower threshold)
60
+
61
+ Drop the rest. Log skipped patterns in `.build-loop/experiments/skipped.jsonl` with date + reason — lets us tune thresholds later without losing signal.
62
+
63
+ ### 3. Draft experimental artifacts
64
+
65
+ For each kept pattern, dispatch:
66
+
67
+ ```
68
+ Agent: self-improvement-architect (sonnet)
69
+ Input: the pattern object + target type (skill or agent)
70
+ Output:
71
+ - writes .build-loop/skills/experimental/<name>/SKILL.md (or agents/experimental/<name>.md)
72
+ - returns concise 3-4 line synthesis
73
+ ```
74
+
75
+ The architect agent includes an A/B Experiment section in every artifact it writes.
76
+
77
+ ### 4. Opus 4.7 signoff
78
+
79
+ Build-orchestrator (Opus 4.7) reads each drafted artifact and decides:
80
+
81
+ - **APPROVE** — artifact is coherent, pattern is real, A/B plan is measurable → proceed to track
82
+ - **REVISE** — core idea is right, execution needs tightening → re-dispatch architect with specific feedback, max 1 revision pass
83
+ - **DISCARD** — pattern is noise or artifact is unusable → delete the file, log to `.build-loop/experiments/discarded.jsonl` with reason
84
+
85
+ Opus signoff is the quality gate. Sonnet drafts fast; Opus ensures no garbage ships into `.build-loop/skills/experimental/`.
86
+
87
+ ### 5. Track baseline
88
+
89
+ For each APPROVED artifact, write to `.build-loop/experiments/<name>.jsonl`:
90
+
91
+ ```jsonl
92
+ {"event": "created", "date": "2026-04-19T14:22:00Z", "artifact": "experimental-middleware-typegen", "baseline_metric": "Review-B pass rate on middleware edits", "baseline_value": 0.6, "target_value": 0.9, "sample_size_target": 5}
93
+ ```
94
+
95
+ The experimental skill's description triggers it on matching runs. Each subsequent run that matches the skill's trigger appends to this file:
96
+
97
+ ```jsonl
98
+ {"event": "applied", "date": "...", "run_date": "2026-04-20", "triggered": true, "metric_value": 1.0, "outcome": "phase_5_pass"}
99
+ ```
100
+
101
+ After `sample_size_target` applied entries, Phase 6 Learn computes delta and emits a decision recommendation (promote / remove / extend sample).
102
+
103
+ ### 6. Notify user (concise synthesis)
104
+
105
+ Emit exactly this format to the Review sub-step F report tail:
106
+
107
+ ```
108
+ ## Phase 6 Learn: Self-Improvement Review
109
+
110
+ Scanned: N runs over last M days
111
+ Detected: X high-confidence patterns, Y filtered out (low signal)
112
+
113
+ Created experimental artifacts (all in .build-loop/, easy to remove):
114
+ • <name-1> — <one-line purpose> — A/B on: <metric>
115
+ • <name-2> — <one-line purpose> — A/B on: <metric>
116
+
117
+ Monitor: `cat .build-loop/experiments/<name>.jsonl`
118
+ Remove: `rm -rf .build-loop/skills/experimental/<name>/`
119
+ ```
120
+
121
+ If nothing was created, emit:
122
+
123
+ ```
124
+ ## Phase 6 Learn: Self-Improvement Review
125
+ Scanned N runs. No recurring patterns crossed confidence threshold. Nothing created.
126
+ ```
127
+
128
+ ### 7. Episodic memory consolidation (Phase 4 wiring)
129
+
130
+ After steps 1-6 complete, run the memory-consolidation pass. This is the
131
+ hook that wires recurring-pattern detection into the four-memory-types
132
+ framework — when the orchestrator sees the same root cause N times, it
133
+ becomes both an experimental skill (above) AND a procedural-memory
134
+ candidate (below).
135
+
136
+ Run in this order:
137
+
138
+ ```bash
139
+ # Promote any pending semantic candidates into agent_memory.semantic_facts
140
+ # (no-op if .semantic/_candidates.jsonl is missing)
141
+ python3 scripts/consolidate_memory.py --workdir "$PWD"
142
+
143
+ # Surface recurring root_causes as procedural candidates
144
+ # (writes .procedural/_candidates.jsonl entries crossing the 3-incident threshold)
145
+ python3 scripts/procedural_governance.py --workdir "$PWD" --mode detect-patterns
146
+ ```
147
+
148
+ Both are safe to re-run; both no-op when nothing qualifies. The first
149
+ fans out the auto-capture batch sweep results into the indexed
150
+ `semantic_facts` table; the second draws from the same
151
+ `state.json.runs[]` that step 1 just scanned, so the procedural
152
+ candidates align with the experimental skills drafted in steps 3-5.
153
+
154
+ Auto-drafting of procedures (`procedural_governance.py --mode auto-draft`)
155
+ remains gated until 5 hand-authored procedures exist in `.procedural/`
156
+ — the third phase of the procedural learning curve from design ref §14.
157
+
158
+ If consolidation surfaces a CONFLICT, the orchestrator surfaces the
159
+ count in the Phase 6 summary — never auto-resolves.
160
+
161
+ ## Data Contracts
162
+
163
+ ### `.build-loop/state.json.runs[]` extensions (writer: build-orchestrator during Review sub-step F)
164
+
165
+ Review sub-step F (Report) must now append a run entry to `state.json.runs[]` before Phase 6 Learn runs. Schema:
166
+
167
+ ```json
168
+ {
169
+ "date": "ISO-8601 UTC",
170
+ "goal": "short goal text",
171
+ "outcome": "pass" | "fail" | "partial",
172
+ "phases": {
173
+ "1": { "status": "pass|fail", "duration_s": number, "root_cause": "string?" },
174
+ "...": "..."
175
+ },
176
+ "diagnosticCommands": ["shell commands run during build"],
177
+ "filesTouched": ["absolute paths edited"],
178
+ "manualInterventions": [
179
+ { "phase": number, "note": "short description" }
180
+ ]
181
+ }
182
+ ```
183
+
184
+ The orchestrator is responsible for capturing `diagnosticCommands` (hook or transcript review), `filesTouched` (git diff after build), and `manualInterventions` (any AskUserQuestion response that overrode default flow).
185
+
186
+ ### `.build-loop/experiments/<name>.jsonl`
187
+
188
+ Append-only log per experimental artifact. Schema:
189
+
190
+ ```jsonl
191
+ {"event": "created", "date": "ISO", "artifact": "name", "baseline_metric": "...", "baseline_value": N, "target_value": N, "sample_size_target": 8}
192
+ {"event": "applied", "date": "ISO", "run_id": "run_YYYYMMDDTHHMMSSZ_hash8", "triggered": true, "metric_value": N, "outcome": "pass|fail", "co_applied_experimental_artifacts": ["other-name"], "confounded": true}
193
+ {"event": "applied", "date": "ISO", "run_id": "...", "triggered": true, "metric_value": N, "outcome": "pass", "co_applied_experimental_artifacts": [], "confounded": false}
194
+ {"event": "decision", "date": "ISO", "verdict": "promote|remove|extend", ...}
195
+ ```
196
+
197
+ `applied` rows with `confounded: true` are preserved for audit but excluded from the effective sample count. The effective sample is `count(rows where confounded == false)`. A sample only passes the floor when effective count >= 8 (or the user's custom `sample_size_target`, whichever is larger).
198
+
199
+ ## Promotion decisions (after sample complete)
200
+
201
+ **Default behavior is opt-in.** `autoPromote` defaults to **`false`** in `.build-loop/config.json` — Phase 6 Learn drafts experimental artifacts and tracks A/B evidence but stops at "propose promote" until the user enables the auto mode. This changed after an adversarial review flagged that small-sample auto-promotion can flip on flake and delete good work during temporary regressions.
202
+
203
+ ### Enabling auto-promote
204
+
205
+ To opt in, create `.build-loop/config.json` with:
206
+
207
+ ```json
208
+ { "autoPromote": true }
209
+ ```
210
+
211
+ Even with the flag on, auto-promotion requires **`sample_size_target >= 8`** and passing the promotion rules below. Below the floor, Phase 6 Learn always writes a proposal to `.build-loop/proposals/<name>.md` and blocks promotion until the user reviews. The architect agent initializes new experiments with `sample_size_target: 8` by default; only raise it when noise demands more power.
212
+
213
+ ### Promotion rules
214
+
215
+ When `autoPromote` is true AND `sample_size_target >= 8` AND the experiment's applied entries are all `confounded: false` (see §Confound tracking below):
216
+
217
+ | Delta vs baseline | Action | Location |
218
+ |---|---|---|
219
+ | Metric improves ≥ target (non-confounded) | **Auto-promote**: `git mv .build-loop/skills/experimental/<name> .build-loop/skills/active/<name>`, update SKILL.md frontmatter `experimental: false` + `promoted_at: <ISO>`, append `{event: "promoted", ...}` to the experiment's jsonl | `.build-loop/skills/active/<name>/` |
220
+ | Metric improves < target (partial win) | **Extend sample** to 2N; re-evaluate after additional runs | unchanged |
221
+ | Metric flat (±10% of baseline) | **Extend sample** to 2N; re-evaluate | unchanged |
222
+ | Metric regresses | **Write proposal** to `.build-loop/proposals/<name>-remove.md` with evidence. Removal requires user confirmation via `AskUserQuestion` in the next Phase 6 Learn run (not immediate `rm -rf`). Avoids single-build regressions deleting useful skills. | experimental (intact) |
223
+ | Sample at 2N still flat | **Write proposal** to `.build-loop/proposals/<name>-inconclusive.md`; same user confirmation gate for removal | experimental (intact) |
224
+
225
+ If the opt-in flag is off, every row above becomes "write proposal, no file moves/deletes." Proposals accumulate in `.build-loop/proposals/` for manual review.
226
+
227
+ **Below the sample-size floor** (`applied_count < 8`): Phase 6 Learn records evidence but never acts. The architect may still author new experimental artifacts in this state — the floor only gates promotion/removal decisions.
228
+
229
+ ### Confound tracking
230
+
231
+ Every Review-B applied-run log line MUST include:
232
+ - `run_id` — a canonical identifier for the build run (the orchestrator generates it at Review-F, e.g. `run_20260419T143022Z_<goalHash8>`)
233
+ - `co_applied_experimental_artifacts[]` — full list of experimental artifact names that also triggered on this run
234
+
235
+ **Rule**: a run with `co_applied_experimental_artifacts.length > 0` is **confounded** — no single artifact can claim credit for the metric delta. Phase 6 Learn marks all such runs with `confounded: true` and **excludes them from promotion math**. The confound state is sticky: removing an entry from the jsonl does not uncontaminate it.
236
+
237
+ **Enforcement**: at most one experimental artifact should trigger per build by design. If two fire (because their descriptions both matched the goal), log both measurements with the confound flag and continue the build, but the A/B accounting discounts all co-applied rows. Extending the sample to 2N must count only `confounded: false` rows toward the new target.
238
+
239
+ **Why we keep both artifacts active rather than disabling one**: silently disabling a co-applied artifact alters future behavior without user awareness. Keeping them both on + marking runs confounded produces honest (if slower) evidence and a surfacable signal that the skills are overlapping and should be merged or one retired.
240
+
241
+ **A note on precedent**: Karpathy's autoresearch auto-accepts metric wins *within a single optimization run*, not across runs. Cross-run auto-promotion is a new layer. The adversarial review correctly pointed out that small-sample cross-run promotion without isolation is not the same claim of rigor — so the default is opt-in, the floor is 8, and confounded runs don't count.
242
+
243
+ ### Decision log format
244
+
245
+ Write to `.build-loop/experiments/decisions.jsonl` (append-only) one entry per auto-decision:
246
+
247
+ ```jsonl
248
+ {"event": "auto_promote", "date": "ISO", "name": "middleware-typegen", "baseline": 0.6, "observed": 0.94, "delta": "+56%", "target": 0.9, "sample_size": 5, "artifacts_moved": 2}
249
+ {"event": "auto_remove", "date": "ISO", "name": "aggressive-dedup", "reason": "regression", "baseline": 3.2, "observed": 4.1, "delta": "+28% (worse)", "sample_size": 5}
250
+ {"event": "extend_sample", "date": "ISO", "name": "memo-scope", "reason": "flat", "baseline": 0.72, "observed": 0.75, "delta": "+4%", "new_target_size": 10}
251
+ {"event": "auto_remove", "date": "ISO", "name": "eager-typegen", "reason": "inconclusive", "sample_size": 10, "note": "flat after 2N"}
252
+ ```
253
+
254
+ ### User override / reversal
255
+
256
+ - **Stop an auto-promote**: if the user disagrees with an auto-promotion, `git mv .build-loop/skills/active/<name> .build-loop/skills/experimental/<name>` or `rm -rf .build-loop/skills/active/<name>/`. Phase 6 Learn will not re-promote a name listed in `.build-loop/skills/.demoted` (one name per line — create this file to block re-promotion).
257
+ - **Restore a removed artifact**: logs preserve the original SKILL.md content in `discarded.jsonl` under `{artifact_content: "..."}`. Restoration is manual (grab the content, write back). Only the last 30 discards are preserved; older entries keep metadata only.
258
+ - **Auto-promote is OFF by default**. To enable: `.build-loop/config.json` → `{"autoPromote": true}`. Even when on, promotion requires effective non-confounded sample >= 8 and non-regression. Below the floor or with confounded-only evidence, proposals accumulate in `.build-loop/proposals/` for manual review regardless of the flag.
259
+
260
+ ## Cross-Project Promotion
261
+
262
+ Auto-promote stays inside the project. Moving an experimental or active artifact into the build-loop plugin repo — where it affects every user on every project — requires explicit invocation:
263
+
264
+ ```
265
+ /build-loop:promote-experiment <name>
266
+ ```
267
+
268
+ The command reads the experiment's track record across this and other projects (if global `~/.build-loop/experiments/` index exists), checks the artifact quality, asks the user for confirmation, and commits to the plugin repo on a feature branch for user review. See `commands/promote-experiment.md` for the full protocol.
269
+
270
+ ## Removal
271
+
272
+ Users can remove any experimental artifact at any time:
273
+
274
+ ```bash
275
+ rm -rf .build-loop/skills/experimental/<name>/
276
+ rm .build-loop/experiments/<name>.jsonl # optional, keeps history
277
+ ```
278
+
279
+ The skill stops triggering immediately (no orchestrator restart needed).
280
+
281
+ ## What This Skill Will NOT Do
282
+
283
+ - Will not modify the build-loop plugin repo
284
+ - Will not promote skills across projects without explicit user approval
285
+ - Will not run if state.json has < 3 runs — insufficient signal
286
+ - Will not retry pattern detection more than once per run
287
+ - Will not write skills for patterns with confidence "low"
288
+
289
+ ## Model Tiering (this skill)
290
+
291
+ | Step | Agent / Model |
292
+ |---|---|
293
+ | 1. Detect | recurring-pattern-detector (haiku) |
294
+ | 3. Draft | self-improvement-architect (sonnet) |
295
+ | 4. Signoff | build-orchestrator (opus 4.7) |
296
+ | 6. Notify | inline, no model |
297
+
298
+ Haiku detect is the floor — scanning JSON for counts. Sonnet drafts because authoring SKILL.md needs judgment about trigger phrases and structure. Opus 4.7 signs off because a bad experimental skill silently contaminates future runs; wrong spec is catastrophic.