Aller au contenu
Hermès Skills
← Retour au catalogue

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:

AgentCLIProviderBest For
Claude CodeclaudeAnthropicComplex multi-step work, structured JSON output, team orchestration
CodexcodexOpenAIFast feature builds, parallel issue fixing
OpenCodeopencodeProvider-agnosticOpen-source flexibility, provider choice
Antigravity CLIagyGoogle GeminiPlugin-based coding agents, sandbox, TUI sessions
Claude Cowork Desktopclaude-desktopAnthropicGUI 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 diff to 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-turns and --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

ScenarioptybackgroundNotes
One-shot via print/run/execNoNoSimplest; exits when done
Interactive TUI (all agents)YesYesRequired for TUI apps
Long-running task > 5 minvariesYes, +notifySo you can keep working

Universal Pitfalls

  1. Git repo required: Codex and OpenCode refuse to run outside a git repo. For scratch work use mktemp -d && git init.
  2. Hermes safety filter may block long prompts (>~500 chars) or flags containing “dangerously” when passed through terminal(). Workaround: write scripts directly with write_file and terminal instead.
  3. Clean up background sessions: tmux sessions and background processes persist — kill them when done (tmux kill-session, process kill).
  4. Workdir isolation: never share one working directory across parallel agent sessions.
  5. Know the exit mechanism: Ctrl+C for OpenCode TUI, /exit for Claude Code interactive, natural exit for one-shot modes.
  6. Monitor, don’t assume: use process(action="poll") or tmux capture-pane to 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.