Stateless Agent Memory Pattern
Design pattern for agents that run in ephemeral, stateless environments (such as Claude Code cloud routines). Because no runtime state persists between sessions, the agent writes everything it learns to files in the GitHub repo and commits them back — so the next agent can read those files on wake-up and maintain continuity.
Key points
- Each routine run wakes up → reads memory files from repo → does work → writes updated knowledge back → commits to repo [src-010]
- Files act as the persistent personality and discipline layer: trading rules, past decisions, risk parameters, style guides, preferences [src-010]
- “Files aren’t just memory, but they’re essentially the agent’s full personality and discipline.” — Nate Herk [src-010]
- Treat repo size as a token budget: each file read costs tokens. Use dedicated per-routine repos rather than large monorepos to avoid loading irrelevant context [src-010]
- Extends naturally to multi-routine architectures: five separate trading routines (pre-market, execution, midday, end-of-day, weekly) all read and write to the same shared memory files via the same GitHub repo [src-010]
- Anthropic’s scientific-computing workflow uses a similar file-backed continuity pattern:
CHANGELOG.mdrecords progress, failed approaches, accuracy checkpoints, and known limitations across long-running Claude Code sessions [src-072]. - In scientific work, recording failed approaches is especially important because otherwise later sessions can repeat numerically plausible but already-disproven paths [src-072].
- Hermes uses a personal-agent version of the same pattern:
user.mdcaptures stable identity/preferences,memory.mdcaptures environment and project context, and a SQLite-backed session search can retrieve older conversations [src-074]. - Nate draws a boundary around memory quality: long-term memory should not store secrets, temporary task state, or every trivial preference; the agent should be told explicitly when a fact should persist [src-074].
Related entities
- Claude Code — the runtime where this pattern is applied
- Alpaca Markets — example: trading rules and journal files are the persistent memory for the trading agent
Related concepts
- Claude Code Cloud Routines — the execution environment this pattern is designed for
- Claude Code Memory 2.0 (AutoDream) — stateless memory extends local session memory to distributed cloud execution
- Progressive Context Loading (Skills) — related principle: load only what’s needed per run
- Agent Progress File Memory
- Long-Running Scientific Agents
- Hermes Five-Pillar Agent Architecture
- Personal Agent Container Isolation
Source references
- [src-010] Nate Herk — Cloud agents & model releases cluster (2026-04-14 to 2026-04-17)
- [src-072] Siddharth Mishra-Sharma – “Long-running Claude for scientific computing” (2026-03-23)
- [src-074] Nate Herk — “Hermes Agent: Zero to Personal AI Assistant (1 Hour Course)” (2026-05-10)
Recommended next
Keep reading from this thread
From 494 indexed pages and articles.
- Wiki concept Agent Progress File Memory The practice of keeping long-running agent state in an explicit file such as CHANGELOG.md, so future sessions Related by approaches
- Wiki concept Claude Code Cloud Routines Cloud-hosted scheduled agent feature in Claude Code. Configure a prompt once; it runs on Anthropic's infrastructure on a cron schedule, via API Related by 010
- Insight AI Measurement and Experimentation How to measure AI product impact with evals, adoption metrics, online experiments, guardrails, and cost tracking Readers have engaged with this next