JournalSpec-driven development: requirements as a typed graph
Agentic SDLC

Spec-driven development: requirements as a typed graph

Kiran AbrahamFounding Principal Engineer, Orlian
Published
Reading time
7 min
Topic
Agentic SDLC
In short
  • 01A typed spec gives every requirement, rule, policy and open question an ID, a type and links, so a change shows what it touches.
  • 02Agents draft the nodes and named people approve them, and the product owner signs the graph at the Plan gate before Build reads it.
  • 03Each task loads only its linked nodes, because model reliability drops as input grows and when facts sit in the middle.
  • 04Nodes are versioned, so moving the return window from 30 to 45 days flags two tests, a requirement, a question and a ticket.
  • 05Two rules that conflict become an open question that blocks the requirement until a person decides at the Plan gate.
  • 06The graph grows with requirements but agents read it in slices, and adoption starts with one feature and one change.
  • 07Skip it for small fixes and prototypes. It pays when rules span services, several teams edit them or someone asks for traceability.

Spec-driven development works best when the spec is a graph of typed nodes that agents can query. Every objective, business requirement, rule, policy and open question gets an ID, a type and links to the things it affects. Tests and tickets point back at those IDs, so a change to one rule shows which tests and code it touches. Teams weighing this approach for an AI SDLC tend to ask the same eight questions. This post answers each with an example from Order Hub, an illustrative project. For the lifecycle around the spec, start with What is an agentic SDLC?

On 19 July 2024 a faulty content update from CrowdStrike sent more than 8 million Windows systems into reboot loops. Its root cause analysis traced the crash to a template type that defined 21 input fields while the integration code supplied 20. The content validator checked updates against the 21-field definition, so each check passed against a description that the running code did not match. The definition and the code that consumed it were verified separately and no check compared the two before release.

01What is a typed spec, in one example?

A typed spec is a set of requirement nodes in which every node has a type, an ID and explicit links to the nodes it depends on. Figure 1 shows one Order Hub requirement, the return of an item, with the goal it serves, two rules, a policy, two test cases and one open question.

A requirement sits in a typed graph with its rules, tests and open items
GoalFaster returns
RequirementReturn an item inside the window
Rule30-day return window counted from delivery
TestDay 30: accepted
TestDay 31: refused
Open questionBackorder pause?
RuleRefund to same method
PolicyRefund approval limit

Arrows point toward what an item serves: tests verify rules, a policy governs a rule, rules constrain a requirement and a requirement serves a goal.

Dashed box: an open question that blocks its rule. Shaded box: the rule traced in Figure 2.

Figure 1 · Order Hub return requirement, 8 typed nodes and 7 links

The types decide what a link may mean. A test case can verify a rule and an open item can block one until a person closes it. The same facts in a PDF would sit in a sentence on page 41, a table on page 52 and an appendix and a reader would search for all three before changing any of them. Order Hub is an illustrative project.

02Who writes and edits it?

