published Aug 24, 2026, 3:17 PM · updated Aug 25, 2026, 3:21 PM
Target Workflow
[aw] Failure Investigator (6h) (.github/workflows/aw-failure-investigator.lock.yml, source aw-failure-investigator.md)
Selected because it is the single highest-AIC workflow in the last 7 days (top-workflows.json), has not been optimized in the last 14 days (last touched: none found in optimization-log.json), and its name does not contain "Token".
Analysis Period + Runs Analyzed
- 7-day window snapshot: 1 run, AIC 254.60, 89,361 raw tokens (
top-workflows.json). - Historical daily snapshots: 2026-07-07 (AIC 105.21), 2026-07-08 (AIC 145.90) — AIC has grown ~2.4x since early July for a functionally unchanged prompt.
- API-confirmed run history (last 15 scheduled runs): 14
success, 1failure(§32641065351, driver-exit in theagentjob, unrelated to prompt/tool config — CLI execution crash). - Deep-dived the latest full run §32730678157 using local logs under
.github/aw/logs/run-32730678157/usage/.
Cost Profile
| Metric | Value |
|---|---|
| Total AIC (7d window) | 254.60 |
| Avg AIC/run (7d) | 254.60 |
| Raw token usage (latest run) | 89,361 (21,904 input / 67,457 output) |
| Cache read tokens (latest run) | 6,562,270 |
| Cache write tokens (latest run) | 223,595 |
| Turns / invocations (latest run) | 66 invocations, rebuild_factor 2.56x |
| Peak vs cumulative input tokens | peak 8,541 / cumulative 21,904 |
| Action minutes (latest run) | 26 |
The rebuild_factor of 2.56x means the agent's context was rebuilt roughly 2.5x the size of its peak working set across the run's 66 tool invocations — a direct AIC cost driver from repeated context reconstruction rather than raw prompt size.
Ranked Recommendations
1. Remove the unused pull_requests GitHub MCP toolset — est. 5–8% AIC savings/run
- Action: change
tools.github.toolsetsfrom[actions, issues, pull_requests]to[actions, issues]. - Evidence: the prompt body, all three inline sub-agents (
failure-classifier,issue-matcher,cluster-evidence-extractor), and the deterministic pre-fetch script never reference pull-request data — investigation is scoped entirely to workflow runs, jobs, logs, and issues. The onlypull_requests-adjacent references in the source are the staticpull-requests: readpermission andexclude_pull_requests: truein the pre-fetch API filter (which explicitly excludes PR-triggered runs, the opposite of needing PR tools). Loading an unused MCP toolset still adds tool-definition tokens to every context rebuild, compounding with the observed 2.56x rebuild factor. - Caveat: only 1 full run was available in the 7-day window for direct AIC comparison; recommend validating the saving over the next 3–5 runs.
2. Consolidate failure-classifier and issue-matcher into a single sub-agent call — est. 8–12% AIC savings/run
- Action: merge the two sequential small-model sub-agent invocations in Step 1 (
failure-classifierthenissue-matcher) into one sub-agent that both clusters failures by signature/severity and matches clusters toexisting_tracking_issuesin a single pass, returning one combined JSON object (clusters+matched+gaps). - Evidence: both agents consume the same
failurespayload from the single pre-fetch file, run back-to-back with no intervening dependency on external state, and both usemodel: small. Each sub-agent call re-serializes/re-sends its instructions and schema into a fresh context, contributing directly to the measured 66 invocations and 2.56x rebuild factor for this run. Combining them keeps the same small-model division of labor while cutting one full invocation round-trip per run. - Caveat: verify combined output schema doesn't reduce match-confidence quality; keep the two-step logic internally in the merged agent's prompt to preserve behavior.
3. Trim redundant "read the pre-fetch payload" reminders in the prompt body — est. 2–4% AIC savings/run
- Action: Step 0 already states "Read
failed_run_ids,failures, andexisting_tracking_issuesonce... Do not re-read this file; keep the parsed data in context." The same payload fields (failures,existing_tracking_issues) are then re-described in Steps 1 and 4. Consolidate the field descriptions into Step 0 only, and have Steps 1/4 reference "the parsed payload from Step 0" instead of re-listing field names. - Evidence: sections
### 0,### 1, and### 4each independently restate which payload fields to use, adding duplicate instructional tokens to every context rebuild without changing agent behavior.
Caveats
- Sample size is limited: only 1 full run fell inside the 7-day analysis window; historical snapshots (2026-07-07/08) were used to confirm cost trend but predate current experiment/tone-variant tooling, so exact percentage savings should be treated as directional, not guaranteed.
- The workflow already runs an active
tone_variantA/B experiment (issue #36105); tone changes should not be conflated with the structural/tool recommendations above — no changes to## Tone Variant Instructionsare proposed here. - The one observed failure (§32641065351) was a driver-level Claude Code CLI crash, not caused by prompt/tool configuration — no reliability fix is recommended for it.
- No inline sub-agents are proposed as new additions since the workflow already contains three (
failure-classifier,issue-matcher,cluster-evidence-extractor); recommendation #2 above is a consolidation of two existing sub-agents, not a new addition.
References:
Generated by Agentic Workflow AIC Usage Optimizer · copilot · auto · 83.1 AIC · ⊞ 11K · ◷
- expires on Aug 31, 2026, 7:17 AM UTC-08:00