Skip to content

v0.41.0: SubagentStop budget feedback (env-gated, CC 2.1.163+)#39

Merged
Shahinyanm merged 1 commit into
masterfrom
v0.41.0-subagent-feedback
Jun 5, 2026
Merged

v0.41.0: SubagentStop budget feedback (env-gated, CC 2.1.163+)#39
Shahinyanm merged 1 commit into
masterfrom
v0.41.0-subagent-feedback

Conversation

@Shahinyanm
Copy link
Copy Markdown
Member

CC 2.1.163 added: Stop and SubagentStop hooks can now return hookSpecificOutput.additionalContext. Unlocks in-the-moment feedback from the v0.40.0 SubagentStop capture — useful for dynamic workflows (a /workflow run fans out to tens–hundreds of agents).

Doctrine applied — verified the binary FIRST. The user's active CC is 2.1.161, which does NOT support additionalContext from SubagentStop (returning it there = hook error, the v0.34.0-args class). So this is strictly env-gated, default OFF, documented 2.1.163+ only.

When TOKEN_PILOT_SUBAGENT_FEEDBACK=1 AND CC ≥ 2.1.163:

  • decideSubagentFeedback() — when an active token-pilot workflow is at ≥90% of its token ceiling, returns a wind-down note so a large fan-out stops dispatching before the budget blows. Silent otherwise.
  • emission gated behind the flag; default path (telemetry-only, v0.40.0) unchanged + safe on every CC version.

Pure logic fully unit-tested; CC-side emission verifiable only on 2.1.163 (user not there yet) → hence the flag.

1333/1333 tests pass.

CC 2.1.163 added: "Stop and SubagentStop hooks can now return
hookSpecificOutput.additionalContext to give Claude feedback and keep
the turn going without being labeled a hook error." That unlocks
in-the-moment feedback from our v0.40.0 SubagentStop capture, useful
for the new dynamic-workflows era (a /workflow run fans out to tens-
hundreds of agents).

Verified against the user's installed bundle FIRST (the doctrine):
the active CC is 2.1.161, which does NOT support additionalContext
from SubagentStop — returning it there is labelled a hook error
(noise, the v0.34.0-args failure class). So this is strictly
env-gated, default OFF, and documented as 2.1.163+ only.

What it does (when TOKEN_PILOT_SUBAGENT_FEEDBACK=1 AND CC >= 2.1.163):
  - decideSubagentFeedback(): when an active `token-pilot workflow`
    is at >=90% of its token ceiling, returns a wind-down note so a
    large fan-out stops dispatching new agents before the budget
    blows. Silent otherwise — no nagging on every completion; broad
    adoption nudges stay in SessionStart.
  - renderSubagentFeedback(): wraps it in the SubagentStop
    hookSpecificOutput shape.
  - hook-subagent-stop emits it ONLY behind the env flag; the
    default path (telemetry write only, v0.40.0) is unchanged and
    safe on every CC version.

Pure logic is fully unit-tested; the CC-side emission can only be
verified once on 2.1.163 (the user is not there yet) — hence the flag.

Tests: 1333/1333 pass (+5).
Build: clean (25 agents under 0.41.0).
@Shahinyanm Shahinyanm merged commit 6b0ddd7 into master Jun 5, 2026
@Shahinyanm Shahinyanm deleted the v0.41.0-subagent-feedback branch June 5, 2026 06:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant