Veit's Blog

Always Be Theorizin’

2026-11-26

Late last month I caught up with my friend Kevin Lynagh and, among other things, we compared notes on how we work with coding agents. Mostly we talked about complexity, how each of us stays inside a codebase when most of its code isn’t written by us anymore. I told him about the agent loop I have running in the background over some of my repositories, and about how I try to keep up with what it does. Something something dark software factory, but really I’m just amazed that it has held for over half a year and I’m still doing it this way.

Kevin then wrote a newsletter about his own struggles with this, and it’s very kind to me (I get two links!). In it, he cites Peter Naur’s1 “Programming as Theory Building” from 1985, a paper he also told me to read in our conversation.

So I opened the link, let it sit there for entirely too long, then finally read it last week or so. He was right, of course. It is interesting.

It ties together a lot of what I’ve been writing about here over the last few months. Always surprising how things fit together, and most new things are really old things in disguise.

Says Naur

Naur’s argument is that programming is not the production of program text. It’s the programmers building up a theory of how the program meets the world, and the text, along with any documentation, is “an auxiliary, secondary product”.

He takes his notion of “theory” from Gilbert Ryle, and it comes with a pretty specific definition:

[...] the knowledge a person must have in order not only to do certain things
intelligently but also to explain them, to answer queries about them, to argue
about them, and so forth.
Fig. 1: Naur, paraphrasing Ryle.

That’s much sharper than most notions of “theory” I’ve seen around, but it’s super useful!

Applied to programs, someone having that theory can do three things. They can explain how the program relates to the part of the world it handles. They can explain why each part of the program is what it is. And they can respond appropriately when the world changes and the program has to change to accommodate it.

Naur argues that none of these can be fully written down, because they depend on recognizing similarities between situations, and those can’t be reduced to rules any more than you can write down the rules for recognizing a face (I’m really bad at that, too, so that might be a skill issue).

Either way, theories are largely tacit.

He describes this in a case that instantly clicked, mostly because it’s so close to what I do. Group A builds a compiler. Group B is tasked with extending it, gets the full source and listings and design discussions, and personal advice from group A on top. They still propose extensions that ignore the facilities already in the compiler—patches that, in Naur’s words, “effectively destroyed its power and simplicity” (ouch!). Group A spots this instantly every time, and can explain how to do it within the existing structures instead.

In the years after, other programmers take over group B’s compiler, without any guidance from group A. Then, ten years later:

[...] the original powerful structure was still visible, but made entirely
ineffective by amorphous additions of many different kinds.
Fig. 2: A compiler, a decade after.

Kevin’s newsletter has a list of things language models can’t stop doing to his code. They introduce names for concepts that already exist, scatter mutable state everywhere, add a narrow new test for every change. Amorphous additions of many different kinds that leave the codebase a blob.

But, perhaps unsurprisingly, Naur draws that conclusion himself:

[...] the problems of program modification arise from acting on the assumption
that programming consists of program text production, instead of recognizing
programming as an activity of theory building.
Fig. 3: Naur, in 1985, talking about 2026, presumably.

Well, I never!

Dead programs

The part of the paper that clicked most with me is when Naur talks about the life and death of programs. A program is alive while a team that has its theory is in charge of it. It dies when that team is dissolved. But the dead program doesn’t stop working:

A dead program may continue to be used for execution in a computer and to
produce useful results. The actual state of death becomes visible when demands
for modifications of the program cannot be intelligently answered.
Fig. 4: Undead software.

Reviving a program, rebuilding its theory from text and documentation alone, he calls “strictly impossible”. At best it’s costly, and you end up with a different theory than the one the program was built on. He recommends throwing the text away and solving the problem afresh instead (I’d argue that the written remnants of the theory might be useful guidance, but the program text certainly is not).

Kevin splits his own programming into two kinds. Sometimes he wants a program, something that solves a problem without caring about the details, and vibe coding is great for that. And sometimes he wants to care about the details, because he wants the theory.

At this point I should say that I believe that agentic codebases can, much like human codebases2, be dead or alive. They can be vibe-coded or understood. The agent changes the depth of detail you wrestle with, but you can still hold the theory firmly in your grasp.

In Naur’s terms, the vibe-coded program is born dead, and that’s fine. Nobody needs to answer queries about the script that maps MIDI dials to monitor brightness unless you want to. If it ever needs to change, you do what Naur recommends and generate a new one. It’s the way of the vibe-code, and I shudder at the expense involved (I still hold an outdated cost structure around code generation in my head).

In any case, I don’t think the line runs along how much of the code was written by a language model. It doesn’t run along code lines at all.

Every session a revival

