A session whose first request says an agent, not the user, sent it is a worker, so the direct-call limit no longer kills a delegated worker

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Sonnet 5.5 committed 2026-11-24 13:31:46 -07:00
1 parent abd48cba8f
commit 85b9f1489d
2 files changed
+19 -2

No files matched your search

+3 -2
View File
@@ -5,8 +5,9 @@ should be delegating. The end-of-turn hook forces the retro when work was done."
import json, os, re, sys, time
from . import models, rules, store
# A delegated session says so in the first lines of its first request (the brief).
WORKER = re.compile(r"(?im)^\W*(you are a (worker|subagent|sub-agent|delegate)\b|do this task yourself|do not delegate)")
# A delegated session says so in the first lines of its first request (the brief), or a host's bracketed line
# at the start of a line says an agent, not the user, sent it.
WORKER = re.compile(r"(?im)^\W*(you are a (worker|subagent|sub-agent|delegate)\b|do this task yourself|do not delegate|\[[^\]\n]{0,200}\bsent this message, not the user\.?\])")
DIRECT = ("shell", "read", "edit", "search", "web") # the classes of tool call the meter counts
METER = ("sisi: %d direct tool calls this turn (the limit is %d). Delegate the rest: `sisi models` lists your "