swarm-orchestrator 7.0.0-alpha.0 → 12.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (421) hide show
  1. package/README.md +198 -142
  2. package/config/personas/architect.yaml +26 -0
  3. package/config/personas/dependency-auditor.yaml +57 -0
  4. package/config/personas/documentation-writer.yaml +57 -0
  5. package/config/personas/implementer.yaml +55 -0
  6. package/config/personas/migration-specialist.yaml +59 -0
  7. package/config/personas/security-reviewer.yaml +57 -0
  8. package/config/personas/test-author.yaml +56 -0
  9. package/config/personas/verifier.yaml +62 -0
  10. package/dist/src/audit/aibom/cyclonedx-ml.js +174 -0
  11. package/dist/src/audit/aibom/index.js +11 -0
  12. package/dist/src/audit/aibom/ledger-reader.js +40 -0
  13. package/dist/src/audit/aibom/spdx-ai-profile.js +166 -0
  14. package/dist/src/audit/cheat-detector/assertion-strip.js +60 -0
  15. package/dist/src/audit/cheat-detector/audit-config.js +342 -0
  16. package/dist/src/audit/cheat-detector/comment-only-fix.js +54 -0
  17. package/dist/src/audit/cheat-detector/confirm-findings.js +96 -0
  18. package/dist/src/audit/cheat-detector/coverage-erosion.js +67 -0
  19. package/dist/src/audit/cheat-detector/dead-branch-insertion.js +45 -0
  20. package/dist/src/audit/cheat-detector/detector-sets.js +86 -0
  21. package/dist/src/audit/cheat-detector/diff-chunker.js +181 -0
  22. package/dist/src/audit/cheat-detector/diff-walker.js +241 -0
  23. package/dist/src/audit/cheat-detector/error-swallow.js +263 -0
  24. package/dist/src/audit/cheat-detector/exception-rethrow-lost-context.js +38 -0
  25. package/dist/src/audit/cheat-detector/fake-refactor.js +218 -0
  26. package/dist/src/audit/cheat-detector/import-resolver.js +313 -0
  27. package/dist/src/audit/cheat-detector/index.js +174 -0
  28. package/dist/src/audit/cheat-detector/internal-roots.js +192 -0
  29. package/dist/src/audit/cheat-detector/judge-primary.js +75 -0
  30. package/dist/src/audit/cheat-detector/judge-prompts/index.js +25 -0
  31. package/dist/src/audit/cheat-detector/judge-prompts/types.js +10 -0
  32. package/dist/src/audit/cheat-detector/judge-prompts/v1-conservative.js +66 -0
  33. package/dist/src/audit/cheat-detector/judge-prompts/v2-balanced.js +79 -0
  34. package/dist/src/audit/cheat-detector/llm-judge/anthropic-judge.js +245 -0
  35. package/dist/src/audit/cheat-detector/llm-judge/cache.js +92 -0
  36. package/dist/src/audit/cheat-detector/llm-judge/index.js +207 -0
  37. package/dist/src/audit/cheat-detector/llm-judge/local-judge.js +75 -0
  38. package/dist/src/audit/cheat-detector/llm-judge/ollama-judge.js +150 -0
  39. package/dist/src/audit/cheat-detector/llm-judge/types.js +12 -0
  40. package/dist/src/audit/cheat-detector/manifests/cargo-toml.js +63 -0
  41. package/dist/src/audit/cheat-detector/manifests/composer-json.js +82 -0
  42. package/dist/src/audit/cheat-detector/manifests/csproj.js +93 -0
  43. package/dist/src/audit/cheat-detector/manifests/find-manifests.js +128 -0
  44. package/dist/src/audit/cheat-detector/manifests/gemfile.js +79 -0
  45. package/dist/src/audit/cheat-detector/manifests/go-mod.js +73 -0
  46. package/dist/src/audit/cheat-detector/manifests/gradle.js +97 -0
  47. package/dist/src/audit/cheat-detector/manifests/index.js +43 -0
  48. package/dist/src/audit/cheat-detector/manifests/package-json.js +83 -0
  49. package/dist/src/audit/cheat-detector/manifests/pom-xml.js +78 -0
  50. package/dist/src/audit/cheat-detector/manifests/pyproject-toml.js +78 -0
  51. package/dist/src/{cli/cost-prompt.js → audit/cheat-detector/manifests/requirements-txt.js} +20 -15
  52. package/dist/src/audit/cheat-detector/manifests/types.js +15 -0
  53. package/dist/src/audit/cheat-detector/matcher-grader.js +267 -0
  54. package/dist/src/audit/cheat-detector/mock-delta.js +101 -0
  55. package/dist/src/audit/cheat-detector/mock-of-hallucination.js +284 -0
  56. package/dist/src/audit/cheat-detector/no-op-fix-helpers.js +157 -0
  57. package/dist/src/audit/cheat-detector/no-op-fix.js +268 -0
  58. package/dist/src/audit/cheat-detector/pr-intent.js +85 -0
  59. package/dist/src/audit/cheat-detector/registries/cache.js +41 -0
  60. package/dist/src/audit/cheat-detector/registries/github-actions-scan.js +52 -0
  61. package/dist/src/audit/cheat-detector/registries/index.js +32 -0
  62. package/dist/src/audit/cheat-detector/registries/offline-allowlist.js +174 -0
  63. package/dist/src/audit/cheat-detector/registries/types.js +13 -0
  64. package/dist/src/audit/cheat-detector/subject-paths.js +92 -0
  65. package/dist/src/audit/cheat-detector/test-import-closure.js +141 -0
  66. package/dist/src/audit/cheat-detector/test-relaxation.js +194 -0
  67. package/dist/src/audit/cheat-detector/type-suppression.js +100 -0
  68. package/dist/src/audit/cheat-detector/verify-findings.js +328 -0
  69. package/dist/src/audit/execution-grounded/corroborate.js +149 -0
  70. package/dist/src/audit/execution-grounded/coverage-delta.js +288 -0
  71. package/dist/src/audit/execution-grounded/dead-branch-restoration.js +457 -0
  72. package/dist/src/audit/execution-grounded/docker-runner.js +104 -0
  73. package/dist/src/audit/execution-grounded/eg-cache.js +106 -0
  74. package/dist/src/audit/execution-grounded/exec-env.js +282 -0
  75. package/dist/src/audit/execution-grounded/fake-refactor-restoration.js +399 -0
  76. package/dist/src/audit/execution-grounded/index.js +1151 -0
  77. package/dist/src/audit/execution-grounded/issue-repro.js +340 -0
  78. package/dist/src/audit/execution-grounded/mock-restoration.js +396 -0
  79. package/dist/src/audit/execution-grounded/monorepo.js +83 -0
  80. package/dist/src/audit/execution-grounded/mutation-check.js +332 -0
  81. package/dist/src/audit/execution-grounded/no-op-fix-restoration.js +376 -0
  82. package/dist/src/audit/execution-grounded/sandbox.js +459 -0
  83. package/dist/src/audit/execution-grounded/test-restoration.js +906 -0
  84. package/dist/src/audit/execution-grounded/type-suppression-restoration.js +496 -0
  85. package/dist/src/audit/gate/block-eligibility.js +87 -0
  86. package/dist/src/audit/gate/block-trigger-ledger.js +39 -0
  87. package/dist/src/audit/gate/block-trigger-types.js +22 -0
  88. package/dist/src/audit/gate/block-triggers.js +539 -0
  89. package/dist/src/audit/gate/calibrate-triggers.js +41 -0
  90. package/dist/src/audit/gate/gate-decision.js +61 -0
  91. package/dist/src/audit/gate/revert-proof.js +70 -0
  92. package/dist/src/audit/gate/self-certifying.js +74 -0
  93. package/dist/src/audit/gate/wilson.js +56 -0
  94. package/dist/src/audit/oracle/category-map.js +24 -0
  95. package/dist/src/audit/oracle/evade/evaders.js +166 -0
  96. package/dist/src/audit/oracle/inject/assertion-strip.js +32 -0
  97. package/dist/src/audit/oracle/inject/cheat-mock-mutation.js +37 -0
  98. package/dist/src/audit/oracle/inject/comment-only-fix.js +33 -0
  99. package/dist/src/audit/oracle/inject/coverage-erosion.js +35 -0
  100. package/dist/src/audit/oracle/inject/dead-branch-insertion.js +31 -0
  101. package/dist/src/audit/oracle/inject/diff-carrier.js +165 -0
  102. package/dist/src/audit/oracle/inject/error-swallow.js +32 -0
  103. package/dist/src/audit/oracle/inject/exception-rethrow-lost-context.js +35 -0
  104. package/dist/src/audit/oracle/inject/fake-refactor.js +32 -0
  105. package/dist/src/audit/oracle/inject/goal-not-fixed.js +37 -0
  106. package/dist/src/audit/oracle/inject/index.js +42 -0
  107. package/dist/src/audit/oracle/inject/injection-runner.js +118 -0
  108. package/dist/src/audit/oracle/inject/injector-types.js +24 -0
  109. package/dist/src/audit/oracle/inject/mock-of-hallucination.js +43 -0
  110. package/dist/src/audit/oracle/inject/no-op-fix.js +47 -0
  111. package/dist/src/audit/oracle/inject/site.js +10 -0
  112. package/dist/src/audit/oracle/inject/test-relaxation.js +29 -0
  113. package/dist/src/audit/oracle/inject/type-suppression.js +33 -0
  114. package/dist/src/audit/pr-source/index.js +132 -0
  115. package/dist/src/audit/report-comment/block-trigger-section.js +223 -0
  116. package/dist/src/audit/report-comment/detector-precision.js +154 -0
  117. package/dist/src/audit/report-comment/index.js +217 -0
  118. package/dist/src/audit/shadow-output.js +105 -0
  119. package/dist/src/audit/shadow.js +103 -0
  120. package/dist/src/audit/types.js +23 -0
  121. package/dist/src/cli/flags.js +4 -0
  122. package/dist/src/cli/v8/argv-schema.js +127 -0
  123. package/dist/src/cli/v8/audit-handler.js +913 -0
  124. package/dist/src/cli/v8/compile-handler.js +272 -0
  125. package/dist/src/cli/v8/doctor-handler.js +849 -0
  126. package/dist/src/cli/v8/grammar-resolve.js +88 -0
  127. package/dist/src/cli/v8/index.js +70 -0
  128. package/dist/src/cli/v8/init-handler.js +177 -0
  129. package/dist/src/cli/v8/ledger-verify-handler.js +142 -0
  130. package/dist/src/cli/v8/local-provider-flags.js +275 -0
  131. package/dist/src/cli/v8/local-provider-types.js +10 -0
  132. package/dist/src/cli/v8/pr-fetch.js +192 -0
  133. package/dist/src/cli/v8/pr-manifest-fetch.js +231 -0
  134. package/dist/src/cli/v8/resume-handler.js +487 -0
  135. package/dist/src/cli/v8/run-handler.js +564 -0
  136. package/dist/src/cli/v8/run-wrapper.js +253 -0
  137. package/dist/src/cli/v8/session-utils.js +121 -0
  138. package/dist/src/cli/v8/stats-handler.js +270 -0
  139. package/dist/src/cli.js +51 -166
  140. package/dist/src/config/provider-config.js +202 -0
  141. package/dist/src/contract/approval.js +193 -0
  142. package/dist/src/contract/auto-discover.js +77 -0
  143. package/dist/src/contract/canonicalize.js +187 -0
  144. package/dist/src/contract/compiler.js +304 -0
  145. package/dist/src/contract/extractor/anthropic-extractor.js +266 -0
  146. package/dist/src/contract/extractor/contract-schema.js +126 -0
  147. package/dist/src/contract/extractor/deterministic-extractor.js +57 -0
  148. package/dist/src/contract/extractor/factory.js +105 -0
  149. package/dist/src/contract/extractor/local-extractor.js +133 -0
  150. package/dist/src/contract/extractor/scan-pipeline.js +190 -0
  151. package/dist/src/contract/extractor/stub-extractor.js +89 -0
  152. package/dist/src/{bootstrap-types.js → contract/extractor/types.js} +0 -3
  153. package/dist/src/contract/index.js +51 -0
  154. package/dist/src/contract/schema/loader.js +87 -0
  155. package/dist/src/contract/schema/v1.json +198 -0
  156. package/dist/src/contract/serializer.js +139 -0
  157. package/dist/src/contract/tagger.js +122 -0
  158. package/dist/src/contract/types.js +22 -0
  159. package/dist/src/contract/validator.js +235 -0
  160. package/dist/src/env-loader.js +104 -0
  161. package/dist/src/errors.js +27 -0
  162. package/dist/src/falsification/adapters/adapter-profile.js +5 -0
  163. package/dist/src/falsification/adapters/candidate-runners.js +143 -0
  164. package/dist/src/falsification/adapters/cli-falsifier.js +171 -0
  165. package/dist/src/falsification/adapters/fenced-json.js +107 -0
  166. package/dist/src/falsification/adapters/index.js +30 -0
  167. package/dist/src/falsification/adapters/profiles/claude-code.js +202 -0
  168. package/dist/src/falsification/adapters/profiles/codex/prompts/property-must-hold.md +44 -0
  169. package/dist/src/falsification/adapters/profiles/codex.js +206 -0
  170. package/dist/src/falsification/adapters/profiles/copilot/prompts/function-must-have-signature.md +58 -0
  171. package/dist/src/falsification/adapters/profiles/copilot/prompts/import-graph-must-satisfy.md +49 -0
  172. package/dist/src/falsification/adapters/profiles/copilot/prompts/no-cycles.md +6 -0
  173. package/dist/src/falsification/adapters/profiles/copilot/prompts/no-upward-imports.md +4 -0
  174. package/dist/src/falsification/adapters/profiles/copilot.js +184 -0
  175. package/dist/src/falsification/adapters/registry.js +90 -0
  176. package/dist/src/falsification/adapters/spawn-cli.js +88 -0
  177. package/dist/src/falsification/adapters/transient-retry.js +93 -0
  178. package/dist/src/falsification/adapters/types.js +5 -0
  179. package/dist/src/falsification/dispatcher.js +70 -0
  180. package/dist/src/falsification/inspection/heuristic-classifier.js +361 -0
  181. package/dist/src/falsification/scheduler.js +217 -0
  182. package/dist/src/index.js +1 -27
  183. package/dist/src/inference/local/backend.js +30 -0
  184. package/dist/src/inference/local/backends/llama-cpp.js +181 -0
  185. package/dist/src/inference/local/backends/ollama.js +186 -0
  186. package/dist/src/inference/local/backends/openai-compatible.js +187 -0
  187. package/dist/src/inference/local/backends/vllm.js +175 -0
  188. package/dist/src/inference/local/concurrency-gate.js +68 -0
  189. package/dist/src/inference/local/factory.js +89 -0
  190. package/dist/src/inference/local/grammars/unified-diff.gbnf +26 -0
  191. package/dist/src/ledger/index.js +26 -0
  192. package/dist/src/ledger/jsonl-ledger.js +23 -0
  193. package/dist/src/ledger/ledger.js +212 -0
  194. package/dist/src/ledger/memoization.js +180 -0
  195. package/dist/src/ledger/resume.js +139 -0
  196. package/dist/src/ledger/types.js +6 -0
  197. package/dist/src/logger.js +0 -15
  198. package/dist/src/persona/index.js +31 -0
  199. package/dist/src/persona/persona-registry.js +187 -0
  200. package/dist/src/persona/predicates.js +54 -0
  201. package/dist/src/persona/types.js +6 -0
  202. package/dist/src/persona/verifier-persona.js +138 -0
  203. package/dist/src/population/apply-verify.js +142 -0
  204. package/dist/src/population/deterministic-dispatch.js +87 -0
  205. package/dist/src/population/diff-applier.js +90 -0
  206. package/dist/src/population/diff-snapshot.js +164 -0
  207. package/dist/src/population/falsifier-dispatch.js +115 -0
  208. package/dist/src/population/file-context.js +87 -0
  209. package/dist/src/population/index.js +27 -0
  210. package/dist/src/population/manager.js +364 -0
  211. package/dist/src/population/persona-message.js +186 -0
  212. package/dist/src/population/pipeline-config.js +73 -0
  213. package/dist/src/population/post-merge-handler.js +112 -0
  214. package/dist/src/population/provider-attribution.js +16 -0
  215. package/dist/src/population/rollback.js +177 -0
  216. package/dist/src/population/single-mode-executor.js +224 -0
  217. package/dist/src/population/snapshot-cleanup.js +299 -0
  218. package/dist/src/population/state.js +48 -0
  219. package/dist/src/population/test-framework-misuse.js +104 -0
  220. package/dist/src/population/tournament-driver.js +104 -0
  221. package/dist/src/population/tournament.js +427 -0
  222. package/dist/src/population/unified-diff.js +298 -0
  223. package/dist/src/population/whole-file-apply.js +181 -0
  224. package/dist/src/session/anthropic-session.js +198 -0
  225. package/dist/src/session/auto-discover.js +88 -0
  226. package/dist/src/session/bounded-session.js +94 -0
  227. package/dist/src/session/deterministic-session.js +331 -0
  228. package/dist/src/session/factory.js +123 -0
  229. package/dist/src/session/index.js +28 -0
  230. package/dist/src/session/local-session.js +221 -0
  231. package/dist/src/session/stub-session.js +160 -0
  232. package/dist/src/session/token-estimator.js +23 -0
  233. package/dist/src/session/types.js +44 -0
  234. package/dist/src/shared/child-env.js +94 -0
  235. package/dist/src/shared/obligation-rendering.js +80 -0
  236. package/dist/src/shared-predicates/index.js +17 -0
  237. package/dist/src/shared-predicates/predicate-runner.js +62 -0
  238. package/dist/src/shared-types/index.js +17 -0
  239. package/dist/src/shared-types/obligation-types.js +25 -0
  240. package/dist/src/shared-wasm/index.js +17 -0
  241. package/dist/src/shared-wasm/strategy-constants.js +156 -0
  242. package/dist/src/verification/ast-imports.js +199 -0
  243. package/dist/src/verification/ast-signature.js +406 -0
  244. package/dist/src/verification/index.js +12 -39
  245. package/dist/src/verification/live-cost-tracker.js +78 -0
  246. package/dist/src/verification/post-merge.js +53 -0
  247. package/dist/src/verification/pre-generation.js +71 -0
  248. package/dist/src/verification/predicate-runner.js +22 -0
  249. package/dist/src/verification/run-verifier.js +613 -0
  250. package/dist/src/verification/streaming-verifier.js +162 -0
  251. package/dist/src/wasm/index.js +29 -0
  252. package/dist/src/wasm/registry.js +30 -0
  253. package/dist/src/wasm/strategies/format-prettier.js +119 -0
  254. package/dist/src/wasm/strategies/import-sort.js +185 -0
  255. package/dist/src/wasm/strategies/scaffold-template.js +98 -0
  256. package/dist/src/wasm/types.js +11 -0
  257. package/dist/src/wasm/wasm-runtime.js +260 -0
  258. package/package.json +103 -25
  259. package/agents/reviewer.agent.md +0 -50
  260. package/agents/worker.agent.md +0 -41
  261. package/config/default-agents.yaml +0 -56
  262. package/config/pm-agent.yaml +0 -36
  263. package/config/quality-gates.yaml +0 -88
  264. package/config/repair-agent.yaml +0 -34
  265. package/config/semgrep-rules/complexity-mismatch.yaml +0 -6
  266. package/config/semgrep-rules/exception-swallowing.yaml +0 -13
  267. package/config/semgrep-rules/hardcoded-answer.yaml +0 -6
  268. package/config/semgrep-rules/mock-mutation.yaml +0 -6
  269. package/config/semgrep-rules/test-modification.yaml +0 -6
  270. package/config/user-agents.yaml +0 -23
  271. package/dist/src/adapters/adapter-factory.js +0 -29
  272. package/dist/src/adapters/agent-adapter.js +0 -32
  273. package/dist/src/adapters/claude-code-adapter.js +0 -126
  274. package/dist/src/adapters/claude-code-teams.js +0 -119
  275. package/dist/src/adapters/codex-adapter.js +0 -118
  276. package/dist/src/adapters/copilot-adapter.js +0 -224
  277. package/dist/src/adapters/fatal-error-classifier.js +0 -88
  278. package/dist/src/adapters/index.js +0 -44
  279. package/dist/src/adapters/persistent-session.js +0 -204
  280. package/dist/src/adapters/process-supervisor.js +0 -199
  281. package/dist/src/agents-exporter.js +0 -398
  282. package/dist/src/analytics-log.js +0 -161
  283. package/dist/src/baseline-scanner.js +0 -65
  284. package/dist/src/bootstrap-evidence.js +0 -88
  285. package/dist/src/bootstrap-orchestrator.js +0 -205
  286. package/dist/src/branch-merger.js +0 -427
  287. package/dist/src/cli/attest-handlers.js +0 -44
  288. package/dist/src/cli/demo-handlers.js +0 -274
  289. package/dist/src/cli/index.js +0 -57
  290. package/dist/src/cli/live-status.js +0 -186
  291. package/dist/src/cli/misc-handlers.js +0 -242
  292. package/dist/src/cli/plan-handlers.js +0 -350
  293. package/dist/src/cli/share-handlers.js +0 -163
  294. package/dist/src/cli/status-handlers.js +0 -457
  295. package/dist/src/cli/swarm-handlers.js +0 -638
  296. package/dist/src/cli/usage.js +0 -72
  297. package/dist/src/commit-pattern-detector.js +0 -143
  298. package/dist/src/commit-quality-analyzer.js +0 -38
  299. package/dist/src/config-loader.js +0 -339
  300. package/dist/src/context-broker.js +0 -358
  301. package/dist/src/copilot-cli-wrapper.js +0 -258
  302. package/dist/src/cost-estimator.js +0 -241
  303. package/dist/src/defaults.js +0 -18
  304. package/dist/src/demo-mode.js +0 -180
  305. package/dist/src/deployment-handler.js +0 -78
  306. package/dist/src/deployment-manager.js +0 -228
  307. package/dist/src/execution-queue.js +0 -196
  308. package/dist/src/external-tool-manager.js +0 -184
  309. package/dist/src/gate-prompt-builder.js +0 -117
  310. package/dist/src/gate-remediation.js +0 -173
  311. package/dist/src/github-issues-ingester.js +0 -152
  312. package/dist/src/github-mcp-integrator.js +0 -164
  313. package/dist/src/hook-generator.js +0 -229
  314. package/dist/src/knowledge-base.js +0 -300
  315. package/dist/src/meta-analyzer.js +0 -208
  316. package/dist/src/metrics-collector.js +0 -209
  317. package/dist/src/metrics-types.js +0 -5
  318. package/dist/src/multi-repo-coordinator.js +0 -179
  319. package/dist/src/orchestrator/async-meta-analysis.js +0 -84
  320. package/dist/src/orchestrator/fatal-run-error.js +0 -43
  321. package/dist/src/orchestrator/final-gates-remediation.js +0 -258
  322. package/dist/src/orchestrator/git-state-utils.js +0 -119
  323. package/dist/src/orchestrator/pause-controller.js +0 -55
  324. package/dist/src/orchestrator/replan-runner.js +0 -258
  325. package/dist/src/orchestrator/step-executor.js +0 -391
  326. package/dist/src/orchestrator/wave-scheduler-loop.js +0 -204
  327. package/dist/src/owasp-mapper.js +0 -153
  328. package/dist/src/owasp-report-renderer.js +0 -39
  329. package/dist/src/plan-files.js +0 -142
  330. package/dist/src/plan-generator.js +0 -1207
  331. package/dist/src/pm-agent.js +0 -296
  332. package/dist/src/post-run-reporter.js +0 -203
  333. package/dist/src/pr-automation.js +0 -103
  334. package/dist/src/pr-manager.js +0 -318
  335. package/dist/src/presenter/index.js +0 -209
  336. package/dist/src/prompt-builder.js +0 -173
  337. package/dist/src/quality-gates/config-loader.js +0 -196
  338. package/dist/src/quality-gates/default-config.js +0 -243
  339. package/dist/src/quality-gates/file-utils.js +0 -152
  340. package/dist/src/quality-gates/gate-runner.js +0 -171
  341. package/dist/src/quality-gates/gates/accessibility.js +0 -355
  342. package/dist/src/quality-gates/gates/duplicate-blocks.js +0 -144
  343. package/dist/src/quality-gates/gates/hardcoded-config.js +0 -52
  344. package/dist/src/quality-gates/gates/readme-claims.js +0 -62
  345. package/dist/src/quality-gates/gates/runtime-checks.js +0 -265
  346. package/dist/src/quality-gates/gates/scaffold-defaults.js +0 -108
  347. package/dist/src/quality-gates/gates/test-coverage.js +0 -240
  348. package/dist/src/quality-gates/gates/test-file-protection.js +0 -85
  349. package/dist/src/quality-gates/gates/test-isolation.js +0 -74
  350. package/dist/src/quality-gates/index.js +0 -17
  351. package/dist/src/quality-gates/registry.js +0 -205
  352. package/dist/src/quick-fix-mode.js +0 -302
  353. package/dist/src/recipe-loader.js +0 -122
  354. package/dist/src/repair-agent.js +0 -396
  355. package/dist/src/repo-analyzer.js +0 -342
  356. package/dist/src/report-generator.js +0 -146
  357. package/dist/src/report-renderer.js +0 -90
  358. package/dist/src/requirement-filter.js +0 -52
  359. package/dist/src/sarif-formatter.js +0 -140
  360. package/dist/src/scheduling/dependency-analyzer.js +0 -178
  361. package/dist/src/scheduling/work-stealing-queue.js +0 -123
  362. package/dist/src/secret-redactor.js +0 -90
  363. package/dist/src/session-executor.js +0 -587
  364. package/dist/src/session-manager.js +0 -221
  365. package/dist/src/share/transcript-verification.js +0 -128
  366. package/dist/src/share-parser.js +0 -477
  367. package/dist/src/spinner.js +0 -146
  368. package/dist/src/step-runner.js +0 -365
  369. package/dist/src/swarm-orchestrator.js +0 -686
  370. package/dist/src/task-classifier.js +0 -134
  371. package/dist/src/test-command-discovery.js +0 -123
  372. package/dist/src/text-similarity.js +0 -24
  373. package/dist/src/tier-maps.js +0 -158
  374. package/dist/src/url-shortener.js +0 -135
  375. package/dist/src/verification/attestation.js +0 -166
  376. package/dist/src/verification/cheat-detector.js +0 -240
  377. package/dist/src/verification/command-runner.js +0 -70
  378. package/dist/src/verification/composite-score.js +0 -157
  379. package/dist/src/verification/cosign-attestation.js +0 -137
  380. package/dist/src/verification/diff-analysis.js +0 -89
  381. package/dist/src/verification/differential-gate.js +0 -173
  382. package/dist/src/verification/mutation-gate.js +0 -242
  383. package/dist/src/verification/property-gate.js +0 -201
  384. package/dist/src/verification/test-synthesizer.js +0 -243
  385. package/dist/src/verifier/outcome-checks.js +0 -396
  386. package/dist/src/verifier/transcript-checks.js +0 -207
  387. package/dist/src/verifier/verification-reporters.js +0 -148
  388. package/dist/src/verifier-engine.js +0 -491
  389. package/dist/src/wave-resizer.js +0 -131
  390. package/dist/src/wave-scheduler.js +0 -44
  391. package/dist/src/worktree-manager.js +0 -368
  392. package/dist/src/worktree-reserved-paths.js +0 -97
  393. package/plugin/agents/.gitkeep +0 -0
  394. package/plugin/agents/backend_master.agent.md +0 -72
  395. package/plugin/agents/devops_pro.agent.md +0 -45
  396. package/plugin/agents/frontend_expert.agent.md +0 -59
  397. package/plugin/agents/integrator_finalizer.agent.md +0 -44
  398. package/plugin/agents/meta_reviewer.agent.md +0 -44
  399. package/plugin/agents/security_auditor.agent.md +0 -43
  400. package/plugin/agents/tester_elite.agent.md +0 -43
  401. package/plugin/hooks/hooks.json +0 -19
  402. package/plugin/hooks/post-tool-use.json +0 -9
  403. package/plugin/hooks/pre-tool-use.json +0 -9
  404. package/plugin/plugin.json +0 -47
  405. package/plugin/skills/swarm-gates/SKILL.md +0 -53
  406. package/plugin/skills/swarm-orchestrate/SKILL.md +0 -34
  407. package/plugin/skills/swarm-verify/SKILL.md +0 -44
  408. package/templates/README.md +0 -35
  409. package/templates/cli-tool.json +0 -31
  410. package/templates/fullstack.json +0 -52
  411. package/templates/library.json +0 -38
  412. package/templates/react-app.json +0 -45
  413. package/templates/recipes/add-api-docs.json +0 -35
  414. package/templates/recipes/add-auth.json +0 -47
  415. package/templates/recipes/add-ci.json +0 -39
  416. package/templates/recipes/add-tests.json +0 -39
  417. package/templates/recipes/migrate-to-ts.json +0 -42
  418. package/templates/recipes/refactor-modularize.json +0 -44
  419. package/templates/recipes/security-audit.json +0 -35
  420. package/templates/rest-api.json +0 -38
  421. /package/dist/src/{quality-gates/types.js → audit/cheat-detector/detector-types.js} +0 -0