So why should we hold on to the theory? Simple.

What does a coding agent have when it starts a session? The code, maybe some documentation, maybe an AGENTS.md or a plan file. Text, in other words. Every session is an attempted revival from documentation, which is exactly what Naur says can’t be done. The model cannot build theory, because it cannot preserve it.

Of course I don’t know whether a model has anything that deserves the word “theory” within a creative session, so I’m not going to belabor the point. I wrote before about why I don’t trust the model’s own testimony on questions like this, and humans certainly do not know. But whatever it has in a session, it doesn’t carry it over into the next one, except as more text, the universal and terrible format.

This also explains something Kevin noted, namely that agents get strange about plan files. They either maintain them as documentation or get tunnel vision on the places where the code doesn’t match the original plan. Even if the plan were meant to carry the theory, it can’t. It’s just another artifact to be reconciled with the other artifacts. The rot hides everywhere.

Where theory has to live

If the theory has to live somewhere, and the model can’t hold it across sessions, then I think it has to live in a human head, as it always has.

That’s what I’ve been looking for. The difference between slop and what people are calling some variation of AI-native engineering isn’t how much of the code the model writes, but whether a human engineer is still building the theory that makes the software intelligible and lets it change.

And, as ever, once you see the forest, all the trees start to make sense.

In the post on cheats, I wrote that when an agent hands me a solution to a kata, I recognize the solution, but I didn’t find it. Recognizing a solution doesn’t build a theory. I can follow along, but I can’t argue about it.

And in the post on dual use, I complained about a contributor who answered an RFC with model-generated code, and then answered my objections with more model-generated text. I wrote that I didn’t want to outsource our thinking. The theory has to stay ours.

What I do

I don’t have a method, and Naur reminds me that “for the primary activity of the programming there can be no right method”. What I have are (messy) habits, and I can try to share them here.

I have an agent loop running in the background over a set of repositories I define. I only do it on repositories I control, and with varying degrees of human involvement in them. The agents mostly work on issues I file, and open pull requests for them. A separate review agent looks at each pull request first and either says “merge” or “revise”. I only start looking once it says “merge”.

Crucially, the loop produces text, but it doesn’t get to produce theory. Nothing it does becomes part of the program until I’ve taken it into my understanding of the program, or rejected it. I am often quite brutal there, and sometimes too lenient, and that’s come back to bite me. I think brutal is the right default.

How closely I look depends on the change: how big it is, what kind of change it is, and how easily I can check it. A dependency bump with a green test suite gets almost instant approval. A new feature that touches the core of the program sits there for entirely too long if it’s not top of mind. But, frankly, I usually don’t just go back to reading everything closely and trusting my eyes. Often, I spawn an agent as I read through the code myself, and then I review the pull request together with the agent, guiding it directly, and asking it questions I would ask the author. It’s surprising how much slop hides in these.

So, often the theory-building is code review, done properly, which means kicking the tires hard, like you mean it. And not just at the code, at the theory behind it.

If you want to be fancy, call it a Socratic dialogue, where I ask pointed questions until the agent pretends to get it. I used to think of that as teaching the agent, but that’s horrible anthropomorphizing that’s long gone from my interactions.

I think this is deeply personal. What builds a theory in my head won’t necessarily build one in yours. Kevin is trying top-down sketching, types and signatures first, with agents filling in the holes. I’m curious how that goes.

I suppose I just want someone to yell at sometimes, and I can’t do that to a fellow human being.

Fin

As is customary, I don’t have a resolution. Naur wrote this when the threat to the theory was programmers being treated as replaceable parts in an industrial production process, so his answer was to give them the status of professionals who own the activity. Today, you still need to fight to own your activity, but the ones taking it away are not just the industrial processes and AI mandates, but also the psychological traps of pretend-work.

One last thing. A few weeks ago, before I had read the paper, I published a short story about a man with a map his father copied for him, and a woman who arrives without one and keeps finding ways through the building. I didn’t know then that it was about this. Maybe it’s about other things too. Maybe it’s about nothing at all. It’s not part of the theory yet.

Footnotes

1. It’s the Peter Naur that most will know as the N in BNF, the Backus-Naur form. Funnily enough, Naur didn’t want his name in it, and preferred Backus Normal Form.

2. The version of the paper Kevin links is a reprint from Alistair Cockburn’s “Agile Software Development”, with some commentary of his own. In it, he imagines ten programmers working in parallel, as fast as they can, each building their own theory as they add code, until the design “easily becomes a ‘kludge’”.

He wrote that about people, of course, but I think about it when I see someone run ten agents on ten worktrees and the agents get stuck in the mud they themselves created in record time.