A spec without a harness is a document nobody enforces A developer published a bash script, spec-gate.sh, that enforces spec-driven development for AI coding agents by failing CI when a pull request's diff touches files outside a spec's 'Allowed files' list or when an acceptance criterion (AC-1, AC-2, …) has no test mentioning it. The script, which runs on macOS's bash 3.2 and is wired into a GitHub Actions pull_request job, operationalizes the distinction between specs (what a change must do) and harness engineering (how any change is made trustworthy), drawing on Birgitta Böckeler's harness definition and OpenAI's five-month Codex experiment that produced roughly a million lines and 1,500 merged pull requests with no manually written code. The author notes the gate proves tests exist, not that they are good. Two terms keep getting mixed up in AI coding: spec-driven development and harness engineering. They answer different questions. A spec decides what one change must do before the agent starts. A harness is everything around the agent except the model: what it reads, what it may touch, which checks run on its output, and what happens when one fails. Teams that let agents write real code end up needing both, and each one fails in a predictable way without the other. Birgitta Böckeler's article on martinfowler.com defines a harness as "everything in an AI agent except the model itself". The term took off in February 2026, when OpenAI's Ryan Lopopolo described a five-month experiment in which a small team shipped an internal product with zero manually written lines: about a million lines and roughly 1,500 merged pull requests. The engineers' job, in the post's words, became "to design environments, specify intent, and build feedback loops that allow Codex agents to do reliable work." Two ideas from that post matter most here: | | Spec-driven development | Harness engineering | |---|---|---| | Question it answers | What must this change do? | How do we make any change trustworthy? | | Scope | One change or feature | The whole repository, for its whole life | | Main artifacts | spec.md , tasks.md , acceptance criteria | AGENTS.md , linters, structural tests, test harness, CI | | Changes when | Every new feature | The same failure happens twice | | Failure if missing | People argue about intended behaviour in code review | People agree on the behaviour but cannot prove it cheaply | Böckeler splits a harness into guides , which steer the agent before it acts, and sensors , which observe after it acts so it can correct itself. A functional spec is on her list as a guide. It is the only guide that changes with every feature, which makes it the most important one for behaviour. When you write a section of the spec, decide which harness control it feeds: | Spec section | Harness control | |---|---| | Context, goal, non-goals | Linked from AGENTS.md so the agent reads it first | | Allowed files | CI fails if the diff touches anything else | | Acceptance criteria AC-1…n | Each has a test that names it; CI fails if one is missing | | Edge cases | Fixtures and factory states that reproduce them | | API contract | Contract tests generated from the OpenAPI document | | Rollback | A feature flag exists and defaults off | The two rows that catch the most agent mistakes, allowed files and acceptance criteria, fit in one short script. It reads the spec, fails when the diff leaves the allowed list, and fails when a criterion has no test that mentions it. We ran it against a sample repository on bash 3.2, the version macOS ships: bash /usr/bin/env bash Usage: scripts/spec-gate.sh