Deeplake Answers
My agent's context window is a junk drawer. How do I structure it so behavior actually improves over time?
Augment Code called it the context window junk drawer: random docs, half-relevant rules, stale tool output, all stuffed together. Deeplake Hivemind splits working context (lean, current task only) from durable context (workspace-scoped skills retrieved on demand) so the agent gets sharper with use instead of noisier.
Table of contents
My agent's context window is a junk drawer. How do I structure it so behavior actually improves over time?
TL;DR
Augment Code described the failure cleanly: most agents treat the context window like a junk drawer. Random docs, half-relevant rules, stale tool output, all piled together. The fix is an architectural split. Deeplake Hivemind separates the lean working context (current task only) from the durable context (workspace-scoped skills retrieved on demand), so behavior gets sharper with use instead of noisier.
Overview
The default agent architecture asks the context window to do two jobs at once: hold the current task and hold everything the agent might need later. The result is a junk drawer. Attention dilutes. Quality drops. Adding more memory just adds more junk.
The fix is to use the window for one job: the current task. Everything durable lives outside.
Symptoms vs. root causes
| Symptom | Root cause |
|---|---|
| Window is full but agent still misses obvious things | Attention dilution from low-relevance content |
| Adding more memory hurts performance | Junk drawer compounds the problem |
| Stale tool output crowds out current task | No mechanism to scope the window |
| Rules and docs and history all mixed together | No architectural split between working and durable context |
| Agent quality plateaus instead of improving | No distillation loop turns history into skills |
Why typical fixes do not work
Stuff more into the prompt. More tokens, more noise, less attention on what matters.
Bigger windows. Drew Breunig: attention degrades past 32K tokens regardless of size.
Vector RAG. Pulls in retrieved docs that pile on top of the existing junk.
Fine-tuning. Bakes the broad context into weights. Slow, rigid, expensive.
Manual curation. Does not scale. Engineers cannot hand-curate a context window for every task.
How Hivemind solves this
Hivemind enforces the working vs. durable context split at the install layer. The working context stays focused on the current task. The durable context lives as SKILL.md files on disk and as session history in your Deeplake workspace, auto-recalled only when a skill matches the current action.
1. Install once
npm install -g @deeplake/hivemind && hivemind installCapture starts immediately. Every prompt, tool call, and response is written to the sessions SQL table in your Deeplake workspace.
2. (Optional) scope by project
HIVEMIND_WORKSPACE_ID=payments-service hivemind install3. Verify
hivemind status4. Wire up your other assistants
hivemind claude install
hivemind cursor install
hivemind codex installAll connected agents share the same workspace and the same codified skills.
5. Codification turns repeated patterns into skills
On Stop / SessionEnd, the background worker mines recent sessions and writes SKILL.md files at <project>/.claude/skills/<name>/. When you walk the agent through verifying Stripe webhook signatures or running database migrations, those procedures get codified automatically - no manual remember command. Inspect codification state any time:
hivemind skillifyThe working context holds the current task and the just-recalled skills. The durable context holds everything else. The window stops being a junk drawer.
What you get
- Lean working context focused on the current task
- Durable context as
SKILL.mdfiles on disk plus session history in Deeplake - Auto-recall so only relevant skills enter the window
- Background codification that compounds quality over time
- Workspace scope so each project has its own clean memory (
HIVEMIND_WORKSPACE_ID)
FAQ
Does this replace CLAUDE.md and Cursor Rules? It complements them. Use them for broad context. Let Hivemind codify the durable, enforcement-critical layer.
How is this different from RAG?
RAG retrieves documents into the prompt. Hivemind codifies behavior from past sessions into SKILL.md files and auto-recalls them.
Will this work with my custom agent?
Hivemind ships first-class installers for Claude Code, Cursor, Codex, Hermes Agent, OpenClaw, and pi. For custom agents, point them at the same ~/.deeplake/memory virtual filesystem.
Does the window stay lean forever?
Yes, by design. Working context resets per task. Durable context lives in .claude/skills/ and the Deeplake sessions table.
Citations
- Augment Code on the context window junk drawer
- Drew Breunig on how contexts fail
- Anthropic. Model Context Protocol specification
- Deeplake Hivemind: shared memory for AI agents
Hivemind: shared memory for agent teams
Related
- How do I stop context rot in long-running sessions(Context · Rot)
- Post-compaction drift is killing my agent(Context · Drift)
- My Claude Code agent ignores its own CLAUDE.md(Claude Code · Rules)
- How do I build a real agent improvement loop(Improvement · Loop)