background-agent-pings

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Background Agent Pings

后台Agent进度提醒

Trust system reminders as agent progress notifications. Don't poll.
将系统提醒作为Agent进度通知,请勿轮询。

Pattern

模式

When you launch a background agent, continue working on other tasks. The system will notify you via reminders when:
  • Agent makes progress:
    Agent <id> progress: X new tools used, Y new tokens
  • Agent writes output file (check the path you specified)
当你启动一个后台Agent时,继续处理其他任务。当出现以下情况时,系统会通过提醒通知你:
  • Agent取得进展:
    Agent <id> progress: X new tools used, Y new tokens
  • Agent写入输出文件(请检查你指定的路径)

DO

正确做法

1. Task(run_in_background=true, prompt="... Output to: .claude/cache/agents/<type>/output.md")
2. Continue with next task immediately
3. When system reminder shows agent activity, check if output file exists
4. Read output file only when agent signals completion
1. Task(run_in_background=true, prompt="... Output to: .claude/cache/agents/<type>/output.md")
2. 立即继续下一个任务
3. 当系统提醒显示Agent活动时,检查输出文件是否存在
4. 仅当Agent发出完成信号时再读取输出文件

DON'T

错误做法

undefined
undefined

BAD: Polling wastes tokens and time

错误:轮询会浪费token和时间

Task(run_in_background=true) Bash("sleep 5 && ls ...") # polling Bash("tail /tmp/claude/.../tasks/<id>.output") # polling TaskOutput(task_id="...") # floods context
undefined
Task(run_in_background=true) Bash("sleep 5 && ls ...") # 轮询 Bash("tail /tmp/claude/.../tasks/<id>.output") # 轮询 TaskOutput(task_id="...") # 占用上下文空间
undefined

Why This Matters

为什么这很重要

  • Polling burns tokens on repeated checks
  • TaskOutput
    floods main context with full agent transcript
  • System reminders are free - they're pushed to you automatically
  • Continue productive work while waiting
  • 轮询会在重复检查中消耗token
  • TaskOutput
    会将完整的Agent记录填满主上下文
  • 系统提醒是免费的——会自动推送给你
  • 等待期间可继续开展有成效的工作

Source

来源

  • This session: Realized polling for agent output wasted time when system reminders already provide progress updates
  • 本次会话:当系统提醒已能提供进度更新时,意识到轮询Agent输出是在浪费时间