Token Efficiency Improvements for GitHub Agentic Workflows
Key point
GitHub revealed optimizations that reduce token usage in agentic workflows.
Details
Starting in April 2026, GitHub began systematically reducing token usage in agentic workflows. CI-style workflows defined in YAML and run repeatedly are easier to optimize than interactive sessions, and their costs tend to accumulate unnoticed.
Using the API proxy in the security architecture, GitHub consolidated usage from Claude CLI, Copilot CLI, and Codex CLI into a single format. Every workflow leaves behind a token-usage.jsonl artifact, and each day the Auditor aggregates recent usage and anomalies while the Optimizer finds inefficiencies and generates improvement proposals as GitHub issues.
The two biggest sources of savings were:
- Removing unused MCP tools: In a GitHub MCP server with 40 tools where only 2 are actually used, the remaining schemas add 10-15KB of overhead per turn.
- Replacing GitHub MCP with GitHub CLI: Data such as PR diffs, changed files, and review comments was handled via pre-agentic data downloads using
ghahead of time, while runtime calls used in-agent CLI proxy substitution with a transparent HTTP proxy.
Efficiency was evaluated using Effective Tokens (ET) instead of raw token counts. Applying ET = m × (1.0 × I + 0.1 × C + 4.0 × O) reflected per-model cost differences, weighting Haiku at 0.25×, Sonnet at 1.0×, and Opus at 5.0×. Cache read tokens were calculated at 0.1× and output tokens at 4.0× to match the actual cost structure.
Of 12 production workflows in the gh-aw and gh-aw-firewall repositories, 9 were optimized, and only items with 8 or more runs both before and after were analyzed. Representative results include Auto-Triage Issues (-62%), Daily Compiler Quality (-19%), Community Attribution (-37%), Security Guard (-43%), and Smoke Claude (-59%). For workflows like Auto-Triage Issues that run an average of 6.8 times a day, the cumulative savings effect was especially large, with estimated savings reaching 7.8M ET.
However, efficiency shouldn't be judged by numbers alone. Contribution Check saw a 5% increase in ET as the share of larger PRs grew, but this reflects a change in workload rather than worsening efficiency. GitHub noted that many agent turns are effectively deterministic data collection, and that unnecessary tools and faulty rules can cause runaway behavior such as 64-turn infinite loops.
This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.
Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.