Back to Daemon Bootstrap

Daemon Protocol v1.0

Authoritative WebSocket spec for the Autonoma local daemon. Every official IDE extension (VS Code, JetBrains, Neovim, Emacs, Sublime) conforms to this protocol — third-party clients should too.

The daemon is the only component that talks to the remote orchestrator. Extensions never hold API credentials or call orchestrator endpoints directly. All authentication, retry, and routing happens inside the daemon.

Transport

  • URL: ws://localhost:{port}/ws — default port 9876, configurable per extension
  • Encoding: JSON, UTF-8, one message per WebSocket frame
  • Connect timeout: 5 seconds
  • Request timeout: 30 seconds per request
  • Authentication: none — daemon binds to 127.0.0.1 only

Message envelopes

Request (extension → daemon)

{
  "id": "req_<monotonic_counter>",
  "method": "<namespace.action>",
  "params": { ... }
}

Response (daemon → extension)

{
  "id": "req_<matching_id>",
  "result": <any>,
  "error": "<error_message>"  // present ONLY on failure; mutually exclusive with result
}

Event (daemon → extension, unsolicited)

{
  "type": "<event_name>",
  "data": { ... }
}

Events have no id. Subscribe by event name.

Methods

agents.list

List available agents.

Params
{}
Result
Agent[]

interface Agent {
  id: string;
  name: string;
  description: string;
  status: "available" | "busy" | "offline";
}

agents.invoke

Invoke an agent with a task. Returns an executionId you can subscribe to via execution.status and the phase.update event.

Params
{
  agentType: string;
  task: string;
  context?: any;
}
Result
{ executionId: string }

execution.status

Get RIGOR execution status. Includes phases array (5 phases: research, inspect, generate, optimize, review) and any artifacts produced.

Params
{ executionId: string }
Result
interface ExecutionResult {
  executionId: string;
  status: "success" | "failure";
  phases: RigorPhase[];
  artifacts: Artifact[];
  error?: string;
}

interface RigorPhase {
  name: "research" | "inspect" | "generate" | "optimize" | "review";
  status: "pending" | "running" | "completed" | "failed";
  progress: number;   // 0-100
  duration?: number;  // milliseconds
}

interface Artifact {
  id: string;
  type: string;
  path: string;
  content: string;
  language: string;
}

background.list

List all background tasks the daemon is tracking.

Params
{}
Result
BackgroundTask[]

interface BackgroundTask {
  id: string;
  task: string;
  agentType: string;
  status: "queued" | "running" | "completed" | "failed" | "cancelled";
  progress: number;
  startedAt: string;       // ISO-8601
  completedAt?: string;
  errorMsg?: string;
}

background.launch

Launch a long-running background task. Returns immediately with a taskId; subscribe to task.update events for progress.

Params
{ task: string; agentType: string }
Result
{ taskId: string }

background.cancel

Cancel a running background task.

Params
{ taskId: string }
Result
null

background.output

Get accumulated raw log output for a background task.

Params
{ taskId: string }
Result
string

artifacts.preview

Preview what applying a set of artifacts would do — returns a per-file action and unified diff. Always call before artifacts.apply for user review.

Params
{ artifacts: Artifact[] }
Result
{
  files: Array<{
    path: string;
    action: "create" | "modify" | "skip";
    diff?: string;  // unified diff format
  }>;
}

artifacts.apply

Apply artifacts to the workspace. Returns counts and any per-file errors.

Params
{ artifacts: Artifact[] }
Result
{
  applied: number;
  skipped: number;
  errors: string[];
}

code.explain

Explain a code selection in plain English. Returns a markdown string.

Params
{ code: string; language: string; filePath: string }
Result
string  // markdown

code.refactor

Refactor code with optional natural-language instructions. Returns artifacts you can preview/apply.

Params
{
  code: string;
  language: string;
  filePath: string;
  instructions?: string;
}
Result
Artifact[]

code.generateTests

Generate tests for a code selection. Returns artifacts (typically one test file per source file).

Params
{ code: string; language: string; filePath: string }
Result
Artifact[]

code.review

Review code for issues. The reviewType narrows what the reviewer looks for.

Params
{
  code: string;
  language: string;
  filePath: string;
  reviewType: "security" | "performance" | "quality" | "all";
}
Result
{
  issues: Array<{
    severity: "error" | "warning" | "info";
    message: string;
    line?: number;
    suggestion?: string;
  }>;
  summary: string;
}

workflows.list

List available workflow templates across all domains. Optional domain filter narrows the result.

Params
{}  // or { domain?: string }
Result
Array<{
  id: string;          // "sales:lead_to_close"
  name: string;
  domain: string;
  description: string;
  pattern: string;     // "supervisor" | "group_chat_maker_checker" | ...
  stepCount: number;
  agents: string[];
}>

Events

connected

Emitted locally by the client when the WebSocket opens. No payload.

disconnected

Emitted locally when the WebSocket closes. No payload.

phase.update

RIGOR phase progress update.

{
  executionId: string;
  phase: "research" | "inspect" | "generate" | "optimize" | "review";
  status: "pending" | "running" | "completed" | "failed";
  progress: number;
}

task.update

Background task state change.

{
  taskId: string;
  status: "queued" | "running" | "completed" | "failed" | "cancelled";
  progress: number;
}

execution.complete

Execution finished — payload is the same shape as execution.status result.

ExecutionResult

Error handling

  • Connection refused: daemon not running — offer to launch a6s daemon via embedded terminal.
  • Connect timeout (5s): daemon unreachable — same as above.
  • Request timeout (30s): daemon hung — show error, allow retry.
  • error field in response: server-side error — surface the message to the user.
  • Invalid JSON frame: log and ignore. Do not crash the client.

Reconnection

Clients should implement auto-reconnect with exponential backoff: 1s → 2s → 4s → 8s → 16s, capped at 5 attempts. After 5 failures, stop and show the user a manual reconnect button.

Conformance

All official IDE extensions and any third-party client claiming Autonoma compatibility MUST:

  1. Implement every method listed above.
  2. Handle every event listed above (at minimum: log and no-op for unknown events).
  3. Respect the 5-second connect and 30-second request timeouts.
  4. Never bypass the daemon to call the orchestrator directly.
  5. Never persist API credentials in extension storage.