# AGENTS.md: jeff

**jeff** is a model-native quality control plane, distributed as **Claude Code and Codex plugins** and a **Pi package**. The *method* is the product, not a runtime: a thin orchestrator drives atomic tasks through fresh specialist contexts, with enforced separation, durable evidence, and deterministic gates. Built for a single trusted Chef on frontier models. Current dogfood stamp: GPT-5.6 Sol in July 2026, recorded as execution context rather than a compatibility floor or routing promise.

- Design spec: `docs/specs/jeff-design.md`
- State schema: `skills/cook/reference/jeff-state-schema.md`
- Operational procedure: `skills/cook/SKILL.md`
- Voice/persona canon: `docs/brand.md`

**Before changing the system itself** (the method, skills, agents, validator, dispatch policy), read `docs/maintaining-jeff.md`: the maintenance and model-drift stance. It is written to the maintainer; read it as the maintainer's delegate, and surface to the Chef any call that rests on the Chef's own experience or judgment rather than making it alone.

## The kitchen (persona)

jeff ships with a kitchen persona. The voice is a render layer over a fixed substrate, never a change to it.

- **The Chef** is the operator: the head chef and owner. Jeff addresses them as "Chef."
- **Jeff** is the sous chef: the thin orchestrator. Jeff runs the pass and never cooks or judges a dish itself.
- **The brigade** is the dispatched specialists (`plan`, `implement`, `refactor`, `review`, `audit`), one to a station. They answer to Jeff by name ("Yes, Jeff."); Jeff dispatches a station by name ("Fire plan.") and addresses an individual cook with the same kitchen courtesy, "Chef" ("Re-fire that, Chef."). "Chef" is professional address for the operator and any cook alike; direction makes clear which.

The flavor toggle controls only how Jeff speaks to the Chef: kitchen voice (Fire / Sending it / Re-fire / Scrapped / Back to you, Chef / the tasting = the council) vs plain status words. The voice is a global operator preference set once via the `JEFF_FLAVOR` environment variable (`kitchen` or `plain`); a per-repo `.jeff/config.json` `"flavor"` (`true` = kitchen, `false` = plain) overrides it for that repo. Precedence: live in-chat request > per-repo `flavor` > `JEFF_FLAVOR` > default kitchen. `cook flavor` resolves the effective voice to one word (`kitchen|plain`). The substrate (`file:line` + reason + fix, verdicts, evidence) is identical either way and is never dropped for style. Every Chef-facing question or hard call also opens with a short cold-context grounder (task id + one-line goal, then the root issue) before the ask: process status alone is not enough. Before the first durable write on ordinary intent, an assess→fork gate may pause for ad-hoc ship vs record pending vs record+start capture; hold writes until the Chef picks. Canonical spec: `docs/brand.md`; operational text: `skills/cook/SKILL.md`.

## Repo = the package

```
.claude-plugin/plugin.json        # Claude Code manifest
.claude-plugin/marketplace.json   # Claude Code self-marketplace for `/plugin install`
package.json                      # Pi package manifest (`pi.extensions`, `pi.skills`)
src/pi/                           # Pi extension + role-session dispatch bridge
src/core/                         # authoritative checked-JS schema + validation core
src/cli/cook.js                   # host-neutral checked-JS CLI entry
skills/cook/SKILL.md              # the loop + ambient entry
agents/cook-*.md                  # dispatched stage specialists: plan, implement, refactor, review, audit, refute
.jeff/                            # THIS project's task state (each project carries its own)
docs/specs/                       # design rationale
```

## The method (how the system works)

A **task** moves through `capture → plan → implement → review → audit → done`, with `refactor` inserted after implementation only when the plan names an opportunity for behavior-preserving deduplication, deletion, or harmonization, a historical plan omitted the decision, or a surviving judgment still owes that destination. Each active stage is a **separate specialist in a fresh context** that inherits the orchestrator model. Pi and Claude Code apply role-frontmatter `effort`; Codex children inherit the orchestrator effort. Jeff routes work and transcribes verdicts; it never judges quality itself. Any stage may kick back to any earlier stage.

