tantr

Keeping the cost flat

tantr is written mostly by AI agents. The rules they write under have two aims: the screen never breaks, and feature twenty costs what feature two did.

5 min read

Most of tantr's code was written by AI agents, directed and reviewed by one engineer. An agent writes quickly and has no memory of what it wrote last week. Left alone, it will solve the same problem four different ways in four sessions. So the repository opens with a document of coding rules that every change is reviewed against. This article is about what those rules are for.

Two aims, in order

  1. The screen never breaks in front of a user.
  2. The next feature costs what the last one cost.

Both come before "the code is elegant". Elegance is not a goal. A flat cost curve is.

The screen never breaks

The person using the app may be a field worker on a poor connection, or someone checking a health reading. For them a blank screen, a crash or a spinner that never ends is worse than a screen that is slightly out of date. So every operation that can fail returns its failure as a value that the caller must handle. Nothing throws across a boundary between layers and hopes someone catches it.

There is one hard limit: the screen must not lie. Showing zero for a count that could not be loaded is acceptable when zero is true. Inventing a fact to fill a gap is not. When the app does not know, it says so.

A smaller rule from the same family: nothing waits for a fixed time and hopes the thing it needs is ready. It waits for the real signal.

Feature twenty costs what feature two did

In most codebases the twentieth feature costs several times what the second did. It is not harder. By then there are four ways to do everything, three of them half replaced, and each change means finding all of them. The rules name what keeps the cost flat:

And what bends it upwards: two libraries doing the same job, a migration that stopped halfway, a business rule copied into a third place, a screen whose rules are buried in its drawing code.

Speed is a feature

The rules also say what not to do. Do not polish what was not asked for. Do not add a layer for a second case that does not exist yet. Do not rewrite code nobody asked you to touch. Ship the smallest correct thing. When a rule conflicts with shipping something correct today, the agent must say so and propose the trade. It may not quietly pick a side.

Ask before you build

The repository keeps a retrieval index of its own code, documents and recent history. Every task starts by asking it what already exists. An agent's commonest expensive mistake is not a bug. It is building, with care and tests, something the repository already had. The index was wired into every session after exactly that happened.

Checks, not hopes

A rule that depends on being remembered will be forgotten, by people and by agents. Where a rule can be a check, it is one:

RuleThe check
Files that repeat across apps stay the sameA gate that fails on a silent difference
Every file has an ownerA gate that fails on a file with none
The contract and the code agreeExample messages validated on both sides
A server speaks the contractThe conformance suite
A generated product buildsA test that generates one and builds it

What this buys

An engineer reviewing an agent's change in tantr is not reading unfamiliar code. Every feature has the shape of every other, so the review is a comparison with a known pattern, and what is different is what matters. That is the only way one person can review the output of several agents and still answer for it.

tantr is not public yet. If you would like to build on it, or see the apps made with it, ask for access.

Request access

What is collected, and why