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.
- package/README.md +198 -142
- package/config/personas/architect.yaml +26 -0
- package/config/personas/dependency-auditor.yaml +57 -0
- package/config/personas/documentation-writer.yaml +57 -0
- package/config/personas/implementer.yaml +55 -0
- package/config/personas/migration-specialist.yaml +59 -0
- package/config/personas/security-reviewer.yaml +57 -0
- package/config/personas/test-author.yaml +56 -0
- package/config/personas/verifier.yaml +62 -0
- package/dist/src/audit/aibom/cyclonedx-ml.js +174 -0
- package/dist/src/audit/aibom/index.js +11 -0
- package/dist/src/audit/aibom/ledger-reader.js +40 -0
- package/dist/src/audit/aibom/spdx-ai-profile.js +166 -0
- package/dist/src/audit/cheat-detector/assertion-strip.js +60 -0
- package/dist/src/audit/cheat-detector/audit-config.js +342 -0
- package/dist/src/audit/cheat-detector/comment-only-fix.js +54 -0
- package/dist/src/audit/cheat-detector/confirm-findings.js +96 -0
- package/dist/src/audit/cheat-detector/coverage-erosion.js +67 -0
- package/dist/src/audit/cheat-detector/dead-branch-insertion.js +45 -0
- package/dist/src/audit/cheat-detector/detector-sets.js +86 -0
- package/dist/src/audit/cheat-detector/diff-chunker.js +181 -0
- package/dist/src/audit/cheat-detector/diff-walker.js +241 -0
- package/dist/src/audit/cheat-detector/error-swallow.js +263 -0
- package/dist/src/audit/cheat-detector/exception-rethrow-lost-context.js +38 -0
- package/dist/src/audit/cheat-detector/fake-refactor.js +218 -0
- package/dist/src/audit/cheat-detector/import-resolver.js +313 -0
- package/dist/src/audit/cheat-detector/index.js +174 -0
- package/dist/src/audit/cheat-detector/internal-roots.js +192 -0
- package/dist/src/audit/cheat-detector/judge-primary.js +75 -0
- package/dist/src/audit/cheat-detector/judge-prompts/index.js +25 -0
- package/dist/src/audit/cheat-detector/judge-prompts/types.js +10 -0
- package/dist/src/audit/cheat-detector/judge-prompts/v1-conservative.js +66 -0
- package/dist/src/audit/cheat-detector/judge-prompts/v2-balanced.js +79 -0
- package/dist/src/audit/cheat-detector/llm-judge/anthropic-judge.js +245 -0
- package/dist/src/audit/cheat-detector/llm-judge/cache.js +92 -0
- package/dist/src/audit/cheat-detector/llm-judge/index.js +207 -0
- package/dist/src/audit/cheat-detector/llm-judge/local-judge.js +75 -0
- package/dist/src/audit/cheat-detector/llm-judge/ollama-judge.js +150 -0
- package/dist/src/audit/cheat-detector/llm-judge/types.js +12 -0
- package/dist/src/audit/cheat-detector/manifests/cargo-toml.js +63 -0
- package/dist/src/audit/cheat-detector/manifests/composer-json.js +82 -0
- package/dist/src/audit/cheat-detector/manifests/csproj.js +93 -0
- package/dist/src/audit/cheat-detector/manifests/find-manifests.js +128 -0
- package/dist/src/audit/cheat-detector/manifests/gemfile.js +79 -0
- package/dist/src/audit/cheat-detector/manifests/go-mod.js +73 -0
- package/dist/src/audit/cheat-detector/manifests/gradle.js +97 -0
- package/dist/src/audit/cheat-detector/manifests/index.js +43 -0
- package/dist/src/audit/cheat-detector/manifests/package-json.js +83 -0
- package/dist/src/audit/cheat-detector/manifests/pom-xml.js +78 -0
- package/dist/src/audit/cheat-detector/manifests/pyproject-toml.js +78 -0
- package/dist/src/{cli/cost-prompt.js → audit/cheat-detector/manifests/requirements-txt.js} +20 -15
- package/dist/src/audit/cheat-detector/manifests/types.js +15 -0
- package/dist/src/audit/cheat-detector/matcher-grader.js +267 -0
- package/dist/src/audit/cheat-detector/mock-delta.js +101 -0
- package/dist/src/audit/cheat-detector/mock-of-hallucination.js +284 -0
- package/dist/src/audit/cheat-detector/no-op-fix-helpers.js +157 -0
- package/dist/src/audit/cheat-detector/no-op-fix.js +268 -0
- package/dist/src/audit/cheat-detector/pr-intent.js +85 -0
- package/dist/src/audit/cheat-detector/registries/cache.js +41 -0
- package/dist/src/audit/cheat-detector/registries/github-actions-scan.js +52 -0
- package/dist/src/audit/cheat-detector/registries/index.js +32 -0
- package/dist/src/audit/cheat-detector/registries/offline-allowlist.js +174 -0
- package/dist/src/audit/cheat-detector/registries/types.js +13 -0
- package/dist/src/audit/cheat-detector/subject-paths.js +92 -0
- package/dist/src/audit/cheat-detector/test-import-closure.js +141 -0
- package/dist/src/audit/cheat-detector/test-relaxation.js +194 -0
- package/dist/src/audit/cheat-detector/type-suppression.js +100 -0
- package/dist/src/audit/cheat-detector/verify-findings.js +328 -0
- package/dist/src/audit/execution-grounded/corroborate.js +149 -0
- package/dist/src/audit/execution-grounded/coverage-delta.js +288 -0
- package/dist/src/audit/execution-grounded/dead-branch-restoration.js +457 -0
- package/dist/src/audit/execution-grounded/docker-runner.js +104 -0
- package/dist/src/audit/execution-grounded/eg-cache.js +106 -0
- package/dist/src/audit/execution-grounded/exec-env.js +282 -0
- package/dist/src/audit/execution-grounded/fake-refactor-restoration.js +399 -0
- package/dist/src/audit/execution-grounded/index.js +1151 -0
- package/dist/src/audit/execution-grounded/issue-repro.js +340 -0
- package/dist/src/audit/execution-grounded/mock-restoration.js +396 -0
- package/dist/src/audit/execution-grounded/monorepo.js +83 -0
- package/dist/src/audit/execution-grounded/mutation-check.js +332 -0
- package/dist/src/audit/execution-grounded/no-op-fix-restoration.js +376 -0
- package/dist/src/audit/execution-grounded/sandbox.js +459 -0
- package/dist/src/audit/execution-grounded/test-restoration.js +906 -0
- package/dist/src/audit/execution-grounded/type-suppression-restoration.js +496 -0
- package/dist/src/audit/gate/block-eligibility.js +87 -0
- package/dist/src/audit/gate/block-trigger-ledger.js +39 -0
- package/dist/src/audit/gate/block-trigger-types.js +22 -0
- package/dist/src/audit/gate/block-triggers.js +539 -0
- package/dist/src/audit/gate/calibrate-triggers.js +41 -0
- package/dist/src/audit/gate/gate-decision.js +61 -0
- package/dist/src/audit/gate/revert-proof.js +70 -0
- package/dist/src/audit/gate/self-certifying.js +74 -0
- package/dist/src/audit/gate/wilson.js +56 -0
- package/dist/src/audit/oracle/category-map.js +24 -0
- package/dist/src/audit/oracle/evade/evaders.js +166 -0
- package/dist/src/audit/oracle/inject/assertion-strip.js +32 -0
- package/dist/src/audit/oracle/inject/cheat-mock-mutation.js +37 -0
- package/dist/src/audit/oracle/inject/comment-only-fix.js +33 -0
- package/dist/src/audit/oracle/inject/coverage-erosion.js +35 -0
- package/dist/src/audit/oracle/inject/dead-branch-insertion.js +31 -0
- package/dist/src/audit/oracle/inject/diff-carrier.js +165 -0
- package/dist/src/audit/oracle/inject/error-swallow.js +32 -0
- package/dist/src/audit/oracle/inject/exception-rethrow-lost-context.js +35 -0
- package/dist/src/audit/oracle/inject/fake-refactor.js +32 -0
- package/dist/src/audit/oracle/inject/goal-not-fixed.js +37 -0
- package/dist/src/audit/oracle/inject/index.js +42 -0
- package/dist/src/audit/oracle/inject/injection-runner.js +118 -0
- package/dist/src/audit/oracle/inject/injector-types.js +24 -0
- package/dist/src/audit/oracle/inject/mock-of-hallucination.js +43 -0
- package/dist/src/audit/oracle/inject/no-op-fix.js +47 -0
- package/dist/src/audit/oracle/inject/site.js +10 -0
- package/dist/src/audit/oracle/inject/test-relaxation.js +29 -0
- package/dist/src/audit/oracle/inject/type-suppression.js +33 -0
- package/dist/src/audit/pr-source/index.js +132 -0
- package/dist/src/audit/report-comment/block-trigger-section.js +223 -0
- package/dist/src/audit/report-comment/detector-precision.js +154 -0
- package/dist/src/audit/report-comment/index.js +217 -0
- package/dist/src/audit/shadow-output.js +105 -0
- package/dist/src/audit/shadow.js +103 -0
- package/dist/src/audit/types.js +23 -0
- package/dist/src/cli/flags.js +4 -0
- package/dist/src/cli/v8/argv-schema.js +127 -0
- package/dist/src/cli/v8/audit-handler.js +913 -0
- package/dist/src/cli/v8/compile-handler.js +272 -0
- package/dist/src/cli/v8/doctor-handler.js +849 -0
- package/dist/src/cli/v8/grammar-resolve.js +88 -0
- package/dist/src/cli/v8/index.js +70 -0
- package/dist/src/cli/v8/init-handler.js +177 -0
- package/dist/src/cli/v8/ledger-verify-handler.js +142 -0
- package/dist/src/cli/v8/local-provider-flags.js +275 -0
- package/dist/src/cli/v8/local-provider-types.js +10 -0
- package/dist/src/cli/v8/pr-fetch.js +192 -0
- package/dist/src/cli/v8/pr-manifest-fetch.js +231 -0
- package/dist/src/cli/v8/resume-handler.js +487 -0
- package/dist/src/cli/v8/run-handler.js +564 -0
- package/dist/src/cli/v8/run-wrapper.js +253 -0
- package/dist/src/cli/v8/session-utils.js +121 -0
- package/dist/src/cli/v8/stats-handler.js +270 -0
- package/dist/src/cli.js +51 -166
- package/dist/src/config/provider-config.js +202 -0
- package/dist/src/contract/approval.js +193 -0
- package/dist/src/contract/auto-discover.js +77 -0
- package/dist/src/contract/canonicalize.js +187 -0
- package/dist/src/contract/compiler.js +304 -0
- package/dist/src/contract/extractor/anthropic-extractor.js +266 -0
- package/dist/src/contract/extractor/contract-schema.js +126 -0
- package/dist/src/contract/extractor/deterministic-extractor.js +57 -0
- package/dist/src/contract/extractor/factory.js +105 -0
- package/dist/src/contract/extractor/local-extractor.js +133 -0
- package/dist/src/contract/extractor/scan-pipeline.js +190 -0
- package/dist/src/contract/extractor/stub-extractor.js +89 -0
- package/dist/src/{bootstrap-types.js → contract/extractor/types.js} +0 -3
- package/dist/src/contract/index.js +51 -0
- package/dist/src/contract/schema/loader.js +87 -0
- package/dist/src/contract/schema/v1.json +198 -0
- package/dist/src/contract/serializer.js +139 -0
- package/dist/src/contract/tagger.js +122 -0
- package/dist/src/contract/types.js +22 -0
- package/dist/src/contract/validator.js +235 -0
- package/dist/src/env-loader.js +104 -0
- package/dist/src/errors.js +27 -0
- package/dist/src/falsification/adapters/adapter-profile.js +5 -0
- package/dist/src/falsification/adapters/candidate-runners.js +143 -0
- package/dist/src/falsification/adapters/cli-falsifier.js +171 -0
- package/dist/src/falsification/adapters/fenced-json.js +107 -0
- package/dist/src/falsification/adapters/index.js +30 -0
- package/dist/src/falsification/adapters/profiles/claude-code.js +202 -0
- package/dist/src/falsification/adapters/profiles/codex/prompts/property-must-hold.md +44 -0
- package/dist/src/falsification/adapters/profiles/codex.js +206 -0
- package/dist/src/falsification/adapters/profiles/copilot/prompts/function-must-have-signature.md +58 -0
- package/dist/src/falsification/adapters/profiles/copilot/prompts/import-graph-must-satisfy.md +49 -0
- package/dist/src/falsification/adapters/profiles/copilot/prompts/no-cycles.md +6 -0
- package/dist/src/falsification/adapters/profiles/copilot/prompts/no-upward-imports.md +4 -0
- package/dist/src/falsification/adapters/profiles/copilot.js +184 -0
- package/dist/src/falsification/adapters/registry.js +90 -0
- package/dist/src/falsification/adapters/spawn-cli.js +88 -0
- package/dist/src/falsification/adapters/transient-retry.js +93 -0
- package/dist/src/falsification/adapters/types.js +5 -0
- package/dist/src/falsification/dispatcher.js +70 -0
- package/dist/src/falsification/inspection/heuristic-classifier.js +361 -0
- package/dist/src/falsification/scheduler.js +217 -0
- package/dist/src/index.js +1 -27
- package/dist/src/inference/local/backend.js +30 -0
- package/dist/src/inference/local/backends/llama-cpp.js +181 -0
- package/dist/src/inference/local/backends/ollama.js +186 -0
- package/dist/src/inference/local/backends/openai-compatible.js +187 -0
- package/dist/src/inference/local/backends/vllm.js +175 -0
- package/dist/src/inference/local/concurrency-gate.js +68 -0
- package/dist/src/inference/local/factory.js +89 -0
- package/dist/src/inference/local/grammars/unified-diff.gbnf +26 -0
- package/dist/src/ledger/index.js +26 -0
- package/dist/src/ledger/jsonl-ledger.js +23 -0
- package/dist/src/ledger/ledger.js +212 -0
- package/dist/src/ledger/memoization.js +180 -0
- package/dist/src/ledger/resume.js +139 -0
- package/dist/src/ledger/types.js +6 -0
- package/dist/src/logger.js +0 -15
- package/dist/src/persona/index.js +31 -0
- package/dist/src/persona/persona-registry.js +187 -0
- package/dist/src/persona/predicates.js +54 -0
- package/dist/src/persona/types.js +6 -0
- package/dist/src/persona/verifier-persona.js +138 -0
- package/dist/src/population/apply-verify.js +142 -0
- package/dist/src/population/deterministic-dispatch.js +87 -0
- package/dist/src/population/diff-applier.js +90 -0
- package/dist/src/population/diff-snapshot.js +164 -0
- package/dist/src/population/falsifier-dispatch.js +115 -0
- package/dist/src/population/file-context.js +87 -0
- package/dist/src/population/index.js +27 -0
- package/dist/src/population/manager.js +364 -0
- package/dist/src/population/persona-message.js +186 -0
- package/dist/src/population/pipeline-config.js +73 -0
- package/dist/src/population/post-merge-handler.js +112 -0
- package/dist/src/population/provider-attribution.js +16 -0
- package/dist/src/population/rollback.js +177 -0
- package/dist/src/population/single-mode-executor.js +224 -0
- package/dist/src/population/snapshot-cleanup.js +299 -0
- package/dist/src/population/state.js +48 -0
- package/dist/src/population/test-framework-misuse.js +104 -0
- package/dist/src/population/tournament-driver.js +104 -0
- package/dist/src/population/tournament.js +427 -0
- package/dist/src/population/unified-diff.js +298 -0
- package/dist/src/population/whole-file-apply.js +181 -0
- package/dist/src/session/anthropic-session.js +198 -0
- package/dist/src/session/auto-discover.js +88 -0
- package/dist/src/session/bounded-session.js +94 -0
- package/dist/src/session/deterministic-session.js +331 -0
- package/dist/src/session/factory.js +123 -0
- package/dist/src/session/index.js +28 -0
- package/dist/src/session/local-session.js +221 -0
- package/dist/src/session/stub-session.js +160 -0
- package/dist/src/session/token-estimator.js +23 -0
- package/dist/src/session/types.js +44 -0
- package/dist/src/shared/child-env.js +94 -0
- package/dist/src/shared/obligation-rendering.js +80 -0
- package/dist/src/shared-predicates/index.js +17 -0
- package/dist/src/shared-predicates/predicate-runner.js +62 -0
- package/dist/src/shared-types/index.js +17 -0
- package/dist/src/shared-types/obligation-types.js +25 -0
- package/dist/src/shared-wasm/index.js +17 -0
- package/dist/src/shared-wasm/strategy-constants.js +156 -0
- package/dist/src/verification/ast-imports.js +199 -0
- package/dist/src/verification/ast-signature.js +406 -0
- package/dist/src/verification/index.js +12 -39
- package/dist/src/verification/live-cost-tracker.js +78 -0
- package/dist/src/verification/post-merge.js +53 -0
- package/dist/src/verification/pre-generation.js +71 -0
- package/dist/src/verification/predicate-runner.js +22 -0
- package/dist/src/verification/run-verifier.js +613 -0
- package/dist/src/verification/streaming-verifier.js +162 -0
- package/dist/src/wasm/index.js +29 -0
- package/dist/src/wasm/registry.js +30 -0
- package/dist/src/wasm/strategies/format-prettier.js +119 -0
- package/dist/src/wasm/strategies/import-sort.js +185 -0
- package/dist/src/wasm/strategies/scaffold-template.js +98 -0
- package/dist/src/wasm/types.js +11 -0
- package/dist/src/wasm/wasm-runtime.js +260 -0
- package/package.json +103 -25
- package/agents/reviewer.agent.md +0 -50
- package/agents/worker.agent.md +0 -41
- package/config/default-agents.yaml +0 -56
- package/config/pm-agent.yaml +0 -36
- package/config/quality-gates.yaml +0 -88
- package/config/repair-agent.yaml +0 -34
- package/config/semgrep-rules/complexity-mismatch.yaml +0 -6
- package/config/semgrep-rules/exception-swallowing.yaml +0 -13
- package/config/semgrep-rules/hardcoded-answer.yaml +0 -6
- package/config/semgrep-rules/mock-mutation.yaml +0 -6
- package/config/semgrep-rules/test-modification.yaml +0 -6
- package/config/user-agents.yaml +0 -23
- package/dist/src/adapters/adapter-factory.js +0 -29
- package/dist/src/adapters/agent-adapter.js +0 -32
- package/dist/src/adapters/claude-code-adapter.js +0 -126
- package/dist/src/adapters/claude-code-teams.js +0 -119
- package/dist/src/adapters/codex-adapter.js +0 -118
- package/dist/src/adapters/copilot-adapter.js +0 -224
- package/dist/src/adapters/fatal-error-classifier.js +0 -88
- package/dist/src/adapters/index.js +0 -44
- package/dist/src/adapters/persistent-session.js +0 -204
- package/dist/src/adapters/process-supervisor.js +0 -199
- package/dist/src/agents-exporter.js +0 -398
- package/dist/src/analytics-log.js +0 -161
- package/dist/src/baseline-scanner.js +0 -65
- package/dist/src/bootstrap-evidence.js +0 -88
- package/dist/src/bootstrap-orchestrator.js +0 -205
- package/dist/src/branch-merger.js +0 -427
- package/dist/src/cli/attest-handlers.js +0 -44
- package/dist/src/cli/demo-handlers.js +0 -274
- package/dist/src/cli/index.js +0 -57
- package/dist/src/cli/live-status.js +0 -186
- package/dist/src/cli/misc-handlers.js +0 -242
- package/dist/src/cli/plan-handlers.js +0 -350
- package/dist/src/cli/share-handlers.js +0 -163
- package/dist/src/cli/status-handlers.js +0 -457
- package/dist/src/cli/swarm-handlers.js +0 -638
- package/dist/src/cli/usage.js +0 -72
- package/dist/src/commit-pattern-detector.js +0 -143
- package/dist/src/commit-quality-analyzer.js +0 -38
- package/dist/src/config-loader.js +0 -339
- package/dist/src/context-broker.js +0 -358
- package/dist/src/copilot-cli-wrapper.js +0 -258
- package/dist/src/cost-estimator.js +0 -241
- package/dist/src/defaults.js +0 -18
- package/dist/src/demo-mode.js +0 -180
- package/dist/src/deployment-handler.js +0 -78
- package/dist/src/deployment-manager.js +0 -228
- package/dist/src/execution-queue.js +0 -196
- package/dist/src/external-tool-manager.js +0 -184
- package/dist/src/gate-prompt-builder.js +0 -117
- package/dist/src/gate-remediation.js +0 -173
- package/dist/src/github-issues-ingester.js +0 -152
- package/dist/src/github-mcp-integrator.js +0 -164
- package/dist/src/hook-generator.js +0 -229
- package/dist/src/knowledge-base.js +0 -300
- package/dist/src/meta-analyzer.js +0 -208
- package/dist/src/metrics-collector.js +0 -209
- package/dist/src/metrics-types.js +0 -5
- package/dist/src/multi-repo-coordinator.js +0 -179
- package/dist/src/orchestrator/async-meta-analysis.js +0 -84
- package/dist/src/orchestrator/fatal-run-error.js +0 -43
- package/dist/src/orchestrator/final-gates-remediation.js +0 -258
- package/dist/src/orchestrator/git-state-utils.js +0 -119
- package/dist/src/orchestrator/pause-controller.js +0 -55
- package/dist/src/orchestrator/replan-runner.js +0 -258
- package/dist/src/orchestrator/step-executor.js +0 -391
- package/dist/src/orchestrator/wave-scheduler-loop.js +0 -204
- package/dist/src/owasp-mapper.js +0 -153
- package/dist/src/owasp-report-renderer.js +0 -39
- package/dist/src/plan-files.js +0 -142
- package/dist/src/plan-generator.js +0 -1207
- package/dist/src/pm-agent.js +0 -296
- package/dist/src/post-run-reporter.js +0 -203
- package/dist/src/pr-automation.js +0 -103
- package/dist/src/pr-manager.js +0 -318
- package/dist/src/presenter/index.js +0 -209
- package/dist/src/prompt-builder.js +0 -173
- package/dist/src/quality-gates/config-loader.js +0 -196
- package/dist/src/quality-gates/default-config.js +0 -243
- package/dist/src/quality-gates/file-utils.js +0 -152
- package/dist/src/quality-gates/gate-runner.js +0 -171
- package/dist/src/quality-gates/gates/accessibility.js +0 -355
- package/dist/src/quality-gates/gates/duplicate-blocks.js +0 -144
- package/dist/src/quality-gates/gates/hardcoded-config.js +0 -52
- package/dist/src/quality-gates/gates/readme-claims.js +0 -62
- package/dist/src/quality-gates/gates/runtime-checks.js +0 -265
- package/dist/src/quality-gates/gates/scaffold-defaults.js +0 -108
- package/dist/src/quality-gates/gates/test-coverage.js +0 -240
- package/dist/src/quality-gates/gates/test-file-protection.js +0 -85
- package/dist/src/quality-gates/gates/test-isolation.js +0 -74
- package/dist/src/quality-gates/index.js +0 -17
- package/dist/src/quality-gates/registry.js +0 -205
- package/dist/src/quick-fix-mode.js +0 -302
- package/dist/src/recipe-loader.js +0 -122
- package/dist/src/repair-agent.js +0 -396
- package/dist/src/repo-analyzer.js +0 -342
- package/dist/src/report-generator.js +0 -146
- package/dist/src/report-renderer.js +0 -90
- package/dist/src/requirement-filter.js +0 -52
- package/dist/src/sarif-formatter.js +0 -140
- package/dist/src/scheduling/dependency-analyzer.js +0 -178
- package/dist/src/scheduling/work-stealing-queue.js +0 -123
- package/dist/src/secret-redactor.js +0 -90
- package/dist/src/session-executor.js +0 -587
- package/dist/src/session-manager.js +0 -221
- package/dist/src/share/transcript-verification.js +0 -128
- package/dist/src/share-parser.js +0 -477
- package/dist/src/spinner.js +0 -146
- package/dist/src/step-runner.js +0 -365
- package/dist/src/swarm-orchestrator.js +0 -686
- package/dist/src/task-classifier.js +0 -134
- package/dist/src/test-command-discovery.js +0 -123
- package/dist/src/text-similarity.js +0 -24
- package/dist/src/tier-maps.js +0 -158
- package/dist/src/url-shortener.js +0 -135
- package/dist/src/verification/attestation.js +0 -166
- package/dist/src/verification/cheat-detector.js +0 -240
- package/dist/src/verification/command-runner.js +0 -70
- package/dist/src/verification/composite-score.js +0 -157
- package/dist/src/verification/cosign-attestation.js +0 -137
- package/dist/src/verification/diff-analysis.js +0 -89
- package/dist/src/verification/differential-gate.js +0 -173
- package/dist/src/verification/mutation-gate.js +0 -242
- package/dist/src/verification/property-gate.js +0 -201
- package/dist/src/verification/test-synthesizer.js +0 -243
- package/dist/src/verifier/outcome-checks.js +0 -396
- package/dist/src/verifier/transcript-checks.js +0 -207
- package/dist/src/verifier/verification-reporters.js +0 -148
- package/dist/src/verifier-engine.js +0 -491
- package/dist/src/wave-resizer.js +0 -131
- package/dist/src/wave-scheduler.js +0 -44
- package/dist/src/worktree-manager.js +0 -368
- package/dist/src/worktree-reserved-paths.js +0 -97
- package/plugin/agents/.gitkeep +0 -0
- package/plugin/agents/backend_master.agent.md +0 -72
- package/plugin/agents/devops_pro.agent.md +0 -45
- package/plugin/agents/frontend_expert.agent.md +0 -59
- package/plugin/agents/integrator_finalizer.agent.md +0 -44
- package/plugin/agents/meta_reviewer.agent.md +0 -44
- package/plugin/agents/security_auditor.agent.md +0 -43
- package/plugin/agents/tester_elite.agent.md +0 -43
- package/plugin/hooks/hooks.json +0 -19
- package/plugin/hooks/post-tool-use.json +0 -9
- package/plugin/hooks/pre-tool-use.json +0 -9
- package/plugin/plugin.json +0 -47
- package/plugin/skills/swarm-gates/SKILL.md +0 -53
- package/plugin/skills/swarm-orchestrate/SKILL.md +0 -34
- package/plugin/skills/swarm-verify/SKILL.md +0 -44
- package/templates/README.md +0 -35
- package/templates/cli-tool.json +0 -31
- package/templates/fullstack.json +0 -52
- package/templates/library.json +0 -38
- package/templates/react-app.json +0 -45
- package/templates/recipes/add-api-docs.json +0 -35
- package/templates/recipes/add-auth.json +0 -47
- package/templates/recipes/add-ci.json +0 -39
- package/templates/recipes/add-tests.json +0 -39
- package/templates/recipes/migrate-to-ts.json +0 -42
- package/templates/recipes/refactor-modularize.json +0 -44
- package/templates/recipes/security-audit.json +0 -35
- package/templates/rest-api.json +0 -38
- /package/dist/src/{quality-gates/types.js → audit/cheat-detector/detector-types.js} +0 -0
package/README.md
CHANGED
|
@@ -1,199 +1,255 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
[](LICENSE)
|
|
10
|
-
[](package.json)
|
|
11
|
-
[](package.json)
|
|
12
|
-
[](https://github.com/moonrunnerkc/swarm-orchestrator/actions/workflows/ci.yml)
|
|
13
|
-
[](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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
13
|
+
<!-- BADGES:START -->
|
|
14
|
+
[](https://github.com/moonrunnerkc/swarm-orchestrator/actions/workflows/ci.yml)
|
|
15
|
+
[](LICENSE)
|
|
16
|
+
[](package.json)
|
|
17
|
+
[](package.json)
|
|
18
|
+
[&color=brightgreen)](benchmarks/results/AB-REPORT.md)
|
|
19
|
+
[](benchmarks/real-prs/REAL-WORLD-REPORT.md)
|
|
20
|
+
[&color=brightgreen)](benchmarks/real-prs/v11-BENEFIT-REPORT.md)
|
|
21
|
+
<!-- BADGES:END -->
|
|
36
22
|
|
|
37
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
45
|
+
npm link
|
|
46
|
+
swarm --help
|
|
56
47
|
```
|
|
57
48
|
|
|
58
|
-
|
|
49
|
+
## Quick start
|
|
59
50
|
|
|
60
51
|
```bash
|
|
61
|
-
|
|
62
|
-
|
|
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
|
-
|
|
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
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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
|
-
|
|
70
|
+
Exit codes: `0` advisory or any advise-mode run, `1` block (gate mode only), `2` usage error.
|
|
71
|
+
|
|
72
|
+
## Results
|
|
80
73
|
|
|
81
|
-
|
|
74
|
+
Every number here is reproducible from this repo and runs offline.
|
|
82
75
|
|
|
83
|
-
|
|
76
|
+
### Catches cheats that linters miss
|
|
84
77
|
|
|
85
|
-
|
|
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
|
-
|
|
95
|
+
## Cheat detectors
|
|
88
96
|
|
|
89
|
-
|
|
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
|
-
|
|
|
99
|
+
| Category | Set | Trigger |
|
|
92
100
|
|---|---|---|
|
|
93
|
-
| `
|
|
94
|
-
| `
|
|
95
|
-
| `
|
|
96
|
-
| `
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
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
|
|
120
|
-
|
|
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
|
-
|
|
123
|
-
|
|
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
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
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
|
-
|
|
137
|
-
</details>
|
|
187
|
+
Local-LLM run (Ollama):
|
|
138
188
|
|
|
139
|
-
|
|
140
|
-
|
|
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
|
-
|
|
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
|
-
|
|
145
|
-
</details>
|
|
199
|
+
## Architecture
|
|
146
200
|
|
|
147
|
-
|
|
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
|
-
|
|
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
|
-
|
|
153
|
-
|
|
154
|
-
|
|
|
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
|
-
|
|
|
178
|
-
|
|
|
179
|
-
|
|
|
180
|
-
|
|
|
181
|
-
|
|
|
182
|
-
|
|
|
183
|
-
|
|
|
184
|
-
|
|
|
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
|
-
|
|
219
|
+
`swarm <cmd> --help` for the flag list of any subcommand.
|
|
187
220
|
|
|
188
|
-
|
|
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
|
-
|
|
192
|
-
|
|
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)
|
|
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.
|