Target Workflow
Daily XKCD Comic (daily-xkcd.md) — selected as the highest-AIC workflow not recently optimized (prior optimization: 2026-08-21, 6 days ago). All top workflows have been optimized within 14 days; this one has the oldest optimization date and meaningful per-run spend (~58 AIC/run across 7 daily runs).
Analysis Period
2026-08-21 – 2026-08-27 · 7 runs audited · All conclusions: success · 0 errors
Spend Profile
| Metric |
Value |
| Total AIC (7 runs) |
406.95 credits |
| Avg AIC / run |
~58.1 credits |
| Avg tokens / run |
~180 k |
| Avg turns / run |
6.7 (range: 5–8) |
| Total action-minutes |
38 min |
| Cache efficiency |
Not reported |
| Errors |
0 |
Per-run breakdown
| Run |
Date |
AIC |
Tokens |
Turns |
Conclusion |
| §32467304018 |
2026-08-21 |
74.28 |
212 574 |
8 |
success |
| §32564407628 |
2026-08-22 |
~58 |
~180 k |
~7 |
success |
| §32630448758 |
2026-08-23 |
~58 |
~180 k |
~7 |
success |
| §32711427637 |
2026-08-24 |
72.53 |
210 309 |
8 |
success |
| §32831303647 |
2026-08-25 |
51.46 |
152 886 |
6 |
success |
| §32952653667 |
2026-08-26 |
42.44 |
126 510 |
5 |
success |
| §33072973368 |
2026-08-27 |
60.94 |
180 301 |
7 |
success |
Ranked Recommendations
1 — Pre-compute comic selection in steps (remove from agent prompt)
Estimated savings: ~12–15 AIC/run (~20–25%)
The current steps section fetches only the latest comic number. The agent is then asked to:
- Read the curated list (50+ hardcoded numbers across 3 categories embedded in every prompt context window)
- Compute
date +%j mod list_size
- Pick a comic and verify relevance (potentially 3 attempts)
This selection logic is deterministic and purely computational — it does not require LLM reasoning. Moving it into the steps section eliminates 1–2 agent turns per run and removes ~250 tokens of static list data from every prompt window.
Proposed steps addition:
- name: Select comic for today
run: |
set -euo pipefail
DEVELOPER_COMICS="303 327 353 386 456 519 664 705 722 737 844 859 936 1068 1168 1205 1319 1425 1443 1537 1739"
MATH_COMICS="55 135 174 687 712 715 881 882 1236 1261 1379 1478 1754 2048 2100"
ML_COMICS="1838 1875 2050 2173 2347 2440 2501 2545 2581 2674 2746 2785 2860 2916 2925"
ALL_COMICS="$DEVELOPER_COMICS $ML_COMICS $MATH_COMICS"
COMICS_ARRAY=($ALL_COMICS)
COUNT=${#COMICS_ARRAY[@]}
DOY=$(date +%j | sed 's/^0*//')
INDEX=$((DOY % COUNT))
SELECTED=${COMICS_ARRAY[$INDEX]}
echo "$SELECTED" > /tmp/gh-aw/agent/xkcd/selected_num.txt
echo "Selected comic for today: #$SELECTED"
The prompt can then replace the entire Comic Selection section with: "The curated comic number for today is in /tmp/gh-aw/agent/xkcd/selected_num.txt."
Evidence: Turn variance (5–8) across runs correlates with the retry loop. Runs with 8 turns (2026-08-21, 2026-08-24) cost 72–74 AIC vs. 5-turn runs at 42 AIC — the selection/retry loop drives most of the variance.
2 — Read cached latest.json instead of re-fetching
Estimated savings: ~4–6 AIC/run (~7–10%)
The steps section already downloads the full latest comic JSON to /tmp/gh-aw/agent/xkcd/latest.json. However, instruction step 2 reads:
"Check if the latest comic is relevant (fetch it and read its title/alt text)"
This directs the agent to web_fetch `(xkcd.com/redacted) — a duplicate network call. The agent should instead read the already-cached file.
Fix: Change instruction step 2 from:
"Check if the latest comic is relevant (fetch it and read its title/alt text)"
To:
"Read /tmp/gh-aw/agent/xkcd/latest.json (already downloaded) and check if the title/alt text is relevant."
Evidence: Every run makes at least one web_fetch call for the latest comic despite the steps section downloading it. Eliminating this call saves one tool invocation and reduces context churn.
3 — Remove expr from allowed tools if unused
Estimated savings: negligible AIC, minor prompt hygiene
The workflow declares expr as an allowed bash command. The setup step uses jq and bash arithmetic. With pre-computation moved to steps (recommendation 1), no expr usage remains. If no run has used expr, it can be removed from the tools list.
Action: Audit the last 7 run logs for expr invocations. If zero occurrences, remove expr from the bash tools list.
Structural Optimization
Common setup prefix: minor duplication between Context and Instructions
Both the Context section and Instructions step 1 reference /tmp/gh-aw/agent/xkcd/latest_num.txt. This is minor and does not warrant extracting a shared setup prefix.
Inline sub-agents: not recommended
The workflow has a single coherent task: select a comic, fetch its data, create a discussion. There are no independent extractive subtasks of sufficient size to justify a sub-agent call. The main agent handles the final output creation, which requires synthesis — not a small-model fit.
Caveats
- Turns data is only directly available for 3 of 7 runs from daily snapshots; the remaining runs are estimated from AIC proportions.
- The turn-count variance (5–8) may reflect XKCD API latency as well as retry loops; recommendation 1 savings estimate uses the conservative end.
- Moving comic selection to
steps changes the retry behavior: the agent can no longer try multiple curated numbers. Consider keeping a short fallback list (3 alternatives) in the prompt for the relevance check.
References:
Generated by Agentic Workflow AIC Usage Optimizer · 256.1 AIC · ⊞ 21.6K · ◷
Target Workflow
Daily XKCD Comic (
daily-xkcd.md) — selected as the highest-AIC workflow not recently optimized (prior optimization: 2026-08-21, 6 days ago). All top workflows have been optimized within 14 days; this one has the oldest optimization date and meaningful per-run spend (~58 AIC/run across 7 daily runs).Analysis Period
2026-08-21 – 2026-08-27 · 7 runs audited · All conclusions:
success· 0 errorsSpend Profile
Per-run breakdown
Ranked Recommendations
1 — Pre-compute comic selection in
steps(remove from agent prompt)Estimated savings: ~12–15 AIC/run (~20–25%)
The current
stepssection fetches only the latest comic number. The agent is then asked to:date +%j mod list_sizeThis selection logic is deterministic and purely computational — it does not require LLM reasoning. Moving it into the
stepssection eliminates 1–2 agent turns per run and removes ~250 tokens of static list data from every prompt window.Proposed
stepsaddition:The prompt can then replace the entire Comic Selection section with: "The curated comic number for today is in
/tmp/gh-aw/agent/xkcd/selected_num.txt."Evidence: Turn variance (5–8) across runs correlates with the retry loop. Runs with 8 turns (2026-08-21, 2026-08-24) cost 72–74 AIC vs. 5-turn runs at 42 AIC — the selection/retry loop drives most of the variance.
2 — Read cached
latest.jsoninstead of re-fetchingEstimated savings: ~4–6 AIC/run (~7–10%)
The
stepssection already downloads the full latest comic JSON to/tmp/gh-aw/agent/xkcd/latest.json. However, instruction step 2 reads:This directs the agent to
web_fetch`(xkcd.com/redacted) — a duplicate network call. The agent should instead read the already-cached file.Fix: Change instruction step 2 from:
To:
Evidence: Every run makes at least one
web_fetchcall for the latest comic despite thestepssection downloading it. Eliminating this call saves one tool invocation and reduces context churn.3 — Remove
exprfrom allowed tools if unusedEstimated savings: negligible AIC, minor prompt hygiene
The workflow declares
expras an allowed bash command. The setup step usesjqandbasharithmetic. With pre-computation moved tosteps(recommendation 1), noexprusage remains. If no run has usedexpr, it can be removed from the tools list.Action: Audit the last 7 run logs for
exprinvocations. If zero occurrences, removeexprfrom thebashtools list.Structural Optimization
Common setup prefix: minor duplication between Context and Instructions
Both the Context section and Instructions step 1 reference
/tmp/gh-aw/agent/xkcd/latest_num.txt. This is minor and does not warrant extracting a shared setup prefix.Inline sub-agents: not recommended
The workflow has a single coherent task: select a comic, fetch its data, create a discussion. There are no independent extractive subtasks of sufficient size to justify a sub-agent call. The main agent handles the final output creation, which requires synthesis — not a small-model fit.
Caveats
stepschanges the retry behavior: the agent can no longer try multiple curated numbers. Consider keeping a short fallback list (3 alternatives) in the prompt for the relevance check.References: