Analyze and reduce token consumption in agentic workflows — guardrail-specific entry points, measurement, and optimization techniques.
npx skills add https://github.com/github/gh-aw --skill optimize-agentic-workflow
Help users reduce the AI token usage and cost of GitHub Agentic Workflows in this repository.
Load these files from github/gh-aw (they are not available locally).
.github/aw/github-agentic-workflows.md.github/aw/token-optimization.md.github/aw/workflow-editing.md.github/aw/syntax.mdLoad these only when relevant:
.github/aw/experiments.md.github/aw/safe-outputs.mdgh aw audit <run-id> --json
gh aw audit <base-run-id> <optimized-run-id>
gh aw logs <workflow-name> --json
gh aw compile <workflow-name>
gh aw status
Ask for one of these inputs:
If the user gives a GitHub Actions run URL:
gh aw audit <run-id> --jsonagent_usage.aic, agent_usage.input_tokens, agent_usage.output_tokens, agent_usage.cache_read_tokensmax-ai-credits exceededThe workflow was stopped because it consumed more AI Credits than the configured per-run budget.
Priority checks:
token-usage.jsonl)max-daily-ai-credits exceededThe workflow is being blocked because its 24-hour AI Credits budget is exhausted.
Priority checks:
max-tool-denials exceededThe Copilot SDK hit the tool-denial threshold, indicating the prompt attempted actions outside the allowed tool policy.
Priority checks:
max-turns exceededThe agent ran out of time or turns before completing the task.
Priority checks:
max-turns or timeout-minutes be raised, or should the task be split?After measuring token usage, produce a prioritized plan:
gh aw audit <run-id> --json and summarize AI Credits and per-call token breakdowngh-proxy, cli-proxy, prompt trimmingcache-memory when cross-run reuse is useful; apply relevant recurring patterns to similar casesexperiments: entry, compare output quality first, and use metric: "aic" to choose among equivalent-quality variantsPresent the plan clearly before making any edits. Confirm with the user before applying changes.
.github/workflows/<workflow-name>.mdgh aw compile <workflow-name>.lock.ymlGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks.
Intelligently organizes your files and folders across your computer by understanding context, finding duplicates, suggesting better structures, and automating cleanup tasks. Reduces cognitive load and keeps your digital workspace tidy without manual effort.
Generates creative domain name ideas for your project and checks availability across multiple TLDs (.com, .io, .dev, .ai, etc.). Saves hours of brainstorming and manual checking.
You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.
Implements Manus-style file-based planning for complex tasks. Creates task_plan.md, findings.md, and progress.md. Use when starting complex multi-step tasks, research projects, or any task requiring >5 tool calls.
Creative research ideation and exploration. Use for open-ended brainstorming sessions, exploring interdisciplinary connections, challenging assumptions, or identifying research gaps. Best for early-stage research planning when you do not have specific observations yet. For formulating testable hypotheses from data use hypothesis-generation.
Comprehensive GitHub project management with swarm-coordinated issue tracking, project board automation, and sprint planning
Interview the user relentlessly about a plan or design until reaching shared understanding, resolving each branch of the decision tree. Use when user wants to stress-test a plan, get grilled on their design, or mentions "grill me".
Take github/optimize-agentic-workflow from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.