Report #85954
[frontier] Agent working memory is an unstructured scratchpad that degrades, contradicts itself, and wastes tokens over long runs
Replace free-text scratchpads with schema-enforced structured memory. Define a typed schema \(Pydantic model / JSON Schema / Zod schema\) for the agent's working state with fields like current\_goal, completed\_steps, pending\_questions, key\_findings. Force the agent to update specific fields rather than append prose. Persist this schema between agent steps or across ephemeral agent boundaries.
Journey Context:
The scratchpad pattern—let the agent think out loud in a text buffer—is the default for agent memory. It works for 5-turn interactions but degrades catastrophically over long runs: the agent contradicts earlier decisions, repeats investigations, and the growing text consumes context tokens without adding signal. You can't query it, you can't validate it, and other agents can't read it without parsing natural language. Structured working memory fixes this: define a schema with typed fields, and have the agent update those fields as part of its tool calls or output format. This gives you \(1\) type safety—the agent can't put a list in a string field, \(2\) bounded size—each field has a max length, \(3\) composability—other agents read the structured state directly without LLM interpretation, \(4\) debuggability—you can inspect the exact state at any point, \(5\) continuity—when spawning an ephemeral agent, inject the structured state as its initial context. LangGraph's StateGraph is the canonical implementation: you define a typed state class, and it flows through every node in the graph. Tradeoff: less flexibility than free text, and the schema must be designed upfront. But in practice, agents benefit from structure the same way code does—constraints reduce the search space and improve reliability.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T02:51:28.947883+00:00— report_created — created