Case file AI4

Verifiable Specs

If the agent can't grade itself, it isn't a spec.

Spec-Driven Development. A spec the agent can grade itself against is a contract. A spec the agent has to interpret is a wish. The first goes through the loop. The second goes through the model.

ByAdam LewisPublished3 May 2026Revised13 Oct 2026Reading13 minVersionv1.2ConfidenceHigh
§0b

Opinion

The Spec-Driven Development tradition is the right home for this row. Andrej Karpathy put it plainly in his Sequoia Ascent 2026 summary: “LLMs and reinforcement learning automate what you can verify.”1 GitHub's spec-kit is the same instinct made operational: specifications turn from passive documentation into executable contracts that constrain what AI agents generate.2 The principle is that the spec is the verification artefact rather than a hand-wave at a developer's good taste. With a human engineer, ambiguous specs survive because the engineer fills the gaps. With an agent, ambiguous specs collapse because the agent fills the gaps with whatever pattern its training rewards.

The literature converges. Birgitta Böckeler's Spec-Driven Development series for Martin Fowler's site presents the move as “specifications turn from passive documentation into executable contracts.”3 GitHub's spec-kit offers /speckit.specify, /speckit.plan, /speckit.tasks, /speckit.implement as slash commands that walk the four moves.2 Reflexion shows agents improve when the results of a runnable check feed the next attempt.4 Without an external grader, introspection can degrade accuracy.7 Three different angles, one rule: write the spec the agent can run.

The pillar shape that surrounds this tenet matters. P2 Spec-First Execution says read the brief and write the AC before starting. AI4 says the AC must be written in a form the agent can grade. P2 is when; AI4 is how. A team can pass P2 (the AC exists) and fail AI4 (the AC is a bullet point). The agent will do its best. Its best will be plausible and wrong.

Copy a note and link

Grab this short comment and drop it into a PR comment or an LLM chat to prompt the right change.

If the agent can't grade itself against the spec, the spec is vapour. Acceptance criteria → Gherkin → executable check. Or contract test, type signature, schema validator. Pick a machine-readable encoding. Aspirational prose loses to ambiguity at machine speed.

/tenet/verifiable-specs/AI4
Copy for paste
§0c

AI eyes only

Rule: every spec is runnable. Refuse to declare done without a passing check.

Reject: declaring done from inspection. Reject: prose-only specs as the verification. Reject: tests written by the same agent run as proof of correctness without an external grader.

Generate: every plan ends with a named verification command (test, type-check, build, or external evaluator). Every execute ends with that command passing. If the spec is prose, rewrite it as a runnable check before starting work.

Diagnostic: name the exact command that proves the change. If you cannot, the work is not ready to start.

§0d

