Skip to content
Back to skills

Scrutinize

ASecurity

Principal-engineer review gate. Runs a Validate-Identify-Improve-Adjust (VIIA) pass over a target - a plan file awaiting approval, just-executed work, a specific file or directory, or the entire workspace - then runs an adversarial refutation layer (Phase 2.5) with cross-family judge rotation (Claude, Kimi k3, ChatGPT) and optional two-agent debate on BLOCKER + HIGH findings before presenting findings with concrete proposed fixes for batched approval. Blocks forward progress until approved. T...

  • 2 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added November 17, 2026
ai-agentspythongobashcode-reviewgitsecurity

Security analysis

A100/100

Pro scans all 20 files and shows the line behind each finding

Scanned November 17, 2026

npx -y skills add HEADING-OS-Official/heading-os --skill scrutinize --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Scrutinize?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Scrutinize
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/heading-os-official-scrutinize/badge)](https://www.skillsdirectory.com/skills/heading-os-official-scrutinize)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: scrutinize
disable-model-invocation: true
description: >
  Principal-engineer review gate. Runs a Validate-Identify-Improve-Adjust
  (VIIA) pass over a target - a plan file awaiting approval, just-executed work, a specific
  file or directory, or the entire workspace - then runs an adversarial refutation
  layer (Phase 2.5) with cross-family judge rotation (Claude, Kimi k3, ChatGPT) and
  optional two-agent debate on BLOCKER + HIGH findings before presenting findings
  with concrete proposed fixes for batched approval. Blocks forward progress until
  approved.
  Triggers on "scrutinize", "stress-test this", "principal review", "validate and
  improve", "review the plan before I approve", "audit what you just did".
  Do NOT trigger for a single artifact check alone (run scripts/artifact-evaluator.py)
  or strategic reasoning (use /deep-think).
argument-hint: "[execution | file:<path> | dir:<path> | workspace | trajectory:<run_id>] [--relentless] [--no-refute]"
allowed-tools: "Read, Glob, Grep, Bash(.venv/bin/python:*), Bash(git:*), Edit, Write, Agent"
metadata:
  author: Misha Hanin
  email: misha.hanin@headingos.com
  version: "2.5"
x-heading-capability:
  what: >
    Maximum-effort review gate over a plan file, executed work, a file or dir, the workspace, or a past /implement trajectory. Produces evidence-backed findings with confidence scores and proposed fixes, after an adversarial layer drops false positives. Blocks progress until approved.
  how: >
    Explicit-invocation only (disable-model-invocation). Run /scrutinize [execution | file:<path> | dir:<path> | workspace | trajectory:<run_id>] [--relentless] [--no-refute]. Reports save under scrutiny-sheets.
  when: >
    Use to stress-test a plan file before approval or audit changes after /implement. For a deterministic check of one artifact run scripts/artifact-evaluator.py; for decision reasoning use /deep-think.
x-heading-routing:
  category: Operations
  label: /scrutinize [target] [--relentless] [--no-refute]
  triggers:
    - NEVER auto-trigger. Explicit `/scrutinize [target] ...` only.
  exclusions:
    - Artifact check only -> scripts/artifact-evaluator.py
    - reasoning on a decision -> /deep-think
  router: manual
---
# Scrutinize

Manually-invoked quality gate. It runs a maximum-effort VIIA pass (Validate - Identify - Improve - Adjust) over a target. An adversarial layer then filters the false positives. Each finding carries a concrete fix and a confidence score, and the gate blocks progress until the user approves the batch.

Principal-engineer posture: find what is wrong, not what works. Every finding needs evidence. Every BLOCKER and HIGH survives a debate first. No shortcut exits. Version history: `version-history.md` in the data repository, under the registry name `spec-docs` at subpath `skills/scrutinize__references/`.

---

## Variables

One optional `target` plus the flags in `references/flags.md`, which Phase 0
step 1 already loads. That catalog is the source of truth. The one-line copies
in `argument-hint`, `x-heading-capability.how` and `x-heading-routing.label`
carry the same flags. Since the 2026-09-21 test-suite split nothing fails when a
copy drifts from the catalog. Nothing fails on a flag no code reads either.
Check all three by hand whenever the catalog changes.

---

## When to Engage

Manual invocation only.

**Use** it on a high-stakes plan file before approving it, or after `/implement` to audit the changes against that plan. Use it on a file or a dir when something feels off, and periodically on the workspace to catch drift.

**Do NOT use** it for a single artifact check (`scripts/artifact-evaluator.py`), decision reasoning (`/deep-think`), or content-quality review of a post or an email.

---

## Phase 0 - Context Loading

1. **Load every reference file** under `.claude/skills/scrutinize/references/`. The directive is the directory, not a list: each file states what consumes it.

2. **Load applicable rules:** `.claude/rules/{development-standards,hidden-chars,security,classification,voice}.md`.

3. **Resolve target** per `references/target-detection.md`. Parse an explicit argument from the invocation when one is present. Otherwise apply the priority order execution (git) > menu. Print a confirmation line for priorities 2 and 3 and wait for the user. Use the new target when they redirect you. A plan is reviewed as `file:<path>`. When the user asks to review a plan without a file, ask for its path. A typed `/scrutinize plan` prints exactly `The plan target is retired. Run /scrutinize file:<path of the plan>.` and stops.

4. **Resolve scope** per target:
   - Execution: git status + session commits (see references/target-detection.md for the full resolver).
   - File: read the file. It is a **plan file** when its path resolves under registry name `plans` (`.venv/bin/python scripts/data-path.py path plans`) or its first line starts with `# Plan:`.
   - Dir: glob the dir with standard exclusions.
   - Workspace: no scope loading here - Phase 2 dispatches specialists.

5. **Mint the run id and the scratch directory.** Derive the slug per `references/target-detection.md` § Slug and run id. The run id is `<YYYY-MM-DD>_<HHMMSS>_<slug>`. The scratch directory is `<.venv/bin/python scripts/data-path.py scratch>/scrutinize/<run_id>/`. Every later temporary file goes there.

6. **Open the run record:** `.venv/bin/python scripts/scrutinize-dispatch.py --pass-start --run-id <id> --target <t>`. A pass with no `pass_start` row fails `--validate`.

7. **Tracing needs no step.** Every `scripts/scrutinize-dispatch.py` subcommand runs in its own Langfuse span (`scrutinize-judge`, `-role-scan`, `-currency`, `-reproduce`, `-promote`). Spans flow only when `SENSITIVE_MODE` is explicitly cleared and `LANGFUSE_ENABLED` is not false; tags and the report footer per `references/observability.md`.

8. **Optional - prime the Identify pass with named methods.** On a hard target, pull 2 to 5 critique methods from `reference/elicitation-methods.md`. Examples: Pre-mortem Analysis, Inversion Analysis, Assumption Audit. Run `.venv/bin/python scripts/elicit.py list --category risk|core`, then `show "<Method>"`. Use them to structure the VIIA Identify stage. This composes with Phase 2.5 and never replaces it. Skip it when the viia-framework subchecks already cover the target.

---

## Phase 1 - VIIA Pass (non-workspace targets)

For targets `execution`, `file`, `dir`:

Apply the four phases from `references/viia-framework.md`:

**For target type `trajectory:<run_id>`** — dispatch the trajectory lens in `references/trajectory-evaluation.md` instead of the file/dir VIIA lens. Universal subchecks 1 to 9 are re-interpreted for the sequential-decision shape. Subchecks 10 to 14 default to `N/A (out of scope)`, unless the `step_end` events list content, comms, or doctype files. On disagreement, the deterministic tool-call records beat the rationale prose.

1. **Validate** - run all 14 subchecks (9 universal + 5 workspace-specific compliance gates per the target-to-subcheck map); no shortcut exits.
2. **Identify** - adversarial pass; each finding gets ID, Severity, **Confidence (0-100)**, Location, Statement, Evidence.
3. **Improve** - concrete proposed fix for every `BLOCKER`/`HIGH`/`MEDIUM`, optional for `LOW`/`NIT` if cheap.
4. (Adjust happens in Phase 3, after user approval.)

For any `SKILL.md`, `scripts/*.py`, rule, or reference file in scope: call `.venv/bin/python scripts/artifact-evaluator.py --path <file> --json` first to pick up deterministic findings, then add qualitative VIIA layer on top.

**Code targets - external code voice (always on):** dispatch the external code voice in parallel with Identify. It fires on a code `file:` or `dir:`, and on an `execution` whose diff touches code. Its candidates merge into the Identify set, de-duped, then face Phase 2.5 like any other. Skip silently for a plan file, `workspace` and `trajectory`, and when the proxy is unavailable (note it, never fail the pass). Firing rules, dispatch, merge and logging: `references/code-review-voice.md`.

**Plan files - goldfish read (auto):** dispatch the `goldfish` agent in mode `plan` on the plan file, per `.claude/skills/goldfish/SKILL.md` Phases 0-1. Its findings join Identify as lens `goldfish` and face Phase 2.5 like any other.

**Role lenses (auto, by path trigger):** `.venv/bin/python scripts/scrutinize-dispatch.py --role-scan --run-id <id> --target <t> --paths <scope>` fires the ops, scheduler and boundary checklists whose globs match; each writes a `role` row. A lens finding citing neither its commands nor its artifacts is not a lens finding. Full taxonomies: `references/role-lenses.md`.

**Currency (code scopes):** `.venv/bin/python scripts/scrutinize-dispatch.py --currency --run-id <id> --target <t> --paths <scope>` checks each third-party import's pinned version against the latest known, writing `ok`/`mismatch`/`inconclusive`. A mismatch whose behaviour changed is a BLOCKER. It never fails the pass.

---

## Phase 2 - Parallel Dispatch (workspace target only)

For `target = workspace`: dispatch the 5 area specialists in one message per `references/workspace-areas.md`, and announce it. When a result has not arrived, say which areas are outstanding. Continue the phase when each result arrives. Never write the final report while a dispatched agent is outstanding. A failed area is flagged partial, not fatal; with no Agent tool, run them sequentially and say so in the header. Then synthesise across areas and consolidate for Phase 2.5. Brief, areas, degradation rules and how the role lenses compose with them: `references/workspace-areas.md`.

---

## Phase 2.5 - Adversarial Refutation Layer

Inserted in v2.0. Full protocol in `references/refutation-protocol.md`. Bias mitigations in `references/bias-mitigation.md`.

**Skip entirely when:**

- `--no-refute` flag is set
- Phase 1/2 emitted zero BLOCKER/HIGH/MEDIUM findings
- `SENSITIVE_MODE` active AND cross-family rotation not available

Below-threshold findings are not refuted.

Announce the skip explicitly in the approval block header.

Run the two sub-passes in order:

- **2.5a** single-pass refutation, over BLOCKER + HIGH + MEDIUM.
- **2.5b** two-agent debate, over the BLOCKER + HIGH survivors only.

`references/refutation-protocol.md` carries the full briefs, the dispatch commands, the outcome rules, and the confidence-adjustment tables. The outcomes are REFUTED, REFUTE_PARTIAL, REFUTATION_FAILED for 2.5a, and CORRECT, CORRECT_DOWNGRADE, INCORRECT, AMBIGUOUS for 2.5b. Judge-family rotation lives in `bias-mitigation.md`.

**Every judge call goes through `scripts/scrutinize-dispatch.py --judge`**, never by hand. It assigns the family, and the Skeptic and the Meta-Judge never share one. It gates the external side on a DECLARED sensitive session, and it writes the verdict row.

A reproduction outranks a debate. `--reproduce` runs the command and records the exit code. Only the harness may write `REPRODUCED` or `FALSIFIED`.

**Logging (mandatory):** every Phase 2.5 pass appends a `## Judge layer` section to the saved Phase 5 report. It carries the family per call, the run's side assignment, and the Meta-Judge verdicts, for the human-agreement benchmark.

---

## Phase 3 - Approval Block

**If `--relentless` is active:** SKIP this phase. Every finding with a concrete proposed fix counts as approved. Mark the findings without one as `deferred` for the iteration report. Proceed directly to Phase 4.

Produce the approval block inline per the exact layout in `references/approval-block.md` (loaded in Phase 0). Do NOT apply any change before user approval.

- **Grade** is one of `PASS | PASS-WITH-NOTES | NEEDS-REWORK | BLOCKED`. The header MUST carry the `Refutation:` line: it is the one signal `--validate` reconciles the record against.
- **Only explicit commands act.** Silence, ambiguity, or "looks good" means WAIT.
- **Confidence threshold 75.** Below-threshold and AMBIGUOUS findings are listed in a `Not proposed` section (id, one line, score) right after the approval block, never inside it.
- Block layout, every per-command semantic, the no-findings and BLOCKED lines: `references/approval-block.md`.

---

## Phase 4 - Apply Approved Fixes (sequential)

For each approved finding, in order:

1. Apply the fix using `Edit` or `Write`.
2. Run three post-apply checks on the edited file. Hidden characters: `.venv/bin/python scripts/sanitize-text.py <file> --scan`. Python syntax, for `.py` only: `.venv/bin/python -m py_compile <file>`. Frontmatter YAML parse and required fields, for `SKILL.md` only, per `scripts/skill-metadata-check.py`.
3. If all checks pass, print `"[OK] <file> - applied and checks passed."`
4. If any check fails, halt further applies. Print the failure, ask the user whether to continue or rollback.

For each `flag-as-fp <ids>`: `.venv/bin/python scripts/scrutinize-flag-fp.py --scrutiny-id <stem> --ids <ids> --notes <note>`, which writes the flag into the run record beside the verdicts it disagrees with. Print `"Flagged N as FP."`

For `workspace` target: apply per area, with one-line confirmation per area completion.

**In `--relentless` mode:** use the adaptive termination and the verbal memory ledger from `references/relentless-adaptive.md`. Track `improvement_marginal` per iteration and detect fix-revert oscillation. Terminate on the first of: two-zero, marginal-twice, hard-cap (10), check-failure, oscillation.

---

## Phase 4.5 - Eval-Case Promotion (single-pass only, CEO-gated)

`references/eval-case-template.md` carries the eligibility rules, the draft-case generation, the auto-scaffold workflow, the per-target artefact shapes, and the approval-block format. Read it before you propose a promotion.

**Skip entirely when:** `--relentless` is active, the target is a plan file, or no applied finding qualifies.

**Flow:**

1. Filter the Phase 4 applied findings down to the qualifiers.
2. When the target lacks `evals/cases/`, offer the CEO-gated auto-scaffold: `scaffold and promote all|<ids>`, `scaffold only`, or `skip`.
3. Build a draft case per the target-type shape.
4. Present the approval block with every draft inline. **Wait for an explicit `promote all|<ids>`, `skip all`, or `revise <id>`.** A silent write is forbidden, and "looks good" means WAIT.
5. On promote, write the case, run `sanitize-text.py --scan`, then validate the shape. Halt on any failure.
6. Record the result for Phase 5.

With one or more candidates, announce before the block: `"Phase 4.5: <N> finding(s) eligible for eval-case promotion. CEO approval required per case."`

---

## Phase 5 - Report Persistence (tiered)

Every target saves to `<YYYY-MM-DD>-<slug>.md` under `scrutiny-sheets`, with the Phase 0 slug. A plan file saves like any `file:` report.

After saving, run `.venv/bin/python scripts/scrutinize-record.py --validate --run-id <id> --report <path>` and surface any defect verbatim. It sees omission, not intent: the Claude-side verdict is still session-supplied.

**Saved report sections** (single-pass 10-section layout) and the **`--relentless` consolidated-report shape** are defined in `references/report-format.md`.

---

## Voice

- Findings are statements, not suggestions: `"Line 47 uses os.path instead of pathlib"`, not `"Consider using pathlib"`.
- Use hyphens (`-`), never double dashes (`--`). Respect the company terminology per `.claude/rules/terminology.md`. Be direct - the burden of proof is on the target, not the reviewer.

---

## NEVER

- Never apply a fix without explicit user approval of that specific fix (or `approve all`)
- Never short-circuit Phase 1 subchecks after finding an early issue - every required subcheck runs (universal 1-9 always, workspace-specific 10-14 when target-applicable)
- Never emit a finding without evidence (quote or reference)
- Never emit a finding without a confidence score
- Never grade `PASS` if any `BLOCKER` or `HIGH` exists in the above-threshold set
- Never write private data into the engine clone.
- Never dispatch more than 5 parallel agents per concurrency cap
- Never auto-commit after apply - the user decides whether to commit
- Never invoke `/scrutinize` recursively
- Never exceed 10 iterations in `--relentless` mode (raised from 5 with adaptive termination)
- Never roll back applied fixes in `--relentless` mode on post-apply check failure - halt and surface
- Never skip post-apply checks in `--relentless` mode
- Never run `--relentless` against a plan file
- Never write the final report while a dispatched agent is outstanding
- Never auto-create the `evals/cases/` directory - offer auto-scaffold as a CEO-gated step (`scaffold and promote ...`, `scaffold only`, or `skip`)
- Never overwrite an existing eval-case JSON; always pick the next free `case-{N}-{slug}.json`
- Never create a file under `tests/` from Phase 4.5. A script finding promotes to a reproduction command and a proposed `Fix-Note:` line. Only a failure A or B finding becomes a test. That test is a new function in the existing file that holds that guarantee, and never carries a real assertion the CEO has not approved
- Never cross-feed one judge's refutation to another's debate (each agent reasons independently)
- Never skip the `Judge Layer` section in the saved report when Phase 2.5 ran (audit trail required for human-agreement benchmark)
- Never run every judge on Claude without naming the cause in `Judge Layer`
- Never dispatch an external judge when a session is DECLARED sensitive. Read it with `sensitivity_is_declared()` and never with `is_sensitive()`, whose unset default would disable every external side of the roster. Fall back to 2.5a on Claude, write the `degraded` row, and surface the cause in the header
- Never pin a Claude model version anywhere in this skill. That judge IS the running session, so it is always the latest Opus. No live test has caught a literal since the 2026-09-21 test-suite split, so the ban rests on the reviewer
- Never write a verdict, role or currency claim into a report without its row in the record
- Never write `REPRODUCED` or `FALSIFIED` from a narrated command - the harness observes both exit codes or neither verdict exists
- Never silently disable Langfuse observability - the saved report's Observability footer must always state whether it was on, off (by env var), or disabled (`SENSITIVE_MODE`)

Files in this skill

  • SKILL.md18 KB
  • evals/cases/case-1-viia-structure.json406 B
  • evals/cases/case-2-severity-tags.json367 B
  • evals/cases/case-3-batched-approval.json474 B
  • evals/cases/case-4-disprove-step.json695 B
  • evals/cases/case-5-confidence-score.json608 B
  • evals/cases/case-6-flag-as-fp.json835 B
  • evals/cases/case-7-trajectory-target.json749 B
  • evals/cases/case-8-deterministic-audit.json606 B
  • references/approval-block.md3.3 KB
  • references/bias-mitigation.md13.5 KB
  • references/code-review-voice.md4.5 KB
  • references/eval-case-template.md17 KB
  • references/flags.md1.6 KB
  • references/observability.md7.1 KB
  • references/refutation-protocol.md14.7 KB
  • references/relentless-adaptive.md6.2 KB
  • references/report-format.md4.2 KB
  • references/role-lenses.md7.6 KB
  • references/severity-grid.md7.1 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.