Doppleganger
Description
Prevents duplicate subagent sessions running the same task. Saves tokens and reduces lag—no more "multiple Spidermen" doing the same work.
Doppleganger
One task, one agent. Doppleganger stops duplicate subagent sessions from running the same task. That prevents token overspend, UI lag, and the chaos of five identical "task completed" announcements.
Usage
- - The orchestrator already runs a duplicate check before
sessions_spawn (see delegate rule); Doppleganger is the named skill for that behavior. - User says: "prevent duplicate agents", "stop dopplegangers", "why are so many agents doing the same thing?"
- You want a single entry point to check whether a task is already running before spawning.
CODEBLOCK0
JSON output:
- -
{"duplicate": false, "doppleganger_ok": true} → safe to spawn. - INLINECODE2 → do not spawn; reply that the task is already running.
Exit codes: 0 = no duplicate (or check ok). 1 = error. 2 = duplicate detected.
What it does
- - check / guard — Given a task string (the same one you would pass to
sessions_spawn), returns whether that task is already running. If yes, the orchestrator must not spawn again. - Uses the subagent-tracker's
check-duplicate under the hood (one source of truth for runs/sessions).
Orchestrator
The delegate rule runs a duplicate check before every sessions_spawn; that check can be implemented by calling Doppleganger (or subagent-tracker check-duplicate) with the router's task string. If duplicate: true, do not call sessions_spawn.
Name
"Doppleganger" = the duplicate agent doing the same thing. One Spiderman is enough.
分身代理
描述
防止多个子代理会话同时执行同一任务。节省令牌并减少延迟——不再出现多个蜘蛛侠做同一份工作的情况。
分身代理
一个任务,一个代理。 分身代理阻止多个子代理会话运行同一任务。这可以防止令牌超支、界面卡顿以及五个相同的任务完成通知造成的混乱。
使用方法
- - 编排器在 sessions_spawn 之前已经运行重复检查(参见委托规则);分身代理是该行为的命名技能。
- 用户说:防止重复代理、阻止分身代理、为什么这么多代理在做同一件事?
- 你需要一个单一的入口点来检查任务是否已在运行,然后再生成代理。
bash
python3 /Users/ghost/.openclaw/workspace/skills/doppleganger/scripts/doppleganger.py check <任务字符串> [--json]
python3 /Users/ghost/.openclaw/workspace/skills/doppleganger/scripts/doppleganger.py guard --task <任务> [--json]
JSON输出:
- - {duplicate: false, dopplegangerok: true} → 可以安全生成。
- {duplicate: true, reason: running, sessionId: ..., key: ..., dopplegangerok: true} → 不要生成;回复该任务已在运行。
退出代码: 0 = 无重复(或检查通过)。1 = 错误。2 = 检测到重复。
功能说明
- - check / guard — 给定一个任务字符串(与传递给 sessions_spawn 的相同),返回该任务是否已在运行。如果是,编排器不得再次生成。
- 底层使用子代理追踪器的 check-duplicate(运行/会话的唯一数据源)。
编排器
委托规则在每次 sessionsspawn 之前运行重复检查;该检查可以通过使用路由器的任务字符串调用分身代理(或子代理追踪器 check-duplicate)来实现。如果 duplicate: true,则不调用 sessionsspawn。
名称
分身代理 = 做同一件事的重复代理。一个蜘蛛侠就够了。