2026-01-02 12:59:47 +01:00
---
summary: "Doctor command: health checks, config migrations, and repair steps"
read_when:
- Adding or modifying doctor migrations
- Introducing breaking config changes
---
# Doctor
2026-01-04 14:32:47 +00:00
`clawdbot doctor` is the repair + migration tool for Clawdbot. It runs a quick health check, audits skills, and can migrate deprecated config entries to the new schema.
2026-01-02 12:59:47 +01:00
## What it does
- Runs a health check and offers to restart the gateway if it looks unhealthy.
- Prints a skills status summary (eligible/missing/blocked).
- Detects deprecated config keys and offers to migrate them.
2026-01-04 16:02:28 +00:00
- Migrates legacy `~/.clawdis/clawdis.json` when no Clawdbot config exists.
- Checks sandbox Docker images when sandboxing is enabled (offers to build or switch to legacy names).
2026-01-04 15:39:33 +00:00
- Detects legacy Clawdis services (launchd/systemd/schtasks) and offers to migrate them.
2026-01-05 18:38:30 +01:00
- On Linux, checks if systemd user lingering is enabled and can enable it (required to keep the Gateway alive after logout).
2026-01-06 18:25:52 +00:00
- Migrates legacy on-disk state layouts (sessions, agentDir, provider auth dirs) into the current per-agent/per-account structure.
2026-01-02 12:59:47 +01:00
2026-01-04 16:02:28 +00:00
## Legacy config file migration
If `~/.clawdis/clawdis.json` exists and `~/.clawdbot/clawdbot.json` does not, doctor will migrate the file and normalize old paths/image names.
2026-01-02 12:59:47 +01:00
## Legacy config migrations
2026-01-04 14:32:47 +00:00
When the config contains deprecated keys, other commands will refuse to run and ask you to run `clawdbot doctor` .
2026-01-02 12:59:47 +01:00
Doctor will:
- Explain which legacy keys were found.
- Show the migration it applied.
2026-01-04 14:32:47 +00:00
- Rewrite `~/.clawdbot/clawdbot.json` with the updated schema.
2026-01-02 12:59:47 +01:00
2026-01-06 00:56:29 +00:00
The Gateway also auto-runs doctor migrations on startup when it detects a legacy
config format, so stale configs are repaired without manual intervention.
2026-01-02 12:59:47 +01:00
Current migrations:
- `routing.allowFrom` → `whatsapp.allowFrom`
2026-01-06 00:56:29 +00:00
- `agent.model` /`allowedModels` /`modelAliases` /`modelFallbacks` /`imageModelFallbacks`
→ `agent.models` + `agent.model.primary/fallbacks` + `agent.imageModel.primary/fallbacks`
2026-01-02 12:59:47 +01:00
2026-01-06 18:25:52 +00:00
## Legacy state migrations (disk layout)
Doctor can migrate older on-disk layouts into the current structure:
- Sessions store + transcripts:
- from `~/.clawdbot/sessions/` to `~/.clawdbot/agents/<agentId>/sessions/`
- Agent dir:
- from `~/.clawdbot/agent/` to `~/.clawdbot/agents/<agentId>/agent/`
- WhatsApp auth state (Baileys):
- from legacy `~/.clawdbot/credentials/*.json` (except `oauth.json` )
- to `~/.clawdbot/credentials/whatsapp/<accountId>/...` (default account id: `default` )
These migrations are best-effort and idempotent; doctor will emit warnings when it leaves any legacy folders behind as backups.
2026-01-02 12:59:47 +01:00
## Usage
```bash
2026-01-04 14:32:47 +00:00
clawdbot doctor
2026-01-02 12:59:47 +01:00
```
If you want to review changes before writing, open the config file first:
```bash
2026-01-04 14:32:47 +00:00
cat ~/.clawdbot/clawdbot.json
2026-01-02 12:59:47 +01:00
```
2026-01-04 15:39:33 +00:00
## Legacy service migrations
Doctor checks for older Clawdis gateway services (launchd/systemd/schtasks).
If found, it offers to remove them and install the Clawdbot service using the current gateway port.
Remote mode skips the install step, and Nix mode only reports what it finds.