ENGINEERING

How We Build with Coding Agents Without Losing Control of the Codebase

By Subhojit Banerjee (Staff Engineering) · Dec 2026 · 4 min read

Speed is the easy part of building with coding agents. The real engineering work is designing session boundaries, frozen tests, and stop conditions that make generated code safe to merge.

We built much of our Kafka knowledge layer with Claude Code. The interesting part is not raw generation speed. It is the set of engineering guardrails that keeps the output safe to merge.

Five Guardrails for Agent-Assisted Development

  1. One module, one fresh session, one PR. The agent never carries conversation history from a previous module. Long sessions drift; a fresh session starts cleanly from the specification.
  2. Test-first, with existing tests frozen. The agent writes new tests before implementation and cannot modify existing ones; repository hooks block edits to protected test files. If it cannot pass without altering an existing test, it stops and asks.
  3. Goal loops with fixed stop conditions. "Done" means the test suite is green, type checks pass, and the verification script succeeds within a hard cap of six attempts. Done is never "the agent thinks it is finished."
  4. Review by a second agent with no prior context. The reviewer sees only the diff and the specification, never the first agent’s reasoning trace, preventing anchoring bias. Security-sensitive modules (authentication, tool surfaces, checks) also receive a dedicated security review.
  5. Narrow permissions. File edits are scoped and shell commands are strictly allowlisted. Git push, merge, destructive deletes, and outbound network access remain denied. We never bypass permission checks.

Define Finished So It Cannot Be Faked

A clever opening prompt accomplishes far less than a concrete stop condition. A coding agent will always try to declare victory; the engineer’s job is to define finished through tests, types, and isolated reviews in a way the agent cannot game.

Key Takeaways

  • Scope coding agent sessions strictly to one module and one PR from a clean context.
  • Protect existing tests with hooks and cap automated retry loops behind deterministic verification scripts.
  • Run blind second-agent code and security reviews against the diff and spec without the author trace.