Optimize workflow prompts: reduce token usage by 70% in shared files#7081
Merged
Optimize workflow prompts: reduce token usage by 70% in shared files#7081
Conversation
- trending-charts-simple.md: 313→78 lines (75% reduction) - reporting.md: 80→14 lines (82% reduction) - audit-workflows.md: 374→163 lines (56% reduction) - daily-code-metrics.md: 563→93 lines (83% reduction) Total reduction: 1330→348 lines (74% reduction) for these 4 files Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Streamlined task description and guidelines while maintaining core functionality Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Applied prompt optimizations across all workflow lock files. Most significant reductions in: - audit-workflows.lock.yml: -634 lines - daily-code-metrics.lock.yml: -952 lines - portfolio-analyst.lock.yml: -423 lines - prompt-clustering-analysis.lock.yml: -416 lines - daily-performance-summary.lock.yml: -375 lines - daily-firewall-report.lock.yml: -334 lines Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Optimize prompt token usage in workflow runs
Optimize workflow prompts: reduce token usage by 70% in shared files
Dec 20, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Token usage spiked 4x to 1.71M across 10 workflow runs. Root cause: verbose prompts with redundant examples, lengthy bash scripts, and repetitive instructions.
Changes
Shared files (high-impact, imported by 30-45 workflows each):
trending-charts-simple.md: 313 → 78 lines (75% ↓)reporting.md: 80 → 14 lines (82% ↓)High-volume workflows (daily/per-event):
audit-workflows.md: 374 → 163 lines (56% ↓)daily-code-metrics.md: 563 → 93 lines (83% ↓)dev-hawk.md: 143 → 98 lines (31% ↓)All 121 workflow lock files recompiled: -5,316 lines net across affected sections.
Token impact
Shared file multiplier effect:
trending-charts-simple.md: 235 lines × 32 imports = 7,520 lines eliminatedreporting.md: 66 lines × 45 imports = 2,970 lines eliminatedEstimated savings: ~42K tokens/run from shared files alone, ~450K tokens across 10 runs.
Before/After example (
trending-charts-simple.md):Projected results
From 1.71M baseline → ~1.26M tokens (26% reduction). Target: <850K (50%). Additional optimizations available if monitoring shows gap remains: output summarization, MCP server instruction files (slack.md: 219 lines, drain3.md: 196 lines), remaining high-line-count workflows.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.