[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7561WECFFGC8H2TXH586MF2":3,"skill-same:01M7561WECFFGC8H2TXH586MF2":44},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":23,"commitSha":24,"skillDirectory":25,"forksCount":26,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":29,"install":30,"resources":43},"01M7561WECFFGC8H2TXH586MF2","execute",null,"Full execution protocol for MODE: EXECUTE -- task execution, coder retry handling, QA gates, completion evidence, and per-task closure.","AlexanderNarbaev\u002Fagi","AlexanderNarbaev","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F33544956?v=4","01M755ZKB1JJ26ZBNZSDJ4C0TV","01M755ZKBX072HZMHVQBWK7MK7",1,"AGPL-3.0","https:\u002F\u002Fgithub.com\u002FAlexanderNarbaev\u002Fagi\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fexecute\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: execute\ndescription: >\n  Full execution protocol for MODE: EXECUTE -- task execution, coder retry handling, QA gates, completion evidence, and per-task closure.\n---\n\n# Execute 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### MODE: EXECUTE\nFor each task (respecting dependencies):\n\nRETRY PROTOCOL — when returning to coder after any gate failure:\n1. Provide structured rejection: \"GATE FAILED: [gate name] | REASON: [details] | REQUIRED FIX: [specific action required]\"\n2. Re-enter at step 5b (the active swarm's coder agent) with full failure context\n3. Resume execution at the failed step (do not restart from 5a)\n   Exception: if coder modified files outside the original task scope, restart from step 5c\n4. Gates already PASSED may be skipped on retry if their input files are unchanged\n5. Print \"Resuming at step [5X] after coder retry [N\u002Fconfigured QA retry limit]\" before re-executing\n\nGATE FAILURE RESPONSE RULES — when ANY gate returns a failure:\nYou MUST return to the active swarm's coder agent. You MUST NOT fix the code yourself.\n\nWRONG responses to gate failure:\n✗ Editing the file yourself to fix the syntax error\n✗ Running a tool to auto-fix and moving on without coder\n✗ \"Installing\" or \"configuring\" tools to work around the failure\n✗ Treating the failure as an environment issue and proceeding\n✗ Deciding the failure is a false positive and skipping the gate\n\nRIGHT response to gate failure:\n✓ Print \"GATE FAILED: [gate name] | REASON: [details]\"\n✓ BEFORE the retry delegation: call `declare_scope` with the file list the retry will touch. Re-declare even if the files are identical to the original task — retry scope persists per-call, not per-task. See Rule 1a.\n✓ Delegate to the active swarm's coder agent with:\nTASK: Fix [gate name] failure\nFILE: [affected file(s)]\nINPUT: [exact error output from the gate]\nCONSTRAINT: Fix ONLY the reported issue, do not modify other code\n✓ After coder returns, re-run the failed gate from the step that failed\n✓ Print \"Coder attempt [N\u002Fconfigured QA retry limit] on task [X.Y]\"\n\nThe ONLY exception: lint tool in fix mode (step 5g) auto-corrects by design.\nAll other gates: failure → return to coder. No self-fixes. No workarounds.\n\n5a. **UI DESIGN GATE** (conditional — Rule 9): If task matches UI trigger → the active swarm's designer agent produces scaffold → pass scaffold to coder as INPUT. If no match → skip.\n\n→ After step 5a (or immediately if no UI task applies): Call update_task_status with status in_progress for the current task. Then proceed to step 5b.\n\n5a-bis. **DARK MATTER CO-CHANGE DETECTION**: After declaring scope but BEFORE finalizing the task file list, call knowledge_recall with query hidden-coupling primaryFile where primaryFile is the first file in the task's FILE list. Extract primaryFile from the task's FILE list (first file = primary). If results found, add those files to the task's AFFECTS scope with a BLAST RADIUS note. If no results or knowledge_recall unavailable, proceed gracefully without adding files. This is advisory — the architect may exclude files from scope if they are unrelated to the current task. Delegate to the active swarm's coder agent only after scope is declared.\n\n5b-PRE (required): Call `declare_scope({ taskId, files })` with the EXACT file list for this task — including any co-change files surfaced by 5a-bis. Skipping this call will cause every coder write to be BLOCKED by scope-guard. No `declare_scope` → no 5b delegation. See Rule 1a.\n    5b-BASE (required, once per task): Call `sast_scan` with `{ capture_baseline: true, phase: \u003CN>, changed_files: \u003Cfiles from 5b-PRE> }` where `\u003CN>` is the current phase number (extract from current task ID: task \"3.2\" → phase 3, task \"1.5\" → phase 1). The tool maintains `.swarm\u002Fevidence\u002F{phase}\u002Fsast-baseline.json` as a phase-scoped, incrementally merged baseline of pre-existing SAST findings. Calling twice for the same files is safe (idempotent merge). Do NOT re-capture mid-task.\n    → REQUIRED: Print \"sast-baseline: [WRITTEN — N fingerprints | MERGED — N fingerprints | SKIPPED — gate disabled | ERROR — details]\"\n    → Subsequent `pre_check_batch` calls with `phase: \u003CN>` will automatically diff against this baseline — only NEW findings (not in baseline) drive the fail verdict.\n5b. the active swarm's coder agent - Implement (if designer scaffold produced, include it as INPUT).\n5c. Run `diff` tool. If `hasContractChanges` → the active swarm's explorer agent integration analysis. If COMPATIBILITY SIGNALS=INCOMPATIBLE or MIGRATION_SURFACE=yes → coder retry. If COMPATIBILITY SIGNALS=COMPATIBLE and MIGRATION_SURFACE=no → proceed.\n    → REQUIRED: Print \"diff: [PASS | CONTRACT CHANGE — details]\"\n    5d. Run `syntax_check` tool. SYNTACTIC ERRORS → return to coder. NO ERRORS → proceed to placeholder_scan.\n    → REQUIRED: Print \"syntaxcheck: [PASS | FAIL — N errors]\"\n    5e. Run `placeholder_scan` tool. PLACEHOLDER FINDINGS → return to coder. NO FINDINGS → proceed to imports.\n    → REQUIRED: Print \"placeholderscan: [PASS | FAIL — N findings]\"\n    5f. Run `imports` tool for dependency audit. ISSUES → return to coder.\n    → REQUIRED: Print \"imports: [PASS | ISSUES — details]\"\n    5g. Run `lint` tool with fix mode for auto-fixes. If issues remain → run `lint` tool with check mode. FAIL → return to coder.\n    → REQUIRED: Print \"lint: [PASS | FAIL — details]\"\n    5h. Run `build_check` tool. BUILD FAILS → return to coder. SUCCESS → proceed to pre_check_batch.\n    → REQUIRED: Print \"buildcheck: [PASS | FAIL | SKIPPED — no toolchain]\"\n    5i. Run `pre_check_batch` tool with `phase: \u003CN>` (same phase number used in 5b-BASE) → runs four verification tools in parallel (max 4 concurrent):\n    - lint:check (code quality verification)\n    - secretscan (secret detection)\n    - sast_scan (static security analysis — diffs against phase baseline when phase provided)\n    - quality_budget (maintainability metrics)\n    → Returns { gates_passed, lint, secretscan, sast_scan, quality_budget, total_duration_ms }\n    → sast_scan result may include { new_findings, pre_existing_findings, baseline_used } when baseline diff is active.\n    → If ALL FOUR tools have ran === false (lint.ran === false && secretscan.ran === false && sast_scan.ran === false && quality_budget.ran === false):\n        → This is a SKIP - no tools actually ran. Print \"pre_check_batch: SKIP — all tools ran===false (no files to check or tools not available)\" and proceed to the active swarm's reviewer agent.\n    → Else if gates_passed === false: read individual tool results, identify which tool(s) failed, return structured rejection to the active swarm's coder agent with specific tool failures. Do NOT call the active swarm's reviewer agent.\n    → If gates_passed === true AND sast_preexisting_findings is present: proceed to the active swarm's reviewer agent. Include the pre-existing SAST findings in the reviewer delegation context with instruction: \"SAST TRIAGE REQUIRED: The following SAST findings existed before this task began (from phase baseline or unchanged lines). Verify these are acceptable pre-existing conditions and do not interact with the new changes.\" Do NOT return to coder for pre-existing findings.\n    → If gates_passed === true (no sast_preexisting_findings): proceed to the active swarm's reviewer agent.\n    → REQUIRED: Print \"pre_check_batch: [PASS — all gates passed | PASS — pre-existing SAST findings (N findings, reviewer triage) | FAIL — [gate]: [details]]\"\n\n⚠️ pre_check_batch SCOPE BOUNDARY:\npre_check_batch runs FOUR automated tools: lint:check, secretscan, sast_scan, quality_budget.\npre_check_batch does NOT run and does NOT replace:\n- the active swarm's reviewer agent (logic review, correctness, edge cases, maintainability)\n- the active swarm's reviewer agent security-only pass (OWASP evaluation, auth\u002Fcrypto review)\n- the active swarm's test_engineer agent verification tests (functional correctness)\n- the active swarm's test_engineer agent adversarial tests (attack vectors, boundary violations)\n- diff tool (contract change detection)\n- placeholder_scan (TODO\u002Fstub detection)\n- imports (dependency audit)\ngates_passed: true means \"automated static checks passed.\"\nIt does NOT mean \"code is reviewed.\" It does NOT mean \"code is tested.\"\nAfter pre_check_batch passes, you MUST STILL delegate to the active swarm's reviewer agent.\nTreating pre_check_batch as a substitute for the active swarm's reviewer agent is a PROCESS VIOLATION.\n\n    5j-COUNCIL (when council_mode is ON — replaces steps 5j through 5l):\n    When `council_mode` is enabled in the QA gate profile, Stage B (steps 5j-5l: reviewer + test_engineer) is REPLACED by the full 5-member council per task.\n\n    After Stage A (pre_check_batch) passes:\n    1. Ensure `declare_council_criteria` was called for this task (prerequisite).\n    2. Dispatch all 5 council members (critic, reviewer, sme, test_engineer, explorer) in PARALLEL with task-scoped context.\n    3. Collect all 5 verdict objects. Do NOT fabricate or substitute verdicts.\n    4. Call `submit_council_verdicts` with the collected verdicts.\n    5. Act on the verdict: APPROVE → task passes. CONCERNS with `success: false` + `reason: 'blocking_concerns_unresolved'` → HIGH\u002FCRITICAL findings are blocking, no evidence written, return to coder with requiredFixes and re-council after fixes. CONCERNS with `success: true` → only MEDIUM\u002FLOW advisory findings, task passes. REJECT → return to coder with requiredFixes.\n\n    When `council_mode` is OFF, the standard Stage B flow (steps 5j-5l: reviewer + test_engineer) runs as normal.\n\n    5j. the active swarm's reviewer agent - General review. REJECTED before the configured QA retry limit → coder retry. REJECTED at the configured QA retry limit → escalate.\n    → REQUIRED: Print \"reviewer: [APPROVED | REJECTED — reason]\"\n    5k. Security gate: if change matches TIER 3 criteria OR content contains SECURITY_KEYWORDS OR secretscan has ANY findings OR sast_scan has ANY findings at or above threshold → MUST delegate the active swarm's reviewer agent security-only review. REJECTED before the configured QA retry limit → coder retry. REJECTED at the configured QA retry limit → escalate to user.\n    → REQUIRED: Print \"security-reviewer: [TRIGGERED | NOT TRIGGERED — reason]\"\n    → If TRIGGERED: Print \"security-reviewer: [APPROVED | REJECTED — reason]\"\n    5l. the active swarm's test_engineer agent - Verification tests. FAIL → coder retry from 5g.\n    → REQUIRED: Print \"testengineer-verification: [PASS N\u002FN | FAIL — details]\"\n    5l-bis. REGRESSION SWEEP (automatic after test_engineer-verification PASS):\n    Run test_runner with { scope: \"graph\", files: [\u003Call source files changed by coder in this task>] }.\n    scope:\"graph\" traces imports to discover test files beyond the task's own tests that may be affected by this change.\n    \n    Outcomes (based on test_runner result.outcome field):\n    - outcome: \"pass\" → All tests passed. Print \"regression-sweep: PASS [N additional tests, M files]\"\n    - outcome: \"regression\" → Tests ran but some failed. Print \"regression-sweep: FAIL — REGRESSION DETECTED in [files]. The failing tests are CORRECT — fix the source code, not the tests.\" Return to coder with retry from 5g.\n    - outcome: \"skip\" → No test files resolved (nothing to run). Print \"regression-sweep: SKIPPED — no related tests beyond task scope\"\n    - outcome: \"scope_exceeded\" → Too many files for graph scope. Print \"regression-sweep: SKIPPED — broad scope, no related tests beyond task scope\"\n    - outcome: \"error\" → Tool error (timeout, no framework, etc.). Print \"regression-sweep: SKIPPED — test_runner error\" and continue pipeline.\n    \n    IMPORTANT: The regression sweep runs test_runner DIRECTLY (architect calls the tool). Do NOT delegate to test_engineer for this — the test_engineer's EXECUTION BOUNDARY restricts it to its own test files. The architect has unrestricted test_runner access.\n    → REQUIRED: Print \"regression-sweep: [PASS | FAIL — REGRESSION DETECTED | SKIPPED — no related tests | SKIPPED — broad scope | SKIPPED — test_runner error]\"\n\n    5l-ter. TEST DRIFT CHECK (conditional): Run this step if the change involves any drift-prone area:\n    - Command\u002FCLI behavior changed (shell command wrappers, CLI interfaces)\n    - Parsing or routing logic changed (argument parsing, route matching, file resolution)\n    - User-visible output changed (formatted output, error messages, JSON response structure)\n    - Public contracts or schemas changed (API types, tool argument schemas, return types)\n    - Assertion-heavy areas where output strings are tested (command\u002Fhelp output tests, error message tests)\n    - Helper behavior or lifecycle semantics changed (state machines, lifecycle hooks, initialization)\n    \n    If NOT triggered: Print \"test-drift: NOT TRIGGERED — no drift-prone change detected\"\n    If TRIGGERED:\n    - Use grep\u002Fsearch to find test files that cover the affected functionality\n    - Run those tests via test_runner with scope:\"convention\" on the related test files\n    - If any FAIL → print \"test-drift: DRIFT DETECTED in [N] tests\" and escalate to reviewer\u002Ftest_engineer\n    - If all PASS → print \"test-drift: [N] related tests verified\"\n    - If no related tests found → print \"test-drift: NO RELATED TESTS FOUND\" (not a failure)\n    → REQUIRED: Print \"test-drift: [TRIGGERED | NOT TRIGGERED — reason]\" and \"[DRIFT DETECTED in N tests | N related tests verified | NO RELATED TESTS FOUND | NOT TRIGGERED]\"\n\n    5n. TODO SCAN (advisory): Call todo_extract with paths=[list of files changed in this task]. If any results have priority HIGH → print \"todo-scan: WARN — N high-priority TODOs in changed files: [list of TODO texts]\". If no high-priority results → print \"todo-scan: CLEAN\". This is advisory only and does NOT block the pipeline.\n    → REQUIRED: Print \"todo-scan: [WARN — N high-priority TODOs | CLEAN]\"\n\n    5m. ADVERSARIAL TEST STEP (config-specific): Use the rendered adversarial-test instruction from the MODE: EXECUTE architect stub. If the stub omits step 5m, skip this step.\n    5n. COVERAGE CHECK: If the active swarm's test_engineer agent reports coverage \u003C 70% → delegate the active swarm's test_engineer agent for an additional test pass targeting uncovered paths. This is a soft guideline; use judgment for trivial tasks.\n\nPRE-COMMIT RULE — Before ANY commit or push:\n  You MUST answer YES to ALL of the following:\n  [ ] Did the active swarm's reviewer agent run and return APPROVED? (not \"I reviewed it\" — the agent must have run)\n  [ ] Did the active swarm's test_engineer agent run and return PASS? (not \"the code looks correct\" — the agent must have run)\n  [ ] Did pre_check_batch run with gates_passed true?\n  [ ] Did the diff step run?\n  [ ] Did regression-sweep run (or SKIP with no related tests or test_runner error)?\n  [ ] Did test-drift check run (or NOT TRIGGERED)?\n\n  If ANY box is unchecked: DO NOT COMMIT. Return to step 5b.\n  There is no override. A commit without a completed QA gate is a workflow violation.\n\n## ROLE-BOUNDARY CHANGE VALIDATION (mandatory for prompt changes)\nWhen a task modifies agent prompts (especially explorer, reviewer, critic, or any agent involved in the mapper\u002Fvalidator\u002Fchallenge hierarchy), add an explicit test validation step:\n- If new prompt contract tests exist (e.g., explorer-role-boundary.test.ts, explorer-consumer-contract.test.ts): Run them via test_runner\n- If no specific tests exist for the changed prompt: Run test_runner with scope \"convention\" on the changed file\n- Verify the new tests pass before completing the task\n\nThis step supplements (not replaces) the existing regression-sweep and test-drift checks. It exists to catch prompt contract regressions that automated gates might miss.\n\n5o. ⛔ TASK COMPLETION GATE — You MUST print this checklist with filled values before marking ✓ in .swarm\u002Fplan.md:\n  [TOOL] diff: PASS \u002F SKIP — value: ___\n  [TOOL] syntax_check: PASS — value: ___\n  [TOOL] placeholder_scan: PASS — value: ___\n  [TOOL] imports: PASS — value: ___\n  [TOOL] lint: PASS — value: ___\n  [TOOL] build_check: PASS \u002F SKIPPED — value: ___\n  [TOOL] pre_check_batch: PASS (lint:check ✓ secretscan ✓ sast_scan ✓ quality_budget ✓) — value: ___\n  [GATE] reviewer: APPROVED — value: ___\n  [GATE] reuse_re_verification: VERIFIED \u002F SKIPPED \u002F DUPLICATION_DETECTED — value: ___\n  [GATE] security-reviewer: APPROVED \u002F SKIPPED — value: ___\n  [GATE] test_engineer-verification: PASS — value: ___\n  [GATE] regression-sweep: PASS \u002F SKIPPED — value: ___\n  [GATE] test-drift: TRIGGERED \u002F NOT TRIGGERED — value: ___\n  [GATE] test_engineer-adversarial: use the rendered checklist entry from the MODE: EXECUTE architect stub\n  [GATE] coverage: ≥70% \u002F soft-skip — value: ___\n\n  You MUST NOT mark a task complete without printing this checklist with filled values.\n  You MUST NOT fill \"PASS\" or \"APPROVED\" for a gate you did not actually run — that is fabrication.\n  Any blank \"value: ___\" field = gate was not run = task is NOT complete.\n  Filling this checklist from memory (\"I think I ran it\") is INVALID. Each value must come from actual tool\u002Fagent output in this session.\n\n    5p. Call update_task_status with status \"completed\".\n    5q. OPTIONAL TASK-COMPLETION COMMIT POLICY: read `.swarm\u002Fcontext.md`.\n        - If `## Task Completion Commit Policy` contains `commit_after_each_completed_task: true`, immediately call:\n          `checkpoint save task-\u003Ctask-id>-complete`\n        - If the section is absent or false, skip this step.\n        - This optional commit policy NEVER bypasses PRE-COMMIT RULE checks above.\n        - If checkpoint save fails with \"duplicate label\", the task was already checkpointed from a prior completion or retry. Silently skip — the existing checkpoint is valid.\n    5r. Proceed to next task.\n\n## Dispatch-lanes empty-output fallback\n\nThis fallback applies only to a settled, blocking `dispatch_lanes` result with empty output (0 chars, `output_digest` matching SHA-256 of empty string `e3b0c442...b855`). It does **not** apply to `dispatch_lanes_async` rows that are still pending\u002Frunning, an early `collect_lane_results` poll, or an async result whose full text is available through `retrieve_lane_output`.\n\nFor read-only advisory lanes, do **not** jump straight to Task. First re-collect async lanes with `collect_lane_results` (`wait: true` when no independent work remains) and inspect any `output_ref` with `retrieve_lane_output`. If a settled blocking `dispatch_lanes` lane is genuinely empty, prefer retrying the same agent through `dispatch_lanes_async` when promptAsync is available. Use the **Task tool** (`Task(subagent_type=..., prompt=...)`) only as a last-resort equivalent dispatch mechanism after the lane tools are unavailable or have produced a confirmed empty settled result; record the same agent, same prompt, same scope, and which dispatch mechanism succeeded.\n\nIf the Task tool also returns empty, **then** escalate to substitute review (4-member council without the broken agent) or surface to the user. Never fabricate or substitute a verdict for the missing agent.\n\n## Post-coder write verification\n\nAfter **any** coder delegation, verify the change actually landed by reading back at least one changed file (grep for a key line that should be present). Coder large or full-file writes can **silently fail** — the tool call appears in the response text but the file remains unchanged, and the coder reports DONE without realizing the write didn't execute.\n\nFor large or full-file changes, instruct the coder to use **targeted EDIT operations**, not full-file WRITE — targeted edits are more reliable for substantial changes. If a file appears unchanged after the coder reports DONE, re-delegate with explicit \"use targeted EDIT operations, not a full-file WRITE\" and verify the readback.\n","# Execute 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### MODE: EXECUTE\nFor each task (respecting dependencies):\n\nRETRY PROTOCOL — when returning to coder after any gate failure:\n1. Provide structured rejection: \"GATE FAILED: [gate name] | REASON: [details] | REQUIRED FIX: [specific action required]\"\n2. Re-enter at step 5b (the active swarm's coder agent) with full failure context\n3. Resume execution at the failed step (do not restart from 5a)\n   Exception: if coder modified files outside the original task scope, restart from step 5c\n4. Gates already PASSED may be skipped on retry if their input files are unchanged\n5. Print \"Resuming at step [5X] after coder retry [N\u002Fconfigured QA retry limit]\" before re-executing\n\nGATE FAILURE RESPONSE RULES — when ANY gate returns a failure:\nYou MUST return to the active swarm's coder agent. You MUST NOT fix the code yourself.\n\nWRONG responses to gate failure:\n✗ Editing the file yourself to fix the syntax error\n✗ Running a tool to auto-fix and moving on without coder\n✗ \"Installing\" or \"configuring\" tools to work around the failure\n✗ Treating the failure as an environment issue and proceeding\n✗ Deciding the failure is a false positive and skipping the gate\n\nRIGHT response to gate failure:\n✓ Print \"GATE FAILED: [gate name] | REASON: [details]\"\n✓ BEFORE the retry delegation: call `declare_scope` with the file list the retry will touch. Re-declare even if the files are identical to the original task — retry scope persists per-call, not per-task. See Rule 1a.\n✓ Delegate to the active swarm's coder agent with:\nTASK: Fix [gate name] failure\nFILE: [affected file(s)]\nINPUT: [exact error output from the gate]\nCONSTRAINT: Fix ONLY the reported issue, do not modify other code\n✓ After coder returns, re-run the failed gate from the step that failed\n✓ Print \"Coder attempt [N\u002Fconfigured QA retry limit] on task [X.Y]\"\n\nThe ONLY exception: lint tool in fix mode (step 5g) auto-corrects by design.\nAll other gates: failure → return to coder. No self-fixes. No workarounds.\n\n5a. **UI DESIGN GATE** (conditional — Rule 9): If task matches UI trigger → the active swarm's designer agent produces scaffold → pass scaffold to coder as INPUT. If no match → skip.\n\n→ After step 5a (or immediately if no UI task applies): Call update_task_status with status in_progress for the current task. Then proceed to step 5b.\n\n5a-bis. **DARK MATTER CO-CHANGE DETECTION**: After declaring scope but BEFORE finalizing the task file list, call knowledge_recall with query hidden-coupling primaryFile where primaryFile is the first file in the task's FILE list. Extract primaryFile from the task's FILE list (first file = primary). If results found, add those files to the task's AFFECTS scope with a BLAST RADIUS note. If no results or knowledge_recall unavailable, proceed gracefully without adding files. This is advisory — the architect may exclude files from scope if they are unrelated to the current task. Delegate to the active swarm's coder agent only after scope is declared.\n\n5b-PRE (required): Call `declare_scope({ taskId, files })` with the EXACT file list for this task — including any co-change files surfaced by 5a-bis. Skipping this call will cause every coder write to be BLOCKED by scope-guard. No `declare_scope` → no 5b delegation. See Rule 1a.\n    5b-BASE (required, once per task): Call `sast_scan` with `{ capture_baseline: true, phase: \u003CN>, changed_files: \u003Cfiles from 5b-PRE> }` where `\u003CN>` is the current phase number (extract from current task ID: task \"3.2\" → phase 3, task \"1.5\" → phase 1). The tool maintains `.swarm\u002Fevidence\u002F{phase}\u002Fsast-baseline.json` as a phase-scoped, incrementally merged baseline of pre-existing SAST findings. Calling twice for the same files is safe (idempotent merge). Do NOT re-capture mid-task.\n    → REQUIRED: Print \"sast-baseline: [WRITTEN — N fingerprints | MERGED — N fingerprints | SKIPPED — gate disabled | ERROR — details]\"\n    → Subsequent `pre_check_batch` calls with `phase: \u003CN>` will automatically diff against this baseline — only NEW findings (not in baseline) drive the fail verdict.\n5b. the active swarm's coder agent - Implement (if designer scaffold produced, include it as INPUT).\n5c. Run `diff` tool. If `hasContractChanges` → the active swarm's explorer agent integration analysis. If COMPATIBILITY SIGNALS=INCOMPATIBLE or MIGRATION_SURFACE=yes → coder retry. If COMPATIBILITY SIGNALS=COMPATIBLE and MIGRATION_SURFACE=no → proceed.\n    → REQUIRED: Print \"diff: [PASS | CONTRACT CHANGE — details]\"\n    5d. Run `syntax_check` tool. SYNTACTIC ERRORS → return to coder. NO ERRORS → proceed to placeholder_scan.\n    → REQUIRED: Print \"syntaxcheck: [PASS | FAIL — N errors]\"\n    5e. Run `placeholder_scan` tool. PLACEHOLDER FINDINGS → return to coder. NO FINDINGS → proceed to imports.\n    → REQUIRED: Print \"placeholderscan: [PASS | FAIL — N findings]\"\n    5f. Run `imports` tool for dependency audit. ISSUES → return to coder.\n    → REQUIRED: Print \"imports: [PASS | ISSUES — details]\"\n    5g. Run `lint` tool with fix mode for auto-fixes. If issues remain → run `lint` tool with check mode. FAIL → return to coder.\n    → REQUIRED: Print \"lint: [PASS | FAIL — details]\"\n    5h. Run `build_check` tool. BUILD FAILS → return to coder. SUCCESS → proceed to pre_check_batch.\n    → REQUIRED: Print \"buildcheck: [PASS | FAIL | SKIPPED — no toolchain]\"\n    5i. Run `pre_check_batch` tool with `phase: \u003CN>` (same phase number used in 5b-BASE) → runs four verification tools in parallel (max 4 concurrent):\n    - lint:check (code quality verification)\n    - secretscan (secret detection)\n    - sast_scan (static security analysis — diffs against phase baseline when phase provided)\n    - quality_budget (maintainability metrics)\n    → Returns { gates_passed, lint, secretscan, sast_scan, quality_budget, total_duration_ms }\n    → sast_scan result may include { new_findings, pre_existing_findings, baseline_used } when baseline diff is active.\n    → If ALL FOUR tools have ran === false (lint.ran === false && secretscan.ran === false && sast_scan.ran === false && quality_budget.ran === false):\n        → This is a SKIP - no tools actually ran. Print \"pre_check_batch: SKIP — all tools ran===false (no files to check or tools not available)\" and proceed to the active swarm's reviewer agent.\n    → Else if gates_passed === false: read individual tool results, identify which tool(s) failed, return structured rejection to the active swarm's coder agent with specific tool failures. Do NOT call the active swarm's reviewer agent.\n    → If gates_passed === true AND sast_preexisting_findings is present: proceed to the active swarm's reviewer agent. Include the pre-existing SAST findings in the reviewer delegation context with instruction: \"SAST TRIAGE REQUIRED: The following SAST findings existed before this task began (from phase baseline or unchanged lines). Verify these are acceptable pre-existing conditions and do not interact with the new changes.\" Do NOT return to coder for pre-existing findings.\n    → If gates_passed === true (no sast_preexisting_findings): proceed to the active swarm's reviewer agent.\n    → REQUIRED: Print \"pre_check_batch: [PASS — all gates passed | PASS — pre-existing SAST findings (N findings, reviewer triage) | FAIL — [gate]: [details]]\"\n\n⚠️ pre_check_batch SCOPE BOUNDARY:\npre_check_batch runs FOUR automated tools: lint:check, secretscan, sast_scan, quality_budget.\npre_check_batch does NOT run and does NOT replace:\n- the active swarm's reviewer agent (logic review, correctness, edge cases, maintainability)\n- the active swarm's reviewer agent security-only pass (OWASP evaluation, auth\u002Fcrypto review)\n- the active swarm's test_engineer agent verification tests (functional correctness)\n- the active swarm's test_engineer agent adversarial tests (attack vectors, boundary violations)\n- diff tool (contract change detection)\n- placeholder_scan (TODO\u002Fstub detection)\n- imports (dependency audit)\ngates_passed: true means \"automated static checks passed.\"\nIt does NOT mean \"code is reviewed.\" It does NOT mean \"code is tested.\"\nAfter pre_check_batch passes, you MUST STILL delegate to the active swarm's reviewer agent.\nTreating pre_check_batch as a substitute for the active swarm's reviewer agent is a PROCESS VIOLATION.\n\n    5j-COUNCIL (when council_mode is ON — replaces steps 5j through 5l):\n    When `council_mode` is enabled in the QA gate profile, Stage B (steps 5j-5l: reviewer + test_engineer) is REPLACED by the full 5-member council per task.\n\n    After Stage A (pre_check_batch) passes:\n    1. Ensure `declare_council_criteria` was called for this task (prerequisite).\n    2. Dispatch all 5 council members (critic, reviewer, sme, test_engineer, explorer) in PARALLEL with task-scoped context.\n    3. Collect all 5 verdict objects. Do NOT fabricate or substitute verdicts.\n    4. Call `submit_council_verdicts` with the collected verdicts.\n    5. Act on the verdict: APPROVE → task passes. CONCERNS with `success: false` + `reason: 'blocking_concerns_unresolved'` → HIGH\u002FCRITICAL findings are blocking, no evidence written, return to coder with requiredFixes and re-council after fixes. CONCERNS with `success: true` → only MEDIUM\u002FLOW advisory findings, task passes. REJECT → return to coder with requiredFixes.\n\n    When `council_mode` is OFF, the standard Stage B flow (steps 5j-5l: reviewer + test_engineer) runs as normal.\n\n    5j. the active swarm's reviewer agent - General review. REJECTED before the configured QA retry limit → coder retry. REJECTED at the configured QA retry limit → escalate.\n    → REQUIRED: Print \"reviewer: [APPROVED | REJECTED — reason]\"\n    5k. Security gate: if change matches TIER 3 criteria OR content contains SECURITY_KEYWORDS OR secretscan has ANY findings OR sast_scan has ANY findings at or above threshold → MUST delegate the active swarm's reviewer agent security-only review. REJECTED before the configured QA retry limit → coder retry. REJECTED at the configured QA retry limit → escalate to user.\n    → REQUIRED: Print \"security-reviewer: [TRIGGERED | NOT TRIGGERED — reason]\"\n    → If TRIGGERED: Print \"security-reviewer: [APPROVED | REJECTED — reason]\"\n    5l. the active swarm's test_engineer agent - Verification tests. FAIL → coder retry from 5g.\n    → REQUIRED: Print \"testengineer-verification: [PASS N\u002FN | FAIL — details]\"\n    5l-bis. REGRESSION SWEEP (automatic after test_engineer-verification PASS):\n    Run test_runner with { scope: \"graph\", files: [\u003Call source files changed by coder in this task>] }.\n    scope:\"graph\" traces imports to discover test files beyond the task's own tests that may be affected by this change.\n    \n    Outcomes (based on test_runner result.outcome field):\n    - outcome: \"pass\" → All tests passed. Print \"regression-sweep: PASS [N additional tests, M files]\"\n    - outcome: \"regression\" → Tests ran but some failed. Print \"regression-sweep: FAIL — REGRESSION DETECTED in [files]. The failing tests are CORRECT — fix the source code, not the tests.\" Return to coder with retry from 5g.\n    - outcome: \"skip\" → No test files resolved (nothing to run). Print \"regression-sweep: SKIPPED — no related tests beyond task scope\"\n    - outcome: \"scope_exceeded\" → Too many files for graph scope. Print \"regression-sweep: SKIPPED — broad scope, no related tests beyond task scope\"\n    - outcome: \"error\" → Tool error (timeout, no framework, etc.). Print \"regression-sweep: SKIPPED — test_runner error\" and continue pipeline.\n    \n    IMPORTANT: The regression sweep runs test_runner DIRECTLY (architect calls the tool). Do NOT delegate to test_engineer for this — the test_engineer's EXECUTION BOUNDARY restricts it to its own test files. The architect has unrestricted test_runner access.\n    → REQUIRED: Print \"regression-sweep: [PASS | FAIL — REGRESSION DETECTED | SKIPPED — no related tests | SKIPPED — broad scope | SKIPPED — test_runner error]\"\n\n    5l-ter. TEST DRIFT CHECK (conditional): Run this step if the change involves any drift-prone area:\n    - Command\u002FCLI behavior changed (shell command wrappers, CLI interfaces)\n    - Parsing or routing logic changed (argument parsing, route matching, file resolution)\n    - User-visible output changed (formatted output, error messages, JSON response structure)\n    - Public contracts or schemas changed (API types, tool argument schemas, return types)\n    - Assertion-heavy areas where output strings are tested (command\u002Fhelp output tests, error message tests)\n    - Helper behavior or lifecycle semantics changed (state machines, lifecycle hooks, initialization)\n    \n    If NOT triggered: Print \"test-drift: NOT TRIGGERED — no drift-prone change detected\"\n    If TRIGGERED:\n    - Use grep\u002Fsearch to find test files that cover the affected functionality\n    - Run those tests via test_runner with scope:\"convention\" on the related test files\n    - If any FAIL → print \"test-drift: DRIFT DETECTED in [N] tests\" and escalate to reviewer\u002Ftest_engineer\n    - If all PASS → print \"test-drift: [N] related tests verified\"\n    - If no related tests found → print \"test-drift: NO RELATED TESTS FOUND\" (not a failure)\n    → REQUIRED: Print \"test-drift: [TRIGGERED | NOT TRIGGERED — reason]\" and \"[DRIFT DETECTED in N tests | N related tests verified | NO RELATED TESTS FOUND | NOT TRIGGERED]\"\n\n    5n. TODO SCAN (advisory): Call todo_extract with paths=[list of files changed in this task]. If any results have priority HIGH → print \"todo-scan: WARN — N high-priority TODOs in changed files: [list of TODO texts]\". If no high-priority results → print \"todo-scan: CLEAN\". This is advisory only and does NOT block the pipeline.\n    → REQUIRED: Print \"todo-scan: [WARN — N high-priority TODOs | CLEAN]\"\n\n    5m. ADVERSARIAL TEST STEP (config-specific): Use the rendered adversarial-test instruction from the MODE: EXECUTE architect stub. If the stub omits step 5m, skip this step.\n    5n. COVERAGE CHECK: If the active swarm's test_engineer agent reports coverage \u003C 70% → delegate the active swarm's test_engineer agent for an additional test pass targeting uncovered paths. This is a soft guideline; use judgment for trivial tasks.\n\nPRE-COMMIT RULE — Before ANY commit or push:\n  You MUST answer YES to ALL of the following:\n  [ ] Did the active swarm's reviewer agent run and return APPROVED? (not \"I reviewed it\" — the agent must have run)\n  [ ] Did the active swarm's test_engineer agent run and return PASS? (not \"the code looks correct\" — the agent must have run)\n  [ ] Did pre_check_batch run with gates_passed true?\n  [ ] Did the diff step run?\n  [ ] Did regression-sweep run (or SKIP with no related tests or test_runner error)?\n  [ ] Did test-drift check run (or NOT TRIGGERED)?\n\n  If ANY box is unchecked: DO NOT COMMIT. Return to step 5b.\n  There is no override. A commit without a completed QA gate is a workflow violation.\n\n## ROLE-BOUNDARY CHANGE VALIDATION (mandatory for prompt changes)\nWhen a task modifies agent prompts (especially explorer, reviewer, critic, or any agent involved in the mapper\u002Fvalidator\u002Fchallenge hierarchy), add an explicit test validation step:\n- If new prompt contract tests exist (e.g., explorer-role-boundary.test.ts, explorer-consumer-contract.test.ts): Run them via test_runner\n- If no specific tests exist for the changed prompt: Run test_runner with scope \"convention\" on the changed file\n- Verify the new tests pass before completing the task\n\nThis step supplements (not replaces) the existing regression-sweep and test-drift checks. It exists to catch prompt contract regressions that automated gates might miss.\n\n5o. ⛔ TASK COMPLETION GATE — You MUST print this checklist with filled values before marking ✓ in .swarm\u002Fplan.md:\n  [TOOL] diff: PASS \u002F SKIP — value: ___\n  [TOOL] syntax_check: PASS — value: ___\n  [TOOL] placeholder_scan: PASS — value: ___\n  [TOOL] imports: PASS — value: ___\n  [TOOL] lint: PASS — value: ___\n  [TOOL] build_check: PASS \u002F SKIPPED — value: ___\n  [TOOL] pre_check_batch: PASS (lint:check ✓ secretscan ✓ sast_scan ✓ quality_budget ✓) — value: ___\n  [GATE] reviewer: APPROVED — value: ___\n  [GATE] reuse_re_verification: VERIFIED \u002F SKIPPED \u002F DUPLICATION_DETECTED — value: ___\n  [GATE] security-reviewer: APPROVED \u002F SKIPPED — value: ___\n  [GATE] test_engineer-verification: PASS — value: ___\n  [GATE] regression-sweep: PASS \u002F SKIPPED — value: ___\n  [GATE] test-drift: TRIGGERED \u002F NOT TRIGGERED — value: ___\n  [GATE] test_engineer-adversarial: use the rendered checklist entry from the MODE: EXECUTE architect stub\n  [GATE] coverage: ≥70% \u002F soft-skip — value: ___\n\n  You MUST NOT mark a task complete without printing this checklist with filled values.\n  You MUST NOT fill \"PASS\" or \"APPROVED\" for a gate you did not actually run — that is fabrication.\n  Any blank \"value: ___\" field = gate was not run = task is NOT complete.\n  Filling this checklist from memory (\"I think I ran it\") is INVALID. Each value must come from actual tool\u002Fagent output in this session.\n\n    5p. Call update_task_status with status \"completed\".\n    5q. OPTIONAL TASK-COMPLETION COMMIT POLICY: read `.swarm\u002Fcontext.md`.\n        - If `## Task Completion Commit Policy` contains `commit_after_each_completed_task: true`, immediately call:\n          `checkpoint save task-\u003Ctask-id>-complete`\n        - If the section is absent or false, skip this step.\n        - This optional commit policy NEVER bypasses PRE-COMMIT RULE checks above.\n        - If checkpoint save fails with \"duplicate label\", the task was already checkpointed from a prior completion or retry. Silently skip — the existing checkpoint is valid.\n    5r. Proceed to next task.\n\n## Dispatch-lanes empty-output fallback\n\nThis fallback applies only to a settled, blocking `dispatch_lanes` result with empty output (0 chars, `output_digest` matching SHA-256 of empty string `e3b0c442...b855`). It does **not** apply to `dispatch_lanes_async` rows that are still pending\u002Frunning, an early `collect_lane_results` poll, or an async result whose full text is available through `retrieve_lane_output`.\n\nFor read-only advisory lanes, do **not** jump straight to Task. First re-collect async lanes with `collect_lane_results` (`wait: true` when no independent work remains) and inspect any `output_ref` with `retrieve_lane_output`. If a settled blocking `dispatch_lanes` lane is genuinely empty, prefer retrying the same agent through `dispatch_lanes_async` when promptAsync is available. Use the **Task tool** (`Task(subagent_type=..., prompt=...)`) only as a last-resort equivalent dispatch mechanism after the lane tools are unavailable or have produced a confirmed empty settled result; record the same agent, same prompt, same scope, and which dispatch mechanism succeeded.\n\nIf the Task tool also returns empty, **then** escalate to substitute review (4-member council without the broken agent) or surface to the user. Never fabricate or substitute a verdict for the missing agent.\n\n## Post-coder write verification\n\nAfter **any** coder delegation, verify the change actually landed by reading back at least one changed file (grep for a key line that should be present). Coder large or full-file writes can **silently fail** — the tool call appears in the response text but the file remains unchanged, and the coder reports DONE without realizing the write didn't execute.\n\nFor large or full-file changes, instruct the coder to use **targeted EDIT operations**, not full-file WRITE — targeted edits are more reliable for substantial changes. If a file appears unchanged after the coder reports DONE, re-delegate with explicit \"use targeted EDIT operations, not a full-file WRITE\" and verify the readback.\n",{"name":5,"description":7},"main","7709dc9e5ebd3bd641124ad2a3f6bb053ac2dab6",".opencode\u002Fskills\u002Fexecute",0,"https:\u002F\u002Fgithub.com\u002FAlexanderNarbaev\u002Fagi","https:\u002F\u002Fgithub.com\u002FAlexanderNarbaev","2026-11-15 04:35:36",{"source":8,"skillName":5,"commands":31,"prompt":41,"zipAvailable":42},[32,35,38],{"tool":33,"command":34},"npx","npx skills add AlexanderNarbaev\u002Fagi --skill execute",{"tool":36,"command":37},"bunx","bunx skills add AlexanderNarbaev\u002Fagi --skill execute",{"tool":39,"command":40},"pnpm","pnpm dlx skills add AlexanderNarbaev\u002Fagi --skill execute","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FAlexanderNarbaev\u002Fagi\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fexecute\u002FSKILL.md",true,[],[45,52,59,66,73,80],{"skillNo":46,"name":47,"nameZh":6,"description":48,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":49,"categories":50,"keywords":51,"publishedAt":18},"01M76RZHYHMGE1WP9JBCMNA801","springboot-patterns","Spring Boot architecture patterns, REST API design, layered services, data access, caching, async processing, and logging. Use for Java Spring Boot backend work.","https:\u002F\u002Fgithub.com\u002FAlexanderNarbaev\u002Fagi\u002Fblob\u002Fmain\u002F.veai\u002Fskills\u002Fspringboot-patterns\u002FSKILL.md",[],[],{"skillNo":53,"name":54,"nameZh":6,"description":55,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":56,"categories":57,"keywords":58,"publishedAt":18},"01M76RZE6JNZH5HV7Q8JM7R0PN","search-first","Research-before-coding workflow. Search for existing tools, libraries, and patterns before writing custom code. Invokes the researcher agent.","https:\u002F\u002Fgithub.com\u002FAlexanderNarbaev\u002Fagi\u002Fblob\u002Fmain\u002F.veai\u002Fskills\u002Fsearch-first\u002FSKILL.md",[],[],{"skillNo":60,"name":61,"nameZh":6,"description":62,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":18},"01M76RZBV42EMQV77H7GMFY4AJ","scholar-evaluation","Structured scholarly-work evaluation for papers, proposals, literature reviews, methods sections, evidence quality, citation support, and research-writing feedback.","https:\u002F\u002Fgithub.com\u002FAlexanderNarbaev\u002Fagi\u002Fblob\u002Fmain\u002F.veai\u002Fskills\u002Fscholar-evaluation\u002FSKILL.md",[],[],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":18},"01M76RZ97GC3XAY48H126C30PM","redis-patterns","Redis data structure patterns, caching strategies, distributed locks, rate limiting, pub\u002Fsub, and connection management for production applications.","https:\u002F\u002Fgithub.com\u002FAlexanderNarbaev\u002Fagi\u002Fblob\u002Fmain\u002F.veai\u002Fskills\u002Fredis-patterns\u002FSKILL.md",[],[],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":18},"01M76RZ528FANTKX7Q9XR0CXM7","react-patterns","React 18\u002F19 patterns including hooks discipline, server\u002Fclient component boundaries, Suspense + error boundaries, form actions, data fetching, state management decision trees, and accessibility-first composition. Use when writing or reviewing React components.","https:\u002F\u002Fgithub.com\u002FAlexanderNarbaev\u002Fagi\u002Fblob\u002Fmain\u002F.veai\u002Fskills\u002Freact-patterns\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":18},"01M76RZ1244PZQRQV5HBQ4PVYQ","query-patterns","SQL patterns, relational database design, query optimization, transactions, analytics, and dialect-aware best practices.","https:\u002F\u002Fgithub.com\u002FAlexanderNarbaev\u002Fagi\u002Fblob\u002Fmain\u002F.veai\u002Fskills\u002Fquery-patterns\u002FSKILL.md",[],[]]