You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Repository Quality Improvement Agent (repository-quality-improver.md) — highest-AIC workflow not optimized in the last 14 days. Runs daily on weekdays.
Analysis Period
7-day window ending 2026-06-15 · 1 run analyzed (run §27554699119)
Cost Profile
Metric
Value
Total AIC (1 run)
609.10
Avg AIC / run
609.10
Raw input tokens
1,711,255
Raw output tokens
31,269
Cache read tokens
1,627,442 (95.1% of input)
Cache write tokens
0
LLM turns (API calls)
35
Bash tool calls
53
Action minutes
19
Pre-computed context size
36 lines (Go metrics only)
Key Findings
The run chose Documentation as its focus area and made 53 tool calls across 35 LLM turns. The waste profile breaks down into three distinct problem areas:
1. Expand pre-agent step to cover documentation analysis 🔴
Est. savings: ~150 AIC/run
The pre-agent bash step currently collects only Go source metrics (36 lines). The agent chose "Documentation" and spent 23 consecutive bash calls (#4–26) gathering docs structure that could be computed deterministically before the agent starts.
Action: Add to the pre-agent Collect quality metrics bash step:
Evidence: Bash calls #4–26 are all docs/code structure discovery that ran identically to what this snippet would produce. The pre-agent step completes in <1s and writes to /tmp/gh-aw/agent/analysis-context.md which the agent already reads on turn 1.
2. Add explicit safeoutputs create_discussion invocation example 🔴
Est. savings: ~100 AIC/run
The prompt says "Use the reporting MCP to create a discussion" with no concrete syntax. The agent:
That's 13 calls and ~8 turns just to emit one discussion.
Action: Add to Phase 2 in the prompt:
## Phase 2: Generate Improvement Report
Use the `safeoutputs` CLI to create a discussion:
```bashprintf'%s\n''{ "title": "Repository Quality: [Focus Area] - [Date]", "body": "...", "category": "announcements"}'| safeoutputs create_discussion .
Do NOT call safeoutputs --help or probe parameters first — the schema above is complete. Pass the body inline in the JSON object.
**Evidence:** The 13-call ceremony accounted for ~8 turns out of 35 total (23%). This optimization alone eliminates a common retry-loop pattern that wastes significant context.
---
#### 3. Add bash batching guidance to Phase 1 🟡
**Est. savings: ~80 AIC/run**
The prompt provides a per-category command reference table but doesn't instruct the agent to batch independent commands. This caused 8 separate calls just for Go documentation coverage (#10–17) and another 10 calls for docs sidebar/content analysis (#16–26).
**Action:** Add to the Phase 1 "Conduct Analysis" section:
```markdown
**Batching rule**: Consolidate all analysis for your chosen focus area into at most
4 bash calls, one per major topic cluster. For Documentation: one call for
frontmatter/structure, one for content quality, one for code doc-comments.
Do NOT run separate bash calls for each individual metric — combine with `&&` and
section headers.
Evidence: Calls #10–17 (8 calls) cover the same Go code documentation topic and could be a single bash block. Calls #16–26 (11 calls) explore docs sidebar configuration and could be 2 calls.
4. Inline sub-agent for Phase 1 data collection 🟡
Est. savings: ~150 AIC/run
The analysis phase (Phase 1) is a strong candidate for extraction into an inline sub-agent using a smaller model:
Dimension
Score
Reason
Independence
3/3
Needs only the focus area name from Phase 0
Small-model adequacy
3/3
Pure bash execution + structured result collection
Parallelism
2/2
Runs before report generation, no concurrency conflict
Size
2/2
36 bash calls, ~25 exploration turns currently
Total
10/10
Strong candidate
Action: Add an ## agent: block after Phase 0:
## agent: analysis-collector
model: github/haiku
inputs:
focus_area: "{{ focus_area }}"
pre_computed: "{{ analysis_context }}"
Collect analysis data for focus area `{{ focus_area }}` by running targeted bash
commands. Read pre-computed context from `/tmp/gh-aw/agent/analysis-context.md`.
Output a JSON summary of findings to `/tmp/gh-aw/agent/analysis-results.json`.
Run at most 4 bash calls. Do not write any reports.
Moving the exploratory bash work to a Haiku sub-agent (10× cheaper than Sonnet) would save ~150 AIC. The main agent then only needs to read the results JSON and write the discussion (~10 turns).
Note: Implement Recommendations 1–3 first to establish the turn baseline. Sub-agent refactor is higher risk; validate after prompt fixes.
Caveats
Only 1 run was available in the 7-day window; behavior varies by chosen focus area. Documentation focus is more exploration-heavy than Security or CI/CD.
The 95.1% cache read rate indicates prompt caching is functioning well — savings estimates target turn reduction, not cache optimization.
Target Workflow
Repository Quality Improvement Agent (
repository-quality-improver.md) — highest-AIC workflow not optimized in the last 14 days. Runs daily on weekdays.Analysis Period
7-day window ending 2026-06-15 · 1 run analyzed (run §27554699119)
Cost Profile
Key Findings
The run chose Documentation as its focus area and made 53 tool calls across 35 LLM turns. The waste profile breaks down into three distinct problem areas:
Ranked Recommendations
1. Expand pre-agent step to cover documentation analysis 🔴
Est. savings: ~150 AIC/run
The pre-agent bash step currently collects only Go source metrics (36 lines). The agent chose "Documentation" and spent 23 consecutive bash calls (#4–26) gathering docs structure that could be computed deterministically before the agent starts.
Action: Add to the pre-agent
Collect quality metricsbash step:Evidence: Bash calls #4–26 are all docs/code structure discovery that ran identically to what this snippet would produce. The pre-agent step completes in <1s and writes to
/tmp/gh-aw/agent/analysis-context.mdwhich the agent already reads on turn 1.2. Add explicit
safeoutputs create_discussioninvocation example 🔴Est. savings: ~100 AIC/run
The prompt says "Use the reporting MCP to create a discussion" with no concrete syntax. The agent:
safeoutputs --help(call Remove Gemini engine and all references from codebase #40)safeoutputs create_discussion --help(call remove gemini support for now #41)✗in log)That's 13 calls and ~8 turns just to emit one discussion.
Action: Add to Phase 2 in the prompt:
Do NOT call
safeoutputs --helpor probe parameters first — the schema above is complete. Pass the body inline in the JSON object.Evidence: Calls #10–17 (8 calls) cover the same Go code documentation topic and could be a single bash block. Calls #16–26 (11 calls) explore docs sidebar configuration and could be 2 calls.
4. Inline sub-agent for Phase 1 data collection 🟡
Est. savings: ~150 AIC/run
The analysis phase (Phase 1) is a strong candidate for extraction into an inline sub-agent using a smaller model:
Action: Add an
## agent:block after Phase 0:Moving the exploratory bash work to a Haiku sub-agent (10× cheaper than Sonnet) would save ~150 AIC. The main agent then only needs to read the results JSON and write the discussion (~10 turns).
Note: Implement Recommendations 1–3 first to establish the turn baseline. Sub-agent refactor is higher risk; validate after prompt fixes.
Caveats
References: §27554699119