# Spec Audit
<!--
ref: @protocol/spec-audit
tags: [audit, spec, planning, next-action, looping, prep, select, recommend]
version: 3
updated_at: 2026-10-27T15:42:59.443Z
-->

Read state, surface drift between shipped code and recorded spec, recommend the next chunk. **Stop before chunking.** Wait for the human's go.

The agent often opens a session with "check the spec and tell me what's next." That ritual is this protocol. Naming it gives it a trigger, a stop condition, and a clean composition point inside `@protocol/loop`.

---

## When to invoke

- Session start, before any work
- After a long break, returning to a project
- Between chunks in a loop (composed by `@protocol/loop`)
- Any time the next action is unclear

**Triggers:** `spec audit` · `audit the spec` · `what's next` · `where are we` · `check the spec` · `looping prep` · `where did we leave off`

---

## Read state (in this order)

1. **Git log** — last 10–20 commits. What actually shipped is the ground truth; everything else can drift.
2. **The master spec** (`workspace/spec.md`) — what the system is, its map, and §Roadmap. A pre-graduation project also has a chunk list there; a graduated one points at the tracker instead.
3. **The work** — pre-graduation: the active spec the master points at (phase tree + open items). Graduated: the tracker queries named in §Roadmap or the `## Tracker` section (open issues by milestone or approval label).
4. **Working tree** — `git status`. Mid-flight branches, uncommitted changes, untracked files that suggest in-progress work.
5. **Rulings and directives** — the project's rulings / operations files the spec map names (per `@protocol/memory-routing`), then any harness memory index. Cross-session constraints that override defaults.
6. **Hand-off note** — a `memento-*.md` (legacy `resume-*.md`) addressed to this run, per `@protocol/memento`.

Keep reads lean. Use the orchestrate posture — delegate broad exploration to a sub-agent if the project is large.

---

## Reconcile drift

The spec is a record, not a contract. Code ships; checkboxes lag. Audit's job is to name the gap.

| Drift type | What to look for | What to surface |
|---|---|---|
| **Unrecorded ship** | Commit message says feature X shipped; spec still shows `[ ]` | Flag as half-finished (recording-tier), priority 2 |
| **Stale "in progress"** | Spec marks item in-progress, no commits in N days/sessions | Ask: continue, revert, or close? |
| **Spec ahead of code** | Item marked `[x]` but matching code isn't present | Regression risk — verify before trusting |
| **Index out of date** | New doc in `workspace/` not listed in §"Spec map" | Add a one-line index entry (rule 1 of operating rules) |
| **Memory contradicts spec** | A `feedback_*.md` entry overrides a plan still in the active driver | Flag and propose updating the spec to match memory |

---

## Confidence map

Per project area, judge confidence and gap type. Same shape as `@protocol/loop`'s AUDIT step — this protocol is where that logic lives now.

| Conf | Meaning |
|---|---|
| **HIGH** | Verified recently, unchanged since |
| **MEDIUM** | Verified, but changed since |
| **LOW** | Never verified, or no recent state |
| **CRITICAL** | Was passing, now failing |

**Gap types:** `verification` · `staleness` · `regression` · `roadmap` · `tech-debt` · `polish` · `recording` (new — for unticked-but-shipped chunks)

---

## SELECT — priority waterfall

Pick the highest applicable. Don't skip — if you reach for polish while a regression sits unfixed, you've audited badly.

1. **Regressions** — was working, now broken
2. **Half-finished / recording** — shipped without spec update, or in-progress and stalled
3. **Verification gaps** — never tested against acceptance criteria
4. **Stale verifications** — tested, but code has moved since
5. **Roadmap** — planned, not started
6. **Tech debt** — known shortcuts
7. **Polish** — cosmetic, DX

**Anti-rut:** if the same category fires 3+ consecutive audits, force a category switch on the next pick.

**Pillar weighting** (project-specific, optional): when the project defines quality pillars (e.g. agentsite's four pillars — Assessment / Execution / Conversion / Content), use them as the tiebreaker between equally-prioritized roadmap items. Pick the one that lifts the weakest pillar.

---

## Output shape

A spec-audit always emits the same four-part shape. Predictable output means the human can scan it in 10 seconds.

1. **Audit** — git/working tree summary (3–5 lines max)
2. **Confidence map** — table, one row per area
3. **SELECT rationale** — which priority tier fired and why
4. **Recommendation** — one chunk picked, plus one or two alternates with the trade-off named

End with an explicit decision prompt: `(a) recommended pick`, `(b) alternate`, `(c) something else — name it`, `(d) stop`.

---

## What spec-audit does NOT do

- Write code
- Tick spec checkboxes
- Start the chunk
- Commit anything
- Modify memory (except: if the audit *itself* surfaces a new cross-session directive, surface it for the human to confirm — don't save unilaterally)
- Pick for the human when the call is non-obvious (multiple equally-good chunks → present the trade-off, don't decide)

If the audit reveals work cheap enough to fold in (e.g. a 30-second checkbox flip), still surface it as the recommendation rather than just doing it — the human said "audit," not "audit-and-act."

---

## Composition

```
@protocol/spec-audit              ← invoked directly by user trigger
        │
        ▼
recommendation → user says "go" → @protocol/chunk
                                    OR
                                  @protocol/loop (audit → chunk → audit → chunk …)
```

`@protocol/loop`'s recursive-improvement mode formerly inlined the AUDIT + SELECT prose. That logic now lives here. Looping composes spec-audit at the start of each cycle: audit → present → on go → chunk → audit → …

When invoked standalone (not from looping), spec-audit's only output is the recommendation. The cycle doesn't auto-advance.

---

## Why the name

There are many kinds of audits — security audit, dependency audit, performance audit, accessibility audit. `audit` alone collides. `spec-audit` says exactly which axis: the project's spec tree and its alignment with shipped reality. The trigger phrases ("what's next", "where are we") are the *natural* invocation; `spec-audit` is the canonical name for indexing and composition.

---

*Related: `@protocol/loop` · `@protocol/chunk` · `@protocol/spec` · `@protocol/orchestrate` · `@protocol/context-quality`*

*Search: `/search.md?q=<query>` · Fetch: `/@{repo}/{slug}.md`*

---

*Related: `@protocol/groom-protocols` · `@content/youtube/yifan-bth/claude-code-5-ways-it-beats-ai-code-editors` · `@content/youtube/cole-medin/11-more-tiny-coding-agent-fixes-with-a-stupid-amount-of-payoff-learn-these-now` · `@content/youtube/tiago-forte/what-claude-cowork-actually-does-and-why-its-different` · `@content/youtube/cole-medin/your-ai-second-brain-is-slowly-rotting-here-s-how-to-fix-it`*

---

*You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).*

*Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*