agent-context-isolation by parcadei/continuous-claude-v3
npx skills add https://github.com/parcadei/continuous-claude-v3 --skill agent-context-isolation防止智能体输出污染主上下文窗口。
# 正确 - 后台智能体写入文件,主智能体读取文件
Task(subagent_type="...", run_in_background=true, prompt="... Output to: /path/to/file.md")
# 错误 - 前台智能体将完整记录转储到主上下文
Task(subagent_type="...", run_in_background=false)
使用 run_in_background=true 的后台智能体可以隔离其上下文。让它们将结果写入 .claude/cache/agents/<agent-type>/ 目录下的文件中。
# 错误 - 将整个记录(超过 7 万个令牌)转储到上下文中
TaskOutput(task_id="<id>")
TaskOutput(task_id="<id>", block=true)
# 正确 - 检查预期的输出文件
Bash("ls -la .claude/cache/agents/<agent-type>/")
Bash("bun test") # 通过测试验证
TaskOutput 会返回完整的智能体记录。应始终使用基于文件的协调方式。
# 系统提醒会自动出现:
# "Agent a42a16e progress: 6 new tools used, 88914 new tokens"
# 检测完成状态:
# - 观察进度提醒是否停止出现
# - 轮询预期的输出文件:find .claude/cache/agents -name "*.md" -mmin -5
# - 检查任务输出文件大小增长:wc -c /tmp/claude/.../tasks/<id>.output
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
检测卡住的智能体:
智能体工作完成后:
bun test研究智能体 → .claude/cache/agents/oracle/output.md
↓
规划智能体 → .claude/cache/agents/plan-agent/output.md (读取研究结果)
↓
验证智能体 → .claude/cache/agents/validate-agent/output.md (读取规划)
↓
实施智能体 → src/module.ts (读取已验证的规划)
每个智能体读取前一个智能体的文件输出,而非使用 TaskOutput。
智能体上下文隔离可以保留主对话的上下文预算。通过 TaskOutput 读取智能体输出会淹没上下文,导致:
每周安装量
220
代码仓库
GitHub 星标数
3.6K
首次出现时间
2026年1月22日
安全审计
安装于
opencode211
codex210
gemini-cli207
cursor206
github-copilot205
amp199
Prevent agent output from polluting the main context window.
# 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>/.
# 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.
# 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:
After agent work:
bun testResearch 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.
Agent context isolation preserves the main conversation's context budget. Reading agent outputs via TaskOutput floods context, causing:
Weekly Installs
220
Repository
GitHub Stars
3.6K
First Seen
Jan 22, 2026
Security Audits
Gen Agent Trust HubFailSocketPassSnykPass
Installed on
opencode211
codex210
gemini-cli207
cursor206
github-copilot205
amp199
AI Elements:基于shadcn/ui的AI原生应用组件库,快速构建对话界面
60,400 周安装
iOS Swift Core Bluetooth 开发指南:BLE 扫描连接与数据交换
523 周安装
iOS App Clips 开发指南:轻量级即时应用创建、调用与配置
518 周安装
Airflow DAG编写指南:使用af CLI创建与验证DAG的最佳实践
508 周安装
iOS设备完整性验证:DeviceCheck与App Attest完整指南 | Swift开发
520 周安装
AI每日摘要:从90个热门技术博客中智能筛选最新文章,生成每日AI精选摘要
516 周安装
FFmpeg视频处理与编辑自动化教程:剪辑、转场、音频混音、批量处理与导出优化
519 周安装