Change a shipped requirement#
At the end of this page you can add or change requirements in a live project
through a change, so the specs, the feature files and the traceability
matrix never drift apart. A change is a folder under
docs/specs/changes/<id>/ that holds the requirements being added, modified or removed until they are built.
You need: a project where specgate init has run, and a test command configured (specgate config set test_cmd "npm test").
The loop is four commands: propose opens the change, apply delivers each
requirement, status says what is left, and archive closes the change once every requirement in it is delivered
(ADR-0035). Between propose
and apply, a person approves the change. For writing your first requirements on a new project, see Writing specs.
1. Open the change#
specgate propose add-dynamic-pricing --capability pricing ✔ Change add-dynamic-pricing created · lite · REQ ids REQ-014…REQ-016 reserved
+ docs/specs/changes/add-dynamic-pricing/change.yaml
+ docs/specs/changes/add-dynamic-pricing/discover.md
+ docs/specs/changes/add-dynamic-pricing/design.md
+ docs/specs/changes/add-dynamic-pricing/tasks.md
+ docs/specs/changes/add-dynamic-pricing/specs/pricing/spec.md
Next ───────────────────────────────────────────────────
➜ specgate apply
after you write the delta, a test that names each requirement, and the code- The layers (ADR-0044):
discover.mdis product's (context, use case, criteria- AC-1: …),design.mdthe architect's (it names every criterion),tasks.mdthe developer's (each task names itsREQ-NNN).change validatewarns on each rule; a 0.27 change'sproposal.mdis its Discover. - The delta is
specs/<capability>/spec.md: only the requirements this change adds, modifies or removes. It is named after the change unless--capabilitynames the capability it belongs to. - The reserved ids are written into
change.yaml, so two changes in flight never hand out the sameREQ-NNN.--reserve <n>reserves more than three.
2. See what is left#
specgate statusstatus lists what is still to do, including the requirements of open
changes, and names the one command to run next. Until you write the delta, it
says the change is not judged yet.
To see which file of the change to write next, run
specgate change status add-dynamic-pricing. The files of a change form a
dependency graph, not a sequence of phases
(ADR-0018): nothing stops you writing
them in another order.
3. Write the delta#
Write only what changes, never a copy of the whole spec:
# Delta — pricing
## ADDED Requirements
### Requirement: REQ-014 — Dynamic peak pricing
The system SHALL raise the tariff automatically when occupancy crosses a
configured threshold.
#### Scenario: SCN-014 — Peak rate applies above the threshold
- GIVEN occupancy is above 85%
- WHEN a vehicle enters
- THEN the peak tariff is applied
<!-- specgate:trace kind=functional uc=UC-007 cmd=CMD-011 agg=AGG-Pricing
evt=EVT-PriceApplied feature=features/pricing/REQ-014.feature -->Three sections are valid: ## ADDED Requirements, ## MODIFIED Requirements
and ## REMOVED Requirements. MODIFIED replaces the whole requirement block;
it does not merge scenario by scenario.
The validator is strict about two things:
- Steps are plain
- GIVENbullets.- **GIVEN**fails withscenario_not_gherkin, because the keyword has to start the line. - The body needs an obligation keyword (
SHALL,MUST,SHOULDorMAY), otherwise you getno_rfc2119_keyword.
The specgate:trace comment's kind= (functional, non-functional or
business-rule) is required, and the template propose writes has none: add it,
or change approve refuses the change (approve_blocked; change validate
says change_not_approvable). uc, cmd, agg and evt are optional matrix
columns, - when missing. feature= is one file per requirement.
While the change is open, its requirements already count: status lists
REQ-014 as to do, and apply, check and harness run judge the project as
it will be after archive. Nothing is written into docs/specs/capabilities/
yet.
depends= says what a requirement builds on. Add it to the same comment:
<!-- specgate:trace kind=functional uc=UC-008
feature=features/pricing/refunds.feature depends=REQ-014 -->Separate several with commas: depends=REQ-014, REQ-016. Then:
specgate planorders the queue so a requirement never comes before the work it needs, and marks one whose dependency is pending as⛔ blocked— once the change is archived; while it is open,statuslists them.specgate validatefails on a cycle (requirement_cycle), on a dependency that names no requirement (unknown_dependency) and on a requirement that depends on itself (self_dependency).
A project that declares no depends= has no dependencies.
4. Validate the delta#
specgate change validate add-dynamic-pricing ✔ add-dynamic-pricing (1 delta(s))You rarely need this by hand: specgate validate and specgate check validate
every open change, so a broken delta fails the gate on its own.
5. Approve it, then apply each requirement#
The review is the pull request of the change: the delta, the tests that name its requirements, and the code, together. It starts before any code: a person approves the change, then each requirement goes through the gate on its own.
A person approves the draft#
specgate change approve <id> records that a person read and approved it,
refused while its checklist has an error or a question is open; specgate change note <id> "<what to change>" --req REQ-NNN asks for a change in your
words, in the draft's review.md. The studio's Changes section does
both, each blocker with the action that clears it, and Build starts only approved drafts.
Each layer is approved by its owner (ADR-0045): --layer discover by product,
--layer design by the architect, --layer tasks by the developer; without
--layer, the layers you own. harness.config.yaml says who holds each role
and how many people a layer needs — roles: { product: [ana@acme.eu] },
approvals: { quorum: { design: 2 }, required: layered } (layered is the
default; always, or never for the 0.27 behaviour). A role nobody is named
for is open to anyone. Each approval goes in the change's approvals.json.
- Approving needs a terminal.
change approverefuses when its input is not a terminal (approve_needs_person), and an agent's tool has none. A person runs it in a terminal, or approves in the studio's Review.SPECGATE_ASSUME_TTY=1exists for scripted tests, not for agents. - Approval seals the requirements. Each requirement is recorded by its
hash. One changed after approval fails the gate
(
approved_requirement_changed) until a person approves it again; editing a layer asks for its approval again too. - The design sets the scope. A new source file that no approved design
names is reported (
file_outside_design, gate rulescope).
apply refuses a requirement of a change no person approved
(change_not_approved), and the harness skips an unapproved change.
Then apply#
specgate apply REQ-014 ✖ REQ-014 REQ-014 has no test that names it yet (TDD-1). [apply_no_test]
fix: write a test that names REQ-014 (and its scenario SCN-014), then run specgate apply REQ-014Write the test first, naming the requirement (the link), then the code; run it again:
✔ Specification the gate, for REQ-014
✔ REQ-014 → Implemented (1 row updated)The gate is the same as check's: validate --strict for the requirement,
your architecture check (arch_cmd) and your tests (test_cmd). Nothing is
written while it fails. The status goes into the change's delta
(<!-- specgate:trace status=Implemented -->). Without an id, apply takes
the next requirement status names. apply does not commit: commit after it.
Sealed acceptance tests#
A change can also carry acceptance tests written by someone other than the implementing agent, approved by a person and sealed, so the agent cannot change them: Sealed acceptance tests.
6. Archive it#
Archive when every requirement the change adds or modifies is Implemented, on
your branch, before you open the pull request. Before that it refuses, and
--force does not skip this:
✖ add-dynamic-pricing Change 'add-dynamic-pricing' has 1 requirement(s) not delivered yet: REQ-014. [archive_requirements_pending]
fix: specgate apply REQ-014Preview first:
specgate archive add-dynamic-pricing --dry-run Archive plan ───────────────────────────────────────────
~ docs/specs/capabilities/pricing/spec.md spec
~ docs/specs/traceability.md traceability
→ docs/specs/changes/add-dynamic-pricing moves to docs/specs/changes/archive/2026-10-19-add-dynamic-pricingNo feature file in the plan: change approve wrote it. Unticked tasks in
tasks.md are a warning (archive_tasks_incomplete); --force archives
anyway, once every requirement is delivered. Then:
specgate archive add-dynamic-pricing ✔ Archived as 2026-10-19-add-dynamic-pricing
Specs 1 added · 0 modified · 0 removed
Traceability 1 row(s) added · 0 updated · 0 removed
Features 0 materialisedFeatures 0 materialised is expected, for the same reason. The delta is
merged into docs/specs/capabilities/pricing/spec.md; the row arrives delivered:
| REQ-014 | SCN-014 | `features/pricing/REQ-014.feature` | UC-007 | CMD-011 | AGG-Pricing | EVT-PriceApplied | - | test/pricing.test.js | Implemented |The spec and its code reach review in one pull request, after the gate passed; a test that disproves the spec text is fixed in the same change.
When the change modifies a shipped requirement#
A MODIFIED requirement is pending again while the change is open: status
lists it as needing a test for its new scenarios, and archive waits
for it like any other. When it is delivered, by apply or by the harness,
its test should name every one of its scenarios — a warning under the
standard preset (rule coverage), an error under the strict one. Two requirements modified
by the same change are delivered one at a time; neither waits for the other.
Archiving then rewrites the feature file from the delta
(archive_feature_regenerated).
If the feature file holds scenarios that are not in the delta (written by
hand, or removed by the change), archiving leaves it alone and says which
scenarios it lacks (archive_feature_stale).
With domain packs#
An upstream pack upgrade can be reviewed as a change (specops diff --as-change --pack-version v0.2.0), a local change sent back to the pack (specops contribute --change <id>), and drift from the installed pack fail CI
(validate --against-lock): Domain packs.
Have an agent draft a file#
specgate change author has an agent write one file of a change — the
proposal or the delta — confined to the change folder:
specgate change author add-dynamic-pricing --artifact specs --agent "claude -p < {prompt_file}"The prompt is specgate change instructions rendered for an agent: the same
template, rules and reserved ids a person gets (profiles: Choosing and
wiring your agent). Anything written outside
docs/specs/changes/<id>/ is undone; it refuses a dirty tree, so commit
first; --dry-run prints the prompt and writes nothing. To draft from a brief
or a ticket: From a client brief ·
From a Jira ticket.