CLI Commands
The gh aw CLI extension enables developers to create, manage, and execute AI-powered workflows directly from the command line. It transforms natural language markdown files into GitHub Actions.
🚀 Most Common Commands
Section titled “🚀 Most Common Commands”95% of users only need these 5 commands:
| Command | When to Use | Details |
|---|---|---|
gh aw init | Set up your repository for agentic workflows | → Documentation |
gh aw add (workflow) | Add workflows from The Agentics collection | → Documentation |
gh aw status | Check current state of all workflows | → Documentation |
gh aw compile | Convert markdown to GitHub Actions YAML | → Documentation |
gh aw run (workflow) | Execute workflows immediately in GitHub Actions | → Documentation |
Complete command reference below ↓
Common Workflows for Beginners
Section titled “Common Workflows for Beginners”Learn how to use CLI commands together for common development tasks:
After creating a new workflow
Section titled “After creating a new workflow”gh aw compile my-workflow # Check for syntax errorsgh aw run my-workflow # Test it manually (if workflow_dispatch enabled)gh aw logs my-workflow # See what happenedWhat each command does:
compile: Validates your markdown and generates the.lock.ymlfile—catches errors before runningrun: Triggers the workflow immediately in GitHub Actions (requiresworkflow_dispatchtrigger)logs: Downloads and analyzes execution logs to see what the AI did
When something goes wrong
Section titled “When something goes wrong”gh aw status # Check configuration and workflow stategh aw logs my-workflow # Review recent execution logsgh aw audit (run-id) # Analyze specific run in detailFinding the run-id:
- Go to your repository on GitHub.com
- Click the Actions tab
- Click on a workflow run from the list
- The run-id is the number in the URL:
github.com/owner/repo/actions/runs/12345678→ run-id is12345678
What each command reveals:
status: Shows if workflows are enabled, compiled, and their scheduleslogs: Reveals AI decisions, tool usage, network activity, and errorsaudit: Provides deep analysis of a specific run including execution metrics, failed tools, and artifacts
Fixing common issues
Section titled “Fixing common issues”# Token or secret issuesgh aw secrets bootstrap --engine copilot # Check token configuration
# Workflow not found or disabledgh aw status # List all workflowsgh aw enable my-workflow # Enable if disabled
# Syntax errors in workflow markdowngh aw compile my-workflow --validate # Detailed validation outputgh aw fix my-workflow --write # Auto-fix deprecated fieldsInstallation
Section titled “Installation”Install the GitHub CLI extension:
gh extension install githubnext/gh-awPinning to a Specific Version
Section titled “Pinning to a Specific Version”For production environments or to ensure reproducible builds, you can pin the installation to a specific version using the @REF syntax:
# Pin to a specific release taggh extension install githubnext/gh-aw@v0.1.0
# Pin to a specific commit SHAgh extension install githubnext/gh-aw@abc123def456Checking your current version:
gh aw versionUpgrading to a new pinned version:
# Remove the current installationgh extension remove gh-aw
# Install the new pinned versiongh extension install githubnext/gh-aw@v0.2.0Alternative: Standalone Installer
Section titled “Alternative: Standalone Installer”If the extension installation fails (common in Codespaces outside the githubnext organization or when authentication issues occur), use the standalone installer:
# Install latest versioncurl -sL https://raw.githubusercontent.com/githubnext/gh-aw/main/install-gh-aw.sh | bash
# Install specific versioncurl -sL https://raw.githubusercontent.com/githubnext/gh-aw/main/install-gh-aw.sh | bash -s v0.1.0After standalone installation, the binary is installed to ~/.local/share/gh/extensions/gh-aw/gh-aw and can be used with gh aw commands just like the extension installation.
Pinning with the standalone installer:
To ensure reproducible installations, you can pin to a specific version by passing the version tag as an argument:
# Download and run with a specific versioncurl -sL https://raw.githubusercontent.com/githubnext/gh-aw/main/install-gh-aw.sh | bash -s v0.1.0
# Or download the script first, then run with version argumentcurl -sL https://raw.githubusercontent.com/githubnext/gh-aw/main/install-gh-aw.sh -o install-gh-aw.shchmod +x install-gh-aw.sh./install-gh-aw.sh v0.1.0The installer will download the specified version’s pre-built binary for your platform (Linux, macOS, FreeBSD, or Windows) and install it to the standard extension directory.
GitHub Enterprise Server Support
Section titled “GitHub Enterprise Server Support”GitHub Agentic Workflows fully supports GitHub Enterprise Server deployments. Configure your enterprise instance using environment variables:
# Set your enterprise hostnameexport GH_HOST="github.enterprise.com"# Or use GitHub Actions standard variableexport GITHUB_SERVER_URL="https://github.enterprise.com"
# Authenticate with your enterprise instancegh auth login --hostname github.enterprise.com
# Use gh aw commands normallygh aw statusgh aw logs workflowWhen using the --repo flag, you can specify the enterprise host:
gh aw logs workflow --repo github.enterprise.com/owner/repogh aw run workflow --repo github.enterprise.com/owner/repoGlobal Options
Section titled “Global Options”| Flag | Description |
|---|---|
-h, --help | Show help information |
-v, --verbose | Enable verbose output with debugging details |
Help Commands:
gh aw --help # Show all commandsgh aw help [command] # Command-specific helpgh aw help all # Comprehensive documentationCommands
Section titled “Commands”Commands are organized by workflow lifecycle: creating, building, testing, monitoring, and managing workflows.
Getting Workflows
Section titled “Getting Workflows”Initialize your repository for agentic workflows.
gh aw init # Configure .gitattributes, Copilot instructions (MCP enabled by default)gh aw init --no-mcp # Skip MCP server integrationConfigures .gitattributes to mark .lock.yml files as generated, adds Copilot instructions for better AI assistance, sets up prompt files for workflow creation, and creates .github/aw/logs/.gitignore to prevent workflow logs from being committed. MCP server integration is enabled by default, creating GitHub Actions workflow for MCP server setup, configuring .vscode/mcp.json for VS Code integration, and enabling gh-aw MCP tools in Copilot Agent. Use --no-mcp to skip MCP server integration.
Add workflows from The Agentics collection or other repositories. Displays the workflow description (from frontmatter description field) to provide context.
gh aw add githubnext/agentics/ci-doctor # Add single workflowgh aw add "githubnext/agentics/ci-*" # Add multiple with wildcardsgh aw add ci-doctor --dir shared --number 3 # Organize and create copiesgh aw add ci-doctor --create-pull-request # Create PR instead of direct commitOptions: --dir (organize in subdirectories), --number (create numbered copies), --create-pull-request or --pr (create pull request), --no-gitattributes (skip .gitattributes update)
Create a new custom workflow from scratch.
gh aw new # Interactive modegh aw new my-custom-workflow # Create template filegh aw new my-workflow.md # Same as above (.md extension stripped)gh aw new my-workflow --force # Overwrite if existsCreates a markdown workflow file in .github/workflows/ with template frontmatter and automatically opens it for editing. The .md extension is optional and will be automatically normalized.
secrets
Section titled “secrets”Manage GitHub Actions secrets and tokens for GitHub Agentic Workflows. Use this command to set secrets for workflows and check which recommended token secrets are configured for your repository.
Subcommands:
secrets set
Section titled “secrets set”Create or update a repository secret. The secret value can be provided via flag, environment variable, or stdin.
gh aw secrets set MY_SECRET # From stdin (prompts)gh aw secrets set MY_SECRET --value "secret123" # From flaggh aw secrets set MY_SECRET --value-from-env MY_TOKEN # From environment variablegh aw secrets set MY_SECRET --owner myorg --repo myrepo # For specific repositoryOptions: --owner (repository owner), --repo (repository name), --value (secret value), --value-from-env (environment variable to read from), --api-url (GitHub API base URL)
When --owner and --repo are not specified, the command operates on the current repository. Both flags must be provided together when targeting a specific repository.
secrets bootstrap
Section titled “secrets bootstrap”Check and suggest setup for gh-aw GitHub token secrets. This command is read-only and inspects repository secrets to identify missing tokens, then prints least-privilege setup instructions.
gh aw secrets bootstrap # Check tokens for current repositorygh aw secrets bootstrap --engine copilot # Check Copilot-specific tokensgh aw secrets bootstrap --engine claude # Check Claude-specific tokensgh aw secrets bootstrap --engine codex # Check Codex-specific tokensgh aw secrets bootstrap --owner org --repo project # Check specific repositoryOptions: --engine (AI engine to check tokens for: copilot, claude, codex), --owner (repository owner, defaults to current), --repo (repository name, defaults to current)
The command checks for recommended secrets like GH_AW_GITHUB_TOKEN, COPILOT_GITHUB_TOKEN, ANTHROPIC_API_KEY, and OPENAI_API_KEY based on the specified engine. It provides setup instructions with suggested scopes for any missing tokens.
See GitHub Tokens reference for detailed information about token precedence and security best practices.
Building
Section titled “Building”Automatically fix deprecated workflow fields using codemods. Applies migrations for field renames and API changes to keep workflows up-to-date with the latest schema.
gh aw fix # Check all workflows (dry-run)gh aw fix --write # Fix all workflowsgh aw fix my-workflow # Check specific workflow (dry-run)gh aw fix my-workflow --write # Fix specific workflowgh aw fix --list-codemods # List available codemods with versionsOptions: --write (apply changes to files, defaults to dry-run), --list-codemods (show available fixes with version information)
Available Codemods:
timeout_minutes→timeout-minutes(field rename, v0.1.0)network.firewall→sandbox.agent(migration with value mapping, v0.1.0)on.command→on.slash_command(trigger rename, v0.2.0)
The command runs in dry-run mode by default, showing what would be changed without modifying files. Use --write to apply the fixes. All changes preserve formatting, comments, and indentation.
Integration: The fix command is automatically run before compilation when using gh aw compile --fix, and is integrated into the build process via make fix.
compile
Section titled “compile”Compile Markdown workflows to GitHub Actions YAML. Remote imports are automatically cached in .github/aw/imports/ for offline compilation.
gh aw compile # Compile all workflowsgh aw compile my-workflow # Compile specific workflowgh aw compile --watch # Auto-recompile on changesgh aw compile --validate --strict # Schema + strict mode validationgh aw compile --validate --json # Validation with JSON outputgh aw compile --fix # Run fix command before compilationgh aw compile --zizmor # Security scan (warnings)gh aw compile --strict --zizmor # Security scan (fails on findings)gh aw compile --dependabot # Generate dependency manifestsgh aw compile --purge # Remove orphaned .lock.yml filesOptions: --validate (schema validation and container checks), --strict (strict mode validation for all workflows), --fix (run gh aw fix --write before compiling), --zizmor (security scanning with zizmor), --dependabot (generate npm/pip/Go manifests and update dependabot.yml), --json (machine-readable JSON output), --watch (auto-recompile on changes), --purge (remove orphaned .lock.yml files)
Strict Mode (--strict):
Enhanced security validation for production workflows. Enforces: (1) no write permissions - use safe-outputs instead, (2) explicit network configuration required, (3) no wildcard * in network.allowed domains, (4) network configuration required for custom MCP servers with containers, (5) GitHub Actions pinned to commit SHAs, (6) no deprecated frontmatter fields. The CLI flag applies to all workflows and takes precedence over individual workflow strict frontmatter fields.
Example:
gh aw compile --strict # Enable strict mode for all workflowsgh aw compile --strict --zizmor # Strict mode with security scanninggh aw compile --validate --strict # Validate schema and enforce strict modeAgentic campaign specs and generated workflows: When agentic campaign spec files exist under .github/workflows/*.campaign.md, gh aw compile validates those specs (including referenced workflows) and fails if problems are found. By default, compile also synthesizes coordinator workflows for each valid spec that has meaningful details (e.g., go-file-size-reduction.campaign.md → go-file-size-reduction.campaign.g.md and go-file-size-reduction.campaign.launcher.g.md) and compiles each one to a corresponding .lock.yml file. Coordinator workflows are only generated when the agentic campaign spec includes tracker labels, workflows, memory paths, a metrics glob, or governance settings. See the campaign command for management and inspection.
See Strict Mode reference for frontmatter configuration and Security Guide for best practices.
Testing
Section titled “Testing”Test workflows safely in temporary private repositories or run directly in a specified repository. Displays workflow description from frontmatter.
gh aw trial githubnext/agentics/ci-doctor # Test remote workflowgh aw trial ./workflow.md # Test local workflowgh aw trial ./workflow.md --use-local-secrets # Test with local API keysgh aw trial ./workflow.md --logical-repo owner/repo # Act as different repogh aw trial ./issue-workflow.md --trigger-context "#123" # With issue contextgh aw trial ./workflow.md --repo owner/repo # Run directly in repositoryOptions: -e, --engine (override AI engine), --auto-merge-prs (auto-merge created PRs), --repeat N (repeat N times), --delete-host-repo-after (delete trial repository), --use-local-secrets (use local API keys), --logical-repo owner/repo (access issues/PRs from specific repository), --clone-repo owner/repo (use different codebase), --trigger-context "#123" (provide issue/PR context), --repo owner/repo (install and run directly without waiting)
Trial Modes: Default creates temporary private repository for safe testing. Direct repository mode (--repo) installs workflow in specified repository and executes immediately. Results saved to trials/ directory.
Execute workflows immediately in GitHub Actions. After triggering, displays workflow URL and suggests using gh aw audit to analyze the run.
gh aw run workflow # Run workflowgh aw run workflow1 workflow2 # Run multiple workflowsgh aw run workflow --repeat 3 # Repeat execution 3 timesgh aw run workflow --use-local-secrets # Use local API keysOptions: --repeat N (execute N times), --use-local-secrets (temporarily push AI engine secrets from environment variables, then clean up)
Monitoring
Section titled “Monitoring”status
Section titled “status”Show status of all workflows in the repository.
gh aw status # Show all workflow statusgh aw status --ref main # Show status with latest run info for main branchgh aw status --json --ref feature-branch # JSON output with run status for specific branchgh aw status --label automation # Filter workflows by labelgh aw status --repo owner/other-repo # Check status in different repositoryLists all agentic workflows with their current state, enabled/disabled status, schedules, labels, and configurations. When --ref is specified, includes the latest run status and conclusion for each workflow on that branch or tag.
Options: --ref (filter by branch or tag, shows latest run status and conclusion), --label (filter workflows by label, case-insensitive match), --json (output in JSON format), --repo owner/repo (check workflow status in specific repository, defaults to current)
Download and analyze workflow execution logs. Downloads logs, analyzes tool usage and network patterns, and caches results for faster subsequent runs (~10-100x speedup). Overview table includes errors, warnings, missing tools, and noop messages.
gh aw logs # Download logs for all workflowsgh aw logs workflow # Download logs for specific workflowgh aw logs -c 10 --start-date -1w # Filter by count and dategh aw logs --ref main # Filter logs by branch or taggh aw logs --ref v1.0.0 --parse --json # Generate markdown + JSON output for specific taggh aw logs --campaign # Filter to only campaign orchestrator workflowsgh aw logs workflow --repo owner/repo # Download logs from specific repositoryOptions: -c, --count N (limit number of runs), -e, --engine (filter by AI engine like -e copilot), --campaign (filter to only campaign orchestrator workflows), --start-date (filter runs from date like --start-date -1w), --end-date (filter runs until date like --end-date -1d), --ref (filter by branch or tag like --ref main or --ref v1.0.0), --parse (generate log.md and firewall.md), --json (output structured metrics), --repo owner/repo (download logs from specific repository)
Investigate and analyze specific workflow runs. Provides detailed analysis including overview, execution metrics, tool usage patterns, MCP server failures, firewall analysis, noop messages, and artifact information. Accepts run IDs or URLs from any repository and GitHub instance. JSON output includes parsed noop messages similar to missing-tool reports. Automatically detects GitHub Copilot agent runs and uses specialized log parsing to extract agent-specific metrics including turns, tool calls, errors, and token usage.
gh aw audit 12345678 # By run IDgh aw audit https://github.com/owner/repo/actions/runs/123 # By URLgh aw audit 12345678 --parse # Parse logs to markdownAgentic campaigns
Section titled “Agentic campaigns”campaign
Section titled “campaign”Inspect and validate first-class agentic campaign definitions declared as .github/workflows/*.campaign.md files.
For safe scaling and incremental discovery, campaign specs support:
cursor-glob: durable cursor/checkpoint location in repo-memory.governance.max-discovery-items-per-run: maximum items processed during discovery.governance.max-discovery-pages-per-run: maximum pages fetched during discovery.
See the Agentic campaigns guide for the full spec shape and recommended defaults.
gh aw campaign # List all agentic campaignsgh aw campaign security # Filter by ID or name substringgh aw campaign --json # JSON output
gh aw campaign status # Live status for all agentic campaignsgh aw campaign status incident # Filter by ID or name substringgh aw campaign status --json # JSON status output
gh aw campaign new my-campaign-id # Scaffold a new agentic campaign specgh aw campaign validate # Validate agentic campaign specs (fails on problems)gh aw campaign validate --no-strict # Report problems without failingAlternative approach: For a low-code/no-code method, use the ”🚀 Start an Agentic Campaign” issue form in the GitHub UI. The form captures campaign intent with structured fields and can trigger an agent to scaffold the spec file automatically. See the Getting Started guide for details.
Management
Section titled “Management”enable
Section titled “enable”Enable workflows for execution with pattern matching support for bulk operations.
gh aw enable # Enable all workflowsgh aw enable prefix # Enable workflows matching prefixgh aw enable ci-* # Enable workflows with patterngh aw enable workflow --repo owner/repo # Enable in specific repositoryOptions: --repo owner/repo (enable workflows in specific repository, defaults to current)
disable
Section titled “disable”Disable workflows to prevent execution and cancel any currently running workflow jobs.
gh aw disable # Disable all workflowsgh aw disable prefix # Disable workflows matching prefixgh aw disable ci-* # Disable workflows with patterngh aw disable workflow --repo owner/repo # Disable in specific repositoryOptions: --repo owner/repo (disable workflows in specific repository, defaults to current)
remove
Section titled “remove”Remove workflows from the repository.
gh aw remove my-workflowRemoves both .md and .lock.yml files and updates repository configuration.
update
Section titled “update”Update workflows to their latest versions. Updates workflows based on source field format owner/repo/path@ref. Replaces local file with upstream version (default) or performs 3-way merge to preserve local changes. Semantic version tags update within the same major version. Falls back to git commands when GitHub API authentication fails. Works with public repositories without requiring GitHub authentication.
gh aw update # Update all workflows with source fieldgh aw update ci-doctor # Update specific workflowgh aw update ci-doctor --merge # Update with 3-way merge (preserve changes)gh aw update ci-doctor --major --force # Allow major version updatesgh aw update --dir custom/workflows # Update workflows in custom directoryOptions: --dir (specify workflow directory, defaults to .github/workflows), --merge (3-way merge to preserve local changes, creates conflict markers if needed), --major (allow major version updates/breaking changes), --force (force update even with conflicts)
Update Modes: Default replaces local file with latest upstream version (no conflicts). --merge performs 3-way merge preserving local changes (may create conflict markers). When conflicts occur with --merge, diff3 markers are added and recompilation is skipped until resolved.
Advanced
Section titled “Advanced”Manage MCP (Model Context Protocol) servers. Lists MCP servers configured in workflows, inspects server configuration, tests connectivity, and adds new servers from the registry.
gh aw mcp list # List all MCP serversgh aw mcp list workflow # List servers for specific workflowgh aw mcp list-tools <mcp-server> # List tools for specific MCP servergh aw mcp list-tools <mcp-server> workflow # List tools in specific workflowgh aw mcp inspect workflow # Inspect and test servers (auto-detects safe-inputs)gh aw mcp add # Add servers from registryThe mcp inspect command automatically detects and inspects safe-inputs defined in workflows, including those imported from shared workflows. No additional flag is needed - safe-inputs are inspected alongside other MCP servers when present.
See MCPs Guide for complete documentation.
Pull request management utilities.
Subcommands:
pr transfer
Section titled “pr transfer”Transfer a pull request to another repository, preserving code changes, title, and description.
gh aw pr transfer https://github.com/source/repo/pull/234gh aw pr transfer <pr-url> --repo target-owner/target-repoOptions: --repo target-owner/target-repo (specify target repository, defaults to current)
mcp-server
Section titled “mcp-server”Run an MCP server exposing gh-aw commands as tools for integration with MCP-compatible applications.
gh aw mcp-server # Run with stdio transportgh aw mcp-server --port 8080 # Run HTTP server on port 8080gh aw mcp-server --cmd ./gh-aw # Use custom gh-aw binaryOptions: --port (run HTTP server with SSE transport), --cmd (path to gh-aw binary)
Available Tools: status, compile, logs, audit, mcp-inspect, add, update
The server spawns subprocess calls for each tool invocation to ensure GitHub tokens and secrets are not shared with the MCP server process.
See MCP Server Guide for integration details.
Utility Commands
Section titled “Utility Commands”version
Section titled “version”Show gh aw extension version information.
gh aw versionDisplays the current version of gh-aw and product information. Equivalent to using the --version flag.
Shell Completions
Section titled “Shell Completions”gh-aw provides shell completion for bash, zsh, fish, and PowerShell. Completions enable tab completion for workflow names, engine names, and directory paths.
Setting Up Completions
Section titled “Setting Up Completions”Bash:
gh aw completion bash > /etc/bash_completion.d/gh-aw# Or for local user installation:gh aw completion bash > ~/.bash_completion.d/gh-awsource ~/.bash_completion.d/gh-awZsh:
gh aw completion zsh > "${fpath[1]}/_gh-aw"# Then restart your shell or run:compinitFish:
gh aw completion fish > ~/.config/fish/completions/gh-aw.fishPowerShell:
gh aw completion powershell | Out-String | Invoke-Expression# For permanent setup, add to your PowerShell profileWhat Gets Completed
Section titled “What Gets Completed”| Context | Completion Type |
|---|---|
gh aw compile <TAB> | Workflow names from .github/workflows/ |
gh aw run <TAB> | Workflow names |
gh aw logs <TAB> | Workflow names |
gh aw status <TAB> | Workflow names |
gh aw enable/disable <TAB> | Workflow names |
gh aw mcp inspect <TAB> | Workflow names |
gh aw mcp list-tools <TAB> | Common MCP server names |
gh aw mcp list-tools github <TAB> | Workflow names |
--engine <TAB> | Engine names (copilot, claude, codex, custom) |
--dir <TAB> | Directory paths |
--output <TAB> | Directory paths |
Debug Logging
Section titled “Debug Logging”Enable detailed debugging output for troubleshooting. Shows namespace, message, and time diff (e.g., +50ms). Zero overhead when disabled. Supports pattern matching with wildcards.
DEBUG=* gh aw compile # All debug logsDEBUG=cli:* gh aw compile # CLI operations onlyDEBUG=cli:*,workflow:* gh aw compile # Multiple packagesDEBUG=*,-tests gh aw compile # All except testsTip: Use --verbose flag for user-facing details instead of DEBUG environment variable.
Smart Features
Section titled “Smart Features”Fuzzy Workflow Name Matching
Section titled “Fuzzy Workflow Name Matching”When a workflow name is not found, the CLI automatically suggests similar workflow names using fuzzy matching. This helps catch typos and provides helpful suggestions.
gh aw compile audti-workflows# ✗ workflow file not found: .github/workflows/audti-workflows.md## Suggestions:# • Did you mean: audit-workflows?# • Run 'gh aw status' to see all available workflows# • Check for typos in the workflow nameFuzzy matching works across all commands that accept workflow names:
gh aw compile <workflow>gh aw enable <workflow>gh aw disable <workflow>gh aw logs <workflow>gh aw mcp list <workflow>gh aw mcp add <workflow> <server>gh aw mcp list-tools <server> <workflow>gh aw mcp inspect <workflow>
The feature uses Levenshtein distance to suggest up to 3 similar names within an edit distance of 3 characters.
Troubleshooting
Section titled “Troubleshooting”| Issue | Solution |
|---|---|
command not found: gh | Install from cli.github.com |
extension not found: aw | Run gh extension install githubnext/gh-aw |
| Compilation fails with YAML errors | Check indentation, colons, and array syntax in frontmatter |
| Workflow not found | Check typo suggestions or run gh aw status to list available workflows |
| Permission denied | Check file permissions or repository access |
| Trial creation fails | Check GitHub rate limits and authentication |
See Common Issues and Error Reference for detailed troubleshooting.
Related Documentation
Section titled “Related Documentation”- Quick Start - Get your first workflow running
- Frontmatter - Configuration options
- Packaging & Distribution - Adding and updating workflows
- Security Guide - Security best practices
- VS Code Setup - Editor integration and watch mode
- MCP Server Guide - MCP server configuration
- Labs - Experimental workflows