AG

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.zip

Installs 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 Isolation
23 charsno explicit “when” trigger
Intermediate

Key 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

You give it
A sub-agent task request
You get back
A file-based output artifact in the cache directory

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:

  1. Progress reminders stop arriving
  2. Task output file size stops growing
  3. Expected output file not created after reasonable time

4. Verify with Tests, Not Output

After agent work:

  1. Run the test suite directly: bun test
  2. Report pass/fail counts
  3. 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.

SkillInstallsUpdatedSafetyDifficulty
agent-context-isolation (this skill)47moReviewIntermediate
posthog-webhooks-events127dCautionIntermediate
using-superpowers953moNo flagsBeginner
ultrawork112moNo flagsAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

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".

11

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

95205

ultrawork

Yeachan-Heo

Parallel execution engine for high-throughput task completion

11184

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.

14174

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.

47140

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.

25151

Search skills

Search the agent skills registry