Run popular AI code agents (Claude Code, Codex, Gemini CLI) in headless or non-interactive mode for automation, scripting, and programmatic execution. Use when automating AI agent tasks or integrating into CI/CD pipelines.
This skill provides instructions for running popular AI code agents in headless (non-interactive) mode, enabling automation, scripting, and programmatic execution without user interaction.
As an expert in your assigned roles, you must announce your actions before performing them using the following format:
As a {Role} [and {Role}, ...], I will {action description}
This communication pattern ensures transparency and allows for human-in-the-loop oversight at key decision points.
Follow these steps to run an AI code agent in headless mode:
Determine which AI code agent to run in headless mode. Route to the appropriate reference file:
references/claude-code.mdreferences/codex.mdreferences/gemini-cli.md<agent-name> --help to discover available flags for non-interactive/headless mode. Look for flags like --print, --non-interactive, --batch, --yes, --auto-approve, or similarAs a DevOps Engineer, verify the agent is installed:
# Claude Code
claude --version
# Codex
codex --version
# Gemini CLI
gemini --version
If not installed, use the dev-swarm-install-ai-code-agent skill.
Each agent supports different headless modes:
| Agent | Mode | Use Case |
|-------|------|----------|
| Claude Code | --print | Print output and exit (piping) |
| Codex | exec | Non-interactive execution |
| Gemini CLI | Positional prompt | One-shot execution |
Important: Headless mode typically requires bypassing permission prompts.
| Agent | Permission Flag | Security Note |
|-------|-----------------|---------------|
| Claude Code | --dangerously-skip-permissions | Bypasses all prompts |
| Codex | --ask-for-approval never | Auto-approve all actions |
| Gemini CLI | --yolo | Auto-accept all actions |
Security Warning: Only use these flags in trusted, sandboxed environments.
Refer to the agent-specific reference file for detailed command syntax and examples.
Quick Reference (Minimal Commands):
# Claude Code (headless)
claude --print --dangerously-skip-permissions "your prompt here"
# Codex (headless)
codex --ask-for-approval never --sandbox workspace-write exec "your prompt here"
# Gemini CLI (headless)
gemini --yolo --sandbox "your prompt here"
Configure output format based on your needs:
See agent-specific reference files for output format options.
Issue: Agent hangs waiting for input
Issue: Command not found
Issue: Permission denied errors
Issue: Output parsing fails
--output-format json) for reliable parsingnpx skills add X-School-Academy/dev-swarm-无头-AI代理下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer