← All posts

How I Use OpenSpec with Coding Agents

A coding agent can write a thousand lines in an afternoon. The hard part is making sure they are the right thousand lines, and that next week's session still knows why they exist. Chat history is a poor place to keep that. Since September 2026 I have used OpenSpec, a lightweight spec framework for coding agents, for most non-trivial work in my own projects: my genetic genealogy project Jile, the credit-risk model fintfm, the CircassianDNA site, and five Kaggle entries. This post explains how it works, the conventions I added on top, the checks that keep those conventions honest, and where it still goes wrong.

In short

  • OpenSpec splits a repository's plans into two trees: specs/ says what the system does now, and changes/ holds what you intend to change. An agent proposes into changes/; archiving a finished change folds it into specs/.
  • My additions: every proposal says what would prove it wrong, every task names the command that verifies it and records the result, and specs state guarantees rather than features.
  • Conventions an agent is only told about drift; conventions a test checks hold. A short validator in the test suite does most of that work.
  • Across eight repositories: 92 changes and 850 tasks, 91 per cent of them naming a check or recording a result. The weak point is archiving: two repositories have archived every finished change, the others almost none.

What OpenSpec is

OpenSpec is an open-source (MIT) command-line tool and a set of agent skills from Fission AI. It works with more than 30 coding agents, including Claude Code, Codex, Cursor and GitHub Copilot. Its own summary is short: "AI coding assistants are powerful but unpredictable when requirements live only in chat history. OpenSpec adds a lightweight spec layer so you agree on what to build before any code is written."

Each piece of work is a change: a folder under openspec/changes/ with a proposal.md (why), a tasks.md (the checklist), an optional design.md (how), and spec deltas that say which requirements the change adds or modifies. Requirements are plain Markdown with a SHALL statement and scenarios written as WHEN and THEN. You describe only what changes, which is why it fits existing codebases rather than only new ones.

Three document cards for an invented change called add-csv-export: a proposal with Why, Non-goals, Falsified by and Cost; tasks with Verify lines and results; and a spec delta adding a CSV export requirement with a WHEN and THEN scenario openspec/changes/add-csv-export/ proposal.md ## Why Users copy results by hand. ## Non-goals No Excel format, no scheduling. ## Falsified by Nobody uses it within a month. ## Cost Half a day; no published number. tasks.md - [x] 1.1 Exporter. Verify: pytest tests/test_export.py (4 passed) - [x] 1.2 Download button. Verify: browser test (1 passed) - [ ] 1.3 README section. Verify: the section renders. specs/export/spec.md ## ADDED Requirements ### Requirement: CSV export The system SHALL export the results table as CSV. #### Scenario: Header row - WHEN a user exports - THEN row 1 holds the column names in display order Invented example. Archiving merges the ADDED requirement into openspec/specs/export/spec.md.
Figure 1. One change, three files. The proposal and tasks use my conventions.
Six steps, explore, propose, review, apply, verify and archive; propose writes into the changes folder, archive moves a finished change into the specs folder Explore read code, weigh options Propose proposal, tasks, spec deltas Review you edit and approve Apply implement, tick with proof Verify code matches the spec Archive deltas merge into specs/ human step changes/ what we intend one folder per change, kept until it lands specs/ what is true now requirements with SHALL and WHEN/THEN Propose writes into changes/; archive folds a finished change into specs/ and keeps the folder as history.
Figure 2. The workflow, and the two trees it keeps apart.

The agent drives each step through a skill. Version 2.0 (November 2026) put the skills in one shared .agents/skills/ folder for every tool, and 2.2 added a router, so /openspec followed by a plain request is enough. Review is the step with no skill: it is you reading the proposal before any code is written.

SkillWhat it doesWhen I use it
/openspecRoutes a plain request to the right skill, or reports where a change stands"Where does add-export stand?"
/openspec-exploreReads the code, weighs options and shapes a plan before any code is writtenBefore I know what the change should be
/openspec-proposeCreates the change folder: proposal, spec deltas, design, tasksOnce the problem is clear
/openspec-apply-changeWorks through the tasks in orderAfter I have edited and approved the proposal
/openspec-verify-changeChecks the code against the requirements (expanded profile)Before I tick the last task
/openspec-archive-changeMerges the deltas into specs/ and files the changeThe day the change lands

