The loop
Every stage has an input, an output and a gate
Follow one sample ticket, T-1042 “Export button does nothing on an empty report”, from the customer’s words to general availability.
Illustrative: the ticket and every artefact below are examplesStage 1 · agent
Reads the ticket
Takes the customer’s words, attachments and history, and restates the problem.
- Input
- A support ticket as it was raised: description, attachments, environment and earlier replies.
- What the agent does
- Restates the problem in one sentence, keeping the customer’s own words beside it
- Separates what was observed from what was asked for
- Looks for related and duplicate tickets
- Lists what is missing instead of guessing it
- Gate
- Enough to reproduce or describe the problem. If not, a question goes back to the person who raised it and the run waits.
output → A structured intake record
ticket: T-1042
channel: support
quote: "I click Export and nothing happens."
observed: Export is enabled; clicking it has no effect
expected: A file, or a clear reason why there is none
environment:
browser: Safari
page: /reports
steps:
- open Reports
- choose a date range with no data
- click Export
duplicates: none found
missing: nothing blocking
Stage 2 · agent
Classifies and scopes
Decides what kind of change this is, how urgent it is and what it touches.
- Input
- The intake record, plus the component inventory and code ownership of the product.
- What the agent does
- Classifies: bug, accessibility, improvement, feature or question
- Proposes severity and names the owning area
- Maps the problem to components that exist in both design and code
- Writes acceptance criteria that tests can later check
- Gate
- Scope stays inside the rules the team set. Anything outside them, such as billing, permissions or data migrations, is routed to a person.
output → A triage file with scope and acceptance criteria
type: bug
severity: medium
area: reporting
components:
- ExportButton # figma + code
- EmptyState # figma + code
in_policy: true # UI only, no data change
acceptance:
- export is disabled when the report has 0 rows
- the reason is visible, not only a tooltip
- screen readers hear the reason
route: agent # else: assign to a person
Stage 3 · agent
Designs in the system
Resolves the change in Figma using the design system’s own components and tokens.
- Input
- The triage file and the published design system library in Figma.
- What the agent does
- Picks existing components, variants and tokens first
- Draws the changed states: empty, loading, error, focus
- Flags the case where the system has no answer, rather than inventing a one-off
- Records the frame and the component changes in a spec the build stage reads
- Gate
- A parity check: every layer maps to a real component and token. A new component or variant needs a designer’s approval.
output → A Figma frame and a design spec
frame: "Reports / Empty range"
library: product-system
changes:
- component: Button
variant: { kind: secondary, state: disabled }
- component: InlineNotice
variant: { tone: neutral }
text: "Nothing to export for these dates."
describes: Button
tokens:
gap: space.2
text: color.text.muted
parity: pass # every layer maps to code
new_components: 0
Stage 4 · agent
Writes the change
Implements the design against the same components, and writes the tests with it.
- Input
- The design spec, the acceptance criteria and the repository.
- What the agent does
- Works on a branch of its own
- Edits the component the design already named
- Writes a test for each acceptance criterion
- Runs the fast checks locally and fixes what fails
- Gate
- Type check, lint and the new tests pass. The diff touches only what the triage scoped.
output → A reviewable diff with tests
@@ ExportButton @@
export function ExportButton({ rows, onExport }: Props) {
+ const empty = rows.length === 0;
return (
- <Button kind="secondary" onClick={onExport}>
- Export
- </Button>
+ <Stack gap="space.2">
+ <Button kind="secondary" onClick={onExport}
+ disabled={empty}
+ aria-describedby={empty ? "why" : undefined}>
+ Export
+ </Button>
+ {empty && (
+ <InlineNotice id="why" tone="neutral">
+ Nothing to export for these dates.
+ </InlineNotice>
+ )}
+ </Stack>
);
}
Stage 5 · agent
Commits to the repo
Commits with a message that links the ticket, the design and the criteria.
- Input
- The passing branch.
- What the agent does
- Writes one focused commit per concern
- Links the ticket and the design frame in the message
- Opens a pull request that explains what changed and why
- Requests review from the code owners
- Gate
- Branch protection holds. The agent does not push to the main branch or bypass a required review.
output → A commit and a pull request
$ git switch -c fix/T-1042-empty-export
$ git add components/ExportButton.tsx tests/export.spec.tsx
$ git commit
fix(reports): explain why an empty report cannot export
Ticket: T-1042
Design: "Reports / Empty range"
Tests: disabled, visible reason, announced reason
$ git push -u origin fix/T-1042-empty-export
✓ pull request opened, review requested from code owners
Stage 6 · agent
Runs the full test suite
The pipeline runs everything. A red check sends the work back to build.
- Input
- The pull request, run on the team’s own pipeline.
- What the agent does
- Runs lint, types, unit, component, integration and end-to-end tests
- Compares screenshots against the design and checks accessibility
- Scans dependencies and builds the release artefact
- Reads failures, returns to build with the log, and tries again within a set limit
- Gate
- Every required job is green. Tests are never skipped, deleted or weakened to get there.
output → A pipeline report and a build artefact
$ pipeline run --suite full
✓ lint
✓ typecheck
✓ unit
✓ component
✗ accessibility notice not linked to button
! returning to build with the log (attempt 2 of 3)
✓ accessibility aria-describedby added
✓ visual matches "Reports / Empty range"
✓ integration
✓ end-to-end chromium, firefox, webkit
✓ dependency scan
✓ build artefact ready
# all required jobs green
Stage 7 · human
A person decides
A person reads the evidence and approves, sends it back or stops it.
- Input
- The ticket, the design, the diff, the test report and the rollback plan on one page.
- What happens
- Assembles the evidence in the order a reviewer needs it
- Points out judgement calls it made and anything it is unsure of
- Waits. Nothing is released on a timer
- Carries review comments back to the stage that owns them
- Gate
- A named person approves. This gate cannot be turned into an automatic step.
output → A recorded decision with a name against it
ticket: T-1042 "Export does nothing"
change: disable export on empty report, say why
evidence:
design: "Reports / Empty range"
diff: 2 files
pipeline: green after 1 retry
judgement_calls:
- kept the button visible rather than hiding it
unsure:
- notice wording; please check tone
rollback: restore previous release
decision: waiting for a person
Stage 8 · agent
Releases to GA
Merges, releases to general availability, watches it and closes the ticket.
- Input
- The approved pull request and the built artefact.
- What the agent does
- Merges and tags the release
- Rolls out to general availability through the team’s pipeline
- Watches health checks and rolls back if they fail
- Writes release notes and drafts a reply on the original ticket
- Gate
- Health checks stay green. If not, the previous version is restored and the ticket reopens.
output → A release, its notes and a closed ticket
$ release --channel ga
✓ approved by a reviewer, merged to main
✓ tagged v2.18.1
✓ rolled out to general availability
✓ health checks green
✓ release notes published
✓ reply drafted on T-1042:
"Export now tells you when there is nothing
to download. Thank you for reporting it."
✓ T-1042 closed
Configuration
The loop, declared in one file
The team writes the limits. The loop works inside them.
# the loop as a team might declare it
trigger: ticket.created
stages:
- read
- triage
- design # figma, system components only
- build # branch + tests
- commit # pull request, never straight to main
- test # full suite in CI/CD
- approve # human, required
- release # general availability
limits:
build_retries: 3
on_limit: assign to a person
route_to_person:
- billing
- permissions
- data migrations
- security fixes
never:
- skip or weaken a test
- release without approval
An illustrative file, not a published format.