Loading patterns…
Filesystem as Context (Context Offloading)(FSC)
Treat the agent's own file tools plus the operating-system filesystem as unbounded, persistent, agent-operable external memory. Token-heavy tool outputs such as search results, page dumps, and large files are written to disk and replaced in the message history by a short reference (a path plus a one-line summary); the agent re-reads or greps the file on demand. This keeps the live context window small and the KV-cache prefix stable while preserving full recoverability, unlike lossy summarization. Distinct from `context-write-patterns` (which teaches memory abstractions like buffers and vector stores rather than the agent reading and writing its own scratch files) and from `plan-todo-recitation`, which is only the todo.md-recitation slice of this larger idea.
In 30 seconds
- What
- Agent writes large tool outputs to disk files and replaces them in context with path plus one-line summary, re-reading on demand.
- When to use
- Multi-turn work with large search results, page dumps, or file payloads that would bloat the context window or destabilize the KV-cache.
- Watch out
- Filesystem storage is finite and requires management; agent must verify file existence and freshness before assuming cached references remain valid.
Ask the AI expert about this pattern
Opens the assistant with your question prefilled. You review it before sending.
Filesystem as Context (Context Offloading): Overview
Treat the agent's own file tools plus the operating-system filesystem as unbounded, persistent, agent-operable external memory. Token-heavy tool outputs such as search results, page dumps, and large files are written to disk and replaced in the message history by a short reference (a path plus a one-line summary); the agent re-reads or greps the file on demand. This keeps the live context window small and the KV-cache prefix stable while preserving full recoverability, unlike lossy summarization. Distinct from `context-write-patterns` (which teaches memory abstractions like buffers and vector stores rather than the agent reading and writing its own scratch files) and from `plan-todo-recitation`, which is only the todo.md-recitation slice of this larger idea.
- File tools (read, write, grep) used as the agent's external memory
- Large tool outputs written to disk, replaced by path plus short summary in context
- Re-read or grep on demand to recover the exact bytes when needed
- Stable KV-cache prefix because prior turns are not rewritten
- Lossless: the full payload stays retrievable, unlike summarization
- Persists across turns and sessions, unbounded by the context window
The Agent Architect
One pattern, one tradeoff, one production failure story. A short weekly briefing for people building agentic systems.
Weekly email, one-click unsubscribe. We only use your address to send the briefing.
References
The papers, specifications, and repositories this pattern is based on.
From the engineer behind this catalog
Get your agent architecture reviewed
This page documents one pattern. Your system runs dozens, and most failures live in how they fit together. Have the whole design reviewed against the 288 patterns in this catalog: architecture, reliability, evaluation and cost, every finding mapped to the pattern that fixes it.
€750 instead of €1,500, one week, written report and walkthrough call, until 30 September