$ show openclaw/acpx
acpx is a headless CLI client and runtime for the Agent Client Protocol (ACP), enabling orchestration of AI agent sessions with persistent state, multi-step flow execution, permission policies, and a replay viewer for auditing. The architecture combines a CLI entry point, an embeddable runtime (AcpRuntime), a queue-based IPC system for shared session access, and a separate React-based replay viewer for inspecting flow run bundles. It supports 20+ built-in agents (Claude, Gemini, Cursor, etc.) via ACP, manages session persistence as JSON files with event logs, and provides output formatting in text, JSON, or quiet modes. The codebase is predominantly TypeScript with extensive test coverage (85%+), conformance testing against the ACP specification, and platform-specific process management for Windows and POSIX systems.
The LLM identified 5 files worth highlighting for reuse:
Cross-platform descendant process tracker that captures and signals process trees using birth identity verification (Linux /proc, Windows creation timestamps, POSIX lstart). Isolates process group cleanup logic from the rest of the runtime, making it reusable for any application needing reliable child process lifecycle management.
Generic DAG executor (FlowRunner) that runs flow definitions composed of acp, compute, action, shell, and checkpoint nodes. Supports timeout, heartbeat, cancellation, session binding, and node-level error handling. The node type system and edge routing are decoupled from specific agent logic, enabling reuse in any multi-step workflow engine.
Append-only event log writer and reader with segment rotation, cursor-based replay, and corruption detection. Used for session journaling but designed as a standalone component that could be extracted for any application requiring durable, sequential event storage with bounded file sizes.
Pure function reducer that transforms ACP session updates (text deltas, tool calls, usage, mode changes) into a normalized conversation model. Handles all ACP update types with deep cloning and safe property access, making it reusable for any system that needs to maintain a lossless, bounded conversation state from a stream of events.
Permission resolution pipeline that supports three modes (approve-all, approve-reads, deny-all), rule-based policy matching with auto-approve/deny/escalate, and fallback to interactive prompts. The modeβpolicyβescalationβprompt chain is cleanly separated, allowing reuse in any CLI or daemon that needs configurable access control for tool calls.