jonnifyagile agents
jonnify / Agile Agent Workflow / A1 · Why / A1.04 / A1.04.2 · The spec layer

A1.04 · Two layers · dive 2

The spec layer

The spec layer is where correctness lives: for one rung, the precise definition plus its proof — and the hub the rest of the work derives from.

The user stories, the agent brief, the code, and the tests all come from the spec. It is the single source of truth, and only feedback edits it. Switch the view on the right to follow one artifact back to the spec it derives from.

Everything derives from the spec · switch the view

the spec single source of truth the user stories derived from the spec the agent brief derived from the spec the code built to the spec the tests built to the spec arrows point out from the spec · nothing edits a derived artifact directly
The user stories are derived from the spec: the spec is the source, the story its negotiable face. Nothing edits the story directly — change the spec and the story is regenerated.

What the spec layer is

The spec layer answers one question for each rung: what we build and how we know it is right. It holds the spec, its user stories, and the agent brief — the precise definition plus its proof. It is the single source of truth, and the only thing that edits it is feedback.

Everything else is downstream. The user stories and the agent brief are derived from the spec; the code and the tests are built to the spec. Nothing edits a derived artifact directly: a change happens in the spec, and the stories, the brief, the code, and the tests are regenerated from it. That is what keeps the spec authoritative — the moment a story or the code is edited in place, it forks from the spec, and the spec becomes a document that lies about the system (the A1.02.1 drift, between the spec and what it specifies).

spec layer
What we build and how we know it is right: for each rung, the spec, its user stories, and the agent brief. The single source of truth; edited only by feedback.
derived
The user stories and the agent brief come from the spec; the code and tests are built to it. Nothing edits a derived artifact directly — change the spec, regenerate.
single source
One place a change is made, from which every downstream artifact follows. When it is not single, a derived artifact forks and the spec starts to lie.
two faces
A roadmap item is the coarse face of a rung; its spec is the fine face. Same rung, two granularities (the next section).

The roadmap layer (A1.04.1) plans how we deliver and changes often; the spec layer defines what is right and changes slowly — because everything downstream depends on it.

The same rung, two granularities

The roadmap and the spec are not two different things — they are two granularities of the same rung. The roadmap holds the coarse face: one line and a definition of done, enough to order the work and demo against. The spec holds the fine face: the full contract — the precondition, the postcondition, the invariant — enough to build to and prove. One rung, two layers; the spec is the one where correctness lives.

Switch the view to render one rung at both granularities. The line is what the roadmap carries; the contract is what the spec carries. The roadmap line is mutable and re-ordered as priorities move; the contract is fine and authoritative, and it changes only through feedback.

One rung at two granularities · switch the view

rung: a branded id a branded id DoD: decodes to its type the coarse face · one line, enough to order the work and demo against
Same rung, two layers: the roadmap holds the coarse face (one line + a definition of done); the spec holds the fine face (the full definition and its acceptance). The spec is where correctness lives.

A roadmap item and its spec are one rung at two zoom levels — coarse to order and demo, fine to build and prove.

The spec layer on the Portal

On the Portal — the learning platform this course builds — take the rung “one branded id”. Its spec is the id contract: a 14-character TSK… id, decodes to its type, unique within a node-millisecond. From that one spec everything derives. The user story is its negotiable face: “as a caller I receive a typed id I can decode.” The agent brief tells the Author how to build it. The implementation Portal.ID.generate/1 satisfies it, and the tests accept it.

Now feedback arrives — “also sort by time.” The change lands in one place, the spec; then the story, the brief, the code, and the tests are regenerated from the edited spec. Nothing is patched in isolation, so nothing forks. The spec stays the one fine, authoritative face every other artifact is built from.

# The spec for the rung "one branded id" — the single source of truth.
#   pre:  type ∈ {:user, :event, :session, ...}
#   post: 14 chars · decodes to that type
#   inv:  unique within a node-millisecond

# Derived: the user story (the negotiable face) and the agent brief come FROM the spec;
# the code and tests are built TO it. Nothing edits a derived artifact directly.
id = Portal.ID.generate(:user)        # => "USR0NbAb1xcFCy" (built to the spec)
assert Portal.ID.decode(id).type == :user   # the test accepts to the spec

# Feedback: "also sort by time" → edit the spec, regenerate everything downstream.

The principle

Define correctness once, in an authoritative spec everything derives from. One source; feedback edits it; the downstream artifacts are regenerated, never patched in isolation.

On the Portal

The id contract is the spec. The user story, the agent brief, Portal.ID.generate/1, and its tests all derive from it — and a change lands in the contract, then propagates.

The spec is the single source of truth — the one fine, authoritative face of a rung that every other artifact is built from, and the only one feedback edits.

Recap — one hub, everything derives

The spec layer is where correctness lives: for one rung, the precise definition plus its proof. The user stories and the agent brief are derived from it; the code and the tests are built to it; nothing edits a derived artifact directly. It is the fine face of a rung whose roadmap line is the coarse one — same rung, two granularities — and it is the single source of truth, edited only by feedback. With both layers in hand, the closing dive draws the rule that holds them together.

Next in A1.04: A1.04.3 · The single source of truth — the rule that the spec is edited only by feedback, and the drift that follows when a derived artifact is edited instead.

References

Primary sources for the spec as the derived-from hub, and where it connects in the course.

Sources

Related in this course