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
Source report: Created by Daily Copilot Token Usage Analyzer (run #28930856537) Estimated cost per run: $186.59 AIC Total tokens per run: ~2.6M Cache hit rate: 95.6% LLM turns: ~100 Copilot API calls (run-28919141556) Model: claude-sonnet-4.6
The workflow is already well-optimized on the tools and network dimensions — it uses only 2 tools and restricts GitHub to the issues toolset. The cost is driven entirely by output verbosity and sequential multi-phase analysis:
54,548 output tokens for 4 issues = ~13,600 tokens per issue body (extremely verbose)
86,132 cache_write tokens — long context builds up across 6 sequential analysis phases
100 API calls — each phase triggers multiple reasoning+tool-call cycles
The issue template has 7+ sections including full bash command blocks that the agent quotes back verbatim
Recommendations
1. Simplify the Issue Body Template
Estimated savings: ~27,000 output tokens/run (~21% of total cost, ~$39 AIC/run)
The current issue format in Phase 6 has 7 mandatory sections including Evidence (full grep output), Proposed Split (detailed module breakdown), Affected Callers (with embedded bash command), Effort Estimate, and Benefits. Each issue body averages ~13,600 output tokens.
Current template (in .github/workflows/refactoring-scanner.md, Phase 6 section):
### Issue Format**Title**: `[Refactoring] Split <file> into focused modules`**Body**:
## Summary-**File**: `path/to/file.ts` (**X lines**, N responsibilities)
-**Score**: N points
-**Priority**: High/Medium
## Evidence[2–3 specific function names or grep output lines that demonstrate the problem — NOT full grep output, just the key findings]## Proposed Split[Bullet list of proposed modules with line count estimates only — no bash commands embedded]---*Detected by Refactoring Scanner. Run: ${{ github.run_id }}*
Remove these sections entirely:
Affected Callers section with embedded bash — agent can add this if needed but it's rarely acted on immediately
Benefits section — boilerplate, always the same
Full grep output blocks (summarize findings instead of quoting all output)
Implementation: Edit .github/workflows/refactoring-scanner.md, Phase 6 "Issue Format" section. Replace the 7-section template with the 3-section version above.
2. Pre-compute Phase 2 Bash Analysis (Nesting + Function Length)
The node network group (registry.npmjs.org, nodejs.org, etc.) was in the network allow-list but zero requests were made to any node-related domain in the last run. The workflow uses only bash analysis and GitHub API.
Target Workflow:
refactoring-scannerSource report: Created by Daily Copilot Token Usage Analyzer (run #28930856537)
Estimated cost per run: $186.59 AIC
Total tokens per run: ~2.6M
Cache hit rate: 95.6%
LLM turns: ~100 Copilot API calls (run-28919141556)
Model: claude-sonnet-4.6
Current Configuration
bash,github(issues toolset)bash(grep/awk analysis),github(search + create issues)node,githubfile-sizesandfunction-countspre-computedAnalysis
The workflow is already well-optimized on the tools and network dimensions — it uses only 2 tools and restricts GitHub to the
issuestoolset. The cost is driven entirely by output verbosity and sequential multi-phase analysis:Recommendations
1. Simplify the Issue Body Template
Estimated savings: ~27,000 output tokens/run (~21% of total cost, ~$39 AIC/run)
The current issue format in
Phase 6has 7 mandatory sections includingEvidence(full grep output),Proposed Split(detailed module breakdown),Affected Callers(with embedded bash command),Effort Estimate, andBenefits. Each issue body averages ~13,600 output tokens.Current template (in
.github/workflows/refactoring-scanner.md, Phase 6 section):Proposed simpler template (~50% shorter):
Remove these sections entirely:
Affected Callerssection with embedded bash — agent can add this if needed but it's rarely acted on immediatelyBenefitssection — boilerplate, always the sameImplementation: Edit
.github/workflows/refactoring-scanner.md, Phase 6 "Issue Format" section. Replace the 7-section template with the 3-section version above.2. Pre-compute Phase 2 Bash Analysis (Nesting + Function Length)
Estimated savings: ~7,000 tokens/run (~5% cost, ~$4 AIC/run)
Phase 2 (
Detect Deep Nesting and Complex Functions) contains 3 bash commands that the agent executes at runtime:awkfor finding deeply nested lines (reads entiredocker-manager.ts)awkheuristic for long functionsgrepfor functions with 5+ parametersThese are deterministic and can be pre-computed in
steps:, same asfile-sizesandfunction-counts.Add to the
steps:section in the frontmatter:Then remove Phase 2 entirely from the prompt body and reference
${{ steps.complex-patterns.outputs.COMPLEX_PATTERNS }}instead.Implementation: Add
complex-patternsstep to frontmatter; replace Phase 2 body with a data reference.3. Remove Unused
nodeNetwork GroupEstimated savings: 0 tokens (security hygiene only)
The
nodenetwork group (registry.npmjs.org,nodejs.org, etc.) was in the network allow-list but zero requests were made to any node-related domain in the last run. The workflow uses only bash analysis and GitHub API.Edit
.github/workflows/refactoring-scanner.mdfrontmatter:This reduces the attack surface if the agent is ever prompt-injected to exfiltrate data via npm.
4. Consolidate Phase 3 Grep Commands into Pre-Step
Estimated savings: ~3,000 tokens/run (~2% cost)
Phase 3 (
Detect Mixed Responsibilities) has 5bashgrep commands that run at agent time:These read the same large files multiple times. Pre-computing them into a
responsibility-zonesstep saves multiple tool-call round trips.Add to
steps::Remove the inline bash in Phase 3 and use
${{ steps.responsibility-zones.outputs.RESPONSIBILITY_ZONES }}.Expected Impact
Implementation Checklist
.github/workflows/refactoring-scanner.md: simplify Phase 6 issue template (Rec. 1).github/workflows/refactoring-scanner.md: addcomplex-patternsstep and remove Phase 2 body (Rec. 2).github/workflows/refactoring-scanner.md: removenodefromnetwork.allowed(Rec. 3).github/workflows/refactoring-scanner.md: addresponsibility-zonesstep and remove Phase 3 body (Rec. 4)gh aw compile .github/workflows/refactoring-scanner.mdWarning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
awmgmcpgSee Network Configuration for more information.