opencode-swarm 7.57.0 → 7.58.1

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 (39) hide show
  1. package/.opencode/skills/brainstorm/SKILL.md +142 -0
  2. package/.opencode/skills/clarify/SKILL.md +103 -0
  3. package/.opencode/skills/clarify-spec/SKILL.md +58 -0
  4. package/.opencode/skills/codebase-review-swarm/INSTALL.md +75 -0
  5. package/.opencode/skills/codebase-review-swarm/README.md +44 -0
  6. package/.opencode/skills/codebase-review-swarm/SKILL.md +65 -0
  7. package/.opencode/skills/codebase-review-swarm/agents/openai.yaml +6 -0
  8. package/.opencode/skills/codebase-review-swarm/assets/jsonl-schemas.md +239 -0
  9. package/.opencode/skills/codebase-review-swarm/assets/review-report-template.md +244 -0
  10. package/.opencode/skills/codebase-review-swarm/references/compatibility-and-research-notes.md +25 -0
  11. package/.opencode/skills/codebase-review-swarm/references/full-v7-source-prompt.md +2373 -0
  12. package/.opencode/skills/codebase-review-swarm/references/review-protocol-v8.2.md +310 -0
  13. package/.opencode/skills/codebase-review-swarm/scripts/init-review-run.py +134 -0
  14. package/.opencode/skills/codebase-review-swarm/scripts/validate-skill-package.py +62 -0
  15. package/.opencode/skills/consult/SKILL.md +16 -0
  16. package/.opencode/skills/council/SKILL.md +147 -0
  17. package/.opencode/skills/critic-gate/SKILL.md +59 -0
  18. package/.opencode/skills/deep-dive/SKILL.md +142 -0
  19. package/.opencode/skills/design-docs/SKILL.md +81 -0
  20. package/.opencode/skills/discover/SKILL.md +20 -0
  21. package/.opencode/skills/execute/SKILL.md +191 -0
  22. package/.opencode/skills/issue-ingest/SKILL.md +64 -0
  23. package/.opencode/skills/phase-wrap/SKILL.md +123 -0
  24. package/.opencode/skills/plan/SKILL.md +293 -0
  25. package/.opencode/skills/pre-phase-briefing/SKILL.md +69 -0
  26. package/.opencode/skills/resume/SKILL.md +23 -0
  27. package/.opencode/skills/specify/SKILL.md +175 -0
  28. package/.opencode/skills/swarm-pr-feedback/SKILL.md +192 -0
  29. package/.opencode/skills/swarm-pr-review/SKILL.md +884 -0
  30. package/dist/cli/index.js +1350 -1158
  31. package/dist/commands/command-dispatch.d.ts +1 -0
  32. package/dist/commands/index.d.ts +1 -0
  33. package/dist/commands/registry.d.ts +15 -14
  34. package/dist/config/bundled-skills.d.ts +25 -0
  35. package/dist/index.js +2815 -2605
  36. package/dist/tools/index.d.ts +3 -1
  37. package/dist/tools/tool-metadata.d.ts +1 -1
  38. package/dist/tools/web-search.d.ts +2 -1
  39. package/package.json +20 -1
