CLI Commands
This page lists available commands for managing agentic workflows with the GitHub CLI extension gh aw
.
Installation
Section titled “Installation”gh extension install githubnext/gh-aw
Quick Start
Section titled “Quick Start”# Show version and helpgh aw versiongh aw --help
# Basic workflow lifecyclegh aw add samples/weekly-research.md -r githubnext/agentics # Add workflow and compile to GitHub Actionsgh aw compile # Recompile to GitHub Actionsgh aw status # Check statusgh aw run weekly-research # Execute workflowgh aw run weekly-research daily-plan # Execute multiple workflowsgh aw run weekly-research --repeat 3600 # Execute workflow every hourgh aw logs weekly-research # View execution logs
📝 Workflow Creation and Management
Section titled “📝 Workflow Creation and Management”The add
and new
commands help you create and manage agentic workflows, from templates and samples to completely custom workflows.
Creating New Workflows:
# Create a new workflow with comprehensive templategh aw new my-custom-workflow
# Create a new workflow, overwriting if it existsgh aw new issue-handler --force
Adding Workflows from Samples:
# Add a workflow from the official samples repositorygh aw add samples/weekly-research.md -r githubnext/agentics
# Add workflow and create pull request for reviewgh aw add samples/issue-triage.md -r githubnext/agentics --pr
# Add workflow to a specific directorygh aw add samples/daily-standup.md -r githubnext/agentics --output .github/workflows/
Workflow Removal:
# Remove a workflow and its compiled versiongh aw remove WorkflowName
# Remove workflow but keep shared include filesgh aw remove WorkflowName --keep-orphans
🔧 Workflow Recompilation
Section titled “🔧 Workflow Recompilation”The compile
command transforms natural language workflow markdown files into executable GitHub Actions YAML files. This is the core functionality that converts your agentic workflow descriptions into automated GitHub workflows.
Core Compilation:
# Compile all workflows in .github/workflows/gh aw compile
# Compile with detailed output for debugginggh aw compile --verbose
# Compile with schema validation to catch errors earlygh aw compile --validate
# Override the AI engine for specific compilationgh aw compile --engine codex
# Generate GitHub Copilot instructions file alongside workflowsgh aw compile --instructions
# Compile all workflows and remove orphaned .lock.yml filesgh aw compile --purge
Development Features:
# Watch for changes and automatically recompile (ideal for development)gh aw compile --watch
# Watch with verbose output for detailed compilation feedbackgh aw compile --watch --verbose
# Clean up orphaned lock files from deleted workflowsgh aw compile --purge --verbose
When markdown workflow files (.md
) are deleted, their corresponding compiled workflow files (.lock.yml
) remain behind. The --purge
flag automatically removes these orphaned files:
# Remove orphaned .lock.yml files during compilationgh aw compile --purge
# With verbose output to see which files are removedgh aw compile --purge --verbose
⚙️ Workflow Operations on GitHub Actions
Section titled “⚙️ Workflow Operations on GitHub Actions”These commands control the execution and state of your compiled agentic workflows within GitHub Actions.
Workflow Execution:
# Run a single workflow immediately in GitHub Actionsgh aw run WorkflowName
# Run multiple workflows immediately in GitHub Actionsgh aw run WorkflowName1 WorkflowName2 WorkflowName3
# Run workflows and repeat every 3 minutesgh aw run WorkflowName --repeat 180
# Run workflow with specific input parameters (if supported)gh aw run weekly-research --input priority=high
Workflow State Management:
# Show status of all agentic workflowsgh aw status
# Show status of workflows matching a patterngh aw status WorkflowPrefixgh aw status path/to/workflow.lock.yml
# Enable all agentic workflows for automatic executiongh aw enable
# Enable specific workflows matching a patterngh aw enable WorkflowPrefixgh aw enable path/to/workflow.lock.yml
# Disable all agentic workflows to prevent executiongh aw disable
# Disable specific workflows matching a patterngh aw disable WorkflowPrefixgh aw disable path/to/workflow.lock.yml
📊 Log Analysis and Monitoring
Section titled “📊 Log Analysis and Monitoring”The logs
command provides comprehensive analysis of workflow execution history, including performance metrics, cost tracking, and error analysis.
Basic Log Retrieval:
# Download logs for all agentic workflowsgh aw logs
# Download logs for a specific workflowgh aw logs weekly-research
# Download logs to custom directory for organizationgh aw logs -o ./workflow-analysis
Advanced Filtering and Analysis:
# Limit number of runs and filter by date rangegh aw logs -c 10 --start-date 2024-01-01 --end-date 2024-01-31
# Analyze recent performance with verbose outputgh aw logs weekly-research -c 5 --verbose
# Export logs for external analysis toolsgh aw logs --format json -o ./exports/
Metrics Included:
- Execution duration from GitHub API timestamps (CreatedAt, StartedAt, UpdatedAt)
- AI model token consumption and associated costs
- Success/failure rates and error categorization
- Workflow run frequency and scheduling patterns
- Resource usage and performance trends
🔍 MCP Server Inspection
Section titled “🔍 MCP Server Inspection”The mcp inspect
command allows you to analyze and troubleshoot Model Context Protocol (MCP) servers configured in your workflows.
📘 Complete MCP Guide: For comprehensive MCP setup, configuration examples, and troubleshooting, see the MCPs.
# List all workflows that contain MCP server configurationsgh aw mcp inspect
# Inspect all MCP servers in a specific workflowgh aw mcp inspect workflow-name
# Filter inspection to specific servers by namegh aw mcp inspect workflow-name --server server-name
# Show detailed information about a specific tool (requires --server)gh aw mcp inspect workflow-name --server server-name --tool tool-name
# Enable verbose output with connection detailsgh aw mcp inspect workflow-name --verbose
# Launch the official @modelcontextprotocol/inspector web interfacegh aw mcp inspect workflow-name --inspector
Key Features:
- Server discovery and connection testing
- Tool and capability inspection
- Detailed tool information with
--tool
flag - Permission analysis
- Multi-protocol support (stdio, Docker, HTTP)
- Web inspector integration
For detailed MCP debugging and troubleshooting guides, see MCP Debugging.
👀 Watch Mode for Development
Section titled “👀 Watch Mode for Development”The --watch
flag provides automatic recompilation during workflow development, monitoring for file changes in real-time. See Authoring in VS Code.
# Watch all workflow files in .github/workflows/ for changesgh aw compile --watch
# Watch with verbose output for detailed compilation feedbackgh aw compile --watch --verbose
📦 Package Management
Section titled “📦 Package Management”# Install workflow packages globally (default)gh aw install org/repo
# Install packages locally in current projectgh aw install org/repo --local
# Install a specific version, branch, or commitgh aw install org/repo@v1.0.0gh aw install org/repo@main --localgh aw install org/repo@commit-sha
# Uninstall a workflow package globallygh aw uninstall org/repo
# Uninstall a workflow package locallygh aw uninstall org/repo --local
# List all installed packages (global and local)gh aw list --packages
# List only local packagesgh aw list --packages --local
# Uninstall a workflow package globallygh aw uninstall org/repo
# Uninstall a workflow package locallygh aw uninstall org/repo --local
# Show version informationgh aw version
Package Management Features:
- Install from GitHub: Download workflow packages from any GitHub repository’s
workflows/
directory - Version Control: Specify exact versions, branches, or commits using
@version
syntax - Global Storage: Global packages are stored in
~/.aw/packages/org/repo/
directory structure - Local Storage: Local packages are stored in
.aw/packages/org/repo/
directory structure - Flexible Installation: Choose between global (shared across projects) or local (project-specific) installations
Package Installation Requirements:
- GitHub CLI (
gh
) to be installed and authenticated with access to the target repository - Network access to download from GitHub repositories
- Target repository must have a
workflows/
directory containing.md
files
Package Removal:
# Uninstall workflow packages globally (default)gh aw uninstall org/repo
# Uninstall packages locally from current projectgh aw uninstall org/repo --local
Related Documentation
Section titled “Related Documentation”- Workflow Structure - Directory layout and file organization
- Frontmatter Options - Configuration options for workflows
- Safe Outputs - Secure output processing including issue updates
- Tools Configuration - GitHub and MCP server configuration
- Include Directives - Modularizing workflows with includes