optimize-agentic-workflow
Skill5.3k starsChanged 6 months agoMITView on GitHub
Analyze and reduce token consumption in agentic workflows — guardrail-specific entry points, measurement, and optimization techniques.
Trending
Quiet since March.thin dataabout the whole repository
Who's talking about github/gh-aw
- A Hacker News story“GitHub Agentic Workflows”Hacker News · Feb 11, 2026 · 2 points
- @kcieslak.io“We see that a lot in our OSSed AW repository which uses fully agentic development - github.com/github/gh-aw …”Bluesky · Mar 24, 2026 · 1 likes
- @github-trending.bsky.social“🚀 Skyrocketing! 🚀 (200+ new stars) 📦 github / gh-aw ⭐ 2,482 (+213) 🗒 Go GitHub Agentic Workflows”Bluesky · Feb 15, 2026
The biggest 3 of 3 mentions linking to the repository that our crawl found. Each line is their own headline.
In this repository108 other files it gives its agents.
- AGENTS.mdAGENTS.md
- docs/src/content/docs/engines/claude.mdCLAUDE.md
- pkg/workflow/data/engines/claude.mdCLAUDE.md
- .squad/templates/copilot-instructions.mdCopilot instructions
- playwright-cliSkill
- agentic-workflowsSkill
- awf-release-integratorSkill
- checkout-credential-reviewSkill
- console-renderingSkill
- copilot-reviewSkill
- create-canvasSkill
- custom-agentsSkill
- custom-engine-implementationSkill
- debugging-workflowsSkill
- developer-code-organizationSkill
- developer-internalsSkill
- developer-releaseSkill
- developer-securitySkill
- developerSkill
- documentationSkill
- error-messagesSkill
- error-pattern-safetySkill
- error-recovery-patternsSkill
- gh-agent-sessionSkill
- gh-agent-taskSkill
- github-copilot-agent-tips-and-tricksSkill
- github-discussion-querySkill
- github-issue-querySkill
- github-labels-querySkill
- github-mcp-serverSkill
- github-pr-querySkill
- github-scriptSkill
- github-workflows-querySkill
- go-codemodSkill
- go-lintersSkill
- http-mcp-headersSkill
- javascript-refactoringSkill
- jqschemaSkill
- messagesSkill
- npmSkill
- open-pull-requestSkill
- operational-value-designerSkill
- otel-queriesSkill
- pr-finisherSkill
- prompt-token-efficiencySkill
- pr-to-go-linterSkill
- reportingSkill
- resolve-merge-conflictsSkill
- restricted-tool-triageSkill
- review-agentic-workflowsSkill
- security-advisory-compat-enforcerSkill
- sergo-examplesSkill
- skillz-integrationSkill
- ssl-skill-normalizerSkill
- temporary-id-safe-outputSkill
- workflow-step-summariesSkill
- GitHub Agentic WorkflowsSkill
- {skill-name}Skill
- agent-collaborationSkill
- agent-conductSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 36
Ask for one of these inputs:
- Distinctive: line 44
If the user gives a GitHub Actions run URL:
- Distinctive: line 95
After measuring token usage, produce a prioritized plan:
- Very specific: line 113
Commit both the source and the generated .lock.yml
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Agentic Workflow Token Optimizer
Help users reduce the AI token usage and cost of GitHub Agentic Workflows in this repository.
Load These References First
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.md
Load these only when relevant:
.github/aw/experiments.md.github/aw/safe-outputs.md
Available Commands
gh 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 statusStart the Conversation
Ask for one of these inputs:
- a workflow run URL (or run ID) to analyze
- a workflow name to review the source
- the guardrail that was exceeded (max-ai-credits, max-daily-ai-credits, max-tool-denials, max-turns / timeout)
Fast Path: Run URL Provided
If the user gives a GitHub Actions run URL:
- Extract the run ID
- Run
gh aw audit <run-id> --json - Inspect
agent_usage.aic,agent_usage.input_tokens,agent_usage.output_tokens,agent_usage.cache_read_tokens - Identify the most expensive phases before asking additional questions
Guardrail-Specific Entry Points
max-ai-credits exceeded
The workflow was stopped because it consumed more AI Credits than the configured per-run budget.
Priority checks:
- Which tool calls dominated token usage? (
token-usage.jsonl) - Is the prompt front-loading large payloads that could be fetched on demand?
- Are there repetitive extraction steps that sub-agents could handle cheaply?
- Does the frontier model handle tasks that a small model could do?
max-daily-ai-credits exceeded
The workflow is being blocked because its 24-hour AI Credits budget is exhausted.
Priority checks:
- What is the run cadence? (scheduled too frequently?)
- Does the workflow use cheap triage before escalating to the frontier model?
- Is batching or caching applicable to reduce run frequency?
- Are there noop early-exits for events that do not require agent action?
max-tool-denials exceeded
The Copilot SDK hit the tool-denial threshold, indicating the prompt attempted actions outside the allowed tool policy.
Priority checks:
- What tool was repeatedly denied? (last denied reason in the failure issue)
- Is the tool missing from the workflow's permissions/firewall config?
- Can the prompt be revised to avoid the denied operation entirely?
- Would a DataOps pre-step satisfy the data need without a tool call?
Timeout / max-turns exceeded
The agent ran out of time or turns before completing the task.
Priority checks:
- Is the task decomposable into smaller, faster sub-tasks?
- Are there long-running tool calls that could be replaced with DataOps pre-steps?
- Is the prompt asking the agent to do too much in one run?
- Can
max-turnsortimeout-minutesbe raised, or should the task be split?
Optimization Analysis Plan
After measuring token usage, produce a prioritized plan:
- Measure — run
gh aw audit <run-id> --jsonand summarize AI Credits and per-call token breakdown - Diagnose the harness — classify failures across context assembly, tool interaction, generation control, orchestration, memory management, and output processing
- Identify top cost drivers — list the three most expensive phases/tool calls
- Apply quick wins first — DataOps pre-steps,
gh-proxy,cli-proxy, prompt trimming - Sub-agent delegation — identify repetitive per-item loops suitable for small-model workers
- Reuse execution experience — preserve compact task features, configuration deltas, outcomes, costs, and diagnoses in
cache-memorywhen cross-run reuse is useful; apply relevant recurring patterns to similar cases - Prompt caching — verify stable instructions and reusable experience appear before dynamic content
- Experiment correctness first — add an
experiments:entry, compare output quality first, and usemetric: "aic"to choose among equivalent-quality variants - Validate quality — confirm the optimized run produces equivalent safe outputs
Present the plan clearly before making any edits. Confirm with the user before applying changes.
Editing Workflow
- Edit
.github/workflows/<workflow-name>.md - Recompile:
gh aw compile <workflow-name> - Commit both the source and the generated
.lock.yml - Report the estimated savings and link to the PR or commit
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

