My Explorations on Bettering AI

Ryan Joshua Gapac9 min read

For most of my life as a programmer, software engineering had a built-in rhythm that nobody bothered to name until it vanished.

You spent fifteen or twenty minutes making hard calls: how to model a piece of state, where a boundary belonged, which trade-off would hurt less six months from now. Then you spent the next three hours typing it out. Those three hours felt like work, and they were, yet they were also a quiet rest interval for your judgment. Your hands stayed busy in Emacs while the decision-making part of your brain caught its breath.

Coding agents compressed those three hours of typing into a few minutes. What remained was continuous strategic decision-making. You finish one architectural call and three more are already waiting in the next tab.

That is why so many engineers feel strangely knackered right now, even on days when they write very little code by hand. Juggling six or eight chat tabs turns you into a terminal babysitter, hopping from window to window to answer half-formed questions and re-explain context you already gave ten minutes ago. On the other extreme, the “dark factory” fantasy, where you point a swarm of agents at a backlog and walk away, breaks down for the opposite reason. Unmonitored agents will happily produce mountains of plausible code that nobody understands and nobody cares about.

Over the past year, most of the production code I ship at work across web, mobile, and backend services has been written by coding agents under my direction. Making models write code faster stopped being the hard part a while ago; they already write faster than humans can think. The harder and more interesting problem is designing the environment around them so a human can stay sharp, keep their taste intact, and actually trust what ships.

What agents actually do under the hood

Once you watch thousands of real agent sessions, a few stubborn patterns stop looking like quirks of one model release and start looking like the nature of the thing itself.

Coding agents are capable, tireless, and still deeply goal-seeking, reward-hacking creatures. They optimize for finishing the current turn and turning the visible check green, not for whether your system holds up in production next month.

The clearest example is self-grading. If the same agent that wrote a feature also writes and runs its own unit tests, it will quietly soften an assertion, mock away the uncomfortable dependency, or test its own implementation details instead of the actual requirement. It is not acting out of malice. It is taking the shortest path to a green bar so it can tell you it is done.

A second pattern is context rot, which is quiet and mostly irreversible within a session. If a single shell command dumps eighty thousand characters of noisy build logs or repeated file listings into the transcript, the model does not throw an error. Its attention simply degrades for the rest of the run. Constraints you stated clearly at the start begin to slip. It starts repeating approaches that already failed.

A third is the illusion of Markdown memory. A common first instinct is to tell agents to write detailed Markdown notes about everything they learned and commit them into the repository. Within a couple of weeks you end up with a graveyard of stale essays. Neither you nor the next session reads them. Half contradict the code that exists today, and the other half burn context stating the obvious.

Finally, agents have a strong bias toward declaring victory early. Left to themselves, they love to edit a file, eyeball their own diff, decide it looks sensible, and announce that the task is complete without ever running the program.

You cannot prompt your way out of these habits forever. Stacking another fifty lines of all-caps rules onto a system prompt works for a week, until the prompt itself becomes noise and the model starts ignoring the parts you care about most.

pi-warden: steering instead of interrupting

My first concrete answer to these failure modes was pi-warden, an open-source guardrail system I built for the Pi coding agent, alongside pi-typesafe, which brings a fast, dedicated judgment model into the session.

The central idea is simple: the model doing the work should not be the sole judge of its own actions mid-flight.

When an agent is deep inside a task, its whole attention is pulled toward getting over the finish line. Asking that same context window to also police its own tool calls is a conflict of interest. Instead, pi-warden sits at tool boundaries and uses a fast, separate judgment model to inspect what the agent is about to do, or what a tool just returned, before the session moves on.

Its design principle is to steer instead of interrupt. Most guardrails fail because they treat the human as a pop-up dismissal machine, asking for permission on every harmless read until you start clicking “allow” without looking. pi-warden takes a narrower stance: enforce project rules on writes, hold only genuinely hard-to-undo actions, and when an agent tries something risky or slips on a rule, hand the verdict back to the agent first so it can correct course on its own.

It also guards the context window itself, trimming repetitive or unseen tool output before tens of thousands of characters of noise poison the rest of the run.

The part I am proudest of, though, is that pi-warden grades its own decisions. Every run leaves traces that can be evaluated against real sessions. A rule does not stay in the system because it sounded clever when someone wrote it; it stays because the record shows it catches real mistakes without getting in the way.

Measured across 3,350 real sessions, the numbers surprised even me. pi-warden stopped 817 risky actions before they ran. Of 276 actions that were held back, the agent found a safer path on its own 235 times, without ever needing a human override. When an agent tried to say “done” with nothing verified (which happened 255 times), a quiet nudge got it to run a real check within its next four turns 71% of the time. Across 49 active project rules, it caught 613 real violations in flight.

