Claude Code subagents start with a blank context window. When they finish, the transcript disappears. A shared state folder lets every subagent read what the others wrote.
The orchestrator spawns a subagent with a prompt and a set of tools. The subagent gets its own context window, does its work, then reports a final message back.
The full transcript (every tool call, every intermediate thought) dies with the subagent. The orchestrator only sees the summary. Isolation prevents cross-contamination, but no discovery survives unless someone writes it down.
| Without shared state | With shared state | |
|---|---|---|
| Findings | Summary only | Full files on disk |
| Evidence | Lost with transcript | Persisted in state folder |
| Next subagent | Starts from zero | Reads prior work first |
| Retries | Re-learn everything | Continue from last state |
Instead of only reporting a summary, the subagent writes its findings to a shared folder. The next subagent reads that folder before it starts. The folder is the shared memory, not the orchestrator's context window.
This pattern works because files are durable, inspectable, and tool-accessible. Any subagent with access to the folder can read what any other subagent wrote, regardless of when it ran.
gcontext is an MCP server that serves a folder of plain text files. Every subagent connected to the parent session gets the same tools: read_file, write_file, list_dir, grep.
Every file is also an MCP resource at gcontext://modules/research/findings.md. The orchestrator can attach a resource directly to a subagent's prompt.
The second subagent reads the prior findings before it starts its own work. It skips redundant searches and builds on what Agent A already discovered.
Tell your subagents to read the module index before they start work. Add one line to the orchestrator prompt: "Before searching, read modules/task/index.md for prior findings."
modules/task/runs/YYYY-MM-DD/. Delete them after you extract what matters.modules/task/index.md.Concurrent writes need discipline. If two subagents write to the same file at the same time, the last write wins. Use append-only files, or give each agent its own output file.
State reads cost tokens. Every file a subagent reads consumes context window space. Keep files small and focused so agents only load what they need.
No. Each subagent starts with a fresh context window. They share access to MCP servers connected to the parent session, but they do not share the parent's conversation history.
Two ways: through the prompt string the orchestrator sends, or by connecting both the parent and the subagent to an MCP server where the context is stored as files.
Yes, but the last write wins. Use append-only patterns or separate files per agent to prevent conflicts.
One MCP server. Every subagent reads and writes the same state folder.