typestate
TYPESTATE, INC.
a field guide to the scaffolding era

Agents forget. Loops are hand-written. Guardrails are suggestions.

AI agents got remarkably capable — and everything around them stayed improvised. Seven problems anyone who uses or builds agents will recognize, and a first look at what we're doing about them.

Chapter 1

Using coding agents

The pains you feel at the keyboard, working with tools like Claude Code, Cursor, or Codex every day.

01

The compaction cliff

Every long session ends the same way: the context window fills, the tool summarizes the conversation, and work continues from the summary. But a summary is lossy by design — the decisions you argued over, the approaches that already failed, the constraint mentioned once two hours ago: gone. The next session confidently re-suggests the thing you rejected on Tuesday.

The structural cause is simple: for today's agents, the context window is the only memory. Anything that falls out of it never happened. Million-token windows moved the cliff; they did not remove it. Compaction isn't a fix — it's the cliff edge where knowledge becomes prose, and prose becomes noise.

$ /compact summarizing 214 messages… ✂ 3 design decisions, 2 rejected approaches, 1 constraint — not in summary new session started. "So, have we considered using approach X?"
symptom

The agent re-proposes, with full confidence, the approach the team rejected last week.

today’s patch

Bigger context windows, /compact rituals, and a briefing file re-read at the top of every session.

the ceiling

A larger window only moves the cliff. And a summary of a summary is a rumor.

02

Your agent's knowledge is trapped in one tool

Months of accumulated context — how your codebase is shaped, what conventions you enforce, what was tried and abandoned — lives inside a single vendor's session files. Switch tools, or even mix tools across a team, and the new agent starts from zero. Every migration is an amnesia event.

Memory this valuable shouldn't be a feature of a tool. It should be an asset of the project — typed, portable, and mountable by whichever agent you point at it. The open protocols for this exist today; the memory layer that deserves them doesn't.

symptom

Each new tool is re-briefed on architecture the previous one already knew.

today’s patch

Per-tool briefing files — a CLAUDE.md here, a .cursorrules there — duplicated by hand and synced by hope.

the ceiling

N tools × M projects of parallel briefings, drifting apart by design. Vendors shipping native memory deepens the silo; it doesn't open it.

That's the experience of using one agent. Now build your own — as every company suddenly must — and the same gaps reappear, with production stakes.

Chapter 2

Building AI agents

The pains of every engineer who has shipped an agent loop — and then had to keep it alive.

03

Everyone hand-rolls context management

Ask any team running a serious agent what their engineers actually spend time on. It isn't prompts — it's compaction strategy: what to keep verbatim, what to summarize, what to re-inject after truncation, and when. Every loop grows its own bespoke scheme; every scheme is re-tuned by hand when the task shape changes; and none of it transfers to the next loop.

Context management became a craft because there is no substrate under the loop — nothing that holds what the agent knows outside the window and serves back exactly the slice a step needs. So everyone rebuilds that, badly, per project.

symptom

Every serious agent repository ships a bespoke context-management module — typically on its third rewrite.

today’s patch

“Context engineering” — the craft now has a name, a job title, and a conference track.

the ceiling

The schemes are task-shaped. Change the workflow, and the craft starts over from zero.

04

Guardrails don't survive long contexts

You write the policy. You run the evals. They pass. Then production happens: contexts grow to hundreds of thousands of tokens, instruction adherence decays with distance, and after a compaction the paragraph containing your policy may literally no longer exist. Was the rule applied at step 40 of a three-hour run? You have no way to know — the eval ran on a short, clean transcript that no longer resembles reality.

Confidence built at build-time doesn't transfer to run-time, because the enforcement lives in the same fragile medium as everything else: the prompt.

symptom

The eval suite passes; production violates the same policy. Both reports are accurate.

today’s patch

More evals, another red-team pass, and re-stating the policy every few turns of the conversation.

the ceiling

Sampling cannot certify a three-hour trace — and repetition rents the model's attention; it never buys enforcement.

05

The workflow engine you didn't mean to build

A real agent system needs ordering, retries with feedback, fan-out and joins, durable state, resume-after-crash, and human checkpoints. None of that is AI — it's a workflow engine. And because no agent framework provides it with governance built in, every team hand-writes one in Python glue: ad-hoc state dicts, brittle retry wrappers, loops nobody wants to touch six months later.

