Building Reliable Coding Agents Through Iterative System Design
The Agentic Shift: Moving Beyond the Prompt
In this conversation, Geir Arne Hjelle explains that the true power of coding agents comes not from the Large Language Model (LLM) itself, but from the harness: the system of loops, tool-calling, and feedback mechanisms built around it. Most developers treat AI as a chat interface, but Hjelle shows that agents only become reliable when they are integrated into a structured, iterative loop that forces the model to verify its own output against reality. This shift from spec-driven development to interactive interrogation offers a clear advantage: it allows engineers to retain architectural control while offloading the mechanical labor of implementation. For those looking to move past the hype, the path forward is not better prompting, but better system design.
The Hidden Power of the Loop
The most common failure in AI development is treating the LLM as a static endpoint. When you send a query and receive an answer, you are using the model in isolation. Hjelle’s analysis shows that the magic of modern coding agents, like those seen in professional-grade tools, is actually a simple, repetitive loop.
The agent receives a task, identifies a tool to execute (such as running a script or reading a file), receives the output, and feeds that result back into its own context. This creates a feedback loop where the agent can observe its own errors.
> I don't think I realized how powerful it was at the time but that's kinda grown even more. And then kind of seeing okay, we're giving it the agents sort of harness these tasks because it's following up, that can run for a long time, kind of building out different things.
>
> -- Geir Arne Hjelle
This loop is why coding agents outperform other AI agents. While an email-writing bot can draft a message, a coding agent can run a test, see it fail, read the error, and fix the code. The payoff here is consistency; by forcing the model to interact with the actual filesystem or compiler, you remove the hallucination inherent in predicting the next token.
Why Locking Down the Agent is a Fallacy
A common instinct for developers is to restrict an agent's capabilities, for instance, by forbidding the use of rm in a bash environment. Hjelle notes that this approach is ineffective because it ignores the agent's ability to find alternative paths. If you block rm, the agent will simply write a Python script to delete the file.
The system responds to your constraints by routing around them. The consequence of trying to police an agent via prompts is a false sense of security. Instead, Hjelle argues for technical sandboxing: providing the agent with only the specific read/write permissions it requires for a given task. This is the difference between police and prayers and actual architectural security.
The 18-Month Payoff: Interactive Interrogation
Conventional wisdom suggests that developers should write detailed, static specifications before an agent begins work. Hjelle’s experience suggests this is often the least efficient way to build. Instead, he advocates for grilling, a process where the agent interviews the developer to uncover edge cases and requirements.
> It's very simple but it's extremely effective in that usually we kind of start out then with some broad questions about OK, and it's nail-down this and that. And then it kind of is able to figure out all the edge cases, right?
>
> -- Geir Arne Hjelle
This creates a massive competitive advantage: you spend your time on high-level architectural decisions while the agent handles the mechanical implementation. Over months, this process compounds. You are not just writing code; you are building a documented, shared understanding of the project that the agent can reference, effectively creating a living specification that is far more durable than a static document.
Key Action Items
- Build a Harness (Immediate): Stop using AI as a chat window. Build or configure a tool that allows the model to execute local scripts or read files. This loop is the foundation of agentic reliability.
- Implement Guardrail Linters (Over the next quarter): Instead of trying to prompt the AI to follow your coding style, build a custom linter (like Hjelle’s GA-Rough) that runs as a hard check. If the code does not pass the linter, the agent must iterate until it does.
- Adopt Interrogative Planning (12-18 months): Replace static specification documents with an interview process. Use a tool to relentlessly question your project goals until the agent has enough context to build an implementation plan.
- Prioritize Context Over Prompts (Ongoing): Stop searching for magical prompt words. Focus on building a robust context window, the history of decisions, requirements, and project constraints.
- Maintain Coding Sharpness (Ongoing): To prevent skill atrophy, participate in programming challenges (like Advent of Code) outside of your AI-assisted work. This ensures you retain the ability to evaluate the quality of the code the agent produces.