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, andchanges/holds what you intend to change. An agent proposes intochanges/; archiving a finished change folds it intospecs/. - 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.
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.
| Skill | What it does | When I use it |
|---|---|---|
/openspec | Routes a plain request to the right skill, or reports where a change stands | "Where does add-export stand?" |
/openspec-explore | Reads the code, weighs options and shapes a plan before any code is written | Before I know what the change should be |
/openspec-propose | Creates the change folder: proposal, spec deltas, design, tasks | Once the problem is clear |
/openspec-apply-change | Works through the tasks in order | After I have edited and approved the proposal |
/openspec-verify-change | Checks the code against the requirements (expanded profile) | Before I tick the last task |
/openspec-archive-change | Merges the deltas into specs/ and files the change | The 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:
| Section | From | The question it answers | What it prevents |
|---|---|---|---|
| Why | OpenSpec | What problem, with what evidence? | Work started because it seemed like a good idea in the moment |
| What Changes | OpenSpec | Which files, behaviours and outputs move? | An agent's broad reading of a short request |
| Non-goals | Mine | What is deliberately left out? | Scope creep, the agent's favourite failure |
| Falsified by | Mine | What result would show this was wrong? | Changes that can only ever be declared a success |
| Blocked by / blocks | Mine | What must come first, and what waits on this? | Claims made before the work that supports them |
| Cost | Mine | Time, 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:
| Project | Capabilities in specs/ |
|---|---|
| Jile | dating-honesty, determinism, placement-tiers, reporting-integrity, withholding |
| fintfm | calibrated-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:
| What | Where it goes |
|---|---|
| What the system guarantees now | openspec/specs/ |
| Work intended or in flight, with its reasoning | openspec/changes/ |
| Landed or rejected work | openspec/changes/archive/ |
| A measured number, with the command that produced it | A findings document |
| A decision and what it rules out | A decision log |
| A mistake and what would have caught it | A mistakes document |
| An idea found mid-session | A 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:
- A completed change is never archived, "so
changes/accumulates finished work and nobody can see what is actually in flight". - A change ships without a delta spec, so a requirement enters the product unstated.
- Requirements stop being testable: no SHALL, or a scenario without WHEN and THEN, "at which point the spec is prose".
specs/drifts fromchanges/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.
What the repositories show
Counting across the eight repositories I can name:
| Repository | Since | Changes (open / archived) | Tasks (done / total) | Tasks naming a check | Proposals with Falsified by |
|---|---|---|---|---|---|
| Jile | Sep 2026 | 5 / 1 | 21 / 57 | 84% | 0 of 6 |
| fintfm | Sep 2026 | 39 / 0 | 315 / 420 | 100% | 24 of 39 |
| CircassianDNA | Nov 2026 | 9 / 1 | 24 / 117 | 99% | 0 of 10 |
| Kaggle: CASMI | Nov 2026 | 0 / 10 | 89 / 89 | 65% | 10 of 10 |
| Kaggle: Santa | Nov 2026 | 10 / 0 | 20 / 43 | 60% | 10 of 10 |
| Kaggle: smart buildings | Nov 2026 | 0 / 12 | 71 / 71 | 80% | 12 of 12 |
| Kaggle: engineering exam | Nov 2026 | 3 / 0 | 17 / 35 | 89% | 3 of 3 |
| Kaggle: quantum circuits | Nov 2026 | 2 / 0 | 9 / 18 | 78% | 2 of 2 |
| All eight | 68 / 24 | 566 / 850 | 91% | 61 of 92 |
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
| Problem | What it looks like | What I do |
|---|---|---|
| Archive backlog | Finished changes left in changes/ beside live ones | The validator flags changes with every task done; archive the same day |
| Documentation sprawl | Proposals longer than the code they describe | Half-day tasks; a proposal fits on one screen or splits into two changes |
| Ceremony | A full proposal for a one-line fix | A 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 it | No tick without a recorded result; the validator enforces it |
| Spec as prose | Requirements nobody can test | SHALL plus WHEN/THEN, and a named test where possible |
| Tool drift | An old CLI and skills in old folders; mine was a major version behind while I wrote this | Upgrade, 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
- Install the CLI and run
openspec initin one active repository, not all of them. - Write the
contextblock inopenspec/config.yaml: where the truth lives, what counts as evidence, what is settled. - Add Non-goals and Falsified by to the proposal template, and a Verify line to every task.
- Write specs for the guarantees you would hate to lose, starting with the last bug that came back.
- Add a validator to the test suite once the conventions settle, so they stop depending on memory.
- 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.