specgate/docs v1.8.0

The method#

Specgate is a tool, and the tool encodes a way of working. This page is that way of working: the principles behind it, the four phases a product goes through, the two ways in, who does what, and where each artefact lives. Every step names the command that does it; nothing here is advice the tool does not enforce or produce.

Note

Spec-anchored, not spec-first. The specification is not a prompt written once and thrown away when the code exists, and the code is not regenerated from it. It stays in the repository for the life of the system, next to the code and the tests that prove it, and every change to the system changes it first.

Six principles#

  1. The specification lives in the repository. Numbered requirements with Gherkin scenarios, reviewed in pull requests like code, versioned with it. → Concepts
  2. Nothing is done until a test proves it. A requirement is Implemented only when a test names it and the gate passes; specgate apply writes nothing otherwise. The same gate runs locally and in CI. → Validating
  3. Ambiguity is asked, never guessed. A draft from a brief or a ticket is held to its source text; every value nobody gave becomes an assumption or a question, and the requirement it blocks waits for the answer. → From a client brief
  4. The specification changes first. New work, a bug or an enhancement opens a change; the code follows the delta, never the other way round. → Change a shipped requirement
  5. The agent works inside the same rules. It gets the same loop, a test before the code, a gate it cannot talk round, files it may not touch and decisions it must leave to a person. → The harness
  6. The people who decide can read it. A change becomes a page anyone can open; acceptance is signed by a person; the guide is written per actor. → Review with the business

A perfect specification is neither possible nor needed. What the method asks for is a specification that can be wrong — every requirement concrete enough to be checked — and a gate that says so the moment it is.

Four phases#

The phases overlap and repeat: a product is in all four at once, one change at a time. What separates them is the question being answered.

PhaseThe questionWhat comes out of itCommands
StartWhat are we building, or what is already there?A brief, its actors and modules; or the existing modules and a baselineinit, propose --from-brief --new-brief, reverse --modules, check --baseline
ShapeWhat exactly must it do, and what have we decided?Requirements and scenarios in a change, answered questions, ADRs, the glossary and business rulespropose, questions, answer, change approve, adr, stack, review
BuildDoes it do it?Tests that name each requirement, code, a green gatestatus, apply, harness run, check
Hand overDoes the business accept it?The change archived into the specification, release notes, a signed acceptance, a guide per actorarchive, release-notes, acceptance --sign, guide

Start#

For a new product, the client's brief is saved as docs/brief.md: specgate propose --from-brief --new-brief writes one to fill in, and specgate propose --from-brief names its modules and the next one to draft. For a system that already runs, specgate init adopts the repository without touching its code, specgate reverse --modules lists its modules, and specgate check --baseline records today's findings so that only new ones fail.

Shape#

A change is opened — specgate propose <id>, --from-brief <module>, --from-ticket <KEY>, or specgate reverse <module> for existing code — and its delta holds the requirements it adds or modifies. Questions only the client can answer go to the change's questions.md (specgate questions, specgate answer). Decisions that outlive the change are recorded as ADRs (specgate adr new), and what the agent may decide alone is written in docs/specs/decision-rights.md. Words are fixed in the glossary, rules are numbered BR-NNN.

A change has three layers, each owned by a role (ADR-0044):

LayerOwnerSays
discover.mdproductWhy, the use case, and the acceptance criteria AC-1, AC-2…
design.mdarchitectHow each criterion is met: modules, mechanisms, channels, decisions
tasks.mddeveloperThe work, each task naming the requirement it delivers

Before building, specgate review <change> gives the people who decide one page to read, and each layer is approved by someone who holds its role — specgate change approve <id> --layer discover|design|tasks, or Approve in the studio. Approving is a person's act: the command refuses a session with no terminal, as an agent's tool is. specgate apply refuses a requirement of a change no person approved (change_not_approved), and the harness builds a change only once its layers are approved. Approval seals each requirement by its hash; editing one, or a layer, asks for its approval again.