@@ -0,0 +1,142 @@
1
+ ---
2
+ name: brainstorm
3
+ description: >
4
+ Full execution protocol for MODE: BRAINSTORM -- structured discovery dialogue, approach selection, spec drafting, QA gate selection, and transition handling.
5
+ ---
6
+
7
+ # Brainstorm Protocol
8
+
9
+ This protocol is loaded on demand by the architect stub in src/agents/architect.ts. The architect prompt keeps only activation, action, and hard safety constraints; the full execution details live here.
10
+
11
+ ### MODE: BRAINSTORM
12
+ Activates when: user invokes `/swarm brainstorm`; OR uses phrases like "brainstorm", "let's think through", "think this through with me", "workshop this idea"; OR the problem is fuzzy/exploratory and the user has not yet written (or does not want to directly dictate) a spec.
13
+
14
+ Use BRAINSTORM when requirements need to be drawn out through structured dialogue before committing to a spec. Use SPECIFY when the user has already articulated clear requirements.
15
+
16
+ MODE: BRAINSTORM runs seven phases in strict order. Do not skip phases. Do not collapse phases. Each phase has a clear entry signal and a clear exit signal.
17
+
18
+ **Phase 1: CONTEXT SCAN (architect + explorer, parallel).**
19
+ - Delegate to `the active swarm's explorer agent` to map the relevant portion of the codebase. Scope the explorer to the area most likely affected by the topic.
20
+ - In parallel, read any existing `.swarm/spec.md`, `.swarm/plan.md`, and `.swarm/knowledge.jsonl` entries that are relevant.
21
+ - Run CODEBASE REALITY CHECK on any claims the user made in their topic statement. Surface discrepancies before moving forward.
22
+ - Exit when you have a confident map of: (a) existing code and patterns, (b) relevant prior decisions, (c) what is actually unknown.
23
+
24
+ **Phase 2: DIALOGUE (architect ↔ user).**
25
+ - Ask EXACTLY ONE focused question per message. Wait for the user's answer before asking the next.
26
+ - Prioritize questions that materially change scope, risk, or architecture. Skip questions whose answers can be responsibly defaulted — use informed defaults and say so.
27
+ - Hard cap: no more than SIX questions total in this phase. Stop sooner if uncertainty has collapsed.
28
+ - Each question must include: (a) why it matters, (b) the default you will use if the user doesn't answer, (c) the concrete options you're weighing.
29
+ - Exit when: remaining ambiguity can be defaulted safely, or the user explicitly says "good, move on" or equivalent.
30
+
31
+ **Phase 3: APPROACHES (architect, optionally with SME).**
32
+ - Produce 2-4 distinct candidate approaches. Each approach must have: name, one-paragraph summary, primary tradeoff it optimizes for, primary risk it accepts, rough integration surface.
33
+ - For high-risk domains (auth, payments, data mutation, public API, schema, concurrency, security-sensitive parsing), delegate to `the active swarm's sme agent` for domain research first.
34
+ - Present the approaches to the user and recommend one with explicit reasoning. The user can pick, modify, or reject.
35
+ - Exit when the user has chosen (or agreed to your recommended) approach.
36
+
37
+ **Phase 4: DESIGN SECTIONS (architect).**
38
+ - Draft the structural design of the chosen approach. Include: data model / entities, major components / modules, integration points, invariants, failure modes, rollout considerations.
39
+ - Keep design technology-aware (this is NOT the spec — BRAINSTORM design notes can reference frameworks and patterns).
40
+ - Name the design sections explicitly so you can reference them in the spec without duplicating.
41
+ - Exit with a design outline the user can skim in under two minutes.
42
+
43
+ **Phase 5: SPEC WRITE + SELF-REVIEW (architect + reviewer).**
44
+ - Generate `.swarm/spec.md` following the same SPEC CONTENT RULES that MODE: SPECIFY uses: WHAT/WHY only, no tech stack, no implementation details, FR-### / SC-### numbering, Given/When/Then scenarios, `[NEEDS CLARIFICATION]` markers only for items that survive the clarification funnel: inventory all material uncertainties without numeric cap → classify each (self_resolved/critic_resolved/research_needed/user_decision/deferred_nonblocking) — **overconfidence guard:** if the default is not directly supported by user request, spec, or recorded context, classify as `user_decision` rather than `self_resolved` → consult critic_sounding_board — critic responds per SoundingBoardVerdict: UNNECESSARY→DROP, RESOLVE→RESOLVE, REPHRASE→REPHRASE, APPROVED→ASK_USER — **always-surface protection:** always-surface categories must not receive UNNECESSARY/DROP; override to APPROVED/ASK_USER → record resolved items as assumptions → surface only survivors as markers with decision packet format (grouped by category, recommended defaults, blocking vs optional markers).
45
+ - Cross-reference design sections by name where relevant context helps (but keep HOW out of the spec).
46
+ - Delegate to `the active swarm's reviewer agent` for an independent review of the draft spec. Reviewer must flag: requirements that encode HOW, untestable requirements, missing edge cases, silent assumptions.
47
+ - Apply reviewer feedback. If reviewer rejects, iterate once and re-review. After two rounds, surface remaining disagreements to the user.
48
+ - Write the final spec to `.swarm/spec.md`.
49
+ - Exit when reviewer signs off (or user explicitly accepts remaining disagreements).
50
+
51
+ **Phase 6: QA GATE SELECTION (architect, dialogue only).**
52
+ Now ask the user which QA gates to enable for this plan -- do not select on their behalf.
53
+
54
+ Present the eleven gates with their defaults (DEFAULT_QA_GATES) as a single user-facing question. Offer the user a one-shot choice: accept defaults, or customize. The eleven gates are:
55
+ - reviewer (default: ON) -- code review of coder output
56
+ - test_engineer (default: ON) -- test verification of coder output
57
+ - sme_enabled (default: ON) -- SME consultation during planning/clarification
58
+ - critic_pre_plan (default: ON) -- critic review before plan finalization
59
+ - sast_enabled (default: ON) -- static security scanning
60
+ - council_mode (default: OFF) -- multi-member council gate (recommended for high-impact architecture, public APIs, schema/data mutation, security-sensitive code)
61
+ - hallucination_guard (default: OFF) -- when enabled, mandatory per-phase API/signature/claim/citation verification via critic_hallucination_verifier at PHASE-WRAP; phase_complete will REJECT phase completion unless .swarm/evidence/{phase}/hallucination-guard.json exists with an APPROVED verdict (recommended for claim-heavy or research-heavy work)
62
+ - mutation_test (default: OFF) -- when enabled, runs mutation testing on source files touched this phase via generate_mutants + mutation_test + write_mutation_evidence at PHASE-WRAP; FAIL verdict blocks phase_complete; WARN is non-blocking (recommended for projects with coverage gaps or safety-critical code)
63
+ - council_general_review (default: OFF) -- when enabled, MODE: SPECIFY runs convene_general_council on the draft spec before the critic-gate; the architect runs a curated web_search pass, dispatches council_generalist / council_skeptic / council_domain_expert in parallel with a shared RESEARCH CONTEXT block, deliberates on disagreements, and synthesizes the result directly into the spec (recommended for novel architecture, unclear best practices, or high-risk design decisions). Requires council.general.enabled: true and a configured search API key in the resolved config: global ~/.config/opencode/opencode-swarm.json, then project .opencode/opencode-swarm.json overrides.
64
+ - drift_check (default: ON) -- when enabled, mandatory per-phase drift verification via critic_drift_verifier at PHASE-WRAP; compares implemented changes against spec.md intent; hard-blocks phase_complete when spec.md exists and drift evidence is missing or REJECTED; advisory-only when no spec.md exists (recommended for all projects with a specification)
65
+ - final_council (default: OFF) - when enabled, after all phases complete the architect dispatches the same five phase-council members (`critic`, `reviewer`, `sme`, `test_engineer`, `explorer`) at project scope, collects `CouncilMemberVerdict` objects, and calls `write_final_council_evidence`. This is not General Council mode and does not require `council.general.enabled`.
66
+
67
+ One question, one message, defaults pre-stated. Wait for the user's answer.
68
+
69
+ If the user answered the gate question, immediately follow up with ONE more question: "How many coders should run in parallel? (default: 1, range: 1-4)" -- if the user says a number > 1, also write a `## Pending Parallelization Config` section to `.swarm/context.md` alongside the gate selection:
70
+ ```
71
+ ## Pending Parallelization Config
72
+ - parallelization_enabled: true
73
+ - max_concurrent_tasks: <user's number>
74
+ - council_parallel: false
75
+ - locked: true
76
+ - recorded_at: <ISO timestamp>
77
+ ```
78
+ If the user accepts the default (1), skip writing this section entirely -- serial execution is the default and needs no config.
79
+
80
+ After asking the parallelization question (regardless of whether the user chose serial or parallel), immediately follow up with ONE more question: "Commit frequency for completed tasks? (default: phase-level only; optional per-task checkpoint commit after each task completion)".
81
+
82
+ If the user chooses per-task commits, write this section to `.swarm/context.md`:
83
+ ```
84
+ ## Task Completion Commit Policy
85
+ - commit_after_each_completed_task: true
86
+ - recorded_at: <ISO timestamp>
87
+ ```
88
+ If the user keeps the default phase-level behavior, do not write this section.
89
+
90
+ <!-- BEHAVIORAL_GUIDANCE_START -->
91
+ GATE SELECTION IS MANDATORY — these thoughts are WRONG and must be ignored:
92
+ ✗ "I'll use the defaults — they're probably fine"
93
+ → WRONG: defaults are not the user's decision. The user must be asked every time.
94
+ ✗ "The user didn't mention gates, so defaults are fine"
95
+ → WRONG: silence is not consent. The gate dialogue is not optional.
96
+ ✗ "I'll handle it in MODE: PLAN after the spec is done"
97
+ → WRONG: ## Pending QA Gate Selection must exist in context.md BEFORE save_plan is called.
98
+ save_plan will reject with QA_GATE_SELECTION_REQUIRED if this section is absent.
99
+ ✗ "This feature is simple — gates are obvious"
100
+ → WRONG: complexity does not exempt this step. Gate selection is mandatory for ALL plans.
101
+ ✗ "I already know which gates are right for this project"
102
+ → WRONG: the architect does not configure gates. The user configures gates. Always ask.
103
+ ✗ "council_general_review is off by default, I don't need to mention it"
104
+ → WRONG: every gate is presented with its default stated. The user opts in or accepts the default explicitly.
105
+
106
+ MANDATORY PAUSE: Do NOT write the spec summary (step 7). Do NOT suggest next steps.
107
+ You are BLOCKED until ALL THREE of these conditions are met:
108
+ (1) The gate selection question has been presented to the user in a single message
109
+ (2) The user has responded (accept defaults OR customized list)
110
+ (3) The elected gates have been written to .swarm/context.md under "## Pending QA Gate Selection"
111
+ <!-- BEHAVIORAL_GUIDANCE_END -->
112
+
113
+ Do NOT call `set_qa_gates` yet — `plan.json` does not exist at this point. Once the user answers, write the elected gates to `.swarm/context.md` under a new section:
114
+ ```
115
+ ## Pending QA Gate Selection
116
+ - reviewer: <true|false>
117
+ - test_engineer: <true|false>
118
+ - sme_enabled: <true|false>
119
+ - critic_pre_plan: <true|false>
120
+ - sast_enabled: <true|false>
121
+ - council_mode: <true|false>
122
+ - hallucination_guard: <true|false>
123
+ - mutation_test: <true|false>
124
+ - council_general_review: <true|false>
125
+ - drift_check: <true|false>
126
+ - final_council: <true|false>
127
+ - recorded_at: <ISO timestamp>
128
+ ```
129
+ MODE: PLAN applies these after `save_plan` succeeds via `set_qa_gates`.
130
+ - Exit with the elected gates recorded in `.swarm/context.md` (NOT yet persisted to plan.json).
131
+
132
+ **Phase 7: TRANSITION.**
133
+ - Summarize: (a) chosen approach, (b) design sections produced, (c) spec written, (d) QA gates selected, (e) remaining `[NEEDS CLARIFICATION]` markers.
134
+ - Offer the user two next steps: `PLAN` (go to MODE: PLAN and write plan.md) or `CLARIFY-SPEC` (resolve remaining markers first).
135
+ - Do NOT proceed to PLAN or CLARIFY-SPEC automatically — wait for user direction.
136
+
137
+ BRAINSTORM RULES:
138
+ - No skipping phases. Each phase's exit condition must be met before moving on.
139
+ - One question per message in DIALOGUE — never batch.
140
+ - Always offer an informed default for every question.
141
+ - The spec produced in Phase 5 must still satisfy the SPEC CONTENT RULES (no tech stack, no implementation details).
142
+ - QA gates elected in Phase 6 are persisted during MODE: PLAN after `save_plan` succeeds and are ratchet-tighter from that point — once persisted you cannot undo them later in the session.
@@ -0,0 +1,103 @@
1
+ ---
2
+ name: clarify
3
+ description: >
4
+ Full execution protocol for MODE: CLARIFY -- structured clarification funnel with critic review before surfacing user decisions.
5
+ ---
6
+
7
+ # Clarify Protocol
8
+
9
+ This protocol is loaded on demand by the architect stub in src/agents/architect.ts. The architect prompt keeps only activation, action, and hard safety constraints; the full execution details live here.
10
+
11
+ ### MODE: CLARIFY
12
+ Ambiguous request → Run the clarification funnel
13
+ Clear request → MODE: DISCOVER
14
+
15
+ ### Clarification Funnel
16
+
17
+ Before surfacing any clarification question to the user, the architect MUST run this four-stage funnel. The goal is to limit unnecessary user interruption, not planning completeness.
18
+
19
+ #### Stage 1: Inventory All Material Uncertainties
20
+
21
+ Identify ALL uncertainties that could affect:
22
+ - Scope boundaries
23
+ - User-visible behavior
24
+ - Destructive behavior or data loss
25
+ - Security/privacy posture
26
+ - Backward compatibility
27
+ - Migrations or rollout strategy
28
+ - Cost/performance tradeoffs
29
+ - Operational complexity
30
+ - QA gate selection or enforcement strictness
31
+ - Architecture choice among materially different paths
32
+ - Dependency or platform assumptions
33
+
34
+ There is NO hard cap on the internal inventory. Record every material uncertainty found.
35
+
36
+ #### Stage 2: Classify Each Uncertainty
37
+
38
+ Classify each item as exactly one of:
39
+ - `self_resolved`: answered from the user request, spec, plan, codebase reality check, `.swarm/context.md`, repo conventions, or an informed default. **If the default is not directly supported by user request, spec, or recorded context, classify as `user_decision` rather than `self_resolved`.**
40
+ - `critic_resolved`: sent to Critic Sounding Board and resolved by the critic.
41
+ - `research_needed`: needs SME/explorer/domain lookup before user escalation.
42
+ - `user_decision`: only the user can decide because it affects product scope, risk tolerance, policy, budget, UX, rollout, or destructive behavior.
43
+ - `deferred_nonblocking`: useful follow-up detail that does not block a correct initial plan and can be explicitly recorded as an assumption or follow-up.
44
+
45
+ #### Stage 3: Consult Critic Sounding Board
46
+
47
+ Before asking the user any clarification question, the architect MUST consult `critic_sounding_board` with the candidate question set and context.
48
+
49
+ For each item classified as `research_needed` or `user_decision` in Stage 2, send it to the critic. The critic responds with a verdict from `SoundingBoardVerdict` (see `src/agents/critic.ts`). The mapping between critic verdicts and funnel actions is:
50
+
51
+ | Critic Verdict (SoundingBoardVerdict) | Funnel Action | Meaning |
52
+ |---|---|---|
53
+ | `UNNECESSARY` | DROP | Item is unnecessary or answerable from existing context |
54
+ | `RESOLVE` | RESOLVE | Critic supplies the answer or recommended default |
55
+ | `REPHRASE` | REPHRASE | Question is valid but should be clearer, narrower, or grouped |
56
+ | `APPROVED` | ASK_USER | User decision is genuinely required |
57
+
58
+ **Hard constraint:** Items in the Always-Surface Categories list (below) MUST NOT receive `UNNECESSARY`/`DROP` from the critic — only `REPHRASE` or `APPROVED`/`ASK_USER` are allowed. If the critic attempts to `UNNECESSARY`/`DROP` an always-surface item, override to `APPROVED`/`ASK_USER`.
59
+
60
+ **Overconfidence guard:** If the critic attempts to self-resolve an item by supplying an answer (verdict `RESOLVE`) but the underlying default is not directly supported by user request, spec, or recorded context, the architect MUST classify the item as `user_decision` rather than `self_resolved`. Unsupported defaults must not be silently accepted.
61
+
62
+ Update classifications based on critic response:
63
+ - `UNNECESSARY`/`DROP` → reclassify as `self_resolved` and record the reason.
64
+ - `RESOLVE` → reclassify as `critic_resolved` and record the answer as an assumption.
65
+ - `REPHRASE` → update the question wording and keep as candidate.
66
+ - `APPROVED`/`ASK_USER` → confirm as `user_decision`.
67
+
68
+ Record all resolved items as explicit assumptions before proceeding.
69
+
70
+ #### Stage 4: Surface User Decision Packet
71
+
72
+ If any items remain classified as `user_decision` after Stage 3, present them as a structured decision packet — NOT as an arbitrary subset.
73
+
74
+ The packet MUST include for each decision:
75
+ - Category grouping (scope, security, compatibility, performance, UX, rollout, QA policy)
76
+ - Why the decision matters
77
+ - Recommended default when safe
78
+ - Options being weighed
79
+ - Impact of accepting the default
80
+ - Blocking vs optional marker
81
+
82
+ The architect MAY ask questions one at a time in interactive mode, but MUST preserve and report the full unresolved list. The architect MUST NOT drop unresolved decisions because of a session question cap.
83
+
84
+ ### Always-Surface Categories
85
+
86
+ The critic may improve wording or confirm prior context, but these categories MUST be surfaced to the user unless already explicitly answered by the user or by recorded context:
87
+ - Scope boundaries: what is in or out
88
+ - Data loss or destructive behavior
89
+ - Security/privacy risk tolerance
90
+ - Backward compatibility or migration policy
91
+ - Breaking changes to existing APIs, contracts, or interfaces
92
+ - New dependency additions or version changes
93
+ - Deprecation decisions for existing features or APIs
94
+ - Cross-platform impact (Windows/macOS/Linux differences)
95
+ - Cost/performance tradeoffs
96
+ - User-visible behavior and UX choices
97
+ - Release/rollout strategy
98
+ - Optional QA gates or stricter enforcement modes
99
+ - Any choice that changes whether the work is advisory vs hard-blocking
100
+
101
+ ### Assumptions Recording
102
+
103
+ All items resolved in Stages 2-3 (self_resolved, critic_resolved, deferred_nonblocking) MUST be recorded as explicit assumptions in the spec, plan, or `.swarm/context.md`. Silently dropping resolved uncertainties is a protocol violation — every uncertainty that entered the funnel must have a recorded outcome.
@@ -0,0 +1,58 @@
1
+ ---
2
+ name: clarify-spec
3
+ description: >
4
+ Full execution protocol for MODE: CLARIFY-SPEC -- resolving spec clarification markers and maintaining spec/planning alignment.
5
+ ---
6
+
7
+ # Clarify Spec Protocol
8
+
9
+ This protocol is loaded on demand by the architect stub in src/agents/architect.ts. The architect prompt keeps only activation, action, and hard safety constraints; the full execution details live here.
10
+
11
+ ### MODE: CLARIFY-SPEC
12
+ Activates when: `.swarm/spec.md` exists AND contains `[NEEDS CLARIFICATION]` markers; OR user says "clarify", "refine spec", "review spec", or "/swarm clarify" is invoked; OR architect transitions from MODE: SPECIFY with open markers.
13
+
14
+ CONSTRAINT: CLARIFY-SPEC must NEVER create a spec. If `.swarm/spec.md` does not exist, tell the user: "No spec found. Use `/swarm specify` to generate one first." and stop.
15
+
16
+ 1. Read `.swarm/spec.md` (read current spec FIRST before making any changes).
17
+ 2. Scan for ambiguities beyond explicit `[NEEDS CLARIFICATION]` markers:
18
+ - Vague adjectives ("fast", "secure", "user-friendly") without measurable targets
19
+ - Requirements that overlap or potentially conflict with each other
20
+ - Edge cases implied but not explicitly addressed in the spec
21
+ - Acceptance criteria (SC-###) that are not independently testable
22
+ 3. Present all spec modifications using delta format with ## ADDED/MODIFIED/REMOVED Requirements sections:
23
+ - ## ADDED Requirements: New requirements being added to the spec
24
+ - ## MODIFIED Requirements: Existing requirements being revised (show old vs new)
25
+ - ## REMOVED Requirements: Requirements being deleted (show what was removed)
26
+ 4. Delegate to `the active swarm's sme agent` for domain research on ambiguous areas before presenting questions.
27
+ 5. Present questions to the user ONE AT A TIME (max 8 per session):
28
+ - Offer 2–4 multiple-choice options for each question
29
+ - Mark the recommended option with reasoning (e.g., "Recommended: Option 2 because…")
30
+ - Allow free-form input as an alternative to the options
31
+ 5. After each accepted answer:
32
+ - Immediately update `.swarm/spec.md` with the resolution
33
+ - Replace the relevant `[NEEDS CLARIFICATION]` marker or vague language with the accepted answer
34
+ - If the answer invalidates an earlier requirement, update it to remove the contradiction
35
+ 6. Stop when: all critical ambiguities are resolved, user says "done" or "stop", or 8 questions have been asked.
36
+ 7. Report a ## Clarification Summary: total questions asked, requirements added/modified/removed, remaining open ambiguities (if any), and suggest next step (`PLAN` if spec is clear, or continue clarifying).
37
+
38
+ CLARIFY-SPEC RULES:
39
+ - FR-ID increment rule: When adding new requirements, find the highest existing FR-ID and increment from there (FR-001 → FR-002). Never reuse or skip FR-IDs.
40
+ - One question at a time — never ask multiple questions in the same message.
41
+ - Do not modify any part of the spec that was not affected by the accepted answer.
42
+ - Always write the accepted answer back to spec.md before presenting the next question.
43
+ - Max 8 questions per session — if limit reached, report remaining ambiguities and stop.
44
+ - Do not create or overwrite the spec file — only refine what exists.
45
+
46
+ ### Scoped Funnel Protocol (CLARIFY-SPEC only)
47
+
48
+ CLARIFY-SPEC handles **already-surfaced** `[NEEDS CLARIFICATION]` markers and spec ambiguities — it does not perform open-ended discovery of new uncertainties. The full four-stage clarification funnel (inventory, classify, consult critic, surface) described in the clarify skill applies to MODE: CLARIFY and MODE: PLAN, not here.
49
+
50
+ However, before surfacing each marker question to the user, CLARIFY-SPEC MUST:
51
+
52
+ 1. **Consult `critic_sounding_board`** with the candidate marker question and surrounding spec context to check whether the question wording can be improved or the item can be resolved from existing context.
53
+ 2. **Apply the overconfidence guard:** If the critic supplies a `RESOLVE` verdict with a default answer, but that default is not directly supported by user request, spec, or recorded context, classify the item as `user_decision` rather than `self_resolved`.
54
+ 3. **Apply always-surface protection:** If the marker belongs to an always-surface category (scope boundaries, destructive behavior, security/privacy, backward compatibility, breaking API changes, new dependencies, deprecations, cross-platform impact, cost/performance tradeoffs, user-visible UX, rollout strategy, QA gates), the item MUST NOT receive `UNNECESSARY`/`DROP` from the critic — override to `APPROVED`/`ASK_USER`.
55
+
56
+ Critic verdict mapping (see `src/agents/critic.ts` `SoundingBoardVerdict`): `UNNECESSARY`→DROP, `RESOLVE`→RESOLVE, `REPHRASE`→REPHRASE, `APPROVED`→ASK_USER.
57
+
58
+ This scoped protocol is lighter than the full funnel because CLARIFY-SPEC starts from known markers rather than open uncertainty inventory, but it still protects against overconfident self-resolution and premature dropping of important questions.
@@ -0,0 +1,75 @@
1
+ # Installation
2
+
3
+ The canonical portable package is the folder `codebase-review-swarm/` containing `SKILL.md`, `references/`, `assets/`, `scripts/`, and optional Codex metadata in `agents/openai.yaml`.
4
+
5
+ ## Repository-local install
6
+
7
+ ### Codex and OpenCode
8
+
9
+ From the opencode-swarm repository root into another repository:
10
+
11
+ ```sh
12
+ TARGET_REPO=/path/to/repo
13
+ mkdir -p "$TARGET_REPO/.agents/skills"
14
+ cp -R .opencode/skills/codebase-review-swarm "$TARGET_REPO/.agents/skills/"
15
+ ```
16
+
17
+ Then invoke explicitly as `$codebase-review-swarm` or ask for a comprehensive codebase review. Codex scans `.agents/skills` from the current directory to repo root. OpenCode also supports `.agents/skills`.
18
+
19
+ ### opencode-swarm repository layout
20
+
21
+ Within the opencode-swarm plugin repository, keep the full canonical protocol in:
22
+
23
+ ```sh
24
+ .opencode/skills/codebase-review-swarm/
25
+ ```
26
+
27
+ Keep `.claude/skills/codebase-review-swarm/` and `.agents/skills/codebase-review-swarm/` as thin adapters that point to the canonical OpenCode skill.
28
+
29
+ ### Claude Code
30
+
31
+ From the repository root:
32
+
33
+ ```sh
34
+ TARGET_REPO=/path/to/repo
35
+ mkdir -p "$TARGET_REPO/.claude/skills"
36
+ cp -R .opencode/skills/codebase-review-swarm "$TARGET_REPO/.claude/skills/"
37
+ ```
38
+
39
+ Claude Code discovers project skills under `.claude/skills/<skill-name>/SKILL.md`.
40
+
41
+ ### OpenCode alternative for other repositories
42
+
43
+ ```sh
44
+ TARGET_REPO=/path/to/repo
45
+ mkdir -p "$TARGET_REPO/.opencode/skills"
46
+ cp -R .opencode/skills/codebase-review-swarm "$TARGET_REPO/.opencode/skills/"
47
+ ```
48
+
49
+ ## User-global install
50
+
51
+ ```sh
52
+ mkdir -p ~/.agents/skills
53
+ cp -R .opencode/skills/codebase-review-swarm ~/.agents/skills/
54
+ ```
55
+
56
+ For Claude-only global use:
57
+
58
+ ```sh
59
+ mkdir -p ~/.claude/skills
60
+ cp -R .opencode/skills/codebase-review-swarm ~/.claude/skills/
61
+ ```
62
+
63
+ ## Suggested repository instruction
64
+
65
+ Add this to `AGENTS.md`, `CLAUDE.md`, or equivalent repository agent instructions:
66
+
67
+ ```markdown
68
+ When asked for a comprehensive codebase review, QA audit, security/supply-chain review, AI-slop review, accessibility review, performance/observability review, or enhancement catalog, invoke `$codebase-review-swarm`. Run Phase 0 inventory first, stop for review-mode selection unless the user already selected tracks, and do not modify source files.
69
+ ```
70
+
71
+ ## Validation
72
+
73
+ ```sh
74
+ python3 .opencode/skills/codebase-review-swarm/scripts/validate-skill-package.py .opencode/skills/codebase-review-swarm
75
+ ```
@@ -0,0 +1,44 @@
1
+ # Codebase Review Swarm Skill v8.2
2
+
3
+ Portable Agent Skill for OpenCode, Codex, and Claude Code. It converts the v7 codebase-review swarm prompt into a progressive-disclosure skill package with a short routing-focused `SKILL.md`, detailed protocol references, parseable schemas, report template, optional Codex metadata, and deterministic helper scripts.
4
+
5
+ ## Contents
6
+
7
+ ```text
8
+ codebase-review-swarm/
9
+ SKILL.md
10
+ INSTALL.md
11
+ README.md
12
+ agents/
13
+ openai.yaml
14
+ assets/
15
+ jsonl-schemas.md
16
+ review-report-template.md
17
+ references/
18
+ compatibility-and-research-notes.md
19
+ full-v7-source-prompt.md
20
+ review-protocol-v8.2.md
21
+ scripts/
22
+ init-review-run.py
23
+ validate-skill-package.py
24
+ ```
25
+
26
+ ## Design summary
27
+
28
+ - Canonical opencode-swarm repo path: `.opencode/skills/codebase-review-swarm/`.
29
+ - Claude path: `.claude/skills/codebase-review-swarm/` as a thin adapter to the canonical OpenCode skill.
30
+ - Codex path: `.agents/skills/codebase-review-swarm/` as a thin adapter with `agents/openai.yaml`.
31
+ - Portable user install paths may still use `.agents/skills/`, `.opencode/skills/`, or `.claude/skills/` depending on host.
32
+ - Frontmatter is intentionally portable: required `name` and `description`, plus harmless metadata.
33
+ - Long instructions are split into references/assets to preserve routing quality and context budget.
34
+ - Focused track selections expand depth inside the selected domain; multi-track/all-track selections add waves rather than sacrificing per-track quality.
35
+ - The full v7 prompt is preserved verbatim for detailed track checklists.
36
+ - Standards are current as of 2026-06-08: ASVS 5.0.0, OWASP LLM Top 10 2025, SLSA v1.2, WCAG 2.2 AA, OpenTelemetry.
37
+
38
+ ## Primary command
39
+
40
+ ```text
41
+ $codebase-review-swarm
42
+ ```
43
+
44
+ Begin at repository root. The skill runs Phase 0 inventory, stops for review mode selection unless preselected, then performs selected exhaustive tracks with coverage closure, review-depth planning, non-diluting multi-track execution, and critic validation.
@@ -0,0 +1,65 @@
1
+ ---
2
+ name: codebase-review-swarm
3
+ description: Run a rigorous, quote-grounded codebase review or security/QA/accessibility/performance/AI-slop/enhancement audit. Use for full-repo or large-subsystem review reports; not for normal implementation. Performs Phase 0 inventory, selected exhaustive tracks with non-diluting depth, coverage closure, reviewer/critic validation, and writes .swarm/review-v8 artifacts without modifying source files.
4
+ license: MIT
5
+ metadata:
6
+ version: "8.2.0"
7
+ generated: "2026-06-08"
8
+ source_prompt: "codebase-review-swarm-prompt-v7"
9
+ artifact_root: ".swarm/review-v8/runs/<run_id>/"
10
+ ---
11
+
12
+ # Codebase Review Swarm
13
+
14
+ Use this skill when the user asks for a deep codebase audit, full QA review, security review, supply-chain review, AI-slop/provenance review, UI/accessibility review, performance/observability review, or enhancement catalog. Do not use it for ordinary bug fixing, feature implementation, or quick PR comments unless the user explicitly wants the full evidence-gated review workflow.
15
+
16
+ You are the Architect/orchestrator. You produce a verified review report and supporting artifacts. You do not modify source files. Source edits, automatic fixes, dependency upgrades, and remediation patches are out of scope unless the user starts a separate implementation task after the report.
17
+
18
+ ## Load order
19
+
20
+ Read these files before executing:
21
+
22
+ 1. `references/review-protocol-v8.2.md` - authoritative workflow, phases, track contracts, and standards.
23
+ 2. `assets/jsonl-schemas.md` - exact parseable block formats for inventory, candidates, validation, critic, and coverage artifacts.
24
+ 3. `assets/review-report-template.md` - final `review-report.md` structure.
25
+ 4. `references/full-v7-source-prompt.md` - full source prompt and long track checklists; load only when the concise protocol is insufficient for a selected track or output format.
26
+
27
+ Optional deterministic helpers:
28
+
29
+ - `scripts/init-review-run.py` creates the `.swarm/review-v8/runs/<run_id>/` artifact tree and warns if `.swarm/` is not ignored.
30
+ - `scripts/validate-skill-package.py` checks the local skill package shape.
31
+
32
+ ## Non-negotiable invariants
33
+
34
+ 1. **No Quote, No Claim.** Every repo-derived factual claim must cite exact relative file path, line or range, verbatim excerpt, and what the excerpt proves.
35
+ 2. **Coverage closure.** Every selected-track coverage unit must end `REVIEWED`, `NOT_APPLICABLE`, `SKIPPED_WITH_REASON`, or `BLOCKED`. A final report is forbidden while any selected-track unit is `UNASSIGNED` or `UNREVIEWED`.
36
+ 3. **Depth scales with focus and never dilutes with breadth.** Selecting one track concentrates effort into that track: increase coverage granularity, caller/callee tracing, deterministic tool use, runtime validation attempts, test/claim comparison, and critic passes for that domain. Selecting multiple tracks or all tracks does not permit any track to be shallower than it would be in a single-track run; decompose into more passes, smaller batches, or sequential waves instead.
37
+ 4. **Candidates are not findings.** Explorer output is candidate evidence only. Reviewer validation filters false positives. Critic validation is mandatory for CRITICAL/HIGH defects and all report-eligible enhancements. Final whole-report critic must PASS before completion.
38
+ 5. **Deterministic before judgment.** Mechanically check imports, manifests, lockfiles, package existence, route wiring, CLI scripts, framework signatures, public exports, and test assertions before subjective reasoning. Run safe SAST, dependency scanners, linters, typecheckers, tests, or MCP/security scanners when available and relevant.
39
+ 6. **Disproof required.** Every candidate records the alternative interpretation that would make it wrong and where that interpretation was checked. CRITICAL/HIGH candidates lacking a clear disproof model must be downgraded before validation.
40
+ 7. **Runtime validation when runtime matters.** Static review is insufficient for routing, auth/session state, async ordering, database state, feature flags, bundling, rendering, LLM/tool execution, MCP permissions, or cross-platform shell behavior. Run the smallest safe validation or mark the item `UNVERIFIED`.
41
+ 8. **Separate defects from enhancements.** Defects are shipped behavior that is wrong, unsafe, broken, misleading, or materially incomplete. Enhancements improve working code without implying breakage. Do not duplicate the same root issue in both forms.
42
+ 9. **Evidence-based AI slop only.** Never report "looks generated" findings. Quote concrete repeated patterns, phantom APIs/dependencies, confident stubs, stale API usage, excessive churn, mock-only tests, or unmodified scaffold defaults.
43
+ 10. **Quality over speed.** Parallelize only independent scopes. If quality and concurrency conflict, quality wins.
44
+ 11. **No fixed budget compression.** Never fit the review to an assumed time/token budget by sampling selected scopes, increasing batch size, reducing validation, or omitting low-salience files. When scope is large, split work; when splitting is insufficient, mark precise coverage units `BLOCKED` or `SKIPPED_WITH_REASON` rather than producing a weaker report.
45
+
46
+ ## Current standards to apply
47
+
48
+ Use these baselines unless repository policy explicitly requires stricter or older controls:
49
+
50
+ - OWASP ASVS 5.0.0 for web application control review.
51
+ - OWASP Top 10 for LLM Applications 2025 for LLM, agent, RAG, and model-output security.
52
+ - SLSA v1.2 and OpenSSF Scorecard checks for build/release provenance and repository hygiene.
53
+ - WCAG 2.2 AA for UI accessibility.
54
+ - OpenTelemetry semantic model: traces, metrics, logs, baggage/context propagation where applicable.
55
+
56
+ ## Execution outline
57
+
58
+ 1. Run Phase 0 inventory in the strict dependency order from `references/review-protocol-v8.2.md` and write the source-of-truth packet.
59
+ 2. Stop after Phase 0 and ask the user to choose review mode unless the original request already selected tracks and explicitly authorized continuing.
60
+ 3. Build coverage units for the selected tracks and write a `review-depth-plan.md` that proves each selected track receives full-depth treatment.
61
+ 4. Generate candidates by selected track only, using exact scope assignments and quoted evidence. Focused selections must expand depth within selected tracks; multi-track selections must add waves, not dilute depth.
62
+ 5. Validate candidates in small local reasoning batches.
63
+ 6. Run inline critic for CRITICAL/HIGH defects, enhancement critic for all kept enhancements, and final whole-report critic.
64
+ 7. Write `review-report.md` only after coverage closure and final critic PASS.
65
+ 8. Final response reports only the run path, selected tracks, counts summary, highest-risk items, coverage limitations, and confirmation that no source files were modified.
@@ -0,0 +1,6 @@
1
+ interface:
2
+ display_name: "Codebase Review Swarm"
3
+ short_description: "Evidence-gated full-repo audit with Phase 0 inventory, non-diluting selected-track depth, coverage closure, reviewer/critic validation, and .swarm artifacts."
4
+ default_prompt: "Use $codebase-review-swarm to run a quote-grounded codebase review. Begin at repository root with Phase 0 inventory."
5
+ policy:
6
+ allow_implicit_invocation: false