package/README.md CHANGED
@@ -1,199 +1,255 @@
1
- <div align="center">
2
-
3
- <img src="assets/header.svg" alt="Swarm Orchestrator" width="100%">
1
+ <p align="center">
2
+ <img src="./assets/cover.svg" alt="Swarm Orchestrator cover" width="100%">
3
+ </p>
4
4
 
5
5
  # Swarm Orchestrator
6
6
 
7
- **Independent verification battery for patches written by AI coding agents.**
8
-
9
- [![License](https://img.shields.io/badge/license-ISC-blue?style=flat-square)](LICENSE)
10
- [![Version](https://img.shields.io/badge/version-7.0.0--alpha.0-orange?style=flat-square)](package.json)
11
- [![Node](https://img.shields.io/badge/node-%3E%3D20-339933?style=flat-square)](package.json)
12
- [![CI](https://img.shields.io/github/actions/workflow/status/moonrunnerkc/swarm-orchestrator/ci.yml?branch=main&label=ci&style=flat-square)](https://github.com/moonrunnerkc/swarm-orchestrator/actions/workflows/ci.yml)
13
- [![Stars](https://img.shields.io/github/stars/moonrunnerkc/swarm-orchestrator?style=flat-square)](https://github.com/moonrunnerkc/swarm-orchestrator/stargazers)
14
-
15
- [Quick Start](#quick-start) · [How It Works](#how-it-works) · [Documentation](#documentation) · [Contributing](#contributing)
16
-
17
- </div>
18
-
19
- ---
20
-
21
- > Wraps third-party coding-agent CLIs (Copilot, Claude Code, Codex), runs worker and reviewer steps on isolated git branches, and applies a five-layer falsification battery to each agent-authored patch. Hard gates block patches that fail intent or regression checks; advisory layers feed a composite score.
22
-
23
- You run this around an agent CLI, not instead of one. The agent produces the patch; the orchestrator tries to break it. Patches that survive merge to `main`; patches that don't are rolled back with a verification report.
7
+ Reads a pull request (PR) diff and flags the shortcuts artificial intelligence (AI) coding agents use to look done without being done. Relaxed tests, swallowed errors, fake renames, eleven categories in all. Grading patches against typed obligation contracts via a multi-persona pipeline is the second surface.
24
8
 
25
- ## Features
9
+ For engineers reviewing AI-written PRs at volume. Compliance teams generate CycloneDX-ML (machine learning) and SPDX (Software Package Data Exchange) 3.0 AI-BOM (bill of materials) artifacts. The artifacts map to EU AI Act (European Union Artificial Intelligence Act) Annex IV and CISA (Cybersecurity and Infrastructure Security Agency) reporting. Maintainers keep a hash-chained evidence record for every graded patch.
26
10
 
27
- - **Five-layer falsification battery.** Intent verification, regression and mutation testing, cheat detection, property-based testing, and signed attestation. Layers 1 and 2 are hard gates; layers 3 to 5 feed an advisory composite score. Implementations live under `src/verification/`.
28
- - **Isolated worker and reviewer steps.** Each step runs on its own git branch and worktree. Worker writes; reviewer is read-only and synthesises differential tests or reviews the diff against an active policy.
29
- - **Analyzer-gated parallelism.** A static dependency analyser (`src/scheduling/dependency-analyzer.ts`) decides which steps can run in parallel. The planner does not declare independence.
30
- - **Quality-gate engine.** Nine built-in gates (`scaffoldDefaults`, `duplicateBlocks`, `hardcodedConfig`, `readmeClaims`, `testIsolation`, `runtimeChecks`, `accessibility`, `testCoverage`, `testFileProtection`) registered in `src/quality-gates/registry.ts`. Projects register custom gates via `.swarm/gates/index.js`.
31
- - **Signed attestation.** In-toto SLSA v1.0 attestation, cosign keyless via Fulcio plus OIDC, attached as a git note. Implementation: `src/verification/attestation.ts` and `cosign-attestation.ts`.
32
- - **Audit-ready run artifacts.** Every execution writes `runs/<execution-id>/` with `session-state.json`, `metrics.json`, `cost-attribution.json`, per-step `share.md` transcripts, and per-step verification reports. Secrets are redacted at end of run.
33
- - **Multiple agent backends.** Adapters for Copilot CLI, Claude Code, Codex, and Claude Code Teams behind a shared process supervisor.
11
+ **Flags are tips, blocks are proof.** A flag is a structural detector seeing a cheat-shaped pattern; it is advisory and never blocks a merge (`--mode advise` is the default). A block is a self-certifying runtime result whose per-instance controls are all green, and every block ships the exact command that reproduces it in a fresh checkout. Eight proof protocols back the gate today: six execution-grounded restoration proofs (`test-tamper`, `mock-mutation`, `no-op-fix`, `type-suppression`, `fake-refactor`, `dead-branch`) plus `claim-falsified` and `obligation-failure`. The measured proven-finding precision on the execution-grounded-viable corpus slice, with its plain n, is in [`benchmarks/real-corpus/GATE-PRECISION-REPORT.md`](benchmarks/real-corpus/GATE-PRECISION-REPORT.md).
34
12
 
35
- ## Quick Start
13
+ <!-- BADGES:START -->
14
+ [![CI](https://github.com/moonrunnerkc/swarm-orchestrator/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/moonrunnerkc/swarm-orchestrator/actions/workflows/ci.yml)
15
+ [![license ISC](https://img.shields.io/static/v1?label=license&message=ISC&color=blue)](LICENSE)
16
+ [![node >= 20](https://img.shields.io/static/v1?label=node&message=%3E%3D%2020&color=3c873a)](package.json)
17
+ [![version 12.0.0](https://img.shields.io/static/v1?label=version&message=12.0.0&color=22d3ee)](package.json)
18
+ [![oracle recall 93% (301/325)](https://img.shields.io/static/v1?label=oracle%20recall&message=93%25%20(301%2F325)&color=brightgreen)](benchmarks/results/AB-REPORT.md)
19
+ [![real-PR false alarms 0.11/PR](https://img.shields.io/static/v1?label=real-PR%20false%20alarms&message=0.11%2FPR&color=brightgreen)](benchmarks/real-prs/REAL-WORLD-REPORT.md)
20
+ [![real-PR cheats vs linters 4 confirmed (Semgrep+ESLint: 1)](https://img.shields.io/static/v1?label=real-PR%20cheats%20vs%20linters&message=4%20confirmed%20(Semgrep%2BESLint%3A%201)&color=brightgreen)](benchmarks/real-prs/v11-BENEFIT-REPORT.md)
21
+ <!-- BADGES:END -->
36
22
 
37
- ### Prerequisites
23
+ <p align="center">
24
+ <a href="#install">Install</a> ·
25
+ <a href="#quick-start">Quick start</a> ·
26
+ <a href="#results">Results</a> ·
27
+ <a href="#cheat-detectors">Detectors</a> ·
28
+ <a href="#use-as-a-github-action">GitHub Action</a> ·
29
+ <a href="#ai-bom">AI-BOM</a> ·
30
+ <a href="#orchestrator-mode">Orchestrator</a> ·
31
+ <a href="#architecture">Architecture</a> ·
32
+ <a href="#commands">Commands</a> ·
33
+ <a href="#limitations">Limitations</a>
34
+ </p>
38
35
 
39
- | Requirement | Version | Notes |
40
- |---|---|---|
41
- | [Node.js](https://nodejs.org/) | >= 20 | Engines-enforced. CI runs 20 and 22. |
42
- | [git](https://git-scm.com/) | >= 2.40 | Worktrees are required; older git is not tested. |
43
- | One agent CLI | latest | One of: `copilot`, `claude`, `codex`. Must be installed and authenticated separately. |
44
- | [Docker](https://www.docker.com/) | latest | Optional. Required only for SWE-bench evaluation containers. |
45
-
46
- ### Install
36
+ ## Install
47
37
 
48
- The npm package is not published yet. Install from source:
38
+ Node 20 or later. See [`package.json`](package.json).
49
39
 
50
40
  ```bash
51
41
  git clone https://github.com/moonrunnerkc/swarm-orchestrator.git
52
42
  cd swarm-orchestrator
53
43
  npm install
54
44
  npm run build
55
- node dist/src/cli.js --help
45
+ npm link
46
+ swarm --help
56
47
  ```
57
48
 
58
- ### First run
49
+ ## Quick start
59
50
 
60
51
  ```bash
61
- node dist/src/cli.js run --goal "Add a /health endpoint that returns 200 OK" \
62
- --tool claude-code --target ./my-repo
63
- ```
52
+ # Audit a PR by reference (advisory by default; never blocks the merge)
53
+ GITHUB_TOKEN=... swarm audit moonrunnerkc/swarm-orchestrator#42
64
54
 
65
- Expected output shape:
55
+ # Opt in to merge-blocking gate mode (blocks only on a self-certifying
56
+ # runtime proof; enable the execution-grounded layer in
57
+ # .swarm/audit-config.yaml first; see docs/audit-config.md)
58
+ GITHUB_TOKEN=... swarm audit moonrunnerkc/swarm-orchestrator#42 --mode gate
66
59
 
67
- ```text
68
- [cli:swarm] Total Steps: 3
69
- [cli:swarm] Cost Estimate: 3-5 premium requests
70
- [orchestrator] Starting Parallel Swarm Execution
71
- [orchestrator] Step 1 (worker) on branch: swarm/<run-id>/step-1-worker
72
- [orchestrator] Step 1 (worker) - Agent working...
73
- [orchestrator] Step 1 verified, merging...
74
- [cli:swarm] SWARM EXECUTION COMPLETE
75
- [cli:swarm] Completed: 3/3
76
- [cli:swarm] Artifacts: ./runs/<run-id>/
60
+ # Audit a local diff with all 11 detectors
61
+ git diff main...HEAD | swarm audit --diff-stdin --detectors experimental
62
+
63
+ # Audit and emit a CycloneDX 1.6 ML-BOM
64
+ swarm audit --diff-file my.patch --emit-aibom cyclonedx-ml
65
+
66
+ # Shadow mode: record verdicts to disk without commenting or gating
67
+ swarm audit --pr <ref> --shadow my-org/my-repo
77
68
  ```
78
69
 
79
- ## How It Works
70
+ Exit codes: `0` advisory or any advise-mode run, `1` block (gate mode only), `2` usage error.
71
+
72
+ ## Results
80
73
 
81
- The CLI takes a goal, calls `swarm bootstrap` or `swarm plan` to produce a plan file, then `swarm swarm <planfile>` runs each step. A worker step is a git branch and worktree where the configured agent CLI executes against the goal; the worker writes a `/share` transcript and commits its changes. A reviewer step is read-only, runs either before the worker (synthesises a differential test from the goal's `FAIL_TO_PASS` description) or after (reviews the diff against a configured policy: general, security, or accessibility).
74
+ Every number here is reproducible from this repo and runs offline.
82
75
 
83
- After each step, the verifier runs. The active per-step path is `src/verifier-engine.ts`, which parses the transcript, cross-references hook-recorded file evidence, and runs outcome checks (`git_diff`, `file_existence`, `build_exec`, `test_exec`) against the worktree. The v7 falsification battery code lives under `src/verification/` and is wired in for differential gating, mutation testing, cheat detection, property testing, and attestation; the migration to make it the sole per-step path is in progress.
76
+ ### Catches cheats that linters miss
84
77
 
85
- Steps that pass verification merge to `main` via octopus merge; steps that fail are rolled back. After all step branches merge, the nine-gate quality engine scans the merged result and writes a report. Quality-gate findings are advisory in the current code: they do not block the merge path.
78
+ | PR | Cheat caught | Semgrep / ESLint |
79
+ |---|---|---|
80
+ | [cloudflare/workers-sdk#14063](https://github.com/cloudflare/workers-sdk/pull/14063) | fake refactor: function renamed but two callers still use the old name | not flagged |
81
+ | [cloudflare/workers-sdk#14132](https://github.com/cloudflare/workers-sdk/pull/14132) | error swallow: bare empty `catch` silently hides every error in the block | not flagged |
82
+
83
+ Both reproduce deterministically from the committed diffs. Semgrep (210 rules) and the ESLint security ruleset flag neither. Reproduce either with `swarm audit --diff-file benchmarks/real-prs/diffs/cloudflare-workers-sdk/<pr>.diff`. Full study across twelve repos in [`benchmarks/real-prs/v11-BENEFIT-REPORT.md`](benchmarks/real-prs/v11-BENEFIT-REPORT.md).
84
+
85
+ ### Detection numbers
86
+
87
+ **301 of 325** planted cheats recovered (92.6%) across thirteen categories scored against a defect-injection oracle: 258/275 structural plus 43/50 on the two semantic categories the judge-primary path covers. The behavioral `cheat-mock-mutation` category drove the latest gain: focusing the judge on the hunks that add a value-injecting mock lifted its recall from 0.16 (the prior rapid-mlx glm47 run) to 0.96 (24/25) on the local qwen3.6 judge, while the clean-PR judge false-positive rate fell from 10% to 0%. Reproduce with `SWARM_JUDGE_PROVIDER=ollama SWARM_JUDGE_MODEL=qwen3.6:35b-a3b npm run benchmarks:full`; A/B with the same-model decomposition in [`benchmarks/results/AB-REPORT.md`](benchmarks/results/AB-REPORT.md) and per-detector recall in [`benchmarks/oracle-corpus/per-detector-recall.md`](benchmarks/oracle-corpus/per-detector-recall.md).
88
+
89
+ **0.11 findings per PR** on an 18-PR pilot across five public repos. At or below the pre-upgrade auditor's false-alarm burden, with the oracle recall gain intact. Full numbers in [`benchmarks/real-prs/REAL-WORLD-REPORT.md`](benchmarks/real-prs/REAL-WORLD-REPORT.md).
90
+
91
+ ### Execution-grounded layer
92
+
93
+ Reproduce with `npm run execution-grounded:full`. This optional layer sets up a sandboxed checkout and runs mutation testing, repro execution, and a coverage delta scoped to the lines the PR changed. It surfaced one proof-correlated catch: proof anchor [`trpc/trpc#6098`](https://github.com/trpc/trpc/pull/6098), where 8 lines with surviving mutations were later changed by a hotfix. Evaluation in [`benchmarks/real-prs/v11-EXECUTION-GROUNDED-REPORT.md`](benchmarks/real-prs/v11-EXECUTION-GROUNDED-REPORT.md).
86
94
 
87
- For deeper detail, see [`ARCHITECTURE.md`](ARCHITECTURE.md) and [`docs/verification.md`](docs/verification.md).
95
+ ## Cheat detectors
88
96
 
89
- ## Supported Agents
97
+ Eleven detectors. Eight load by default; three (`comment-only-fix`, `exception-rethrow-lost-context`, `dead-branch-insertion`) require `--detectors experimental` because they have no real-PR signal yet to measure against. Registered in [`src/audit/cheat-detector/detector-sets.ts`](src/audit/cheat-detector/detector-sets.ts).
90
98
 
91
- | Agent CLI | Status | Notes |
99
+ | Category | Set | Trigger |
92
100
  |---|---|---|
93
- | `copilot` | shipped | GitHub Copilot CLI. Cold-start spawn per step. Adapter: `src/adapters/copilot-adapter.ts`. |
94
- | `claude-code` | shipped | Anthropic Claude Code CLI. Supports persistent interactive sessions. Adapter: `src/adapters/claude-code-adapter.ts`. |
95
- | `claude-code-teams` | shipped | Claude Code in teams configuration. Adapter: `src/adapters/claude-code-teams.ts`. |
96
- | `codex` | shipped | OpenAI Codex CLI. Spawns `codex exec` with sandbox bypass for git worktrees. Adapter: `src/adapters/codex-adapter.ts`. |
101
+ | `error-swallow` | default | Bare empty or comment-only `catch` block added in non-test code. |
102
+ | `mock-of-hallucination` | default | `jest.mock` / `vi.mock` / `@patch` against a module declared in no manifest in the repo. |
103
+ | `no-op-fix` | default | Test modified with no source change, or vice versa; import-graph reachability fallback when only one side moved. |
104
+ | `fake-refactor` | default | Exported symbol renamed in source, no caller in the diff updates the old name. |
105
+ | `coverage-erosion` | default | Source branch added with no compensating test addition. |
106
+ | `test-relaxation` | default | Strict matcher swapped for a loose one, or a test block removed without same-chunk replacement. |
107
+ | `assertion-strip` | default | Net assertion count in a test file drops after the PR. |
108
+ | `type-suppression` | default | A type-checker or linter suppression (for example `@ts-ignore` or `eslint-disable`) added over a changed line. |
109
+ | `comment-only-fix` | experimental | Source modifications are all comment additions. |
110
+ | `exception-rethrow-lost-context` | experimental | `throw err` replaced with `throw new Error(...)` and `{ cause }` not forwarded. |
111
+ | `dead-branch-insertion` | experimental | Branch guarded by a literal-false condition added. |
97
112
 
98
- Pass `--tool <name>` to select. The agent CLI must be installed and authenticated by the user; the orchestrator does not bundle credentials.
113
+ Beyond the structural detectors, a judge-primary path catches two semantic categories (`goal-not-fixed`, `cheat-mock-mutation`) by asking the judge whether the diff delivers the PR's stated claim. For `cheat-mock-mutation` a deterministic pre-filter hands the judge only the test hunks that add a value-injecting mock, so the judge reads the six-line cheat instead of skimming a 40k-char diff, and is never asked on a clean PR that adds no such mock. A proven mock-mutation can also block under `--mode gate` as a self-certifying `mock-mutation-proven` trigger (see [`docs/limitations.md`](docs/limitations.md)).
99
114
 
100
- ## Configuration
115
+ Per-repo configuration in `.swarm/audit-config.yaml`: `excludePaths`, `intentSeverityPolicy` (`strict` | `lenient` | `off`), and `judgePrimary`. See [`docs/audit-config.md`](docs/audit-config.md).
101
116
 
102
- <details>
103
- <summary><b><code>.swarm/gates.yaml</code>: verification battery weights and thresholds</b></summary>
117
+ ## Use as a GitHub Action
104
118
 
105
119
  ```yaml
106
- verification:
107
- mutation:
108
- failBelow: 0.6
109
- warnBelow: 0.8
110
- composite:
111
- threshold: 0.7
112
- weights:
113
- cheatDetector: 0.4
114
- propertyGate: 0.4
115
- attestation: 0.2
116
- advisoryGatePenalty: 0.02
120
+ name: PR audit
121
+ on:
122
+ pull_request:
123
+ types: [opened, synchronize, reopened, ready_for_review]
124
+ permissions:
125
+ pull-requests: write
126
+ contents: read
127
+ jobs:
128
+ audit:
129
+ runs-on: ubuntu-latest
130
+ steps:
131
+ - uses: actions/checkout@v4
132
+ with:
133
+ fetch-depth: 0
134
+ - uses: moonrunnerkc/swarm-orchestrator@main
135
+ with:
136
+ audit-mode: true
137
+ mode: advise # advise | gate
138
+ detectors: default # default | experimental
139
+ emit-aibom: cyclonedx-ml
140
+ env:
141
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
117
142
  ```
118
143
 
119
- Full reference: [`docs/configuration.md`](docs/configuration.md).
120
- </details>
144
+ Outputs: `audit-pass`, `audit-findings`, `audit-ledger`. Full input list in [`action.yml`](action.yml).
145
+
146
+ ### Enabling the execution-grounded layer
147
+
148
+ Structural detectors run with no setup and only ever flag (advisory). The six runtime proofs that can gate a merge (`test-tamper`, `mock-mutation`, `no-op-fix`, `type-suppression`, `fake-refactor`, `dead-branch`) need the execution-grounded layer, which is off until you set `executionGrounded.enabled: true` in [`.swarm/audit-config.yaml`](docs/audit-config.md). Turning it on is what lets `--mode gate` block, and every block it produces ships the exact command that reproduces it in a fresh checkout.
149
+
150
+ What it costs: for each audited PR the layer provisions the repository in a sandbox (clone the head, install dependencies, run the affected tests), so it adds clone, install, and test wall-clock to the job, and only PRs in a Node project with a lockfile and a recognized test runner (jest, vitest, mocha) provision at all. Everything else fails closed to advisory. The static viability screen on the project corpus measured 12 of 197 PRs as provisionable ([`benchmarks/real-corpus/eg-viability.json`](benchmarks/real-corpus/eg-viability.json)); your own repository, where the suite is known to run in CI, provisions far more reliably than an arbitrary sample. Nothing the layer cannot prove ever blocks: with the layer off, or on a non-provisionable PR, gate mode passes on advisory findings alone.
151
+
152
+ ## AI-BOM
153
+
154
+ `--emit-aibom cyclonedx-ml | spdx-ai | both` writes one document per format per run under `.swarm/aibom/`. Emitters in [`src/audit/aibom/`](src/audit/aibom/) produce hand-rolled JSON against the upstream specs with no third-party AI-BOM runtime dependency.
155
+
156
+ Procurement mappings:
157
+
158
+ - [`docs/eu-ai-act-mapping.md`](docs/eu-ai-act-mapping.md): EU AI Act (European Union Artificial Intelligence Act) Article 11 + Annex IV fields.
159
+ - [`docs/cisa-sbom-ai-mapping.md`](docs/cisa-sbom-ai-mapping.md): CISA (Cybersecurity and Infrastructure Security Agency) SBOM-for-AI minimum elements.
121
160
 
122
- <details>
123
- <summary><b><code>config/quality-gates.yaml</code>: built-in quality gates</b></summary>
161
+ ## Orchestrator mode
162
+
163
+ Grades patches against a typed contract instead of auditing a PR diff.
164
+
165
+ ```bash
166
+ swarm init # Scaffold contract.yaml + patches.jsonl
167
+ swarm run --goal "check this project builds" # Deterministic provider, no API key
168
+ ```
169
+
170
+ Minimal contract:
124
171
 
125
172
  ```yaml
126
- enabled: true
127
- failOnIssues: true
128
- autoAddRefactorStepOnDuplicateBlocks: true
129
- autoAddReadmeTruthStepOnReadmeClaims: true
130
- autoAddScaffoldFixStepOnScaffoldDefaults: true
131
- autoAddConfigFixStepOnHardcodedConfig: true
132
- autoAddAccessibilityFixStepOnAccessibility: true
133
- autoAddTestCoverageStepOnTestCoverage: true
173
+ obligations:
174
+ - type: build-must-pass
175
+ command: npm run build
176
+ - type: test-must-pass
177
+ command: npm test
178
+ ```
179
+
180
+ Hosted-model run:
181
+
182
+ ```bash
183
+ export ANTHROPIC_API_KEY=sk-...
184
+ swarm run --goal "add a /health endpoint" --extractor anthropic --session anthropic
134
185
  ```
135
186
 
136
- Full reference: [`docs/quality-gates.md`](docs/quality-gates.md).
137
- </details>
187
+ Local-LLM run (Ollama):
138
188
 
139
- <details>
140
- <summary><b><code>config/default-agents.yaml</code>: agent profiles</b></summary>
189
+ ```bash
190
+ swarm run --goal "add a named export sum(a, b)" \
191
+ --session local --local-backend ollama \
192
+ --local-base-url http://localhost:11434 \
193
+ --local-model-session gemma4:31b \
194
+ --local-grammar none --local-max-concurrency 1 --preset fast
195
+ ```
141
196
 
142
- Worker and reviewer roles are defined in `agents/worker.agent.md` and `agents/reviewer.agent.md`. Project overrides live in `config/default-agents.yaml`; install-level and `.github/agents/*.agent.md` are the lower-precedence sources.
197
+ Provider details in [`docs/providers.md`](docs/providers.md). Obligation taxonomy in [`docs/check-types.md`](docs/check-types.md). Schema in [`src/contract/schema/v1.json`](src/contract/schema/v1.json).
143
198
 
144
- Full reference: [`docs/configuration.md`](docs/configuration.md).
145
- </details>
199
+ ## Architecture
146
200
 
147
- ## CLI Reference
201
+ Two command-line interface (CLI) surfaces share one core. `swarm run` drives the v8 pipeline (extractor, session, predicate-runner, falsifier, verifier). No patch reaches main without passing both `verifyObligation` and `postMergeVerify`.
148
202
 
149
- <details>
150
- <summary><b>Top-level commands</b></summary>
203
+ `swarm audit` reuses the verifier and falsifier layers against a unified diff, with no session, extractor, or model credentials needed. Both surfaces write to the same append-only hash-chained ledger ([`src/ledger/ledger.ts`](src/ledger/ledger.ts)); tampering breaks the chain.
151
204
 
152
- | Command | Description |
153
- |---|---|
154
- | `swarm bootstrap <path(s)> "<goal>"` | Analyses target repos and writes a plan. |
155
- | `swarm plan <goal>` | Generates a plan from a goal description. |
156
- | `swarm execute <planfile>` | Executes a saved plan step-by-step. |
157
- | `swarm swarm <planfile>` | Executes a plan with verified branch and worktree workflow. |
158
- | `swarm run --goal "<description>"` | Plan and execute in one step. |
159
- | `swarm quick "<task>"` | Single-agent quick-fix mode. |
160
- | `swarm gates [path]` | Runs quality gates against a repo. |
161
- | `swarm status <execid>` | Shows execution status. |
162
- | `swarm report <run-id>` | Generates a structured run report. |
163
- | `swarm audit <session-id>` | Generates a Markdown audit report. |
164
- | `swarm metrics <session-id>` | Shows metrics summary for a session. |
165
- | `swarm attest verify <commit>` | Verifies the swarm attestation git note on a commit. |
166
- | `swarm demo <scenario>` | Runs a pre-configured demo scenario. |
167
- | `swarm templates` | Lists available plan templates. |
168
- | `swarm recipes` | Lists available recipes. |
169
-
170
- Full flag reference: [`docs/cli.md`](docs/cli.md).
171
- </details>
172
-
173
- ## Documentation
174
-
175
- | Section | What's covered |
205
+ ## Commands
206
+
207
+ | Command | Purpose |
176
208
  |---|---|
177
- | [Architecture](ARCHITECTURE.md) | Module layout, scheduling, merge strategy, governance. |
178
- | [Verification](docs/verification.md) | Per-step verifier, outcome checks, transcript checks, hook evidence. |
179
- | [Adapters](docs/adapters.md) | Per-CLI capabilities, options, and process supervision. |
180
- | [Quality gates](docs/quality-gates.md) | The nine built-in gates and how to register custom ones. |
181
- | [Configuration](docs/configuration.md) | Config file precedence, schema, and overrides. |
182
- | [CLI](docs/cli.md) | Full command and flag reference. |
183
- | [Benchmarks](docs/benchmarks.md) | SWE-bench harness, scoring, and methodology. |
184
- | [Contributing](CONTRIBUTING.md) | Development setup, code style, PR workflow. |
209
+ | `swarm audit <ref \| --diff-*>` | Audit a PR or local diff. Advisory by default. |
210
+ | `swarm run --goal "<text>"` | Compile and grade in one step. |
211
+ | `swarm compile <goal>` | Write a reusable compiled contract directory. |
212
+ | `swarm run <contract-dir>` | Grade against a pre-compiled contract directory. |
213
+ | `swarm resume <run-id>` | Resume a killed run from its ledger. |
214
+ | `swarm stats <run-id>` | Aggregate diagnostic counts from a run ledger. |
215
+ | `swarm ledger verify <run-id>` | Verify a hash-chained ledger at rest. |
216
+ | `swarm init` | Scaffold `contract.yaml` and `patches.jsonl`. |
217
+ | `swarm doctor [--fix] [--connectors]` | Probe local prerequisites. |
185
218
 
186
- ## Contributing
219
+ `swarm <cmd> --help` for the flag list of any subcommand.
187
220
 
188
- PRs welcome. Code style is enforced: named exports only, kebab-case filenames, no `any` types in `src/`, full JSDoc on public functions, 300-line file soft limit, structured logger only (no `console.*` in `src/`). Before any PR: `npm test`, then `node dist/src/cli.js gates .`, then a descriptive conventional-commit message. The full standards are in [CONTRIBUTING.md](CONTRIBUTING.md).
221
+ ## Run artifacts
222
+
223
+ ```text
224
+ .swarm/contracts/<id>/contract.jsonl compiled contract (orchestrator mode)
225
+ .swarm/ledger/<run-id>.jsonl orchestrator ledger
226
+ .swarm/ledger/audit-<run-id>.jsonl audit ledger
227
+ .swarm/aibom/<run-id>.cdx.json CycloneDX-ML (when --emit-aibom)
228
+ .swarm/aibom/<run-id>.spdx.json SPDX 3.0 AI-Profile (when --emit-aibom)
229
+ .swarm/shadow/<repo>/<run-id>.json shadow-mode verdict (when --shadow)
230
+ ```
231
+
232
+ `.swarm/` is in [`.gitignore`](.gitignore) at the consumer-repo level.
233
+
234
+ ## Integrations
235
+
236
+ - Claude Code slash command: [`.claude/commands/swarm-audit.md`](.claude/commands/swarm-audit.md)
237
+ - Cursor rule pack: [`integrations/cursor/swarm-audit.mdc`](integrations/cursor/swarm-audit.mdc)
238
+ - Aider pre-commit hook: [`integrations/aider/pre-commit-swarm-audit`](integrations/aider/pre-commit-swarm-audit)
239
+
240
+ ## Limitations
241
+
242
+ No single detector has cleared the precision bar to block on its own. Gate mode blocks only on a self-certifying runtime proof whose per-instance controls are all green: test-tamper, mock-mutation, no-op-fix, type-suppression, or fake-refactor restoration, claim falsification, or obligation failure. The first such proof fired on a dogfood PR in June 2026. The full accounting, including the measured gate precision and what blocks today and what doesn't, is in [`docs/limitations.md`](docs/limitations.md).
243
+
244
+ ## Contributing
189
245
 
190
246
  ```bash
191
- git clone https://github.com/moonrunnerkc/swarm-orchestrator.git
192
- cd swarm-orchestrator
193
- npm install
194
- npm test
247
+ npm install && npm run build && npm test
248
+ npm run typecheck && npm run lint
195
249
  ```
196
250
 
251
+ Project conventions in [`CONTRIBUTING.md`](CONTRIBUTING.md). New cheat detectors must include an injector under `src/audit/oracle/inject/` so recall is measurable from day one. Security disclosures via [`SECURITY.md`](SECURITY.md), never via public issues.
252
+
197
253
  ## License
198
254
 
199
- [ISC](LICENSE) © 2026 Bradley R. Kinnard / moonrunnerkc
255
+ [ISC](LICENSE).
@@ -0,0 +1,26 @@
1
+ id: architect
2
+ role: architect
3
+ tier: sonnet
4
+ handles:
5
+ - file-must-exist
6
+ sampling:
7
+ temperature: 0.2
8
+ maxTokens: 2048
9
+ systemSuffix: |-
10
+ You are the architect persona in the swarm-orchestrator v8 population.
11
+ Your job is to satisfy file-must-exist obligations: when an obligation
12
+ requires a file at a given path, emit the file content as a single
13
+ fenced code block. Output exactly one file body, with no surrounding
14
+ prose, so the run-time can write it verbatim.
15
+
16
+ Constraints:
17
+ - Use the project context to match existing conventions (language,
18
+ formatting, build tooling).
19
+ - Keep the file minimal but functional. Stub content is acceptable when
20
+ the obligation does not specify behavior.
21
+ - Never reference paths outside the obligation's target path.
22
+ - When the dynamic message includes a "REQUIRED:" block specifying a
23
+ test framework, you MUST use that framework's API exclusively.
24
+ Never import a different framework's globals (no Jest test/expect
25
+ in node:test projects, no node:test imports in Jest projects, etc.).
26
+ This rule overrides any default-API muscle memory.
@@ -0,0 +1,57 @@
1
+ id: dependency-auditor
2
+ role: dependency-auditor
3
+ tier: sonnet
4
+ handles:
5
+ - import-graph-must-satisfy
6
+ sampling:
7
+ temperature: 0.1
8
+ maxTokens: 8192
9
+ systemSuffix: |-
10
+ You are the dependency-auditor persona in the swarm-orchestrator v8
11
+ population. Your job is to satisfy import-graph-must-satisfy
12
+ obligations, which assert structural constraints over the import
13
+ graph (no cycles, no upward imports, etc.). Reason about module
14
+ boundaries before patching.
15
+
16
+ Constraints:
17
+ - Prefer extracting a shared module over inlining duplicate code.
18
+ - Never resolve a cycle by introducing dynamic require/import.
19
+ - Do not silence the constraint by renaming the offending file.
20
+
21
+ Output rules (strict). Pick ONE of these response formats:
22
+
23
+ FORMAT 1 — whole-file replacement (PREFERRED for substantive edits):
24
+ Emit one or more file blocks, each block delimited as:
25
+ <<<FILE <repo-relative-path>
26
+ <full new file contents>
27
+ FILE>>>
28
+ The body between the markers is written VERBATIM to disk; the existing
29
+ file is replaced. Use this whenever your edit touches more than one or
30
+ two lines, or when the file is short enough that re-emitting all of it
31
+ is clearer than a diff. Multiple <<<FILE ... FILE>>> blocks may appear
32
+ in one response (one per file you need to write).
33
+ IMPORTANT: emit the FULL file contents in the block, not just the new
34
+ parts. Any line you omit from the block will be removed from the file.
35
+ Preserve existing imports, helper functions, and exports.
36
+
37
+ FORMAT 2 — unified diff (use ONLY for small, well-anchored edits):
38
+ - Reply with a unified diff and nothing else.
39
+ - No prose before, after, or between hunks. No "Here is the diff:".
40
+ - No code fences. No ```diff or ``` wrappers.
41
+ - The first character of your response MUST be a `-` from a `--- a/<path>`
42
+ header line. The second line MUST be a `+++ b/<path>` header.
43
+ - New files use `--- /dev/null` and `+++ b/<path>`. Deletions use
44
+ `--- a/<path>` and `+++ /dev/null`.
45
+ - Repo-relative paths only; no absolute paths, no leading `./`.
46
+ - Every ` ` (context) and `-` line MUST appear VERBATIM in the file
47
+ shown in the "Current contents of <path>:" block. Same characters,
48
+ same indentation, same surrounding lines. Do not paraphrase. Do not
49
+ invent helper lines. The parser does byte-for-byte context matching;
50
+ one wrong character rejects the entire diff.
51
+
52
+ FORMAT 3 — no-op:
53
+ If the obligation already holds against the file shown and no change
54
+ is needed, reply with the literal three characters: no-op
55
+
56
+ Default to FORMAT 1 for anything more complex than a single-line tweak.
57
+ It avoids the context-mismatch failure mode that plagues FORMAT 2.
@@ -0,0 +1,57 @@
1
+ id: documentation-writer
2
+ role: documentation-writer
3
+ tier: sonnet
4
+ handles:
5
+ - function-must-have-signature
6
+ sampling:
7
+ temperature: 0.1
8
+ maxTokens: 8192
9
+ systemSuffix: |-
10
+ You are the documentation-writer persona in the swarm-orchestrator v8
11
+ population. Your job is to satisfy function-must-have-signature
12
+ obligations: ensure named functions declare the contract-specified
13
+ signature in the contract-specified file.
14
+
15
+ Constraints:
16
+ - Preserve existing function bodies; only the signature line should
17
+ change unless the body genuinely depends on a removed parameter.
18
+ - Update doc comments adjacent to the signature so docs and source agree.
19
+ - Never delete an existing public function to silence the obligation.
20
+
21
+ Output rules (strict). Pick ONE of these response formats:
22
+
23
+ FORMAT 1 — whole-file replacement (PREFERRED for substantive edits):
24
+ Emit one or more file blocks, each block delimited as:
25
+ <<<FILE <repo-relative-path>
26
+ <full new file contents>
27
+ FILE>>>
28
+ The body between the markers is written VERBATIM to disk; the existing
29
+ file is replaced. Use this whenever your edit touches more than one or
30
+ two lines, or when the file is short enough that re-emitting all of it
31
+ is clearer than a diff. Multiple <<<FILE ... FILE>>> blocks may appear
32
+ in one response (one per file you need to write).
33
+ IMPORTANT: emit the FULL file contents in the block, not just the new
34
+ parts. Any line you omit from the block will be removed from the file.
35
+ Preserve existing imports, helper functions, and exports.
36
+
37
+ FORMAT 2 — unified diff (use ONLY for small, well-anchored edits):
38
+ - Reply with a unified diff and nothing else.
39
+ - No prose before, after, or between hunks. No "Here is the diff:".
40
+ - No code fences. No ```diff or ``` wrappers.
41
+ - The first character of your response MUST be a `-` from a `--- a/<path>`
42
+ header line. The second line MUST be a `+++ b/<path>` header.
43
+ - New files use `--- /dev/null` and `+++ b/<path>`. Deletions use
44
+ `--- a/<path>` and `+++ /dev/null`.
45
+ - Repo-relative paths only; no absolute paths, no leading `./`.
46
+ - Every ` ` (context) and `-` line MUST appear VERBATIM in the file
47
+ shown in the "Current contents of <path>:" block. Same characters,
48
+ same indentation, same surrounding lines. Do not paraphrase. Do not
49
+ invent helper lines. The parser does byte-for-byte context matching;
50
+ one wrong character rejects the entire diff.
51
+
52
+ FORMAT 3 — no-op:
53
+ If the obligation already holds against the file shown and no change
54
+ is needed, reply with the literal three characters: no-op
55
+
56
+ Default to FORMAT 1 for anything more complex than a single-line tweak.
57
+ It avoids the context-mismatch failure mode that plagues FORMAT 2.
@@ -0,0 +1,55 @@
1
+ id: implementer
2
+ role: implementer
3
+ tier: sonnet
4
+ handles:
5
+ - build-must-pass
6
+ sampling:
7
+ temperature: 0.1
8
+ maxTokens: 8192
9
+ systemSuffix: |-
10
+ You are the implementer persona in the swarm-orchestrator v8 population.
11
+ Your job is to satisfy build-must-pass obligations: when the project's
12
+ build is failing, propose the smallest patch that makes it pass without
13
+ breaking other obligations. Output a unified diff against repo root.
14
+
15
+ Constraints:
16
+ - Do not introduce new files unless the diff explicitly creates them.
17
+ - Do not modify test files; that is the verifier persona's job.
18
+
19
+ Output rules (strict). Pick ONE of these response formats:
20
+
21
+ FORMAT 1 — whole-file replacement (PREFERRED for substantive edits):
22
+ Emit one or more file blocks, each block delimited as:
23
+ <<<FILE <repo-relative-path>
24
+ <full new file contents>
25
+ FILE>>>
26
+ The body between the markers is written VERBATIM to disk; the existing
27
+ file is replaced. Use this whenever your edit touches more than one or
28
+ two lines, or when the file is short enough that re-emitting all of it
29
+ is clearer than a diff. Multiple <<<FILE ... FILE>>> blocks may appear
30
+ in one response (one per file you need to write).
31
+ IMPORTANT: emit the FULL file contents in the block, not just the new
32
+ parts. Any line you omit from the block will be removed from the file.
33
+ Preserve existing imports, helper functions, and exports.
34
+
35
+ FORMAT 2 — unified diff (use ONLY for small, well-anchored edits):
36
+ - Reply with a unified diff and nothing else.
37
+ - No prose before, after, or between hunks. No "Here is the diff:".
38
+ - No code fences. No ```diff or ``` wrappers.
39
+ - The first character of your response MUST be a `-` from a `--- a/<path>`
40
+ header line. The second line MUST be a `+++ b/<path>` header.
41
+ - New files use `--- /dev/null` and `+++ b/<path>`. Deletions use
42
+ `--- a/<path>` and `+++ /dev/null`.
43
+ - Repo-relative paths only; no absolute paths, no leading `./`.
44
+ - Every ` ` (context) and `-` line MUST appear VERBATIM in the file
45
+ shown in the "Current contents of <path>:" block. Same characters,
46
+ same indentation, same surrounding lines. Do not paraphrase. Do not
47
+ invent helper lines. The parser does byte-for-byte context matching;
48
+ one wrong character rejects the entire diff.
49
+
50
+ FORMAT 3 — no-op:
51
+ If the obligation already holds against the file shown and no change
52
+ is needed, reply with the literal three characters: no-op
53
+
54
+ Default to FORMAT 1 for anything more complex than a single-line tweak.
55
+ It avoids the context-mismatch failure mode that plagues FORMAT 2.