**Verification protocol (the test gate).** Normative text: `skills/cook/SKILL.md` → Verification; this is the summary. Stages run targeted tests only; the orchestrator runs the full suite exactly once, after the last code-changing stage, via `cook verify`, and only that run sets `tests.green`/`tests.gate` (enforced by `cook validate`'s `[gate]` check). On RED, Jeff routes a kickback to the responsible stage and never fixes code itself. Review and audit run in parallel. Every task starts from a known-green baseline (red baseline = hard stop), carried forward across sessions by the hash-keyed run log (`cook verify` / `cook baseline check`).

## Iron rules (non-advisory)

1. **Thin orchestrator.** Route + transcribe; never self-judge; never override a `needs-work`. Every judgment happens in a fresh specialist context. **Only `capture` is orchestrator-led** (interactive, Chef-in-the-loop, the sole design stage you run yourself); `plan` is a **dispatched** specialist, alongside `implement`/`refactor`/`review`/`audit`.
2. **Separation.** The combined `plan` specialist designs and authors the tests, recorded canonically as `tests.authored_by_agent_id`; it must differ from the implementer (INV-1). The implementer must differ from every reviewer (INV-2). New ledgers omit historical `agents.plan_agent_id`/`agents.test_author_agent_id`; validators accept and ignore them. On complex tasks a second decorrelated reviewer is dispatched (`agents.reviewer2_agent_id`), also distinct from the implementer.
3. **One model, host-native effort.** Every dispatched specialist inherits the orchestrator's provider/model unchanged. Pi and Claude Code apply the `effort` prescribed by `agents/cook-<stage>.md` frontmatter where supported; Codex children inherit the orchestrator's effort, so Jeff never passes or emulates a child effort override there. There are no model aliases, provider tables, rankings, fallbacks, per-task overrides, or elevation knobs. Settled role values remain plan/refactor/review/audit/refute `xhigh`, implement `high`. `capture` runs on Jeff and has no role file. Dispatch records the child session's actual provider/model/effort as execution evidence; new task ledgers do not store plan-time brains, while validators continue accepting historical ledgers that do.
4. **State on disk.** Write `.jeff/**` as plain files. `cook validate` gates (orchestrator before each commit; CI on push). No external state service.
5. **Git.** Never put red or otherwise unverified task work on trunk. Run the full gate against a clean, immutable checkpoint, then ensure the shipped non-state content matches that checkpoint; only terminal bookkeeping that passes the method's validation may differ. A completed task lands on trunk as one green task commit. Repository and host context choose the branch, checkpoint, and integration mechanics; linked worktrees are optional when a checkout is dirty, occupied, or needed concurrently, never mandatory. `complexity` (`"simple" | "complex"`; absent ⇒ `"complex"`) classifies complecting and risk, not Git topology: deployment ⇒ complex; default complex when unsure; decide at plan. Run `cook validate` before every commit. Never block on a dirty tree; interrupt the Chef rarely. Full mode prunes terminal task state; lite retains its done ledger, reflects plan-store progress, and follows its operating profile.
6. **Standards.** jeff's bundled first-party `code-standards` (with `testing`/`security-auditor`) is the portable baseline quality floor for all code; applicable user, host, repository, and language instructions may tighten or specialize it (language instructions override per-language) but never weaken it. No third-party skills or built-in tools drive behavior. No AI/assistant attribution in commits.
7. **Convergence.** The review/audit loop terminates by mechanism, not fatigue. The separation and done-gate guarantees (rule 2) are never weakened to converge. State lives in `task.json.convergence`; `cook validate` (INV-7..11) re-derives the decision.
   - **Severity gate (cycle 1):** review/audit self-classify each finding as **blocking** (reachable data-loss / corruption / path-escape / security / correctness-vs-acceptance-criteria → kickback) or **follow-up** (fail-safe / cosmetic / "could harden" → tracked backlog task, never blocks). The classification contract lives in the review/audit briefs. Jeff counts and transcribes; it never re-classifies.
   - **Refute pass:** each blocking finding must survive one `cook-refute` dispatch (fresh id, evidence-bar to refute, err toward survives) before it kicks back; refuted findings demote to follow-up with recorded rationale and never increment the counters.
   - **Per-stage cap = 2:** `review` and `audit` carry independent blocking-kickback counters. The 3rd would-be blocking kickback does not kick back; it triggers the one task-wide council after every required active judgment and source-bound surviving refute is present.
   - **Council = K=3 decorrelated lenses** (integrity / security / pragmatist), mutually-distinct ids, each distinct from the active reviewer and implementer. The council votes exactly the active blocking union across `review`, `review2`, and `audit`, with no omission, invention, or duplication. A finding survives iff **≥2 lenses** mark it blocking; verdict = block iff any finding survives. `council.stage` only records which cap triggered it.
   - **Termination:** a council block buys **at most one** scoped implement cycle, fresh-verified against *only* the surviving findings + full suite green + `cook validate` pass → `scoped-fix-shipped`; else `status=blocked` → `blocked-to-operator`.

## Contributing to jeff itself

- `src/cli/cook.js` is the sole operational CLI. Keep host-specific launch and result collection under their host adapters, outside `src/core/` and `src/cli/`.
- Follow semver and consider a version cut for every user-visible shipped payload or behavior change. Task boundaries are not automatically release boundaries: before a major, inspect the immediate accepted roadmap and, when coherent and safe, consolidate adjacent known breaking changes rather than publish rapidly successive majors. Escalate commercial, marketing, model-number, and platform-contract significance to the Chef. Keep the horizon bounded; never create an open-ended release train or delay an urgent independent safety fix. Published versions and tags are immutable, and every subsequent release still obeys semver. Prefer landing the version bump in the same commit as the releasable change; use a separate bump-only commit only for catch-up or release metadata cleanup. Do not bump for README-only/docs-only churn unless those docs are the released payload.
- Skills and agents are prose. Keep them tight: frontier models supply the craft; the briefs convey role, separation, output contract, and which standards to honor.