The expanded profile adds verify, plus skills for creating a change step by step, fast-forwarding through all artefacts, archiving in bulk and onboarding a new user.

Thoughtworks moved OpenSpec from Assess to Trial in its November 2026 Technology Radar. Its teams "report more predictable agent output and fewer unintended changes compared to bare prompting". The same entry carries the warning this post keeps returning to: "maintaining the persistent spec still requires discipline".

The one idea that matters: two trees

Everything else follows from keeping intent and truth apart. changes/ is a queue of things you mean to do, each with its reasoning. specs/ is the answer to "what does this system guarantee today?", which neither a backlog nor a pile of design documents can give you. My Jile repository adopted OpenSpec for exactly that reason: its planning file had 59 numbered items, 31 of them open, whose status could only be read "by scanning prose for words like DONE, DECIDED, SWEPT and NOT ACTIONABLE".

The fintfm README states the rule I aim for everywhere: a change that lands "updates the spec it touches in the same commit", because "a change that leaves the spec stale has not really landed, and the specs stop being trustworthy the first time that is allowed."

Proposals that can be proved wrong

OpenSpec's default proposal has four sections: Why, What Changes, Capabilities and Impact. I keep the first two and add four of my own, each forcing a decision before the agent starts typing:

SectionFromThe question it answersWhat it prevents
WhyOpenSpecWhat problem, with what evidence?Work started because it seemed like a good idea in the moment
What ChangesOpenSpecWhich files, behaviours and outputs move?An agent's broad reading of a short request
Non-goalsMineWhat is deliberately left out?Scope creep, the agent's favourite failure
Falsified byMineWhat result would show this was wrong?Changes that can only ever be declared a success
Blocked by / blocksMineWhat must come first, and what waits on this?Claims made before the work that supports them
CostMineTime, compute, money; does it move a published number?A cheap-looking change that reruns a week of experiments

Falsified by is the section I would keep if I could keep only one. In fintfm, a proposal to measure whether the model improves with more pretraining says: "A flat or saturating curve. That is a publishable negative result and it redirects the roadmap rather than ending it." A proposal can also say honestly that there is nothing to falsify. The change that moved fintfm's evaluation from random to time-based splits reads "Nothing to falsify", then: "this is a correctness fix, not a hypothesis." Writing that sentence is still useful, because it separates fixes from bets.

Blocks stops the agent, and me, from getting ahead of the evidence. The fintfm change that added proper gradient-boosting baselines lists what it blocks: "any external claim involving gradient boosting, which is most of them".

Tasks that carry their own proof

A bare [x] is the agent's word that something is done. I want the evidence instead, so every task names the command that verifies it, and the result goes next to the tick. A real one from fintfm:

- [x] 18.1 Run the boosting family in a torch-free subprocess, exchanging arrays via a temp
      file. Verify: a test that fits LightGBM, CatBoost and XGBoost in a process where torch
      is already imported, and asserts none crashes. **Done 2026-09-09:
      `evaluation/boosting.py`, guarded by a parametrised test that imports torch first.**

Failures go in too. In one Kaggle entry, the task for the submission path recorded that its first attempt failed: the competition's local gateway and my local scorer disagreed, because a relay reordered dictionary keys. The fix is in the next line of the same task, with three gateway runs that then matched to every digit. That note is the only record of why the layout code no longer trusts key order.

Two rules make this work. Tasks are half-day chunks, small enough that "done" is unambiguous. And a deferred task stays open with its reason; it is never ticked to make a list look finished, because a closed box is a claim that someone will later rely on.

Specs that state guarantees

OpenSpec examples tend to specify features: a theme toggle, a login form. My most useful specs specify properties the system must never lose. The capability names say it:

ProjectCapabilities in specs/
Jiledating-honesty, determinism, placement-tiers, reporting-integrity, withholding
fintfmcalibrated-prediction, credit-evaluation-data, evaluation-honesty, experiment-decisions, inference-options, model-invariances, pretraining-provenance

