ACPX Headless Agent Harness
The Headless Agent Harness (acpx) enables Hiroshi gateway events to orchestrate external interactive CLI agents (like Claude Code, Codex, or Aider) as background child processes.
Command Execution
Gateway users spawn subprocess sessions by utilizing the/acp spawn syntax:
Protocol Execution & Auto-Approval
- Subprocess Pipes: The harness spawns the target agent binary with stdin, stdout, and stderr fully captured using async Tokio process streams.
- Handshake Verification: It writes initial standard
initialize,session/new, andsession/promptJSON-RPC packets directly into the child process’s stdin. - Auto-Approval Middleware: When the sub-agent requests permission authorization (such as writing local files or executing bash scripts), the harness intercepts the
session/request_permissionnotification and writes back an auto-approved JSON-RPC confirmation. - ANSI Sanitization: It strips all ANSI color escape sequences from stdout before piping the stream outputs back to the chat transceiver.