Back Original

The System Guardrails Pyramid - How to get better code from AI agents

I've been exploring software factories and how to build faster while maintaining quality with AI agents.

Durable context is the DNA at the core, generating the replaceable code that forms the body of the system.

My current theory is:

Here I want to talk about the System Guardrails Pyramid and how to think about setting up your system to continuously improve.

The System Guardrails Pyramid

System Guardrails are similar to the testing pyramid. The idea is to shift feedback left in the development cycle. The farther left it is, the earlier and cheaper it is to course correct.

Testing pyramid with unit tests at the base, integration tests in the middle, and end-to-end tests at the top. Arrows show faster and cheaper tests toward the base, broader test scope toward the top, and the relative number of tests through the pyramid's width.

The testing pyramid favors many fast, focused tests and fewer tests with broader system scope. Broader scope allows you to test more things (especially the interaction between things) but typically suffers in speed, cost, and determinism.

System Guardrails Pyramid with structural guardrails at the base, then mechanical, judgement, and guidance at the top. Arrows show cheaper and more deterministic guardrails toward the base, broader coverage toward the top, and the recommended amount of guardrails through the pyramid's width.

System Guardrails are similar:

Next

AI problems are often just human / organizational problems magnified. We've dealt with code quality issues before and the approaches are largely the same with AI.

Observe issues in your system - where developers (human or ai) make mistakes and ratchet up rules + guardrails to prevent them.

As you improve the System Guardrails, quality will start to improve. And because quality improves it means less rework which tends to lead ot faster speeds overall.

See an issue? Improve the system to prevent it from happening again. That's basically all a software factory is doing - that and building new features on that solid foundation.

If you want to see the full AI dotfiles I use for agentic engineering, I snapshot them each month and make them available to HAMINIONS Members.

If you liked this post you might also like: