agent-context-isolation
Prevents context window pollution by using file-based coordination for sub-agents.
Install
mkdir -p .claude/skills/agent-context-isolation && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/1576" && unzip -o skill.zip -d .claude/skills/agent-context-isolation && rm skill.zipInstalls to .claude/skills/agent-context-isolation
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Agent Context IsolationKey capabilities
- →Isolate sub-agent output in cache files
- →Monitor agent progress via system reminders
- →Verify task completion using automated tests
- →Prevent context overflow in main conversations
How it works
It enforces a file-based coordination pattern where agents write results to specific cache paths instead of streaming transcripts into the main context window.
Inputs & outputs
When to use agent-context-isolation
- →Isolate sub-agent output files
- →Monitor agent progress via logs
- →Verify agent task completion
- →Prevent token overflow in main context
About this skill
Agent Context Isolation
Prevent agent output from polluting the main context window.
Rules
1. Use Background Agents with File-Based Coordination
# RIGHT - background agent writes to file, main reads file
Task(subagent_type="...", run_in_background=true, prompt="... Output to: /path/to/file.md")
# WRONG - foreground agent dumps full transcript into main context
Task(subagent_type="...", run_in_background=false)
Background agents with run_in_background=true isolate their context. Have them write results to files in .claude/cache/agents/<agent-type>/.
2. Never Use TaskOutput to Retrieve Results
# WRONG - dumps entire transcript (70k+ tokens) into context
TaskOutput(task_id="<id>")
TaskOutput(task_id="<id>", block=true)
# RIGHT - check expected output files
Bash("ls -la .claude/cache/agents/<agent-type>/")
Bash("bun test") # verify with tests
TaskOutput returns the full agent transcript. Always use file-based coordination instead.
3. Monitor Agent Progress via System Reminders
# System reminders come automatically:
# "Agent a42a16e progress: 6 new tools used, 88914 new tokens"
# To detect completion:
# - Watch for progress reminders to stop arriving
# - Poll for expected output files: find .claude/cache/agents -name "*.md" -mmin -5
# - Check task output file size growth: wc -c /tmp/claude/.../tasks/<id>.output
Stuck agent detection:
- Progress reminders stop arriving
- Task output file size stops growing
- Expected output file not created after reasonable time
4. Verify with Tests, Not Output
After agent work:
- Run the test suite directly:
bun test - Report pass/fail counts
- Only investigate failures if tests fail
5. File-Based Agent Pipeline Pattern
Research agent → .claude/cache/agents/oracle/output.md
↓
Plan agent → .claude/cache/agents/plan-agent/output.md (reads research)
↓
Validate agent → .claude/cache/agents/validate-agent/output.md (reads plan)
↓
Implement agent → src/module.ts (reads validated plan)
Each agent reads the previous agent's file output, not TaskOutput.
Why This Matters
Agent context isolation preserves the main conversation's context budget. Reading agent outputs via TaskOutput floods context, causing:
- Mid-conversation compaction
- Lost context about user's original request
- Repeated explanations needed
Source
- Session where TaskOutput flooded 70k+ tokens into main context
- Session 2026-01-01: Successfully used background agents with file-based coordination for SDK Phase 3
When not to use it
- →When the agent output is small enough to fit comfortably in the main context
Limitations
- →Requires manual verification of output files
- →Relies on system reminders for progress tracking
How it compares
It avoids the token-heavy TaskOutput retrieval method in favor of direct file system polling and test-based verification.
Compared to similar skills
agent-context-isolation side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| agent-context-isolation (this skill) | 4 | 7mo | Review | Intermediate |
| posthog-webhooks-events | 1 | 27d | Caution | Intermediate |
| using-superpowers | 95 | 3mo | No flags | Beginner |
| ultrawork | 11 | 2mo | No flags | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by parcadei
View all by parcadei →You might also like
posthog-webhooks-events
jeremylongshore
Implement PostHog webhook signature validation and event handling. Use when setting up webhook endpoints, implementing signature verification, or handling PostHog event notifications securely. Trigger with phrases like "posthog webhook", "posthog events", "posthog webhook signature", "handle posthog events", "posthog notifications".
using-superpowers
obra
Use when starting any conversation - establishes mandatory workflows for finding and using skills, including using Skill tool before announcing usage, following brainstorming before coding, and creating TodoWrite todos for checklists
ultrawork
Yeachan-Heo
Parallel execution engine for high-throughput task completion
opencode-cli
SpillwaveSolutions
This skill should be used when configuring or using the OpenCode CLI for headless LLM automation. Use when the user asks to "configure opencode", "use opencode cli", "set up opencode", "opencode run command", "opencode model selection", "opencode providers", "opencode vertex ai", "opencode mcp servers", "opencode ollama", "opencode local models", "opencode deepseek", "opencode kimi", "opencode mistral", "fallback cli tool", or "headless llm cli". Covers command syntax, provider configuration, Vertex AI setup, MCP servers, local models, cloud providers, and subprocess integration patterns.
claude-automation-recommender
anthropics
Analyze a codebase and recommend Claude Code automations (hooks, subagents, skills, plugins, MCP servers). Use when user asks for automation recommendations, wants to optimize their Claude Code setup, mentions improving Claude Code workflows, asks how to first set up Claude Code for a project, or wants to know what Claude Code features they should use.
clawhub
openclaw
Use the ClawHub CLI to search, install, update, and publish agent skills from clawhub.com. Use when you need to fetch new skills on the fly, sync installed skills to latest or a specific version, or publish new/updated skill folders with the npm-installed clawhub CLI.