Tag Archive for: agent

Posts

Agentic Scrum, Part 3 of 5: Write Specs a Coding Agent Can Actually Follow

This is part 3 of 5 in the Agentic Scrum series. Part 2 covered value.md and requirements.md, the two files that humans write.

This part follows them into the first agent steps, the specification agent and the coding loop. Part 4 deals with testing.

 

Once requirements.md is approved, the Specification Agent takes over. Its job is to translate requirements written for people into instructions written for a coding agent.

Those are different audiences. People forgive vagueness and fill gaps from context. A Coding Agent fills gaps too, but it does so confidently and in a direction you did not choose. 🙂 

 

What the Specification Agent reads and writes

The agent reads value.md, requirements.md, AGENTS.md and the parts of the codebase the feature touches. It writes agent-spec.md and a first handover.

It does not write feature code. The spec is the contract between the human decisions upstream and the machine work downstream, so it has a fixed structure.

# Invoice export: agent specification
--
## Goal
Let a signed-in user export all invoices of a chosen period in one action.

## Read first
specs/042-invoice-export/requirements.md
guardrails/coding.md
guardrails/limits.md
src/invoices/ (the existing invoice service client)

## Requirements covered
R1, R2, R3, N1, N2, N3, F1, F2, F3

## Tasks, in order
1. Add an export service that reads invoices through the existing client.
2. Add the two format writers behind one interface.
3. Add the export endpoint and wire up access logging.

## Interfaces and contracts
Endpoint: GET /exports/invoices with the parameters from, to and format.
Success: the user downloads a file.
Empty period: the response states that no invoices were found, no file is created.

## Constraints
Follow guardrails/coding.md. No new dependencies. No new tables.

## Definition of done
Build passes. Lint passes. The existing test suite passes.

## Out of scope
Scheduled exports. Any other format.

## Stop and ask when
A requirement contradicts existing code behavior.
A task needs changes outside src/invoices/ and src/exports/.

—

Every section has a job.

  • “Read first” tells the agent which context to load instead of letting it wander through the repository.
  • “Requirements covered” carries the IDs from Part 2, so Part 4 can trace tests back to them.
  • “Tasks, in order” keeps each step small enough to fit the diff limit in limits.md.
  • “Definition of done” has to be commands a machine can run, not adjectives.
  • “Stop and ask when” turns uncertainty into a break in the loop instead of a guess.

Sounds familiar? This works with any SDLC around, especially with the one I have been using and writing about.

 

How developers validate a spec

Developers review the spec in a pull request on the specs folder, and this is the step that takes the place of code review in this model.

It is shorter and more valuable than reading a diff, because a mistake in a spec costs one sentence to fix and a mistake in code costs a feature.

Reading a spec takes ten minutes. Reading a diff from an agent that burnt a few hundred thousand tokens in the morning takes an afternoon or more.

I ask reviewers to look for five things. Ambiguous words like “appropriate” and “fast”. Assumptions the spec does not state. Failure modes from requirements.md that no task covers. Tasks too big to review as one change. And a definition of done that a machine cannot check. When any of these shows up, the review does not patch the spec by hand. It goes back to the specification agent with the comment, and the spec gets regenerated.

AGENTS.md and the guardrail files

AGENTS.md sits at the repository root and gives every agent the same orientation. A project map, how to build and check, the conventions, and the few non-negotiables.

Keep it under a page. Every agent loads it on every task, so every extra paragraph costs context each time. The commands below are placeholders, so swap in your own.

# AGENTS.md
--
## Project map
src/ application code. 
tests/ test code. specs/ specifications.
guardrails/ rules for agents. ## Build and check Build: make build Lint: make lint Existing tests: make test ## Conventions Follow the structure of the module you are changing. Prefer the existing client libraries over new ones. ## Non-negotiable Never edit specs/ or guardrails/. Never commit secrets. If the spec and the code disagree, stop and write a handover.
--

guardrails/coding.md holds the coding rules, such as error handling, logging and forbidden APIs, and guardrails/limits.md holds the budgets I showed in Part 1. The same two-layer rule applies as before. The agent reads the rule so it understands it, and CI, protected paths and code owners enforce it so it holds when the agent does not.

The development loop

The coding agent works on its own branch. It reads the spec, the guardrails and the latest handover, then implements one task at a time. After each task it runs the definition of done, fixes what fails, and repeats.

It stops when the work is done, when a limit from limits.md is hit, or when a stop condition from the spec triggers. Or when it runs out of tokens or hits a budget cap.

One design choice here is deliberate. The coding agent does not write or change the tests that count. It runs the build, the linter and the existing tests so it cannot break what is already there, but the new tests belong to the QA agent in Part 4.

