[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75FJFFRYPWT1M32N3JAT543":3,"skill-same:01M75FJFFRYPWT1M32N3JAT543":43},{"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":13,"repositoryHtmlUrl":26,"repositoryHomepageUrl":6,"ownerHtmlUrl":27,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":28,"install":29,"resources":42},"01M75FJFFRYPWT1M32N3JAT543","quality-gate",null,"Independently verify an Implementation Complete task with a Default-FAIL verification contract, deterministic checks, and an isolated critical reviewer, then decide whether it is Done.","aharada54914\u002Fsdd-forge","aharada54914","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F40755043?v=4","01M75FFC4V7WXZF0PK9RYWHNGF","01M75FFC5YJJ11B7MDCRVWB9Z6",0,"MIT","https:\u002F\u002Fgithub.com\u002Faharada54914\u002Fsdd-forge\u002Fblob\u002Fmain\u002Fplugins\u002Fsdd-quality-loop\u002Fskills\u002Fquality-gate\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: quality-gate\ndescription: Independently verify an Implementation Complete task with a Default-FAIL verification contract, deterministic checks, and an isolated critical reviewer, then decide whether it is Done.\ndisable-model-invocation: false\nuser-invocable: false\n---\n\n> **Caller**: This skill is invoked by `sdd-ship`. Do not invoke directly.\n> Results are returned to the caller; no downstream skill is auto-invoked.\n\n# Quality Gate\n\nUse after `implement-task` has set a task to `Implementation Complete`.\n\n## Native Codex evaluator route\n\nFor an unmanaged local Codex allocation without an idle sub-agent API, use the\ninstalled review plugin's `scripts\u002Flaunch-codex-review.py` with the ordinary\n`stage: quality`, `role: sdd-evaluator` invocation template. Do not reserve its\nplaceholder IDs. The launcher allocates a genuinely idle native thread, replaces\nonly the run\u002Fsession\u002Fledger continuation fields and its own fresh `scratch_root`,\nthen runs the existing evaluator delivery helper before the first model turn.\nThe original caller template remains pinned and unchanged. Preserve `task_id`,\n`implementation_manifest`, gate-report and supplemental-delivery declarations,\nand every required input. Missing implementation binding is a launch failure.\nManaged model routing retains its admitted managed route; this is not a fallback\nfrom a managed failure and does not change the configured Codex evaluator tier.\n\n```bash\npython3 -I -B \"$SDD_REVIEW_SCRIPTS\u002Flaunch-codex-review.py\" \\\n  \"$repository_root\" \"$invocation\" --manifest-sha256 \"$invocation_sha256\" \\\n  --output \"$new_output_directory\" --timeout 600\n```\n\nUse a new repository-contained output directory. Forward both fixed-input options\nwhen selected. This route requires Linux and native named permission profiles.\nIt verifies inside read, outside read denial, write denial and network denial;\nthere is no generic read-only fallback. The child permits only the projected\ninputs, its invocation and minimal native runtime files. External tools and\nplugins are disabled inside this child; parent workflow guards remain active.\nThe canonical `preflight-evaluator-delivery.py` performs scratch hash readback\nand delegates the reservation, preserving the implementation identity binding\nand feature-wide scratch isolation checks. Do not separately reserve this route.\n\n`evaluator.txt` is an independently produced candidate, not a quality gate report.\nThe shared plaintext validator checks identity, exact persisted manifest pin,\nverdict, findings and checked evidence. A PASS also requires an observed native\nread of an admitted file. The read-only child must list tests it could not rerun;\nmissing dependencies, writes or network are never silently enabled to get PASS.\nUse the usual quality-gate persistence and task-state checks to adopt the result.\nKeep `delivery.json`, native events, permission probes and the reservation receipt\nas transport evidence. Timeout, stale inputs, false identity, or missing delivery\nbinding stops without adopting a result; a consumed reservation stays in history.\n\n## Managed allocation boundary\n\nAffected policy roles: `evaluator`.\n\nApply this boundary only when the caller explicitly selects managed routing\nwith a policy request or model controls, or this allocation continues that\nmanaged workflow. With no managed input, retain the legacy invocation and model\nhints below. Once managed is selected, do not switch that workflow to legacy\nbecause selection, validation or launch fails. No new environment toggle is\nrequired, and this boundary does not grant delegation or execution permission.\n\nFor a managed allocation, apply in the allocating parent before an unbound\nforked Skill\u002FAgent, native role, or fresh context receives work, and before any\nidentity reservation. This\nboundary takes precedence over later native\u002Fdefault launch guidance for these\nroles. It does not add an availability or authority gate.\n\nKeep an already admitted managed entry with its validated selection\u002Fcontrols and\nmatching role, host, run\u002Fsession and workload. Keep a concretely known matching\nbatch startup and fixed generated Codex configuration under their original\ncontracts. An already bound worker continues its original procedure: do not\nselect again, allocate again, or run this refusal inside that same worker.\nA bound parent does not bind a new child, role or session: each new allocation\nneeds its own admitted selection\u002Fcarrier binding or takes the refusal below.\n\nWhen this operation has no admitted binding of the selected model and effort to\nits actual native carrier, substitute the next affected policy role and actual\nhost (`claude-code`, `codex-cli`, `copilot-cli`, or `gemini-cli`) and execute:\n\n```bash\npython3 -I -B \"\u003Cinstalled-root>\"\u002Fplugins\u002Fsdd-implementation\u002Fscripts\u002Fmanaged-model-entry.py unsupported-entry \\\n  --role \"\u003Cpolicy-role>\" --host \"\u003Chost>\"\n```\n\nExit 2 with `model-policy-error\u002Fv1` \u002F `model-unavailable` stops that allocation\nbefore work or reservation. Do not fall through to an old model hint, alias,\nunbound native default or another parent session; do not count allocation alone\nas selection proof. This refusal does not assert host incapability and never\nauthorizes same-session reload. Original host-incapable-only implementation\nfallback evidence and all review isolation requirements remain unchanged.\n\nApply before evaluator allocation or reservation. Keep the admitted managed Claude review\u002Fdelivery route and the fixed generated native Codex configuration entry. The later Codex candidates-file\u002Fcomment startup guidance is reference-only: selector output and x-sdd reference comments do not prove loaded native model\u002Feffort. A zero-turn configuration entry does not prove a substantive evaluator workload; an unbound workload stops here.\n\n\n## Preconditions\n\nIf `AGENTS.md` is absent at the repository root, stop immediately and direct\nthe user to run `\u002Fsdd-bootstrap:sdd-adopt`; do not proceed without it.\nMissing `reports\u002Fquality-gate\u002F` or `docs\u002Freview-tickets\u002F` directories may be\ncreated on the fly before continuing.\n\n## Required Reading\n\nRead the task, implementation report, requirements, design, acceptance tests,\ntraceability, contracts, ADRs, Git diff, and all bundled references, including\n`deterministic-check-policy.md`, `evaluation-rubric.md`, `risk-gate-matrix.md`,\n`risk-classification-policy.md`, and\n`plugins\u002Fsdd-quality-loop\u002Freferences\u002Fquality-gate-calibration.md`.\n\n## SQL開発の参照\n\n要求・設計・承認済みタスクがSQL、DBスキーマ、migration、ORMのDB変更を含む場合は、\nホストのスキル索引で `sql-develop` の配置を確認する。索引に非表示の場合は、\n同じホストが現在有効として登録する `sdd-implementation` のplugin root／manifestから\n`skills\u002Fsql-develop\u002F` を解決する。別versionのcacheや隣接pluginの配置は推測しない。\n確認したディレクトリ内の\n`references\u002Fsql-development-policy.md`の「検証と独立レビュー」と該当engineの参照を読む。\n公開 `sql-develop` を再起動せず、このスキルの承認・トラック・状態・実行証跡の規則を維持する。\nSQL契約の不足や、承認範囲外のDB変更が見つかった場合は、必要な仕様確認へ戻す。\nSQLを扱わない案件はこの追加手順を適用しない。SQL対象なのに参照資料が未導入の場合は、\n`sdd-implementation` の導入を案内し、SQL検証を省略して完了扱いにしない。\n初版で実行できるのは合成データの隔離DB検証まで。共有・本番DBへは接続しない。\n\n## Process\n\n1. Reject any target not in `Implementation Complete`.\n2. Create the Default-FAIL verification contract for the task from\n   `templates\u002Fverification-contract.template.json` following\n   `deterministic-check-policy.md`. Treat the implementation report as a\n   claim, not as evidence.\n3. Compare the implementation and report with the approved task and source artifacts.\n4. Detect and run all available CI-equivalent checks using `verification-policy.md`.\n   Save real command output as evidence and update the contract.\n5. Verify tests using `test-policy.md`.\n6. Run the scripted gates with `scripts\u002F*.sh` or `scripts\u002F*.ps1`, in this order:\n   - `check-risk` on the task: confirms a valid `Risk:` tier, a non-empty\n     `Risk Rationale:`, and — for `high`\u002F`critical` — `Required Workflow: tdd`.\n     The tier selects the required-check set per `risk-gate-matrix.md`.\n   - `check-placeholders` on the changed production files only.\n   - `check-design-system` on the changed files when the project carries a\n     `design-system\u002F` directory and the task touches UI-layer files: validates\n     the design-tokens.json contract envelope, scans changed files for raw\n     style values, and confirms design.md's `## Design System Compliance`\n     section. Warn-phase: findings are recorded in the report and in the\n     contract's `design-system` check but do not block until the error\n     promotion (`SDD_DESIGN_SYSTEM_ENFORCE=error`); when `design-system\u002F` is\n     absent the script skips with a note.\n   - `check-domain-conformance` on the task's `requirements.md`\u002F`design.md`\n     when the project carries a `domain\u002F` directory: validates the\n     `Bounded-Context:` field's context name(s) against\n     `domain\u002Fdomain-contract.json`, structured-field canonical-term usage,\n     and `design.md` aggregate references against `domain\u002Faggregates\u002F`; for\n     a two-context `Bounded-Context:`, passes only when the context map\n     declares a relation between them. Warn-phase: findings are recorded in\n     the report but do not block until the error promotion\n     (`SDD_DOMAIN_ENFORCE=error`); when `domain\u002F` is absent the script skips\n     with a note.\n   - During a correction cycle, `check-workflow-state --feature \u003Cfeature>` gives\n     early feedback on the selected specification. This result is explicitly\n     feature-scoped and cannot satisfy the final repository-wide check.\n     At finalization run `check-workflow-state` without `--feature`: validates the\n     canonical persisted-state invariant for every registered specification.\n     Any edit after that final check invalidates it; rerun before Done. Never\n     substitute a saved PASS flag, receipt timestamp or feature-only success.\n     Only when the existing measurement owner shows a total-time benefit for\n     several tasks evaluated together on an unchanged repository, an optional\n     supported Linux profile can use `check-workflow-state.sh --batch\n     \u003Crequests.json>`. The external request file contains only\n     `{\"schema\":\"workflow-state-batch\u002Fv1\",\"requests\":[\"feature\u002FT-001\",\"feature\u002FT-002\"]}`.\n     It requests the same full scan for each label; labels do not grant task\n     approval. Keep requests, outputs and measurements outside the checked tree.\n     Accept only this invocation's completed result bound to its final snapshot;\n     retained origin run IDs\u002Ftimestamps identify any same-process reuse. Exit 2\n     (`cold-required`) means run the ordinary full checker, with no earlier batch\n     PASS reused. Exit 1 retains ordinary failed-check diagnostics. All remaining\n     gates below and independent reviewers still run. This optional profile does\n     not support Git-history reconciliation, conditional external validators,\n     symlinks\u002FACLs, oversized trees or arbitrary build\u002Ftest caching. See\n     `docs\u002Fadr\u002F0045-workflow-session-reuse.md` for the execution boundary.\n   - `check-task-state` on tasks.md.\n   - `check-contract` on the task contract: enforces the tier-minimum required\n     set (superset rule) and, when `required_workflow` is `tdd`, non-empty\n     `red_evidence` + `green_evidence` for every test-type check.\n   - For an active Project Context with `spec_profile: full`, whose approved\n     Resolver invocation publishes a Facet Manifest, additionally run\n     `python3 scripts\u002Fevaluate-selected-plan.py --repo-root \u003Cproject-root>\n     --registry \u003Cprotected-registry> --facet-manifest \u003Ccurrent-resolver-manifest>\n     --contract \u003Ctask-contract>\n     --output \u003Cproject-root>\u002Fspecs\u002F\u003Cfeature>\u002Fverification\u002F\u003Ctask-id>\u002Fselected-plan.json`\n     (script path relative to this plugin; on Windows use `python`). First\n     complete the existing context approval, Resolver and staleness checks;\n     create the task verification directory before invocation. The output and\n     every parent must be real paths without symlinks or junctions; other output locations\n     are rejected. The feature\u002Ftask identity comes from the evaluated inputs;\n     supply their current manifest, never a hand-authored selection. Record\n     the command, exit code and versioned plan as gate evidence. Nonzero or\n     missing execution blocks acceptance; only a freshly emitted `PASS` may\n     satisfy this additional check. Registry selection never waives the\n     preceding legacy contract. Missing\u002Funrun required observations are\n     `BLOCKED`; only originally optional, target-unselected checks may be\n     reasoned N\u002FA. An absent Project Context retains the legacy path and\n     does not activate this evaluator from manifest file presence alone.\n   - For C3 PROMOTE_FULL (`spec_profile: lite` plus `--full`), the gate is\n     promoted but the Resolver output remains `capability-summary.yaml`.\n     Do not pass that summary to `--facet-manifest`, fabricate a Facet Manifest,\n     or select this branch merely because a manifest file is missing. Retain\n     all preceding full-gate checks, context approval and Resolver checks, and\n     additionally invoke `python3 plugins\u002Fsdd-lite\u002Flib\u002Frun-lite-gate.py\n     --summary \u003Ccurrent-resolver-summary> --enforcement \u003Cadvisory|required>\n     --full-gate-promotion\n     --repo-root \u003Cproject-root> --runtime \u003Cposix|powershell>` (locate the\n     installed sdd-lite plugin; on Windows use `python`). This existing adapter\n     validates the Summary and executes its Registry-sourced required Lite\n     checks using the Lite command-discovery contract. The explicit promotion\n     flag satisfies `full_upgrade_required: true` only because this caller is\n     already running all full-gate checks; the ordinary Lite caller retains its\n     early upgrade-required failure and must not pass this flag. Its baseline no-ops\n     require the corresponding full-gate observations already executed above.\n     Missing\u002Finvalid Summary, unavailable adapter, required-check failure, or\n     nonzero execution blocks acceptance. Record the real command, exit code\n     and JSON result. This branch emits no selected-plan claim and does not\n     change the project's profile; a full-profile context with a missing or\n     invalid Facet Manifest still blocks at the preceding evaluator step.\n   - `check-component-coverage` (epic-191-a3-path-ownership T-004, REQ-004):\n     the Reverse Coverage Gate. Always runs to completion and always emits\n     a `check-component-coverage-verdict\u002Fv1` evidence record. Derives one\n     of three states from the project's `workflow.capability_enforcement`\n     (never from Facet Manifest file presence, ADR-0016): `disabled-legacy`\n     (zero evaluation, a real N\u002FA record, exit 0 — this repository's own\n     current state, since no `project-context.yaml` exists yet),\n     `advisory` (full six-Fail-condition evaluation and recording, always\n     exit 0), `required` (identical evaluation, exit non-zero iff a Fail\n     condition triggers).\n     This is a required invocation with a legitimate applicability result, not\n     an optional waiver or a claim that coverage was substantively evaluated.\n     Preserve its actual command, exit status, configuration\u002Finput provenance and\n     producer-bound JSON in evaluator inputs. Do not force capability activation\n     solely because the contract check has `required: true`. Missing execution,\n     parse errors or enabled-mode missing coverage never qualify as this N\u002FA.\n     This documented invocation is defense-in-depth,\n     not the reachability guarantee — `check-component-coverage` is\n     registered in `check-contract`'s own protected tier-minimum required-\n     check-set (INV-017), which is what actually closes the gap were this\n     line to be deleted or the check renamed.\n   - `check-traceability` on `specs\u002F\u003Cfeature>\u002Ftraceability.json`: every\n     REQ → AC → TEST → evidence chain is intact (required for `high`\u002F`critical`).\n   For `Done` tasks, validate\n   `specs\u002F\u003Cfeature>\u002Fverification\u002F\u003Ctask-id>.evidence.json` with\n   `check-evidence-bundle.(sh|ps1)` so the report, contract, and passing\n   evidence artifacts are all bound together. For `high`\u002F`critical` the bundle\n   must carry `spec_revision`, `build_env`, and `review_verdict.verdict == PASS`;\n   for `critical` it must additionally carry a verifiable HMAC `signature` and a\n   clean tree (`git_generated_dirty == true` is a hard fail). Always produce the\n   bundle with `generate-evidence-bundle.(sh|ps1)` — never hand-author sha256\n   fields or the `git_commit` field. The runner binds the bundle to the current\n   git commit and computes digests automatically.\n7. For `refactor` and `bugfix` tasks with a `baseline-behavior.md`, apply\n   `differential-test-policy.md` and classify every BL diff.\n8. Run critical review with an isolated evaluator using `evaluation-rubric.md`.\n   The evaluator must also apply `quality-gate-calibration.md`: deterministic\n   command output, bundled scripted gates, line-level inspection, and manual\n   artifacts outrank implementation-report claims; the implementation report\n   never supports PASS by itself.\n   When the change touches the relevant surface, the evaluator also applies the\n   on-demand domain checklists — `security-checklist.md` (user input, auth,\n   secrets, external systems, AI\u002FLLM), `performance-checklist.md` (data access,\n   hot paths, rendering), `accessibility-checklist.md` (user-facing UI), and\n   `design-system-checklist.md` (user-facing UI in projects carrying a\n   `design-system\u002F` contract).\n   Load a checklist only when its domain is in scope, to keep review context lean.\n   On Claude Code use the `sdd-evaluator` subagent. The managed non-TTY\n   route below applies the selected model and effort through validated native\n   flags and its generated agent definition. This establishes configuration,\n   not actual backend identity. For legacy routes that only record the\n   `x-sdd-effort:` comment, retain `effort_applied=null` and pass\n   `--effort-control-main frontmatter` (no `--effort-applied-main`) to\n   `emit-run-record`, exposing the degradation through the resolved\n   `effort_control` value (AC-039, AC-024\u002FAC-051).\n\n   On Codex use the shipped `sdd-evaluator` (or `sdd-investigator`) TOML\n   agent; do not create new agent role files under `~\u002F.codex\u002Fagents\u002F`.\n   Codex-host startup wiring (REQ-006, T-006): before launching `codex`,\n   resolve `--model`\u002F`--effort` from the live registry — never from\n   unsanitized task or spec text (security-spec.md B3) — via:\n\n   ```sh\n   plugins\u002Fsdd-implementation\u002Fscripts\u002Fselect-agent-model.sh \\\n     --risk \u003Crisk> --registry contracts\u002Fagent-model-capabilities.v2.json \\\n     --candidates-file \u003Ccodex-candidates.json> \\\n     --role sdd-evaluator --host codex-cli --json\n   ```\n\n   (substitute `--role sdd-investigator` for the investigator; `--host\n   codex-cli` resolves each candidate's `effort_control.codex-cli`, and\n   `--role` seeds the role's `minimum_tier`\u002Ffallback effort from\n   `role_defaults`). Cross-check the resolved `model`\u002F`effort` against the\n   `# x-sdd-model:`\u002F`# x-sdd-effort:` reference comments T-003's renderer\n   wrote into `.codex\u002Fagents\u002Fsdd-evaluator.toml` (or\n   `sdd-investigator.toml`): when they diverge, report the divergence\n   (`DRIFT: \u003Ctoml-path> toml=\u003Cmodel>\u002F\u003Ceffort> live=\u003Cmodel>\u002F\u003Ceffort>`)\n   rather than silently preferring either value — the live selector output\n   is always what launches `codex`, the stale reference comment is never\n   silently substituted in either direction (AC-038). Reject any resolved\n   `--model`\u002F`--effort` value that is not a member of the registry's own\n   enumerated vocabulary: a whitespace-containing value, a value with a\n   leading `-`\u002F`--` (flag-injection shape), a value containing `;`\n   (command-separator shape), or an effort string outside the set\n   `{low, medium, high, xhigh}`. On rejection: non-zero exit, a diagnostic\n   message, and no `codex` invocation attempted (AC-052;\n   `run-panelist-gpt.sh`\u002F`.ps1` implement this same rejection for their own\n   `--model`\u002F`--effort` arguments — `tests\u002Frun-panelist-effort.tests.sh`\u002F\n   `.ps1` TEST-052). Launch `codex` with the resolved, validated flags:\n\n   ```sh\n   codex --model \u003Clive-model> --effort \u003Clive-effort> ...\n   ```\n\n   Elsewhere, perform the review in a fresh session or a clearly separated\n   critical-review pass.\n   Before launch, persist a canonical allowed-input manifest containing exactly\n   one `reports\u002Fimplementation\u002F\u003Cfeature>\u002FT-NNN.md`, the task's required\n   specification and calibration files, and only those changed, test, contract,\n   ADR, or deterministic-evidence files whose exact canonical path and lowercase\n   SHA-256 pair appears in that implementation report's `## Outputs` table, or\n   in the `## Post-Fix Artifacts` table of a gate report the manifest names in\n   `gate_report_declaration` and pins by SHA-256 (WFI-036). The implementation\n   report is frozen, so it can never describe bytes produced by a fix this gate\n   itself raised; a cycle that follows a review-ticket or in-gate fix therefore\n   records the post-fix path\u002Fhash rows in its own report, and the next cycle\n   names that report. The second channel is checked exactly as the first: the\n   named report's own hash is verified before a single row is read from it, a\n   path in neither document is still unlisted, and a row carrying the wrong\n   hash still fails. Do not add the rows to an earlier cycle's report -- that\n   report recorded a verdict at a point in time and must not later declare\n   bytes that did not exist then.\n   If a frozen implementation report omitted required evaluation inputs, preserve\n   it and use the approved supplemental-delivery repair: the quality manifest's\n   `supplemental_delivery_declaration` pins a canonical, symlink-free JSON file\n   under `specs\u002F\u003Cfeature>\u002Fverification\u002F\u003Ctask_id>\u002F`. Its exact fields are `schema`\n   (`supplemental-delivery-declaration\u002Fv1`), `feature`, `task_id`,\n   `implementation_report` (the canonical task-report path and its current SHA-256),\n   and `artifacts` (unique canonical path\u002FSHA-256 pairs). Include the declaration\n   itself in `allowed_input_manifest`. Validate its identity, report binding,\n   artifact paths and hashes before reservation; reject duplicate JSON keys,\n   duplicate paths, symlinks, traversal, missing files and raw review\u002Fgate reports.\n   This declaration admits inputs only: it neither replaces historical evidence\n   nor asserts approval, a verdict, task completion or tests not actually run.\n   For a frozen report containing only a legacy `Manifest SHA-256: \u003Chash>`\n   citation, declaration v2 adds exactly `implementation_manifest` (path\u002FSHA-256).\n   This pin must equal the invocation's implementation manifest and occur once\n   in its allowed inputs. Verify the file hash and the report's single exact\n   legacy digest; reject any `Input manifest:` line rather than override it.\n   Existing task\u002Frun\u002Fsession validation and reservation uniqueness still apply.\n   Version 1 and modern report citations retain their existing behavior.\n   Broad `plugins\u002F`, `tests\u002F`, `contracts\u002F`, or `docs\u002Fadr\u002F` membership never\n   authorizes an evaluator input.\n   Reverify every hash immediately before launch and bind the manifest path\u002Fhash,\n   a fresh run ID and a host-session ID unused by every other context into the\n   evaluator result. These fields may be identical within this invocation;\n   never invent a second native identifier merely to make them unequal.\n   Persist a one-role `review-context-invocation\u002Fv2` manifest for the evaluator.\n   Set its `task_id` to the current T-NNN and require the sole implementation\n   report path, report heading, and `Task ID` field to match that exact task.\n   Bind it to the current SHA-256 and final record hash of the canonical\n   `reports\u002Freview-context\u002Fidentity-ledger.json`. The ledger must already carry\n   every earlier reviewer\u002Fevaluator reservation as a valid hash chain. For a\n   new reservation, include the existing hash-pinned `task-input-manifest\u002Fv1`\n   as an evaluator input and name its path and SHA-256 in\n   `implementation_manifest`. Require its task\u002Frun\u002Fsession to agree with the\n   implementation report and reject their reuse in the canonical ledger.\n   Never fabricate an implementation ledger reservation or accept reserved-ID\n   arrays as a substitute.\n   Before reservation, the caller must prepare any dependency fixture needed\n   by read-only checks in a fresh evaluator-only scratch directory, preserving\n   admitted relative paths. Include every test dependency in the manifest;\n   missing dependencies block launch rather than being created by the evaluator.\n   The scratch copy is only a byte-identical projection of admitted files, not\n   an additional source of authority. Record its canonical `scratch_root` in\n   the invocation and independently read back every copied file against its\n   admitted SHA-256. The evaluator remains read-only inside scratch as well.\n   Freeze the manifest and pin its SHA-256 separately in the launch brief.\n   For the explicitly authorized Claude Code non-TTY Sonnet route, use the\n   shared caller (repository-root-relative paths):\n   `rtk proxy python3 -B plugins\u002Fsdd-review-loop\u002Fscripts\u002Flaunch-impl-review.py\n   \u003Crepository-root> \u003Cinvocation> \u003Creports\u002Fquality-gate\u002Flaunch-SESSION>\n   --manifest-sha256 \u003Ccaller-pin>`.\n   In this legacy route the canonical Claude evaluator and its generator select Sonnet;\n   this does not change the Codex evaluator tier or authorize a host switch to\n   bypass a refusal. This route requires a fresh declared scratch projection.\n   When managed routing is explicitly selected for the authorized Claude Code\n   non-TTY route, prepare the\n   evaluator policy selection and forward its validated controls to the shared\n   caller. Use repository-root-relative request, registry and fresh output\n   paths. The launcher output is absolute under the repository root.\n   The policy role is `evaluator`; the invocation's transport role stays\n   `sdd-evaluator`. The run and session IDs must equal the invocation's fresh\n   UUID, and the attempt must match its task attempt. Read the controls SHA\n   from `validation.json`; do not substitute an unchecked rehash.\n\n   ```bash\n   cd \"\u003Crepository-root>\" || exit $?\n   output=\"\u003Coutput-dir>\"\n   python3 -B plugins\u002Fsdd-implementation\u002Fscripts\u002Fmanaged-model-entry.py prepare \\\n     --role evaluator --host claude-code --request \"\u003Cpolicy-request>\" --registry \"\u003Cregistry>\" \\\n     --run-id \u003Crun-id> --session-id \u003Csession-id> --attempt \u003Cattempt> \\\n     --output-dir \"$output\" --require-actual-id false > \u002Fdev\u002Fnull || exit $?\n   controls_sha=$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))[\"controls\"][\"sha256\"])' \"$output\u002Fvalidation.json\") || exit $?\n   rtk proxy python3 -B plugins\u002Fsdd-review-loop\u002Fscripts\u002Flaunch-impl-review.py \\\n     \"\u003Crepository-root>\" \"\u003Cinvocation>\" \"\u003Crepository-root>\u002F\u003Creports\u002Fquality-gate\u002Flaunch-SESSION>\" \\\n     --manifest-sha256 \u003Ccaller-pin> \\\n     --model-controls \"$output\u002Fcontrols.json\" --model-controls-sha256 \"$controls_sha\"\n   ```\n\n   Stop on preparation or launch failure; never retry the legacy route.\n   With these controls the canonical Claude evaluator and its generated role\n   both use the trusted selected native model and effort. A standalone legacy\n   launch without controls retains Sonnet. This does not change the Codex\n   evaluator tier or authorize a host switch to bypass a refusal. This route\n   requires a fresh declared scratch projection.\n   Both routes check the external raw pin, common required-input\u002Fpath admission, and\n   this plugin's `preflight-evaluator-delivery.py` scratch readback before\n   creating launch output. It then pins dependencies, checks live CLI argv,\n   and runs the shared native permission probe before reservation. Missing or\n   failed `preflight-host-review.py` `HOST_REVIEW_PREFLIGHT_OK` proof, or\n   failed admitted-read, outside-read denial, compound-Bash denial, session\n   collision, or ordered-hash proof stops without reserving. Input preflight\n   alone explicitly leaves permission proof unestablished. Immediately before\n   reservation it rechecks dependency bytes, admission, argv, and the same\n   delivery helper's pin\u002Fscratch readback; only that helper delegates the\n   canonical atomic reservation. Do not separately reserve this route.\n   The complete receipt and invocation pin reach the child through the shared\n   prompt, and native delivery is validated independently of its verdict.\n   Exact Read\u002Fhash permissions do not permit writable tests: list tests not\n   rerun, and never treat delivery or a receipt as quality PASS. A candidate\n   launcher or fixture success does not establish an installed verified\n   baseline or authorize formal execution.\n   For other already-supported host routes, retain the delivery sequence below:\n     run `python3 -B scripts\u002Fpreflight-evaluator-delivery.py --manifest \u003Cmanifest>\n   --manifest-sha256 \u003Ccaller-pin> --repository-root \u003Crepository-root>` (paths\n   relative to this plugin); append `--scratch-root \u003Cscratch>` when a fixture\n   is needed. Require `EVALUATOR_DELIVERY_OK` before calling the reservation\n   validator. Failure leaves the ledger untouched. This delivery check does\n   not replace the existing required-input, path, identity or reservation checks.\n   Do not change these bytes between delivery and launch; the evaluator must\n   independently compare the manifest's raw bytes with the caller's pin before\n   parsing, then verify admitted inputs before use. A scratch fixture does not\n   authorize write-requiring tests; those remain caller-owned evidence.\n   Immediately before launch on those other host routes, run the same delivery command with `--reserve`.\n   It rechecks the pin and fixture before delegating the atomic reservation to\n   `scripts\u002Fvalidate-review-context-set.sh`; do not reserve directly and then\n   prepare a fixture. Require `EVALUATOR_DELIVERY_OK` and `REVIEW_CONTEXT_OK`,\n   then pass the complete validator receipt and the persisted invocation\n   manifest path\u002Fhash in the launch brief to the shipped evaluator. Tell the\n   evaluator to verify identity from that receipt and manifest alone; the\n   ledger is caller-only. Do not ask it to read\u002Fhash the ledger, rerun the\n   validator, inspect the process environment, or open raw session logs.\n   Launch exactly the reserved evaluator run\u002Fsession. A missing canonical\n   ledger, stale chain tip, deterministic runtime, or any non-zero result\n   retains `Implementation Complete` and blocks evaluator launch. This boundary\n   validates only the evaluator being launched; it does not require fabricated\n   future or replayed reviewer contexts.\n   Reject a missing manifest, unlisted path, hash mismatch, chat-only input, or\n   any implementation\u002Freview\u002Fevaluation session reuse.\n   Never direct an evaluator to reach an artifact the manifest does not\n   authorize -- not through `git show`, not through the live tree, and not by\n   reproducing its contents in the launch prompt. Authorization comes from the\n   persisted, validator-checked manifest, never from the launching agent's\n   prose; a launcher that can widen the evaluator's reachable set by asking has\n   removed the boundary this machinery exists to enforce. When a needed\n   artifact is undeclared, declare it and relaunch rather than instructing\n   around it (WFI-036).\n   No same-session fallback is permitted for the evaluator.\n   Use the caller-prepared evaluator scratch directory and name it in the\n   launch brief and the invocation record's optional `scratch_root` field: a\n   canonical absolute path used by no implementation context for this feature and\n   by no earlier evaluator run. Tell the evaluator to write nothing, including\n   inside scratch; fixture preparation and writable tests belong to the caller.\n   When `scratch_root` is present, the deterministic reservation boundary\n   compares it with the current implementation report's `Scratch Root` and\n   rejects equal or ancestor\u002Fdescendant paths before launch.\n   This is not housekeeping (WFI-034). Sharing one scratch root across roles\n   puts the implementing agent's intermediates -- a `.bak` of the suite under\n   review, per-task append scripts, raw red\u002Fgreen logs -- inside reach of the\n   agent grading that work, through a channel the manifest does not describe\n   and the hash checks never see. Observed in `sdd-domain-concept-contract`:\n   the evaluator found exactly those files and disclosed that it had declined\n   to read them. What held there was the reviewer's judgement, not a mechanism,\n   and a boundary that depends on the reviewed party declining an available\n   capability is not a boundary.\n   For `high`\u002F`critical` tasks, record\n   the evaluator's verdict as `review_verdict` in the evidence bundle;\n   `check-evidence-bundle` requires `review_verdict.verdict == PASS`.\n9. Classify findings as `Accepted`, `Rejected`, or `Deferred`. When a finding\n   is that the implementation report's narrative (counts, statuses, or\n   paths) diverges from the gate-time measured reality -- e.g. a later\n   same-feature task's edit, or a gate-phase artifact move, superseded what\n   the report described -- record the current values directly in this\n   quality-gate report and classify the finding `Accepted`; do not edit the\n   frozen implementation report to reconcile it.\n10. Apply only safe fixes allowed by `auto-fix-policy.md`.\n11. Repeat critical review autonomously for a maximum of 3 cycles.\n    Stop earlier when the remaining issue requires human decision, missing\n    evidence cannot be produced, or the fix belongs to `fix-by-review-ticket` or\n    an upstream review loop. Do not downgrade a finding merely to end the loop.\n    After escalation, follow Resuming After A Human Decision below.\n12. For UI changes, use available browser or Playwright tooling to verify the\n    rendered screen, DOM, and console, and when feasible perform the smoke\n    run described in `deterministic-check-policy.md`.\n13. Create review-ticket YAML for unresolved or non-auto-fixable findings.\n14. Update traceability and detect drift using `integrity-policy.md`.\n15. Create `reports\u002Fquality-gate\u002F\u003Ctimestamp>.md` from\n    `plugins\u002Fsdd-quality-loop\u002Ftemplates\u002Fquality-report.template.md` — the\n    template exists and is parity-tested\n    (`tests\u002Ftemplate-validator-parity.tests.{sh,ps1}`); do not author the\n    report freeform. Its identity header block (`Task ID:` \u002F `Feature:` \u002F\n    `Run ID:` \u002F `VERDICT:` \u002F `Critical:` \u002F `Major:` \u002F `Minor:`) is parsed\n    by deterministic consumers (check-evidence-bundle, emit-run-record,\n    generate-evidence-bundle, the retrospective's artifact rules): keep\n    each as a bare line before any prose, and never start a later body\n    line with `Feature: ` or `Task ID: ` — two consumers require exactly\n    one match each. Record the same `- Model:` \u002F `- Effort:` two-line\n    requirement the implementation report carries\n    (`implementation-report.template.md`,\n    `validate-implementation-report.sh` present-and-format-only check):\n    name the model and effort the gate's own critical-review pass ran\n    under. (WFI-020)\n\n### Resuming After A Human Decision\n\n`Escalate-Human` ends autonomous retries; it is not a failed quality check that\ncan be relabeled as success. After a human explicitly authorizes further\ncorrection and review, record in the current handoff and next gate report who\nauthorized it, the actual instruction and its conversation\u002Fartifact reference,\nthe affected feature\u002Ftask, the correction scope, and remaining findings.\nAn existing explicit retry instruction may apply: explain its concrete match\nto this correction instead of asking again. A general wish to finish, routine\napproval, or Sudo Mode alone does not authorize retries beyond the limit.\n\nWithin that recorded scope, perform the authorized correction through the\napplicable workflow and obtain a fresh independent review on the corrected\ninputs. Re-run all required deterministic checks and satisfy every Done\nDecision condition. Preserve every prior report, counter, finding and verdict;\nkeep the cycle-limit script's actual `Escalate-Human` output and non-zero exit\nin the evidence, describing this continuation as human-authorized rather than\nclaiming the limit passed. Do not reset history, invent an override flag, or\nuse a previous PASS for changed inputs. A new out-of-scope correction or an\nunresolved genuine human judgment still stops the gate. The recorded decision\nauthorizes only its stated scope, not an unlimited autonomous retry loop.\n\n### Sudo Mode\n\nIf a valid `SDD_SUDO` flag file exists at the project root (see\n`plugins\u002Fsdd-quality-loop\u002Freferences\u002Fsudo-mode-policy.md`), routine **approval**\ncheckpoints auto-pass: record `Approval: Approved (sudo \u003CISO8601 UTC>)` in\ntasks.md and continue. A `refactor`\u002F`bugfix` BL diff classified `accepted` also\nauto-passes (mark `(sudo \u003CISO8601 UTC>)` and update `baseline-behavior.md`).\n\nSudo never auto-passes genuine **judgment**: `requires_human_decision: true`\nfindings, architecture\u002Fauth\u002Fauthz\u002Fbreaking-API\u002Fsecurity decisions, and a\n`fix-required` baseline diff still stop the gate and require a human. All\ndeterministic gates apply; every check runs as normal.\n\n## Done Decision\n\nSet the task to `Done` only when:\n\n- `check-workflow-state` without `--feature` passes against the final input tree,\n  including specifications outside the selected feature. A correction-cycle\n  feature check is early feedback only; it cannot authorize Done.\n- `check-risk` passes: valid tier + rationale, and `high`\u002F`critical` declares\n  `Required Workflow: tdd`\n- `check-contract` passes: every required contract check (the tier-minimum\n  superset) is true with existing evidence files; for `tdd`, test checks carry\n  `red_evidence` + `green_evidence`\n- `check-traceability` passes for `high`\u002F`critical` (REQ → AC → TEST → evidence)\n- `check-evidence-bundle` passes: the bundle names the report, contract, and\n  contract-passing artifacts, with matching hashes and task id; for\n  `high`\u002F`critical` it carries `spec_revision`, `build_env`, and\n  `review_verdict.verdict == PASS`; for `critical` it carries a verified HMAC\n  `signature` over a clean tree\n- for `critical`, a second distinct named approver recorded\n  `Second Approval: Approved` (enforced by `check-task-state`; never sudo-bypassed)\n- acceptance criteria have tests\n- no unresolved Critical or Major finding remains\n- required UI verification succeeds\n- contracts and ADRs agree with the implementation\n- traceability is current\n- every in-scope \"cannot verify\" item has been resolved by evidence or recorded\n  as a blocking review ticket\n\nOtherwise set the task to `Blocked` or retain `Implementation Complete`, and\ncreate review tickets. Do not commit, push, or create a PR\u002FMR unless explicitly\nrequested.\n\n## Post-Done: Automatic Retrospective\n\nWhen the task transitions to `Done` (all conditions in the Done Decision section\nare met), automatically invoke the retrospective flow:\n\n1. Confirm `reports\u002Fquality-gate\u002F\u003Ctimestamp>.md` has been written (step 15 must\n   complete first so the new report is included in retrospective metrics).\n2. Determine the feature path from the task's spec directory (e.g. `specs\u002F\u003Cfeature>`).\n3. Check `tasks.md` for the feature: if any task with `Approval: Approved` is not\n   yet `Status: Done`, append\n   `[INFO] retrospective deferred: N approved task(s) still pending Done`\n   to the quality-gate report and stop here. Invoke retrospective only when\n   every approved task in the feature is `Done`.\n4. Invoke `workflow-retrospective` for that feature path:\n   - Claude Code: `\u002Fsdd-quality-loop:workflow-retrospective specs\u002F\u003Cfeature>`\n   - Codex: `Use the workflow-retrospective skill for specs\u002F\u003Cfeature>`\n5. The retrospective runs in read-only mode and does not affect `Done` status or\n   any other task field.\n6. If the feature path cannot be determined, skip the retrospective and append a\n   `[WARN] retrospective skipped: feature path unknown` line to the quality-gate\n   report.\n\nDo **not** invoke this flow when the gate exits with `Blocked` or retains\n`Implementation Complete`.\n\n## Common Rationalizations\n\nThe gate exists because generators grade their own work generously. Reject\nthese excuses — each one launders a claim into a `Done`.\n\n- \"The report says all tests pass, so they pass\" — the report is a claim; rerun\n  the checks and read the output yourself (`evaluation-rubric.md`).\n- \"The checks are green, the review can be light\" — green checks do not cover\n  spec compliance, untested acceptance criteria, or completion-faking.\n- \"This finding is probably fine, downgrade it to Minor\" — never weaken a\n  severity without recording why in the report.\n- \"A check doesn't apply, I'll just delete it from the contract\" — mark it\n  `required: false` with a non-empty `waiver_reason`; never remove a check to pass.\n- \"The evidence file is missing but the result is obviously right\" — Default-FAIL:\n  no saved evidence means the check stays false.\n- \"I cannot verify this, but no failure is visible\" — cannot-verify is not PASS;\n  keep the check false or create a review ticket.\n- \"sudo is on, so I can wave this through\" — sudo auto-passes routine *approval*\n  only; judgment findings and architecture\u002Fauth\u002Fsecurity decisions still stop\n  the gate.\n\n## Red Flags\n\n- Flipping a contract check to `passes: true` without a saved evidence path.\n- A handler returning data shaped like the test fixture (completion-faking —\n  `Critical`).\n- Skipped\u002F`todo`\u002F`xit` tests covering in-scope behavior left unaddressed.\n- An acceptance criterion with no test traced to it.\n- Setting `Done` while a Critical or Major finding is unresolved.\n- Running the critical review in the same context as the implementation.\n\n\n## Optional passive timing\n\nKeep measurement output outside the checkout. Existing execution owners accept\n`--measure-dir \u003Cnew-empty-directory>` and\n`--measure-parent \u003Copen-parent-span-id>`: `tests\u002Fverification.py --run` and\n`sdd-lite\u002Flib\u002Frun-lite-gate.py`. The immutable `sdd-run-measurement\u002Fv1` sidecar is\nobservation only. It records separate command\u002Fgate\u002Fsession spans, real outcomes,\nand hashes the owner's receipt\u002Foutput only after publication. It does not replace\nrun-records, contracts, independent review, evidence bundles or final checks.\n\nFor existing Bash or PowerShell gate calls, open a measurement with\n`python run_measurement.py open --dir D --measurement-id ID --run-id RUN --scope feature --feature FEATURE`,\nthen `start --dir D --phase gate --command-id GATE --span-id SPAN`; execute the\noriginal gate and save its exit code before calling\n`finish --dir D --span-id SPAN --outcome success|failure --exit-code CODE`.\nReturn the saved original gate exit code, not the recorder's. Use an enclosing\nsession span for aggregation. Record timeout\u002Finterruption only when the execution\nowner actually observed it; exit 124 alone is not a timeout observation.\n`summary` is obtained with `summarize --dir D --as-of none --ref-root ROOT`.\nHuman-active and human-wait phases require explicit observation; unobserved time,\ntokens and cost stay null, never zero. Shared boot identity is used where\navailable; when no shared monotonic clock domain can be established,\ncross-process duration remains unknown. Consult current-head\nnative CI evidence for platform execution rather than inferring it from Linux.\n\n## Optional project evidence collection\n\nThe [project evidence collection procedure](..\u002F..\u002F..\u002F..\u002Fdocs\u002Fcontributor\u002Fproject-evidence-collection.md)\nuses the existing runner and contract\u002Freport\u002Fbundle owners. Low-risk ordinary\ncollection and prospective Red\u002FGreen keep the required checks unchanged.\nHigh\u002Fcritical `--prepare` stops before the existing independent review, clean commit\nand signing steps; it does not grant approval or set Done. High\u002Fcritical work\nretains its existing review and signing requirements. Collection is optional,\nand neither this helper nor an observation file replaces owner-side execution.\n","> **Caller**: This skill is invoked by `sdd-ship`. Do not invoke directly.\n> Results are returned to the caller; no downstream skill is auto-invoked.\n\n# Quality Gate\n\nUse after `implement-task` has set a task to `Implementation Complete`.\n\n## Native Codex evaluator route\n\nFor an unmanaged local Codex allocation without an idle sub-agent API, use the\ninstalled review plugin's `scripts\u002Flaunch-codex-review.py` with the ordinary\n`stage: quality`, `role: sdd-evaluator` invocation template. Do not reserve its\nplaceholder IDs. The launcher allocates a genuinely idle native thread, replaces\nonly the run\u002Fsession\u002Fledger continuation fields and its own fresh `scratch_root`,\nthen runs the existing evaluator delivery helper before the first model turn.\nThe original caller template remains pinned and unchanged. Preserve `task_id`,\n`implementation_manifest`, gate-report and supplemental-delivery declarations,\nand every required input. Missing implementation binding is a launch failure.\nManaged model routing retains its admitted managed route; this is not a fallback\nfrom a managed failure and does not change the configured Codex evaluator tier.\n\n```bash\npython3 -I -B \"$SDD_REVIEW_SCRIPTS\u002Flaunch-codex-review.py\" \\\n  \"$repository_root\" \"$invocation\" --manifest-sha256 \"$invocation_sha256\" \\\n  --output \"$new_output_directory\" --timeout 600\n```\n\nUse a new repository-contained output directory. Forward both fixed-input options\nwhen selected. This route requires Linux and native named permission profiles.\nIt verifies inside read, outside read denial, write denial and network denial;\nthere is no generic read-only fallback. The child permits only the projected\ninputs, its invocation and minimal native runtime files. External tools and\nplugins are disabled inside this child; parent workflow guards remain active.\nThe canonical `preflight-evaluator-delivery.py` performs scratch hash readback\nand delegates the reservation, preserving the implementation identity binding\nand feature-wide scratch isolation checks. Do not separately reserve this route.\n\n`evaluator.txt` is an independently produced candidate, not a quality gate report.\nThe shared plaintext validator checks identity, exact persisted manifest pin,\nverdict, findings and checked evidence. A PASS also requires an observed native\nread of an admitted file. The read-only child must list tests it could not rerun;\nmissing dependencies, writes or network are never silently enabled to get PASS.\nUse the usual quality-gate persistence and task-state checks to adopt the result.\nKeep `delivery.json`, native events, permission probes and the reservation receipt\nas transport evidence. Timeout, stale inputs, false identity, or missing delivery\nbinding stops without adopting a result; a consumed reservation stays in history.\n\n## Managed allocation boundary\n\nAffected policy roles: `evaluator`.\n\nApply this boundary only when the caller explicitly selects managed routing\nwith a policy request or model controls, or this allocation continues that\nmanaged workflow. With no managed input, retain the legacy invocation and model\nhints below. Once managed is selected, do not switch that workflow to legacy\nbecause selection, validation or launch fails. No new environment toggle is\nrequired, and this boundary does not grant delegation or execution permission.\n\nFor a managed allocation, apply in the allocating parent before an unbound\nforked Skill\u002FAgent, native role, or fresh context receives work, and before any\nidentity reservation. This\nboundary takes precedence over later native\u002Fdefault launch guidance for these\nroles. It does not add an availability or authority gate.\n\nKeep an already admitted managed entry with its validated selection\u002Fcontrols and\nmatching role, host, run\u002Fsession and workload. Keep a concretely known matching\nbatch startup and fixed generated Codex configuration under their original\ncontracts. An already bound worker continues its original procedure: do not\nselect again, allocate again, or run this refusal inside that same worker.\nA bound parent does not bind a new child, role or session: each new allocation\nneeds its own admitted selection\u002Fcarrier binding or takes the refusal below.\n\nWhen this operation has no admitted binding of the selected model and effort to\nits actual native carrier, substitute the next affected policy role and actual\nhost (`claude-code`, `codex-cli`, `copilot-cli`, or `gemini-cli`) and execute:\n\n```bash\npython3 -I -B \"\u003Cinstalled-root>\"\u002Fplugins\u002Fsdd-implementation\u002Fscripts\u002Fmanaged-model-entry.py unsupported-entry \\\n  --role \"\u003Cpolicy-role>\" --host \"\u003Chost>\"\n```\n\nExit 2 with `model-policy-error\u002Fv1` \u002F `model-unavailable` stops that allocation\nbefore work or reservation. Do not fall through to an old model hint, alias,\nunbound native default or another parent session; do not count allocation alone\nas selection proof. This refusal does not assert host incapability and never\nauthorizes same-session reload. Original host-incapable-only implementation\nfallback evidence and all review isolation requirements remain unchanged.\n\nApply before evaluator allocation or reservation. Keep the admitted managed Claude review\u002Fdelivery route and the fixed generated native Codex configuration entry. The later Codex candidates-file\u002Fcomment startup guidance is reference-only: selector output and x-sdd reference comments do not prove loaded native model\u002Feffort. A zero-turn configuration entry does not prove a substantive evaluator workload; an unbound workload stops here.\n\n\n## Preconditions\n\nIf `AGENTS.md` is absent at the repository root, stop immediately and direct\nthe user to run `\u002Fsdd-bootstrap:sdd-adopt`; do not proceed without it.\nMissing `reports\u002Fquality-gate\u002F` or `docs\u002Freview-tickets\u002F` directories may be\ncreated on the fly before continuing.\n\n## Required Reading\n\nRead the task, implementation report, requirements, design, acceptance tests,\ntraceability, contracts, ADRs, Git diff, and all bundled references, including\n`deterministic-check-policy.md`, `evaluation-rubric.md`, `risk-gate-matrix.md`,\n`risk-classification-policy.md`, and\n`plugins\u002Fsdd-quality-loop\u002Freferences\u002Fquality-gate-calibration.md`.\n\n## SQL開発の参照\n\n要求・設計・承認済みタスクがSQL、DBスキーマ、migration、ORMのDB変更を含む場合は、\nホストのスキル索引で `sql-develop` の配置を確認する。索引に非表示の場合は、\n同じホストが現在有効として登録する `sdd-implementation` のplugin root／manifestから\n`skills\u002Fsql-develop\u002F` を解決する。別versionのcacheや隣接pluginの配置は推測しない。\n確認したディレクトリ内の\n`references\u002Fsql-development-policy.md`の「検証と独立レビュー」と該当engineの参照を読む。\n公開 `sql-develop` を再起動せず、このスキルの承認・トラック・状態・実行証跡の規則を維持する。\nSQL契約の不足や、承認範囲外のDB変更が見つかった場合は、必要な仕様確認へ戻す。\nSQLを扱わない案件はこの追加手順を適用しない。SQL対象なのに参照資料が未導入の場合は、\n`sdd-implementation` の導入を案内し、SQL検証を省略して完了扱いにしない。\n初版で実行できるのは合成データの隔離DB検証まで。共有・本番DBへは接続しない。\n\n## Process\n\n1. Reject any target not in `Implementation Complete`.\n2. Create the Default-FAIL verification contract for the task from\n   `templates\u002Fverification-contract.template.json` following\n   `deterministic-check-policy.md`. Treat the implementation report as a\n   claim, not as evidence.\n3. Compare the implementation and report with the approved task and source artifacts.\n4. Detect and run all available CI-equivalent checks using `verification-policy.md`.\n   Save real command output as evidence and update the contract.\n5. Verify tests using `test-policy.md`.\n6. Run the scripted gates with `scripts\u002F*.sh` or `scripts\u002F*.ps1`, in this order:\n   - `check-risk` on the task: confirms a valid `Risk:` tier, a non-empty\n     `Risk Rationale:`, and — for `high`\u002F`critical` — `Required Workflow: tdd`.\n     The tier selects the required-check set per `risk-gate-matrix.md`.\n   - `check-placeholders` on the changed production files only.\n   - `check-design-system` on the changed files when the project carries a\n     `design-system\u002F` directory and the task touches UI-layer files: validates\n     the design-tokens.json contract envelope, scans changed files for raw\n     style values, and confirms design.md's `## Design System Compliance`\n     section. Warn-phase: findings are recorded in the report and in the\n     contract's `design-system` check but do not block until the error\n     promotion (`SDD_DESIGN_SYSTEM_ENFORCE=error`); when `design-system\u002F` is\n     absent the script skips with a note.\n   - `check-domain-conformance` on the task's `requirements.md`\u002F`design.md`\n     when the project carries a `domain\u002F` directory: validates the\n     `Bounded-Context:` field's context name(s) against\n     `domain\u002Fdomain-contract.json`, structured-field canonical-term usage,\n     and `design.md` aggregate references against `domain\u002Faggregates\u002F`; for\n     a two-context `Bounded-Context:`, passes only when the context map\n     declares a relation between them. Warn-phase: findings are recorded in\n     the report but do not block until the error promotion\n     (`SDD_DOMAIN_ENFORCE=error`); when `domain\u002F` is absent the script skips\n     with a note.\n   - During a correction cycle, `check-workflow-state --feature \u003Cfeature>` gives\n     early feedback on the selected specification. This result is explicitly\n     feature-scoped and cannot satisfy the final repository-wide check.\n     At finalization run `check-workflow-state` without `--feature`: validates the\n     canonical persisted-state invariant for every registered specification.\n     Any edit after that final check invalidates it; rerun before Done. Never\n     substitute a saved PASS flag, receipt timestamp or feature-only success.\n     Only when the existing measurement owner shows a total-time benefit for\n     several tasks evaluated together on an unchanged repository, an optional\n     supported Linux profile can use `check-workflow-state.sh --batch\n     \u003Crequests.json>`. The external request file contains only\n     `{\"schema\":\"workflow-state-batch\u002Fv1\",\"requests\":[\"feature\u002FT-001\",\"feature\u002FT-002\"]}`.\n     It requests the same full scan for each label; labels do not grant task\n     approval. Keep requests, outputs and measurements outside the checked tree.\n     Accept only this invocation's completed result bound to its final snapshot;\n     retained origin run IDs\u002Ftimestamps identify any same-process reuse. Exit 2\n     (`cold-required`) means run the ordinary full checker, with no earlier batch\n     PASS reused. Exit 1 retains ordinary failed-check diagnostics. All remaining\n     gates below and independent reviewers still run. This optional profile does\n     not support Git-history reconciliation, conditional external validators,\n     symlinks\u002FACLs, oversized trees or arbitrary build\u002Ftest caching. See\n     `docs\u002Fadr\u002F0045-workflow-session-reuse.md` for the execution boundary.\n   - `check-task-state` on tasks.md.\n   - `check-contract` on the task contract: enforces the tier-minimum required\n     set (superset rule) and, when `required_workflow` is `tdd`, non-empty\n     `red_evidence` + `green_evidence` for every test-type check.\n   - For an active Project Context with `spec_profile: full`, whose approved\n     Resolver invocation publishes a Facet Manifest, additionally run\n     `python3 scripts\u002Fevaluate-selected-plan.py --repo-root \u003Cproject-root>\n     --registry \u003Cprotected-registry> --facet-manifest \u003Ccurrent-resolver-manifest>\n     --contract \u003Ctask-contract>\n     --output \u003Cproject-root>\u002Fspecs\u002F\u003Cfeature>\u002Fverification\u002F\u003Ctask-id>\u002Fselected-plan.json`\n     (script path relative to this plugin; on Windows use `python`). First\n     complete the existing context approval, Resolver and staleness checks;\n     create the task verification directory before invocation. The output and\n     every parent must be real paths without symlinks or junctions; other output locations\n     are rejected. The feature\u002Ftask identity comes from the evaluated inputs;\n     supply their current manifest, never a hand-authored selection. Record\n     the command, exit code and versioned plan as gate evidence. Nonzero or\n     missing execution blocks acceptance; only a freshly emitted `PASS` may\n     satisfy this additional check. Registry selection never waives the\n     preceding legacy contract. Missing\u002Funrun required observations are\n     `BLOCKED`; only originally optional, target-unselected checks may be\n     reasoned N\u002FA. An absent Project Context retains the legacy path and\n     does not activate this evaluator from manifest file presence alone.\n   - For C3 PROMOTE_FULL (`spec_profile: lite` plus `--full`), the gate is\n     promoted but the Resolver output remains `capability-summary.yaml`.\n     Do not pass that summary to `--facet-manifest`, fabricate a Facet Manifest,\n     or select this branch merely because a manifest file is missing. Retain\n     all preceding full-gate checks, context approval and Resolver checks, and\n     additionally invoke `python3 plugins\u002Fsdd-lite\u002Flib\u002Frun-lite-gate.py\n     --summary \u003Ccurrent-resolver-summary> --enforcement \u003Cadvisory|required>\n     --full-gate-promotion\n     --repo-root \u003Cproject-root> --runtime \u003Cposix|powershell>` (locate the\n     installed sdd-lite plugin; on Windows use `python`). This existing adapter\n     validates the Summary and executes its Registry-sourced required Lite\n     checks using the Lite command-discovery contract. The explicit promotion\n     flag satisfies `full_upgrade_required: true` only because this caller is\n     already running all full-gate checks; the ordinary Lite caller retains its\n     early upgrade-required failure and must not pass this flag. Its baseline no-ops\n     require the corresponding full-gate observations already executed above.\n     Missing\u002Finvalid Summary, unavailable adapter, required-check failure, or\n     nonzero execution blocks acceptance. Record the real command, exit code\n     and JSON result. This branch emits no selected-plan claim and does not\n     change the project's profile; a full-profile context with a missing or\n     invalid Facet Manifest still blocks at the preceding evaluator step.\n   - `check-component-coverage` (epic-191-a3-path-ownership T-004, REQ-004):\n     the Reverse Coverage Gate. Always runs to completion and always emits\n     a `check-component-coverage-verdict\u002Fv1` evidence record. Derives one\n     of three states from the project's `workflow.capability_enforcement`\n     (never from Facet Manifest file presence, ADR-0016): `disabled-legacy`\n     (zero evaluation, a real N\u002FA record, exit 0 — this repository's own\n     current state, since no `project-context.yaml` exists yet),\n     `advisory` (full six-Fail-condition evaluation and recording, always\n     exit 0), `required` (identical evaluation, exit non-zero iff a Fail\n     condition triggers).\n     This is a required invocation with a legitimate applicability result, not\n     an optional waiver or a claim that coverage was substantively evaluated.\n     Preserve its actual command, exit status, configuration\u002Finput provenance and\n     producer-bound JSON in evaluator inputs. Do not force capability activation\n     solely because the contract check has `required: true`. Missing execution,\n     parse errors or enabled-mode missing coverage never qualify as this N\u002FA.\n     This documented invocation is defense-in-depth,\n     not the reachability guarantee — `check-component-coverage` is\n     registered in `check-contract`'s own protected tier-minimum required-\n     check-set (INV-017), which is what actually closes the gap were this\n     line to be deleted or the check renamed.\n   - `check-traceability` on `specs\u002F\u003Cfeature>\u002Ftraceability.json`: every\n     REQ → AC → TEST → evidence chain is intact (required for `high`\u002F`critical`).\n   For `Done` tasks, validate\n   `specs\u002F\u003Cfeature>\u002Fverification\u002F\u003Ctask-id>.evidence.json` with\n   `check-evidence-bundle.(sh|ps1)` so the report, contract, and passing\n   evidence artifacts are all bound together. For `high`\u002F`critical` the bundle\n   must carry `spec_revision`, `build_env`, and `review_verdict.verdict == PASS`;\n   for `critical` it must additionally carry a verifiable HMAC `signature` and a\n   clean tree (`git_generated_dirty == true` is a hard fail). Always produce the\n   bundle with `generate-evidence-bundle.(sh|ps1)` — never hand-author sha256\n   fields or the `git_commit` field. The runner binds the bundle to the current\n   git commit and computes digests automatically.\n7. For `refactor` and `bugfix` tasks with a `baseline-behavior.md`, apply\n   `differential-test-policy.md` and classify every BL diff.\n8. Run critical review with an isolated evaluator using `evaluation-rubric.md`.\n   The evaluator must also apply `quality-gate-calibration.md`: deterministic\n   command output, bundled scripted gates, line-level inspection, and manual\n   artifacts outrank implementation-report claims; the implementation report\n   never supports PASS by itself.\n   When the change touches the relevant surface, the evaluator also applies the\n   on-demand domain checklists — `security-checklist.md` (user input, auth,\n   secrets, external systems, AI\u002FLLM), `performance-checklist.md` (data access,\n   hot paths, rendering), `accessibility-checklist.md` (user-facing UI), and\n   `design-system-checklist.md` (user-facing UI in projects carrying a\n   `design-system\u002F` contract).\n   Load a checklist only when its domain is in scope, to keep review context lean.\n   On Claude Code use the `sdd-evaluator` subagent. The managed non-TTY\n   route below applies the selected model and effort through validated native\n   flags and its generated agent definition. This establishes configuration,\n   not actual backend identity. For legacy routes that only record the\n   `x-sdd-effort:` comment, retain `effort_applied=null` and pass\n   `--effort-control-main frontmatter` (no `--effort-applied-main`) to\n   `emit-run-record`, exposing the degradation through the resolved\n   `effort_control` value (AC-039, AC-024\u002FAC-051).\n\n   On Codex use the shipped `sdd-evaluator` (or `sdd-investigator`) TOML\n   agent; do not create new agent role files under `~\u002F.codex\u002Fagents\u002F`.\n   Codex-host startup wiring (REQ-006, T-006): before launching `codex`,\n   resolve `--model`\u002F`--effort` from the live registry — never from\n   unsanitized task or spec text (security-spec.md B3) — via:\n\n   ```sh\n   plugins\u002Fsdd-implementation\u002Fscripts\u002Fselect-agent-model.sh \\\n     --risk \u003Crisk> --registry contracts\u002Fagent-model-capabilities.v2.json \\\n     --candidates-file \u003Ccodex-candidates.json> \\\n     --role sdd-evaluator --host codex-cli --json\n   ```\n\n   (substitute `--role sdd-investigator` for the investigator; `--host\n   codex-cli` resolves each candidate's `effort_control.codex-cli`, and\n   `--role` seeds the role's `minimum_tier`\u002Ffallback effort from\n   `role_defaults`). Cross-check the resolved `model`\u002F`effort` against the\n   `# x-sdd-model:`\u002F`# x-sdd-effort:` reference comments T-003's renderer\n   wrote into `.codex\u002Fagents\u002Fsdd-evaluator.toml` (or\n   `sdd-investigator.toml`): when they diverge, report the divergence\n   (`DRIFT: \u003Ctoml-path> toml=\u003Cmodel>\u002F\u003Ceffort> live=\u003Cmodel>\u002F\u003Ceffort>`)\n   rather than silently preferring either value — the live selector output\n   is always what launches `codex`, the stale reference comment is never\n   silently substituted in either direction (AC-038). Reject any resolved\n   `--model`\u002F`--effort` value that is not a member of the registry's own\n   enumerated vocabulary: a whitespace-containing value, a value with a\n   leading `-`\u002F`--` (flag-injection shape), a value containing `;`\n   (command-separator shape), or an effort string outside the set\n   `{low, medium, high, xhigh}`. On rejection: non-zero exit, a diagnostic\n   message, and no `codex` invocation attempted (AC-052;\n   `run-panelist-gpt.sh`\u002F`.ps1` implement this same rejection for their own\n   `--model`\u002F`--effort` arguments — `tests\u002Frun-panelist-effort.tests.sh`\u002F\n   `.ps1` TEST-052). Launch `codex` with the resolved, validated flags:\n\n   ```sh\n   codex --model \u003Clive-model> --effort \u003Clive-effort> ...\n   ```\n\n   Elsewhere, perform the review in a fresh session or a clearly separated\n   critical-review pass.\n   Before launch, persist a canonical allowed-input manifest containing exactly\n   one `reports\u002Fimplementation\u002F\u003Cfeature>\u002FT-NNN.md`, the task's required\n   specification and calibration files, and only those changed, test, contract,\n   ADR, or deterministic-evidence files whose exact canonical path and lowercase\n   SHA-256 pair appears in that implementation report's `## Outputs` table, or\n   in the `## Post-Fix Artifacts` table of a gate report the manifest names in\n   `gate_report_declaration` and pins by SHA-256 (WFI-036). The implementation\n   report is frozen, so it can never describe bytes produced by a fix this gate\n   itself raised; a cycle that follows a review-ticket or in-gate fix therefore\n   records the post-fix path\u002Fhash rows in its own report, and the next cycle\n   names that report. The second channel is checked exactly as the first: the\n   named report's own hash is verified before a single row is read from it, a\n   path in neither document is still unlisted, and a row carrying the wrong\n   hash still fails. Do not add the rows to an earlier cycle's report -- that\n   report recorded a verdict at a point in time and must not later declare\n   bytes that did not exist then.\n   If a frozen implementation report omitted required evaluation inputs, preserve\n   it and use the approved supplemental-delivery repair: the quality manifest's\n   `supplemental_delivery_declaration` pins a canonical, symlink-free JSON file\n   under `specs\u002F\u003Cfeature>\u002Fverification\u002F\u003Ctask_id>\u002F`. Its exact fields are `schema`\n   (`supplemental-delivery-declaration\u002Fv1`), `feature`, `task_id`,\n   `implementation_report` (the canonical task-report path and its current SHA-256),\n   and `artifacts` (unique canonical path\u002FSHA-256 pairs). Include the declaration\n   itself in `allowed_input_manifest`. Validate its identity, report binding,\n   artifact paths and hashes before reservation; reject duplicate JSON keys,\n   duplicate paths, symlinks, traversal, missing files and raw review\u002Fgate reports.\n   This declaration admits inputs only: it neither replaces historical evidence\n   nor asserts approval, a verdict, task completion or tests not actually run.\n   For a frozen report containing only a legacy `Manifest SHA-256: \u003Chash>`\n   citation, declaration v2 adds exactly `implementation_manifest` (path\u002FSHA-256).\n   This pin must equal the invocation's implementation manifest and occur once\n   in its allowed inputs. Verify the file hash and the report's single exact\n   legacy digest; reject any `Input manifest:` line rather than override it.\n   Existing task\u002Frun\u002Fsession validation and reservation uniqueness still apply.\n   Version 1 and modern report citations retain their existing behavior.\n   Broad `plugins\u002F`, `tests\u002F`, `contracts\u002F`, or `docs\u002Fadr\u002F` membership never\n   authorizes an evaluator input.\n   Reverify every hash immediately before launch and bind the manifest path\u002Fhash,\n   a fresh run ID and a host-session ID unused by every other context into the\n   evaluator result. These fields may be identical within this invocation;\n   never invent a second native identifier merely to make them unequal.\n   Persist a one-role `review-context-invocation\u002Fv2` manifest for the evaluator.\n   Set its `task_id` to the current T-NNN and require the sole implementation\n   report path, report heading, and `Task ID` field to match that exact task.\n   Bind it to the current SHA-256 and final record hash of the canonical\n   `reports\u002Freview-context\u002Fidentity-ledger.json`. The ledger must already carry\n   every earlier reviewer\u002Fevaluator reservation as a valid hash chain. For a\n   new reservation, include the existing hash-pinned `task-input-manifest\u002Fv1`\n   as an evaluator input and name its path and SHA-256 in\n   `implementation_manifest`. Require its task\u002Frun\u002Fsession to agree with the\n   implementation report and reject their reuse in the canonical ledger.\n   Never fabricate an implementation ledger reservation or accept reserved-ID\n   arrays as a substitute.\n   Before reservation, the caller must prepare any dependency fixture needed\n   by read-only checks in a fresh evaluator-only scratch directory, preserving\n   admitted relative paths. Include every test dependency in the manifest;\n   missing dependencies block launch rather than being created by the evaluator.\n   The scratch copy is only a byte-identical projection of admitted files, not\n   an additional source of authority. Record its canonical `scratch_root` in\n   the invocation and independently read back every copied file against its\n   admitted SHA-256. The evaluator remains read-only inside scratch as well.\n   Freeze the manifest and pin its SHA-256 separately in the launch brief.\n   For the explicitly authorized Claude Code non-TTY Sonnet route, use the\n   shared caller (repository-root-relative paths):\n   `rtk proxy python3 -B plugins\u002Fsdd-review-loop\u002Fscripts\u002Flaunch-impl-review.py\n   \u003Crepository-root> \u003Cinvocation> \u003Creports\u002Fquality-gate\u002Flaunch-SESSION>\n   --manifest-sha256 \u003Ccaller-pin>`.\n   In this legacy route the canonical Claude evaluator and its generator select Sonnet;\n   this does not change the Codex evaluator tier or authorize a host switch to\n   bypass a refusal. This route requires a fresh declared scratch projection.\n   When managed routing is explicitly selected for the authorized Claude Code\n   non-TTY route, prepare the\n   evaluator policy selection and forward its validated controls to the shared\n   caller. Use repository-root-relative request, registry and fresh output\n   paths. The launcher output is absolute under the repository root.\n   The policy role is `evaluator`; the invocation's transport role stays\n   `sdd-evaluator`. The run and session IDs must equal the invocation's fresh\n   UUID, and the attempt must match its task attempt. Read the controls SHA\n   from `validation.json`; do not substitute an unchecked rehash.\n\n   ```bash\n   cd \"\u003Crepository-root>\" || exit $?\n   output=\"\u003Coutput-dir>\"\n   python3 -B plugins\u002Fsdd-implementation\u002Fscripts\u002Fmanaged-model-entry.py prepare \\\n     --role evaluator --host claude-code --request \"\u003Cpolicy-request>\" --registry \"\u003Cregistry>\" \\\n     --run-id \u003Crun-id> --session-id \u003Csession-id> --attempt \u003Cattempt> \\\n     --output-dir \"$output\" --require-actual-id false > \u002Fdev\u002Fnull || exit $?\n   controls_sha=$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))[\"controls\"][\"sha256\"])' \"$output\u002Fvalidation.json\") || exit $?\n   rtk proxy python3 -B plugins\u002Fsdd-review-loop\u002Fscripts\u002Flaunch-impl-review.py \\\n     \"\u003Crepository-root>\" \"\u003Cinvocation>\" \"\u003Crepository-root>\u002F\u003Creports\u002Fquality-gate\u002Flaunch-SESSION>\" \\\n     --manifest-sha256 \u003Ccaller-pin> \\\n     --model-controls \"$output\u002Fcontrols.json\" --model-controls-sha256 \"$controls_sha\"\n   ```\n\n   Stop on preparation or launch failure; never retry the legacy route.\n   With these controls the canonical Claude evaluator and its generated role\n   both use the trusted selected native model and effort. A standalone legacy\n   launch without controls retains Sonnet. This does not change the Codex\n   evaluator tier or authorize a host switch to bypass a refusal. This route\n   requires a fresh declared scratch projection.\n   Both routes check the external raw pin, common required-input\u002Fpath admission, and\n   this plugin's `preflight-evaluator-delivery.py` scratch readback before\n   creating launch output. It then pins dependencies, checks live CLI argv,\n   and runs the shared native permission probe before reservation. Missing or\n   failed `preflight-host-review.py` `HOST_REVIEW_PREFLIGHT_OK` proof, or\n   failed admitted-read, outside-read denial, compound-Bash denial, session\n   collision, or ordered-hash proof stops without reserving. Input preflight\n   alone explicitly leaves permission proof unestablished. Immediately before\n   reservation it rechecks dependency bytes, admission, argv, and the same\n   delivery helper's pin\u002Fscratch readback; only that helper delegates the\n   canonical atomic reservation. Do not separately reserve this route.\n   The complete receipt and invocation pin reach the child through the shared\n   prompt, and native delivery is validated independently of its verdict.\n   Exact Read\u002Fhash permissions do not permit writable tests: list tests not\n   rerun, and never treat delivery or a receipt as quality PASS. A candidate\n   launcher or fixture success does not establish an installed verified\n   baseline or authorize formal execution.\n   For other already-supported host routes, retain the delivery sequence below:\n     run `python3 -B scripts\u002Fpreflight-evaluator-delivery.py --manifest \u003Cmanifest>\n   --manifest-sha256 \u003Ccaller-pin> --repository-root \u003Crepository-root>` (paths\n   relative to this plugin); append `--scratch-root \u003Cscratch>` when a fixture\n   is needed. Require `EVALUATOR_DELIVERY_OK` before calling the reservation\n   validator. Failure leaves the ledger untouched. This delivery check does\n   not replace the existing required-input, path, identity or reservation checks.\n   Do not change these bytes between delivery and launch; the evaluator must\n   independently compare the manifest's raw bytes with the caller's pin before\n   parsing, then verify admitted inputs before use. A scratch fixture does not\n   authorize write-requiring tests; those remain caller-owned evidence.\n   Immediately before launch on those other host routes, run the same delivery command with `--reserve`.\n   It rechecks the pin and fixture before delegating the atomic reservation to\n   `scripts\u002Fvalidate-review-context-set.sh`; do not reserve directly and then\n   prepare a fixture. Require `EVALUATOR_DELIVERY_OK` and `REVIEW_CONTEXT_OK`,\n   then pass the complete validator receipt and the persisted invocation\n   manifest path\u002Fhash in the launch brief to the shipped evaluator. Tell the\n   evaluator to verify identity from that receipt and manifest alone; the\n   ledger is caller-only. Do not ask it to read\u002Fhash the ledger, rerun the\n   validator, inspect the process environment, or open raw session logs.\n   Launch exactly the reserved evaluator run\u002Fsession. A missing canonical\n   ledger, stale chain tip, deterministic runtime, or any non-zero result\n   retains `Implementation Complete` and blocks evaluator launch. This boundary\n   validates only the evaluator being launched; it does not require fabricated\n   future or replayed reviewer contexts.\n   Reject a missing manifest, unlisted path, hash mismatch, chat-only input, or\n   any implementation\u002Freview\u002Fevaluation session reuse.\n   Never direct an evaluator to reach an artifact the manifest does not\n   authorize -- not through `git show`, not through the live tree, and not by\n   reproducing its contents in the launch prompt. Authorization comes from the\n   persisted, validator-checked manifest, never from the launching agent's\n   prose; a launcher that can widen the evaluator's reachable set by asking has\n   removed the boundary this machinery exists to enforce. When a needed\n   artifact is undeclared, declare it and relaunch rather than instructing\n   around it (WFI-036).\n   No same-session fallback is permitted for the evaluator.\n   Use the caller-prepared evaluator scratch directory and name it in the\n   launch brief and the invocation record's optional `scratch_root` field: a\n   canonical absolute path used by no implementation context for this feature and\n   by no earlier evaluator run. Tell the evaluator to write nothing, including\n   inside scratch; fixture preparation and writable tests belong to the caller.\n   When `scratch_root` is present, the deterministic reservation boundary\n   compares it with the current implementation report's `Scratch Root` and\n   rejects equal or ancestor\u002Fdescendant paths before launch.\n   This is not housekeeping (WFI-034). Sharing one scratch root across roles\n   puts the implementing agent's intermediates -- a `.bak` of the suite under\n   review, per-task append scripts, raw red\u002Fgreen logs -- inside reach of the\n   agent grading that work, through a channel the manifest does not describe\n   and the hash checks never see. Observed in `sdd-domain-concept-contract`:\n   the evaluator found exactly those files and disclosed that it had declined\n   to read them. What held there was the reviewer's judgement, not a mechanism,\n   and a boundary that depends on the reviewed party declining an available\n   capability is not a boundary.\n   For `high`\u002F`critical` tasks, record\n   the evaluator's verdict as `review_verdict` in the evidence bundle;\n   `check-evidence-bundle` requires `review_verdict.verdict == PASS`.\n9. Classify findings as `Accepted`, `Rejected`, or `Deferred`. When a finding\n   is that the implementation report's narrative (counts, statuses, or\n   paths) diverges from the gate-time measured reality -- e.g. a later\n   same-feature task's edit, or a gate-phase artifact move, superseded what\n   the report described -- record the current values directly in this\n   quality-gate report and classify the finding `Accepted`; do not edit the\n   frozen implementation report to reconcile it.\n10. Apply only safe fixes allowed by `auto-fix-policy.md`.\n11. Repeat critical review autonomously for a maximum of 3 cycles.\n    Stop earlier when the remaining issue requires human decision, missing\n    evidence cannot be produced, or the fix belongs to `fix-by-review-ticket` or\n    an upstream review loop. Do not downgrade a finding merely to end the loop.\n    After escalation, follow Resuming After A Human Decision below.\n12. For UI changes, use available browser or Playwright tooling to verify the\n    rendered screen, DOM, and console, and when feasible perform the smoke\n    run described in `deterministic-check-policy.md`.\n13. Create review-ticket YAML for unresolved or non-auto-fixable findings.\n14. Update traceability and detect drift using `integrity-policy.md`.\n15. Create `reports\u002Fquality-gate\u002F\u003Ctimestamp>.md` from\n    `plugins\u002Fsdd-quality-loop\u002Ftemplates\u002Fquality-report.template.md` — the\n    template exists and is parity-tested\n    (`tests\u002Ftemplate-validator-parity.tests.{sh,ps1}`); do not author the\n    report freeform. Its identity header block (`Task ID:` \u002F `Feature:` \u002F\n    `Run ID:` \u002F `VERDICT:` \u002F `Critical:` \u002F `Major:` \u002F `Minor:`) is parsed\n    by deterministic consumers (check-evidence-bundle, emit-run-record,\n    generate-evidence-bundle, the retrospective's artifact rules): keep\n    each as a bare line before any prose, and never start a later body\n    line with `Feature: ` or `Task ID: ` — two consumers require exactly\n    one match each. Record the same `- Model:` \u002F `- Effort:` two-line\n    requirement the implementation report carries\n    (`implementation-report.template.md`,\n    `validate-implementation-report.sh` present-and-format-only check):\n    name the model and effort the gate's own critical-review pass ran\n    under. (WFI-020)\n\n### Resuming After A Human Decision\n\n`Escalate-Human` ends autonomous retries; it is not a failed quality check that\ncan be relabeled as success. After a human explicitly authorizes further\ncorrection and review, record in the current handoff and next gate report who\nauthorized it, the actual instruction and its conversation\u002Fartifact reference,\nthe affected feature\u002Ftask, the correction scope, and remaining findings.\nAn existing explicit retry instruction may apply: explain its concrete match\nto this correction instead of asking again. A general wish to finish, routine\napproval, or Sudo Mode alone does not authorize retries beyond the limit.\n\nWithin that recorded scope, perform the authorized correction through the\napplicable workflow and obtain a fresh independent review on the corrected\ninputs. Re-run all required deterministic checks and satisfy every Done\nDecision condition. Preserve every prior report, counter, finding and verdict;\nkeep the cycle-limit script's actual `Escalate-Human` output and non-zero exit\nin the evidence, describing this continuation as human-authorized rather than\nclaiming the limit passed. Do not reset history, invent an override flag, or\nuse a previous PASS for changed inputs. A new out-of-scope correction or an\nunresolved genuine human judgment still stops the gate. The recorded decision\nauthorizes only its stated scope, not an unlimited autonomous retry loop.\n\n### Sudo Mode\n\nIf a valid `SDD_SUDO` flag file exists at the project root (see\n`plugins\u002Fsdd-quality-loop\u002Freferences\u002Fsudo-mode-policy.md`), routine **approval**\ncheckpoints auto-pass: record `Approval: Approved (sudo \u003CISO8601 UTC>)` in\ntasks.md and continue. A `refactor`\u002F`bugfix` BL diff classified `accepted` also\nauto-passes (mark `(sudo \u003CISO8601 UTC>)` and update `baseline-behavior.md`).\n\nSudo never auto-passes genuine **judgment**: `requires_human_decision: true`\nfindings, architecture\u002Fauth\u002Fauthz\u002Fbreaking-API\u002Fsecurity decisions, and a\n`fix-required` baseline diff still stop the gate and require a human. All\ndeterministic gates apply; every check runs as normal.\n\n## Done Decision\n\nSet the task to `Done` only when:\n\n- `check-workflow-state` without `--feature` passes against the final input tree,\n  including specifications outside the selected feature. A correction-cycle\n  feature check is early feedback only; it cannot authorize Done.\n- `check-risk` passes: valid tier + rationale, and `high`\u002F`critical` declares\n  `Required Workflow: tdd`\n- `check-contract` passes: every required contract check (the tier-minimum\n  superset) is true with existing evidence files; for `tdd`, test checks carry\n  `red_evidence` + `green_evidence`\n- `check-traceability` passes for `high`\u002F`critical` (REQ → AC → TEST → evidence)\n- `check-evidence-bundle` passes: the bundle names the report, contract, and\n  contract-passing artifacts, with matching hashes and task id; for\n  `high`\u002F`critical` it carries `spec_revision`, `build_env`, and\n  `review_verdict.verdict == PASS`; for `critical` it carries a verified HMAC\n  `signature` over a clean tree\n- for `critical`, a second distinct named approver recorded\n  `Second Approval: Approved` (enforced by `check-task-state`; never sudo-bypassed)\n- acceptance criteria have tests\n- no unresolved Critical or Major finding remains\n- required UI verification succeeds\n- contracts and ADRs agree with the implementation\n- traceability is current\n- every in-scope \"cannot verify\" item has been resolved by evidence or recorded\n  as a blocking review ticket\n\nOtherwise set the task to `Blocked` or retain `Implementation Complete`, and\ncreate review tickets. Do not commit, push, or create a PR\u002FMR unless explicitly\nrequested.\n\n## Post-Done: Automatic Retrospective\n\nWhen the task transitions to `Done` (all conditions in the Done Decision section\nare met), automatically invoke the retrospective flow:\n\n1. Confirm `reports\u002Fquality-gate\u002F\u003Ctimestamp>.md` has been written (step 15 must\n   complete first so the new report is included in retrospective metrics).\n2. Determine the feature path from the task's spec directory (e.g. `specs\u002F\u003Cfeature>`).\n3. Check `tasks.md` for the feature: if any task with `Approval: Approved` is not\n   yet `Status: Done`, append\n   `[INFO] retrospective deferred: N approved task(s) still pending Done`\n   to the quality-gate report and stop here. Invoke retrospective only when\n   every approved task in the feature is `Done`.\n4. Invoke `workflow-retrospective` for that feature path:\n   - Claude Code: `\u002Fsdd-quality-loop:workflow-retrospective specs\u002F\u003Cfeature>`\n   - Codex: `Use the workflow-retrospective skill for specs\u002F\u003Cfeature>`\n5. The retrospective runs in read-only mode and does not affect `Done` status or\n   any other task field.\n6. If the feature path cannot be determined, skip the retrospective and append a\n   `[WARN] retrospective skipped: feature path unknown` line to the quality-gate\n   report.\n\nDo **not** invoke this flow when the gate exits with `Blocked` or retains\n`Implementation Complete`.\n\n## Common Rationalizations\n\nThe gate exists because generators grade their own work generously. Reject\nthese excuses — each one launders a claim into a `Done`.\n\n- \"The report says all tests pass, so they pass\" — the report is a claim; rerun\n  the checks and read the output yourself (`evaluation-rubric.md`).\n- \"The checks are green, the review can be light\" — green checks do not cover\n  spec compliance, untested acceptance criteria, or completion-faking.\n- \"This finding is probably fine, downgrade it to Minor\" — never weaken a\n  severity without recording why in the report.\n- \"A check doesn't apply, I'll just delete it from the contract\" — mark it\n  `required: false` with a non-empty `waiver_reason`; never remove a check to pass.\n- \"The evidence file is missing but the result is obviously right\" — Default-FAIL:\n  no saved evidence means the check stays false.\n- \"I cannot verify this, but no failure is visible\" — cannot-verify is not PASS;\n  keep the check false or create a review ticket.\n- \"sudo is on, so I can wave this through\" — sudo auto-passes routine *approval*\n  only; judgment findings and architecture\u002Fauth\u002Fsecurity decisions still stop\n  the gate.\n\n## Red Flags\n\n- Flipping a contract check to `passes: true` without a saved evidence path.\n- A handler returning data shaped like the test fixture (completion-faking —\n  `Critical`).\n- Skipped\u002F`todo`\u002F`xit` tests covering in-scope behavior left unaddressed.\n- An acceptance criterion with no test traced to it.\n- Setting `Done` while a Critical or Major finding is unresolved.\n- Running the critical review in the same context as the implementation.\n\n\n## Optional passive timing\n\nKeep measurement output outside the checkout. Existing execution owners accept\n`--measure-dir \u003Cnew-empty-directory>` and\n`--measure-parent \u003Copen-parent-span-id>`: `tests\u002Fverification.py --run` and\n`sdd-lite\u002Flib\u002Frun-lite-gate.py`. The immutable `sdd-run-measurement\u002Fv1` sidecar is\nobservation only. It records separate command\u002Fgate\u002Fsession spans, real outcomes,\nand hashes the owner's receipt\u002Foutput only after publication. It does not replace\nrun-records, contracts, independent review, evidence bundles or final checks.\n\nFor existing Bash or PowerShell gate calls, open a measurement with\n`python run_measurement.py open --dir D --measurement-id ID --run-id RUN --scope feature --feature FEATURE`,\nthen `start --dir D --phase gate --command-id GATE --span-id SPAN`; execute the\noriginal gate and save its exit code before calling\n`finish --dir D --span-id SPAN --outcome success|failure --exit-code CODE`.\nReturn the saved original gate exit code, not the recorder's. Use an enclosing\nsession span for aggregation. Record timeout\u002Finterruption only when the execution\nowner actually observed it; exit 124 alone is not a timeout observation.\n`summary` is obtained with `summarize --dir D --as-of none --ref-root ROOT`.\nHuman-active and human-wait phases require explicit observation; unobserved time,\ntokens and cost stay null, never zero. Shared boot identity is used where\navailable; when no shared monotonic clock domain can be established,\ncross-process duration remains unknown. Consult current-head\nnative CI evidence for platform execution rather than inferring it from Linux.\n\n## Optional project evidence collection\n\nThe [project evidence collection procedure](..\u002F..\u002F..\u002F..\u002Fdocs\u002Fcontributor\u002Fproject-evidence-collection.md)\nuses the existing runner and contract\u002Freport\u002Fbundle owners. Low-risk ordinary\ncollection and prospective Red\u002FGreen keep the required checks unchanged.\nHigh\u002Fcritical `--prepare` stops before the existing independent review, clean commit\nand signing steps; it does not grant approval or set Done. High\u002Fcritical work\nretains its existing review and signing requirements. Collection is optional,\nand neither this helper nor an observation file replaces owner-side execution.\n",{"name":5,"description":7,"user-invocable":19,"disable-model-invocation":19},"main","fd25c1e5f7b94dc5e50addb995d4313da0dda65a","plugins\u002Fsdd-quality-loop\u002Fskills\u002Fquality-gate","https:\u002F\u002Fgithub.com\u002Faharada54914\u002Fsdd-forge","https:\u002F\u002Fgithub.com\u002Faharada54914","2026-11-15 02:49:38",{"source":8,"skillName":5,"commands":30,"prompt":40,"zipAvailable":41},[31,34,37],{"tool":32,"command":33},"npx","npx skills add aharada54914\u002Fsdd-forge --skill quality-gate",{"tool":35,"command":36},"bunx","bunx skills add aharada54914\u002Fsdd-forge --skill quality-gate",{"tool":38,"command":39},"pnpm","pnpm dlx skills add aharada54914\u002Fsdd-forge --skill quality-gate","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Faharada54914\u002Fsdd-forge\u002Fblob\u002Fmain\u002Fplugins\u002Fsdd-quality-loop\u002Fskills\u002Fquality-gate\u002FSKILL.md",true,[],[44,52,59,66,71,78],{"skillNo":45,"name":46,"nameZh":6,"description":47,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":48,"categories":49,"keywords":50,"publishedAt":51},"01M7DY6PWMGRM0GFNBXAE2RP3K","status","Show a read-only Jira-style six-view SDD dashboard in the initiating parent's Sites or Claude Artifacts, with source freshness and failure visibility.","https:\u002F\u002Fgithub.com\u002Faharada54914\u002Fsdd-forge\u002Fblob\u002Fmain\u002Fplugins\u002Fsdd-ship\u002Fskills\u002Fstatus\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"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},"01M75FN16WRENJ2A9CXZCXVKBQ","verify-review-reservation","Recheck the bounded identity-ledger reservation invariant after lock, hash-check or publication changes.","https:\u002F\u002Fgithub.com\u002Faharada54914\u002Fsdd-forge\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fproject-skills\u002Fformal-review-reservation\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},"01M75FMW90YZDCB7QNJ8K5KGKG","aws-cdk","Authors, deploys, and troubleshoots AWS infrastructure using CDK with TypeScript or Python. Covers best practices, stack architecture, and construct patterns. Applies when writing CDK constructs, bootstrapping environments, running cdk deploy\u002Fsynth\u002Fdiff, fixing CDK or CloudFormation errors, planning stack structure, importing existing resources, resolving drift, or refactoring stacks without resource replacement.","https:\u002F\u002Fgithub.com\u002Faharada54914\u002Fsdd-forge\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fcloud-orchestration\u002Faws-bundle\u002Fupstream\u002Fplugins\u002Faws-core\u002Fskills\u002Faws-cdk\u002FSKILL.md",[],[],{"skillNo":67,"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":68,"categories":69,"keywords":70,"publishedAt":18},"01M75FMSTFNT7EQSZY81T4WRHN","https:\u002F\u002Fgithub.com\u002Faharada54914\u002Fsdd-forge\u002Fblob\u002Fmain\u002Fspecs\u002Fsdd-domain-multitarget\u002Fverification\u002FT-003\u002Fattempt10-20261016\u002Fbaseline\u002Fplugins\u002Fsdd-quality-loop\u002Fskills\u002Fquality-gate\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":18},"01M75FMPM8FDE4NQ6FFY7KB83Y","ship","Implement approved SDD tasks through the quality gate to Done — the second of the two-command workflow. Run after \u002Fsdd-bootstrap:bootstrap and human task approval.","https:\u002F\u002Fgithub.com\u002Faharada54914\u002Fsdd-forge\u002Fblob\u002Fmain\u002Fspecs\u002Fquality-loop-fixes\u002Fhuman-copy\u002Fplugins\u002Fsdd-ship\u002Fskills\u002Fship\u002FSKILL.md",[],[],{"skillNo":79,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":18},"01M75FMK3G0EPXW77XK8ED3F2E","https:\u002F\u002Fgithub.com\u002Faharada54914\u002Fsdd-forge\u002Fblob\u002Fmain\u002Fspecs\u002Fmcp-readonly-preflight\u002Fhuman-copy\u002Fplugins\u002Fsdd-ship\u002Fskills\u002Fship\u002FSKILL.md",[],[]]