The result is the worst of both worlds: infrastructure-grade responsibilities implemented as application-grade code, duplicated across every project that ships.

symptom

The loop's author moves on; no one is certain it can be restarted safely.

today’s patch

Workflow graphs, retry wrappers, and a state dict with a comment that says do not touch.

the ceiling

Every team maintains half a workflow engine — and correctness still rides on the model's honor.

06

A prompted policy is a request, not a rule

State a rule in the prompt and the model complies — probabilistically. Worse, when it doesn't comply, it reports that it did: a skipped verification produces output indistinguishable from a completed one. Post-hoc filters catch some failures, but they judge the artifact, not the process — fluent wrongness sails through.

Real systems don't work this way anywhere else. Rules are enforced by mechanisms outside the thing being governed: type systems, transactions, permissions. Determinism is the property that makes a rule a rule. Agents deserve the same.

prompt: "always verify claims against the source before concluding" model: Done! All claims verified. ✓ (they were not) — versus — verify=grounded → FAIL: claim 3 has no source on record → step does not commit
symptom

“Done — all claims verified.” They were not.

today’s patch

Louder prompts, and a second model hired to grade the first.

the ceiling

The enforcer is the thing being enforced. Judges reward fluency — and fluency is what wrongness wears.

And beneath all of it sits a bill that only grows.

Chapter 3

The economics nobody chose

Why every serious agent still runs on the most expensive model available.

07

Small models were supposed to make this cheap

Small language models exist, they're fast, and they cost a fraction of frontier prices. By every economic argument they should be running most agent workloads by now. They aren't — because their efficiency is bought with architectural compromises on memory. Inside a small model, context handling is uneven by design: some transformer layers attend to the whole context while many see only a local sliding window, and the optimizations layered on top — eviction, summarization, cache compression — keep pruning what's retained as the run grows.

The result isn't just weaker long-range recall. It's unauditable forgetting: nobody can say which fact fell out of which layer's window at which step. Over a two-hour agentic run a small model quietly loses the thread — so teams route everything to frontier models and pay many times more per token, not because the work needs it, but as insurance against forgetting. The bill scales with caution, not with work.

symptom

The model bill is priced as insurance against forgetting, not as the cost of the work.

today’s patch

Route everything long-horizon to the frontier tier, and absorb the premium as a cost of doing business.

the ceiling

Spend scales with caution instead of with work — exactly backwards for scaling anything.

None of these are model problems.
They're substrate problems.

Better models won't fix them — a smarter agent still forgets at the compaction cliff, still carries its knowledge in one tool's session file, still runs on a hand-written loop, still treats your policy as a suggestion. And a bigger model doesn't fix the economics; it is the economics. What's missing sits under the model: durable typed memory, and execution that is governed by code instead of vibes.

That's the layer we've been building.

introducing

Typestate — the substrate under the agent.

One system, four commitments — each aimed squarely at the problems above.

Memory as an asset, not a session 01 · 02 · 03

Everything an agent reads and produces lands in a typed, time-aware knowledge graph that reconciles itself as it grows — decisions, constraints, dead-ends, with their history. It survives compaction, survives the session, and mounts into any tool over open protocols. Ask it a question; it answers with its sources.

Loops from plain English 03 · 05

Describe the workflow in prose. Typestate compiles it into a governed multi-agent loop — ordering, retries with feedback, fan-out and joins, durable resumable state, human checkpoints — so the loop you used to hand-write and babysit becomes a spec you edit.

Rules enforced in code, not prompts 04 · 06

Every step commits only after a deterministic check over the recorded evidence — applied at every step, at any context length, on both sides of any compaction. A conclusion the evidence doesn't support is refused, visibly, with the reasons on record. No silent “done.”

Cut the bill — don't grow it 07

When the memory lives outside the model and the rules are enforced in code, the model no longer has to be the biggest one you can afford. Typestate carries the long-horizon memory and the guarantees, so small, cheap models become safe for serious work — the frontier-model insurance premium goes away. Plan for AI spend to go down.

typestate.ai — coming soon
Early access opens for design partners first.