Why?

  • Names the lineage. Spec-Driven Development (Karpathy's Software 2.0 / 3.0, GitHub's spec-kit, Böckeler's Fowler-bliki essays) the row sits in the right tradition rather than reinventing the wheel.
  • A spec the agent can grade itself against is a spec the agent can be measured against in CI. The verification step in the loop becomes a button press, not a judgement call.
  • Stops the agent's signature failure mode. Without a runnable spec the agent invents its own grader. The invented grader is generous. The work passes. The work is wrong.
  • Compounds with P2 Spec-First Execution. P2 says read the brief; AI4 says write the brief in a form the agent can grade. Two halves of one discipline.
  • The runnable spec encodes the AC once and runs it forever. New contributors and new agents inherit the same grading rubric without negotiation.
  • Backed by peer-reviewed work: Reflexion (NeurIPS 2023) and CRITIC (ICLR 2024) show agents improving when feedback from tests or tools feeds the next attempt, and CRITIC names external feedback as crucial to that improvement.
  • Makes AI1 The Intern Pattern's execute leg safe to delegate. Without a runnable spec, “execute” is “cross your fingers” with extra steps.
The receipts
Origins, quoted passages, evidence, the strongest counter-argument and the reply.
§1

Origins

The principle is older than the agent era. Bertrand Meyer's Eiffel baked Design by Contract into the language in 1986. Preconditions, postconditions, and class invariants were the early statement that a spec is something the runtime can grade.5 Cucumber and the BDD movement (2003 onward) applied the same rule at the acceptance-criteria layer, where a Given/When/Then scenario is a spec the test runner can execute. Specification by Example (Gojko Adzic, 2011) made the methodology explicit: collaborate on examples, formalise them, automate them, use them as living documentation.6

Andrej Karpathy reframed the principle for the agent era. The Software 2.0 / 3.0 talks ground the modern restatement: “language models automate what can be verified.”1 Three conditions for an agent-verifiable task: it can be run, it can be reset and it can be graded automatically. Specs that miss any of the three conditions cannot be delegated. The agent has no way to know whether it succeeded.

The 2025 / 2026 wave of Spec-Driven Development tooling instantiates the principle at industrial scale. GitHub's spec-kit sets /speckit.constitution once per project, then walks each feature through slash commands that include /speckit.specify for business context and success criteria, /speckit.plan for architectural translation, /speckit.tasks for decomposition into testable units, /speckit.implement for the agent execution under those constraints.2 Birgitta Böckeler's Spec-Driven Development series for Martin Fowler bliki surveys the wider tooling (Kiro, spec-kit, Tessl) and sums up how the term is used: “Spec-driven development means writing a ‘spec’ before writing code with AI (‘documentation first’). The spec becomes the source of truth for the human and the AI.”3

The peer-reviewed cluster underneath the operational rule sits in Reflexion, Self-Refine, and CRITIC. Each shows the same finding from a different angle: agents that grade themselves against an external check produce measurably better output than agents that grade themselves against their own confidence.4 Huang et al. (2024), the canonical caveat, show that without an external grader, introspection can hurt accuracy.7 The runnable spec is the external grader. Without it, every other AI tenet on the site weakens by the same coefficient.

§2

Quotes

LLMs and reinforcement learning automate what you can verify.

Andrej Karpathy · Sequoia Ascent (2026)

The spec becomes the source of truth for the human and the AI.

Birgitta Böckeler · Spec-Driven Development (Martin Fowler bliki, 2026)

The commands embody SDD principles by treating specifications as executable artifacts rather than static documents.

GitHub · spec-kit Spec-Driven Development guide

Reflexion agents verbally reflect on task feedback signals, then maintain their own reflective text in an episodic memory buffer to induce better decision-making in subsequent trials.

Shinn et al. · Reflexion (NeurIPS 2023)
§3

Evidence

16 external sources, ranked by author authority. The first five are the canon; expand to see the rest, including the qualifiers and the named opposers. Each links out to its primary source.

  1. 01
    Andrej Karpathy · 2026
    “Language models automate what can be verified.” The single sharpest idea for the row. The autonomy slider runs as far as the verification reaches. Verifiable specs are the lever that opens the slider.
  2. 02
    GitHub · 2025
    Slash-command toolkit (/speckit.specify, /speckit.plan, /speckit.tasks, /speckit.implement) that operationalises the principle. Industrial-scale evidence the practice is releasing, not theoretical.
  3. 03
    Birgitta Böckeler / Martin Fowler bliki · 2026
    Survey of the SDD tooling. Names the move: specifications turn from passive documentation into executable contracts that constrain what AI agents generate.
  4. 04
    Shinn et al. · 2023
    NeurIPS paper. Verifiable feedback is why agents improve: HumanEval pass@1 jumps from 80% to 91% when the loop closes against a runnable check.
  5. 05
    Madaan et al. · 2023
    NeurIPS paper. The same draft-feedback-refine loop without an external grader: a single LLM acts as generator, refiner and feedback provider, and improves task performance by ~20% absolute on average across 7 tasks.
  1. 06
    Gou et al. · 2024
    ICLR paper. LLMs validate and progressively amend their outputs by interacting with appropriate tools: tools that grade the spec, not introspection.
  2. 07
    Bai et al. · 2022
    Anthropic's principle-driven self-critique. The constitution is the spec. The model grades its own output against it. Same shape, different surface.
  3. 08
    Huang et al. · 2024
    ICLR paper. Pure introspective self-correction can decrease accuracy. Reads as the case for the rule: external grading (verifiable specs) is what works. Pure introspection is what doesn't.
  4. 09
    Gojko Adzic · 2011
    Methodological grounding for the row. Collaborate on examples, formalise them, automate them, use them as living documentation. The pre-AI version of the SDD lineage.
  5. 10
    Aslak Hellesøy and the Cucumber community · 2008 onwards
    The most widely deployed verifiable-spec format in industry. Given/When/Then steps compile to runnable tests. The AC is the test.
  6. 11
    Bertrand Meyer · 1986
    Earliest production embedding of the principle: preconditions, postconditions, invariants. The spec lives in the source. The runtime grades it.
  7. 12
    Addy Osmani · 2025
    Five principles, plus a six-area checklist drawn from GitHub's analysis of over 2,500 agent configuration files: commands, testing, project structure, code style, git workflow, boundaries. Self-checks and conformance tests sit in principle four.
  8. 13
    David MacIver and others · 2013 onwards
    Verifiable specs at scale: the property is the AC, the runner explores the input space. The encoding the row reaches for when example-based AC is too narrow.
  9. 14
    JSON Schema community / OpenAPI Initiative · 2009 onwards
    Machine-readable contracts at the wire layer. Same principle: the spec is the validator, not the prose.
  10. 15
    Tessl · 2025
    Tessl Framework explored the spec-as-source level of SDD: a Tessl spec is the maintained artefact and the code generated from it carries a GENERATED FROM SPEC - DO NOT EDIT header. Böckeler reviewed it in private beta; Tessl now offers an agent enablement platform built around a registry of agent skills.
  11. 16
    Amazon Web Services · 2025
    Vendor-scale SDD adoption. The pattern is no longer a startup or open-source curiosity. Major cloud providers offer spec-driven tooling for production agents.

Sixteen sources. Karpathy's Software 3.0 talk supplies the idea, Böckeler on the Fowler bliki supplies the practitioner's view and GitHub's spec-kit is the operational artefact. Reflexion (Shinn) and Self-Refine (Madaan) supply the academic backing for verifiable feedback. The qualifier further down captures the case where pure introspection without an external grader can hurt. That is the case for the rule, not against it.

§4

Examples

Viewing: TypeScript.
Avoid

Before a wish, not a spec. The agent invents whatever pattern its training rewards.

Filerescue-hedgehog.ts
function rescueHedgehog(hedgehog: Hedgehog): RescueResult {
// TODO: handle the case where the hedgehog is hibernating
  return { status: "rescued" };
}
Prefer

After Given/When/Then. The spec is runnable; the agent grades its own work.

Filerescue-hedgehog.spec.ts
test("defers a hibernating hedgehog", () => {
  const hedgehog: Hedgehog = { state: "hibernating" };
  const result = rescueHedgehog(hedgehog);
  expect(result).toEqual({ status: "deferred", reason: "hibernating" });
});
rescue-hedgehog.ts
function rescueHedgehog(hedgehog: Hedgehog): RescueResult {
  return hedgehog.state === "hibernating"
    ? { status: "deferred", reason: "hibernating" }
    : { status: "rescued" };
}
§4b

Enforcement

Viewing: TypeScript.

Apply these rules in eslint.config.mjs. The full enforcement across every tenet lives on the implementation page.

RuleToolCatches
vitest/expect-expect@vitest/eslint-plugintests with no assertion. The spec is the assertion; a test without one is a spec without a grader.
cucumber/async-theneslint-plugin-cucumberThen steps that await without resolving: the AC compiles but never grades. Common Cucumber pitfall when AI agents author scenarios.
no-restricted-tagsgherkin-lint@wip / @skip tags committed to main. The runnable AC is no longer runnable the moment a tag opts out.
AJV: schema validationAJV (JSON Schema validator)fixtures and request/response payloads that drift from the JSON Schema. The schema is a verifiable spec at the wire layer.
eslint.config.mjsconfiguration snippet
import { defineConfig } from 'eslint/config';
import tseslint from 'typescript-eslint';
import vitest from '@vitest/eslint-plugin';
import cucumber from 'eslint-plugin-cucumber';

export default defineConfig({
  files: ['**/*.{ts,tsx}'],
  plugins: { vitest, cucumber },
  rules: {
    'vitest/expect-expect': 'error',
    'vitest/no-disabled-tests': 'error',
    'vitest/no-focused-tests': 'error',
    'cucumber/async-then': 'error',
  }
});
§4c

AI rules

File.cursor/rules/ai4-verifiable-specs.mdc
---
alwaysApply: true
---

## Prickles AI4: Verifiable Specs

Write specs as executable contracts the agent can run and grade itself against, not passive documentation it has to interpret. Spec-Driven Development, Karpathy's Software 2.0 and 3.0 and GitHub's spec-kit all converge on this rule.

If the agent cannot grade itself against the spec, the spec is vapour. Acceptance criteria the AI can run beat acceptance criteria the AI can interpret.

Pick a machine-readable encoding: Gherkin, contract tests, type signatures, schema validators, executable checklists. Aspirational prose loses to ambiguity at machine speed.

P2 says read the spec; AI4 says write it in a form the agent can grade. The two together make the spec executable, not aspirational.

Repo layout, CI, and ESLint wiring for these paths live on /implementation, not repeated on every tenet.

§5

Counter-argument

Counter

The honest steelman is that not every requirement reduces to a runnable check. Performance intent (“feels fast”), aesthetic criteria (“respects the brand voice”), discovery work whose acceptance is “we now know”, and product instincts that don't survive premature formalisation all resist the verifiable-spec rule. Birgitta Böckeler's own Spec-Driven Development survey raises the opposite worry: the spec artefacts become the review burden, and the agent ignores parts of them anyway.3 Demanding a runnable check for every spec turns design into compliance and overfits the work to what the test runner can score.

§6

Counter-argument retort

Reply

The unverifiable-judgement objection is real and the rule absorbs it without breaking. AI4 asks for a runnable check on the parts that compile, run and deploy. The aesthetic and product-instinct parts go through AI1 The Intern Pattern instead: the human approves the plan, the agent executes, the human reviews. The spec is the contract on the verifiable surface. The human is the contract on the surface that resists formalisation. Both gates close before merge.

The larger response is that “not everything is verifiable” is usually code for “I haven't found the verification yet.” Performance intent reduces to a latency budget. “Respects the brand voice” reduces to a style guide and a small LLM-as-judge check; Anthropic use constitutional AI as the framework for exactly this. Discovery work reduces to a written hypothesis and a learning-criterion. The verifiable restatement is harder than the prose, which is why the prose tends to win, but the prose is the version the agent will improvise around and the verifiable restatement is the version that survives the next session and the next contributor.

For the genuinely irreducible residue, the human judgement that no test can replace, the rule does not vanish. It shifts. The spec records the judgement was made. The reviewer records who made it. The audit trail survives. P2 says read the brief; AI4 says grade what you can; AI1 The Intern Pattern closes the loop on what you can't.

How this differs from Spec-First Execution and Test-First Development.

See also: P2 Spec-First Execution. P2 says read the brief and write the AC before you start. AI4 says: whatever AC you wrote, write it in a form the agent can grade. P2 is when; AI4 is how. A team can pass P2 (the AC exists) and fail AI4 (the AC is a bullet point). The agent will do its best. Its best will be plausible and wrong.

See also: P1 Test-First Development. P1 says write the failing test before the code. AI4 says the test must be runnable, resettable, and graded automatically: Karpathy's three conditions for a verifiable task. In the human-only loop, P1 is sufficient because the same human reads and runs the test. In the agent loop, P1 works only if AI4 holds. An unrunnable test is a passing test for an agent that can't tell the difference.

§7

Notes

  1. [1]Andrej Karpathy: Sequoia Ascent 2026 / Software 3.0 talks. “Language models automate what can be verified.” The Karpathy idea for the row: the autonomy slider runs as far as the verification reaches and no further.
  2. [2]GitHub: spec-kit: Toolkit to help you get started with Spec-Driven Development. /speckit.constitution is set once per project; /speckit.specify, /speckit.plan, /speckit.tasks, /speckit.implement and /speckit.converge run per feature, with /speckit.clarify, /speckit.checklist and /speckit.analyze as optional quality gates.
  3. [3]Birgitta Böckeler / Martin Fowler bliki: Understanding Spec-Driven-Development: Kiro, spec-kit, and Tessl (2025). The survey essay: the spec becomes the source of truth for the human and the AI.
Disagree? Found a hole in the argument? Take issue with this tenet →
Last revised: 2026-10-13