Some of these were written after the fact, from bugs. Jile's reporting-integrity spec was "written retrospectively", it says, "after three instances of the same defect in three releases". One of its requirements:

### Requirement: A headline counts the population its breakdown describes

The system SHALL NOT print a total beside a breakdown that counts a different population.

#### Scenario: A subtotal is printed as a total

- **WHEN** a console line reports a withheld count beside a per-reason spread
- **THEN** the count is the sum of that spread, and any narrower subtotal is labelled as a subtotal

A spec like that is regression memory. The bug was fixed three times before; the spec makes the fourth time a failing check rather than a surprise. fintfm goes one step further and makes every requirement name the test that enforces it, for example "Enforced by: tests/test_classifier.py::test_fit_predict_shapes". A requirement with no enforcement is a wish, and the test suite rejects it.

Decision rules belong here too. In a Kaggle entry, my adoption rule for a new controller is a requirement: a change that improves the validation scenarios but gets worse on a set of conditions no training scenario covers "SHALL NOT be submitted without the owner's explicit decision". In an evaluation harness I work on, moving any acceptance threshold needs a proposal with a measurement attached and a version bump, because, as its notes put it, a threshold moved after an outcome is seen "will arrive looking like a small, reasonable, well-argued edit made on a deadline".

A context file every session reads

openspec/config.yaml has a context block, which OpenSpec injects into every workflow run. I treat it as the project's rulebook: short, specific, and full of rules that would otherwise be argued again in every session.

  • Where the truth lives. Specs for current behaviour, changes for intent, and named documents for decisions, findings and mistakes.
  • What counts as evidence. In my Kaggle entries: full-length runs, compared in pairs against the current best, adopted only when a bootstrap interval excludes zero. Every number carries a label: MEASURED, SUBSAMPLE or ESTIMATED.
  • What may never happen. Competition data is never committed; public notebooks are read, never run.
  • What is settled. fintfm's context marks its positioning "SETTLED, DO NOT RE-OPEN", which ends a debate that would otherwise restart in every session.
  • The vocabulary. fintfm requires any proposal that introduces a domain term to add it to the glossary, because in credit risk "PD is undefined without a horizon".

The context also tells the agent where each kind of information belongs, so nothing important ends up only in chat:

WhatWhere it goes
What the system guarantees nowopenspec/specs/
Work intended or in flight, with its reasoningopenspec/changes/
Landed or rejected workopenspec/changes/archive/
A measured number, with the command that produced itA findings document
A decision and what it rules outA decision log
A mistake and what would have caught itA mistakes document
An idea found mid-sessionA new proposal, before it is implemented

The CLAUDE.md of each repository carries the rule that starts the loop: every non-trivial piece of work is an OpenSpec change, validated before it is built and archived when it is done.

Checking the conventions in code

Agents follow instructions most of the time. Conventions that matter need a check that fails, so my two longest-running repositories, Jile and fintfm, run a small validator in their test suites; the younger Kaggle entries rely on openspec validate --strict and my review. Jile's validator lists the four failures it exists to catch, all of them silent:

  1. A completed change is never archived, "so changes/ accumulates finished work and nobody can see what is actually in flight".
  2. A change ships without a delta spec, so a requirement enters the product unstated.
  3. Requirements stop being testable: no SHALL, or a scenario without WHEN and THEN, "at which point the spec is prose".
  4. specs/ drifts from changes/archive/, and the two disagree about which capabilities exist.

A stripped-down version of the same idea, which you can drop into any repository:

"""Fail CI when an OpenSpec tree breaks the conventions an agent is told to follow."""
import re
import sys
from pathlib import Path

SECTIONS = ("## Why", "## What Changes", "## Non-goals", "## Falsified by")


def tasks(text):
    """Split tasks.md into (done, body) blocks: a checkbox line plus its indented lines."""
    blocks = []
    for line in text.splitlines():
        if m := re.match(r"\s*- \[([ x])\]", line):
            blocks.append([m.group(1) == "x", line])
        elif blocks and line.startswith("  "):
            blocks[-1][1] += "\n" + line
    return blocks