If one agent writes both the code and its tests, the tests are derived from the code it just wrote, so they confirm what the code does instead of what the spec asks.

Important

Never ask the coder to do the testing

Never ask the coder to verify its code for security issues

 

The handover

Every stage ends by writing a handover, and the next stage reads that file plus the spec, never the previous chat. This is a realistic one from a loop that stopped early.

# Handover 02: coding agent

## Asked
Implement tasks 1 to 3 of agent-spec.md.

## Done
Tasks 1 and 2. Task 3 partly: the endpoint exists, access logging is missing.

## Deliberately not done
Scheduled exports (out of scope).

## Files changed
src/exports/service.ts, src/exports/writers.ts, src/exports/endpoint.ts

## Checks run
Build: pass. Lint: pass. Existing tests: pass.

## Open questions
R2 says invoices of the signed-in customer account.
The invoice client filters by user id. Which one is correct?

## Stop reason
Open question blocks task 3. Needs a product owner or developer decision.

Look at the stop reason. A handover that says everything went fine is welcome, but a handover that says “I stopped because I did not know” is the reason this pipeline works.

The question reaches a human, gets answered in requirements.md where it belongs, and the spec is regenerated. It never turns into a line of code nobody noticed.

 

Previous: Part 2, Describe the Value. Next: Part 4, Tests Are the New Code Review.

The post Agentic Scrum, Part 3 of 5: Write Specs a Coding Agent Can Actually Follow first appeared on Sorin Mustaca: Security-AI-Software.

Agentic Scrum, Part 2 of 5: Describe the Value

Introduction

This is part 2 of 5 in the Agentic Scrum series. Part 1 explained the whole loop and why the product owner stopped being a vending machine. This part covers the first two steps, the only ones with no agent in them. Then we move on to specs and the coding agent.

The first two steps of the pipeline have no agent in them, and that is deliberate. This is where the most expensive mistakes get made, because a wrong sentence here is multiplied by every step downstream. A coding agent will build the wrong thing at full speed and with excellent formatting.

What the product owner writes

The product owner writes one file per feature, called value.md, and it fits on a page. It answers six questions:

  1. who has the problem
  2. what the problem is
  3. what changes for them when we solve it
  4. how we will know it worked
  5. what we are explicitly not doing
  6. which business constraints apply
  7. Optional: are there any open questions, which we can’t or don’t want to answer now?

It does not say how the screen looks. It does not name a button. The moment a value statement contains the word “dropdown”, somebody has started designing, and designing is a conversation for developers and UX that happens later, with more information.

Here is a made-up example, so the numbers are illustrative. I have left many potential details that would make up a real feature definition on purpose. I am not trying here to define a new (imaginary) product, only to show you the format, the headings and the type of language to use.


value.md:

# Invoice export
## Who has the problem Finance clerks at our larger customers.
## The problem Closing the month means exporting invoices by hand, one customer at a time. In interviews, clerks called this the slowest part of their close. ## What changes for them They get all invoices for a period in one step, in a format their accounting system accepts. ## How we will know it worked Support tickets about manual invoice export drop. Time from "close started" to "export done" falls under one hour for the customers we interview again. ## Out of scope Scheduled exports. Formats other than the two named in requirements.md. ## Business constraints Must never expose invoices across customer accounts. Ships before our customers' fiscal year-end. ## Open questions Do customers need credit notes in the same file?

 

 

I make “Out of scope” a required section, because agents are enthusiastic. Ask one for an export and it may also build a scheduler, a settings page and a small dashboard nobody requested. Writing down what we are not doing is the cheapest feature work in the whole process. The section “How we will know it worked” has to be observable too. A number, a ticket count, a behavior someone can watch. “Better user experience” is a wish, not a measure. That section comes back in Part 5, when the product owner checks at the final gate whether the value actually arrived.

What the developers add

Developers turn value.md into requirements.md. They do not rewrite the value, they translate it. Every requirement gets an ID, because Part 3 and Part 4 trace specs and tests back to those IDs, and that traceability is what lets us stop reading code. A good requirement is a sentence a stranger could check. The export contains all invoices of the selected period, and only those of the signed-in customer.

The file also holds interfaces and data, non-functional requirements for performance, security, privacy and availability, failure modes, assumptions and risks. This is where the 40,000 records question lives.

What happens with 40,000 invoices? With none? With the network dropping halfway? With a customer whose name contains an apostrophe and a snowman? Developers are professionally suspicious, and this is the step where that trait earns its salary.

requirements.md:

# Invoice export: requirements

