Desktop agent protocol
On this page
Dokwe pushes real-time notifications to any WebSocket client that
authenticates as a workspace. The intended consumer is the
dokwe-desktop-agent binary running on an operator's laptop — it
receives new-error / regression events and shells out to claude -p ...
so the local Claude Code / Max subscription handles investigation +
fixing.
The protocol is thin and public: anything that can speak WebSocket +
Bearer auth (a Cursor plugin, a bash script wrapping websocat, a
Neovim job) can subscribe.
Just want to install the packaged daemon? See the
Desktop Agent Daemon README
(also rendered at /docs/desktop-agent-daemon on your Dokwe instance)
— this doc covers only the wire protocol.
1. Endpoint & auth#
wss://<your-dokwe-host>/api/desktop-agentFor the hosted version: wss://dokwe.com/api/desktop-agent.
Auth is the same workspace-scoped dkm_ token used by the MCP
integration (mint in Dashboard → Errors tab → MCP tokens). Send as a
Bearer header on the Upgrade request:
Authorization: Bearer dkm_abcd1234...Rejection codes:
| Close code | Meaning |
|---|---|
4401 | Missing / invalid / revoked token. |
One token → many sockets is fine. Every socket for a workspace receives every relevant event.
2. Frame format#
Every frame is a UTF-8 JSON object with two top-level fields:
{ "type": "<event-name>", "payload": { ... } }The first frame after a successful handshake is always:
{ "type": "hello", "payload": { "serverTime": "2026-08-16T…Z", "version": "0.1.0" } }Use it to synchronise your clock offset if needed. Subsequent frames are events.
3. Events#
error.new#
Fired only when a fingerprint is seen for the first time on a
project. Recurrences of an already-existing fingerprint do NOT emit
this event — they show up in the existing group's count on the
dashboard, and (if the issue was resolved) trigger error.regressed
instead.
{
"type": "error.new",
"payload": {
"projectId": "6908abda-…",
"projectSlug": "staffnet-api",
"fingerprint": "95756def…",
"message": "TypeError: cannot read x of undefined",
"level": "error",
"platform": "nodejs",
"environment": "production",
"release": "v1.4.7",
"occurredAt": "2026-08-16T09:22:47Z",
"receivedAt": "2026-08-16T09:22:48Z"
}
}error.regressed#
Fired when a new event lands for a fingerprint whose issue was previously resolved (i.e. the fix stopped working). Carries the deploy that was live at the moment of regression — useful for the daemon's Claude prompt to point at the likely-broken commit.
{
"type": "error.regressed",
"payload": {
"projectId": "6908abda-…",
"projectSlug": "staffnet-api",
"fingerprint": "95756def…",
"recurredAt": "2026-08-16T09:22:48Z",
"regressionCommitSha": "c3f2a91…",
"resolvedAt": "2026-08-14T18:00:00Z"
}
}4. Example: raw websocat subscriber#
Confirms the endpoint is reachable and events flow — no daemon required.
websocat 'wss://dokwe.com/api/desktop-agent' \
--header "Authorization: Bearer dkm_abcd1234..." \
--ping-interval 30Every event appears as one line of JSON on stdout. Great for smoke-testing before running the real daemon.
Same shape works from a shell script:
websocat -tE 'wss://dokwe.com/api/desktop-agent' \
--header "Authorization: Bearer $DOKWE_MCP_TOKEN" \
| while read line; do
case "$(echo "$line" | jq -r .type)" in
error.new)
fp=$(echo "$line" | jq -r .payload.fingerprint)
slug=$(echo "$line" | jq -r .payload.projectSlug)
claude -p "Investigate new error $fp on $slug via the dokwe MCP tools. Fix + PR if straightforward."
;;
esac
doneThat's essentially what the packaged Go daemon does, minus config, rate limiting, dedup, and reconnect handling.
5. Filtering rules the server applies#
The server currently emits every error.new and error.regressed
for the workspace — no environment filter, no severity filter, no
rate limit. Client-side filtering is expected because different
consumers want different signal:noise ratios.
Planned server-side knobs (not yet built): per-token filter config (environments, min level) so the wire is quieter for expensive consumers.
6. Reconnection behaviour#
The gateway does not buffer events for a disconnected client. If your socket drops, events fired during the outage are lost. On reconnect, the daemon should:
- Reconnect with exponential backoff (starting ~2s, capped ~60s).
- Call the MCP
list_errorstool withsinceHours: 1(or however long the outage lasted) to catch up on missed events.
The packaged daemon does both. A hand-rolled subscriber should implement at least step 1.