Files

3.2 KiB

name, description, version, author, license, platforms, metadata
name description version author license platforms metadata
ai-coding-agents Delegate coding to external AI CLI agents (Claude Code, Codex, OpenCode). Shared orchestration patterns, tool selection, PTY handling. 1.0.0 Hermes Agent MIT
linux
macos
windows
hermes
tags related_skills
Coding-Agent
Claude
Codex
OpenAI
OpenCode
Autonomous
PTY
Delegation
hermes-agent

AI Coding Agents — Orchestration Guide

Delegate coding tasks to external autonomous coding agent CLIs via the Hermes terminal. All three tools follow the same orchestration patterns; pick based on what's installed and the user's preference.

Tool Selection

Tool Provider Install Best For
Claude Code Anthropic npm install -g @anthropic-ai/claude-code Complex multi-file refactoring, deep reasoning, MCP integration
Codex OpenAI npm install -g @openai/codex Fast feature implementation, batch issue fixing
OpenCode Multi-provider npm i -g opencode-ai@latest Provider-agnostic work, cost optimization

Shared Orchestration Patterns

One-Shot (Preferred for most tasks)

All three tools support non-interactive one-shot execution — the cleanest integration:

# Claude Code
claude -p 'Add error handling to all API calls in src/' --allowedTools 'Read,Edit' --max-turns 10

# Codex
codex exec 'Add dark mode toggle to settings'

# OpenCode
opencode run 'Add retry logic to API calls and update tests'

Interactive / Background (Multi-turn sessions)

For iterative work, run in background with PTY:

# All tools require pty=true for interactive mode
terminal(command="<tool> ...", workdir="~/project", background=true, pty=true)
# Monitor with process(action="poll"|"log")
# Send input with process(action="submit", data="...")

PR Review

# Claude Code
claude -p 'Review this PR thoroughly' --from-pr 42 --max-turns 10

# Codex
codex exec 'Review PR #42. git diff origin/main...origin/pr/42'

# OpenCode
opencode pr 42

Parallel Tasks

All three support running multiple instances in separate workdirs/worktrees:

terminal(command="<tool> 'Fix issue #78'", workdir="/tmp/issue-78", background=true, pty=true)
terminal(command="<tool> 'Fix issue #99'", workdir="/tmp/issue-99", background=true, pty=true)

Critical Rules

  1. Always use workdir — scope the agent to the right project
  2. Set turn limits for one-shot mode (prevents runaway loops)
  3. Use pty=true for interactive sessions — all three are TUI apps
  4. Monitor progress with process(action="poll"|"log") — don't kill slow sessions
  5. Git repo required — all three need a git directory. Use mktemp -d && git init for scratch work
  6. Clean up background sessions when done

Tool-Specific References

Detailed CLI flags, session management, and advanced features for each tool:

  • references/claude-code.md — Claude Code: print mode deep dive, tmux orchestration, hooks, MCP, subagents, settings hierarchy
  • references/codex.md — Codex: exec flags, full-auto vs yolo, worktree patterns, auth (OAuth vs API key)
  • references/opencode.md — OpenCode: run vs interactive TUI, session resumption, provider selection, PR review