## Functional requirements
R1 The user can export all invoices of a chosen period in one action.
R2 The export contains only invoices of the signed-in customer account.
R3 The export is available in the two named accounting formats.

## Interfaces and data
Reads invoices through the existing invoice service. No new tables.

## Non-functional requirements
N1 An export of 40000 invoices finishes within 5 minutes.
N2 Every export is logged with user and period.
N3 The export file is not stored after download.
N4 Only one export can be served at a time. ## Failure modes F1 No invoices in the period: the user sees an explicit empty result. F2 Invoice service unavailable: retry message, no partial file. F3 Export interrupted: nothing is left on the server. ## Assumptions and dependencies A1 Invoice service response times stay as they are today.
A2 The operator is already logged in and authorized to download. ## Risks R1 Large exports may load the invoice service during month-end peaks.
R2 Export requests will by queued, potentially slowing down the overall delivery.

The gate between humans and agents

Nothing goes to the specification agent until requirements.md is approved by the product owner and by a developer who did not write it. I run this as a short value review of 30 to 45 minutes, with the product owner, the developers who will own the feature, and QA or the security specialist when the feature touches their areas. The product owner asks whether the requirements still mean what was meant. The developers ask whether the value is clear enough to build against.

The questions are boring on purpose. Can a stranger tell when this is done? Is there a number or an observable behavior under “how we will know”? Is any requirement a solution in disguise? Does “out of scope” contain something? Approval happens as a pull request on the specs folder. The merge is the approval, the discussion is the record, and nobody has to remember what was agreed in a meeting three weeks ago.

This gate is also the brake that Part 1 promised. Agents are fast, so the limit has to sit on the humans’ work in progress. I cap the number of features in flight per team, and I would start with two, which is my guess and not a benchmark. When both slots are taken, nothing new enters until one of them clears the final gate. The product owner no longer has to out-write the agents. The product owner has to stay two value statements ahead, which is a job a person can actually do.

 

Who writes the backlog now

The backlog now holds value statements, which cost far less to produce than the full stories of the old days. Developers draft them too, for technical enablers like refactoring, performance work and security hardening, because they see those needs first. The product owner keeps the one decision that cannot be delegated, which is priority, and approves or rejects what developers propose.

I also reserve a slice of every sprint for discovery. Developers read support tickets, talk to a customer-facing colleague or prototype an idea. The output is a better value.md or the deletion of a planned one. Deleting a feature before an agent builds it is the cheapest delivery you will ever make.

How this goes wrong

Three failure patterns show up early.

  • The first is the value statement that is a design in disguise, usually something like “design a green page with a blue button in the middle of it called ‘Download’”.
  • The second is requirements that copy the value text and add nothing, which means nobody did the thinking.
  • The third is the absent product owner. If the product owner is not available, the pipeline stalls. That looks like a problem, but it is the system working, because an agent guessing the missing answer is far worse than a feature waiting a day.

 

Previous: Part 1, The Product Owner Is Not a Vending Machine. Next: Part 3, Write Specs a Coding Agent Can Actually Follow.

The post Agentic Scrum, Part 2 of 5: Describe the Value first appeared on Sorin Mustaca: Security-AI-Software.

Agentic Scrum, Part 1 of 5: The Product Owner Is Not a Vending Machine

Agentic Scrum, part 1. 

Introduction

My developers consume user stories faster than any product owner can write them. A story that used to fill a sprint now takes an afternoon, because a coding agent writes the code, the tests and a very confident commit message. The backlog looks like a fridge the night before a vacation. Some mustard, one lonely epic, and a login story that has been there since spring.

Asking the product owner to write more stories treats the symptom. When coding is nearly free, the scarce things are a clear statement of what to build and a trustworthy way to know it was built correctly. So I stopped feeding agents stories and started feeding them specifications, with humans owning the decision at every gate.

The pipeline

The product owner describes business value and nothing else. Who has the problem, what changes for them, how we will recognize success. No field lengths, no button colors. Developers translate that into technical requirements: constraints, interfaces, data volumes, the things that break at 40,000 records. A specification agent turns those requirements into agentic specs written for the coding agent. Developers validate the specs, and only then does the development loop start.

Once code exists, a QA agent reads the specs and the generated code and drafts test specifications. QA engineers and developers validate those first, and only after approval does the QA agent write the actual tests. In parallel, a security and compliance agent checks the code. The results of both go to developers, a security specialist and the product owner, each judging what they are qualified to judge. Developers look at technical soundness, the security specialist at risk, and the product owner at whether the original business value actually arrived.

Here is the whole loop in one picture:

 

Anyone can break the loop

