@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,172 @@
1
+ <!-- SPDX-FileCopyrightText: 2025-2026 Tyrone Ross, Jr <46267523+tyroneross@users.noreply.github.com> | SPDX-License-Identifier: Apache-2.0 -->
2
+
3
+ # Supabase Auth
4
+
5
+ ## When to use
6
+
7
+ - **Legacy projects** already on Supabase — keep them there unless there's a compelling reason to migrate
8
+ - **Single-project apps** where Supabase's bundled Postgres + Storage + Realtime + Auth justify the lock-in
9
+ - **Edge-function-heavy** workloads where Supabase Auth's JWT verification at the edge is convenient
10
+
11
+ For new Next.js projects, the documented stack default is **Neon + Better Auth + Drizzle** instead — see `better-auth-setup.md`. Supabase Auth across multiple projects gets expensive (per-project pricing) and the SSR cookie story has been brittle (see breaking change below).
12
+
13
+ For runtime API doc lookups, use `mcp__plugin_context7_context7__query-docs` with library `/supabase/supabase`.
14
+
15
+ ## When Supabase Auth vs Better Auth — decision
16
+
17
+ | Need | Pick |
18
+ |---|---|
19
+ | Brand-new project, Next.js, single repo | **Better Auth + Neon + Drizzle** (Example Web App migrated TO this) |
20
+ | Existing project on Supabase, working fine | **Stay on Supabase** — migration cost > benefit |
21
+ | Multi-project portfolio (3+ apps) | **Better Auth** — per-project Supabase cost adds up |
22
+ | Edge functions doing JWT verification on every request | **Supabase** — built-in JWT verification at the edge |
23
+ | Need Postgres RLS policies as the auth boundary | **Supabase** (or Better Auth + manual `dbForUser` IDOR guard — see `better-auth-setup.md`) |
24
+ | Complex social provider config (Apple iOS native, etc.) | **Better Auth** — more flexible plugin surface |
25
+ | Mobile native app with offline session persistence | Either — Supabase has the JWT story; Better Auth has the Bearer plugin |
26
+
27
+ ## ⚠️ SSR ≥0.3 breaking change — `getAll` / `setAll`
28
+
29
+ The single biggest gotcha. `@supabase/ssr` versions before 0.3 used per-cookie `get`/`set`/`remove`; 0.3+ requires a unified `getAll`/`setAll` interface. Code that worked in dev with an old version will fail in prod with the new version — **and the failure mode is a silent session loss**, not a thrown error.
30
+
31
+ ### Old (broken on ≥0.3)
32
+
33
+ ```ts
34
+ // ❌ DO NOT use on @supabase/ssr ≥0.3
35
+ const supabase = createServerClient(url, key, {
36
+ cookies: {
37
+ get(name) { return cookieStore.get(name)?.value },
38
+ set(name, value, options) { cookieStore.set({ name, value, ...options }) },
39
+ remove(name, options) { cookieStore.set({ name, value: '', ...options }) },
40
+ },
41
+ })
42
+ ```
43
+
44
+ ### New (correct)
45
+
46
+ ```ts
47
+ // ✅ @supabase/ssr ≥0.3
48
+ import { createServerClient } from '@supabase/ssr'
49
+ import { cookies } from 'next/headers'
50
+
51
+ export async function createClient() {
52
+ const cookieStore = await cookies()
53
+ return createServerClient(
54
+ process.env.NEXT_PUBLIC_SUPABASE_URL!,
55
+ process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
56
+ {
57
+ cookies: {
58
+ getAll() {
59
+ return cookieStore.getAll()
60
+ },
61
+ setAll(cookiesToSet) {
62
+ try {
63
+ cookiesToSet.forEach(({ name, value, options }) =>
64
+ cookieStore.set(name, value, options)
65
+ )
66
+ } catch {
67
+ // Called from a Server Component — middleware will refresh sessions instead.
68
+ }
69
+ },
70
+ },
71
+ }
72
+ )
73
+ }
74
+ ```
75
+
76
+ If you see "session not persisting after sign-in", "logged out after refresh", or RSC-only auth working but route handlers losing the session — check this first.
77
+
78
+ ## Browser client
79
+
80
+ ```ts
81
+ // lib/supabase-browser.ts
82
+ import { createBrowserClient } from '@supabase/ssr'
83
+
84
+ export function createBrowserSupabase() {
85
+ return createBrowserClient(
86
+ process.env.NEXT_PUBLIC_SUPABASE_URL!,
87
+ process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!
88
+ )
89
+ }
90
+ ```
91
+
92
+ ## Env-var validation — warn, don't fail (example-app pattern)
93
+
94
+ Useful when Supabase is optional infrastructure and you want CI / preview envs without a real backend. From `example-app/lib/supabase.ts`:
95
+
96
+ ```ts
97
+ const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL || 'https://placeholder.supabase.co'
98
+ const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY || 'placeholder_key'
99
+
100
+ const validateSupabaseConfig = () => {
101
+ const hasValidUrl =
102
+ process.env.NEXT_PUBLIC_SUPABASE_URL &&
103
+ process.env.NEXT_PUBLIC_SUPABASE_URL !== 'your_supabase_project_url' &&
104
+ process.env.NEXT_PUBLIC_SUPABASE_URL !== 'https://placeholder.supabase.co'
105
+ const hasValidKey =
106
+ process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY &&
107
+ process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY !== 'your_supabase_anon_key'
108
+
109
+ if (!hasValidUrl || !hasValidKey) {
110
+ console.warn('Supabase configuration not properly set up. Database features will not work.')
111
+ return false
112
+ }
113
+ return true
114
+ }
115
+
116
+ export const supabase = createClient(supabaseUrl, supabaseAnonKey)
117
+
118
+ // Then in every operation:
119
+ async function getThing() {
120
+ if (!validateSupabaseConfig()) return [] // graceful no-op, not a crash
121
+ // ... real query ...
122
+ }
123
+ ```
124
+
125
+ Trade-off: this hides config errors that should be surfaced. Prefer this only for genuinely-optional features (e.g., user-saved data when the app is also useful unauthenticated). For required auth, fail at boot — silent fallback is worse than a clear error.
126
+
127
+ ## RLS as the auth boundary
128
+
129
+ Supabase's pitch is "let RLS do the auth check, pass the user JWT to Postgres, never write `dbForUser` wrappers." When it works, it's elegant:
130
+
131
+ ```sql
132
+ -- Example RLS policy
133
+ create policy "users_own_camps" on camps
134
+ for all
135
+ using (auth.uid() = user_id)
136
+ with check (auth.uid() = user_id);
137
+ ```
138
+
139
+ Footguns:
140
+ 1. **Service-role queries bypass RLS by design.** Easy to accidentally use the service-role key in a route handler thinking you're being efficient — that's an IDOR.
141
+ 2. **`anon` role policies are public.** A misconfigured `select` policy on `anon` makes the table world-readable.
142
+ 3. **RLS errors look like "row not found".** `select * where id = X` returns `[]` if RLS denies, not a permission error. Confusing.
143
+ 4. **Migration ordering matters.** Add RLS policies BEFORE inserting prod data; enabling RLS on a populated table without policies locks it.
144
+
145
+ If you adopt RLS, run a periodic audit: log every distinct combination of (table, role, command) the app actually uses, then assert each is policy-covered.
146
+
147
+ ## Migrating away from Supabase Auth
148
+
149
+ Example Web App migrated `@supabase/ssr` → Better Auth. Pattern:
150
+
151
+ 1. Stand up Better Auth in parallel (keeps Supabase running)
152
+ 2. Migrate user records via a one-time script (account, session, verification tables)
153
+ 3. Switch the route handler from Supabase callbacks to `app/api/auth/[...all]/route.ts`
154
+ 4. Delete Supabase-specific cookie code
155
+ 5. Replace RLS-based auth with `dbForUser(userId)` IDOR wrapper (see `better-auth-setup.md`)
156
+
157
+ The biggest risk is in step 2 — schema mismatch. Better Auth's user/account/session tables don't map 1:1 to Supabase auth schema. Test on a copy of prod first.
158
+
159
+ ## Verification
160
+
161
+ 1. Sign up with email/password (or magic-link / social, depending on config)
162
+ 2. Hard refresh the page — confirm session persists (this is the SSR cookie test)
163
+ 3. Open in a new tab — confirm session persists across tabs
164
+ 4. Sign out — confirm cookies cleared and protected pages redirect
165
+ 5. Confirm `auth.uid()` works inside SQL via the SQL editor (`select auth.uid()`)
166
+ 6. If using RLS: pick one protected table and confirm with `anon` role that it returns `[]`, with authenticated role that it returns owned rows only
167
+
168
+ ## Cross-references
169
+
170
+ - Universal footgun #11 (cookie config) in `../SKILL.md`
171
+ - `better-auth-setup.md` — the recommended alternative for new projects
172
+ - For the Example Web App migration narrative, see `lessons-example-web-app-better-auth.md`
@@ -0,0 +1,419 @@
1
+ ---
2
+ name: auto-decision-capture
3
+ description: Project-scoped skill for proactive in-session decision capture. Provides Claude the signal taxonomy, confidence ladder, overwrite rules, and the three extraction prompts (SPO triplet / MADR-aligned / batch consolidation) so substantive decisions land in build-loop-memory without manual triggering. Use when the user makes a substantive choice, confirms a proposal, or implies a constraint with textual evidence.
4
+ user-invocable: false
5
+ when_to_use: |
6
+ - User issues a direct verbal marker ("let's go with X", "ship it", "use Y")
7
+ - Claude offered a choice menu and the user picked one
8
+ - User accepts a proposal Claude wrote (action-confirmation)
9
+ - Topic shifts past a proposal that stood without objection (continuation)
10
+ - User states a project-scoped constraint, preference, or convention
11
+ - Topic-coherent inference can be drawn with quotable evidence (tier 3)
12
+ namespace: build-loop-memory/projects/<project>/decisions/
13
+ companion_scripts:
14
+ - scripts/write_decision/__main__.py — atomic writer (file + INDEX + events.jsonl + DB)
15
+ - scripts/scan_transcript_for_decisions.py — Stop-hook batch sweep (tier 3)
16
+ - scripts/supersede_decision.py — explicit replacement
17
+ - scripts/revoke_decision.py — explicit withdrawal
18
+ - scripts/recall.py — "have we decided this before?" lookup
19
+ ---
20
+
21
+ <!-- SPDX-FileCopyrightText: 2025-2026 Tyrone Ross, Jr <46267523+tyroneross@users.noreply.github.com> | SPDX-License-Identifier: Apache-2.0 -->
22
+
23
+ # auto-decision-capture — proactive decision capture during sessions
24
+
25
+ This skill makes Claude an active participant in maintaining the project's
26
+ decision log. The user does not have to remember to write decisions, and
27
+ does not have to invoke a slash command. When evidence is in the
28
+ conversation, Claude writes; when evidence is weak, the end-of-session
29
+ Stop hook batches inferences for review.
30
+
31
+ ## Core principle: signal-based, NOT turn-counted
32
+
33
+ There is no "wait N turns" rule. The threshold is **"is there textual
34
+ evidence?"**, not "have we waited long enough?". Every capture must
35
+ trace to a quote, an action, or a topic transition. No speculation
36
+ without a concrete signal.
37
+
38
+ ## Signal taxonomy and confidence ladder
39
+
40
+ | Signal | Confidence | Write target | Write timing | Example |
41
+ |---|---|---|---|---|
42
+ | **Direct verbal marker (user)** | `explicit` | trusted (`build-loop-memory/projects/<project>/decisions/`) | immediately on user turn | "let's go with X" / "ship it" / "use Y" |
43
+ | **Choice converter** | `explicit` | trusted | immediately | Claude offered A/B/C; user said "B" |
44
+ | **Implementation declarative (agent)** | `explicit` | trusted | when stated in agent reasoning | "I'll use X for Y", "going with X over Y because Z", "implementing via X". For build-orchestrator subagents specifically — task-execution language IS a decision signal. |
45
+ | **Tradeoff statement** | `explicit` | trusted | when "X over Y because Z" appears | "extend YAML parser instead of changing test expectations" / "use X (Apache-2.0) over Y (GPL-3) because licensing" |
46
+ | **Threshold/parameter declaration with rationale** | `explicit` | trusted | when a numeric/named value is bound to reasoning | "cosine 0.85 because design ref §12 cites Mem0/Zep production consensus" / "default budget 25s leaves headroom on cold qwen3:8b" |
47
+ | **Default-value selection** | `confirmed` | trusted | when a default is declared | "default: `claude-opus-4-7` (current top model)" / "fall back to ollama on MLX failure" |
48
+ | **Action-confirmation (user)** | `confirmed` | trusted | after action accepted | Claude proposed → wrote code → user accepted without reverting |
49
+ | **Continuation pattern** | `confirmed` | trusted | when topic shifts past decision | proposal stood while conversation moved on |
50
+ | **Topic-coherent inference** | `inferred` | trusted, **overwriteable** | aggressive — written during session | Claude pattern-matched a position; user did not object but did not endorse |
51
+ | **Pure pattern-match from prior conversation** | `assumed` | trusted, **overwriteable** | aggressive — written during session | inferred from past decisions or memory |
52
+
53
+ **Note on agent-style language (build-orchestrator subagents, implementer subagents).** Task-execution language ("I'll add X", "extending Y", "default to Z") is just as much a decision signal as user-conversational language ("let's use Y"). Earlier versions of this skill under-captured agent decisions because the patterns were tuned only for user-Claude back-and-forth. The three middle rows above (Implementation declarative / Tradeoff / Threshold) are the explicit fix. **If you are reasoning as a subagent and you make any of those moves, capture it.**
54
+
55
+ **Tier 1 + 2 (explicit + confirmed) live captures during the session.**
56
+ Use `scripts/write_decision/__main__.py` directly with `--confidence explicit` or
57
+ `--confidence confirmed`. Set `--source auto-explicit` or
58
+ `--source auto-confirmed` so the capture is distinguishable from manual
59
+ human entries.
60
+
61
+ **Tier 3 + 4 (inferred + assumed) batch sweeps at session end** via the
62
+ Stop hook. The hook runs `scripts/scan_transcript_for_decisions.py`,
63
+ which calls a local LLM (`qwen3:8b-q4_K_M`) with Prompt C below. Tier 3
64
+ results land in `build-loop-memory/projects/<project>/decisions/_review/` for user promotion,
65
+ NOT in the trusted set.
66
+
67
+ You can also write tier-3 captures aggressively in-session if a
68
+ topic-coherent inference is strong. Old `inferred` of the same
69
+ `primary_tag + entity` is overwritten by the next signal — see
70
+ "Overwrite rules" below.
71
+
72
+ ## Overwrite rules
73
+
74
+ Written into `write_decision.py`'s topic-identity supersession path
75
+ (`primary_tag + entity` is the topic key):
76
+
77
+ - Higher-confidence auto-supersedes lower (prior moves to `_history/<id>-vN.md`)
78
+ - Equal-confidence requires `--supersedes <id>` flag (refuse otherwise)
79
+ - Lower-confidence cannot displace higher (refused with exit 1)
80
+ - `inferred` and `assumed` captures are overwriteable by any newer signal of
81
+ equal or higher confidence on the same topic
82
+
83
+ This is the safety mechanism that lets you capture aggressively without
84
+ poisoning the trusted set: a wrong inferred capture is corrected by the
85
+ next contradicting signal.
86
+
87
+ ## What gets captured (positive evidence required)
88
+
89
+ - Decisions: choice + rationale + alternatives that were on the table + provenance
90
+ - Project-scoped constraints, preferences, conventions stated as durable
91
+ - Tooling/library/architecture choices with rationale
92
+
93
+ ## What does NOT get captured
94
+
95
+ - Brainstorming that did not converge
96
+ - Questions the user asked Claude
97
+ - One-off corrections to a single response (these are feedback, not decisions)
98
+ - Anything Claude "thinks the user would want" without textual evidence
99
+ - Sensitive or volatile content where the user has not signaled durability
100
+
101
+ **No sensitivity-keyword filter.** Per project direction, capture any
102
+ decision the user makes regardless of topic. The user can revoke any
103
+ capture with `scripts/revoke_decision.py --id <id> --reason ...`.
104
+
105
+ ## Tag selection — controlled vocabulary
106
+
107
+ Tags come from `write_decision.py`'s controlled vocabulary. New tags get the `proposed:`
108
+ prefix (e.g. `proposed:streaming-llm`), surfaced for promotion in the
109
+ next Phase 1 Assess. Do not invent tags outside this vocabulary —
110
+ vocabulary mismatch is the dominant retrieval failure mode.
111
+
112
+ ## How to capture (live, during the session)
113
+
114
+ ```bash
115
+ python3 scripts/write_decision/__main__.py \
116
+ --workdir "$PWD" \
117
+ --title "<one-line title>" \
118
+ --decision "<one-sentence decision>" \
119
+ --context "<1-3 sentences>" \
120
+ --alternatives "<options considered>" \
121
+ --consequences "<1-3 bullets>" \
122
+ --tags "tooling,testing" \
123
+ --primary-tag "testing" \
124
+ --entity "<scope: project name or module>" \
125
+ --confidence explicit \
126
+ --source auto-explicit \
127
+ --captured-turn-excerpt "<≤200 chars from the user's turn>" \
128
+ --tool claude-code \
129
+ --model claude-opus-4-7 \
130
+ --task-category bugfix \
131
+ --author auto
132
+ ```
133
+
134
+ ### v2 metadata fields (skill-driven captures)
135
+
136
+ Frontmatter v2 (added 2026-05-04, design §15) attaches five required
137
+ fields and four optional fields to every decision. The writer applies
138
+ sensible defaults so legacy callers still work, but skill-driven
139
+ captures should set these explicitly when the signal is clear:
140
+
141
+ | Field | Skill default | Example | When to override |
142
+ |---|---|---|---|
143
+ | `--tool` | `claude-code` (Stop hook fires inside Claude Code) | `claude-code` | If the conversation references another tool authoring the decision (rare) |
144
+ | `--model` | `claude-opus-4-7` (or `$CLAUDE_MODEL`) | `claude-sonnet-4-6` | When you know the active sub-agent's model |
145
+ | `--author` | `auto` (skill-driven captures) | `auto` | Always `auto` for in-session skill writes |
146
+ | `--project` | derived from entity prefix or `$CLAUDE_PROJECT_DIR` | `build-loop` | Almost never; the default is right |
147
+ | `--task-category` | `unknown` if no signal | `bugfix`, `feature`, `refactor`, `research`, `docs`, `migration`, `experiment`, `config` | **Set explicitly** whenever the conversational signal is clear (user said "fix this bug" → `bugfix`; "add this feature" → `feature`; "investigate why X" → `research`) |
148
+ | `--files-touched` | `[]` (or `--infer-files-touched` for git diff) | `src/auth/session.ts,src/auth/middleware.ts` | When the decision is bound to a specific file set |
149
+
150
+ **Inferring `task_category` from the conversation** — pick the strongest
151
+ signal:
152
+
153
+ - "fix the bug where…" / "this error…" / "broken since…" → `bugfix`
154
+ - "add the X feature" / "build a new…" / "implement…" → `feature`
155
+ - "clean up…" / "extract…" / "rename…" without behavior change → `refactor`
156
+ - "investigate / understand / what's the best way" → `research`
157
+ - "update the docs" / "README" / "changelog" → `docs`
158
+ - "migrate from X to Y" / "schema change" → `migration`
159
+ - "try / spike / experiment" → `experiment`
160
+ - env vars / settings / runtime config → `config`
161
+ - everything else → `unknown` (let the user override later via `/knowledge:review`)
162
+
163
+ ### v3 metadata fields (skill-driven captures, design §16)
164
+
165
+ Frontmatter v3 (added 2026-05-04) adds seven more fields. The writer fills
166
+ sensible defaults, but skill-driven captures should set the three that
167
+ benefit from conversational signal:
168
+
169
+ | Field | Skill default | When to override |
170
+ |---|---|---|
171
+ | `--confidence-source` | `user_statement` if confidence=`explicit` AND a verbal marker / quote is captured; else `ai_inference` | Set explicitly whenever you can attribute the assertion. `user_statement` for direct quotes ("let's go with X"); `ai_inference` for topic-coherent inferences; `tool_extraction` if the value came from a deterministic tool output rather than the conversation |
172
+ | `--domain` | `unknown` | **Set explicitly** when the conversational scope is clear: `ui` for visual / interaction work, `api` for endpoint contracts, `data` for storage layer, `search` for retrieval / recall / indexing, `auth` for identity / permissions, `build` for compilation / packaging / CI, `infra` for deploy / hosting / runtime, `tooling` for dev workflow / CLI / linters, `docs` for documentation, `test` for test-suite work, `meta` for cross-cutting / process / architecture |
173
+ | `--goal` | `unknown` | **Set explicitly** when the user's framing makes intent clear: `user-value` for end-user-visible improvements, `reliability` for bug fixes / robustness, `performance` for speed / cost / efficiency, `security` for hardening, `dev-velocity` for developer-experience gains, `maintainability` for refactor / readability, `compliance` for regulated requirements, `learning` for spike / explore |
174
+ | `--confirmation-count` | `0` | Almost never override at write time — the bumper hook (future) increments this on successful action |
175
+ | `--valid-until` | `null` | Set when the decision is bound to a date — quarterly OKR, vendor contract end, model deprecation |
176
+ | `--causal-parent-id` | `null` | Set when this decision is downstream of a specific prior decision (use the 4-digit id) |
177
+ | `--embedding-model-version` | `$EMBED_MODEL` env or `mxbai-embed-large-v1` | Almost never override; the writer reads the active backend automatically |
178
+
179
+ **Examples — `domain` and `goal` from conversational context:**
180
+
181
+ | User said | `domain` | `goal` |
182
+ |---|---|---|
183
+ | "fix this bug in the search retrieval" | `search` | `reliability` |
184
+ | "speed up the homepage loader" | `ui` | `performance` |
185
+ | "rotate the API keys before Friday" | `auth` | `security` |
186
+ | "rewrite the auth middleware to be testable" | `auth` | `maintainability` |
187
+ | "add a CSV export to the dashboard" | `ui` | `user-value` |
188
+ | "investigate which queue library to use" | `infra` | `learning` |
189
+ | "update the CONTRIBUTING.md" | `docs` | `dev-velocity` |
190
+ | "tighten the lint rules" | `tooling` | `maintainability` |
191
+
192
+ When in doubt, leave them as `unknown` rather than guess — the user can
193
+ backfill via `/knowledge:review`.
194
+
195
+ **`confidence_source` — when to set what:**
196
+
197
+ - Direct verbal marker (the user typed it) → `user_statement`
198
+ - Choice converter (Claude offered A/B/C, user picked one) → `user_statement`
199
+ - Action confirmation (user did the thing Claude proposed) → `user_statement`
200
+ - Topic-coherent inference (no direct quote, but the topic stood) → `ai_inference`
201
+ - Pulled from external memory / migration import / vector-DB sync → `external_import`
202
+ - Deterministic tool output (e.g., `git log`, `grep`) → `tool_extraction`
203
+ - Genuinely cannot tell → `unknown`
204
+
205
+ Output is the new 4-digit decision ID on stdout (e.g. `0042`). Errors go
206
+ to stderr.
207
+
208
+ For supersession (a new decision replaces an old one):
209
+ ```bash
210
+ python3 scripts/supersede_decision.py \
211
+ --old-id 0042 \
212
+ --new-decision "..." \
213
+ --new-title "..." \
214
+ --tags "..." --primary-tag "..." --entity "..." \
215
+ --confidence explicit \
216
+ --rationale "Why we changed our mind"
217
+ ```
218
+
219
+ For revocation (the captured decision was wrong, no replacement):
220
+ ```bash
221
+ python3 scripts/revoke_decision.py \
222
+ --id 0042 \
223
+ --reason "user clarified this was venting, not a decision"
224
+ ```
225
+
226
+ For lookup before writing (avoid duplicates):
227
+ ```bash
228
+ python3 scripts/recall.py --query "test framework"
229
+ ```
230
+
231
+ ## Extraction prompts (inline reference)
232
+
233
+ These three prompts are the canonical extraction templates from
234
+ `~/dev/research/topics/repo-episodic-memory-framework/repo-episodic-memory-framework.md` §12.
235
+ Use them whenever you need to extract structured decisions from
236
+ unstructured conversation. Keep temperature low (0.1–0.3).
237
+
238
+ ### Prompt A — Subject-Predicate-Object triplet extraction
239
+
240
+ ```
241
+ Extract facts from the user's conversational decisions. Output JSON array.
242
+ Each fact: subject (who/what), predicate (relationship), object (value).
243
+
244
+ Example:
245
+ Input: "We'll use pytest for testing from now on."
246
+ Output: [{"subject":"this_project","predicate":"testing_framework",
247
+ "object":"pytest","confidence":"explicit",
248
+ "entity_type":"tool","tags":["tooling","testing"]}]
249
+
250
+ Rules:
251
+ - confidence: explicit | confirmed | inferred | assumed
252
+ - entity_type: tool | process | library | constraint | preference | architecture
253
+ - tags: from controlled vocabulary {{taxonomy_tags}}
254
+ - Do NOT infer beyond textual evidence.
255
+ ```
256
+
257
+ ### Prompt B — Decision + rationale (MADR-aligned, single decision)
258
+
259
+ ```
260
+ Extract a decision the user made or implied. Output JSON object.
261
+
262
+ Schema: {decision_title, context, alternatives_considered[],
263
+ chosen, rationale, confidence, primary_tag}
264
+
265
+ Rules:
266
+ - rationale MUST have textual evidence; otherwise mark "inferred"
267
+ - If user did not explicitly choose, confidence is "inferred" at best
268
+ - primary_tag is singular; pick most relevant
269
+ ```
270
+
271
+ ### Prompt C — End-of-session batch consolidation (tier 3 sweep)
272
+
273
+ ```
274
+ Scan the conversation transcript. Identify 2–4 decisions the user made
275
+ implicitly. For each, output:
276
+
277
+ [{decision, evidence (exact quote or turn range),
278
+ confidence: inferred|assumed,
279
+ may_be_superseded_by: null or prior decision ID}]
280
+
281
+ Existing decisions: {{prior_decisions_summary}}
282
+
283
+ Rules:
284
+ - Only capture if there is textual signal. No speculation.
285
+ - Flag supersessions for human review.
286
+ ```
287
+
288
+ ## Dedup thresholds (when comparing against prior captures)
289
+
290
+ | Cosine similarity | Same (subject, predicate)? | Action |
291
+ |---|---|---|
292
+ | ≥ 0.90 | yes, near-identical object | IGNORE (already known) |
293
+ | 0.85–0.90 | yes, slight phrasing variation | MERGE (use supersession) |
294
+ | 0.75–0.85 | related but different predicates | INSERT (keep both) |
295
+ | < 0.75 | unrelated | INSERT |
296
+
297
+ `write_decision.py` handles the topic-identity match (primary_tag + entity);
298
+ the cosine threshold matters for the end-of-session batch sweep
299
+ (`scripts/scan_transcript_for_decisions.py` consults `semantic_facts`
300
+ before writing).
301
+
302
+ ## End-of-session sweep — automatic via Stop hook
303
+
304
+ The Stop hook in `hooks/hooks.json` invokes
305
+ `scripts/scan_transcript_for_decisions.py` against
306
+ `$CLAUDE_TRANSCRIPT_PATH`. The script:
307
+
308
+ 1. Reads the transcript JSONL
309
+ 2. Calls `qwen3:8b-q4_K_M` with Prompt C (above)
310
+ 3. For each candidate: dedups against `semantic_facts` (≥0.85 = SKIP)
311
+ 4. Tier 1+2 (explicit+confirmed) → `write_decision.py` → trusted
312
+ 5. Tier 3+4 (inferred+assumed) → `build-loop-memory/projects/<project>/decisions/_review/` quarantine
313
+
314
+ If ollama is unreachable, the hook logs a no-op and exits 0 — never
315
+ fails the session.
316
+
317
+ ### Per-session opt-out
318
+
319
+ Create `.build-loop/.no-capture` to skip the auto-capture sweep for the
320
+ current session. The script exits 0 immediately on startup with a log
321
+ line. Remove the file when you want the sweep back on:
322
+
323
+ ```bash
324
+ touch .build-loop/.no-capture # disable for this session
325
+ rm .build-loop/.no-capture # re-enable
326
+ ```
327
+
328
+ This is a per-repo flag; it does not affect other projects.
329
+
330
+ ### Hardening contract (Stop-hook safety)
331
+
332
+ The script self-imposes guardrails so the Stop hook never disrupts a
333
+ coding session:
334
+
335
+ - **Wall-clock budget** — default 25s, override with env `SCAN_BUDGET_S`.
336
+ Checked before the LLM call and between writes. On overrun the script
337
+ logs `budget exceeded` and exits 0 with whatever was already written.
338
+ The hook timeout (60s) is a backstop; the budget should always fire
339
+ first.
340
+ - **Single-flight lock** — `fcntl.flock` on `/tmp/build-loop-scan.lock`
341
+ (override with `--lock-file`). A second concurrent invocation exits 0
342
+ immediately with a log line. Prevents contention when sessions end
343
+ close together.
344
+ - **Output suppression** — the hook command redirects stdout and stderr
345
+ to `/dev/null`. The durable record is the log file at
346
+ `${XDG_STATE_HOME}/build-loop/scan.log` (default
347
+ `~/.local/state/build-loop/scan.log`). Override with `--log-file`. The
348
+ log file auto-rotates when it exceeds 10 MB (last 1 MB kept).
349
+
350
+ ## Confidence floor at retrieval
351
+
352
+ `write_decision.py`'s INDEX regenerator filters by `confidence >= confirmed`
353
+ by default. Tier 3 entries written aggressively in-session do appear in
354
+ the trusted directory but are filtered out of the default INDEX view.
355
+ Phase 1 Assess loads only `explicit + confirmed` unless you explicitly
356
+ search at lower confidence.
357
+
358
+ ## When in doubt
359
+
360
+ 1. If the user's turn contains a clear verbal marker → capture as `explicit`
361
+ 2. If the user accepted Claude's proposal and the topic moved on → capture as `confirmed`
362
+ 3. If you can quote evidence but the user did not endorse → capture as `inferred`
363
+ 4. If you can only pattern-match prior context → either skip, or capture as `assumed` knowing it will be overwritten
364
+
365
+ When unsure between two confidence levels, pick the lower. The system
366
+ self-heals as more signal arrives.
367
+
368
+ ## When the user runs `/knowledge:review`, surface…
369
+
370
+ The review surface (loaded by `build-loop:knowledge-review`, backed by
371
+ `scripts/knowledge_review.py`) shows four sections of decisions and
372
+ procedures awaiting human attention:
373
+
374
+ 1. **Review queue** — tier-3 / inferred captures sitting in
375
+ `build-loop-memory/projects/<project>/decisions/_review/` (written there by either the Stop-hook
376
+ batch sweep or in-session aggressive `inferred` captures from this
377
+ skill). User promotes or dismisses each.
378
+ 2. **Decision rot** — accepted decisions where `last_validated` (or
379
+ `date` if absent) is older than 90 days. User marks-validated,
380
+ supersedes, or revokes. Long-running decisions accumulate rot until
381
+ touched.
382
+ 3. **Open conflicts** — `fact_conflicts` rows (resolved=FALSE) created
383
+ when `consolidate_memory.py` detected two semantic facts with the
384
+ same `(subject, predicate, confidence)` but different `object`. User
385
+ resolves by superseding one.
386
+ 4. **Stale procedures** — procedure files whose `depends_on` symbols
387
+ are no longer present in the codebase (run by
388
+ `procedural_governance.py --mode validate-symbols`).
389
+
390
+ **Cross-reference**: when this skill writes aggressively at tier 3
391
+ (`inferred`) and the same `primary_tag + entity` keeps getting
392
+ overwritten, that's a signal the user's intent is unstable. The
393
+ review queue surfaces it; the user takes the explicit decision and
394
+ pins it. The overwrite path then stops firing.
395
+
396
+ Consolidation (`scripts/consolidate_memory.py`) is the related batch
397
+ script for promoting candidate JSONL entries into
398
+ `semantic_facts`.
399
+
400
+ ## Corrections + lessons (companion stack)
401
+
402
+ This skill captures **decisions** inline during a session. The companion
403
+ correction-aware capture stack — `scripts/scan_corrections/` (tier-1
404
+ deterministic Stop hook), `scripts/surface_pending_lessons.py` (tier-3
405
+ host-agent surface), and `scripts/bridge_lesson_to_harness.py` (store
406
+ mirror) — captures **corrections, preferences, and lessons** at session
407
+ boundaries, with no Ollama dependency. Full design:
408
+ `skills/build-loop/references/correction-aware-capture.md`.
409
+
410
+ When the user corrects an action you just took ("revert that", "don't do
411
+ X", "use Y instead of Z"), the tier-1 scanner writes a raw candidate to
412
+ `.build-loop/pending-lessons/`. At the next SessionStart, the host coding
413
+ agent — you — reads `surface_pending_lessons.py` output, classifies each
414
+ candidate, and promotes via `scripts/memory_writer.py --type lesson|feedback`
415
+ (global lane: `build-loop-memory/lessons/`; project lane:
416
+ `build-loop-memory/projects/<slug>/lessons/`). The two paths are
417
+ complementary: this skill catches what you can see during the turn; the
418
+ companion catches what the deterministic scanner can find at the end of
419
+ the session.