Skip to content

An agent that reads and updates a bounded, domain-owned mental model across sessions becomes measurably better at session 50 — a stateless generalist is the same agent every time.

Principle

Specialization Compounds

The wager

Session 50 is the tell.

Two agents. Same codebase. Fifty sessions.

domain skill →s1s25s50

— Stateless generalist Rediscovers conventions every run. Session 50 agent ≡ session 1 agent. Every run pays the cold-start tax.

— Specialized + updatable Reads a bounded model, appends what it learned. Carries 50 sessions of domain learnings. This is the compounding.

Without state, the agent is tired at session 1 and tired at session 50.

The mechanism

A mental model works only when all three hold.

① Bounded

~200-line budget. Oldest summarizes.

Loads in hundreds of tokens, replaces thousands of rediscovery.

Miss this → 2,000 lines of lore, noise drowns signal.

② Updatable

Agent appends after non-obvious learnings.

Not every task updates. Only the ones where something was actually learned.

Miss this → read-only snapshot goes stale fast.

③ Domain-owned

One role, one file, one owner.

backend-mental-model.yaml doesn't carry frontend context. Role is the boundary.

Miss this → specialization inverts into generality.

Drop any one property and the file stops being memory — it becomes noise, staleness, or cross-contamination.

The artifact

One file, five sections, one owner.

expertise/backend-mental-model.yaml

# role: backend-dev · owner: /backend-dev agent · budget: 200 linesconventions:stable-"migrations always go through just migrate"-"API responses use snake_case, never camelCase"gotchas:hard-won-"auth middleware runs AFTER CORS — order matters"-"sessions cache bypasses Redis on staging"architectural_decisions:load-bearing-"we chose pgvector over Pinecone — don't revisit"preferred_patterns:opinionated-"use Result[T, E], not raise — errors are data"known_debt:ack'd-"jobs/worker.py is a mess — scheduled for rewrite"

Five sections loads in hundreds of tokens — and replaces thousands of tokens of rediscovery the agent would otherwise pay every session.

What breaks it

Four failure modes. Each kills the compounding.

Stateless (no file)

Every session is session 1. Agent relearns conventions, reinvents the auth pattern, guesses at gotchas. Quality ceiling is bounded by cold-start.

Read-only (never updated)

Memory without learning. File is a snapshot of an earlier state. Agent reads it, notices it's wrong, doesn't write back. Staleness compounds instead of skill.

Unbounded (no line budget)

Noise dominates signal. By session 100, 2,000 lines of accumulated lore. Agent's context budget is spent reading the memory, not doing the work.

Shared across roles

Specialization inverts. Backend's file accumulates frontend details. Each role carries both domains. Agents get more generic with each update — not more specialized.

The file is memory only when all four traps are avoided — miss one and compounding stops.

The discipline

One role, one file, one owner, one line budget.

Institutional memory is a shape, not a hope. Agents that write back become better engineers in their domain with every session. Agents that don't stay tired forever.