At any gate a human can stop the process and send it back one step or several. A failed test may expose a vague spec, a vague spec may expose a missing technical requirement, and a missing requirement may expose a business value nobody can deliver. The rule is that the earliest artifact responsible for the problem gets fixed first, and everything downstream is regenerated.

Agents can break the loop too, and I want them to. An agent stops when the spec is ambiguous, when two documents contradict each other, when a limit is reached, when a test cannot pass without changing the spec, or when a security finding crosses a threshold. It writes down why it stopped and hands the problem to the human who owns that step. What an agent may never do is quietly rewrite the spec to make its own life easier. It can propose a change in a file. A human decides. Without this rule you get an agent that “fixes” a failing test by deleting the requirement behind it, which is efficient in the same way that cancelling your gym membership is a fitness plan.

Everything lives in the repository, and everything is markdown

Value statements, technical requirements, agent specs, test specs, handovers, guardrails and limits all sit in the same repository as the code, under version control, and all of them are markdown. Humans read markdown in a pull request diff without any tooling, and agents read it without a parser. Chat history is not a source of truth, because it disappears when the session ends and nobody can review it. A file in git has an author, a diff and a history.

It also settles who reviews what, now that humans no longer read generated code. People review pull requests that change specs, test specifications, guardrails and limits. Those files decide what the agents build, so they get the human eyes. A layout like this works for me. The names are my convention, not a standard, so adapt them.

AGENTS.md
specs/
  042-invoice-export/
    value.md
    requirements.md
    agent-spec.md
    test-spec.md
    handovers/
      01-spec-agent.md
      02-coding-agent.md
      03-qa-agent.md
      04-security-agent.md
guardrails/
  coding.md
  qa.md
  security.md
  limits.md
  controls/
    iso27001-mapping.md

Each agent reads a small, fixed set of files and writes a small, fixed set. The diagram shows which is which, in the order the work happens. Security runs in parallel with QA, so its row sits below only for the sake of the page.

A chain of human and agent steps with the markdown file each step produces between them. Guardrail files feed the agents from the side. QA and security run in parallel and merge into a final validation. 

AGENTS.md is a convention that several coding agents read from the repository root, and some tools use their own file name instead, so check what yours picks up automatically.

The security agent reads the control mappings, which means a requirement from ISO 27001 or NIS2 becomes a check that runs on every change instead of a spreadsheet someone opens before an audit.

Guardrails and limits

Guardrails come in two kinds, and the difference matters. The first kind is text the agent reads, like “never add a dependency without approval”. That is a request to a model, and models usually comply but are not obliged to. The second kind is enforcement outside the model: tool permissions, protected paths, CI checks that fail the build, branch protection, and code owners on the guardrail files themselves. A guardrail that exists only in markdown is a polite sign on an open gate. Write the rule in the file so the agent understands it, and enforce it in the pipeline so it holds when the agent does not.

My limits.md is plain markdown with a heading per topic and one rule per line. This is a trimmed example.

# Limits for the coding agent

## Budget
Maximum iterations in the development loop: 5
Maximum changed lines per task: 400
Maximum wall-clock time per task: 60 minutes

## Forbidden
Do not edit files under specs/ or guardrails/.
Do not edit or delete a test to make it pass.
Do not add a dependency without approval.

## When a limit is hit
Stop. Write a handover with the reason. Do not try a different approach.

I picked those numbers as a sensible first guess, not from measurements, so tune them against your own teams. Changes to limits.md need approval from the security specialist through a code owners rule, which means the agents cannot loosen their own leash.

Handovers

Every stage ends by writing a handover file, and the next stage reads that file plus the spec, never the previous conversation. The handover has fixed sections: what was asked, what was done, what was deliberately not done, which files changed, which checks ran with their results, open questions, and the reason for stopping if the agent broke the loop. Chat context dies with the session, but files survive, which is also why a human can pick up any step cold after a weekend.

The trade I made

Humans no longer review code in this model. The attention moves upstream to specs and test cases and downstream to test and security results. That is a deliberate bet, and it has a cost. If a spec is weak or a test misses a behavior, nothing else catches it, because nobody reads the lines that slipped through. I have no data showing this holds across teams, so watch your defect and incident rates for the first few months before trusting the process.

The consumption rate drops because every gate needs understanding instead of a click on approve. The work spreads out. The product owner supplies value and judges outcomes, developers own technical direction and the specs, QA decides what deserves testing, and the security specialist stops being the person who says no on the last Friday before release. The agents still type faster than anyone alive. They just do not get to decide what is worth typing.

This is the first part of five. 

The post Agentic Scrum, Part 1 of 5: The Product Owner Is Not a Vending Machine first appeared on Sorin Mustaca: Security-AI-Software.