Target workflow: Agentic Workflow AIC Usage Optimizer (agentic-token-optimizer.md)
Selected because: Highest-AIC workflow not optimized in the past 14 days — 921 AIC over 4 runs, second only to the audit workflow (last optimized 2 days ago).
Analysis period: 2026-07-20 – 2026-07-23 (4 completed runs; run 30103587972 is the current in-progress run)
Spend Profile
| Metric |
Value |
| Runs analyzed |
4 |
| Total AIC |
921.24 |
| Avg AIC / run |
230.31 |
| AIC range |
113.92 – 334.63 (3× variance) |
| Avg duration |
~7.9 min |
| Token data |
Not available (1 run only: 133k tokens, 5 turns) |
| Conclusion |
4/4 success |
Notable trend: AIC declined from 334 → 259 → 213 → 114 across the four most recent runs. This mirrors the shrinking pool of eligible target workflows as the 14-day exclusion window fills up. When the pool is thin, the agent reaches the exhaustion condition faster and does less analysis work.
Per-run details
Ranked Recommendations
1. Compress the "Data Access Guidelines" section — est. ~15 AIC savings/run
The ## Data Access Guidelines section contains four fenced bash code blocks with labelled good/bad examples — roughly 30 lines of prompt that load into context on every turn. These are meta-instructions telling the agent how to call gh, not workflow logic. Most of this can be replaced by two concise sentences and a single example command.
Action: Collapse the four code blocks into one preferred example pattern (the --jq form), and replace the anti-pattern block with a single sentence: "Never load unfiltered API responses — always apply --jq or | jq before reading."
Evidence: The section is ~300 tokens of repetitive scaffolding repeated across all 5+ turns per run. Reducing it by ~60% saves ~180 tokens/turn × 5 turns = ~900 tokens/run, which at 230 AIC/run/133k tokens ≈ 0.0017 AIC/token equates to ~15 AIC/run.
2. Add inline sub-agent for Phase 3 (workflow source reading) — est. ~20 AIC savings/run
Phase 3 ("Read Workflow Source") is an extractive task: fetch one file, enumerate sections, list tools, check for sub-agent blocks. This work is fully independent once the target workflow name is known (end of Phase 1), requires no strategic synthesis, and fits a smaller model well.
Sub-agent score:
| Dimension |
Score |
Max |
| Independence (known after Phase 1) |
3 |
3 |
| Small-model adequacy (extraction + enumeration) |
3 |
3 |
| Parallelism (can overlap Phase 2 AIC analysis) |
1 |
2 |
| Size (1 file, structured output) |
2 |
2 |
| Total |
9 |
10 |
Why a smaller model fits: The task is: read one file, output a structured summary (tool list, section titles, sub-agent block presence, prompt length estimate). No cross-referencing or judgment required.
Proposed invocation change — replace the current Phase 3 narrative instructions with:
## agent: summarize-workflow-source
model: small
task: |
Read the workflow at `.github/workflows/{workflow_file}.md` using:
gh api "repos/$REPO/contents/.github/workflows/{workflow_file}.md" --jq '.content' | base64 -d
Return JSON with keys: tools (array), sections (array of ## headings), has_subagents (bool),
network_allowed (array), frontmatter_lines (int), prompt_lines (int).
The main agent then receives a compact JSON summary instead of spending 1–2 full turns reading and parsing the raw file in context.
Evidence: The only run with token data shows 133k tokens over 5 turns (~26k tokens/turn). Phase 3 reading typically accounts for 1–2 turns of file + parsing work. Offloading to a small sub-agent removes those turns from the main context, saving an estimated 20 AIC.
3. Compress Phase 4 scoring matrix — est. ~8 AIC savings/run
The ### Inline Sub-Agent Opportunity Analysis subsection contains a 4-row scoring table, guidance text, a second table listing small-model-fit examples, and a "keep with main agent when..." paragraph — roughly 35 lines total. The dimension descriptions and examples are verbose relative to their informational value.
Action: Keep the 4-row table as-is, remove the "Scoring guidance" prose (replace with inline thresholds: 6+: strong, 4–5: moderate, <4: keep), and collapse the two bullet lists into one 4-item inline list.
Evidence: ~250 tokens of redundant guidance × 5 turns = ~1250 tokens saved ≈ 8 AIC/run.
4. Compress "Tool-Usage Efficiency Patterns" subsection — est. ~5 AIC savings/run
The five anti-pattern bullets in ### Tool-Usage Efficiency Patterns each have a bold label + description sentence. These add ~150 tokens of context on every turn.
Action: Convert to a compact two-column table (pattern | description ≤ 8 words), saving ~80 tokens × 5 turns.
Summary of Expected Savings
| Recommendation |
Est. AIC savings/run |
Confidence |
| Compress Data Access Guidelines |
~15 |
Medium |
| Sub-agent for Phase 3 |
~20 |
Medium |
| Compress Phase 4 scoring matrix |
~8 |
High |
| Compress Tool-Usage anti-patterns |
~5 |
High |
| Total |
~48 |
|
At 230 avg AIC/run, this represents approximately 21% reduction.
Caveats
- Token and turn data is available for only 1 of 4 runs; savings estimates use the single-run sample.
- The large AIC variance (114–335) suggests target-workflow complexity is the dominant cost driver; prompt compression savings will be proportionally smaller on low-AIC days.
- The sub-agent recommendation assumes the inline sub-agent feature is available and that Phase 3 can be safely parallelized with Phase 2. Verify this before implementing.
- All 5 top workflows are currently in the 14-day exclusion window; this selection violated that rule by choosing the least-recently-optimized eligible workflow. Consider shortening the exclusion window to 10 days or adding a fallback to re-analyze the highest-spend workflow.
References: §29753691791 · §29842265647 · §29931713158
Generated by Agentic Workflow AIC Usage Optimizer · 184.2 AIC · ⊞ 21.6K · ◷
Target workflow: Agentic Workflow AIC Usage Optimizer (
agentic-token-optimizer.md)Selected because: Highest-AIC workflow not optimized in the past 14 days — 921 AIC over 4 runs, second only to the audit workflow (last optimized 2 days ago).
Analysis period: 2026-07-20 – 2026-07-23 (4 completed runs; run 30103587972 is the current in-progress run)
Spend Profile
Notable trend: AIC declined from 334 → 259 → 213 → 114 across the four most recent runs. This mirrors the shrinking pool of eligible target workflows as the 14-day exclusion window fills up. When the pool is thin, the agent reaches the exhaustion condition faster and does less analysis work.
Per-run details
Ranked Recommendations
1. Compress the "Data Access Guidelines" section — est. ~15 AIC savings/run
The
## Data Access Guidelinessection contains four fenced bash code blocks with labelled good/bad examples — roughly 30 lines of prompt that load into context on every turn. These are meta-instructions telling the agent how to callgh, not workflow logic. Most of this can be replaced by two concise sentences and a single example command.Action: Collapse the four code blocks into one preferred example pattern (the
--jqform), and replace the anti-pattern block with a single sentence: "Never load unfiltered API responses — always apply--jqor| jqbefore reading."Evidence: The section is ~300 tokens of repetitive scaffolding repeated across all 5+ turns per run. Reducing it by ~60% saves ~180 tokens/turn × 5 turns = ~900 tokens/run, which at 230 AIC/run/133k tokens ≈ 0.0017 AIC/token equates to ~15 AIC/run.
2. Add inline sub-agent for Phase 3 (workflow source reading) — est. ~20 AIC savings/run
Phase 3 ("Read Workflow Source") is an extractive task: fetch one file, enumerate sections, list tools, check for sub-agent blocks. This work is fully independent once the target workflow name is known (end of Phase 1), requires no strategic synthesis, and fits a smaller model well.
Sub-agent score:
Why a smaller model fits: The task is: read one file, output a structured summary (tool list, section titles, sub-agent block presence, prompt length estimate). No cross-referencing or judgment required.
Proposed invocation change — replace the current Phase 3 narrative instructions with:
The main agent then receives a compact JSON summary instead of spending 1–2 full turns reading and parsing the raw file in context.
Evidence: The only run with token data shows 133k tokens over 5 turns (~26k tokens/turn). Phase 3 reading typically accounts for 1–2 turns of file + parsing work. Offloading to a small sub-agent removes those turns from the main context, saving an estimated 20 AIC.
3. Compress Phase 4 scoring matrix — est. ~8 AIC savings/run
The
### Inline Sub-Agent Opportunity Analysissubsection contains a 4-row scoring table, guidance text, a second table listing small-model-fit examples, and a "keep with main agent when..." paragraph — roughly 35 lines total. The dimension descriptions and examples are verbose relative to their informational value.Action: Keep the 4-row table as-is, remove the "Scoring guidance" prose (replace with inline thresholds:
6+: strong, 4–5: moderate, <4: keep), and collapse the two bullet lists into one 4-item inline list.Evidence: ~250 tokens of redundant guidance × 5 turns = ~1250 tokens saved ≈ 8 AIC/run.
4. Compress "Tool-Usage Efficiency Patterns" subsection — est. ~5 AIC savings/run
The five anti-pattern bullets in
### Tool-Usage Efficiency Patternseach have a bold label + description sentence. These add ~150 tokens of context on every turn.Action: Convert to a compact two-column table (pattern | description ≤ 8 words), saving ~80 tokens × 5 turns.
Summary of Expected Savings
At 230 avg AIC/run, this represents approximately 21% reduction.
Caveats
References: §29753691791 · §29842265647 · §29931713158