Agents draft the nodes and named people approve them. The business analyst agent (#0216) drafts requirement and rule nodes from the analysis and the brief and the QA analyst agent (#0264) drafts the test cases that point at those rules. Any agent can raise an open question, such as whether the window pauses for backordered items and a person closes it with an answer.

The product owner signs the graph at the Plan gate before the Build wing reads a node. People edit the graph directly as well. A product owner who changes the return-window rule from 30 days to 45 edits one node and the edit follows the same path as any agent change: a new version of the node, a list of the links it touches and a review (question 4).

03How do agents read it without overloading context?

Each task pulls only the nodes linked to it. A build ticket for the return window loads the rule, its requirement and goal, its two test cases and its open question and leaves the rest of the spec out.

Keeping the pack small has measured support. In Lost in the Middle, Liu and colleagues found that model performance is often highest when relevant information sits at the beginning or end of the input and drops when it sits in the middle, including for models built for long contexts. Chroma's Context Rot report found that the reliability of current models falls as input length grows, even on simple tasks.

A typed spec turns those findings into a design rule: walk the links, load the neighbourhood and place the rule and its tests at the start and end of the pack.

04How does it change over time?

Every node is versioned and a change to one node is a diff against the graph. Birgitta Böckeler's analysis of spec-driven development tools separates three levels: spec-first, where the spec is written before the task; spec-anchored, where the spec is kept after the task to guide later changes; and spec-as-source, where people edit only the spec. A typed graph is built for the spec-anchored level, because the links are what make a later change cheap to assess.

Figure 2 follows one edit. The product owner changes the return-window rule from 30 days to 45 and the graph returns the items that depend on it: two test cases to rewrite, a requirement to re-review, an open question to re-check and the build ticket to reopen. The goal, the refund-method rule and the approval-limit policy have no path from the edit and stay as they are.

Changing one rule flags five linked items and leaves the rest alone
Edited
Window rule v430 days becomes 45 by the product owner
Reached by a link
TestDay 30 becomes Day 45: rewrite
TestDay 31 becomes Day 46: rewrite
RequirementRe-review the wording
Open questionRe-check the answer
Build ticketReopened with the new value
No path from the edit
GoalFaster returns
RuleRefund to same method
PolicyRefund approval limit

The only edit is the new version of the window rule. The middle column comes from following its links, so no item depends on someone remembering where the 30-day rule is used.

Figure 2 · One edit to a rule and the five items its links reach

Generated code can differ between runs. Böckeler saw different results when she generated from the same spec several times. The test nodes are what decide whether a new version of the code satisfies the new rule, which is why the two test cases in Figure 2 sit on the list.

05What happens when two rules conflict?

Two rules that constrain the same requirement and disagree become an open question and a person decides between them. Suppose a loyalty programme adds a 60-day window for members while the existing rule sets 30 days for everyone. Both rules constrain the return requirement and their conditions overlap for a member. An agent raises an open question linked to both rules and the requirement shows as blocked until someone closes it.

The product owner resolves the conflict at the Plan gate by narrowing one rule or adding a precedence rule and the resolution is stored as a node with an author. No agent picks a winner. The table compares where the same conflict surfaces in three forms of spec.

Form of specWhat happens to the two rulesWho usually finds the conflict
PDFBoth stay, on different pagesQA or a customer, late
Markdown spec filesBoth stay, in separate filesA reviewer who opens both files
Typed graphAn open question links both and blocks the requirementAn agent, before Build starts

06How big does it get?

Size follows the number of requirements. Figure 1 holds eight nodes for one requirement, so a system with 300 requirements would hold about 2,400 nodes at that ratio. The ratio is illustrative and a live project sets the real one.

Two design choices keep that size workable. Agents read slices of the graph, so the total does not set the cost of a task. People review changes at node level (Figure 2), which avoids the load Böckeler describes when one tool produced "a LOT of markdown files for me to review". The remaining cost is finding things and a graph answers that with queries such as every rule that constrains this requirement.

07What does it cost to adopt?

The effort sits in three places: seeding the graph, agreeing the node types and the product owner's time at the Plan gate. For an existing system, the output of reverse engineering legacy code supplies the first draft of requirements and rules, which people then correct. For a new system the business analyst agent drafts from the brief.

Figure 1 shows the kinds of item a team can start with. A sensible first step is one feature: write its subgraph, put one change through it as in Figure 2 and compare the result with the current process. Teams that want the platform view of spec-driven development can read how Orlian handles AI requirements, specs and test cases and the first 90 days shows where the Plan wing sits in a rollout.

08When should we not use one?

Small bug fixes and prototypes need less than a graph provides. Böckeler found a full spec workflow heavy going for a small bug and questioned whether small work packages suit heavy up-front specs at all. Plain Markdown spec files in the repository are enough when one team owns a short-lived service, requirements change rarely and nobody has to say which test covers which rule.

The graph starts to pay when the same rule appears in several services, when several teams edit requirements or when a regulator or customer asks for traceability from requirement to release. The CrowdStrike mismatch sits on that side of the line. A definition of 21 fields and the code that supplied 20 are two linked nodes in a typed spec and a count that disagrees across a link is a check an agent can run on every change.

09The eight answers at a glance

Figure 3 puts the answers on one page for readers who skim.

10Where Orlian fits

In Orlian the spec is the typed graph described above and it sits at the centre of the AI SDLC. The Plan wing drafts it, a product owner signs it at the Plan gate and each later wing reads the slice it needs. One ID follows every node along the red thread to the ticket, the pull request, the build and the release, so the question behind the CrowdStrike incident, which definition this code depends on, has an answer inside a governed AI SDLC.

Filed underAgentic SDLC
Written by

Kiran Abraham

Founding Principal Engineer, Orlian. Kiran works with engineering teams on reading existing systems before they change them, from the first screen and table through to the code underneath.

The Journal, by email

Get the next field note in your inbox.

We write when we have something worth reading: the method behind the platform, and what we learn delivering with it.

You're on the thread.

Thank you for your interest. The next field note will land in your inbox the moment it's written. We'll send updates, never noise.

That didn't go through. Check the email address and try again, or write to us at hello@orlian.ai.

One email per field note. No noise, and you can unsubscribe anytime.