Repository navigation
Open
Labels
enhancementNew feature or request
Description
Summary
Orca already implements a de-facto 3-layer protocol for agent-orchestrator communication. This issue proposes extracting and documenting it as a universal standard that any orchestrator or agent can adopt.
Current State
Orca has 3 protocol layers already working across 30+ agent integrations:
- Layer 1 (Transport): HTTP POST to
127.0.0.1:{port}with token auth, stdin bridge, endpoint file - Layer 2 (Status): Normalized
AgentStatusPayloadwith 4 states (working/blocked/waiting/done), 9 event types, tool tracking - Layer 3 (Orchestration): Task DAG, CLI message protocol (8 message types), Coordinator polling, group addressing
Proposal
Layer 1: Transport Protocol
Standardize the HTTP POST + Token + Stdin Bridge pattern:
| Element | Orca Current | Proposed Standard |
|---|---|---|
| Transport | HTTP POST to 127.0.0.1:{port} |
✅ Adopt directly |
| Auth | X-Orca-Agent-Hook-Token (UUID) |
→ X-Agent-Orchestrator-Token |
| Response | Always 204 No Content (fail-open) |
✅ Critical design — hooks must not block agents |
| Routing | /hook/{agentType} |
→ /agent-event/{agentType} |
| Stdin Bridge | Agent → stdin → Script → HTTP POST | ✅ Core pattern — any CLI agent works without modification |
| Endpoint File | endpoint.env (restart recovery) |
✅ Optional extension |
| Env Vars | ORCA_AGENT_HOOK_PORT/TOKEN/PANE_KEY/... |
→ AO_PORT/AO_TOKEN/AO_PANE_KEY/... (unified prefix) |
| Protocol Version | ORCA_HOOK_PROTOCOL_VERSION = 1 |
→ AO_PROTOCOL_VERSION |
Layer 2: Status Protocol
Standardize the normalized status schema and state machine:
type AgentStatusPayload = {
state: "working" | "blocked" | "waiting" | "done" // Required
prompt: string // Required (empty string = unknown)
agentType?: string // Agent type identifier
toolName?: string // Current tool name
toolInput?: string // Tool input preview
interactivePrompt?: string // Full interactive question JSON
lastAssistantMessage?: string // Latest assistant message
interrupted?: boolean // Was done triggered by interruption
subagents?: SubagentSnapshot[] // Sub-agent snapshots
}4-state semantics (the core of the standard):
| State | Semantics | Orchestrator Behavior |
|---|---|---|
working |
Agent executing task | Kanban → Working lane, heartbeat timer reset |
blocked |
Agent awaiting approval | Kanban → Attention lane, approval UI popup |
waiting |
Agent awaiting user input | Kanban → Attention lane, prompt user |
done |
Agent completed current turn | Kanban → Idle lane, re-dispatchable |
9 universal event types (extracted from 17 agents):
| Event | Semantics | State Mapping |
|---|---|---|
prompt_submit |
User submitted prompt | → working |
tool_start |
Tool call started | → working |
tool_end |
Tool call ended | → working |
tool_fail |
Tool call failed | → working |
permission_request |
Permission requested | → blocked |
session_stop |
Session ended | → done |
session_fail |
Session ended abnormally | → done |
subagent_start |
Sub-agent started | (sub-roster update) |
subagent_stop |
Sub-agent stopped | (sub-roster update) |
Layer 3: Orchestration Protocol
Standardize the task DAG + message protocol:
- Task model:
id, spec, status, deps, parent_id - State machine:
pending → ready → dispatched → completed/failed/blocked - 8 message types:
status, dispatch, worker_done, merge_ready, escalation, handoff, decision_gate, heartbeat - Group addressing:
@all, @idle, @worktree:id, @agentType - Circuit breaker: 3 failures →
circuit_broken - Heartbeat: 5min interval, 10min stale threshold
Standardization blockers (need abstraction):
- Preamble is Orca-specific — teaches
orca orchestration send/check/askcommands. Standard needs abstract orchestrator CLI interface. - Agent identity is Orca-specific —
ORCA_PANE_KEY. Standard needs abstract agent identity. - Decompose not implemented — AI-driven task decomposition is future work.
Deliverables
- Protocol spec document (Markdown) covering all 3 layers
- Reference implementation: standalone hook server that any orchestrator can embed
- Agent SDK: minimal library for agents to emit status events
- Migration guide: how to adapt existing Orca hooks to the standard
- Test suite: validate protocol compliance
Related Code
src/main/agent-hooks/server.ts— Hook server implementationsrc/shared/agent-hook-types.ts— Hook event typessrc/shared/agent-status-types.ts— Status state machinesrc/main/agent-hooks/hook-stdin-contract.ts— Stdin bridge protocolsrc/main/runtime/orchestration/— Orchestration protocolsrc/main/runtime/orchestration/db.ts— Task DAG schemasrc/main/runtime/orchestration/preamble.ts— Dispatch preamblesrc/main/runtime/orchestration/groups.ts— Group addressing
Priority
High — This is foundational work that enables ecosystem growth. Any agent that adopts the standard works with any orchestrator that implements it.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity
str0203 commentedon Aug 10, 2026
Firstmate is a concrete downstream consumer for this protocol work. Its current Orca backend still reconstructs supervision from raw worktree/terminal operations, while the tmux reference path relies on years of stable process/session semantics. A small, versioned Orca contract would let Firstmate adopt native orchestration incrementally.
Related downstream planning:
To make this adoptable without waiting for the full universal-standard effort, I suggest defining a minimal v1 consumer contract first:
Capability handshake
Stable identity
Cursor-based event stream
Delivery receipt semantics
writtenfrom promptsubmitted, agentaccepted, and first turnworkingLifecycle safety
A small conformance fixture would make this especially useful: create a worker, consume ordered events, restart/reconnect, re-resolve identity, deliver one idempotent follow-up, and release exactly once.
That narrower v1 would already unlock a high-quality Firstmate adapter and provide real downstream feedback for the broader universal protocol, while the naming/SDK/generalization work can continue independently.