You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Source report:(no claude-token-usage-report issue found; analysis based on local run data at .github/aw/logs/) Runs analyzed: 11 runs over ~3 days (2026-07-01 to 2026-07-04) Average AIC per run: 49.35 (range: 35.5–55.7) Total tokens per run: ~357,500 (avg: 3,299 input + 841 output + 294,293 cache_read + 52,050 cache_write) Cache write rate: ~14.6% of total token volume — but 67.8% of estimated cost Cache read rate: 98.9% hit rate (excellent prefix caching) LLM turns per run: 1 (single request; max-turns: 8 is over-provisioned) Model configured:claude-haiku-4-5 — Model actually used:claude-opus-4-8⚠️ Estimated cost per run (opus-4-8 pricing): ~$0.57 Estimated cost per run (haiku-4-5 pricing): ~$0.11
Current Configuration
Setting
Value
Tools loaded
1 (bash)
Tools actually used
bash (reads pre-computed JSON, calls safeoutputs)
github:
false (correct)
Network groups
defaults (60+ domains, only api.anthropic.com actually used)
Pre-agent steps
✅ Yes — smoke file, PR fetch, GitHub reachability, result JSON all pre-computed
Prompt size
7,092 bytes (~1,800 tokens)
max-turns
8 (only 1 turn ever used)
Ambient context
5,786 tokens (main branch AGENTS.md) vs 3,289 tokens (PR branches)
Recommendations
1. Investigate why claude-haiku-4-5 is being served as claude-opus-4-8
Estimated savings: 80% cost reduction ($0.46/run, ~$6.44/week at 14 runs/week)
The workflow frontmatter specifies model: claude-haiku-4-5 and the lock file confirms GH_AW_INFO_MODEL: "claude-haiku-4-5" and ANTHROPIC_MODEL: claude-haiku-4-5. However, every run's agent_usage.json shows "primary_model": "claude-opus-4-8".
This is the single largest cost driver. The models: section in the AWF config lists "claude": ["agent"] → "agent": ["sonnet-6x", "gpt-5.5", ..., "any"] — this model steering configuration appears to override the workflow's explicit haiku request and upgrade to opus.
Investigation steps:
Check AWF config models.agent — currently set to ["sonnet-6x", "gpt-5.5", "gpt-5.4", "gpt-5.3", "gemini-pro", "any"]. The "any" entry permits any model and may be causing haiku requests to be re-routed.
Verify if .github/aw/models.json or GH_AW_MODELS_JSON_PATH overrides the model at runtime.
Add model_override_check to the verify_token_usage job to assert primary_model contains haiku.
If haiku were used, pricing would drop from opus rates ($5/M input, $25/M output, $6.25/M cache_write) to haiku rates ($1/M input, $5/M output, $1.25/M cache_write).
2. Reduce AGENTS.md ambient context to lower cache write cost
Estimated savings: 36K tokens cache_write/run ($0.22/run at opus, ~$0.04/run at haiku)
The ambient_context field in agent_usage.json shows 5,786 tokens on main branch runs vs 3,289 tokens on PR-branch runs — a 2,497-token difference. This directly inflates cache_write by ~35,000 tokens per run (the ambient context is written to cache on every cold start).
AGENTS.md is currently 20,345 bytes / 397 lines — much of it is CI/CD internals, container architecture details, and debugging instructions that a smoke-test agent running a single bash command does not need.
Implementation:
Add a .agents/smoke-claude/ override directory (or agentsignore equivalent) with a minimal AGENTS.md stub for this workflow, OR reduce the main AGENTS.md by moving implementation-detail sections (container architecture, traffic flow diagrams, DNS config details, iptables rules, log formats) to a separate doc referenced by link.
Alternatively, use agents-context: false or a scoped AGENTS.md to exclude the full file from this workflow's context.
Evidence: Three PR-branch runs (28663868157, 28663845911, 28663732543) on SHA abd385b1 achieved:
cache_write: 26,940 tokens (vs 61,820 on main)
aic: 35.5 (vs 55.6 on main)
This 36% AIC reduction came entirely from the smaller ambient context on that branch.
3. Reduce max-turns from 8 to 1
Estimated savings: Minor overhead reduction; improves intent documentation
Every run completes in exactly 1 LLM turn (confirmed across all 11 runs). The workflow is fully deterministic: pre-steps compute all data, agent reads /tmp/gh-aw/agent/final-result.json, calls noop or add_comment, and stops. There is no scenario requiring a second turn.
Setting max-turns: 1 in smoke-claude.md:
max-turns: 1# was: 8
Benefits:
Eliminates the overhead of turn-count tracking and guardrail processing for turns 2–8
Makes the workflow's single-turn contract explicit (documented intent)
Prevents accidental multi-turn drift if the prompt is modified
4. Verify github: false prevents the blocked MCP probe
No token savings; prevents wasted network attempt
Every run shows 1 blocked request to awmg-mcpg:8080. This is the agent attempting to call an MCP tool (likely from the safe-outputs schema probe that the prompt explicitly warns against). With github: false, no GitHub tools are loaded, but the MCP gateway is still reachable.
The prompt already warns: "Never call add_comment or add_labels with empty arguments or as a schema probe." The blocked request appears to be the agent calling safeoutputs via MCP instead of CLI. This is already handled correctly — no change needed — but worth monitoring.
Cache Analysis (Anthropic-Specific)
All runs complete in exactly 1 LLM turn (1 API request), so there is no Turn 2 amortization.
Run
Input
Output
Cache Read
Cache Write
AIC
Note
28690081250
3,298
721
233,629
60,322
51.2
main, schedule
28682360061
3,300
858
296,098
61,820
55.6
main, schedule
28682081717
3,300
865
296,032
61,809
55.6
main, schedule
28676779124
3,300
873
296,735
61,953
55.7
main, schedule
28671133963
3,300
870
296,028
61,831
55.6
main, schedule
28668175485
3,300
852
295,986
61,814
55.6
main, schedule
28663868157
3,300
863
330,989
26,940
35.5
PR branch, smaller AGENTS.md
28663845911
3,300
872
330,940
26,933
35.6
PR branch, smaller AGENTS.md
28663732543
3,300
881
331,086
26,977
35.6
PR branch, smaller AGENTS.md
28663698562
3,300
883
296,073
61,832
55.7
main, schedule
28662229580
3,298
718
233,629
60,321
51.2
main, schedule
Cache write amortization: With 1 turn/run, cache writes are never amortized within a session. They benefit the next run (5-minute Anthropic cache TTL means consecutive schedule runs 12h apart do NOT hit cache from prior runs — cache writes are effectively wasted unless two runs occur within 5 minutes).
Cache cost vs benefit: Cache reads (294K tokens × $0.50/M = $0.147) are still cheaper than re-computing input (294K × $5/M = $1.47), so cache reads are valuable. But cache writes at $6.25/M for 62K tokens = $0.387 per run — 67.8% of total cost — for context that expires before the next run. This is the primary inefficiency.
Recommendation: Since the Anthropic cache TTL is ~5 minutes and this workflow runs every 12 hours, nearly all cache writes expire unused. The cache write cost is unavoidable (Anthropic charges for all context on first request), but reducing the context size (via AGENTS.md trimming) directly reduces this cost.
Target Workflow:
smoke-claudeSource report: (no claude-token-usage-report issue found; analysis based on local run data at⚠️
.github/aw/logs/)Runs analyzed: 11 runs over ~3 days (2026-07-01 to 2026-07-04)
Average AIC per run: 49.35 (range: 35.5–55.7)
Total tokens per run: ~357,500 (avg: 3,299 input + 841 output + 294,293 cache_read + 52,050 cache_write)
Cache write rate: ~14.6% of total token volume — but 67.8% of estimated cost
Cache read rate: 98.9% hit rate (excellent prefix caching)
LLM turns per run: 1 (single request; max-turns: 8 is over-provisioned)
Model configured:
claude-haiku-4-5— Model actually used:claude-opus-4-8Estimated cost per run (opus-4-8 pricing): ~$0.57
Estimated cost per run (haiku-4-5 pricing): ~$0.11
Current Configuration
bash)bash(reads pre-computed JSON, calls safeoutputs)github:false(correct)api.anthropic.comactually used)Recommendations
1. Investigate why
claude-haiku-4-5is being served asclaude-opus-4-8Estimated savings:
80% cost reduction ($0.46/run, ~$6.44/week at 14 runs/week)The workflow frontmatter specifies
model: claude-haiku-4-5and the lock file confirmsGH_AW_INFO_MODEL: "claude-haiku-4-5"andANTHROPIC_MODEL: claude-haiku-4-5. However, every run'sagent_usage.jsonshows"primary_model": "claude-opus-4-8".This is the single largest cost driver. The
models:section in the AWF config lists"claude": ["agent"]→"agent": ["sonnet-6x", "gpt-5.5", ..., "any"]— this model steering configuration appears to override the workflow's explicit haiku request and upgrade to opus.Investigation steps:
models.agent— currently set to["sonnet-6x", "gpt-5.5", "gpt-5.4", "gpt-5.3", "gemini-pro", "any"]. The"any"entry permits any model and may be causing haiku requests to be re-routed..github/aw/models.jsonorGH_AW_MODELS_JSON_PATHoverrides the model at runtime.model_override_checkto theverify_token_usagejob to assertprimary_modelcontainshaiku.If haiku were used, pricing would drop from opus rates ($5/M input, $25/M output, $6.25/M cache_write) to haiku rates ($1/M input, $5/M output, $1.25/M cache_write).
2. Reduce AGENTS.md ambient context to lower cache write cost
Estimated savings:
36K tokens cache_write/run ($0.22/run at opus, ~$0.04/run at haiku)The
ambient_contextfield inagent_usage.jsonshows 5,786 tokens on main branch runs vs 3,289 tokens on PR-branch runs — a 2,497-token difference. This directly inflatescache_writeby ~35,000 tokens per run (the ambient context is written to cache on every cold start).AGENTS.md is currently 20,345 bytes / 397 lines — much of it is CI/CD internals, container architecture details, and debugging instructions that a smoke-test agent running a single bash command does not need.
Implementation:
Add a
.agents/smoke-claude/override directory (oragentsignoreequivalent) with a minimal AGENTS.md stub for this workflow, OR reduce the main AGENTS.md by moving implementation-detail sections (container architecture, traffic flow diagrams, DNS config details, iptables rules, log formats) to a separate doc referenced by link.Alternatively, use
agents-context: falseor a scoped AGENTS.md to exclude the full file from this workflow's context.Evidence: Three PR-branch runs (28663868157, 28663845911, 28663732543) on SHA
abd385b1achieved:cache_write: 26,940 tokens (vs 61,820 on main)aic: 35.5 (vs 55.6 on main)This 36% AIC reduction came entirely from the smaller ambient context on that branch.
3. Reduce
max-turnsfrom 8 to 1Estimated savings: Minor overhead reduction; improves intent documentation
Every run completes in exactly 1 LLM turn (confirmed across all 11 runs). The workflow is fully deterministic: pre-steps compute all data, agent reads
/tmp/gh-aw/agent/final-result.json, callsnooporadd_comment, and stops. There is no scenario requiring a second turn.Setting
max-turns: 1insmoke-claude.md:Benefits:
4. Verify
github: falseprevents the blocked MCP probeNo token savings; prevents wasted network attempt
Every run shows 1 blocked request to
awmg-mcpg:8080. This is the agent attempting to call an MCP tool (likely from the safe-outputs schema probe that the prompt explicitly warns against). Withgithub: false, no GitHub tools are loaded, but the MCP gateway is still reachable.The prompt already warns: "Never call add_comment or add_labels with empty arguments or as a schema probe." The blocked request appears to be the agent calling
safeoutputsvia MCP instead of CLI. This is already handled correctly — no change needed — but worth monitoring.Cache Analysis (Anthropic-Specific)
All runs complete in exactly 1 LLM turn (1 API request), so there is no Turn 2 amortization.
Cache write amortization: With 1 turn/run, cache writes are never amortized within a session. They benefit the next run (5-minute Anthropic cache TTL means consecutive schedule runs 12h apart do NOT hit cache from prior runs — cache writes are effectively wasted unless two runs occur within 5 minutes).
Cache cost vs benefit: Cache reads (294K tokens × $0.50/M = $0.147) are still cheaper than re-computing input (294K × $5/M = $1.47), so cache reads are valuable. But cache writes at $6.25/M for 62K tokens = $0.387 per run — 67.8% of total cost — for context that expires before the next run. This is the primary inefficiency.
Recommendation: Since the Anthropic cache TTL is ~5 minutes and this workflow runs every 12 hours, nearly all cache writes expire unused. The cache write cost is unavoidable (Anthropic charges for all context on first request), but reducing the context size (via AGENTS.md trimming) directly reduces this cost.
Expected Impact
Implementation Checklist
claude-haiku-4-5is being served asclaude-opus-4-8models.agentsteering config —"any"entry may be overriding haiku.github/aw/models.jsonoverrides model at runtimeprimary_modelassertion inverify_token_usagejobambient_contextin next run'sagent_usage.jsonmax-turns: 1insmoke-claude.md(wasmax-turns: 8)gh aw compile .github/workflows/smoke-claude.mdnpx tsx scripts/ci/postprocess-smoke-workflows.tsagent_usage.jsonfrom new run vs baseline (target: AIC < 20, cost < $0.15/run)Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
awmgmcpgSee Network Configuration for more information.