q: load token optimization skill when user mentions optimize/cost/improve#40552
Merged
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
Add cost-optimization keyword detection to Q
q: load token optimization skill when user mentions optimize/cost/improve
Jun 21, 2026
Copilot created this pull request from a session on behalf of
pelikhan
June 21, 2026 03:24
View session
pelikhan
approved these changes
Jun 21, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Adds cost/token-optimization intent detection to the Q workflow prompt so that optimization-focused user requests trigger loading the dedicated token optimization skill, and ensures the compiled workflow lockfile reflects the updated prompt.
Changes:
- Added a new Phase 0 instruction in
.github/workflows/q.mdto detect optimization-related keywords and load.github/skills/optimize-agentic-workflow/SKILL.md. - Recompiled
.github/workflows/q.lock.ymlto reflect the updated source prompt.
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/q.md | Adds a new “Detect Cost-Optimization Intent” step to route optimization requests to the token optimization skill and apply an AIC-savings focus. |
| .github/workflows/q.lock.yml | Regenerated lockfile (metadata/body hash update) after modifying q.md. |
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: 2
Comment on lines
+138
to
+140
| - Read `.github/skills/optimize-agentic-workflow/SKILL.md` for token-reduction techniques | ||
| - Apply a cost-reduction focus throughout all phases: measure AIC usage, identify top cost drivers, and prioritize AIC savings in every recommendation | ||
| - Follow the Optimization Analysis Plan from the skill: measure → identify top drivers → apply quick wins → sub-agent delegation → prompt caching → experiment |
| - Are there error messages or issues described? | ||
| - Is this a general optimization request? | ||
| 3. **Identify Target Workflows from GitHub Context**: | ||
| 3. **Detect Cost-Optimization Intent**: Check whether the triggering content contains any of the following keywords (case-insensitive): **optimize**, **cost**, **improve**. If any keyword is found and it appears in the context of workflow, agent, or token performance (e.g. "optimize this workflow", "reduce cost", "improve performance"): |
This was referenced Jun 21, 2026
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.
Q had no awareness of cost-optimization intent — users asking to "optimize", "reduce cost", or "improve" a workflow got the same generic analysis as any other request.
Changes
q.md— Phase 0 step 3 (new): detects keywordsoptimize,cost,improve(case-insensitive) scoped to workflow/agent/token-performance context; when matched, instructs Q to read.github/skills/optimize-agentic-workflow/SKILL.mdand apply AIC-reduction focus across all phases (measure → top drivers → quick wins → sub-agents → prompt caching → experiment)q.lock.yml: recompiled from updated sourceKeyword matching examples
optimize the scout workflowthis workflow is costing too muchimprove token efficiencyfix the missing tool errorThe q.md content is injected at agent runtime via
{{#runtime-import .github/workflows/q.md}}, so no structural changes to the activation job are needed.