DureClaw API Reference

April 6, 2026 · View on GitHub

For contributors and advanced integrations.


MCP Tools

Register MCP with: bash <(curl -fsSL https://dureclaw.baryon.ai/mcp)

ToolDescription
mcp__oah__get_presenceList online agents
mcp__oah__send_taskSend a task to an agent
mcp__oah__receive_taskWait for incoming task (30s timeout)
mcp__oah__complete_taskReport task completion
mcp__oah__read_stateRead Work Key state
mcp__oah__write_stateUpdate Work Key state
mcp__oah__read_mailboxRead mailbox messages
mcp__oah__post_messageSend a mailbox message

Usage in Claude Code

mcp__oah__get_presence → online agents + roles
mcp__oah__send_task task_id=t1 role=builder instructions="[SHELL] make build"
mcp__oah__read_state → work key progress

REST API

Base URL: http://SERVER_IP:4000

Health & Presence

MethodEndpointDescription
GET/api/healthServer status + work key count
GET/api/presenceConnected agents (all work keys)
GET/api/capabilitiesAgent capability matrix

Work Keys

MethodEndpointDescription
GET/api/work-keysList all work keys
GET/api/work-keys/latestMost recent work key (404 if none)
POST/api/work-keysCreate new work key

State

MethodEndpointDescription
GET/api/state/:wkRead work key state
PATCH/api/state/:wkUpdate work key state
GET/api/team/:wkTeam configuration

Tasks

MethodEndpointDescription
POST/api/taskDispatch task (Phoenix broadcast + mailbox)
GET/api/task/:idPoll task result
POST/api/task/:id/resultSubmit task result
POST/api/task/:id/cancelCancel in-flight task

POST /api/task body:

{
  "work_key": "LN-20260406-001",
  "role": "builder",
  "to": "builder@mac-mini",
  "instructions": "[SHELL] make build",
  "depends_on": []
}

Mailbox (offline queue)

MethodEndpointDescription
GET/api/mailbox/:agentRead queued messages
POST/api/mailbox/:agentEnqueue message

Phoenix Channel Protocol

WebSocket: ws://host:4000/socket/websocket?vsn=2.0.0 Topic: work:{WORK_KEY}

5-tuple format: [join_ref, ref, topic, event, payload]

EventDirectionDescription
phx_joinclient → serverRegister agent with presence payload
phx_replyserver → clientJoin acknowledgement
heartbeatclient → serverKeepalive every 30s (topic: phoenix)
task.assignserver → clientTask dispatched to agent
task.resultclient → serverTask completion report
task.cancelserver → clientCancel running task
task.progressclient → serverStreaming progress update
mailbox.deliveredserver → clientQueued messages delivered on join

phx_join payload:

{
  "agent_name": "builder@mac-mini",
  "role": "builder",
  "machine": "mac-mini",
  "capabilities": ["claude", "opencode", "shell"]
}

task.result payload:

{
  "task_id": "http-123",
  "to": "http@controller",
  "from": "builder@mac-mini",
  "role": "builder",
  "status": "done",
  "output": "...",
  "exit_code": 0
}

Task Instruction Prefixes

PrefixHandled byDescription
[SHELL] <cmd>All agentsRun shell command directly, no LLM
[ORCHESTRATE] <goal>Orchestrator agentAI decomposes goal + dispatches subtasks
[ANALYZE_PIPELINE] ...Orchestrator onlyPhase 1/2 analysis pipeline
(none)All agentsAI backend (claude / opencode / aider)