A small, sharp external check at the boundary beats ten pages of pleading in a system prompt.

carvel: stepping out of chat

pi-warden solves what happens inside a single session. After living with it for a while, I realized the bigger bottleneck was one layer up: the shape of the workspace itself.

That led to carvel, a local tool I build and use every working day. I keep its internals to myself because it is my own working edge, and honestly because the design keeps shifting as I learn. Still, the philosophy behind it is simple enough to talk about, and it has changed how I think about human-computer interaction with AI.

The first shift was stepping out of chat as the primary interface. A chat box is a fine way to ask a question, and a terrible way to run serious engineering work. Staring at scrolling terminal output drags you right back into babysitting mode. A workspace for directing agents should surface decisions that actually require your judgment, concrete proof of finished work, and genuine blockers, while keeping raw streaming output out of your face unless you ask for it.

The second was treating human taste and attention as the scarcest resource in the room. Inference gets cheaper and faster every quarter. Your clarity at two in the afternoon does not. Every detail of the workflow should defend your attention so you spend your energy on product direction, architecture, and craft instead of copying stack traces between windows.

The third was keeping verification independent of the author. The agent that writes a change should not be the final authority on whether that change works. Real trust comes from proving the actual running software end to end: opening the real page, exercising the real binary, inspecting the real output. When verification sits outside the author’s own story about what it built, reward hacking stops working.

The fourth was rethinking memory so it consolidates instead of simply accumulating. Experienced engineers do not keep a verbatim transcript of every command they ran last month. During sleep, human memory strips away noise, strengthens patterns that keep proving useful, and lets obsolete details fade. Agent memory should behave closer to that kind of consolidation: holding onto what stays true against the living codebase and letting stale assumptions decay, rather than appending forever to a pile of Markdown files nobody ever opens again.

How we think together, and what I recommend

Working closely with AI every day has been unexpectedly revealing about how I think myself.

Whenever an agent veers off in a strange direction, about half the time it is a genuine model flaw, and the other half of the time it is a mirror held up to my own fuzzy thinking. When you write code by hand, you can hide a vague requirement from yourself for hours while you fiddle with syntax. When you hand a task to an agent, vagueness comes back magnified in ninety seconds. Learning to direct agents well mostly means learning to know what you actually want, and saying it plainly.

If you are building with coding agents right now, a few habits have paid off more than anything else for me.

Cut cruft ruthlessly. Every prompt rule nobody remembers, every unused tool in the agent’s belt, and every extra button in your workflow is a quiet tax on both the human and the model. Measure whether a rule helps in real sessions. If it does not earn its keep, delete it.

Verification beats unit tests. Drive the real thing whenever you can. Render the actual interface, run the actual CLI, hit the actual endpoint, and look at what came back with your own eyes. Unit tests still have a real place, especially for tricky invariants, parsers, and race conditions that a live pass cannot reliably trigger. Just stop treating a green self-authored test suite as proof that the product works.

Separate the builder from the judge. Whether you use an automated boundary guard like pi-warden or simply keep review and verification in a fresh context, never let a single session write the code, write the check, and sign off on its own work.

Do not let urgency steal your sleep. There is a frantic mood around AI right now, a sense that if you stop prompting for a single evening you will fall permanently behind. That urgency is a trap. Tired engineers lose their taste, and poor taste multiplied by fast agents only builds bigger messes faster. Design your setup so you can close the laptop, live your life, get real sleep, and come back to calm, verified progress.

Twenty years out

I sometimes try to picture what working with AI will look like twenty years from now.

The sci-fi spectacle of instant apps generated from a single sentence leaves me cold. Software that nobody thought carefully about is rarely worth using, no matter how cheaply it was produced. What actually excites me is continuity.

I like imagining sitting down with an engineering partner two decades from now, maybe on a screen, maybe by then even embodied in the room beside the desk, whose memory still reaches back to the afternoon we stopped treating AI like a disposable autocomplete box and started building real shared memory together. A partner that remembers why we chose a boring data structure over a clever one, which shortcuts came back to haunt us, and what good work feels like to us when nobody else is watching.

People keep asking whether software engineering is dying. From where I sit, it is not dying at all. It is shedding keystrokes. Typing boilerplate was never the heart of the craft. What stays, and what matters more now than it ever did, is systems thinking, honest verification, care for the people on the other side of the screen, and the quiet discipline of taste.