autonomous-ai-agents
Spawn and orchestrate autonomous AI coding agents (Claude Code, Codex, OpenCode, Antigravity, Claude Cowork) from CLI terminal tools.
Quand l'utiliser (Trigger)
Déclenchement standard selon le contexte de l'écosystème Hermès.
Mode d'emploi (Usage)
Mode d'emploi standard via l'agent Hermès. Autonomous AI Coding Agents
Delegate coding tasks to autonomous AI CLI agents from within Hermes. Five agents are covered:
| Agent | CLI | Provider | Best For |
|---|---|---|---|
| Claude Code | claude | Anthropic | Complex multi-step work, structured JSON output, team orchestration |
| Codex | codex | OpenAI | Fast feature builds, parallel issue fixing |
| OpenCode | opencode | Provider-agnostic | Open-source flexibility, provider choice |
| Antigravity CLI | agy | Google Gemini | Plugin-based coding agents, sandbox, TUI sessions |
| Claude Cowork Desktop | claude-desktop | Anthropic | GUI with Cowork Spaces, auto-memory, Linux via frame-fix |
See references/claude-code.md, references/codex.md, references/opencode.md, references/antigravity-cli.md, and references/claude-cowork.md for full CLI reference per agent. Antigravity CLI also has an API doc in references/antigravity-cli-docs.md.
Quick Decision Guide
- One-shot bug fix or feature build → prefer the agent the user mentions. If unspecified, Claude Code print mode (
-p) is most reliable. - Multi-turn interactive session → use tmux + the agent’s TUI (see per-agent reference for tmux patterns).
- PR review → pipe
git diffto the agent or use built-in PR commands (claude --from-pr,opencode pr). - Parallel batch work → use git worktrees + background processes per agent.
- Cost-sensitive → use
--max-turnsand--max-budget-usd(Claude Code), or--effort low.
Common Patterns
One-Shot Task (all agents)
# Claude Code (preferred for complex work)
terminal(command="claude -p 'Add error handling to all API calls' --allowedTools 'Read,Edit' --max-turns 10", workdir="~/project", timeout=120)
# Codex
terminal(command="codex exec 'Add error handling'", workdir="~/project", pty=true)
# OpenCode
terminal(command="opencode run 'Add error handling'", workdir="~/project")
Background Interactive Session
# Start the agent in background with PTY
terminal(command="claude", workdir="~/project", background=true, pty=true)
# Returns session_id → monitor with process(action="poll", session_id="<id>")
# Or via tmux for Claude Code TUI control
terminal(command="tmux new-session -d -s agent -x 140 -y 40 && tmux send-keys -t agent 'cd ~/project && claude' Enter")
PR Review Pattern
# Pipe diff
terminal(command="cd ~/project && git diff main...feature | claude -p 'Review this diff for bugs, security, and style issues' --max-turns 1", timeout=60)
# OpenCode built-in
terminal(command="opencode pr 42", workdir="~/project", pty=true)
Parallel Batch Work
# Create isolated worktrees
terminal(command="git worktree add -b fix/issue-1 /tmp/issue-1 main", workdir="~/project")
terminal(command="git worktree add -b fix/issue-2 /tmp/issue-2 main", workdir="~/project")
# Launch agents in parallel
terminal(command="claude -p 'Fix issue #1' --allowedTools 'Read,Edit,Bash' --max-turns 10", workdir="/tmp/issue-1", background=true, notify_on_complete=true)
terminal(command="claude -p 'Fix issue #2' --allowedTools 'Read,Edit,Bash' --max-turns 10", workdir="/tmp/issue-2", background=true, notify_on_complete=true)
PTY and Background Rules
| Scenario | pty | background | Notes |
|---|---|---|---|
| One-shot via print/run/exec | No | No | Simplest; exits when done |
| Interactive TUI (all agents) | Yes | Yes | Required for TUI apps |
| Long-running task > 5 min | varies | Yes, +notify | So you can keep working |
Universal Pitfalls
- Git repo required: Codex and OpenCode refuse to run outside a git repo. For scratch work use
mktemp -d && git init. - Hermes safety filter may block long prompts (>~500 chars) or flags containing “dangerously” when passed through
terminal(). Workaround: write scripts directly withwrite_fileandterminalinstead. - Clean up background sessions: tmux sessions and background processes persist — kill them when done (
tmux kill-session,process kill). - Workdir isolation: never share one working directory across parallel agent sessions.
- Know the exit mechanism: Ctrl+C for OpenCode TUI,
/exitfor Claude Code interactive, natural exit for one-shot modes. - Monitor, don’t assume: use
process(action="poll")ortmux capture-paneto check progress before killing a session that may just be doing multi-step work.
Verification
# Check agent is installed
which claude && claude --version
which codex && codex --version
which opencode && opencode --version
# Auth checks
claude auth status --text
opencode auth list
Absorbed: Dispatcher Pattern
references/dispatcher-pattern.md — Hermes dispatcher pattern: stay responsive to the user while delegating everything to parallel sub-agents, notify on completion. Previously a standalone skill (dispatcher). Use this reference when implementing the responsive-delegation workflow.