Skip to the content.

🇻🇳 Tiếng Việt

← Home · Installation · Architecture · First Agent · Google · Browser · Cron · Multi-Agent · Profiles · Models · Memory · Ops

Operational Playbook

Day-to-day monitoring, debugging, and maintenance.

Daily Checks

# 1. Gateway running?
openclaw status

# 2. Any errors?
tail -20 ~/.openclaw/logs/gateway.err.log

# 3. Cron jobs healthy?
cat ~/.openclaw/cron/jobs.json | python3 -c "
import sys,json
for j in json.load(sys.stdin)['jobs']:
    if not j.get('enabled'): continue
    s = j.get('state',{})
    err = s.get('consecutiveErrors',0)
    status = 'FAILING' if err > 0 else 'OK'
    print(f'{status:8s} {j[\"id\"]:30s} errors={err} last={s.get(\"lastRunStatus\",\"never\")}')"

Debugging Agent Behavior

Read Session Logs

# Find latest session
SESSION=$(ls -t ~/.openclaw/agents/personal/sessions/*.jsonl | head -1)

# View messages (user + assistant)
cat "$SESSION" | python3 -c "
import sys, json
for line in sys.stdin:
    obj = json.loads(line.strip())
    msg = obj.get('message', {})
    role = msg.get('role','')
    model = msg.get('model','')
    content = msg.get('content','')
    if role == 'assistant' and isinstance(content, list):
        texts = [c.get('text','')[:200] for c in content if c.get('type')=='text']
        tools = [c.get('name','') for c in content if c.get('type')=='toolCall']
        if texts: print(f'[{model}] {texts[0]}')
        if tools: print(f'[TOOLS] {tools}')
    elif role == 'user':
        txt = content[:100] if isinstance(content,str) else str(content)[:100]
        print(f'[USER] {txt}')
"

View Tool Call Results

cat "$SESSION" | python3 -c "
import sys, json
for line in sys.stdin:
    obj = json.loads(line.strip())
    msg = obj.get('message', {})
    if msg.get('role') == 'toolResult':
        name = msg.get('toolName','')
        content = msg.get('content',[])
        for c in (content if isinstance(content,list) else []):
            t = c.get('text','')[:300]
            if t: print(f'[{name}] {t}')
"

Common Errors & Fixes

Error Cause Fix
LLM request timed out Model/provider slow Add fallback models; increase timeoutSeconds
cron delivery target is missing Missing delivery.to Add numeric Telegram user ID
Unknown model Stale model cache openclaw gateway restart
No API key found Missing auth profile Create auth-profiles.json
function_response.name mismatch Gemini 3 Flash bug after many tool calls Switch to Gemini 2.0 Flash
Session hết hạn (Playwright) Browser cookies expired Re-run login command manually
No such file or directory (scripts) PATH not available in LaunchAgent Use absolute paths or uv tool install

Gateway Management

# Start
openclaw gateway start

# Restart (after config changes — REQUIRED)
eval "$(/opt/homebrew/bin/brew shellenv)" && openclaw gateway restart

# Check if old process stuck
ps aux | grep openclaw-gateway | grep -v grep

# Force kill + restart
kill -9 $(pgrep -f openclaw-gateway)
openclaw gateway start

# Run diagnostics
openclaw doctor
openclaw doctor --fix  # Remove invalid config keys

Backup Strategy

Create a backup script that:

  1. Redacts secrets from openclaw.json using jq
  2. Copies workspace files (excluding sessions, browser data)
  3. Uses rsync (not cp -r — which copies hidden credential files)
# Redact secrets from config
jq 'walk(if type == "object" then
  with_entries(select(.key | test("apiKey|botToken|password|KEY|TOKEN|SECRET") | not))
else . end)' ~/.openclaw/openclaw.json > backup/openclaw.json

# Rsync workspaces (exclude sensitive data)
rsync -av --exclude='sessions/' --exclude='memory/' \
  --exclude='*.jsonl' --exclude='.browser-data/' \
  --exclude='credentials*' --exclude='token*' \
  ~/.openclaw/workspace-personal/ backup/workspace-personal/

Session Cleanup

Old sessions accumulate. Auto-cleanup via cron:

{
  "id": "session-cleanup",
  "agentId": "personal",
  "schedule": { "kind": "cron", "expr": "0 3 * * *" },
  "payload": {
    "message": "Run: ~/.openclaw/common-scripts/session-mgmt/cleanup-sessions.sh personal 4"
  }
}

Keeps only the 4 most recent sessions per agent.

Security Checklist

Performance Tips