def check(root):
    problems = []
    for change in sorted((root / "changes").iterdir()):
        if change.name == "archive" or not change.is_dir():
            continue
        proposal = (change / "proposal.md").read_text()
        problems += [f"{change.name}: proposal lacks '{s}'" for s in SECTIONS if s not in proposal]
        blocks = tasks((change / "tasks.md").read_text())
        problems += [f"{change.name}: a task names no Verify" for _, b in blocks if "Verify:" not in b]
        problems += [f"{change.name}: ticked task records no result" for done, b in blocks
                     if done and not re.search(r"Verify:.*\S.*\((?:\d|passed|failed)", b, re.S)]
        if blocks and all(done for done, _ in blocks):
            problems.append(f"{change.name}: every task is done, so archive it")
    for spec in (root / "specs").glob("*/spec.md"):
        for req in re.split(r"^### Requirement:", spec.read_text(), flags=re.M)[1:]:
            title = req.splitlines()[0].strip()
            if "SHALL" not in req:
                problems.append(f"{spec.parent.name}: '{title}' states no SHALL")
            if "**WHEN**" not in req or "**THEN**" not in req:
                problems.append(f"{spec.parent.name}: '{title}' has no WHEN/THEN scenario")
    return problems


if __name__ == "__main__":
    found = check(Path(sys.argv[1] if len(sys.argv) > 1 else "openspec"))
    print("\n".join(found) or "openspec tree is sound")
    sys.exit(1 if found else 0)

Run on an invented change with one sloppy proposal, a ticked task with no evidence and two weak requirements, it fails with exactly the problems an agent would otherwise leave behind:

$ python check_openspec.py demo
add-export: proposal lacks '## Non-goals'
add-export: a task names no Verify
add-export: ticked task records no result
export: 'CSV export' has no WHEN/THEN scenario
export: 'Stable columns' states no SHALL
exit 1

Three more tools sit beside it. An archive script refuses to archive a change with open tasks, "because archiving is a claim that the work is done". In one larger repository, a reference checker makes sure every Blocked by and Blocks entry names a change that exists: references are either specified, parked as a deliberate stub counted against a baseline, or dangling, which fails. And openspec validate --strict covers OpenSpec's own format.

Six layers from context files through skills, openspec validate, a repository validator in the test suite and an archive tool, down to human review Context config.yaml and CLAUDE.md: rules every session reads Skills propose, apply, archive: the agent follows the workflow openspec validate --strict structure: deltas, SHALL, scenarios Repo validator in the test suite my conventions: sections, Verify, references, drift Archive tool refuses a change with open tasks Review I read the proposal before code, and the diff after Each layer catches what the one above lets through. The highlighted two are code I added.
Figure 3. Six layers of enforcement, from instructions to code to review.

What the repositories show

Counting across the eight repositories I can name:

RepositorySinceChanges (open / archived)Tasks (done / total)Tasks naming a checkProposals with Falsified by
JileSep 20265 / 121 / 5784%0 of 6
fintfmSep 202639 / 0315 / 420100%24 of 39
CircassianDNANov 20269 / 124 / 11799%0 of 10
Kaggle: CASMINov 20260 / 1089 / 8965%10 of 10
Kaggle: SantaNov 202610 / 020 / 4360%10 of 10
Kaggle: smart buildingsNov 20260 / 1271 / 7180%12 of 12
Kaggle: engineering examNov 20263 / 017 / 3589%3 of 3
Kaggle: quantum circuitsNov 20262 / 09 / 1878%2 of 2
All eight68 / 24566 / 85091%61 of 92
Grouped bars per repository in order of adoption: share of tasks naming a check or result, and share of proposals with a Falsified by section. fintfm 100 and 62 per cent, Jile 84 and 0, CircassianDNA 99 and 0, Kaggle entries 60 to 89 and all 100 Two habits per repository, in order of adoption tasks naming a check or result proposals with Falsified by 0% 50% 100% Jile (Sep) 84% 0% fintfm (Sep) 100% 62% CircassianDNA (Nov) 99% 0% Kaggle: CASMI (Nov) 65% 100% Kaggle: Santa (Nov) 60% 100% Kaggle: smart buildings (Nov) 80% 100% Kaggle: engineering exam (Nov) 89% 100% Kaggle: quantum circuits (Nov) 78% 100%
Figure 4. Task evidence stuck early; Falsified by arrived with experiment-heavy work.
Horizontal stacked bars of archived and open changes per repository: smart buildings 12 archived, CASMI 10 archived, Jile 1 and 5, CircassianDNA 1 and 9, quantum 0 and 2, PLE 0 and 3, Santa 0 and 10, fintfm 0 and 39 Changes per repository archived (landed or rejected) open Kaggle: smart buildings 12 archived, 0 open Kaggle: CASMI 10 archived, 0 open Jile 1 archived, 5 open CircassianDNA 1 archived, 9 open Kaggle: quantum 0 archived, 2 open Kaggle: PLE 0 archived, 3 open Kaggle: Santa 0 archived, 10 open fintfm 0 archived, 39 open
Figure 5. Archived against open changes. Archiving is the habit that slips.

