Target Workflow
Daily XKCD Comic (daily-xkcd.md) — selected as the highest-AIC workflow not optimized within the last 14 days among available candidates.
All top workflows have been recently optimized; this one was last addressed 2026-07-06 (7 days ago) and remains the highest-AIC non-monitoring target at 513 AIC over 7 days.
Analysis Period & Runs Analyzed
Period: 2026-07-06 – 2026-07-13 · Runs analyzed: 7
Spend Profile
| Metric |
Value |
| Total AIC |
513.46 |
| Avg AIC / run |
73.35 |
| Min / Max AIC |
44.59 / 103.99 |
| Total tokens (1 run with data) |
180,230 |
| Avg turns (1 run with data) |
7 |
| Duration range |
4.4 m – 8.1 m |
| Success rate |
7 / 7 (100%) |
The 1.8× duration spread (4.4 m vs 8.1 m) and 2.3× AIC spread (44.6 vs 104.0) suggest that the agent's retry loop is the primary AIC driver — slower runs likely exhausted the 3-attempt comic relevance check.
Ranked Recommendations
1 · Pre-compute comic selection and fetch in the setup step
Estimated AIC savings: ~28–35 / run (38–48%)
The workflow's steps block already runs a pre-step to fetch latest.json. The agent is then asked to:
- Read that file
- Re-fetch the latest comic via
web_fetch to check relevance
- Calculate
date +%j mod <list-size> to pick a fallback number
- Fetch the chosen comic via
web_fetch
- Verify relevance and optionally retry up to 3 times
Steps 2–5 account for the majority of turns (observed: 7 turns in the one fully-instrumented run). Moving all of this into the setup steps block eliminates the reasoning loop entirely.
Concrete action: Extend the setup step to:
# 1. Compute day-of-year and pre-select a comic number
DAY=$(date +%j)
DEVELOPER=(303 327 353 386 456 519 664 705 722 737 844 859 936 1068 1168 1205 1319 1425 1443 1537 1739)
MATH=(55 135 174 687 712 715 881 882 1236 1261 1379 1478 1754 2048 2100)
ML=(1838 1875 2050 2173 2347 2440 2501 2545 2581 2674 2746 2785 2860 2916 2925)
ALL=("${DEVELOPER[@]}" "${MATH[@]}" "${ML[@]}")
IDX=$(( DAY % ${#ALL[@]} ))
LATEST=$(cat /tmp/gh-aw/agent/xkcd/latest_num.txt)
# 2. Try latest first; fall back to curated pick
for NUM in "$LATEST" "${ALL[$IDX]}" "${ALL[$(( (IDX+1) % ${#ALL[@]} ))]}"; do
curl -sSf "(xkcd.com/redacted) \
-o /tmp/gh-aw/agent/xkcd/comic.json && break
done
echo "Selected comic: $NUM"
echo "$NUM" > /tmp/gh-aw/agent/xkcd/selected_num.txt
Then simplify the agent prompt to:
The selected comic data is in `/tmp/gh-aw/agent/xkcd/comic.json` and
its number in `/tmp/gh-aw/agent/xkcd/selected_num.txt`.
Read the file and create the discussion using the Output format below.
This collapses the agent from a reasoning + fetching loop to a single read-and-format step, cutting expected turns from ~7 to ~2.
Evidence: Duration spans 4.4–8.1 m across 7 runs; the step itself is under 5 s (curl to xkcd.com is fast), so all remaining time is agent turn overhead.
2 · Remove the 51-item curated comic list from the agent prompt
Estimated AIC savings: ~5–8 / run (7–11%)
The prompt body embeds three lists totalling 51 comic numbers (~200 tokens of raw numbers plus surrounding prose). Once selection is moved to the setup step (Rec 1), this block is no longer needed in the agent prompt at all.
Concrete action: Delete the ## Comic Selection section and its three sub-lists from the prompt body. The setup step script already encodes the full list.
Even standalone (without Rec 1), the list could be stored in a file pre-written by the step and read only when needed, avoiding its presence in every LLM call.
Evidence: The section as written accounts for roughly 250–300 tokens in the system prompt on every single run.
3 · Replace web_fetch tool with setup-step curl (remove web-fetch from tools config)
Estimated AIC savings: ~3–5 / run (4–7%)
After Rec 1, the agent no longer needs to make any HTTP calls — all data is pre-fetched by the setup step. The web-fetch tool can be removed from the frontmatter tools: list.
Tool declarations appear in the system context and add a small per-call overhead. More importantly, removing web-fetch eliminates any possibility of the agent wandering into speculative fetches during the selection reasoning.
Concrete action: Remove web-fetch: from the tools: block in the YAML frontmatter.
Evidence: With pre-fetched data, zero web_fetch calls are needed in the agent turn.
Combined Estimated Savings
| Recommendation |
AIC savings / run |
Cumulative |
| 1 · Pre-compute in setup |
~28–35 |
~28–35 |
| 2 · Remove curated list from prompt |
~5–8 |
~33–43 |
| 3 · Remove web-fetch tool |
~3–5 |
~36–48 |
| Total (conservative) |
~36 AIC / run |
~49% reduction |
At 7 runs/week this corresponds to ~250 AIC / week saved.
Caveats
- Token data is available for only 1 of 7 runs; turn estimates are inferred from that single data point and duration variance.
- The 3-attempt fallback in the current prompt is not directly observable in logs; the loop overhead is inferred from the AIC/duration spread.
- The setup-step curl approach assumes
xkcd.com is reachable during the step phase (it is already in network.allowed).
- Rec 1 removes the agent's ability to do a nuanced relevance check; if strict thematic accuracy matters, keep a lightweight relevance gate in the prompt (but skip the retry loop).
References:
Generated by Agentic Workflow AIC Usage Optimizer · 128.1 AIC · ⊞ 21.6K · ◷
Target Workflow
Daily XKCD Comic (
daily-xkcd.md) — selected as the highest-AIC workflow not optimized within the last 14 days among available candidates.Analysis Period & Runs Analyzed
Period: 2026-07-06 – 2026-07-13 · Runs analyzed: 7
Spend Profile
The 1.8× duration spread (4.4 m vs 8.1 m) and 2.3× AIC spread (44.6 vs 104.0) suggest that the agent's retry loop is the primary AIC driver — slower runs likely exhausted the 3-attempt comic relevance check.
Ranked Recommendations
1 · Pre-compute comic selection and fetch in the setup step
Estimated AIC savings: ~28–35 / run (38–48%)
The workflow's
stepsblock already runs a pre-step to fetchlatest.json. The agent is then asked to:web_fetchto check relevancedate +%j mod <list-size>to pick a fallback numberweb_fetchSteps 2–5 account for the majority of turns (observed: 7 turns in the one fully-instrumented run). Moving all of this into the setup
stepsblock eliminates the reasoning loop entirely.Concrete action: Extend the setup step to:
Then simplify the agent prompt to:
This collapses the agent from a reasoning + fetching loop to a single read-and-format step, cutting expected turns from ~7 to ~2.
Evidence: Duration spans 4.4–8.1 m across 7 runs; the step itself is under 5 s (curl to xkcd.com is fast), so all remaining time is agent turn overhead.
2 · Remove the 51-item curated comic list from the agent prompt
Estimated AIC savings: ~5–8 / run (7–11%)
The prompt body embeds three lists totalling 51 comic numbers (~200 tokens of raw numbers plus surrounding prose). Once selection is moved to the setup step (Rec 1), this block is no longer needed in the agent prompt at all.
Concrete action: Delete the
## Comic Selectionsection and its three sub-lists from the prompt body. The setup step script already encodes the full list.Even standalone (without Rec 1), the list could be stored in a file pre-written by the step and read only when needed, avoiding its presence in every LLM call.
Evidence: The section as written accounts for roughly 250–300 tokens in the system prompt on every single run.
3 · Replace
web_fetchtool with setup-step curl (removeweb-fetchfrom tools config)Estimated AIC savings: ~3–5 / run (4–7%)
After Rec 1, the agent no longer needs to make any HTTP calls — all data is pre-fetched by the setup step. The
web-fetchtool can be removed from the frontmattertools:list.Tool declarations appear in the system context and add a small per-call overhead. More importantly, removing
web-fetcheliminates any possibility of the agent wandering into speculative fetches during the selection reasoning.Concrete action: Remove
web-fetch:from thetools:block in the YAML frontmatter.Evidence: With pre-fetched data, zero
web_fetchcalls are needed in the agent turn.Combined Estimated Savings
At 7 runs/week this corresponds to ~250 AIC / week saved.
Caveats
xkcd.comis reachable during the step phase (it is already innetwork.allowed).References: