FRI, 17 JUL 2026
Live · Daily AI brief from inside the industry
14:14:36 UTC

CHAPTER 7 OF 7 · 10 min · 3 COPYABLE ASSETS

How to make coding agents improve after every bug (System Evolution)

Phase 3: treat every bug as a defect in your AI layer. Run a retroactive session, upgrade rules and commands, and version them like code so the team compounds.

TL;DW

When a PIV loop produces a bug, fixing the code is only half the job. Fix the system that allowed it. Run a retroactive session: you let this problem in, so inspect your rules, commands, and skills and propose improvements so it cannot recur. The four things to evolve are your commands, your on-demand context, your global rules, and your plan and PRD templates. Check them into source control and review changes through pull requests. One improved command can save a team dozens of hours, permanently.

Lesson · 9 parts

However hard you align during planning, implementations will sometimes miss: coding agents are non-deterministic by nature. What sets this system apart is what happens next. A bug is not a one-off fix before the next ticket. It is evidence about your setup.

Instead of patching and moving on, open a session aimed at the system itself. The agent inspects the rules, commands, and skills, the workflow that produced the bug, and proposes concrete improvements so the class of issue cannot recur.

Typical outcomes of a retroactive session, from real usage: a new line in global rules ('every new component matches the styling of existing components in the same directory'), a new validation step in the implement command ('run the browser skill against changed pages before handing back'), or a sharper section in the plan template ('name the consumer of every new utility'). Ten minutes of session time, and the fix applies to every future ticket.

Review these edits like code. A too-broad rule ('be careful with styling') does nothing; a specific one changes agent behavior permanently.

The retroactive prompt
You allowed this bug into the codebase. Dive into your AI layer, the global rules, commands, and skills, and the workflow I ran you through. Identify what we should improve so this class of issue can't happen again. Propose specific edits.

Say a new frontend component ships ugly, inconsistent with the rest of the app. The code is the symptom. The cause might be missing style conventions in your global rules, or a validation workflow that never checks new components against existing ones. Fix the cause and the bug becomes impossible, not just fixed.

Weak rule vs strong rule (global rules)
Weak:  "Keep components consistent with the app's style."

Strong: "Every new component must reuse the design tokens in
src/styles/tokens.css. Before finishing, compare your component
against two existing ones in the same directory and match their
prop and naming patterns."

Rules, commands, and skills get checked into source control just like the codebase. The whole team reuses them, and changes go through pull requests with real review. That is what makes evolution compound: one improved validation command can save engineers dozens of hours across every future ticket.

The four things to evolve over time

  • Commands: your repeatable procedures
  • On-demand context: docs (even Confluence pages) optimized for AI reading
  • Global rules: the conventions the agent must always follow
  • Plan and PRD templates: fix structural gaps as you discover them

The system is two nested cycles. The inner loop: everything works, and you chug through tickets with the PIV process. The outer loop: something significant went wrong, so you step out, evolve the system, then re-enter. You skip the outer loop when things run clean, but take it often. It is also how the general starting-point commands become your commands, specialized to your codebase.

The QR feature completes on its own branch, validation run, files summarized. One detail is worth stealing: Cole's implement command now compares the finished code against the plan to catch deviation, an improvement born from his own system evolution. The agent even updated the JIRA ticket and posted a detailed comment. Too detailed? That preference is itself an evolution cue. Specify the comment format you want in the command.

Cole creates a poll and sees no QR code. First suspect: a stale app instance, so he has the agent restart it and verify with the browser skill. The real answer sits in the agent's report. The utility was built with no consumer yet, because wiring it into the UI belongs to the next ticket. 'That's on me.' The agent did exactly what the scoped ticket said; the human misread the scope.

For the live demo, Cole has the agent quickly wire a consumer page, then watches the agent-browser skill open the site, navigate, and screenshot to validate visually. That is the same end-to-end testing you can wire into any plan's validation strategy. The QR demo page renders, and the full presentation view arrives with the follow-up ticket, as scoped.

Planning to PIV loop to system evolution: idea to production, with pull requests, ticket updates, and validation handled along the way. It takes real time, and that is fine. Even careful plan iteration and code review beats doing the documents, tickets, and code yourself by hours. 'The days are gone of being a Stack Overflow warrior.' Take the foundation and mold it to your team.

Key terms

System Evolution
Treating every bug as a defect in the AI layer and upgrading rules, commands, or templates so the class of issue cannot recur.
Retroactive session
A session where the agent audits its own rules and workflow for what allowed a failure.
Inner and outer loop
Inner: ship tickets through Plan-Implement-Validate. Outer: pause to improve the system, then re-enter.

Key takeaways

  1. Coding agents are non-deterministic. The question is not whether mistakes happen but whether each one improves the system.
  2. Every bug traces back to context you gave the agent, and context is editable.
  3. Version your AI layer like code: source control, pull requests, code review for commands.
  4. Two loops. The inner PIV loop ships work; the outer evolution loop makes every future inner loop better.

Watch out

  • Skip the outer loop for small wobbles. Cole steps into system evolution for significant issues and otherwise cycles straight into the next PIV loop.
  • A feature can be done and still invisible. Cole's QR utility had no consumer because the UI belonged to the next ticket. Read the ticket's actual scope before declaring the agent wrong. His words: that's on me.

Check your understanding

A bug made it through the PIV loop. What does system evolution say to do beyond fixing the code?

Run a retroactive session against your AI layer. Find what in the rules, commands, or templates allowed the bug, improve it so the whole class of issue cannot recur, then check that improvement into source control for the team.

Why did the QR code not appear, and what is the lesson?

The agent had correctly built only the piping; the UI consumer belonged to the next ticket. The lesson: validate against the ticket's actual scope before concluding the agent failed.