Desktop agent daemon
On this page
A tiny daemon that runs on your laptop. Subscribes to your Dokwe
workspace's error stream and, when new errors fire, invokes claude -p
in the appropriate local repo so your Claude Code / Max
subscription investigates and (optionally) opens a PR — no Anthropic
API bill, no dokwe-side sandbox.
1. Prerequisites#
- macOS ≥ 12 or Linux with
systemd --user(Ubuntu 22.04+, Fedora, etc.) - Claude Code installed and logged in (
claude --versionworks,clauderuns interactively). The daemon shells out to your localclaudebinary using your Max / Pro subscription — it's not an API integration. giton$PATH. Used to check for a dirty working tree before touching a project.- A Dokwe MCP token (
dkm_…) minted at Dashboard → Errors tab → MCP tokens. Same token used forclaude mcp add dokwe …— the daemon reuses it.
2. Install#
One-liner (published binaries — needs the deploy CI merged):
curl -fsSL https://dokwe.com/install/desktop-agent | shBuild from a local checkout of the monorepo:
git clone git@github.com:FregateLab/zeroDeploy.git
cd zeroDeploy/apps/dokwe-desktop-agent
./install/install.sh --build-from-sourceThe dokwe repo is private, so a piped install can't git clone it —
if you need to build from source, you clone locally first and run
the install script from your checkout. --build-from-source needs Go
on your machine.
The install script:
- Downloads (or builds) the binary →
/usr/local/bin/dokwe-desktop-agent - On macOS: installs
~/Library/LaunchAgents/com.dokwe.desktop-agent.plist, loads withlaunchctl - On Linux: installs
~/.config/systemd/user/dokwe-desktop-agent.service, enables withsystemctl --user - Stubs out
~/.config/dokwe-desktop-agent/config.yaml(chmod 600) if missing - Starts the service
After that, edit the config and restart:
$EDITOR ~/.config/dokwe-desktop-agent/config.yaml
# macOS:
launchctl unload ~/Library/LaunchAgents/com.dokwe.desktop-agent.plist
launchctl load ~/Library/LaunchAgents/com.dokwe.desktop-agent.plist
# Linux:
systemctl --user restart dokwe-desktop-agent3. Config#
Two ways to manage the config — pick whichever fits.
3a. CLI subcommands (recommended)#
Set up + iterate without ever opening the yaml file:
# First-run interactive setup
dokwe-desktop-agent init
# Or piecewise
dokwe-desktop-agent auth dkm_... # set token
dokwe-desktop-agent link staffnet-saas /Users/you/code/staffnet
dokwe-desktop-agent link my-app /Users/you/code/my-app
dokwe-desktop-agent set dry_run false # flip a bool
dokwe-desktop-agent set rate_limit_per_hour 20
# Check what's configured + service state
dokwe-desktop-agent list
dokwe-desktop-agent status
dokwe-desktop-agent logs -f
# Remove a mapping
dokwe-desktop-agent unlink my-appEvery mutating subcommand auto-restarts the service so the change takes
effect immediately. Pass --no-restart if you're batching several
edits and want to restart once at the end.
Full command reference: dokwe-desktop-agent help.
3b. Edit the yaml directly#
If you prefer text editing, the config lives at
~/.config/dokwe-desktop-agent/config.yaml with this shape:
endpoint: "https://dokwe.com"
token: "dkm_..."
projects:
staffnet-saas: "/Users/you/code/staffnet"
my-app: "/Users/you/code/my-app"
dry_run: true # v1 default — flip after you trust it
rate_limit_per_hour: 10 # hard cap on real claude invocations
dedup_window_min: 60 # don't re-invoke on same fingerprint within N min
filters:
environments: [production]
levels: [error, fatal]After hand-editing, run dokwe-desktop-agent restart (or the OS
service command below) to load the changes. See config.example.yaml
for the annotated version.
Note: CLI writes overwrite the file via yaml.Marshal, which
drops hand-added comments. If you rely on comments, prefer 3b
throughout; if you rely on convenience, prefer 3a.
4. Safety switches#
The daemon is opinionated about not surprising you:
| Switch | Default | What it does |
|---|---|---|
dry_run | true | Logs "would invoke claude" and stops. First-run safety. |
rate_limit_per_hour | 10 | Hard cap on real invocations per rolling hour, across all projects. |
dedup_window_min | 60 | Don't re-invoke on the same fingerprint within N minutes. Regression storms → 1 claude session, not 50. |
| dirty-tree skip | always on | Never invoke on a project whose working tree has uncommitted changes. Stash or commit to unblock. |
filters.environments | — | Only events matching (default: no filter — but the config stub sets [production]). |
filters.levels | — | Only events matching (default: no filter). |
Claude is invoked with a prompt that instructs it to ack_issue on
success but NOT to resolve_issue — resolution happens when the PR
merges, manually. The daemon never marks issues resolved.
5. How events flow to Claude#
An error is ingested at Dokwe (
POST /api/ingest/errors/:id).If it's the first-ever event for that fingerprint on that project, dokwe emits
error.event.newon its event bus.The
DesktopAgentGatewayfans it out to every connected desktop agent for the workspace.Your daemon receives the frame, runs filters + rate limit + dedup + dirty-tree check, resolves
projectSlug → localPath, then:codecd <localPath> && claude -p "<prompt>"Claude uses the dokwe MCP tools you already set up (
claude mcp add dokwe …) to fetch full error details, reads local source, proposes a fix, runs tests, commits ondokwe/<fingerprint-prefix>, opens a PR againstorigin/main.Claude calls
dokwe.ack_issueso the dashboard shows someone is on it.
Regressions (error.regressed) follow the same flow with a slightly
different prompt template noting the prior resolve + the deploy that
likely broke it.
6. Logs#
macOS:
tail -f ~/Library/Logs/dokwe-desktop-agent/agent.err.logLinux:
journalctl --user -u dokwe-desktop-agent -fEvery skip decision is logged:
[error.new] skip fp=95756def slug=staffnet-saas reason=dirty-tree at /Users/you/code/staffnet
[error.new] skip fp=95756def slug=my-app reason=dedup (within 60m)
[error.new] skip fp=95756def slug=unknown reason=no-local-clone (add to config.projects to enable)
[error.new] skip fp=95756def slug=staffnet-saas reason=rate-limit (10/hr cap)
[error.new] skip fp=95756def slug=staffnet-saas reason=filter env="staging" level="warning"And every real (or dry-run) invocation:
[error.new] DRY-RUN fp=95756def slug=staffnet-saas path=/Users/you/code/staffnet cmd="claude -p '...'"
[error.new] INVOKE fp=95756def slug=staffnet-saas path=/Users/you/code/staffnet
[error.new] INVOKE DONE fp=95756def slug=staffnet-saas7. Uninstall#
curl -fsSL https://dokwe.com/install/desktop-agent | sh -s -- --uninstallRemoves the binary and the OS service unit. Leaves ~/.config/dokwe- desktop-agent/config.yaml in place in case you want it back — delete
manually if you don't.
8. Troubleshooting#
Daemon connects then drops after ~5 minutes. Fixed in the current API version (server sends WS pings every 30s). If still happening, your dokwe API is older than the pings PR — deploy main.
websocat-style smoke test works but daemon doesn't invoke claude. Almost always one of:
dry_run: truestill set → daemon logsDRY-RUN, doesn't spawn.- Project slug not in
config.projects→ daemon logsskip … reason=no-local-clone. - Local repo has uncommitted changes → daemon logs
skip … reason=dirty-tree. - Rate limit hit → daemon logs
skip … reason=rate-limit.
Grep for skip fp= in the log — every skip decision names its reason.
claude not found.
Either put claude on $PATH for the service's environment, or set an
absolute path in config:
claude_command: "/opt/homebrew/bin/claude"Restart takes forever after edit. Not a bug — the reconnect loop uses exponential backoff. New config takes effect on the next connect attempt (up to 60s).