If you are a builder, start here
You have shipped something with an LLM agent, so you know these moments:
You swap the model, and the agent forgets who it was.
The context compacts, and a decision you made an hour ago vanishes without a note.
The bill arrives, and you realize you have been paying rent on your own reasoning, stored in someone else’s cloud.
None of that is a model problem. It is a missing piece of architecture.
Agents have memory: a context window. What they do not have is state: a record of what is true that survives the window closing. This post is about the difference, and about a steward, a small engine that holds state so the agent does not have to.
If you want the short version: state belongs to you, not to the context window and not to the vendor. The tool that does this is open, MIT licensed, and runs with zero dependencies:
github.com/Datamindlabsafrica/steward-mcp
The rest of this post is the why.
1. The category error: memory is not state
We talk about “agent memory” as if it were one thing. It is two, and conflating them is why agents feel brilliant for ten minutes and senile by lunchtime.
Memory is recall inside a window. It is fast, associative, and perishable. It lives in the context and dies with it.
State is the durable record of what has been decided, what is owed, what is true, and why. It must survive a model swap, a context reset, a process restart, and a vendor change. It is not recalled. It is read from somewhere you control.
A context window is memory. It is not state. Every agent that treats the window as its source of truth is one compaction away from losing the thread of its own work.
2. Why the context window cannot be state
Four properties make the window structurally unfit to be the record:
It is ephemeral. When it clears or compacts, unwritten reasoning is gone. There is no undo, because there was no write.
It is bounded. Compression is lossy by design. It keeps what is statistically salient, not what is decision-critical.
It is non-deterministic. Compaction and sampling mean the same agent can re-derive different conclusions from the same inputs. A record that changes when you re-read it is not a record.
It is rented. The tokens, the storage, and the retention belong to the provider. Your reasoning is held in someone else’s account, under their terms, at their price.
Put together: the window is a workspace, not a ledger. Using it as the ledger is the category error.
3. The real costs of statelessness
The bills for this error show up in predictable places:
Compaction amnesia. Decisions silently reset on long tasks. The agent contradicts itself and cannot explain why.
Model-swap resets. Change the model and the agent loses its working identity, its open debts, its current focus.
Token spend on re-derivation. You pay, every session, to reconstruct what you already decided, because it was never written down.
Audit failure. You cannot prove what the agent knew or decided at a given step, because there was no durable, ordered record.
Vendor lock-in. If your agent’s continuity lives in one provider’s context, switching providers is switching your agent’s brain.
Each of these is a symptom of the same missing layer: owned, durable, ordered state.
This is not theoretical. Field notes below.
Field Note 001 — the paper steward
We wrote a
CONTEXT-COMPACTION.mdby hand, every time a session was about to end, because the record kept evaporating. The provenance line on one of them reads plainly: “generated at user request for clean handoff.” Inside it: dozens of decisions, a list of carried debts marked “do not silently resolve,” and one item that had already been decided but not yet executed. Without that file, the next session would have started clean and silently dropped the pending decision. The context window did not hold the thread. A file did.And this was not an edge case. In our own logs alone: 3,171 compaction events, 182 context artifacts demoted out of the working window, and a single long session carrying 670 of them. That is not a bug you fix with a bigger window. It is the default behaviour of every long-running agent that keeps its state in the context window and nowhere else.
The fix we kept reaching for, by hand, was a steward: a place to write state that belongs to us, that survives the session, and that the next agent reads instead of remembering. That is what steward-mcp is, made automatic.
4. What state must be
If state is the record, then the record has requirements:
Durable. Written to storage before it is relied upon. Survives restart.
External. Outside the context window, outside the model, outside any single vendor.
Owned. In a directory the operator controls, portable across models and tools.
Ordered and auditable. Every change is appended in sequence, and the sequence is tamper-evident.
Canonical. One record of truth that many agents read from and write to, without each keeping its own drifting copy.
The moment you accept those requirements, the architecture follows: separate the reasoner from the record.
5. The steward pattern
The steward is the separation of who reasons from what is true.
The agent is a stateless processor. It reads state, acts, and proposes a change. It can be swapped, retried, or replaced without losing continuity, because it holds nothing itself.
The steward owns the state. It enforces the rules, appends the record, and refuses illegal transitions. It is small, boring, and deterministic, and that is the point.
This is not a new idea. It is how we already build systems that must not lose the thread: databases over in-memory caches, ledgers over verbal promises, version control over “the copy on my laptop.” The novelty is only that agents are now common enough to need the same discipline.
6. Why MCP
An agent that owns its state is still useless if it cannot reach it from the tools people actually use. Model Context Protocol (MCP) gives one portable interface across Agent Development Environments: Antigravity, Claude Code, Cursor, Windsurf, Codex, Hermes, and whatever comes next.
Build the steward once as an MCP server, and every ADE can plug into the same owned state. Change the reasoning engine, keep the record.
7. The implementation: steward-mcp
steward-mcp is that steward, built as a local-first, zero-dependency MCP server.
Zero external runtime dependencies. Pure Python standard library, stdio JSON-RPC 2.0. No install friction on any OS, any ADE.
A 12-tool core loop. status, query, decide, debt_open, debt_resolve, focus, propose, adjudicate, promote, freeze, restore, verify. Enough to run a disciplined agent lifecycle, small enough to audit.
Three resources and two prompts. steward://status, steward://anchor, steward://debt/open; plus onboard and handoff, so a fresh agent can pick up the thread cold.
A ten-register ledger. Substrate, mechanisms, active focus, deprecated names, risks, module ledger, carried debt, decisions, conventions, intent audit. State is structured, not a blob.
Tamper-evident by construction. A hash-chained audit log appends every change in order; verify recomputes the chain.
Hardened, not demo-grade. Per-project reentrant file locks, atomic fsync writes with os.replace, path-traversal guards on project identifiers, UTC timestamps, and single-use, payload-bound gate tokens with commit-then-spend.
Local and portable by default. State lives in ./.steward/ (overridable), in a format you can read, diff, back up, and move.
It is MIT licensed and public: github.com/Datamindlabsafrica/steward-mcp.
The reproducible research companion to this post lives in the repo at docs/thesis-chapter-stateful-vs-stateless.md.
8. Dev-to-Paper glossary
If you are a builder, these are the terms you already use. If you are a researcher, here is the mapping.
Memory: recall inside the context window. Fast, associative, perishable. Not a record.
State: the durable register of what is true. Survives resets, swaps, and restarts.
Compaction: lossy reduction of the context. It keeps the salient and drops the decision-critical.
Snapshot: a frozen version of state, so you can prove what was true at a given step.
Prompt: an ephemeral instruction. Useful in the moment, not a decision record.
Steward: the deterministic authority that owns the record. The agent owns nothing.
The point
The agent is not the asset. The state is. Models will keep changing, getting cheaper, getting replaced. The thread of what you have decided, what you owe, and what is true should not change with them.
Build the steward once. Own the state forever.
We opened this because builders should not have to rent their agent’s reasoning from anyone, least of all from us. Built in Africa, for anyone who wants to own their own continuity.
The repo is open. The state is yours.



