[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6JJP0FB2N2C6BYWEART18QH":3,"skill-same:01M6JJP0FB2N2C6BYWEART18QH":68},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":38,"linkOnly":39,"markdownContent":40,"markdownBody":41,"frontMatter":42,"refName":46,"commitSha":47,"skillDirectory":48,"forksCount":49,"repositoryHtmlUrl":50,"repositoryHomepageUrl":51,"ownerHtmlUrl":52,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":53,"install":54,"resources":67},"01M6JJP0FB2N2C6BYWEART18QH","cverify",null,"Verify implementation matches spec. Check rule coverage, undocumented dependencies, architecture compliance. Writes verification report and drift debt. Run after \u002Fctdd completes.","joshft\u002Fcorrectless","joshft","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F2847920?v=4","01M6JJGJ1WCYFH1BKGPZJ0Z4YD","josh","01M6JJGJ69XYFA6MTDXSH5BG42",66,"MIT","https:\u002F\u002Fgithub.com\u002Fjoshft\u002Fcorrectless\u002Fblob\u002Fmain\u002Fcorrectless\u002Fskills\u002Fcverify\u002FSKILL.md",[],[5,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"edit","ctdd","stryker","cargo","verify implementation","drift","ruff","diff","coverage","go","write","read","Bash","Meta","verification","git","run","architecture","workflow","2026-11-10 10:12:30",false,"---\nname: cverify\ndescription: Verify implementation matches spec. Check rule coverage, undocumented dependencies, architecture compliance. Writes verification report and drift debt. Run after \u002Fctdd completes.\nallowed-tools: Read, Grep, Glob, Bash(git*), Bash(*test*), Bash(*coverage*), Bash(diff*), Bash(*workflow-advance.sh*), Bash(jq*), Bash(*meta-record.sh*), Bash(*mutmut*), Bash(*stryker*), Bash(*cargo-mutants*), Bash(*go-mutesting*), Bash(*lint*), Bash(*clippy*), Bash(*ruff*), Bash(*eslint*), Edit, Write(.correctless\u002Fverification\u002F*), Write(.correctless\u002Fmeta\u002Fdrift-debt.json), Write(.correctless\u002Fartifacts\u002F*)\ncontext: fork\ninteraction_mode: hybrid\n---\n\n# \u002Fcverify — Post-Implementation Verification\n\n> **Shared constraints apply.** Before executing, read `_shared\u002Fconstraints.md` from the parent of this skill's base directory. All constraints there apply to this skill.\n\nYou are the verification agent. You did NOT participate in the implementation. Your job is to check that what was built matches what was specced. Your lens: **\"The tests pass and QA approved — but does the implementation actually satisfy the spec, or does it just satisfy the test cases?\"**\n\n## Intensity Configuration\n\n| | Standard | High | Critical |\n|---|---|---|---|\n| Rule coverage | Exists + weak detection | Full matrix + Serena trace | Full + mutation survivor analysis |\n| Dependencies | List + license | List + CVE + maintenance | Full audit |\n| Architecture | Basic compliance | Full + drift detection | Full + cross-spec + prohibitions |\n\n## Effective Intensity\n\nDetermine the effective intensity using the computation in the shared constraints (`_shared\u002Fconstraints.md`).\n\n## Progress Visibility (MANDATORY)\n\n### Intensity-Aware Verification Behavior\n\n- At standard intensity: rule coverage checks for existence and weak detection. Dependencies get list + license check. Architecture gets basic compliance review.\n- At high intensity: rule coverage uses full matrix + Serena trace for symbol-level tracing. Dependencies include CVE scanning and maintenance status. Architecture gets full review with drift detection.\n- At critical intensity: rule coverage includes full matrix plus mutation survivor analysis. Dependencies undergo full audit. Architecture review includes cross-spec consistency checks and prohibition enforcement.\n\nVerification takes 10-15 minutes with mutation testing running in the background. The user must see progress throughout.\n\n**Before starting**, create a task list:\n1. Read context (spec, implementation, tests, .correctless\u002FARCHITECTURE.md)\n2. Rule coverage matrix\n3. Mutation testing (background)\n4. Dependency check\n5. Basic smell check\n6. Drift detection\n7. Architecture adherence\n8. Write verification report\n\n**Between each check**, print a 1-line status: \"Rule coverage complete — {N}\u002F{M} rules covered, {K} weak. Starting mutation testing in background...\" When mutation testing completes in the background, announce immediately: \"Mutation testing done — {N} mutations, {M} killed, {K} survivors.\"\n\nMark each task complete as it finishes.\n\n## Before You Start\n\n**First-run check**: If `.correctless\u002Fconfig\u002Fworkflow-config.json` does not exist, tell the user: \"Correctless isn't set up yet. Run `\u002Fcsetup` first — it configures the workflow and populates your project docs.\" If the config exists but `.correctless\u002FARCHITECTURE.md` contains `{PROJECT_NAME}` or `{PLACEHOLDER}` markers, offer: \".correctless\u002FARCHITECTURE.md is still the template. I can populate it with real entries from your codebase right now (takes 30 seconds), or run `\u002Fcsetup` for the full experience.\" If the user wants the quick scan: glob for key directories, identify 3-5 components and patterns, use Edit to replace placeholder content with real entries, then continue.\n\n1. Read `.correctless\u002FAGENT_CONTEXT.md` for project context.\n2. Read the spec artifact (path from `workflow-advance.sh status` output, `Spec:` line).\n3. Read the implementation — changed files on the branch.\n4. Read the test files.\n5. Read `.correctless\u002FARCHITECTURE.md`.\n6. Read `.correctless\u002Fmeta\u002Fworkflow-effectiveness.json` — check which phases have historically missed bugs in this area.\n7. Read `.correctless\u002Fartifacts\u002Fqa-findings-*.json` — see what QA found and fixed during TDD.\n8. Determine the default branch (check `workflow-config.json` for `workflow.default_branch`, fall back to `main`). Run `git diff {default_branch}...HEAD --stat` to see what changed.\n9. **Record full-suite-green sentinel (CS-019 \u002F QA-002 \u002F QA2-001).** Run the FULL `tests\u002Ftest-*.sh` suite (`commands.test`). If it passes, write the **fixed-name** test-success sentinel `.correctless\u002Fartifacts\u002Ftest-success.sha` whose CONTENT is the current HEAD SHA, so the `done`-transition gate (`_done_phase_gate`) has a live sentinel to content-match against (absence is silent; a recorded SHA that no longer equals HEAD refuses the transition). The filename is fixed — do NOT key it on the HEAD SHA, or the mismatch branch becomes unreachable. `.correctless\u002Fartifacts\u002F` is gitignored, so this stays local:\n   ```bash\n   printf '%s\\n' \"$(git rev-parse HEAD)\" > \".correctless\u002Fartifacts\u002Ftest-success.sha\"\n   ```\n\n## What to Check\n\n### 1. Rule Coverage\n\nFor each R-xxx \u002F INV-xxx in the spec:\n- Is there a test that references this rule ID? (grep test files for `R-001`, etc.)\n- Does the test actually probe the rule, or is it a trivial assertion?\n- Would the test fail if the rule were violated?\n- For rules tagged `[integration]`: is the test actually an integration test using the real system path?\n\nResult: a table of R-xxx → test name → status (covered \u002F uncovered \u002F weak \u002F wrong-level).\n\n**Uncovered rules are BLOCKING findings.** Weak tests are findings. Integration rules tested only at unit level are findings.\n\n### 2. Dependency Check\n\nDiff the package manifest against the base branch:\nUse the project's default branch (from `workflow-config.json`, usually `main`):\n```bash\ngit diff {default_branch}...HEAD -- package.json go.mod Cargo.toml requirements.txt pyproject.toml\n```\n\nFor each new dependency: what is it, which file introduced it, was it in the spec?\n\n### Monorepo: Multi-Package Verification\nIf `workflow-config.json` has `is_monorepo: true` and the spec lists \"Packages Affected\", run tests in ALL listed packages — not just the one where most code changed. Use the per-package test commands from `workflow-config.json`. Report per-package: \"Package `api`: all tests pass. Package `web`: 2 tests fail.\"\n\n### 3. Architecture Adherence\n\n**Complementarity note:** The Architecture Compliance Agent (Phase 4) checks whether PR diffs violate entries — a violation lens. This section checks the inverse: whether entries need updating after implementation — a maintenance lens (\"do entries need updating?\"). \u002Fcdocs acts on these findings. \u002Fcupdate-arch does comprehensive validation of ALL entries.\n\nFor each affected `.correctless\u002FARCHITECTURE.md` entry, verify that the entry's structural claims still hold after this feature's changes. This is NOT the same as the Phase 4 Architecture Compliance Agent's check types — those remain that agent's domain and are not duplicated here.\n\n**Step-by-step:**\n\n1. **Extract all ABS-xxx, PAT-xxx, TB-xxx, ENV-xxx entries** from `.correctless\u002FARCHITECTURE.md`. If no entries exist, the architecture adherence check is dormant — no error, no warning. Skip to drift-debt surfacing.\n\n2. **Get changed files**: Run `git diff {default_branch}...HEAD --name-only` to get the list of files changed by the feature.\n\n3. **Identify affected entries** — entries whose `Enforced at`, `Test`, or consumer\u002Fpath references overlap with changed files. Only these entries are checked — do not validate every entry.\n\n4. **For each affected entry**, check:\n   - (a) **Enforced at paths exist on disk**: verify each file path in the `Enforced at` field exists. Strip parenthetical annotations (e.g., `scripts\u002Flib.sh (source)` → `scripts\u002Flib.sh`) and backtick formatting before checking. Skip entries that reference non-file entities (e.g., `setup`, function names without file paths). When an entry uses wildcards (e.g., `hooks\u002F*.sh`), verify at least one matching file exists via glob.\n   - (b) **Test paths exist and reference the entry ID**: verify each file path in the `Test` field exists, and grep it for the entry ID (e.g., `ABS-001`).\n   - (c) **Invariant text conflicts**: check whether the `Invariant` text conflicts with what the feature changed — does the implementation contradict or invalidate the stated invariant?\n\n5. **Report findings** with advisory severity levels (these are for \u002Fcdocs prioritization — they do not gate \u002Fcverify advancement, non-blocking advisory):\n   - path-missing = HIGH\n   - test-ID-missing = MEDIUM\n   - invariant-conflict = MEDIUM\n   - consumers-incomplete = LOW\n\n**Drift-debt surfacing:** Read `.correctless\u002Fmeta\u002Fdrift-debt.json` and surface open items whose `rule_id`, `description`, or `spec_id` references an architecture entry ID (ABS\u002FPAT\u002FTB\u002FENV) OR whose `description` references files changed by the feature. Include each relevant drift-debt item in the verification report. Dormant when `drift-debt.json` is absent, empty, or has no open items (PAT-019).\n\n### 3a. Compliance Checks (if configured)\n\nRead `workflow.compliance_checks` from `workflow-config.json`. For each check where `phase` is `\"verify\"`:\n1. Run the command\n2. Report results: pass\u002Ffail with output\n3. If `blocking: true` and the check fails: this is a BLOCKING finding — verification cannot pass\n\nCompliance checks are custom scripts written by the team. Correctless runs them at the right time and reports results. Example config:\n```json\n\"compliance_checks\": [{\"name\": \"audit-logging\", \"command\": \".\u002Fscripts\u002Fcheck-audit-logging.sh\", \"phase\": \"verify\", \"blocking\": true}]\n```\n\n### 4. Antipattern Scan and Basic Smell Check\n\nRun the deterministic antipattern-scan script to detect mechanical code smells:\n\n```bash\nbash .correctless\u002Fscripts\u002Fantipattern-scan.sh {default_branch}\n```\n\nwhere `{default_branch}` is read from `workflow.default_branch` in `workflow-config.json`, falling back to `main` if absent.\n\nValidate that stdout is non-empty valid JSON with a `.findings` key before treating it as findings. Empty or invalid output means the scanner itself failed and must be reported as an error, not \"zero findings.\" Also check if the JSON contains an `errors` array with entries — if so, report these scanner errors to the user rather than silently discarding them.\n\nIf the JSON output includes a `summaries` array (present when files exceed the 20-finding cap), include these in the report.\n\nInclude the results in the verification report under an \"## Antipattern Scan\" section with a table of findings. Also review the semantic ai-antipatterns checklist at `.correctless\u002Fchecklists\u002Fai-antipatterns.md` for patterns not detectable by grep.\n\nAdditionally check for:\n- TODO\u002FFIXME\u002FHACK comments, debug statements, commented-out code\n- Overly broad error catches, hardcoded values, unused imports\n\n### 5. Drift Detection\n\nCompare the spec's rules against the implementation:\n- Does the code actually use the abstractions the spec says it should?\n- Are there code paths not covered by any spec rule?\n- For rules with `implemented_in` fields: do those files\u002Ffunctions still exist?\n\n**If drift is found**, present each drift item to the human with options:\n\n```\n  1. Fix (recommended) — update code or spec to resolve drift\n  2. Log as debt — create DRIFT-NNN entry for future resolution\n  3. Accept as intentional — document why the drift is correct\n\n  Or type your own: ___\n```\n\nFor items where the user chooses \"Log as debt\": Read `.correctless\u002Fmeta\u002Fdrift-debt.json` first, then APPEND new entries to the existing `drift_debt` array. Use `Edit` to add entries — do NOT overwrite the file with `Write`. Use the next sequential DRIFT-NNN ID.\n\nDrift debt entry format:\n```json\n{\n  \"drift_debt\": [\n    {\n      \"id\": \"DRIFT-NNN\",\n      \"spec_id\": \"task-slug\",\n      \"rule_id\": \"R-xxx\",\n      \"description\": \"what drifted\",\n      \"detected\": \"ISO date\",\n      \"status\": \"open\"\n    }\n  ]\n}\n```\n\n### 6. Cross-Reference QA Findings\n\nRead `.correctless\u002Fartifacts\u002Fqa-findings-{task-slug}.json` (if it exists). For each class fix that QA identified:\n- Was the structural test actually added?\n- Does it cover the class of bug, not just the instance?\n\n### 7. Spec Update History\n\nIf the spec was updated during TDD, note what changed and why.\n\n## Output: Write Verification Report\n\n**Write the report to `.correctless\u002Fverification\u002F{task-slug}-verification.md`.** This is not optional — downstream skills depend on this file.\n\n```markdown\n# Verification: {Task Title}\n\n## Rule Coverage\n| Rule | Test | Status | Notes |\n|------|------|--------|-------|\n| R-001 | TestUserRegistration | covered | |\n| R-002 | TestEmailValidation | covered | |\n| R-003 | — | UNCOVERED | no test references R-003 |\n| R-004 [integration] | TestConfigWiring | covered | integration test present |\n\n## Dependencies\n- + zod@3.22.0 — input validation (src\u002Froutes\u002Fregister.ts)\n\n## Architecture Adherence\n\nPer-entry lines: `- {entry-ID}: {status} — {one-line description}` where status is `valid`, `stale`, or `path-missing`.\n\n- ABS-001: valid — shared script library paths verified\n- PAT-003: stale — Enforced at path `hooks\u002Fold-gate.sh` missing on disk\n- TB-002: valid — trust boundary invariant consistent with implementation\n\n### Drift Debt\n- DRIFT-001: R-003 drift — config parsing moved from `src\u002Fconfig.ts` to `src\u002Fconfig\u002Findex.ts`\n\n{N} entries checked, {M} stale, {K} drift-debt items\n\n## QA Class Fixes Verified\n- QA-001: structural config wiring test added ✓\n\n## Smells\n- src\u002Froutes\u002Fregister.ts:42 — TODO: add rate limiting\n\n## Drift\n- (none found, or DRIFT-NNN entries created)\n\n## Spec Updates\n- 1 update from tdd-impl: \"R-002 reworded\"\n\n## Overall: PASS\u002FFAIL with N findings\n```\n\n## After Verification\n\n### Commit Metadata (Git Trailers)\n\nIf `workflow.git_trailers` is `true` in `workflow-config.json`, stage the verification report and commit with trailers:\n```\nverify(task-slug): verification complete\n\nSpec: .correctless\u002Fspecs\u002F{task-slug}.md\nRules-covered: R-001, R-002, R-003, ...\nQA-rounds: {N}\nVerified-by: \u002Fcverify\n```\n\nThe `Verified-by: \u002Fcverify` trailer signals that this commit passed structured verification. Queryable: `git log --format='%(trailers:key=Verified-by)'`.\n\n### Git Notes (optional)\n\nIf `workflow.git_notes` is `true` in `workflow-config.json`, attach a verification summary as a git note:\n\n```bash\ngit notes add -f -m \"Verified by \u002Fcverify: {N}\u002F{M} rules covered, {K} drift items, {J} findings\" HEAD\n```\n\nReviewers can see this with `git notes show HEAD` or `git log --notes`.\n\n### Write Calibration Entry\n\nBefore advancing the workflow state, record a calibration entry into `.correctless\u002Fmeta\u002Fintensity-calibration.json`. This records outcome data that `\u002Fcspec` reads to improve future intensity recommendations.\n\n`intensity-calibration.json` is protected by the sensitive-file-guard (SFG) — a naive Edit\u002FWrite to it is blocked (AP-037). Do **not** write or edit the file directly. Instead, build a single **bare entry object** and hand it to the sanctioned sole-writer `.correctless\u002Fscripts\u002Fmeta-record.sh calibration-append` (ABS-047), which validates the entry **at the top level**, locks, then **wraps it and appends it to `calibration_entries[]`** for you. If the file does not exist the writer creates it with an empty `calibration_entries` array (and `mkdir -p` creates the `.correctless\u002Fmeta\u002F` directory) on first use, then appends.\n\n**Assemble THIS bare entry object and pipe it on stdin — do NOT wrap it in a `{ \"calibration_entries\": [ ... ] }` envelope.** The writer parses the object you send at the top level (`has(\"feature_slug\")`, etc.) and does the wrapping itself; a wrapped payload is rejected. The fields are:\n\n```json\n{\n  \"feature_slug\": \"task-slug from spec\u002Fworkflow state\",\n  \"recommended_intensity\": \"standard|high|critical — read from the spec's Recommended-intensity metadata field (the system's pre-override suggestion)\",\n  \"actual_intensity\": \"standard|high|critical — read from the spec's Intensity metadata field (the approved post-override level)\",\n  \"actual_qa_rounds\": \"number — read from the workflow state file (qa_rounds field)\",\n  \"actual_findings_count\": \"number — count of BLOCKING findings only from qa-findings-{slug}.json (not MEDIUM\u002FLOW)\",\n  \"actual_tokens\": \"integer — sum of total_tokens from the token log JSONL file (see below)\",\n  \"actual_cost_usd\": \"number or absent — read from cost artifact if it exists (see below)\",\n  \"actual_spec_updates\": \"number — read from the workflow state file (spec_updates field)\",\n  \"harness_version\": \"integer or absent — current HARNESS_VERSION constant from scripts\u002Fharness-fingerprint.sh (BND-005 of harness-fingerprint spec)\",\n  \"fix_rounds_triggered\": \"integer — derived: max(0, qa_rounds - 1) + mini_audit_fix_rounds (see below)\",\n  \"file_paths_touched\": [\"array of file paths from git diff against the default branch\"],\n  \"timestamp\": \"ISO 8601 string\"\n}\n```\n\n**`harness_version` field (BND-005 of harness-fingerprint spec)**: extract the current `HARNESS_VERSION` constant from `scripts\u002Fharness-fingerprint.sh` (or `.correctless\u002Fscripts\u002Fharness-fingerprint.sh` in installed projects). Read with: `grep -E '^HARNESS_VERSION=' scripts\u002Fharness-fingerprint.sh | head -1 | sed 's\u002FHARNESS_VERSION=\u002F\u002F'`. Include the integer in every new calibration entry so `\u002Fcmodelupgrade`'s three-tier bootstrap lookup (exact-match pool \u002F pre-fingerprint pool \u002F no-baseline) can distinguish entries by harness generation. If the script is missing, omit the field — do not error.\n\n**Field sources:**\n- `recommended_intensity`: Read from the spec's `Recommended-intensity` metadata field. This is the pre-override system suggestion written by `\u002Fcspec`.\n- `actual_intensity`: Read from the spec's `Intensity` metadata field. This is the approved post-override level.\n- `actual_qa_rounds`: Read from the workflow state file (`qa_rounds` field).\n- `actual_spec_updates`: Read from the workflow state file (`spec_updates` field).\n- `actual_findings_count`: Count only BLOCKING findings from `qa-findings-{slug}.json`. MEDIUM and LOW findings indicate thorough QA, not insufficient intensity.\n- `actual_tokens`: Sum of `total_tokens` from the token log JSONL file for this branch. See \"Token Summation for actual_tokens\" below.\n- `actual_cost_usd`: Read `total_cost_usd` from the cost artifact at `.correctless\u002Fartifacts\u002Fcost-{branch-slug}.json` if it exists. If the cost artifact does not exist (e.g., \u002Fcdocs hasn't run yet), omit `actual_cost_usd` from the calibration entry entirely — do not set it to 0, just leave it absent. The cost artifact is the canonical source of USD cost data (ABS-026).\n- `fix_rounds_triggered`: Derived value: `max(0, qa_rounds - 1) + mini_audit_fix_rounds`. `qa_rounds` is read from the workflow state — QA round 1 is the initial QA, rounds 2+ are fix rounds (so `qa_rounds - 1` = fix rounds from QA). `mini_audit_fix_rounds` is the count of fix-loop re-entries during the mini-audit phase, derived from qa-findings JSON round entries with `MA-` prefix that triggered fix loops. Default to 0 when not determinable.\n- `file_paths_touched`: Collect from `git diff {default_branch}...HEAD --name-only`.\n- `timestamp`: Current ISO 8601 timestamp.\n\n**Sanctioned write invocation (ABS-047).** Assemble the bare entry as a compact JSON object and pipe it on **stdin** to the writer — never pass it as an argv token, and never interpolate it into a `bash -c` string (TB-001). Capture the writer's stdout and exit status **in the same shell** (the invocation and its `rc=$?` must stay in one block — Bash tool calls do not share shell state across separate blocks). On success the writer prints a one-line confirmation and exits 0. On failure it exits non-zero and prints its mechanical `meta-record: FAILED \u003Cfile>: \u003Creason>` token — echo that captured token **verbatim** so the actionable reason is surfaced rather than reconstructed or swallowed, then continue with the rest of verification (a calibration-write failure never blocks the primary verification output):\n\n```bash\nout=\"$(printf '%s' \"$ENTRY_JSON\" | bash .correctless\u002Fscripts\u002Fmeta-record.sh calibration-append)\"\nrc=$?\nif [ \"$rc\" -eq 127 ]; then\n  # writer never ran (script absent on an un-re-setup install)\n  echo \"meta-record: FAILED .correctless\u002Fmeta\u002Fintensity-calibration.json: writer script not found — run \u002Fcsetup to install meta-record.sh\"\nelif [ \"$rc\" -ne 0 ]; then\n  # relay the writer's verbatim 'meta-record: FAILED \u003Cfile>: \u003Creason>' token\n  printf '%s\\n' \"$out\"\nelse\n  printf '%s\\n' \"$out\"\nfi\n```\n\nDo **not** fall back to `Write`\u002F`Edit` on the file if the writer fails — SFG blocks that path and it would silently no-op (PRH-002). Report the failure and move on.\n\n#### Token Summation for actual_tokens\n\nThe `actual_tokens` field in the calibration entry is an integer representing total token usage for this feature. Read the branch name from the workflow state file's `.branch` field, then derive the branch_slug by passing that branch name to `branch_slug()` in scripts\u002Flib.sh. Use the resulting slug to locate the token log file at `.correctless\u002Fartifacts\u002Ftoken-log-{branch-slug}.jsonl`.\n\n**Compute the slug and sum tokens with these deterministic commands** — do NOT use LLM arithmetic or hand-construct the slug:\n\n```bash\n# Step 1: Read the branch name from the workflow state file\nFEATURE_BRANCH=\"$(jq -r '.branch \u002F\u002F empty' .correctless\u002Fartifacts\u002Fworkflow-state-*.json 2>\u002Fdev\u002Fnull | head -1)\"\n\n# Step 2: Derive the slug using branch_slug() with the branch name parameter\nsource scripts\u002Flib.sh\nSLUG=\"$(branch_slug \"$FEATURE_BRANCH\")\"\n\n# Step 3: Sum total_tokens from the token log\njq -R 'try (fromjson | .total_tokens \u002F\u002F 0) catch 0' \".correctless\u002Fartifacts\u002Ftoken-log-${SLUG}.jsonl\" | jq -s 'add \u002F\u002F 0'\n```\n\nThis reads each line as raw text (`-R`), attempts to parse it as JSON (`fromjson`), extracts `total_tokens` (defaulting to 0), and catches parse errors on malformed lines (outputting 0). The second jq sums all values.\n\n**Missing or empty token log:** If the token log file does not exist or is empty, set `actual_tokens` to 0.\n\nWrite `actual_tokens` as an integer in the calibration entry alongside the other fields.\n\nWrite this calibration entry before advancing the workflow state — calibration data must be persisted even if the advance step fails.\n\nAdvance the state machine:\n```bash\n.correctless\u002Fhooks\u002Fworkflow-advance.sh verified\n```\nThis checks that the verification report file exists. If it doesn't, the transition fails.\n\nAfter advancing, print the pipeline diagram:\n\nAt standard intensity:\n```\n  ✓ spec → ✓ review → ✓ tdd → ✓ verify → ▶ docs → merge\n```\n\nAt high+ intensity:\n```\n  ✓ spec → ✓ review → ✓ tdd → ✓ verify → ▶ arch → docs → audit → merge\n```\n\nNext step is mandatory:\n- If BLOCKING findings exist: they MUST be fixed first. Return to the TDD cycle.\n- After fixing and re-verifying: tell the human to run `\u002Fcdocs`. This is the final step before merge.\n- Do NOT say \"ready to merge\" until \u002Fcdocs has run and `workflow-advance.sh documented` has been called.\n\n## Claude Code Feature Integration\n\n### Task Lists\nSee \"Progress Visibility\" section above — task creation and narration are mandatory.\n\n### Context Enforcement\n**Context enforcement (mandatory):** Before starting mutation testing, check context usage. Verification reads many files and the orchestrator must stay coherent to write an accurate report. If above 70%: \"Context at {N}%. Run `\u002Fcompact` before I continue — remaining checks may produce incomplete results.\" If above 85%: \"Context is critically full ({N}%). I must stop here. Run `\u002Fcompact` and then re-run `\u002Fcverify` — verification will restart but reads from existing artifacts.\"\n\n### Token Tracking\n\nLog token usage following the shared constraints (`_shared\u002Fconstraints.md`). Skill-specific values:\n- `skill`: \"cverify\"\n- `phase`: \"verification\"\n- `agent_role`: \"verification-agent\"\n\n### Background Tasks\n- Run mutation testing in the background while doing rule coverage analysis, prohibition checks, and antipattern matching\n- Run coverage report in the background while doing drift detection\n- Run linter checks in the background while analyzing architecture compliance\n\n## Code Analysis (MCP Integration)\n\nIf `mcp.serena` is `true` in `workflow-config.json`, use Serena MCP for symbol-level code analysis during verification. Serena enables a traced coverage matrix — use `find_referencing_symbols` to trace rule to test to implementation to entry point, producing a Serena traced coverage matrix that is more precise than grep-based tracing. When Serena is available, augment the Rule Coverage table with a \"Trace\" column showing the symbol chain: `rule_id -> test_fn -> impl_fn -> entry_point`. If a link in the chain cannot be traced, mark it \"?\".\n\n- Use `find_symbol` instead of grepping for function\u002Ftype names\n- Use `find_referencing_symbols` to trace callers and dependencies\n- Use `get_symbols_overview` for structural overview of a module\n- Use `replace_symbol_body` for precise edits (not used in this skill — verification is read-only)\n- Use `search_for_pattern` for regex searches with symbol context\n\n**Fallback table** — if Serena is unavailable, fall back silently to text-based equivalents:\n\n| Serena Operation | Fallback |\n|-----------------|----------|\n| `find_symbol` | Grep for function\u002Ftype name |\n| `find_referencing_symbols` | Grep for symbol name across source files |\n| `get_symbols_overview` | Read directory + read index files |\n| `replace_symbol_body` | Edit tool |\n| `search_for_pattern` | Grep tool |\n\n## Autonomous Defaults\n\nWhen running in autonomous mode (`mode: autonomous` in prompt context), use these defaults instead of pausing for human input.\nWhen dispatched by `\u002Fcauto`, return autonomous decisions in the `AUTONOMOUS_DECISIONS_START`\u002F`AUTONOMOUS_DECISIONS_END` format provided in the task prompt.\n\n**Deferred escalation (R-011)**: This skill has `context: fork` and cannot receive human follow-up input. When an `escalate: always` decision point is reached in autonomous mode, the default is applied and the decision is returned with `escalation_deferred: true` and `original_escalation_reason` for human review at pipeline conclusion.\n\n- **AD-001**: Verification scope — verify all spec rules (default). Rationale: partial verification leaves gaps that downstream skills assume are covered.\n- **AD-002**: Coverage assessment — strict assessment against spec (default). Rationale: lenient assessment masks weak tests that pass despite rule violations.\n- **AD-003**: Rule bypass approval — `escalate: always`. Default if deferred: flag as uncovered, do not bypass. Rationale: bypassing verification rules weakens the safety net.\n\n## If Something Goes Wrong\n\n- **Skill interrupted**: Re-run the skill. It reads the current state and resumes where possible.\n- **Rate limit hit**: Wait 2-3 minutes and re-run. Workflow state persists between sessions.\n- **Wrong output**: This skill doesn't modify workflow state until the final advance step. Re-run from scratch safely.\n- **Stuck in a phase**: Run `\u002Fcstatus` to see where you are. Use `workflow-advance.sh override \"reason\"` if the gate is blocking legitimate work.\n\n## Constraints\n\n- **Write the verification report file.** `\u002Fcpostmortem` and `\u002Fcupdate-arch` depend on it.\n- **Write drift debt entries** when drift is found. `\u002Fcspec` reads these for future features.\n- **Do NOT skip the rule coverage check.** Every rule must be accounted for.\n- **Do NOT approve a feature with uncovered rules.** Uncovered rules are BLOCKING.\n- **Be specific about weak tests.** \"Weak\" means: the test would still pass if the rule were violated.\n","# \u002Fcverify — Post-Implementation Verification\n\n> **Shared constraints apply.** Before executing, read `_shared\u002Fconstraints.md` from the parent of this skill's base directory. All constraints there apply to this skill.\n\nYou are the verification agent. You did NOT participate in the implementation. Your job is to check that what was built matches what was specced. Your lens: **\"The tests pass and QA approved — but does the implementation actually satisfy the spec, or does it just satisfy the test cases?\"**\n\n## Intensity Configuration\n\n| | Standard | High | Critical |\n|---|---|---|---|\n| Rule coverage | Exists + weak detection | Full matrix + Serena trace | Full + mutation survivor analysis |\n| Dependencies | List + license | List + CVE + maintenance | Full audit |\n| Architecture | Basic compliance | Full + drift detection | Full + cross-spec + prohibitions |\n\n## Effective Intensity\n\nDetermine the effective intensity using the computation in the shared constraints (`_shared\u002Fconstraints.md`).\n\n## Progress Visibility (MANDATORY)\n\n### Intensity-Aware Verification Behavior\n\n- At standard intensity: rule coverage checks for existence and weak detection. Dependencies get list + license check. Architecture gets basic compliance review.\n- At high intensity: rule coverage uses full matrix + Serena trace for symbol-level tracing. Dependencies include CVE scanning and maintenance status. Architecture gets full review with drift detection.\n- At critical intensity: rule coverage includes full matrix plus mutation survivor analysis. Dependencies undergo full audit. Architecture review includes cross-spec consistency checks and prohibition enforcement.\n\nVerification takes 10-15 minutes with mutation testing running in the background. The user must see progress throughout.\n\n**Before starting**, create a task list:\n1. Read context (spec, implementation, tests, .correctless\u002FARCHITECTURE.md)\n2. Rule coverage matrix\n3. Mutation testing (background)\n4. Dependency check\n5. Basic smell check\n6. Drift detection\n7. Architecture adherence\n8. Write verification report\n\n**Between each check**, print a 1-line status: \"Rule coverage complete — {N}\u002F{M} rules covered, {K} weak. Starting mutation testing in background...\" When mutation testing completes in the background, announce immediately: \"Mutation testing done — {N} mutations, {M} killed, {K} survivors.\"\n\nMark each task complete as it finishes.\n\n## Before You Start\n\n**First-run check**: If `.correctless\u002Fconfig\u002Fworkflow-config.json` does not exist, tell the user: \"Correctless isn't set up yet. Run `\u002Fcsetup` first — it configures the workflow and populates your project docs.\" If the config exists but `.correctless\u002FARCHITECTURE.md` contains `{PROJECT_NAME}` or `{PLACEHOLDER}` markers, offer: \".correctless\u002FARCHITECTURE.md is still the template. I can populate it with real entries from your codebase right now (takes 30 seconds), or run `\u002Fcsetup` for the full experience.\" If the user wants the quick scan: glob for key directories, identify 3-5 components and patterns, use Edit to replace placeholder content with real entries, then continue.\n\n1. Read `.correctless\u002FAGENT_CONTEXT.md` for project context.\n2. Read the spec artifact (path from `workflow-advance.sh status` output, `Spec:` line).\n3. Read the implementation — changed files on the branch.\n4. Read the test files.\n5. Read `.correctless\u002FARCHITECTURE.md`.\n6. Read `.correctless\u002Fmeta\u002Fworkflow-effectiveness.json` — check which phases have historically missed bugs in this area.\n7. Read `.correctless\u002Fartifacts\u002Fqa-findings-*.json` — see what QA found and fixed during TDD.\n8. Determine the default branch (check `workflow-config.json` for `workflow.default_branch`, fall back to `main`). Run `git diff {default_branch}...HEAD --stat` to see what changed.\n9. **Record full-suite-green sentinel (CS-019 \u002F QA-002 \u002F QA2-001).** Run the FULL `tests\u002Ftest-*.sh` suite (`commands.test`). If it passes, write the **fixed-name** test-success sentinel `.correctless\u002Fartifacts\u002Ftest-success.sha` whose CONTENT is the current HEAD SHA, so the `done`-transition gate (`_done_phase_gate`) has a live sentinel to content-match against (absence is silent; a recorded SHA that no longer equals HEAD refuses the transition). The filename is fixed — do NOT key it on the HEAD SHA, or the mismatch branch becomes unreachable. `.correctless\u002Fartifacts\u002F` is gitignored, so this stays local:\n   ```bash\n   printf '%s\\n' \"$(git rev-parse HEAD)\" > \".correctless\u002Fartifacts\u002Ftest-success.sha\"\n   ```\n\n## What to Check\n\n### 1. Rule Coverage\n\nFor each R-xxx \u002F INV-xxx in the spec:\n- Is there a test that references this rule ID? (grep test files for `R-001`, etc.)\n- Does the test actually probe the rule, or is it a trivial assertion?\n- Would the test fail if the rule were violated?\n- For rules tagged `[integration]`: is the test actually an integration test using the real system path?\n\nResult: a table of R-xxx → test name → status (covered \u002F uncovered \u002F weak \u002F wrong-level).\n\n**Uncovered rules are BLOCKING findings.** Weak tests are findings. Integration rules tested only at unit level are findings.\n\n### 2. Dependency Check\n\nDiff the package manifest against the base branch:\nUse the project's default branch (from `workflow-config.json`, usually `main`):\n```bash\ngit diff {default_branch}...HEAD -- package.json go.mod Cargo.toml requirements.txt pyproject.toml\n```\n\nFor each new dependency: what is it, which file introduced it, was it in the spec?\n\n### Monorepo: Multi-Package Verification\nIf `workflow-config.json` has `is_monorepo: true` and the spec lists \"Packages Affected\", run tests in ALL listed packages — not just the one where most code changed. Use the per-package test commands from `workflow-config.json`. Report per-package: \"Package `api`: all tests pass. Package `web`: 2 tests fail.\"\n\n### 3. Architecture Adherence\n\n**Complementarity note:** The Architecture Compliance Agent (Phase 4) checks whether PR diffs violate entries — a violation lens. This section checks the inverse: whether entries need updating after implementation — a maintenance lens (\"do entries need updating?\"). \u002Fcdocs acts on these findings. \u002Fcupdate-arch does comprehensive validation of ALL entries.\n\nFor each affected `.correctless\u002FARCHITECTURE.md` entry, verify that the entry's structural claims still hold after this feature's changes. This is NOT the same as the Phase 4 Architecture Compliance Agent's check types — those remain that agent's domain and are not duplicated here.\n\n**Step-by-step:**\n\n1. **Extract all ABS-xxx, PAT-xxx, TB-xxx, ENV-xxx entries** from `.correctless\u002FARCHITECTURE.md`. If no entries exist, the architecture adherence check is dormant — no error, no warning. Skip to drift-debt surfacing.\n\n2. **Get changed files**: Run `git diff {default_branch}...HEAD --name-only` to get the list of files changed by the feature.\n\n3. **Identify affected entries** — entries whose `Enforced at`, `Test`, or consumer\u002Fpath references overlap with changed files. Only these entries are checked — do not validate every entry.\n\n4. **For each affected entry**, check:\n   - (a) **Enforced at paths exist on disk**: verify each file path in the `Enforced at` field exists. Strip parenthetical annotations (e.g., `scripts\u002Flib.sh (source)` → `scripts\u002Flib.sh`) and backtick formatting before checking. Skip entries that reference non-file entities (e.g., `setup`, function names without file paths). When an entry uses wildcards (e.g., `hooks\u002F*.sh`), verify at least one matching file exists via glob.\n   - (b) **Test paths exist and reference the entry ID**: verify each file path in the `Test` field exists, and grep it for the entry ID (e.g., `ABS-001`).\n   - (c) **Invariant text conflicts**: check whether the `Invariant` text conflicts with what the feature changed — does the implementation contradict or invalidate the stated invariant?\n\n5. **Report findings** with advisory severity levels (these are for \u002Fcdocs prioritization — they do not gate \u002Fcverify advancement, non-blocking advisory):\n   - path-missing = HIGH\n   - test-ID-missing = MEDIUM\n   - invariant-conflict = MEDIUM\n   - consumers-incomplete = LOW\n\n**Drift-debt surfacing:** Read `.correctless\u002Fmeta\u002Fdrift-debt.json` and surface open items whose `rule_id`, `description`, or `spec_id` references an architecture entry ID (ABS\u002FPAT\u002FTB\u002FENV) OR whose `description` references files changed by the feature. Include each relevant drift-debt item in the verification report. Dormant when `drift-debt.json` is absent, empty, or has no open items (PAT-019).\n\n### 3a. Compliance Checks (if configured)\n\nRead `workflow.compliance_checks` from `workflow-config.json`. For each check where `phase` is `\"verify\"`:\n1. Run the command\n2. Report results: pass\u002Ffail with output\n3. If `blocking: true` and the check fails: this is a BLOCKING finding — verification cannot pass\n\nCompliance checks are custom scripts written by the team. Correctless runs them at the right time and reports results. Example config:\n```json\n\"compliance_checks\": [{\"name\": \"audit-logging\", \"command\": \".\u002Fscripts\u002Fcheck-audit-logging.sh\", \"phase\": \"verify\", \"blocking\": true}]\n```\n\n### 4. Antipattern Scan and Basic Smell Check\n\nRun the deterministic antipattern-scan script to detect mechanical code smells:\n\n```bash\nbash .correctless\u002Fscripts\u002Fantipattern-scan.sh {default_branch}\n```\n\nwhere `{default_branch}` is read from `workflow.default_branch` in `workflow-config.json`, falling back to `main` if absent.\n\nValidate that stdout is non-empty valid JSON with a `.findings` key before treating it as findings. Empty or invalid output means the scanner itself failed and must be reported as an error, not \"zero findings.\" Also check if the JSON contains an `errors` array with entries — if so, report these scanner errors to the user rather than silently discarding them.\n\nIf the JSON output includes a `summaries` array (present when files exceed the 20-finding cap), include these in the report.\n\nInclude the results in the verification report under an \"## Antipattern Scan\" section with a table of findings. Also review the semantic ai-antipatterns checklist at `.correctless\u002Fchecklists\u002Fai-antipatterns.md` for patterns not detectable by grep.\n\nAdditionally check for:\n- TODO\u002FFIXME\u002FHACK comments, debug statements, commented-out code\n- Overly broad error catches, hardcoded values, unused imports\n\n### 5. Drift Detection\n\nCompare the spec's rules against the implementation:\n- Does the code actually use the abstractions the spec says it should?\n- Are there code paths not covered by any spec rule?\n- For rules with `implemented_in` fields: do those files\u002Ffunctions still exist?\n\n**If drift is found**, present each drift item to the human with options:\n\n```\n  1. Fix (recommended) — update code or spec to resolve drift\n  2. Log as debt — create DRIFT-NNN entry for future resolution\n  3. Accept as intentional — document why the drift is correct\n\n  Or type your own: ___\n```\n\nFor items where the user chooses \"Log as debt\": Read `.correctless\u002Fmeta\u002Fdrift-debt.json` first, then APPEND new entries to the existing `drift_debt` array. Use `Edit` to add entries — do NOT overwrite the file with `Write`. Use the next sequential DRIFT-NNN ID.\n\nDrift debt entry format:\n```json\n{\n  \"drift_debt\": [\n    {\n      \"id\": \"DRIFT-NNN\",\n      \"spec_id\": \"task-slug\",\n      \"rule_id\": \"R-xxx\",\n      \"description\": \"what drifted\",\n      \"detected\": \"ISO date\",\n      \"status\": \"open\"\n    }\n  ]\n}\n```\n\n### 6. Cross-Reference QA Findings\n\nRead `.correctless\u002Fartifacts\u002Fqa-findings-{task-slug}.json` (if it exists). For each class fix that QA identified:\n- Was the structural test actually added?\n- Does it cover the class of bug, not just the instance?\n\n### 7. Spec Update History\n\nIf the spec was updated during TDD, note what changed and why.\n\n## Output: Write Verification Report\n\n**Write the report to `.correctless\u002Fverification\u002F{task-slug}-verification.md`.** This is not optional — downstream skills depend on this file.\n\n```markdown\n# Verification: {Task Title}\n\n## Rule Coverage\n| Rule | Test | Status | Notes |\n|------|------|--------|-------|\n| R-001 | TestUserRegistration | covered | |\n| R-002 | TestEmailValidation | covered | |\n| R-003 | — | UNCOVERED | no test references R-003 |\n| R-004 [integration] | TestConfigWiring | covered | integration test present |\n\n## Dependencies\n- + zod@3.22.0 — input validation (src\u002Froutes\u002Fregister.ts)\n\n## Architecture Adherence\n\nPer-entry lines: `- {entry-ID}: {status} — {one-line description}` where status is `valid`, `stale`, or `path-missing`.\n\n- ABS-001: valid — shared script library paths verified\n- PAT-003: stale — Enforced at path `hooks\u002Fold-gate.sh` missing on disk\n- TB-002: valid — trust boundary invariant consistent with implementation\n\n### Drift Debt\n- DRIFT-001: R-003 drift — config parsing moved from `src\u002Fconfig.ts` to `src\u002Fconfig\u002Findex.ts`\n\n{N} entries checked, {M} stale, {K} drift-debt items\n\n## QA Class Fixes Verified\n- QA-001: structural config wiring test added ✓\n\n## Smells\n- src\u002Froutes\u002Fregister.ts:42 — TODO: add rate limiting\n\n## Drift\n- (none found, or DRIFT-NNN entries created)\n\n## Spec Updates\n- 1 update from tdd-impl: \"R-002 reworded\"\n\n## Overall: PASS\u002FFAIL with N findings\n```\n\n## After Verification\n\n### Commit Metadata (Git Trailers)\n\nIf `workflow.git_trailers` is `true` in `workflow-config.json`, stage the verification report and commit with trailers:\n```\nverify(task-slug): verification complete\n\nSpec: .correctless\u002Fspecs\u002F{task-slug}.md\nRules-covered: R-001, R-002, R-003, ...\nQA-rounds: {N}\nVerified-by: \u002Fcverify\n```\n\nThe `Verified-by: \u002Fcverify` trailer signals that this commit passed structured verification. Queryable: `git log --format='%(trailers:key=Verified-by)'`.\n\n### Git Notes (optional)\n\nIf `workflow.git_notes` is `true` in `workflow-config.json`, attach a verification summary as a git note:\n\n```bash\ngit notes add -f -m \"Verified by \u002Fcverify: {N}\u002F{M} rules covered, {K} drift items, {J} findings\" HEAD\n```\n\nReviewers can see this with `git notes show HEAD` or `git log --notes`.\n\n### Write Calibration Entry\n\nBefore advancing the workflow state, record a calibration entry into `.correctless\u002Fmeta\u002Fintensity-calibration.json`. This records outcome data that `\u002Fcspec` reads to improve future intensity recommendations.\n\n`intensity-calibration.json` is protected by the sensitive-file-guard (SFG) — a naive Edit\u002FWrite to it is blocked (AP-037). Do **not** write or edit the file directly. Instead, build a single **bare entry object** and hand it to the sanctioned sole-writer `.correctless\u002Fscripts\u002Fmeta-record.sh calibration-append` (ABS-047), which validates the entry **at the top level**, locks, then **wraps it and appends it to `calibration_entries[]`** for you. If the file does not exist the writer creates it with an empty `calibration_entries` array (and `mkdir -p` creates the `.correctless\u002Fmeta\u002F` directory) on first use, then appends.\n\n**Assemble THIS bare entry object and pipe it on stdin — do NOT wrap it in a `{ \"calibration_entries\": [ ... ] }` envelope.** The writer parses the object you send at the top level (`has(\"feature_slug\")`, etc.) and does the wrapping itself; a wrapped payload is rejected. The fields are:\n\n```json\n{\n  \"feature_slug\": \"task-slug from spec\u002Fworkflow state\",\n  \"recommended_intensity\": \"standard|high|critical — read from the spec's Recommended-intensity metadata field (the system's pre-override suggestion)\",\n  \"actual_intensity\": \"standard|high|critical — read from the spec's Intensity metadata field (the approved post-override level)\",\n  \"actual_qa_rounds\": \"number — read from the workflow state file (qa_rounds field)\",\n  \"actual_findings_count\": \"number — count of BLOCKING findings only from qa-findings-{slug}.json (not MEDIUM\u002FLOW)\",\n  \"actual_tokens\": \"integer — sum of total_tokens from the token log JSONL file (see below)\",\n  \"actual_cost_usd\": \"number or absent — read from cost artifact if it exists (see below)\",\n  \"actual_spec_updates\": \"number — read from the workflow state file (spec_updates field)\",\n  \"harness_version\": \"integer or absent — current HARNESS_VERSION constant from scripts\u002Fharness-fingerprint.sh (BND-005 of harness-fingerprint spec)\",\n  \"fix_rounds_triggered\": \"integer — derived: max(0, qa_rounds - 1) + mini_audit_fix_rounds (see below)\",\n  \"file_paths_touched\": [\"array of file paths from git diff against the default branch\"],\n  \"timestamp\": \"ISO 8601 string\"\n}\n```\n\n**`harness_version` field (BND-005 of harness-fingerprint spec)**: extract the current `HARNESS_VERSION` constant from `scripts\u002Fharness-fingerprint.sh` (or `.correctless\u002Fscripts\u002Fharness-fingerprint.sh` in installed projects). Read with: `grep -E '^HARNESS_VERSION=' scripts\u002Fharness-fingerprint.sh | head -1 | sed 's\u002FHARNESS_VERSION=\u002F\u002F'`. Include the integer in every new calibration entry so `\u002Fcmodelupgrade`'s three-tier bootstrap lookup (exact-match pool \u002F pre-fingerprint pool \u002F no-baseline) can distinguish entries by harness generation. If the script is missing, omit the field — do not error.\n\n**Field sources:**\n- `recommended_intensity`: Read from the spec's `Recommended-intensity` metadata field. This is the pre-override system suggestion written by `\u002Fcspec`.\n- `actual_intensity`: Read from the spec's `Intensity` metadata field. This is the approved post-override level.\n- `actual_qa_rounds`: Read from the workflow state file (`qa_rounds` field).\n- `actual_spec_updates`: Read from the workflow state file (`spec_updates` field).\n- `actual_findings_count`: Count only BLOCKING findings from `qa-findings-{slug}.json`. MEDIUM and LOW findings indicate thorough QA, not insufficient intensity.\n- `actual_tokens`: Sum of `total_tokens` from the token log JSONL file for this branch. See \"Token Summation for actual_tokens\" below.\n- `actual_cost_usd`: Read `total_cost_usd` from the cost artifact at `.correctless\u002Fartifacts\u002Fcost-{branch-slug}.json` if it exists. If the cost artifact does not exist (e.g., \u002Fcdocs hasn't run yet), omit `actual_cost_usd` from the calibration entry entirely — do not set it to 0, just leave it absent. The cost artifact is the canonical source of USD cost data (ABS-026).\n- `fix_rounds_triggered`: Derived value: `max(0, qa_rounds - 1) + mini_audit_fix_rounds`. `qa_rounds` is read from the workflow state — QA round 1 is the initial QA, rounds 2+ are fix rounds (so `qa_rounds - 1` = fix rounds from QA). `mini_audit_fix_rounds` is the count of fix-loop re-entries during the mini-audit phase, derived from qa-findings JSON round entries with `MA-` prefix that triggered fix loops. Default to 0 when not determinable.\n- `file_paths_touched`: Collect from `git diff {default_branch}...HEAD --name-only`.\n- `timestamp`: Current ISO 8601 timestamp.\n\n**Sanctioned write invocation (ABS-047).** Assemble the bare entry as a compact JSON object and pipe it on **stdin** to the writer — never pass it as an argv token, and never interpolate it into a `bash -c` string (TB-001). Capture the writer's stdout and exit status **in the same shell** (the invocation and its `rc=$?` must stay in one block — Bash tool calls do not share shell state across separate blocks). On success the writer prints a one-line confirmation and exits 0. On failure it exits non-zero and prints its mechanical `meta-record: FAILED \u003Cfile>: \u003Creason>` token — echo that captured token **verbatim** so the actionable reason is surfaced rather than reconstructed or swallowed, then continue with the rest of verification (a calibration-write failure never blocks the primary verification output):\n\n```bash\nout=\"$(printf '%s' \"$ENTRY_JSON\" | bash .correctless\u002Fscripts\u002Fmeta-record.sh calibration-append)\"\nrc=$?\nif [ \"$rc\" -eq 127 ]; then\n  # writer never ran (script absent on an un-re-setup install)\n  echo \"meta-record: FAILED .correctless\u002Fmeta\u002Fintensity-calibration.json: writer script not found — run \u002Fcsetup to install meta-record.sh\"\nelif [ \"$rc\" -ne 0 ]; then\n  # relay the writer's verbatim 'meta-record: FAILED \u003Cfile>: \u003Creason>' token\n  printf '%s\\n' \"$out\"\nelse\n  printf '%s\\n' \"$out\"\nfi\n```\n\nDo **not** fall back to `Write`\u002F`Edit` on the file if the writer fails — SFG blocks that path and it would silently no-op (PRH-002). Report the failure and move on.\n\n#### Token Summation for actual_tokens\n\nThe `actual_tokens` field in the calibration entry is an integer representing total token usage for this feature. Read the branch name from the workflow state file's `.branch` field, then derive the branch_slug by passing that branch name to `branch_slug()` in scripts\u002Flib.sh. Use the resulting slug to locate the token log file at `.correctless\u002Fartifacts\u002Ftoken-log-{branch-slug}.jsonl`.\n\n**Compute the slug and sum tokens with these deterministic commands** — do NOT use LLM arithmetic or hand-construct the slug:\n\n```bash\n# Step 1: Read the branch name from the workflow state file\nFEATURE_BRANCH=\"$(jq -r '.branch \u002F\u002F empty' .correctless\u002Fartifacts\u002Fworkflow-state-*.json 2>\u002Fdev\u002Fnull | head -1)\"\n\n# Step 2: Derive the slug using branch_slug() with the branch name parameter\nsource scripts\u002Flib.sh\nSLUG=\"$(branch_slug \"$FEATURE_BRANCH\")\"\n\n# Step 3: Sum total_tokens from the token log\njq -R 'try (fromjson | .total_tokens \u002F\u002F 0) catch 0' \".correctless\u002Fartifacts\u002Ftoken-log-${SLUG}.jsonl\" | jq -s 'add \u002F\u002F 0'\n```\n\nThis reads each line as raw text (`-R`), attempts to parse it as JSON (`fromjson`), extracts `total_tokens` (defaulting to 0), and catches parse errors on malformed lines (outputting 0). The second jq sums all values.\n\n**Missing or empty token log:** If the token log file does not exist or is empty, set `actual_tokens` to 0.\n\nWrite `actual_tokens` as an integer in the calibration entry alongside the other fields.\n\nWrite this calibration entry before advancing the workflow state — calibration data must be persisted even if the advance step fails.\n\nAdvance the state machine:\n```bash\n.correctless\u002Fhooks\u002Fworkflow-advance.sh verified\n```\nThis checks that the verification report file exists. If it doesn't, the transition fails.\n\nAfter advancing, print the pipeline diagram:\n\nAt standard intensity:\n```\n  ✓ spec → ✓ review → ✓ tdd → ✓ verify → ▶ docs → merge\n```\n\nAt high+ intensity:\n```\n  ✓ spec → ✓ review → ✓ tdd → ✓ verify → ▶ arch → docs → audit → merge\n```\n\nNext step is mandatory:\n- If BLOCKING findings exist: they MUST be fixed first. Return to the TDD cycle.\n- After fixing and re-verifying: tell the human to run `\u002Fcdocs`. This is the final step before merge.\n- Do NOT say \"ready to merge\" until \u002Fcdocs has run and `workflow-advance.sh documented` has been called.\n\n## Claude Code Feature Integration\n\n### Task Lists\nSee \"Progress Visibility\" section above — task creation and narration are mandatory.\n\n### Context Enforcement\n**Context enforcement (mandatory):** Before starting mutation testing, check context usage. Verification reads many files and the orchestrator must stay coherent to write an accurate report. If above 70%: \"Context at {N}%. Run `\u002Fcompact` before I continue — remaining checks may produce incomplete results.\" If above 85%: \"Context is critically full ({N}%). I must stop here. Run `\u002Fcompact` and then re-run `\u002Fcverify` — verification will restart but reads from existing artifacts.\"\n\n### Token Tracking\n\nLog token usage following the shared constraints (`_shared\u002Fconstraints.md`). Skill-specific values:\n- `skill`: \"cverify\"\n- `phase`: \"verification\"\n- `agent_role`: \"verification-agent\"\n\n### Background Tasks\n- Run mutation testing in the background while doing rule coverage analysis, prohibition checks, and antipattern matching\n- Run coverage report in the background while doing drift detection\n- Run linter checks in the background while analyzing architecture compliance\n\n## Code Analysis (MCP Integration)\n\nIf `mcp.serena` is `true` in `workflow-config.json`, use Serena MCP for symbol-level code analysis during verification. Serena enables a traced coverage matrix — use `find_referencing_symbols` to trace rule to test to implementation to entry point, producing a Serena traced coverage matrix that is more precise than grep-based tracing. When Serena is available, augment the Rule Coverage table with a \"Trace\" column showing the symbol chain: `rule_id -> test_fn -> impl_fn -> entry_point`. If a link in the chain cannot be traced, mark it \"?\".\n\n- Use `find_symbol` instead of grepping for function\u002Ftype names\n- Use `find_referencing_symbols` to trace callers and dependencies\n- Use `get_symbols_overview` for structural overview of a module\n- Use `replace_symbol_body` for precise edits (not used in this skill — verification is read-only)\n- Use `search_for_pattern` for regex searches with symbol context\n\n**Fallback table** — if Serena is unavailable, fall back silently to text-based equivalents:\n\n| Serena Operation | Fallback |\n|-----------------|----------|\n| `find_symbol` | Grep for function\u002Ftype name |\n| `find_referencing_symbols` | Grep for symbol name across source files |\n| `get_symbols_overview` | Read directory + read index files |\n| `replace_symbol_body` | Edit tool |\n| `search_for_pattern` | Grep tool |\n\n## Autonomous Defaults\n\nWhen running in autonomous mode (`mode: autonomous` in prompt context), use these defaults instead of pausing for human input.\nWhen dispatched by `\u002Fcauto`, return autonomous decisions in the `AUTONOMOUS_DECISIONS_START`\u002F`AUTONOMOUS_DECISIONS_END` format provided in the task prompt.\n\n**Deferred escalation (R-011)**: This skill has `context: fork` and cannot receive human follow-up input. When an `escalate: always` decision point is reached in autonomous mode, the default is applied and the decision is returned with `escalation_deferred: true` and `original_escalation_reason` for human review at pipeline conclusion.\n\n- **AD-001**: Verification scope — verify all spec rules (default). Rationale: partial verification leaves gaps that downstream skills assume are covered.\n- **AD-002**: Coverage assessment — strict assessment against spec (default). Rationale: lenient assessment masks weak tests that pass despite rule violations.\n- **AD-003**: Rule bypass approval — `escalate: always`. Default if deferred: flag as uncovered, do not bypass. Rationale: bypassing verification rules weakens the safety net.\n\n## If Something Goes Wrong\n\n- **Skill interrupted**: Re-run the skill. It reads the current state and resumes where possible.\n- **Rate limit hit**: Wait 2-3 minutes and re-run. Workflow state persists between sessions.\n- **Wrong output**: This skill doesn't modify workflow state until the final advance step. Re-run from scratch safely.\n- **Stuck in a phase**: Run `\u002Fcstatus` to see where you are. Use `workflow-advance.sh override \"reason\"` if the gate is blocking legitimate work.\n\n## Constraints\n\n- **Write the verification report file.** `\u002Fcpostmortem` and `\u002Fcupdate-arch` depend on it.\n- **Write drift debt entries** when drift is found. `\u002Fcspec` reads these for future features.\n- **Do NOT skip the rule coverage check.** Every rule must be accounted for.\n- **Do NOT approve a feature with uncovered rules.** Uncovered rules are BLOCKING.\n- **Be specific about weak tests.** \"Weak\" means: the test would still pass if the rule were violated.\n",{"name":5,"context":43,"description":7,"allowed-tools":44,"interaction_mode":45},"fork","Read, Grep, Glob, Bash(git*), Bash(*test*), Bash(*coverage*), Bash(diff*), Bash(*workflow-advance.sh*), Bash(jq*), Bash(*meta-record.sh*), Bash(*mutmut*), Bash(*stryker*), Bash(*cargo-mutants*), Bash(*go-mutesting*), Bash(*lint*), Bash(*clippy*), Bash(*ruff*), Bash(*eslint*), Edit, Write(.correctless\u002Fverification\u002F*), Write(.correctless\u002Fmeta\u002Fdrift-debt.json), Write(.correctless\u002Fartifacts\u002F*)","hybrid","main","74f9ef3f5acae9c857f6be6dd86cdc3b10830c90","correctless\u002Fskills\u002Fcverify",4,"https:\u002F\u002Fgithub.com\u002Fjoshft\u002Fcorrectless","https:\u002F\u002Fjoshft.github.io\u002Fcorrectless\u002F","https:\u002F\u002Fgithub.com\u002Fjoshft","2026-11-14 02:53:56",{"source":8,"skillName":5,"commands":55,"prompt":65,"zipAvailable":66},[56,59,62],{"tool":57,"command":58},"npx","npx skills add joshft\u002Fcorrectless --skill cverify",{"tool":60,"command":61},"bunx","bunx skills add joshft\u002Fcorrectless --skill cverify",{"tool":63,"command":64},"pnpm","pnpm dlx skills add joshft\u002Fcorrectless --skill cverify","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjoshft\u002Fcorrectless\u002Fblob\u002Fmain\u002Fcorrectless\u002Fskills\u002Fcverify\u002FSKILL.md",true,[],[69,88,93,111,128,141],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":38},"01M6JJW224Q40TCVMTKRZPDHDY","cwtf","Audit the workflow itself. Use when you suspect agents shortcut or after a bug escapes despite the workflow running. Checks phase execution, rule coverage, and agent thoroughness.","https:\u002F\u002Fgithub.com\u002Fjoshft\u002Fcorrectless\u002Fblob\u002Fmain\u002Fskills\u002Fcwtf\u002FSKILL.md",[],[71,37,34,76,77,78,31,79,80,81,30,29,19,27,82,83,84,85,86,87],"artifacts","audit","execution","grep","find","jq","autonomous","use","wtf","bug","you","shortcut",{"skillNo":89,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":38},"01M6JJVT9M4KGWQ99V0CSF6WZ5","https:\u002F\u002Fgithub.com\u002Fjoshft\u002Fcorrectless\u002Fblob\u002Fmain\u002Fskills\u002Fcverify\u002FSKILL.md",[],[5,28,37,36,35,34,33,32,31,30,29,19,27,26,25,24,23,22,21,20],{"skillNo":94,"name":95,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":97,"categories":98,"keywords":99,"publishedAt":38},"01M6JJVP2E6BHHKF3SCMDXG0S2","cupdate-arch","Update .correctless\u002FARCHITECTURE.md after features land. Use after \u002Fcdocs or when the codebase structure has changed.","https:\u002F\u002Fgithub.com\u002Fjoshft\u002Fcorrectless\u002Fblob\u002Fmain\u002Fskills\u002Fcupdate-arch\u002FSKILL.md",[],[100,101,102,36,103,34,104,31,105,79,30,29,19,83,106,107,108,109,110],"arch","cupdate arch","docs","update","land","Rules","structure","codebase","features","codebase structure","cdocs",{"skillNo":112,"name":113,"nameZh":6,"description":114,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":115,"categories":116,"keywords":117,"publishedAt":38},"01M6JJVJVZ72KVWN1K3RWQK0YJ","ctriage","Bulk triage deferred findings backlog. Presents findings one at a time with disposition options.","https:\u002F\u002Fgithub.com\u002Fjoshft\u002Fcorrectless\u002Fblob\u002Fmain\u002Fskills\u002Fctriage\u002FSKILL.md",[],[113,118,32,31,119,79,81,120,30,29,19,121,122,123,124,125,126,127],"triage","json","one at a time","interactive","options","backlog","time","bulk","with","at",{"skillNo":129,"name":20,"nameZh":6,"description":130,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":131,"categories":132,"keywords":133,"publishedAt":38},"01M6JJVCYCNYD4GHK33DZE9DXA","Enforced TDD workflow. Write failing tests from spec rules, then implement. Use after \u002Fcreview approves a spec.","https:\u002F\u002Fgithub.com\u002Fjoshft\u002Fcorrectless\u002Fblob\u002Fmain\u002Fskills\u002Fctdd\u002FSKILL.md",[],[20,134,135,136,37,76,137,31,105,79,30,29,19,83,138,139,140],"spec","implement","tdd","tdd workflow","task","tests","creview",{"skillNo":142,"name":143,"nameZh":6,"description":144,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":145,"categories":146,"keywords":147,"publishedAt":38},"01M6JJV7S3EQG3GHQ56DD8P1SA","csummary","Feature summary. Use after \u002Fcdocs to see what the workflow caught, or mid-feature to check progress.","https:\u002F\u002Fgithub.com\u002Fjoshft\u002Fcorrectless\u002Fblob\u002Fmain\u002Fskills\u002Fcsummary\u002FSKILL.md",[],[143,37,34,76,31,79,148,30,29,19,82,83,149,150,151,152,110],"check","what the","summary","feature","progress"]