Reduce CLI Consistency Checker token usage via pre-agent help capture and prompt/frontmatter trimming#33363
Merged
pelikhan merged 4 commits intoMay 19, 2026
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Optimize token usage for CLI Consistency Checker
Reduce CLI Consistency Checker token usage via pre-agent help capture and prompt/frontmatter trimming
May 19, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reduces token usage for the CLI Consistency Checker workflow by moving deterministic CLI help discovery into pre-agent-steps, trimming workflow context/frontmatter, and simplifying the in-agent prompt to analyze a pre-collected help corpus instead of re-running CLI discovery.
Changes:
- Add
pre-agent-stepsto buildgh-awand aggregate--helpoutput into/tmp/gh-aw/agent/all-help.txt. - Tighten frontmatter context (remove unused tools, reduce network allowlist to
allowed: [defaults]). - Streamline the markdown prompt to reference the pre-collected help file and simplify reporting instructions.
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/cli-consistency-checker.md | Adds pre-agent help capture + updates prompt/frontmatter to rely on the pre-collected dataset. |
| .github/workflows/cli-consistency-checker.lock.yml | Regenerates the compiled workflow to include the new pre-agent step and updated network/tool configuration. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 3
| strict: false | ||
| network: | ||
| allowed: [defaults, node, "api.github.com", "proxy.golang.org", "sum.golang.org"] | ||
| allowed: [defaults] |
Comment on lines
+32
to
+36
| /^[[:space:]]+[[:alnum:]_-]+([[:space:]]|$)/ { | ||
| cmd=$1 | ||
| gsub(/:$/, "", cmd) | ||
| if (cmd != "" && cmd != "Commands") print cmd | ||
| } |
| } | ||
| ' | ||
|
|
||
| ./gh-aw --help > "${output_dir}/main.txt" |
Collaborator
|
@copilot merge main and recompile |
Contributor
Author
Merged |
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.
This workflow was spending most tokens on repetitive CLI help discovery despite being a read-only inspection task. This change shifts deterministic data collection to pre-agent execution and trims unnecessary workflow context to reduce per-run token cost.
Pre-agent deterministic help capture
pre-agent-stepsto buildgh-aw, collect--helpoutput for top-level commands and discovered subcommands, and aggregate into/tmp/gh-aw/agent/all-help.txt.Frontmatter context reduction
cli-proxy,edit,web-fetch.allowed: [defaults].Prompt streamlining
Script hardening