Best Practices

Memory, compaction, multi-agent, cron, and security for running OpenClaw at home.

Answer a few questions on the home page to get setup suggestions tailored to your budget and goals.

Memory: file-based source of truth

Use a structured workspace so the agent persists context across sessions:

~/clawd/
├── MEMORY.md      # Durable facts, how you work
├── IDENTITY.md    # Agent personality
├── memory/
│   └── YYYY-MM-DD.md   # Daily logs
└── projects/

Enable compaction

Prevent context overflow in long-running sessions:

openclaw config set agent.compaction.enabled true
openclaw config set agent.compaction.threshold 50000

Multi-agent: per-task sessions

Don’t run one eternal session for everything. Use a long-lived coordinator for chat and spawn worker sessions per task. Crons and webhooks should run in isolated sessions that complete and exit.

Gateway bind for exec / nodes

If agent-run commands (e.g. openclaw cron list) time out with “gateway timeout,” the gateway may be bound only to localhost. Bind to LAN so exec and nodes can reach it:

openclaw config set gateway.bind lan
openclaw gateway restart

OAuth / API keys

If you see “OAuth token refresh failed” for Anthropic, re-auth or set a fresh API key: openclaw configure anthropic or openclaw auth anthropic, then restart the gateway.

Remote access

Prefer Tailscale or VPN to expose the gateway to your agent machines and clients. Alternative: SSH tunnel ssh -N -L 18789:127.0.0.1:18789 user@brain.

Multi-agent deep dive: getopenclaw.ai/help/multi-agent-architecture