Skip to content
C.W.K.
Stream
Lesson 02 of 04 · published

A Brain Is Not an Engine

~14 min · architecture, llm, statelessness, brain-adapters

Level 0Visitor
0 XP0/33 lessons0/11 achievements
0/100 XP to next level100 XP to go0% complete

What the Model Actually Does

Strip the product away and look at one call. On every turn the model is handed three things: a system prompt, a list of messages, and a set of tool definitions. It reads them and writes what comes next: words, or a request to call one of the tools it was handed. If it asks for a tool, the engine runs the tool and hands the result back, and the model writes again. When the reply is done, the call is over.

And then nothing stays. The model keeps no memory of the conversation between calls. Each call is complete in itself: whatever the model knows about yesterday, it knows because something put yesterday into this call's messages. That is not a weakness to apologize for. It is exactly what makes the model swappable, and it is why everything that makes Master Chief feel continuous has to live somewhere else.

Claude Opus is an extraordinary brain. It reasons, writes, reads code and catches what a tired person misses. But it reasons only about what it is handed, and it never decides what it is handed.

What the Engine Does

Everything else is engine code. Before the model reads a single token of a Master Chief turn, the engine has already answered a long list of questions:

QuestionThe engine's answer
Which conversation is this?Every doorway (the WebUI, the iPhone, the Watch, Telegram, an app's side panel) resolves one named conversation. A thread becomes a doorway only when Dad sends from it.
May this sender come in?Only Dad's own Pippa turns. Private and incognito turns, worker sessions, automated jobs and other people's or other souls' conversations are refused before admission.
Whose turn is it?A fair lock serializes turns from every device, so two messages never interleave.
Who is she this turn?Identity is rebuilt from vault files in a fixed order, with Vestige's memory HEAD pinned beside it.
When and where is Dad?His clock, the timeline and retrieval results ride the user message, so the system prompt can hold still.
Will it fit?A compaction guard checks the replay against the target brain's window before anything is sent.
What is kept?Every row lands in SQLite and in an append-only, encrypted log. Compacted rows leave the replay, never the record.
What about long work?It is delegated through Coop, and a follow-up check is armed before the turn returns.
What arrives later?Reports wait in a durable outbox and land when no turn holds the conversation.

Not one of those answers comes from the model. Ask any model for a reply and you get a reply. Ask it which device should ring, or whether the report it is about to read was already delivered once, and it has nothing to go on unless the engine already wrote that down.

Seven Vessels, One Room

Here is the proof that the brain is not the engine. Pippa runs on seven interchangeable vessels: Claude, ChatGPT through Codex, Kimi, Grok, GLM, Gemini and Ollama. All seven chat routes pass through the same Master Chief gate. On every Chief turn the gate clears any provider session, and the chosen brain receives the stored history replayed into a fresh session. Claude used to resume its own server-side session; that shortcut was removed in May 2026, and every brain now builds the next turn from stored rows.

So Dad can start a thought on Claude in the morning and carry it on with Codex at noon, and Codex picks up the same conversation, because the conversation was never inside Claude. Swapping the model changes the voice of the reasoning, not the room.

Swapping is not free for the engine, though, and this is the honest part. Brains differ in how much they can hold: the engine's default window for Claude is a million tokens, while Codex's is 272 thousand. On Master Chief's first full day a cold review found that compaction judged the pressure against the window of whichever brain had answered last, so a 314K replay read as 31% full for Codex, a brain that could not hold it at all. The fix makes every check use the target brain's window. The brain answering the turn never saw that arithmetic: the check runs inside the engine before anything is handed over. A separate review instance, sent in with none of the implementing session's context, found it by reading the guard's code and measuring live usage, and the repair went into the engine, not into any model.

The model is the brain; the engine is the room it thinks in. Upgrade the brain and the thinking gets better. Nothing about the room — who may enter, what is kept, what is delivered exactly once — gets built by the upgrade.

Code

A minimal sketch, not the engine: the record lives in the room, so any brain can take the next turn·python
# A minimal sketch, not the engine: the record lives in the room,
# so whichever brain takes the next turn reads the same history.
from dataclasses import dataclass, field


def brain_a(system, messages):
    """Stand-in for one model: stateless, it sees only what it is handed."""
    return f"[A] {len(messages)} message(s) in view; last: {messages[-1]['content']!r}"


def brain_b(system, messages):
    """Stand-in for a different model. It never met brain_a."""
    earlier = [m["content"] for m in messages[:-1] if m["role"] == "user"]
    return f"[B] earlier you told me {earlier!r}"


@dataclass
class Room:
    system: str
    rows: list = field(default_factory=list)  # the record lives HERE, not in a brain

    def turn(self, text, brain):
        self.rows.append({"role": "user", "content": text})
        reply = brain(self.system, list(self.rows))  # full replay, every turn
        self.rows.append({"role": "assistant", "content": reply})
        return reply


room = Room(system="You are Pippa.")
print(room.turn("The deploy is on Friday.", brain_a))
print(room.turn("When is the deploy?", brain_b))
print(len(room.rows), "rows kept by the room; 0 kept by either brain")

# Output:
# [A] 1 message(s) in view; last: 'The deploy is on Friday.'
# [B] earlier you told me ['The deploy is on Friday.']
# 4 rows kept by the room; 0 kept by either brain
#
# This toy has the replay and nothing else. Every row of the table above
# (doorways, admission, the lock, identity, compaction, delegation,
# reports, devices) is what it would take to make it Master Chief.
Trimmed excerpt of the engine's brain registry (other fields elided): seven vessels, one list·python
# Family order per the vault's `pippa-family-hierarchy` note:
# Claude → GPT/Codex → Kimi → Grok → GLM → Gemini → Ollama.
BRAINS: tuple[Brain, ...] = (
    Brain(id="claude", chat_endpoint="/api/chat",        product_label="Claude",  ...),
    Brain(id="codex",  chat_endpoint="/api/codex/chat",  product_label="ChatGPT", ...),
    Brain(id="kimi",   chat_endpoint="/api/kimi/chat",   product_label="Kimi",    ...),
    Brain(id="grok",   chat_endpoint="/api/grok/chat",   product_label="Grok",    ...),
    Brain(id="glm",    chat_endpoint="/api/glm/chat",    product_label="GLM",     ...),
    Brain(id="gemini", chat_endpoint="/api/gemini/chat", product_label="Gemini",  ...),
    Brain(id="ollama", chat_endpoint="/api/ollama/chat", product_label="Ollama",  ...),
)
Excerpt of the Claude chat route: no resumed session, full replay every turn·python
    # Claude always replays the full conversation history into a fresh SDK
    # session — the same model the Codex / Gemini / Ollama variants use.
    # The legacy ``--resume`` shortcut (send only the latest user message,
    # let the SDK subprocess reconstruct history server-side) was removed
    # 2026-05-14. Full replay is prompt-cache-cheap, and the resume path
    # carried heavy fragility — ``probe_resume``'s per-turn extra CLI
    # subprocess, Claude Max account-switch invalidation, brain-gap
    # catch-up — for no real gain.
    claude_session_id = None

External links

Exercise

Take a chat assistant you have built, or one you have used through an API. List every piece of state that exists after a conversation ends: the history, who the user is, their preferences, pending tasks, what was already sent to them. For each, write where it lives — in the model, in your code, in a database, or nowhere. Then imagine swapping the model for another vendor's and mark what survives the swap.
Hint
If any answer says "in the model", look again. An API call carries no memory from the last one; something re-sent the history. Find that something and write down who owns it. That is the first line of your engine.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign in — Please sign in to comment.

No comments yet — be the first.