@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,106 @@
1
+ <!-- SPDX-FileCopyrightText: 2025-2026 Tyrone Ross, Jr <46267523+tyroneross@users.noreply.github.com> | SPDX-License-Identifier: Apache-2.0 -->
2
+
3
+ # MCP Security Model — stage-aware controls
4
+
5
+ Derived from the NSA paper *"MCP: Security Design Considerations"* (May 2026) and the OWASP LLM / Agentic Top 10. This reference is the **rubric** the mcp-builder skill runs as a preflight and the `security-reviewer` agent grades against.
6
+
7
+ > Source note: the control split and decision-table cells were specified by the build-loop plan that introduced this file, then cross-checked against the NSA paper directly (2026-05-22). The attack-class table and Tier 1/Tier 2 controls are faithful to the paper's documented concerns.
8
+
9
+ ## What the NSA paper documents (attack classes)
10
+
11
+ | Attack class | What it is |
12
+ |---|---|
13
+ | Parameter injection | Untrusted/ambiguous input forwarded into a tool's typed parameters, escaping the intended instruction/data boundary |
14
+ | Toolchain pivot / naming collision | A malicious or look-alike tool registers a colliding name, so calls intended for a trusted tool route to a parasitic one |
15
+ | CVE-2025-49596 (RCE) | A remote-code-execution vulnerability in **MCP-Inspector**, the MCP-server testing toolchain: it accepted unverified inputs, letting a crafted message trigger RCE. Fixed in version 0.14.1. The paper cites it as proof that well-known weaknesses resurface when AI toolchains skip security hygiene. |
16
+ | Missing RBAC | No access-control layer; any caller gets any tool at full privilege |
17
+ | Opaque approval drift | The set of capabilities a server exposes changes over time without a re-approval workflow, so the user's original consent silently no longer matches reality |
18
+
19
+ ## Output contract
20
+
21
+ mcp-builder emits a checklist split into two lists:
22
+
23
+ - **"Mandatory for this build"** — all of Tier 1, plus every Tier 2 cell that resolved to `mandatory-now`.
24
+ - **"Plan-now, deferred"** — every Tier 2 cell that resolved to `design-now-implement-later` (interface stubbed, trust boundary documented, implementation deferred).
25
+
26
+ The checklist is **advisory**. It routes to the build-loop run report (Notes from judges / `state.json`). It is **never** an `AskUserQuestion` and **never** a hard gate — per build-loop's "advisory checks are automated" rule.
27
+
28
+ ---
29
+
30
+ ## Tier 1 — always mandatory
31
+
32
+ These apply to **every** MCP server regardless of app type or dev stage — including a throwaway consumer prototype. They are cheap, and skipping them is the difference between "small bug" and "RCE".
33
+
34
+ 1. **JSON-schema parameter validation.** Every tool's `inputSchema` is a strict, specific JSON Schema. Validate arguments against it before the tool body runs. Reject on mismatch.
35
+ 2. **Block parameter forwarding from ambiguous/user-supplied sources.** Never pass a raw user string, prompt fragment, or unvalidated LLM output straight into a tool parameter that reaches a filesystem path, shell, URL, query, or another tool. Re-derive the value from a trusted, typed source.
36
+ 3. **Insecure-deserialization hygiene.** No `pickle`, no `eval`-backed parsers, no `Function(...)` over inbound data. Deserialize only with schema-bound, format-restricted parsers. (Part of the untrusted-input-reaches-executor class — the failure mode behind CVE-2025-49596.)
37
+ 4. **Unique / pinned tool identifiers.** Tool names are stable, namespaced, and collision-resistant. Pin the server identity. This is the naming-collision + parasitic-toolchain defense.
38
+ 5. **Tool-execution sandboxing.** Run tool bodies under least privilege — seccomp / AppArmor / a restricted user / a container — so a compromised tool cannot reach the host.
39
+ 6. **stderr-only logging.** `stdout` is the JSON-RPC channel. Anything else corrupts the protocol *and* can leak data into the transport.
40
+ 7. **No network at startup.** Do not validate credentials or call out in the constructor / `initialize`. Lazy-init on first tool call. (Also a load-time-latency fix.)
41
+ 8. **Treat every tool output as untrusted input to the next stage.** A tool's return value is attacker-influenceable. Validate it before it feeds a prompt, another tool, or a renderer. (Cascading-failure defense.)
42
+ 9. **Task / data isolation across trust zones — no shared mutable context.** Tools and connected servers must not blend context. A server only sees the data its current task needs; do not pass the whole client context to every server, and do not let one server's output silently become another's task input without origin + scope verification. This is the paper's *unverified task propagation* / cross-server context-bleed risk — demonstrated by the WhatsApp-MCP exploit, where a malicious server connected alongside a trusted one coerced the client into leaking message data. Per-task scoping also limits blast radius when a single server is compromised.
43
+
44
+ ---
45
+
46
+ ## Tier 2 — stage / type-gated decision table
47
+
48
+ Each control resolves to one of:
49
+
50
+ - `mandatory-now` — implement in this build.
51
+ - `design-now-implement-later` — document the trust boundary and stub the interface now; implement before the next stage.
52
+ - `optional` — defense-in-depth; note it, do not require it.
53
+
54
+ `app_type` ∈ {`consumer`, `enterprise`}. `stage` ∈ {`prototype`, `MVP`, `growth`, `production`}.
55
+
56
+ | Control | consumer / prototype | consumer / MVP | consumer / growth+prod | enterprise / prototype | enterprise / MVP | enterprise / growth | enterprise / production |
57
+ |---|---|---|---|---|---|---|---|
58
+ | Access control + RBAC | optional | optional | design-now-implement-later | design-now-implement-later | design-now-implement-later | mandatory-now | mandatory-now |
59
+ | Token lifecycle (refresh / revoke / rotate) | optional | design-now-implement-later | mandatory-now | design-now-implement-later | mandatory-now | mandatory-now | mandatory-now |
60
+ | Capability-change approval workflow | optional | optional | design-now-implement-later | optional | design-now-implement-later | mandatory-now | mandatory-now |
61
+ | Signed + replay-protected messages | optional | optional | optional | optional | design-now-implement-later | design-now-implement-later | mandatory-now |
62
+ | Audit-log depth (→ SIEM) | optional | optional | design-now-implement-later | design-now-implement-later | design-now-implement-later | mandatory-now | mandatory-now |
63
+ | Egress filtering proxy / DLP | optional | optional | optional | optional | design-now-implement-later | design-now-implement-later | mandatory-now |
64
+ | Local-only MCP instance for sensitive data | optional | optional | design-now-implement-later (if `data_sensitivity = high`) | design-now-implement-later | mandatory-now (if `data_sensitivity = high`) | mandatory-now (if `data_sensitivity = high`) | mandatory-now (if `data_sensitivity = high`) |
65
+ | Rate limiting / DoS protection | optional | design-now-implement-later | mandatory-now | design-now-implement-later | mandatory-now | mandatory-now | mandatory-now |
66
+
67
+ **Worked example — RBAC (the user's case).** A consumer-type server resolves RBAC to `optional`. An enterprise server still at MVP resolves it to `design-now-implement-later`: document the trust boundary, stub the RBAC interface, but do not block the MVP on a full implementation. An enterprise server in production resolves it to `mandatory-now`.
68
+
69
+ When `data_sensitivity = high`, escalate any `optional` cell in that control's row by one step (`optional` → `design-now-implement-later`, `design-now-implement-later` → `mandatory-now`).
70
+
71
+ ---
72
+
73
+ ## Signal inference rules (no config file)
74
+
75
+ `app_type`, `stage`, and `data_sensitivity` are **inferred from repo signals** — there is no security config file to author or maintain. Run these against the target repo:
76
+
77
+ ### app_type — `enterprise` vs `consumer`
78
+
79
+ `enterprise` if **either** holds; otherwise `consumer`:
80
+
81
+ - An auth library is present (`better-auth`, `@clerk/*`, `next-auth`, `@auth/*`, `passport`, `@supabase/auth-*`, `lucia`, …) **AND** multi-tenant signals exist: an `org` / `organization` / `team` / `workspace` / `tenant` table or model, or RBAC scaffolding (a `roles` / `permissions` / `policies` table, a `role`-typed column, a `casl` / `oso` / `permit` dependency).
82
+ - Regulated-data keywords appear in the repo: `HIPAA`, `SOC2`, `PCI`, `EHR`, `PHI`, `GDPR` with a DPA, or domain models clearly holding medical / financial / government records.
83
+
84
+ ### stage — `prototype` → `MVP` → `growth` → `production`
85
+
86
+ Derive from the *highest* tier whose signals are present:
87
+
88
+ | Stage | Signals |
89
+ |---|---|
90
+ | `prototype` | No tests, no CI config, no deploy manifest. Often a single dev. |
91
+ | `MVP` | A test directory with real tests, OR a CI workflow file (`.github/workflows/*`). |
92
+ | `growth` | CI **and** a deploy manifest (`vercel.json`, `railway.json`, `fly.toml`, `Dockerfile` + a deploy step), OR a staging environment. |
93
+ | `production` | All of the above **and** a monitoring SDK (`@sentry/*`, `posthog`, `datadog`, OpenTelemetry) **or** a live custom domain referenced in config. |
94
+
95
+ ### data_sensitivity — `high` vs `normal`
96
+
97
+ `high` if the repo handles PII, EHR/PHI, financial records, or secrets beyond its own service credentials — detected via table/model names (`patients`, `ssn`, `card_number`, `payment_methods`, `medical_*`), regulated-data keywords, or a secrets-management dependency wired to user data. Otherwise `normal`.
98
+
99
+ ---
100
+
101
+ ## How security-reviewer consumes this
102
+
103
+ When `triggers.riskSurfaceChange` is set **and** the diff introduces a new MCP server, the `security-reviewer` agent grades the diff against:
104
+
105
+ - **Tier 1** — always, every control. A missing Tier 1 control is at least `HIGH`.
106
+ - **Tier 2** — only the cells that the inferred `app_type` / `stage` / `data_sensitivity` resolved to `mandatory-now`. A missing `mandatory-now` control is a finding; a missing `design-now-implement-later` control is `LOW` (note it, do not block) provided the interface stub + boundary doc exist.
@@ -0,0 +1,216 @@
1
+ ---
2
+ name: model-tiering
3
+ description: Use when choosing a model tier for a subagent, deciding code-tier vs thinking-tier in frontmatter, or escalating mid-flow. Covers the multi-model abstraction — Opus/Sonnet/Haiku are Anthropic-default mappings; the tier abstraction is provider-portable.
4
+ user-invocable: false
5
+ ---
6
+
7
+ <!-- SPDX-FileCopyrightText: 2025-2026 Tyrone Ross, Jr <46267523+tyroneross@users.noreply.github.com> | SPDX-License-Identifier: Apache-2.0 -->
8
+
9
+ # Model Tiering — Authoritative Reference for Build-Loop
10
+
11
+ Governs model selection across all build-loop phases. Build-loop is **multi-model** — the role assignments below are tier-based (thinking / code / pattern), not provider-specific. Anthropic's Opus/Sonnet/Haiku is the default mapping; equivalents from other providers map to the same tiers.
12
+
13
+ Use `references/agent-role-taxonomy.md` for responsibility boundaries. This
14
+ skill answers "which tier should run the role?", not "who owns the work?".
15
+
16
+ ## Tier abstraction (canonical)
17
+
18
+ | Tier | Anthropic default | Role | Equivalents (advisory — verify benchmarks before swapping) |
19
+ |---|---|---|---|
20
+ | **Thinking** | Opus 4.7 | Synthesis, planning, ambiguity resolution, severity ranking, audit/learnings, cross-file judgment | GPT-5 Thinking, Gemini 2.5 Pro, future Claude tier; any model >= Opus 4.6 on SWE-bench Verified + Frontier-class on ARC-AGI / MMLU-Pro |
21
+ | **Code** | Sonnet 4.6 | Application — apply rule to bounded input, scoped implementation, adversarial critic, mechanical refactor | Sonnet 4.7+, GPT-5 Codex, qwen2.5-coder-32B (local); any model with SWE-bench Verified within ~5pt of Sonnet 4.6 (currently ~79.6%) |
22
+ | **Pattern** | Haiku 4.5 | Recognition — regex/syntactic match, classification into known buckets, log scan, deterministic checklist | Haiku 4.6, GPT-5 Mini, llama3.2-3b (local); any small/fast model that handles structured pattern matching |
23
+
24
+ **Rule of substitution:** tier A's swap target must score within tolerance of the default on the benchmark relevant to its role. For Code tier that's SWE-bench Verified ≥75% AND tool-use accuracy ≥85%; for Thinking tier that's SWE-bench ≥78% AND ARC-AGI / GPQA Diamond competitive; for Pattern tier no benchmark — just "fast and cheap, doesn't hallucinate on bounded structured tasks."
25
+
26
+ ## Provider-swap recipe
27
+
28
+ Build-loop's agent frontmatter uses Anthropic model aliases (`opus`, `sonnet`, `haiku`) because Claude Code is the primary host. To run on a different provider:
29
+
30
+ 1. **One-time edit per agent:** open each `agents/*.md` and change the `model:` field to your provider's equivalent. The tier (Thinking/Code/Pattern) determines the substitution target.
31
+ 2. **Runtime override:** `.build-loop/config.json.modelOverrides` accepts `{ thinking: "<id>", code: "<id>", pattern: "<id>" }`. The orchestrator resolves this through `scripts/model_overrides.py` before dispatching subagents (see `references/model-tier-mapping.md` for full schema).
32
+ 3. **Per-dispatch override:** any orchestrator dispatch may pass `model: <id>` in the subagent prompt to force that call.
33
+
34
+ The role-and-task table below uses tier names. The Anthropic-default mapping in the right column is illustrative; substitute your equivalents at swap time.
35
+
36
+ ## When to use this skill
37
+
38
+ - Choosing `model:` field in an agent frontmatter
39
+ - Orchestrator deciding which subagent tier to spawn for a task
40
+ - Estimating cost tradeoffs before starting a build
41
+ - Deciding whether to escalate mid-flow after failures
42
+ - Evaluating whether to swap providers (use the Tier abstraction table above as the contract)
43
+
44
+ ## Evidence base (2026 Q1)
45
+
46
+ | Claim | Source | Certainty |
47
+ |-------|--------|-----------|
48
+ | Sonnet 4.6: 79.6% SWE-bench Verified | Anthropic announcement + SWE-bench leaderboard | ⚠️ T2, single-source |
49
+ | Opus 4.6: 80.8% SWE-bench Verified (1.2pt gap — smallest in Claude history) | Same | ⚠️ T2, single-source |
50
+ | Sonnet 4.6 uses 70% fewer tokens than 4.5 on complex file ops with +38% accuracy | Anthropic Sonnet 4.6 announcement | ⚠️ T2, single-source |
51
+ | Pricing: Sonnet $3/$15 per MTok input/output | Anthropic pricing page | ⚠️ verify before billing |
52
+ | Pricing: Opus $15/$75 per MTok input/output (5x gap) | Anthropic pricing page | ⚠️ verify before billing |
53
+
54
+ ## MECE primitive: cognitive type of the task
55
+
56
+ Before consulting the role table, classify the task by reasoning shape. The MECE cut is the kind of thinking the task requires; lifecycle stage (plan/execute/review) is a second-order cut that often mixes types.
57
+
58
+ | Reasoning shape | Model | What it means | Example tasks |
59
+ |---|---|---|---|
60
+ | **Synthesis** — combine N inputs into a novel decision; cross-file/cross-system reasoning; ambiguity resolution; severity ranking | **Opus** | The "what" and "why" calls. No single rule produces the answer. | Frame goal, draft spec/ADRs, trace call-paths across files, rank finding severity, escalate stuck iteration with causal-tree, write audit/learnings |
61
+ | **Application** — apply a known rule, spec, or pattern to bounded input; produce an artifact that matches a contract | **Sonnet** | The "how" call when "what" is decided. Single-correct-answer derivable from a rule. | Implement a commit's owned files per spec, write tests for given F-criteria, adversarial critic vs rubric, mechanical simplify, fact-check with named source |
62
+ | **Recognition** — pure regex/syntactic match; classify into known buckets; no judgment | **Haiku** | No gradient — matches or doesn't. | Mock-data scan, log pattern detection, file inventory, cross-run pattern detection, deterministic checklist verification |
63
+
64
+ **Decision tree:** "Does this task have a single-correct answer derivable from a rule applied to bounded input?" → Yes = Application/Sonnet. Else "Is the answer pure pattern-match?" → Yes = Recognition/Haiku. Else = Synthesis/Opus.
65
+
66
+ ## Default assignments
67
+
68
+ | Task | Reasoning shape | Model | effort | Why |
69
+ |------|------|-------|--------|-----|
70
+ | Frame & plan: goal, ADRs, scope, F-criteria, MECE partition | Synthesis | Opus | medium | Ambiguity resolution; wrong plan compounds |
71
+ | Plan-verify deterministic checklist | Recognition | (script) | — | No model; runs `plan_verify.py` |
72
+ | Plan-critic adversarial review against rubric+checklist | Application | Sonnet | high | Bounded — rubric is the rule. Separation drives quality |
73
+ | **Scope auditor (NEW — Plan→Execute boundary)**: trace callers of every modified-API symbol; annotate `caller_audit:` per commit | Synthesis | Opus | medium | Cross-file call-path tracing that fanned-out implementers can't do (round-2 lesson) |
74
+ | Code execution — bounded chunk, spec clear | Application | Sonnet | medium | Default. High accuracy, 5× cheaper |
75
+ | Code execution — ambiguous spec | Synthesis | Opus | medium | Interpretation cost cheaper than rework |
76
+ | Adversarial critic pass (read-only diff vs rubric) | Application | Sonnet | high | Bounded — rubric vs diff is rule-application; separation effect |
77
+ | Code review — severity ranking + recommendation order (given findings) | Synthesis | Opus | medium | Cross-finding judgment about what matters most |
78
+ | Mock data scanning | Recognition | Haiku | low | Regex only |
79
+ | Fact-checking — trace metric → source, judge accuracy | Synthesis | Opus | medium | Cross-system; "is this number real?" requires cross-context judgment |
80
+ | Fact-checking — trace metric → named-source pattern (rule-bound) | Application | Sonnet | medium | When the source-pattern rule is explicit |
81
+ | Simplify — apply known simplifications | Application | Sonnet | medium | Inline single-use helper, delete dead branch — bounded |
82
+ | Debugging — symptom-to-known-pattern match | Application | Sonnet | high | Memory-first gate's "Application until the rule runs out" |
83
+ | Debugging — causal-tree after 2 consecutive failures | Synthesis | Opus | high | Synthesis takes over when rule-match exhausts |
84
+ | Novel architecture decision | Synthesis | Opus | medium | Cross-file impact; wrong call is expensive |
85
+ | Writing user-facing prose (copy, microcopy, errors) | Synthesis | Opus | medium | Tone, restraint, and nuance matter |
86
+ | Audit / learnings / Phase 6 promotion-decision | Synthesis | Opus | medium | Cross-run synthesis |
87
+ | Recurring-pattern detection across runs[] | Recognition | Haiku | low | Pattern-match across structured logs |
88
+
89
+ ## Round 2 evidence (2026-05-07, example-app news-podcast iteration 2)
90
+
91
+ n=2 dispatch-pattern A/B comparison on a 6-commit feature reversed the round-1 belief that Skill-path (Sonnet fan-out) is materially cheaper across the board:
92
+
93
+ | Dimension | A — Skill-path / Sonnet fan-out | B — Agent-tool / inline-Opus |
94
+ |---|---|---|
95
+ | Wall-clock | ~70-80 min | ~30 min |
96
+ | Token mix | ~50% Opus orchestrator + ~50% Sonnet implementer | ~100% Opus single-context |
97
+ | News-podcast jest | 52/0 | 59/0 |
98
+ | Iterations needed | 1 (cross-file prop wiring missed by Sonnet) | 0 |
99
+ | LLM judge speaker-flow | not run live (proxy from B) | 4/4 × 3 samples |
100
+
101
+ Findings that updated the model tiering:
102
+
103
+ 1. **Sonnet implementers are scoped to `files_owned`** and miss cross-file integration gaps (the AIBriefPage→PodcastGenerator props case). This motivates the new Scope Auditor role above.
104
+ 2. **Orchestrator overhead (research dispatches, plan-critic, iterate coordination, audit) burns ~50% of total tokens at Opus rate** on small/medium features. Sonnet's lower per-token rate doesn't dominate at 6-commit scale.
105
+ 3. **Inline-Opus is faster wall-clock** when there's no real parallelism to exploit. Fan-out parallelism is only a win when ≥3 chunks are truly independent.
106
+ 4. **Plan-critic on Sonnet caught 17 substantive findings** on a written spec — confirms "rubric-application = Sonnet" is robust.
107
+
108
+ These findings inform the role assignments, especially the rubric-application=Sonnet vs severity-assessment=Opus split for code review.
109
+
110
+ ## Escalation triggers (stay on Sonnet UNLESS)
111
+
112
+ - 2 consecutive failures on the same chunk after a retry at effort=high
113
+ - Spec is ambiguous and interpretation will materially change implementation
114
+ - A cross-file architectural decision surfaces mid-execution that wasn't in the plan
115
+ - Critic flags a "strong-checkpoint" finding that requires judgment, not just a fix
116
+ - Novel error pattern not found in `.build-loop/issues/` or debugging memory
117
+ - Task produces user-visible prose where tone and restraint are load-bearing
118
+
119
+ ## Techniques that work
120
+
121
+ - **Self-refine with external verification** (tests, lint, type-check). External oracle is non-negotiable — without it, self-refine is circular.
122
+ - **Adversarial critic loop** (writer agent + read-only reviewer agent). Separation is what makes it work. Same model reviewing its own output doesn't catch errors.
123
+ - **Best-of-N sampling with self-certainty voting** on HARD chunks only (flagged by plan or first-pass failure). N=3. Cost = ~3x Sonnet, still under 1.5x single-pass Opus.
124
+ - **Test-time compute** (effort=medium default, effort=high on retry). Easier problems benefit from revisions; harder problems need parallel sampling — not just more thinking on one path.
125
+ - **Plan-then-execute split** (Opus plans once, Sonnet executes many). Established pattern. Amortizes Opus cost across N subagent calls.
126
+
127
+ ## Techniques to avoid
128
+
129
+ - **Multi-agent debate** (3+ agents argue toward consensus). ⚠️ ICLR 2025 MAD analysis shows majority voting captures most gains; debate adds cost without consistent wins. Use simple voting instead.
130
+ - **Self-critique without adversarial separation**. A model editing its own output won't reliably catch its own errors. Use a separate read-only reviewer or rely on external tests.
131
+ - **Chain of Density**. Summarization-specific technique; not applicable to code work.
132
+ - **Best-of-N by default**. Only on hard chunks. Blanket best-of-N wastes tokens on easy tasks where effort=high is sufficient and cheaper.
133
+
134
+ ## Cost math quick reference
135
+
136
+ > ⚠️ **Advisory only.** The numbers below are directional heuristics based on single-source token-profile estimates and public pricing as of the skill's last update. They are **not** verified against real usage telemetry and should not be used as hard routing logic. Treat them as "this tier costs roughly this much more than that tier," not as commitments. Pricing, token profiles, and model output lengths all drift over time. Before using these ratios in any cost-minimization decision, pull actual usage data from the last 30 days of builds and re-derive the numbers for your workload.
137
+
138
+ | Configuration | Relative cost (advisory) |
139
+ |---------------|--------------|
140
+ | Single-pass Opus | ~5x baseline |
141
+ | Single-pass Sonnet 4.6 | ~0.3x (70% fewer tokens in observed samples) |
142
+ | Sonnet 4.6, effort=high | ~0.6x |
143
+ | Sonnet 4.6, best-of-3 + critic | ~1.2x |
144
+ | Sonnet 4.6 best-of-3 + critic vs single-pass Opus | ~4x cheaper |
145
+
146
+ ❓ Best-of-N + critic vs single-pass Opus on SWE-bench has not been directly benchmarked.
147
+
148
+ **How to convert these into routing decisions**: don't. Use the numbers to sanity-check a tier choice after the fact ("was this worth the 5x?"), not to justify forcing a model swap. When real telemetry disagrees with this table, trust telemetry and file an issue to update the table.
149
+
150
+ ## How the build-loop uses this
151
+
152
+ Orchestrator (Opus 4.7) spawns implementer subagent (Sonnet, effort=medium) → external verification gate (tests/lint/types) → Sonnet critic agent (read-only, effort=high) → if strong-checkpoint flagged, escalate to Opus for judgment call. See `agents/build-orchestrator.md §Escalation Triggers`. The **tier mapping** is the policy; the cost numbers above are advisory context, not the basis for overrides.
153
+
154
+ Haiku is only used for Phase 7B mock scanning. Never for reasoning tasks.
155
+
156
+ ## Pin vs inherit in agent frontmatter
157
+
158
+ Not every agent should hard-pin its model. Use this rule:
159
+
160
+ - **Pin** (`model: opus | sonnet | haiku`) when the task has a clear right tier and cost/quality drift from user's session choice would be a bug. Examples: `independent-auditor` (Sonnet advisory judge across chunk + build scope, consolidated 2026-05-23 — replaces retired `commit-auditor` and earlier `sonnet-critic`), `mock-scanner` (pattern matching only), `build-orchestrator` (Opus judgment at plan/review boundaries).
161
+ - **Inherit** (`model: inherit`) when user intent should flow through. The user's main-session choice is itself a cost/speed preference; respect it. Pair with a "recommended: X" note in this skill rather than forcing via frontmatter. Example: `fact-checker` — recommended Sonnet, but inherit honors whatever tier the user picked upstream.
162
+ - **Override mechanism**: users can override any pin by passing `model:` when spawning the agent or by editing the frontmatter. Pins are defaults, not locks.
163
+
164
+ Forward-compat note: pinned family aliases (`sonnet`, `opus`) auto-track latest versions (e.g., 4.6 → 4.7). `inherit` additionally picks up brand-new tiers (e.g., a future Flash-class model) without frontmatter edits.
165
+
166
+ ## Limitations of this guidance
167
+
168
+ - ⚠️ Sonnet 4.6 token-efficiency claim is single-source (Anthropic announcement). Treat as directionally correct, not proven.
169
+ - ❓ Best-of-N + critic hasn't been tested against single-pass Opus on SWE-bench specifically.
170
+ - ⚠️ Escalation triggers are heuristics, not proven thresholds. Revise after observing 5+ real builds and logging outcomes to `.build-loop/memory/`.
171
+
172
+ ## When to consult `model-router`
173
+
174
+ For Phase 3 (Execute) sub-agent dispatch, prefer the standalone router over inline tier reasoning when it is available:
175
+
176
+ ```bash
177
+ python3 ~/.claude/scripts/model-router.py \
178
+ --task "<one-line task summary>" \
179
+ --complexity auto \
180
+ --phase execute \
181
+ --task-id "<task-id-for-cost-ledger>" \
182
+ --json
183
+ ```
184
+
185
+ The router returns:
186
+
187
+ ```json
188
+ {
189
+ "provider": "ollama-mcp" | "codex" | "claude",
190
+ "model": "<model-id>",
191
+ "tool_call": {"name": "<mcp-tool-name>", "args": {...}},
192
+ "reason": "...",
193
+ "evidence_refs": ["<paths to docs that justify this decision>"]
194
+ }
195
+ ```
196
+
197
+ Why prefer the router:
198
+ - **Evidence-cited**: every decision references the doc that supports it (DOE results, model-tiering policy, cost-ledger design)
199
+ - **Deterministic**: same input → same output, auditable across builds
200
+ - **task_id propagates** to MCP tool args, so `cost-ledger-reader.py --by-task` shows per-build-phase economics
201
+ - **Free**: heuristic-only, no LLM call to decide
202
+
203
+ Fallback when router is unavailable: use the inline tier rules above. The router's policy mirrors them, so behavior is consistent either way.
204
+
205
+ Always resolve the final tier to a concrete model before writing the dispatch
206
+ cost-ledger row:
207
+
208
+ ```bash
209
+ python3 ${CLAUDE_PLUGIN_ROOT}/scripts/model_overrides.py \
210
+ --workdir "$PWD" \
211
+ --tier code \
212
+ --fallback sonnet \
213
+ --json
214
+ ```
215
+
216
+ Full contract and routing matrix: `~/dev/research/topics/llm/llm.build-loop-router-integration-2026-04.md`
@@ -0,0 +1,220 @@
1
+ ---
2
+ name: build-loop:native-ax-driver
3
+ description: Use when the build needs to automate a macOS .app without touching the hardware cursor, or the user asks to "click through the app" or "test the UI headlessly". Drives running apps via Accessibility API; self-contained Swift binary — no IBR, Playwright, or Appium required.
4
+ version: 1.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
+ # Native AX Driver
11
+
12
+ **Built-in capability**, not a bridge. Build-loop ships its own Swift binary and Python launcher for navigating macOS apps via the Accessibility API. When this skill loads, the orchestrator can read the AX tree of any running `.app` and dispatch actions on individual elements **while the user keeps using their cursor for something else**.
13
+
14
+ ## Why this exists
15
+
16
+ Build-loop's Iterate phase needs to verify native macOS UI fixes the same way it verifies web routes. Previously, build-loop deferred to IBR's MCP for native automation, which made native verification IBR-dependent. This skill lifts the needed capability into build-loop directly: same Swift code lineage, same AX actions, no MCP hop, no plugin requirement.
17
+
18
+ Build-loop still routes to IBR as the primary verifier when `skills/ibr-bridge/SKILL.md` detects it, because IBR can add session management, baselines, and screenshots as auxiliary evidence. This skill is the native fallback path when IBR is absent.
19
+
20
+ ## What "cursor-free" means
21
+
22
+ The Swift binary calls `AXUIElementPerformAction` and `AXUIElementSetAttributeValue` on the resolved element directly. It does **not** invoke `CGEventCreateMouseEvent`, `CGEventPost`, or `IOHIDPostEvent`. Concretely:
23
+
24
+ | Path | API | Cursor moves? |
25
+ |---|---|---|
26
+ | **This skill** | macOS Accessibility (`AXUIElement*`) | ❌ Never |
27
+ | Virtual HID fallback (NOT bundled) | Quartz Event Services / IOKit HID | ✅ Yes |
28
+ | AppleScript "click at {x,y}" | CGEvent under the hood | ✅ Yes |
29
+
30
+ When an element has no AX action handler (rare in SwiftUI/AppKit; common in custom Metal/canvas surfaces), the driver returns `Element not found at path` or an action-specific error rather than secretly falling through to mouse synthesis. This is intentional — a missing AX handler is usually a real accessibility bug in the app being tested, and papering over it hides the defect.
31
+
32
+ ## What the driver supports
33
+
34
+ Actions exposed by `python3 scripts/native_driver.py action`:
35
+
36
+ | Action | What it does | macOS AX constant |
37
+ |---|---|---|
38
+ | `press` | Click a button, activate a control | `kAXPressAction` |
39
+ | `setValue` | Set a text-field / slider / picker value (requires `--value`) | `AXSetAttributeValue(kAXValueAttribute, …)` |
40
+ | `increment` | Step a stepper / slider up | `kAXIncrementAction` |
41
+ | `decrement` | Step a stepper / slider down | `kAXDecrementAction` |
42
+ | `showMenu` | Open a contextual / popup menu | `kAXShowMenuAction` |
43
+ | `confirm` | Default button activation in a dialog | `kAXConfirmAction` |
44
+ | `cancel` | Cancel-button activation in a dialog | `kAXCancelAction` |
45
+ | `focus` | Move keyboard focus to the element | `AXSetAttributeValue(kAXFocusedAttribute, true)` |
46
+ | `scrollToVisible` | Scroll an element into the visible viewport | `AXScrollToVisible` |
47
+
48
+ Element targeting uses an integer index path from the main window root (e.g. `0,2,1` = first child → third child → second child). The path is returned by every `scan` element under the `path` key, so the typical loop is `scan` → match by `identifier` / `title` → use that element's `path` for `action`.
49
+
50
+ ## Files in this skill
51
+
52
+ ```
53
+ skills/native-ax-driver/
54
+ ├─ SKILL.md (this file)
55
+ ├─ scripts/
56
+ │ ├─ layout_fill.py (layout-fill / gap analyzer; stdlib only)
57
+ │ └─ native_driver.py (Python launcher; stdlib only)
58
+ └─ swift/bl-ax-driver/
59
+ ├─ Package.swift (Swift 5.9, macOS 13+)
60
+ └─ Sources/main.swift (~535 LOC, AX implementation)
61
+ ```
62
+
63
+ The Swift binary compiles on first use to the **consumer project's** `.build-loop/bin/bl-ax-driver` — never inside the plugin tree. Subsequent runs reuse the cached binary; rebuild fires only if `Sources/main.swift` or `Package.swift` is newer than the cached binary.
64
+
65
+ ## Prerequisites
66
+
67
+ | Prereq | How to check | Failure mode |
68
+ |---|---|---|
69
+ | `swift` on PATH | `command -v swift` | `RuntimeError: \`swift\` not found on PATH` from `ensure_binary()` |
70
+ | Xcode CLT installed | `xcode-select -p` | First `swift build` fails with missing-SDK error |
71
+ | AX permission for parent process | `python3 native_driver.py preflight` | All AX calls return `kAXErrorAPIDisabled`; binary exits with the canonical "Accessibility permission required" message |
72
+ | Target app running | `python3 native_driver.py apps` | `findMainWindow` returns nil; binary exits with "No windows found for pid …" |
73
+
74
+ The parent process needing AX permission is whichever process invoked Claude Code (Terminal, iTerm, VS Code, etc.). The driver binary itself does not need to be in the AX list — permission inherits from the parent.
75
+
76
+ ## Operational protocol
77
+
78
+ ### Pre-flight (run once per build-loop run with a native target)
79
+
80
+ ```bash
81
+ python3 ${CLAUDE_PLUGIN_ROOT}/skills/native-ax-driver/scripts/native_driver.py preflight
82
+ ```
83
+
84
+ Exit codes: `0` AX granted · `2` AX missing · `1` osascript missing.
85
+
86
+ If `2`, surface to Iterate as a blocker rather than retrying — the user has to grant permission once in System Settings; build-loop cannot do that itself.
87
+
88
+ ### Scan a running app
89
+
90
+ ```bash
91
+ python3 .../native_driver.py scan --app "Secrets Vault" # by name (substring, case-insensitive)
92
+ python3 .../native_driver.py scan --pid 44330 # by pid
93
+ ```
94
+
95
+ Stdout: `WINDOW:<id>:<WxH>:<title>` header followed by the window root's children as a JSON array of `AXExtractedElement` (`role`, `subrole`, `title`, `identifier`, `value`, `enabled`, `focused`, `actions[]`, `position`, `size`, `children[]`, `path[]`).
96
+
97
+ ### Analyze layout-fill / gap findings
98
+
99
+ ```bash
100
+ # Analyze a saved Swift scan JSON array
101
+ python3 .../native_driver.py analyze-layout --from-file /tmp/ax-tree.json
102
+
103
+ # Accept raw scan stdout with the leading WINDOW:<id>:<WxH>:<title> header
104
+ python3 .../native_driver.py scan --app "Easy Terminal" \
105
+ | python3 .../native_driver.py analyze-layout --stdin
106
+
107
+ # Re-scan a running app or pid and analyze the result
108
+ python3 .../native_driver.py analyze-layout --app "Easy Terminal"
109
+ python3 .../native_driver.py analyze-layout --pid 44330
110
+ ```
111
+
112
+ `analyze-layout` catches the layout bug class where a content element renders narrow and centered inside a larger container, leaving large empty gutters that can be invisible in screenshots. It reads the existing Swift scan JSON only; no Swift change or rebuild is required.
113
+
114
+ Inputs:
115
+ - `--from-file`, `--stdin`, `--pid`, or `--app` are mutually exclusive.
116
+ - `--threshold` defaults to `0.12`.
117
+ - `--min-container-px` defaults to `50`.
118
+
119
+ The analyzer returns the bridge envelope shape from `skills/ibr-bridge/SKILL.md`:
120
+
121
+ ```json
122
+ {
123
+ "status": "ran",
124
+ "route": "native",
125
+ "verifier": "native-ax-driver",
126
+ "artifacts": ["stdin"],
127
+ "verification": "native-ax-driver analyze-layout ran; found 1 layout-fill finding.",
128
+ "findings": [
129
+ {
130
+ "severity": "warning",
131
+ "category": "structure",
132
+ "message": "layout-fill: AXSplitGroup [Main]: leading empty band 317px = 30% of container width 1074px (horizontal)",
133
+ "finding": {
134
+ "containerRole": "AXSplitGroup",
135
+ "containerLabel": "Main",
136
+ "axis": "horizontal",
137
+ "emptyPx": 317.0,
138
+ "emptyPct": 0.2951582867783985,
139
+ "position": "leading",
140
+ "containerWidth": 1074.0,
141
+ "containerHeight": 700.0,
142
+ "detail": "AXSplitGroup [Main]: leading empty band 317px = 30% of container width 1074px (horizontal)"
143
+ }
144
+ }
145
+ ]
146
+ }
147
+ ```
148
+
149
+ The Swift extractor emits absolute screen coordinates, which are correct for this analysis. Each computed value is an intra-container delta, so a constant origin offset cancels out: `firstChild.min - container.min`, `container.max - lastChild.max`, and `band / container.extent`.
150
+
151
+ ### Drive an element
152
+
153
+ ```bash
154
+ # Press a button at AX index path 0,2,1 in pid 44330
155
+ python3 .../native_driver.py action --pid 44330 --element-path 0,2,1 --action press
156
+
157
+ # Type into a text field
158
+ python3 .../native_driver.py action --pid 44330 --element-path 0,4,0 \
159
+ --action setValue --value "BUILD_LOOP_TEST"
160
+
161
+ # Open the popup menu of a NSPopUpButton
162
+ python3 .../native_driver.py action --pid 44330 --element-path 0,1,3 --action showMenu
163
+ ```
164
+
165
+ Stdout JSON shape: `{"success": bool, "action": "press", "error": "AXPress failed" | null}`. Exit 0 on success, 1 on AX failure, 2 on bad arguments.
166
+
167
+ ### Resolve a name without AX permission
168
+
169
+ `resolve` and `apps` work without AX permission — useful for the orchestrator to confirm a freshly-launched app has actually started before the AX-gated operations.
170
+
171
+ ```bash
172
+ python3 .../native_driver.py resolve --app "Secrets Vault"
173
+ # {"pid": 44330, "name": "Secrets Vault", "bundleIdentifier": "com.secretsvault.app"}
174
+
175
+ python3 .../native_driver.py apps
176
+ # [{"name": "Finder", "pid": 612, "bundleIdentifier": "com.apple.finder"}, ...]
177
+ ```
178
+
179
+ ## Integration with build-loop phases
180
+
181
+ | Phase | Use |
182
+ |---|---|
183
+ | **Sub-step B Validate** (Review) — when uiTarget kind = `native-macos` | Run: `preflight` → `scan` → drive critical-path actions → re-`scan` → diff. |
184
+ | **Sub-step D Coverage gaps** | Enumerate `scan` results; for any element with `actions != []` and no corresponding repo-native render/interaction coverage, write a `.build-loop/ux-queue/` entry with a proposed test step pinned by `identifier` (preferred) or `title`. |
185
+ | **Phase 5 Iterate** — `.swift` files under a macOS target | Re-launch the rebuilt `.app` (`open -b <bundleId>`); replay the failing element-path + action; if two consecutive iterations fail on the same element, escalate to root-cause-investigator with the AX path — common cause is a missing `.accessibilityIdentifier(...)` modifier. |
186
+
187
+ ## When *not* to use this skill
188
+
189
+ - **Web targets** — use `ui-validator` and the host browser/screenshot tooling; this skill won't help.
190
+ - **iOS simulator** — the simulator runs on macOS, but interaction goes through `idb ui tap`, not direct AX (the simulator's AX surface is too noisy for path stability). See `reference_idb_sim_tap.md`.
191
+ - **Drag-and-drop, hover-only effects, NSTrackingArea-driven UI** — these need real `CGEvent` mouse events. Out of scope. If the feature is critical, fix the AX surface in the app under test (add `.accessibilityAction { … }`) rather than synthesizing mouse events.
192
+ - **App not yet running** — the driver does not launch apps. The orchestrator's pre-step must `open -b <bundleId>` (or `open <path/to/.app>`) and verify with `resolve` before driving.
193
+
194
+ ## Failure modes & recovery
195
+
196
+ | Symptom | Likely cause | Fix |
197
+ |---|---|---|
198
+ | Binary missing after first install | `swift build` failed silently (sandbox rejection) | `ensure_binary()` retries with `--disable-sandbox` automatically; if both fail, install Xcode Command Line Tools |
199
+ | All AX calls return `kAXErrorAPIDisabled` | Parent process not in System Settings → Privacy & Security → Accessibility | Add the process; macOS 13+ requires a fresh launch after granting |
200
+ | `Element not found at path` after a UI change | Path indices shifted | Re-`scan` and look up the element by `identifier` again — paths are not stable across UI changes |
201
+ | `AXPress failed` on a clearly-clickable button | SwiftUI view missing `.accessibilityAction` | Treat as a real bug in the app under test, not a driver bug |
202
+ | iOS simulator AX tree is empty | Simulator was scanned in macOS mode | Pass `--device-name` to scope to the simulator window |
203
+
204
+ ## Self-test
205
+
206
+ ```bash
207
+ python3 ${CLAUDE_PLUGIN_ROOT}/skills/native-ax-driver/scripts/native_driver.py preflight
208
+ python3 ${CLAUDE_PLUGIN_ROOT}/skills/native-ax-driver/scripts/native_driver.py apps | head
209
+ # pick a running app, then:
210
+ python3 ${CLAUDE_PLUGIN_ROOT}/skills/native-ax-driver/scripts/native_driver.py resolve --app "Finder"
211
+ python3 ${CLAUDE_PLUGIN_ROOT}/skills/native-ax-driver/scripts/native_driver.py scan --app "Finder" | head -40
212
+ ```
213
+
214
+ If all four print sensible JSON, the skill is healthy.
215
+
216
+ ## Provenance
217
+
218
+ Swift extractor ported from `interface-built-right/src/native/swift/ibr-ax-extract/Sources/main.swift`. The two copies started identical; build-loop's copy can drift independently and is not auto-synced. If a future bug is fixed in IBR's copy, port it manually and bump this skill's `version`.
219
+
220
+ Layout-fill / gap analysis in `scripts/layout_fill.py` is ported from `interface-built-right/src/native/layout-fill.ts` v1.4.0. Its fixtures mirror `interface-built-right/src/native/layout-fill.test.ts`, especially the Easy Terminal regression case: a 440px terminal centered in a 1074px container yields `emptyPx == 317`, `emptyPct ~= 0.2952`, and `position == "leading"`. The analyzer is pure Python and has no live AX dependency.