Three patterns stand out. "Falsified by" follows the kind of work: it appears in none of the Jile and CircassianDNA proposals, which are mostly pipeline and website work, in most of fintfm's, and in every proposal of the five Kaggle entries, where nearly every change is an experiment. The verification habit stuck early: 91 per cent of tasks name a check or record a result. That figure comes from a simple text match, so it slightly undercounts tasks that record evidence in free prose. And archiving is where discipline slips. Two Kaggle entries, smart buildings and CASMI, archived every finished change. fintfm, which I stopped after its final release, still lists 39 open changes. Thirty hold deferred tasks, kept open on purpose so nobody mistakes them for done. Nine are finished and were never archived: its README says a finished proposal keeps a DONE header instead, yet none of the nine got one, so only their task lists show they are complete. That is exactly the drift the Thoughtworks warning describes, in a repository whose README warned against it.

What goes wrong

ProblemWhat it looks likeWhat I do
Archive backlogFinished changes left in changes/ beside live onesThe validator flags changes with every task done; archive the same day
Documentation sprawlProposals longer than the code they describeHalf-day tasks; a proposal fits on one screen or splits into two changes
CeremonyA full proposal for a one-line fixA change only when the work needs a why or a falsifier; small fixes go straight to a commit
Ticked but not done[x] with nothing behind itNo tick without a recorded result; the validator enforces it
Spec as proseRequirements nobody can testSHALL plus WHEN/THEN, and a named test where possible
Tool driftAn old CLI and skills in old folders; mine was a major version behind while I wrote thisUpgrade, then run openspec update in each repository

The Radar entry names the cost plainly: "spec files are Markdown that agents generate prolifically", and the same issue puts "AI-driven documentation sprawl" under Caution. A spec framework makes documents cheap to produce. The value is in the few lines that constrain the next change, not in volume.

How I would start

  1. Install the CLI and run openspec init in one active repository, not all of them.
  2. Write the context block in openspec/config.yaml: where the truth lives, what counts as evidence, what is settled.
  3. Add Non-goals and Falsified by to the proposal template, and a Verify line to every task.
  4. Write specs for the guarantees you would hate to lose, starting with the last bug that came back.
  5. Add a validator to the test suite once the conventions settle, so they stop depending on memory.
  6. Archive the day a change lands.

OpenSpec's README compares it with GitHub's Spec Kit, which it calls thorough but heavier with rigid phase gates, and with Kiro, which ties you to one editor. I have not used either in depth, so I will leave that comparison to its authors. What I can say is that OpenSpec stays out of the way: the folders are Markdown in git, the agent does the typing, and the discipline is yours to add.

Why it is worth the effort

Coding agents changed what is scarce. Writing code is cheap now; knowing what the code should do, and whether it still does, is not. OpenSpec puts that knowledge in the repository, in files an agent reads at the start of every session and a reviewer can check in a pull request. The conventions on top turn it from a planning tool into a record: what we meant to do, what would have proved us wrong, what we checked, and what the system now guarantees.

None of it is free. Proposals take minutes to read, archives need tending, and a validator needs maintaining. But the alternative is a codebase whose reasons live in closed chat windows, and every new session starts from zero. Two folders, a few extra sections and one test have been the cheapest fix I have found for that. If you work with coding agents, start with one repository and one change, and see whether next week's session knows more than this one did.

Sources