Skip to content

Unix Socket API

The daemon exposes a Unix socket API at /tmp/agentwatch.sock for local queries.

Connection

echo "command" | nc -U /tmp/agentwatch.sock

Commands

Legacy Commands

Command Arguments Description
status - Get all sessions with full state
session Get specific session state
sessions - List session IDs

REST-Style Commands

Command Description
GET /sessions List all sessions with full state
GET /sessions/<id> Get specific session state
GET /sessions/<id>/parse ?verbose=true Get parsed session output
GET /sessions/<id>/capture Get raw terminal content
GET /health Health check

Response Format

All responses are JSON with the following structure:

{
  "success": true,
  "data": { ... }
}

Or on error:

{
  "success": false,
  "error": "error message"
}

Examples

Get All Sessions

$ echo "status" | nc -U /tmp/agentwatch.sock
{
  "success": true,
  "data": {
    "sessions": {
      "$0": {
        "session": { "name": "coding-0", "id": "$0" },
        "current": { "program": "Claude Code", "state": "Working" },
        ...
      }
    },
    "session_count": 1
  }
}

Get Specific Session

$ echo "session \$0" | nc -U /tmp/agentwatch.sock

REST-Style Query

$ echo "GET /sessions" | nc -U /tmp/agentwatch.sock