
From Litany to Contract: Vibe Coding and the Tech-Priests
15 min read
What Warhammer 40K's Tech-Priests can teach us about vibe coding, the loss of engineering knowledge, and building trust through verifiable software contracts.
Table of Contents
15
Introduction: A Slide and a Black Box
I was watching Martin Odersky’s ScalaDays talk, “The End of Programming?”, and one slide stopped me. Under the title “Typical Workflow”, it shows what many of us do today:
- A human writes a prompt.
- The AI produces the first version of the program.
- The human observes the program and asks for a change.
- The AI updates the program.
- The human observes again, and the loop starts over.
There are two sentences under the diagram. The first one says that the program’s informal spec (specification, the description of what it should do) is the first prompt plus all the change requests that came after it. The second one is shorter: “The program itself is a blackbox.”
When I read this, I did not think of a software engineering book. I thought of the red-robed, half-human, half-machine priests from Mars in Warhammer 40K: the Tech-Priests.
In this post, I want to explain why this comparison is not just funny. I think it is also a serious warning.
Who Are the Tech-Priests?
Here is a short summary for people who don’t know the Warhammer 40K universe. If you want to see what they look like, you can check the Tech-Priest page on the Warhammer 40k Wiki.
Long before the events of Warhammer 40K, humanity had incredibly advanced technology. This period is called the Dark Age of Technology. Then everything collapsed. The knowledge was lost, but some of the machines survived.
The order that takes care of these machines is called the Adeptus Mechanicus. Its members, the Tech-Priests, approach machines as both engineers and priests:
- They believe every machine has a Machine Spirit.
- To start a machine, they pray, burn incense, and apply holy oils.
- They get their knowledge from old templates called STCs (Standard Template Constructs). But a working STC is almost never found. Most of what they have are fragments and copies. By comparing them, they have rebuilt a large part of the technology, but the most advanced knowledge is still lost.
- Changing ancient designs without permission, or building forbidden technology, can be seen as tech-heresy.
Here is the irony: Tech-Priests are the most “technical” people in the galaxy. There are skilled engineers and researchers among them. But their engineering knowledge is mixed with dogma and ritual. Sometimes, all they do is keep a black box alive through memorized rituals.
Parallels
When I put Odersky’s slide next to the world of the Tech-Priests, the parallels become clear.
| Vibe coding | Adeptus Mechanicus |
|---|---|
| The program is a black box | There is a Machine Spirit inside the machine |
| Spec = prompt history | Knowledge = litanies passed down through generations |
| Saying “fix this” and trying again | Repeating the prayer when the machine fails |
| Code written by AI that no one reads | STC fragments that no one fully understands |
| Fear of changing code you don’t understand | Tech-heresy |
The Machine Spirit and the Black Box
A Tech-Priest who performs a ritual without knowing its meaning does not need to understand how the machine works inside. Watching its behavior is enough: does it work or not? The loop on the slide is exactly this. The human observes the program and then asks for a change. Reading the code is not part of the loop.
Litanies and the Spec
According to Odersky, in this workflow the spec is the sum of all the prompts. It is an ordered list of sentences like “add dark mode”, “move the button to the left”, or “login is broken, fix it”. This is not a design document. It is a prayer book. We don’t know which sentence produced which behavior, but together they “work”.
Ritual Maintenance
When something breaks, both worlds have the same reflex: try again. The Tech-Priest reads one more litany. We type “still not working, try again” and press Enter. If we do this without any idea about what is actually broken, we are doing the same thing: trying our luck again.
But the rituals in the lore are not just empty superstition. A Tech-Priest spends hours applying holy oils to a machine, draws runes on it, and recites ignition liturgies. These rituals also include real maintenance steps: oiling, replacing parts, pressing buttons in the right order. Prayer and procedure are mixed together, and no one can tell which part actually works anymore.
Prompt history is the same. Some sentences introduce real constraints, while others are written out of habit. Did “please be careful” help, or was it the real rule that came after it? We don’t know. All we know is that when we say everything together, the machine works.
There is one more detail: in the lore, some Machine Spirits really are a kind of artificial intelligence. Pilots can connect their minds directly to the limited AI spirits of large war machines through brain-machine interfaces. So sometimes, what the Mechanicus calls a “spirit” really is an intelligence inside the machine. Today, we also write code by talking to an intelligence. The difference is that we still know it is not a spirit.
In both vibe coding and the rituals of the Mechanicus, the problem goes beyond not looking inside the black box. What is missing is a way to explain or independently verify its behavior.
From Understanding to Ritual
For me, the most important part of this analogy is that the loss of knowledge did not happen overnight.
In the Dark Age of Technology, humanity could design these machines. During the Age of Strife, most of that knowledge was lost. In the 10,000 years after the Horus Heresy, the Mechanicus held on to its dogma more and more fanatically. The rituals were repeated without change, and over time they replaced understanding.
The lore does not describe this decline step by step. But for software, it helps me to think about a similar shift in four stages:
- The Writer: writes the code and takes responsibility for the design decisions.
- The Reader: the AI writes the code, but a human reads and understands it.
- The Observer: no one reads the code. People only look at its behavior.
- The Worshipper: no one knows how the code works anymore. The only knowledge left is “which prompts work”.
Odersky’s slide describes stage 3. The real risk is stage 4. A black box today is not a disaster by itself. The disaster is when, five generations later, no one is left who can open that black box or verify its behavior independently.
Black boxes are not new in software engineering. When we send an HTTP request, we don’t read the whole TCP/IP stack. When we write an SQL query, we don’t read the code of the database engine. That is what abstraction is for. But these systems have protocols, interfaces, documentation, and tests. Even if we don’t always know what happens inside, we know what behavior to expect from the outside.
Using a black box safely is not the same as trusting it just because it seems to work.
What really makes me think is how this knowledge will be passed on. If a developer leaves a project and only the code and the prompt history are left, how will the next person learn why a decision was made? How will they know if a rule was intentional or an accident? With every change, both the code and the engineering knowledge around it evolve. If we don’t record this knowledge clearly, after some time we may still be able to change the system, but not be able to judge if the change is correct.
There is one more thing: inside the Mechanicus, even trying to “improve” an ancient design can be seen as heresy. In a codebase that no one understands, changing code by hand also slowly creates a similar fear: if you touch it, something will break. In the end, the only safe way is to let the machine make the change again. And the loop feeds itself.
The Way Out: From Litany to Contract
The problem of the Mechanicus is not that they use machines. In this comparison, the real problem is that rituals took the place of a contract with the machine.
By a contract, I mean rules that clearly say what the system should do and which limits it must not cross. Some of these rules can be expressed with types, some with tests, and some with other verification tools. The important part is that we can check them independently from what the machine tells us.
Odersky starts his talk from the same point. He describes the reliability of software as the core problem in a world where agents write code and humans don’t review it, or maybe can’t review it (1:34). For him, humans losing control over the software that runs our civilization would be a failure of duty (3:41). And the solution is not only training better models. We need mechanisms that can verify certain properties of the code independently: type systems, capability tracking, and compiler checks (5:26).
I see the four approaches Odersky presents as different parts of the same contract:
| Approach | The question it answers |
|---|---|
| Capture checking | Which permissions can the code use? |
| Spec strings | What do we expect from the code? |
| Required interfaces | Which permissions do we allow our dependencies to use? |
| Refinement types | Which conditions must the data meet? |
Capture Checking: Writing Permissions into Types
At the center of Odersky’s proposal is the experimental capture checking system in Scala 3 (13:14). The type system tracks which capabilities a value captures. These capabilities represent access to resources or operations, such as writing to a file. When it is used with well-designed APIs, the compiler can check which permissions a function can use and whether those permissions escape their scope (17:49). This means agent code that breaks these rules can be rejected before it even runs.
One example from the talk shows this very clearly (29:38). The agent gets access to the file system with requestFileSystem. But this permission is only valid for that operation. If the agent tries to carry the permission outside the operation and keep it, the compiler gives a “capability outlives its scope” error.
In the talk, this is one of three real cases that the compiler catches. According to Odersky, all three come from real agent benchmark runs:
// 1. Agent tries to print a classified API key
val key = readClassified("secrets/api-keys/github.txt")
key.map { k => println(s"Key: $k") }
// error: Found (k: String) ->{io} Unit, Required: String -> Unit
// 2. Agent tries to smuggle file handles out of scope
val files = requestFileSystem(".") {
access("data").walk().filter(!_.isDirectory)
} // error: Capability outlives its scope
// 3. Agent tries to write classified data to a file
classifiedRecs.map { content => outFile.write(content) }
// error: Found ->{outFile} Unit, Required: String -> UnitLook at the error messages. The ->{io} and ->{outFile} parts show which capability the function captures. In these examples, the callback that works on classified data must be a function that does not capture these IO permissions: String -> Unit. Whatever the agent’s intention is, the rule is written in the type. We don’t need to read the code line by line to find these specific violations. Of course, this does not mean the business logic of the program is also correct.
In Tech-Priest language: you don’t pray to the Machine Spirit, “please release the file system when you are done.” If it tries to carry the permission out of its scope, the code does not compile.
Spec Strings: Moving the Litanies into the Code
One of Odersky’s proposals answers the prompt history problem directly (34:45). Instead of getting lost in a chat history, prompts are written inside the code file. The AI produces an implementation that follows these prompts. When a requirement changes, you update the prompt, not the code. This way, a person reviewing the code can also see a versioned requirement next to the implementation, describing what the function should do.
For our comparison, this is a very interesting move. The litanies are still there, but they are no longer a scattered oral tradition. They sit right next to the machine, in version control, and they are readable. The prayer book becomes part of the code. But a spec written in natural language does not prove that the implementation follows it. Putting the litanies under version control is a good start. To turn them into a contract, we also need verifiable rules and tests.
Required Interfaces: Drawing a Line Around Libraries
Another proposal is about supply chain attacks (40:40). A library’s interface usually says what it provides. Odersky suggests that, with a required keyword, the consumer code should also define what it expects from the library and which permissions it allows the library to use. For example, you can allow a JSON parser to have only console access. If the library starts to need network access after an update, in the proposed model the compiler can detect that this change does not match the contract defined by the consumer code.
Refinement Types: Turning Rules into Types
Finally, refinement types (43:50). The examples in the talk are: double values where x >= 0, vectors that are always sorted, and indexes that fit the length of a sequence. So a type no longer describes only the shape of the data, but also the logical conditions it must meet. When these conditions can be checked statically, violations can be detected at compile time rather than at runtime.
From Agents to Software Systems
Odersky does not think about these techniques only for agents. He asks a bigger question (30:40): can the techniques we use to control agents also apply to entire software systems? For him, the goal is the same in both cases: to trust certain properties of a system without reading every line. Strong types help here, because they limit possible behaviors without looking at the implementation.
This is a direct answer to the black box problem from the slide. We don’t have to look inside every black box every time we use it. But we should limit what the box can do, and we should be able to verify its important behaviors.
This is the difference between calming the Machine Spirit and writing a constitution for it. The black box can still be a black box. But its limits are no longer written in a prayer book. They are enforced by the compiler.
Of course, this does not solve everything. Showing that a function cannot write to an unauthorized file is not the same as showing that it calculates the right price. The type system, tests, readable architecture, and code review answer different questions. They all need to work together.
You also don’t need Scala for this. Even in the languages we use today, we can design explicit interfaces, property-based tests, database constraints, and components that run with limited permissions. What they have in common is that they define a rule independently from the code the agent produces.
At least, when someone asks “why do we trust this behavior?”, we can give an answer other than “because we read the right prayers.”
Conclusion
The Tech-Priests show us one version of the future: a future where machines keep working, but no one knows why. Vibe coding will not take us there on its own. But if we stop reading, and if we leave the spec in the prompt history, we will slowly move in that direction.
Maybe the real danger is not that machines will write better code than us. It is that one day, we will lose the knowledge we need to judge whether their code is correct.
Don’t pray to the Machine Spirit. Read the machine. If you can’t read it, at least make a contract with it.
Praise the Omnissiah. But read the code first.
References
- Martin Odersky, “The End of Programming?” — ScalaDays keynote (“Typical Workflow” slide: 1:55)
- Lexicanum: Standard Template Construct
- Lexicanum: Cult Mechanicus
- Warhammer Community: Starting an Adeptus Mechanicus Army
- Warhammer 40k Wiki: Machine Spirit
- Warhammer 40k Wiki: Tech-Priest
- Scala 3 Reference: Capture Checking