Build#

specgate status names the next requirement. A test that names it comes first; then the code; then specgate apply, which runs the gate for that requirement and marks it Implemented only if it passes. The harness does the same unattended: one requirement, one worktree, one agent — optionally a tester and an implementer — and only what passes the gate is kept. specgate check runs the whole gate before every pull request and in CI.

Hand over#

Once every requirement of a change is delivered, specgate archive merges it into the specification, on its branch, so the spec and the code reach review in one pull request. specgate release-notes <from>..<to> writes what changed for the business, grouped by bug and enhancement. specgate acceptance <change> writes a checklist of the acceptance criteria and of each scenario; a person checks each item and signs with --sign, and the change's Implemented requirements become Verified. specgate guide writes a user guide per actor from what was delivered.

Iterations#

An iteration is a handful of changes taken from shaped to handed over. Short is the point: the gate keeps the specification true at every step, so nothing is saved up for the end — no big specification up front, and no documentation sprint afterwards. Each iteration ends with the people who decide reading the review page or the studio, and the next one starts from their answers.

Two ways in#

Work arriving as Jira tickets enters the same way, through specgate propose --from-ticket. → From a Jira ticket

Who does what#

RoleDoesThrough
Client or product owner (role product)Answers questions, writes and approves the Discover, reads the review page, signs acceptanceanswer, change approve --layer discover, review, acceptance --sign, the studio
Architect (role architect)Writes and approves the Design, records decisionschange approve --layer design, adr, stack
AnalystWrites and reviews requirements, scenarios, the glossary, business rules and journeyspropose, deltas, validate
Developer (role developer)Approves the Tasks, writes the test first and the codechange approve --layer tasks, apply, check
ReviewerReads the delta, its scenarios and its tests in the pull requestthe pull request
AgentDrafts from a source, builds a requirement, asks when it may not decidepropose --from-brief, reverse, harness run, ask

One person often holds several roles. Who holds product, architect and developer is written under roles: in harness.config.yaml; a role nobody is named for is open to anyone (Lanes, roles and limits). In the studio served to a team, a reader reads, an editor's changes arrive as pull requests, and an admin runs builds → The studio for a team.

Where each artefact lives#

ArtefactWhereWritten or generated
The briefdocs/brief.mdWritten
Requirementsspec.md, docs/specs/capabilities/<capability>/spec.mdWritten, through changes
Scenarios and journeysfeatures/**/*.featureScenarios written by archive from the deltas; journeys by hand
An open changedocs/specs/changes/<id>/ — discover.md, design.md, tasks.md, the delta, questions.md, acceptance.mdWritten
Approvals of a changedocs/specs/changes/<id>/approvals.jsonWritten by change approve, per layer and version
Traceability matrixdocs/specs/traceability.mdGenerated from what the tests name, or kept by hand
Glossarydocs/specs/glossary.mdWritten
Entity model, actorsdocs/specs/model.md, docs/specs/actors.mdGenerated
Decisionsdocs/specs/adr/, docs/specs/decision-rights.md, docs/specs/stack.mdWritten; the stack file generated, then kept
Gate baselinedocs/specs/gate-baseline.jsonGenerated by check --baseline
Review page<change>-review.htmlGenerated
User guidedocs/guide/<actor>.mdGenerated
Release notesprinted, or --out <file>Generated
A workspace of repositoriesspecgate.workspace.yaml in its own repository; a story per docs/stories/<id>/story.mdWritten (Workspace)

A requirement's life#

Draft owes nothing yet; Approved and the statuses after it owe a test that names the requirement; Implemented is set by apply once the gate passes; Verified by a signed acceptance; Released when you mark it (specgate done <REQ> --status Released); Deprecated owes nothing again. A requirement waiting for the client is Needs Clarification and cannot be closed by anyone until it is answered. → A status is a promise

Next#