Case study

The harness that built this site

This site is built by Claude Code agents inside a harness: a to-do list, specs with acceptance criteria, three agents with fixed roles, guard hooks and a local gate that runs before every push.

Role
I designed the harness and own the specs, the decisions (ADRs), the review of every diff and every push. Agents write the plans, the code and the tests.
Stack
Claude Code · Claude Opus · Claude Sonnet · Astro · React · TypeScript · Docker · Playwright · POSIX sh
Published

Context

A personal portfolio: Astro with React islands, TypeScript, plain CSS, Playwright, all run inside a Docker dev container. One person, no hosted CI. In its first five weeks the repository reached about 100 commits; 96 of the first 102 carry a Claude co-author trailer.

Problem

The failure that matters most is a false "done": an agent reports a task finished when the tests or the acceptance criteria were never actually checked. Around it sit the usual drifts: changing more than the task asked, getting past a failing check, installing on the host. The site also had to be a case study in itself, so the process had to be written down and checkable, not kept in my head.

Why AI

Three reasons. The site is proof of the skill it sells: the harness is the work, not a side note. Speed: one person with limited time, so agents do the volume and I make the decisions. And dogfooding: a portfolio is a cheap place to find out where a harness breaks before relying on it elsewhere. Most of the work is well specified and checkable (components against a design spec, pages against acceptance criteria, tests in both visual modes at two widths), which is the shape of work an agent does well when something outside the agent checks the result.

Where the script won

Every rule a program can check is a script, not an instruction. Guard hooks refuse host installs, force-pushes, --no-verify, git config writes and Docker bypasses before the command runs. A pre-commit hook refuses env files, secret patterns and hex colours in components. The pre-push hook runs the full lint, unit, build and end-to-end gate in the container. A pnpm hook file refuses installs outside the container. The trace pages are generated by a build script from exported runs, never edited by hand.

Orchestration

CLAUDE.md holds the rules, roadmap.md is the to-do list, docs/plan.md holds each item's scope and acceptance criteria, and docs/adr/ holds the decisions. A session-start hook prints the next open items, so every session starts knowing what is next. Three agents have fixed roles, with the model matched to the work: the strongest model where judgment matters, a faster one for well-specified code. The planner (Claude Opus) writes only under docs/; the reviewer (Claude Opus) is read-only and tags findings blocker, major or minor; the implementer (Claude Sonnet) writes code and tests. One item at a time: read the spec, plan, implement, test only what changed, check each acceptance criterion with evidence, tick the item in roadmap.md in the same commit, commit to main. I review the diff and decide when to push; the push runs the full gate.

fig. — one roadmap item, start to push

Orchestration, top to bottom: a session-start hook shows the next open item in roadmap.md. The item is read with its spec and acceptance criteria in docs/plan.md. The planner agent, which writes only under docs/, plans; the implementer agent changes code and tests, with guard hooks checking every command and edit. Only what changed is tested, in the container. Each acceptance criterion is checked with evidence; the reviewer agent, which is read-only, can review the result. The item is ticked in roadmap.md and committed to main, with a pre-commit hook refusing env files, secrets and hex colours. The owner reviews the diff and decides when to push; the pre-push hook runs the full gate.

Guardrails

  • Guard hooks in .claude/hooks/ check every shell command and every file edit before it runs. They refuse host node and pnpm, force-push, --no-verify, changing core.hooksPath or the git config, Docker commands that bypass the dev scripts, and edits to .env files or inside .git.
  • The guards are tripwires for a well-meaning agent, not a sandbox: code written to a file and then run is invisible to them. They are conservative on purpose and sometimes refuse a harmless command, such as a grep pattern they read as a glob.
  • The reviewer agent cannot edit anything, and the planner can write only under docs/. The edit guard enforces both, on top of each agent's tool list.
  • The container mounts .git, .githooks, .claude and docker/ read-only, so a command run inside it cannot rewrite the hooks, the git config or the scripts the host runs.
  • Pinned versions: the dev image is pinned by digest and pnpm by version. A pnpm hook file refuses installs on the host, so node_modules only ever holds the container's binaries.
  • Settings deny rules block reading or editing .env files and editing the generated traces, and ask before any edit to .claude/, .githooks/ or docker/.
  • A new runtime dependency or a change to the rendering model needs an ADR first.
  • A pre-commit hook refuses env files, secret patterns and hex colours; a pre-push hook refuses the push if the gate fails. Commits go to main, never force-pushed.
  • The harness has its own tests (test/harness.sh), which feed the guards real hook input and check what they refuse and allow.

Evals

Method. Each roadmap item is done only when every acceptance criterion in docs/plan.md is checked with evidence: a test, a command's output or an observation, at 360 and 1440 px, in both modes, with reduced motion on and off. The pre-push gate runs lint, unit tests, the build and the end-to-end suite with accessibility checks. Criteria only the deploy run can prove (WebKit, Lighthouse) are reported as checked at deploy.

Results. The roadmap, the plan and the git history are the record: each ticked item has its commit, named by its item ID, and 31 items were ticked by late November 2026. Session transcripts were only kept from 23 November, so the numbers below cover two days. In that window there was one reviewer run, four gated pushes and one manual gate run, and none caught a false "done": test failures were all fixed before the work was reported as done. That is a small sample, not a track record. The five items with complete transcripts took a median of about 9 million tokens each (3.7 to 15.4 million), about 97 % of them cache reads. At API list prices that is about $3 per item ($2.50 to $6.40), an equivalent rather than a bill.

Outcome

The site is built this way end to end, one item at a time, by one person. The parts worth carrying into a team are all here: guard hooks that refuse risky commands before they run, specs whose acceptance criteria are checked with evidence before anything is called done, role agents with scoped tools, and a gate that runs before every push. A team would add hosted CI on top of the local gate.

What I'd change

Start smaller: the harness and the to-do list first, and add process only when it pays for itself. Keep session transcripts from the first item, so the evals and the trace replays have data from day one instead of being reconstructed later.

Notes

Every claim on this page points at a file in the repository: the rules in CLAUDE.md, the agents in .claude/agents/, the guard hooks in .claude/hooks/, the git hooks in .githooks/, the container in docker/, and the decisions in docs/adr/. The repository is private for now and will be made public later, so these claims can be checked against it.

← All case studies