feat: token-efficiency reinforcement — wiki page + token-report.sh + skill directives (run tokeff) - #132
Merged
Merged
Conversation
…ration) Add a sourced wiki page on token-efficient context management for long-lived coordinator/worker agent sessions: cache pricing mechanics, /compact vs /clear at phase boundaries, delegating visual verification to subagents (with the current image patch-token formula), bounding tool output, and sizing orchestrated runs against measured Anthropic multipliers. Routes into wiki/infrastructure/index.md and INDEX.md. t1 of 3 (t1-wiki-token-efficiency): t2 will cite this page's slug from the orchestrate skill docs. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WjskPUNcUjsE9qzcxhuLGv
Ships token-report.sh: reports per-session and total token usage (calls, output tokens, cache hit %, final/peak context) from Claude Code session transcript JSONL, so an orchestration run can audit its own token efficiency at teardown. POSIX sh + jq, fail-fast validation (exit 2 usage, exit 4 malformed LO_CTX_WARN), with a synthetic-fixture bats suite. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PucyFRX7yfYniePZa9oVaA
…mplates Wire t1's token-budget wiki page and t3's token-report.sh into the orchestrate skill's own instructions: a coordinator token-budget section plus a post-teardown token-report audit step in SKILL.md, a bounded-output and visual-delegation rule in session-prompt.md's subagent protocol, and a token-hygiene constraint line in brief.md. Each cites wiki/infrastructure/agent-orchestration/session-context-token-budget.md. Sharpens the byte-cksum guard in tests/send-prompt.bats that reddened from the session-prompt.md addition, and adds tests/orchestrate-token-budget.bats with dedicated doc-gates (positive assertion + negative control) for the SKILL.md and brief.md changes.
… union of index rows Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DSmPhBqtbkfieq2kTzLWhJ
choiyounggi
added a commit
that referenced
this pull request
Aug 21, 2026
… page + token-report.sh + skill directives) (#132) (#133) Claude-Session: https://claude.ai/code/session_01DSmPhBqtbkfieq2kTzLWhJ Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Token-efficiency reinforcement for orchestration runs — grounded in a measured audit (2026-08-21) of live dev-loop coordinator/worker transcripts and verified Anthropic sources. Three pieces, one per task of orchestration run
tokeff:wiki/infrastructure/agent-orchestration/session-context-token-budget.md— 5 sourced directive clusters: cache mechanics (reads ~0.1x, writes ~1.25x; accumulated context is the cost driver), phase-boundary/compact//clear, visual verification delegated to subagents (current 28px-patch image formula, not the outdated /750 one), bounded tool output, architecture-scaled slot budgets (4x/15x/7x measurements). Routed in both index layers.skills/orchestrate/scripts/token-report.sh— per-session + total report (calls, output tokens, cache hit %, final/peak context) from session transcript JSONL;--cwdproject-path mapping;LO_CTX_WARNpeak-context warnings (default 300000); fail-fast exit 0/2/4. 14 bats cases on synthetic fixtures./compactat the two human gates) and a teardown token-audit step invoking token-report.sh; session-prompt worker protocol gains token-hygiene item [4]; brief template gains a token-hygiene constraint. 6 new doc-gates with negative controls; send-prompt cksum guard bumped per its own protocol in the same commit.Ingest report (wiki addition)
⌈w/28⌉ × ⌈h/28⌉patch formula (the circulating(w×h)/750figure is outdated); "superlinear" not attributed to Anthropic — the verified resend mechanism is stated in the page's own voiceVerification
warn:lines🤖 Generated with Claude Code
https://claude.ai/code/session_01DSmPhBqtbkfieq2kTzLWhJ