[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M732B68QR7V5K55VHVSP2Y0J":3,"skill-same:01M732B68QR7V5K55VHVSP2Y0J":47},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":30,"ownerDescription":31,"updatedAt":32,"install":33,"resources":46},"01M732B68QR7V5K55VHVSP2Y0J","phase-wrap",null,"Full execution protocol for MODE: PHASE-WRAP -- phase boundary evidence, drift and hallucination gates, retrospectives, phase completion, and final council.","djimit\u002Fdjimitflo","djimit","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F19958832?v=4","01M7327CH792DZPFZPYAEFPRXT","Dutch Dim","01M7327CHWPSXT9AWE4MPWCX9Q",2,"MIT","https:\u002F\u002Fgithub.com\u002Fdjimit\u002Fdjimitflo\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fphase-wrap\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: phase-wrap\ndescription: >\n  Full execution protocol for MODE: PHASE-WRAP -- phase boundary evidence, drift and hallucination gates, retrospectives, phase completion, and final council.\n---\n\n# Phase Wrap Protocol\n\nThis protocol is loaded on demand by the architect stub in src\u002Fagents\u002Farchitect.ts. The architect prompt keeps only activation, action, and hard safety constraints; the full execution details live here.\n\n## ⛔ RETROSPECTIVE GATE\n\n**MANDATORY before calling phase_complete.** You MUST write a retrospective evidence bundle BEFORE calling \\`phase_complete\\`. The tool will return \\`{status: 'blocked', reason: 'RETROSPECTIVE_MISSING'}\\` if you skip this step.\n\n**How to write the retrospective:**\n\nCall the \\`write_retro\\` tool with the required fields:\n- \\`phase\\`: The phase number being completed (e.g., 1, 2, 3)\n- \\`summary\\`: Human-readable summary of the phase\n- \\`task_count\\`: Count of tasks completed in this phase\n- \\`task_complexity\\`: One of \\`trivial\\` | \\`simple\\` | \\`moderate\\` | \\`complex\\`\n- \\`total_tool_calls\\`: Total number of tool calls in this phase\n- \\`coder_revisions\\`: Number of coder revisions made\n- \\`reviewer_rejections\\`: Number of reviewer rejections received\n- \\`test_failures\\`: Number of test failures encountered\n- \\`security_findings\\`: Number of security findings\n- \\`integration_issues\\`: Number of integration issues\n- \\`lessons_learned\\` (\"lessons_learned\"): (optional) Key lessons learned from this phase (max 5)\n- \\`top_rejection_reasons\\`: (optional) Top reasons for reviewer rejections\n- \\`metadata\\`: (optional) Additional metadata, e.g., \\`{ \"plan_id\": \"\u003Ccurrent plan title from .swarm\u002Fplan.json>\" }\\`\n\nThe tool will automatically write the retrospective to \\`.swarm\u002Fevidence\u002Fretro-{phase}\u002Fevidence.json\\` with the correct schema wrapper. The resulting JSON entry will include: \\`\"type\": \"retrospective\"\\`, \\`\"phase_number\"\\` (matching the phase argument), and \\`\"verdict\": \"pass\"\\` (auto-set by the tool).\n\n**Required field rules:**\n- \\`verdict\\` is auto-generated by write_retro with value \\`\"pass\"\\`. The resulting retrospective entry will have verdict \\`\"pass\"\\`; this is required for phase_complete to succeed.\n- \\`phase\\` MUST match the phase number you are completing\n- \\`lessons_learned\\` should be 3-5 concrete, actionable items from this phase\n- Write the bundle as task_id \\`retro-{N}\\` (e.g., \\`retro-1\\` for Phase 1, \\`retro-2\\` for Phase 2)\n- \\`metadata.plan_id\\` should be set to the current project's plan title (from \\`.swarm\u002Fplan.json\\` header). This enables cross-project filtering in the retrospective injection system.\n\n### Additional retrospective fields (capture when applicable):\n- \\`user_directives\\`: Any corrections or preferences the user expressed during this phase\n  - \\`directive\\`: what the user said (non-empty string)\n  - \\`category\\`: \\`tooling\\` | \\`code_style\\` | \\`architecture\\` | \\`process\\` | \\`other\\`\n  - \\`scope\\`: \\`session\\` (one-time, do not carry forward) | \\`project\\` (persist to context.md) | \\`global\\` (user preference)\n- \\`approaches_tried\\`: Approaches attempted during this phase (max 10)\n  - \\`approach\\`: what was tried (non-empty string)\n  - \\`result\\`: \\`success\\` | \\`failure\\` | \\`partial\\`\n  - \\`abandoned_reason\\`: why it was abandoned (required when result is \\`failure\\` or \\`partial\\`)\n\n**⚠️ WARNING:** Calling \\`phase_complete(N)\\` without a valid \\`retro-N\\` bundle will be BLOCKED. The error response will be:\n\\`{ \"status\": \"blocked\", \"reason\": \"RETROSPECTIVE_MISSING\" }\\`\n\n### MODE: PHASE-WRAP\n1. the active swarm's explorer agent - Rescan\n2. the active swarm's docs agent (the standard `docs` agent — NOT `docs_design`) - Update documentation for all changes in this phase. Provide:\n   - Complete list of files changed during this phase\n   - Summary of what was added\u002Fmodified\u002Fremoved\n   - List of doc files that may need updating (README.md, CONTRIBUTING.md, docs\u002F)\n   Do NOT dispatch `docs_design` here. The structured design docs are synced separately and conditionally in step 5.58.\n3. Update context.md\n4. Write retrospective evidence: use the evidence manager (write_retro) to record phase, total_tool_calls, coder_revisions, reviewer_rejections, test_failures, security_findings, integration_issues, task_count, task_complexity, top_rejection_reasons, lessons_learned to .swarm\u002Fevidence\u002F. Reset Phase Metrics in context.md to 0.\n4.5. Run `evidence_check` to verify all completed tasks have required evidence (review + test). If gaps found, note in retrospective lessons_learned. Optionally run `pkg_audit` if dependencies were modified during this phase. Optionally run `schema_drift` if API routes were modified during this phase.\n5. Run `sbom_generate` with scope='changed' to capture post-implementation dependency snapshot (saved to `.swarm\u002Fevidence\u002Fsbom\u002F`). This is a non-blocking step - always proceeds to summary.\n5.5. **Drift verification**: Conditional on an EFFECTIVE spec existing (determined via `\u002Fswarm sdd status` or `readEffectiveSpecSync` — native `.swarm\u002Fspec.md`, OpenSpec `openspec\u002F`, or Spec-Kit `.specify\u002F`). If NO effective spec exists at all, skip silently. If an effective spec exists (even openspec-only or specify-only), delegate to the active swarm's critic_drift_verifier agent with DRIFT-CHECK context:\n   - Provide: phase number being completed, completed task IDs and their descriptions\n   - Include evidence path (.swarm\u002Fevidence\u002F) for the critic to read implementation artifacts\n   The critic reads every target file, verifies described changes exist against the spec, and returns per-task verdicts: ALIGNED, MINOR_DRIFT, MAJOR_DRIFT, or OFF_SPEC.\n   If the critic returns anything other than ALIGNED on any task, surface the drift results as a warning to the user before proceeding.\n   After the delegation returns, YOU (the architect) call the `write_drift_evidence` tool to write the drift evidence artifact (phase, verdict from critic, summary). The critic does NOT write files — it is read-only. Only then proceed to step 5.55. phase_complete will also run its own deterministic pre-check (completion-verify) and block if tasks are obviously incomplete.\n   ⚠️ **GOTCHA**: The drift evidence `summary` field is scanned by gates for verdict keywords. NEVER include the string \"NEEDS_REVISION\" or any other verdict word in the summary text — the gate will match it and falsely reject the evidence even when the verdict is APPROVED. Use neutral language like \"drift verification completed\" or \"all tasks aligned with spec\".\n5.55. **Hallucination verification (conditional on QA gate)**: Check whether `hallucination_guard` is enabled in the effective QA gate profile for this plan (visible via `get_qa_gate_profile`). If disabled, skip silently and proceed to step 5.6.\n   If `hallucination_guard` is enabled, delegate to the active swarm's critic_hallucination_verifier agent with HALLUCINATION-CHECK context:\n   - Provide: phase number being completed, completed task IDs, every file touched this phase\n   - Include evidence path (.swarm\u002Fevidence\u002F) so the verifier can read implementation artifacts\n   The verifier reads every changed file cold, cross-references every named API against its real source or package manifest, and returns per-artifact verdicts across four axes: API existence, signature accuracy, doc\u002Fspec claim support, citation integrity.\n   If the verifier returns NEEDS_REVISION: STOP — do NOT call phase_complete.\n   Fix the hallucinations (remove fabricated APIs, correct signatures, repair broken citations), then re-delegate until APPROVED.\n   After the delegation returns APPROVED, YOU (the architect) call the `write_hallucination_evidence` tool to write the evidence artifact (phase, verdict, summary). The critic does NOT write files — it is read-only.\n   NOTE: This step is enforced by the plugin. If `hallucination_guard` is enabled and `.swarm\u002Fevidence\u002F{phase}\u002Fhallucination-guard.json` is missing or has a non-APPROVED verdict, phase_complete will be BLOCKED.\n   PROFILE LOCK NOTE: If the QA gate profile is already locked (drift verification has approved the plan) and `hallucination_guard` was not elected during the initial QA GATE SELECTION, this step is skipped — report the skip to the user. A new plan cycle is required to enable the gate.\n5.56. **Mutation gate (conditional on QA gate)**: Check whether `mutation_test` is enabled in the effective QA gate profile for this plan (visible via `get_qa_gate_profile`). If disabled or turbo mode is active, skip silently and proceed to step 5.6.\n   If `mutation_test` is enabled:\n   1. Call `generate_mutants` with the list of source files touched this phase to produce mutation patches.\n   2. If `generate_mutants` returns a SKIP verdict (LLM unavailable), call `write_mutation_evidence` with verdict SKIP and proceed — SKIP does not block.\n   3. Otherwise, call `mutation_test` with the generated patches, the source files, and the test command for this project.\n   4. Call `write_mutation_evidence` with the phase number, verdict (PASS\u002FWARN\u002FFAIL), killRate, adjustedKillRate, and summary from the mutation_test result.\n   5. If verdict is FAIL: STOP — do NOT call phase_complete. Provide the testImprovementPrompt from mutation_test to the coder to improve test coverage, then re-run from step 1.\n   6. If verdict is WARN: non-blocking — proceed to step 5.6 with a warning to the user.\n   7. If verdict is PASS: proceed to step 5.6.\n   NOTE: This step is enforced by the plugin. If `mutation_test` is enabled and `.swarm\u002Fevidence\u002F{phase}\u002Fmutation-gate.json` is missing or has a 'fail' verdict, phase_complete will be BLOCKED.\n5.58. **Design-doc sync (conditional on `design_docs.enabled` — issue #1080)**: If `design_docs.enabled` is not true, skip silently. Otherwise: `phase_complete` runs a deterministic, non-blocking design-doc drift check and writes `.swarm\u002Fdoc-drift-phase-{phase}.json`. If its verdict is `DOC_STALE`, enter MODE: DESIGN_DOCS in sync mode for the stale sections only — delegate to the active swarm's `docs_design` agent (NOT the standard `docs` agent) with the changed files + the stale section IDs, and have it update the affected docs and append a `design-changelog.md` entry. This is advisory and NON-BLOCKING — never hold up phase_complete on design-doc lag, and never write `.swarm\u002Fspec.md`, `CHANGELOG.md`, or `docs\u002Freleases\u002Fpending\u002F*` here.\n5.6. **Mandatory gate evidence**: Before calling phase_complete, ensure:\n   - `.swarm\u002Fevidence\u002F{phase}\u002Fcompletion-verify.json` exists (written automatically by the completion-verify gate)\n    - `.swarm\u002Fevidence\u002F{phase}\u002Fdrift-verifier.json` exists with verdict 'approved' (written by YOU via the `write_drift_evidence` tool after the critic_drift_verifier returns its verdict in step 5.5) — required when an effective spec exists\n   - `.swarm\u002Fevidence\u002F{phase}\u002Fhallucination-guard.json` exists with verdict 'approved' (written by YOU via the `write_hallucination_evidence` tool after the critic_hallucination_verifier returns its verdict in step 5.55) — ONLY required when `hallucination_guard` is enabled in the QA gate profile\n   - `.swarm\u002Fevidence\u002F{phase}\u002Fmutation-gate.json` exists with verdict 'pass' or 'warn' (written by YOU via the `write_mutation_evidence` tool after step 5.56) — ONLY required when `mutation_test` is enabled in the QA gate profile\n    - regression-test falsification evidence exists for at least one regression\n      test added or modified in this phase: fix removed\u002Fbypassed -> test fails\n      for the expected reason -> fix restored -> test passes. If the phase\n      changed no regression tests, record `not applicable` with the changed-file\n      evidence.\n    If any required file is missing, run the missing gate first. Turbo mode skips all gates automatically.\n   NOTE: Steps 5.5, 5.55, and 5.56 are enforced by runtime hooks. If `hallucination_guard` is enabled and you skip the critic_hallucination_verifier delegation (or fail to call `write_hallucination_evidence`), phase_complete will be BLOCKED by the plugin. Similarly, if `mutation_test` is enabled and you skip step 5.56 (or fail to call `write_mutation_evidence`), phase_complete will be BLOCKED. These are not suggestions — they are hard enforcement mechanisms.\n5.65. **Phase Council (conditional on QA gate — `phase_council`)**: Check whether `phase_council` is enabled in the effective QA gate profile (visible via `get_qa_gate_profile`). If disabled, skip silently and proceed to step 5.7.\n   This gate is triggered by the `phase_council` QA gate, NOT by `council_mode`. (`council_mode` controls per-task Stage B replacement in MODE: EXECUTE; `phase_council` controls holistic phase-level review here in MODE: PHASE-WRAP.)\n   If `phase_council` is enabled:\n   1. Build a PHASE DOSSIER from all completed tasks in this phase, their evidence artifacts, changed-file summaries, and any drift\u002Fhallucination\u002Fmutation evidence.\n   2. Dispatch the full 5-member council (`the active swarm's critic agent`, `the active swarm's reviewer agent`, `the active swarm's sme agent`, `the active swarm's test_engineer agent`, and `the active swarm's explorer agent`) in PARALLEL with phase-scoped context. Each member reviews the entire phase's work holistically and returns a `CouncilMemberVerdict` JSON object.\n   3. Collect all 5 verdict objects. Do NOT fabricate or substitute verdicts.\n   4. Act on the verdict: APPROVE → proceed. CONCERNS with `success: false` + `reason: 'blocking_concerns_unresolved'` → HIGH\u002FCRITICAL findings are blocking, no evidence written, must resolve requiredFixes and re-council. CONCERNS with `success: true` → only MEDIUM\u002FLOW advisory findings, phase may proceed per `phaseConcernsAllowComplete` flag. REJECT → surface required fixes to the user before proceeding.\n   Requires council.enabled: true in config.\n\n5.7. **Final Council (conditional on QA gate - last phase only)**: Check whether `final_council` is enabled in the effective QA gate profile (visible via `get_qa_gate_profile`). If disabled, skip silently and proceed to step 6.\n   If enabled AND this is the LAST phase in the plan (all other phases have status 'complete' and no more phases remain):\n   1. Build a PROJECT DOSSIER from the completed plan, all phase summaries, changed-file summaries, and all relevant evidence artifacts. This is the full 5-member council (NOT the General Council) running a completed-project review.\n   2. Dispatch the full 5-member council (`the active swarm's critic agent`, `the active swarm's reviewer agent`, `the active swarm's sme agent`, `the active swarm's test_engineer agent`, and `the active swarm's explorer agent`) in PARALLEL with project-scoped context. Each member must review the entire completed body of work and return a `CouncilMemberVerdict` JSON object using `agent`, `verdict` (APPROVE|CONCERNS|REJECT), `confidence`, `findings[]`, `criteriaAssessed[]`, `criteriaUnmet[]`, and `durationMs`.\n   3. Collect the five returned verdict objects. Do NOT fabricate, infer, or substitute verdicts. If a member does not return valid JSON, re-dispatch that member.\n   4. Call `write_final_council_evidence` with `phase`, `projectSummary`, `roundNumber`, and the collected `verdicts` array. This writes `.swarm\u002Fevidence\u002Ffinal-council.json` with plan binding, member verdicts, and quorum metadata.\n   ⚠️ **GOTCHA**: `write_final_council_evidence` normalizes CONCERNS verdicts to \"rejected\" internally. A CONCERNS verdict in the **final council** still blocks `phase_complete` even with zero required fixes. You MUST either address the concerns and get APPROVE on a second council round, or surface the non-blocking advisory to the user before proceeding. (Note: the **phase-level** council has a `phaseConcernsAllowComplete` flag that makes CONCERNS advisory; the final council does not.)\n   5. Do NOT call `convene_general_council`, do NOT dispatch `council_generalist`, `council_skeptic`, or `council_domain_expert`, and do NOT require `council.general.enabled` for this gate. `final_council` is the full 5-member council (NOT the General Council) rerun at project scope.\n   6. Do NOT call `phase_complete` or `\u002Fswarm close` until `.swarm\u002Fevidence\u002Ffinal-council.json` exists with an approved, plan-bound, quorumed final-council verdict. When `final_council` is enabled, `phase_complete` will block until that evidence exists.\n   If enabled but NOT the last phase, skip silently - final council only runs once, after all phases.\n6. Summarize to user\n7. Check the AUTO_PROCEED STATUS banner (injected into your context by the system-enhancer). The banner shows:\n   - `auto-proceed: \u003Con|off>` — the current effective value\n   - `source: \u003Csession|plan-or-default>` — which side it came from\n   - `nudge: \u003Ctrue|false>` — whether the FR-004 first-boundary nudge has already been done\n   Then branch:\n   - If `auto-proceed: on`: call `phase_complete`, then advance to the first task of the next phase. Do NOT ask the user.\n   - If `auto-proceed: off` AND `nudge: false`: after the user confirms the phase transition, suggest enabling auto-proceed. Use the swarm_command tool to record the user's answer: `swarm_command({ command: \"auto-proceed\", args: [\"on\"] })` for yes, `swarm_command({ command: \"auto-proceed\", args: [\"off\"] })` for no. Either call sets nudge to true and prevents re-nudging.\n   - If `auto-proceed: off` AND `nudge: true`: Ask \"Ready for Phase [N+1]?\" and wait for user confirmation before proceeding.\n\n5.59. **Required agent dispatch for phase_complete**: Before calling `phase_complete`, the architect MUST have dispatched each of the active swarm's standard agents at least once during this phase. By default, `phase_complete` requires these agents:\n\n| Agent | When required | Where dispatched during normal task execution |\n|---|---|---|\n| `coder` | Always | Task implementation (coder) |\n| `reviewer` | Always | Task review (reviewer) |\n| `test_engineer` | When phase modifies source code\u002Ftests (unless explicitly waived) | Test verification (test_engineer) |\n| `docs` | When `require_docs: true` in QA gate profile | Documentation updates |\n\nIf any required agent is missing, `phase_complete` returns `{ success: false, status: 'incomplete', message: 'Phase N incomplete: missing required agents: \u003Clist>', agentsMissing: [...] }` and the phase is not closed. Dispatch each agent during normal task execution (not only inside optional Phase\u002FFinal Councils in steps 5.65\u002F5.7) so the closeout gate is satisfied.\n\nThe `docs` agent is only required when `require_docs: true` in the effective QA gate profile (visible via `get_qa_gate_profile`). For most small plans and feedback cycles, `docs` is NOT required and can be skipped. For multi-task implementation plans, `docs` is typically required.\n\nThe `coder` and `test_engineer` agents are required because every phase that modifies source code or tests must have at least one implementation and one test-verification delegation. For pure documentation or retrospective phases, these may be waived by the user explicitly.\n\nThis is a hard enforcement mechanism, not a suggestion. `phase_complete` will not return `status: success` if any required agent is missing from `agentsDispatched`.\n\nCATASTROPHIC VIOLATION CHECK — ask yourself at EVERY phase boundary (MODE: PHASE-WRAP):\n\"Have I delegated to each of the active swarm's required agents (coder, reviewer, test_engineer, plus docs if required) at least once this phase?\"\nIf the answer is NO for any of them: you have a catastrophic process violation.\nSTOP. Do not proceed to the next phase. Inform the user:\n\"⛔ PROCESS VIOLATION: Phase [N] completed with missing required-agent delegations in the active swarm: [list missing agents].\nAll code changes in this phase are unreviewed\u002Funtested\u002Fundocumented. Recommend retrospective review before proceeding.\"\nThis is not optional. Missing required-agent calls in a phase is always a violation.\nThere is no project where code ships without review, tests, and required documentation.\n\n### Blockers\nMark [BLOCKED] in plan.md, skip to next unblocked task, inform user.\n","# Phase Wrap Protocol\n\nThis protocol is loaded on demand by the architect stub in src\u002Fagents\u002Farchitect.ts. The architect prompt keeps only activation, action, and hard safety constraints; the full execution details live here.\n\n## ⛔ RETROSPECTIVE GATE\n\n**MANDATORY before calling phase_complete.** You MUST write a retrospective evidence bundle BEFORE calling \\`phase_complete\\`. The tool will return \\`{status: 'blocked', reason: 'RETROSPECTIVE_MISSING'}\\` if you skip this step.\n\n**How to write the retrospective:**\n\nCall the \\`write_retro\\` tool with the required fields:\n- \\`phase\\`: The phase number being completed (e.g., 1, 2, 3)\n- \\`summary\\`: Human-readable summary of the phase\n- \\`task_count\\`: Count of tasks completed in this phase\n- \\`task_complexity\\`: One of \\`trivial\\` | \\`simple\\` | \\`moderate\\` | \\`complex\\`\n- \\`total_tool_calls\\`: Total number of tool calls in this phase\n- \\`coder_revisions\\`: Number of coder revisions made\n- \\`reviewer_rejections\\`: Number of reviewer rejections received\n- \\`test_failures\\`: Number of test failures encountered\n- \\`security_findings\\`: Number of security findings\n- \\`integration_issues\\`: Number of integration issues\n- \\`lessons_learned\\` (\"lessons_learned\"): (optional) Key lessons learned from this phase (max 5)\n- \\`top_rejection_reasons\\`: (optional) Top reasons for reviewer rejections\n- \\`metadata\\`: (optional) Additional metadata, e.g., \\`{ \"plan_id\": \"\u003Ccurrent plan title from .swarm\u002Fplan.json>\" }\\`\n\nThe tool will automatically write the retrospective to \\`.swarm\u002Fevidence\u002Fretro-{phase}\u002Fevidence.json\\` with the correct schema wrapper. The resulting JSON entry will include: \\`\"type\": \"retrospective\"\\`, \\`\"phase_number\"\\` (matching the phase argument), and \\`\"verdict\": \"pass\"\\` (auto-set by the tool).\n\n**Required field rules:**\n- \\`verdict\\` is auto-generated by write_retro with value \\`\"pass\"\\`. The resulting retrospective entry will have verdict \\`\"pass\"\\`; this is required for phase_complete to succeed.\n- \\`phase\\` MUST match the phase number you are completing\n- \\`lessons_learned\\` should be 3-5 concrete, actionable items from this phase\n- Write the bundle as task_id \\`retro-{N}\\` (e.g., \\`retro-1\\` for Phase 1, \\`retro-2\\` for Phase 2)\n- \\`metadata.plan_id\\` should be set to the current project's plan title (from \\`.swarm\u002Fplan.json\\` header). This enables cross-project filtering in the retrospective injection system.\n\n### Additional retrospective fields (capture when applicable):\n- \\`user_directives\\`: Any corrections or preferences the user expressed during this phase\n  - \\`directive\\`: what the user said (non-empty string)\n  - \\`category\\`: \\`tooling\\` | \\`code_style\\` | \\`architecture\\` | \\`process\\` | \\`other\\`\n  - \\`scope\\`: \\`session\\` (one-time, do not carry forward) | \\`project\\` (persist to context.md) | \\`global\\` (user preference)\n- \\`approaches_tried\\`: Approaches attempted during this phase (max 10)\n  - \\`approach\\`: what was tried (non-empty string)\n  - \\`result\\`: \\`success\\` | \\`failure\\` | \\`partial\\`\n  - \\`abandoned_reason\\`: why it was abandoned (required when result is \\`failure\\` or \\`partial\\`)\n\n**⚠️ WARNING:** Calling \\`phase_complete(N)\\` without a valid \\`retro-N\\` bundle will be BLOCKED. The error response will be:\n\\`{ \"status\": \"blocked\", \"reason\": \"RETROSPECTIVE_MISSING\" }\\`\n\n### MODE: PHASE-WRAP\n1. the active swarm's explorer agent - Rescan\n2. the active swarm's docs agent (the standard `docs` agent — NOT `docs_design`) - Update documentation for all changes in this phase. Provide:\n   - Complete list of files changed during this phase\n   - Summary of what was added\u002Fmodified\u002Fremoved\n   - List of doc files that may need updating (README.md, CONTRIBUTING.md, docs\u002F)\n   Do NOT dispatch `docs_design` here. The structured design docs are synced separately and conditionally in step 5.58.\n3. Update context.md\n4. Write retrospective evidence: use the evidence manager (write_retro) to record phase, total_tool_calls, coder_revisions, reviewer_rejections, test_failures, security_findings, integration_issues, task_count, task_complexity, top_rejection_reasons, lessons_learned to .swarm\u002Fevidence\u002F. Reset Phase Metrics in context.md to 0.\n4.5. Run `evidence_check` to verify all completed tasks have required evidence (review + test). If gaps found, note in retrospective lessons_learned. Optionally run `pkg_audit` if dependencies were modified during this phase. Optionally run `schema_drift` if API routes were modified during this phase.\n5. Run `sbom_generate` with scope='changed' to capture post-implementation dependency snapshot (saved to `.swarm\u002Fevidence\u002Fsbom\u002F`). This is a non-blocking step - always proceeds to summary.\n5.5. **Drift verification**: Conditional on an EFFECTIVE spec existing (determined via `\u002Fswarm sdd status` or `readEffectiveSpecSync` — native `.swarm\u002Fspec.md`, OpenSpec `openspec\u002F`, or Spec-Kit `.specify\u002F`). If NO effective spec exists at all, skip silently. If an effective spec exists (even openspec-only or specify-only), delegate to the active swarm's critic_drift_verifier agent with DRIFT-CHECK context:\n   - Provide: phase number being completed, completed task IDs and their descriptions\n   - Include evidence path (.swarm\u002Fevidence\u002F) for the critic to read implementation artifacts\n   The critic reads every target file, verifies described changes exist against the spec, and returns per-task verdicts: ALIGNED, MINOR_DRIFT, MAJOR_DRIFT, or OFF_SPEC.\n   If the critic returns anything other than ALIGNED on any task, surface the drift results as a warning to the user before proceeding.\n   After the delegation returns, YOU (the architect) call the `write_drift_evidence` tool to write the drift evidence artifact (phase, verdict from critic, summary). The critic does NOT write files — it is read-only. Only then proceed to step 5.55. phase_complete will also run its own deterministic pre-check (completion-verify) and block if tasks are obviously incomplete.\n   ⚠️ **GOTCHA**: The drift evidence `summary` field is scanned by gates for verdict keywords. NEVER include the string \"NEEDS_REVISION\" or any other verdict word in the summary text — the gate will match it and falsely reject the evidence even when the verdict is APPROVED. Use neutral language like \"drift verification completed\" or \"all tasks aligned with spec\".\n5.55. **Hallucination verification (conditional on QA gate)**: Check whether `hallucination_guard` is enabled in the effective QA gate profile for this plan (visible via `get_qa_gate_profile`). If disabled, skip silently and proceed to step 5.6.\n   If `hallucination_guard` is enabled, delegate to the active swarm's critic_hallucination_verifier agent with HALLUCINATION-CHECK context:\n   - Provide: phase number being completed, completed task IDs, every file touched this phase\n   - Include evidence path (.swarm\u002Fevidence\u002F) so the verifier can read implementation artifacts\n   The verifier reads every changed file cold, cross-references every named API against its real source or package manifest, and returns per-artifact verdicts across four axes: API existence, signature accuracy, doc\u002Fspec claim support, citation integrity.\n   If the verifier returns NEEDS_REVISION: STOP — do NOT call phase_complete.\n   Fix the hallucinations (remove fabricated APIs, correct signatures, repair broken citations), then re-delegate until APPROVED.\n   After the delegation returns APPROVED, YOU (the architect) call the `write_hallucination_evidence` tool to write the evidence artifact (phase, verdict, summary). The critic does NOT write files — it is read-only.\n   NOTE: This step is enforced by the plugin. If `hallucination_guard` is enabled and `.swarm\u002Fevidence\u002F{phase}\u002Fhallucination-guard.json` is missing or has a non-APPROVED verdict, phase_complete will be BLOCKED.\n   PROFILE LOCK NOTE: If the QA gate profile is already locked (drift verification has approved the plan) and `hallucination_guard` was not elected during the initial QA GATE SELECTION, this step is skipped — report the skip to the user. A new plan cycle is required to enable the gate.\n5.56. **Mutation gate (conditional on QA gate)**: Check whether `mutation_test` is enabled in the effective QA gate profile for this plan (visible via `get_qa_gate_profile`). If disabled or turbo mode is active, skip silently and proceed to step 5.6.\n   If `mutation_test` is enabled:\n   1. Call `generate_mutants` with the list of source files touched this phase to produce mutation patches.\n   2. If `generate_mutants` returns a SKIP verdict (LLM unavailable), call `write_mutation_evidence` with verdict SKIP and proceed — SKIP does not block.\n   3. Otherwise, call `mutation_test` with the generated patches, the source files, and the test command for this project.\n   4. Call `write_mutation_evidence` with the phase number, verdict (PASS\u002FWARN\u002FFAIL), killRate, adjustedKillRate, and summary from the mutation_test result.\n   5. If verdict is FAIL: STOP — do NOT call phase_complete. Provide the testImprovementPrompt from mutation_test to the coder to improve test coverage, then re-run from step 1.\n   6. If verdict is WARN: non-blocking — proceed to step 5.6 with a warning to the user.\n   7. If verdict is PASS: proceed to step 5.6.\n   NOTE: This step is enforced by the plugin. If `mutation_test` is enabled and `.swarm\u002Fevidence\u002F{phase}\u002Fmutation-gate.json` is missing or has a 'fail' verdict, phase_complete will be BLOCKED.\n5.58. **Design-doc sync (conditional on `design_docs.enabled` — issue #1080)**: If `design_docs.enabled` is not true, skip silently. Otherwise: `phase_complete` runs a deterministic, non-blocking design-doc drift check and writes `.swarm\u002Fdoc-drift-phase-{phase}.json`. If its verdict is `DOC_STALE`, enter MODE: DESIGN_DOCS in sync mode for the stale sections only — delegate to the active swarm's `docs_design` agent (NOT the standard `docs` agent) with the changed files + the stale section IDs, and have it update the affected docs and append a `design-changelog.md` entry. This is advisory and NON-BLOCKING — never hold up phase_complete on design-doc lag, and never write `.swarm\u002Fspec.md`, `CHANGELOG.md`, or `docs\u002Freleases\u002Fpending\u002F*` here.\n5.6. **Mandatory gate evidence**: Before calling phase_complete, ensure:\n   - `.swarm\u002Fevidence\u002F{phase}\u002Fcompletion-verify.json` exists (written automatically by the completion-verify gate)\n    - `.swarm\u002Fevidence\u002F{phase}\u002Fdrift-verifier.json` exists with verdict 'approved' (written by YOU via the `write_drift_evidence` tool after the critic_drift_verifier returns its verdict in step 5.5) — required when an effective spec exists\n   - `.swarm\u002Fevidence\u002F{phase}\u002Fhallucination-guard.json` exists with verdict 'approved' (written by YOU via the `write_hallucination_evidence` tool after the critic_hallucination_verifier returns its verdict in step 5.55) — ONLY required when `hallucination_guard` is enabled in the QA gate profile\n   - `.swarm\u002Fevidence\u002F{phase}\u002Fmutation-gate.json` exists with verdict 'pass' or 'warn' (written by YOU via the `write_mutation_evidence` tool after step 5.56) — ONLY required when `mutation_test` is enabled in the QA gate profile\n    - regression-test falsification evidence exists for at least one regression\n      test added or modified in this phase: fix removed\u002Fbypassed -> test fails\n      for the expected reason -> fix restored -> test passes. If the phase\n      changed no regression tests, record `not applicable` with the changed-file\n      evidence.\n    If any required file is missing, run the missing gate first. Turbo mode skips all gates automatically.\n   NOTE: Steps 5.5, 5.55, and 5.56 are enforced by runtime hooks. If `hallucination_guard` is enabled and you skip the critic_hallucination_verifier delegation (or fail to call `write_hallucination_evidence`), phase_complete will be BLOCKED by the plugin. Similarly, if `mutation_test` is enabled and you skip step 5.56 (or fail to call `write_mutation_evidence`), phase_complete will be BLOCKED. These are not suggestions — they are hard enforcement mechanisms.\n5.65. **Phase Council (conditional on QA gate — `phase_council`)**: Check whether `phase_council` is enabled in the effective QA gate profile (visible via `get_qa_gate_profile`). If disabled, skip silently and proceed to step 5.7.\n   This gate is triggered by the `phase_council` QA gate, NOT by `council_mode`. (`council_mode` controls per-task Stage B replacement in MODE: EXECUTE; `phase_council` controls holistic phase-level review here in MODE: PHASE-WRAP.)\n   If `phase_council` is enabled:\n   1. Build a PHASE DOSSIER from all completed tasks in this phase, their evidence artifacts, changed-file summaries, and any drift\u002Fhallucination\u002Fmutation evidence.\n   2. Dispatch the full 5-member council (`the active swarm's critic agent`, `the active swarm's reviewer agent`, `the active swarm's sme agent`, `the active swarm's test_engineer agent`, and `the active swarm's explorer agent`) in PARALLEL with phase-scoped context. Each member reviews the entire phase's work holistically and returns a `CouncilMemberVerdict` JSON object.\n   3. Collect all 5 verdict objects. Do NOT fabricate or substitute verdicts.\n   4. Act on the verdict: APPROVE → proceed. CONCERNS with `success: false` + `reason: 'blocking_concerns_unresolved'` → HIGH\u002FCRITICAL findings are blocking, no evidence written, must resolve requiredFixes and re-council. CONCERNS with `success: true` → only MEDIUM\u002FLOW advisory findings, phase may proceed per `phaseConcernsAllowComplete` flag. REJECT → surface required fixes to the user before proceeding.\n   Requires council.enabled: true in config.\n\n5.7. **Final Council (conditional on QA gate - last phase only)**: Check whether `final_council` is enabled in the effective QA gate profile (visible via `get_qa_gate_profile`). If disabled, skip silently and proceed to step 6.\n   If enabled AND this is the LAST phase in the plan (all other phases have status 'complete' and no more phases remain):\n   1. Build a PROJECT DOSSIER from the completed plan, all phase summaries, changed-file summaries, and all relevant evidence artifacts. This is the full 5-member council (NOT the General Council) running a completed-project review.\n   2. Dispatch the full 5-member council (`the active swarm's critic agent`, `the active swarm's reviewer agent`, `the active swarm's sme agent`, `the active swarm's test_engineer agent`, and `the active swarm's explorer agent`) in PARALLEL with project-scoped context. Each member must review the entire completed body of work and return a `CouncilMemberVerdict` JSON object using `agent`, `verdict` (APPROVE|CONCERNS|REJECT), `confidence`, `findings[]`, `criteriaAssessed[]`, `criteriaUnmet[]`, and `durationMs`.\n   3. Collect the five returned verdict objects. Do NOT fabricate, infer, or substitute verdicts. If a member does not return valid JSON, re-dispatch that member.\n   4. Call `write_final_council_evidence` with `phase`, `projectSummary`, `roundNumber`, and the collected `verdicts` array. This writes `.swarm\u002Fevidence\u002Ffinal-council.json` with plan binding, member verdicts, and quorum metadata.\n   ⚠️ **GOTCHA**: `write_final_council_evidence` normalizes CONCERNS verdicts to \"rejected\" internally. A CONCERNS verdict in the **final council** still blocks `phase_complete` even with zero required fixes. You MUST either address the concerns and get APPROVE on a second council round, or surface the non-blocking advisory to the user before proceeding. (Note: the **phase-level** council has a `phaseConcernsAllowComplete` flag that makes CONCERNS advisory; the final council does not.)\n   5. Do NOT call `convene_general_council`, do NOT dispatch `council_generalist`, `council_skeptic`, or `council_domain_expert`, and do NOT require `council.general.enabled` for this gate. `final_council` is the full 5-member council (NOT the General Council) rerun at project scope.\n   6. Do NOT call `phase_complete` or `\u002Fswarm close` until `.swarm\u002Fevidence\u002Ffinal-council.json` exists with an approved, plan-bound, quorumed final-council verdict. When `final_council` is enabled, `phase_complete` will block until that evidence exists.\n   If enabled but NOT the last phase, skip silently - final council only runs once, after all phases.\n6. Summarize to user\n7. Check the AUTO_PROCEED STATUS banner (injected into your context by the system-enhancer). The banner shows:\n   - `auto-proceed: \u003Con|off>` — the current effective value\n   - `source: \u003Csession|plan-or-default>` — which side it came from\n   - `nudge: \u003Ctrue|false>` — whether the FR-004 first-boundary nudge has already been done\n   Then branch:\n   - If `auto-proceed: on`: call `phase_complete`, then advance to the first task of the next phase. Do NOT ask the user.\n   - If `auto-proceed: off` AND `nudge: false`: after the user confirms the phase transition, suggest enabling auto-proceed. Use the swarm_command tool to record the user's answer: `swarm_command({ command: \"auto-proceed\", args: [\"on\"] })` for yes, `swarm_command({ command: \"auto-proceed\", args: [\"off\"] })` for no. Either call sets nudge to true and prevents re-nudging.\n   - If `auto-proceed: off` AND `nudge: true`: Ask \"Ready for Phase [N+1]?\" and wait for user confirmation before proceeding.\n\n5.59. **Required agent dispatch for phase_complete**: Before calling `phase_complete`, the architect MUST have dispatched each of the active swarm's standard agents at least once during this phase. By default, `phase_complete` requires these agents:\n\n| Agent | When required | Where dispatched during normal task execution |\n|---|---|---|\n| `coder` | Always | Task implementation (coder) |\n| `reviewer` | Always | Task review (reviewer) |\n| `test_engineer` | When phase modifies source code\u002Ftests (unless explicitly waived) | Test verification (test_engineer) |\n| `docs` | When `require_docs: true` in QA gate profile | Documentation updates |\n\nIf any required agent is missing, `phase_complete` returns `{ success: false, status: 'incomplete', message: 'Phase N incomplete: missing required agents: \u003Clist>', agentsMissing: [...] }` and the phase is not closed. Dispatch each agent during normal task execution (not only inside optional Phase\u002FFinal Councils in steps 5.65\u002F5.7) so the closeout gate is satisfied.\n\nThe `docs` agent is only required when `require_docs: true` in the effective QA gate profile (visible via `get_qa_gate_profile`). For most small plans and feedback cycles, `docs` is NOT required and can be skipped. For multi-task implementation plans, `docs` is typically required.\n\nThe `coder` and `test_engineer` agents are required because every phase that modifies source code or tests must have at least one implementation and one test-verification delegation. For pure documentation or retrospective phases, these may be waived by the user explicitly.\n\nThis is a hard enforcement mechanism, not a suggestion. `phase_complete` will not return `status: success` if any required agent is missing from `agentsDispatched`.\n\nCATASTROPHIC VIOLATION CHECK — ask yourself at EVERY phase boundary (MODE: PHASE-WRAP):\n\"Have I delegated to each of the active swarm's required agents (coder, reviewer, test_engineer, plus docs if required) at least once this phase?\"\nIf the answer is NO for any of them: you have a catastrophic process violation.\nSTOP. Do not proceed to the next phase. Inform the user:\n\"⛔ PROCESS VIOLATION: Phase [N] completed with missing required-agent delegations in the active swarm: [list missing agents].\nAll code changes in this phase are unreviewed\u002Funtested\u002Fundocumented. Recommend retrospective review before proceeding.\"\nThis is not optional. Missing required-agent calls in a phase is always a violation.\nThere is no project where code ships without review, tests, and required documentation.\n\n### Blockers\nMark [BLOCKED] in plan.md, skip to next unblocked task, inform user.\n",{"name":5,"description":7},"main","1667541871a3a917f9e544e5584ef06a544a119d",".opencode\u002Fskills\u002Fphase-wrap",0,"https:\u002F\u002Fgithub.com\u002Fdjimit\u002Fdjimitflo","https:\u002F\u002Fgithub.com\u002Fdjimit","https:\u002F\u002Fdjimit.nl\u002F","About me\r\n\r\nI’m Dennis a strategic IT advisor specializing in cloud, cybersecurity, privacy, AI, and enterprise architecture. ","2026-11-15 04:42:36",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add djimit\u002Fdjimitflo --skill phase-wrap",{"tool":39,"command":40},"bunx","bunx skills add djimit\u002Fdjimitflo --skill phase-wrap",{"tool":42,"command":43},"pnpm","pnpm dlx skills add djimit\u002Fdjimitflo --skill phase-wrap","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fdjimit\u002Fdjimitflo\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fphase-wrap\u002FSKILL.md",true,[],[48,55,62,69,76,83],{"skillNo":49,"name":50,"nameZh":6,"description":51,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":52,"categories":53,"keywords":54,"publishedAt":19},"01M732DRW7MHQP9VTJ5JSBMWC3","provider-step-usage-v1-0-0","Sum measured OpenCode step_finish token totals with replay deduplication and fail-closed validation.","https:\u002F\u002Fgithub.com\u002Fdjimit\u002Fdjimitflo\u002Fblob\u002Fmain\u002Fskills\u002Fprovider-step-usage-v1-0-0\u002FSKILL.md",[],[],{"skillNo":56,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":19},"01M732DKXHWZ1P99ZDNA4PX7BV","writing-tests","Guidelines for writing, organizing, and maintaining tests in the opencode-swarm repository. Covers framework rules (bun:test), mock isolation, CI pipeline structure, file placement, and anti-patterns that break cross-platform CI. Load this skill before writing or modifying any test file.","https:\u002F\u002Fgithub.com\u002Fdjimit\u002Fdjimitflo\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fwriting-tests\u002FSKILL.md",[],[],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":19},"01M732DCEG1R9S45A68T5WR2T7","worktree-retry-cleanup","Protocol for cleaning parallel-coder worktree lanes before retry. Triggered before re-dispatching any task that already has a lane (completed, denied, cancelled, or failed).","https:\u002F\u002Fgithub.com\u002Fdjimit\u002Fdjimitflo\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fworktree-retry-cleanup\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M732D8KYWE5RHJ1AA76F70K7","swarm","Cross-agent swarm-mode behavior model — a higher-rigor workflow using parallel investigation, independent reviewer validation, and critic challenge, plus the mandatory implementation closeout gate. Runtime adapters (.claude, .agents) add execution-specific notes and command wiring.","https:\u002F\u002Fgithub.com\u002Fdjimit\u002Fdjimitflo\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fswarm\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M732D232XCMYP3XYKEAQC3YT","swarm-pr-subscribe","Monitor a pull request after creation and act autonomously on pushed PR activity. Use when subscribing to a PR after opening it, when asked to watch, babysit, or autofix a PR until merge, or when a \u003Cpr-activity> wake message or [pr-monitor:...] advisory arrives for a subscribed PR. Owns event triage (fix \u002F ask \u002F skip), bounded-retry escalation, and terminal-state cleanup.","https:\u002F\u002Fgithub.com\u002Fdjimit\u002Fdjimitflo\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fswarm-pr-subscribe\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M732CVKJ4QEN83DQ30EYG75A","swarm-pr-review","Run a graph-guided, tool-augmented Swarm PR review using context packing, parallel exploration, triggered plugin micro-lanes, independent reviewer validation, critic challenge, and metrics writeback. Use for deep pull request review with low false-positive tolerance and high recall.","https:\u002F\u002Fgithub.com\u002Fdjimit\u002Fdjimitflo\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fswarm-pr-review\u002FSKILL.md",[],[]]