Back to The Times of Claw

DenchClaw CLI: Everything You Can Do from the Terminal

Mark Rachapoom
Mark Rachapoom
·9 min read
DenchClaw CLI: Everything You Can Do from the Terminal

DenchClaw CLI: Everything You Can Do from the Terminal

If you're the kind of person who keeps a terminal open at all times, DenchClaw has you covered. The openclaw CLI is the primary way to manage your agent, gateway, sessions, and data — all without touching a browser. This guide covers every CLI command you'll actually use, plus shell scripts for automating the repetitive stuff.

Installation#

If you installed DenchClaw via npx denchclaw, the openclaw CLI is available globally. Verify:

openclaw --version
# openclaw/2.x.x darwin-arm64 node-v22.x.x

If you get "command not found", add the npm global bin to your PATH:

export PATH="$PATH:$(npm root -g)/../bin"

Gateway Management#

The gateway is the local server that runs your DenchClaw agent. It handles messaging integrations (Telegram, WhatsApp, Discord), API requests, and background processing.

Start, stop, restart, status#

# Start the gateway (runs in background)
openclaw gateway start
 
# Stop the gateway
openclaw gateway stop
 
# Restart (useful after config changes)
openclaw gateway restart
 
# Check status
openclaw gateway status

The status command shows whether the gateway is running, the port it's on, and connected integrations:

Gateway: running
Port: 3000
PID: 12345
Uptime: 2h 14m
Integrations: telegram ✓, discord ✓, whatsapp ✗

Logs#

# Tail the gateway log
openclaw gateway logs
 
# Show last 100 lines
openclaw gateway logs --tail 100
 
# Filter by level
openclaw gateway logs --level error

Logs are stored at ~/.openclaw-dench/workspace/.openclaw/logs/gateway.log. Rotate them if they get large:

openclaw gateway logs --rotate

Auto-start on login#

openclaw gateway install-service

This creates a launchd plist (macOS) or systemd unit (Linux) that starts the gateway when you log in.

Profile Management#

Profiles let you run multiple DenchClaw instances — useful if you're managing different workspaces for different clients or contexts.

# List profiles
openclaw profile list
 
# Create a new profile
openclaw profile create client-a
 
# Switch active profile
openclaw profile use client-a
 
# Show current profile
openclaw profile current
 
# Delete a profile
openclaw profile delete client-a

Each profile has its own workspace directory, database, and config. The default profile lives at ~/.openclaw-dench/.

Session Management#

Sessions are conversations with your agent. You can create, list, and manage them from the terminal.

# List active sessions
openclaw session list
 
# Start a new chat session in your terminal
openclaw session start
 
# Attach to an existing session
openclaw session attach <session-id>
 
# Kill a session
openclaw session kill <session-id>
 
# Kill all sessions
openclaw session kill --all

The session start command drops you into an interactive chat with your DenchClaw agent, right in the terminal. Type your questions in natural language.

Sending Messages to Your Agent from Terminal#

You don't have to start an interactive session to talk to your agent. Send one-off messages:

# Send a message and get the response
openclaw message "How many leads do I have this week?"
 
# Pipe output to a file
openclaw message "List all companies with status=customer" > customers.txt
 
# Use --json for structured output
openclaw message "List my top 10 leads by score" --json > leads.json

This is great for scripting. Your agent processes the message and returns a response. No GUI needed.

# Daily briefing script
openclaw message "Give me a summary of yesterday's CRM activity"

Executing Skills from CLI#

Skills are markdown-based plugins that extend your agent's capabilities. Run them directly from the terminal:

# List installed skills
openclaw skill list
 
# Run a skill
openclaw skill run browser-automation "Go to linkedin.com/in/johndoe and extract their current title"
 
# Install a skill from ClawHub
openclaw skill install seo-research-master
 
# Update all skills
openclaw skill update --all
 
# Show skill info
openclaw skill info crm

Skills can be invoked with natural language parameters. The agent parses your intent and executes the skill's SKILL.md instructions.

Querying DuckDB from Terminal#

DenchClaw's data lives in a local DuckDB file. Query it directly:

# Interactive DuckDB shell
openclaw db shell
 
# Run a SQL query
openclaw db query "SELECT count(*) FROM objects WHERE object_type='person'"
 
# Export to CSV
openclaw db query "SELECT * FROM v_person WHERE status='lead'" --format csv > leads.csv
 
# Export to JSON
openclaw db query "SELECT * FROM v_company" --format json > companies.json
 
# Run a .sql file
openclaw db run ./reports/monthly-pipeline.sql

Or use the duckdb CLI directly (it's installed alongside DenchClaw):

duckdb ~/.openclaw-dench/workspace/workspace.duckdb \
  "SELECT name, email, status FROM v_person WHERE status='lead' LIMIT 20"

Useful Queries#

Quick reference for common queries:

# Count entries by object type
openclaw db query "SELECT object_type, count(*) as n FROM objects GROUP BY object_type ORDER BY n DESC"
 
# Recent activity (last 7 days)
openclaw db query "SELECT * FROM v_person WHERE created_at > now() - INTERVAL '7 days'"
 
# Pipeline by stage
openclaw db query "SELECT stage, count(*), sum(CAST(value AS DECIMAL)) as total_value FROM v_deal GROUP BY stage"

Running Batch Operations#

Need to update or create many entries at once? Use batch commands:

# Import from CSV
openclaw import people leads.csv --map "Email=email,Name=name,Company=company"
 
# Bulk update from a JSON file
openclaw batch update --file updates.json
 
# Export all entries of a type
openclaw export people --format csv --output people-export.csv
 
# Export with filters
openclaw export deals --filter "stage=closed_won" --format json

The import command is smart about deduplication — it matches on email (for people) or domain (for companies) by default.

Scripting DenchClaw for Automation#

Here are complete shell scripts for common automation tasks.

Morning briefing script#

#!/bin/bash
# morning-briefing.sh — run at startup or via cron
 
echo "=== DenchClaw Morning Briefing ==="
echo "Date: $(date '+%A, %B %d %Y')"
echo ""
 
# Make sure gateway is running
if ! openclaw gateway status --quiet; then
  echo "Starting gateway..."
  openclaw gateway start
  sleep 3
fi
 
# Get briefing from agent
openclaw message "Give me a morning briefing: new leads in the last 24 hours, any deals closing this week, and any follow-ups overdue"
 
echo ""
echo "Done."

Save it, chmod +x morning-briefing.sh, and add to your crontab:

crontab -e
# Add: 0 8 * * 1-5 /path/to/morning-briefing.sh >> ~/briefings.log 2>&1

Lead import pipeline#

#!/bin/bash
# import-leads.sh — import leads from a CSV, enrich, and notify
 
set -e
 
INPUT_FILE="$1"
 
if [ -z "$INPUT_FILE" ]; then
  echo "Usage: $0 <csv-file>"
  exit 1
fi
 
echo "Importing leads from $INPUT_FILE..."
openclaw import people "$INPUT_FILE" \
  --map "Email=email,First Name=name,Company=company,Phone=phone" \
  --status lead \
  --dedupe email
 
IMPORTED=$(openclaw db query "SELECT count(*) FROM v_person WHERE created_at > now() - INTERVAL '5 minutes'" --raw)
 
echo "$IMPORTED leads imported."
 
# Notify via Slack (requires webhook URL in env)
if [ -n "$SLACK_WEBHOOK" ]; then
  curl -s -X POST "$SLACK_WEBHOOK" \
    -H 'Content-type: application/json' \
    -d "{\"text\": \"✅ Imported $IMPORTED new leads into DenchClaw\"}"
fi

Daily database backup#

#!/bin/bash
# backup-denchclaw.sh — back up the DuckDB database
 
BACKUP_DIR="$HOME/denchclaw-backups"
DATE=$(date '+%Y-%m-%d')
DB_PATH="$HOME/.openclaw-dench/workspace/workspace.duckdb"
 
mkdir -p "$BACKUP_DIR"
 
# DuckDB supports export to Parquet natively
duckdb "$DB_PATH" "EXPORT DATABASE '$BACKUP_DIR/$DATE' (FORMAT PARQUET)"
 
# Or just copy the file when gateway is stopped
# openclaw gateway stop
# cp "$DB_PATH" "$BACKUP_DIR/workspace-$DATE.duckdb"
# openclaw gateway start
 
# Keep last 30 days
find "$BACKUP_DIR" -name "*.duckdb" -mtime +30 -delete
 
echo "Backup saved to $BACKUP_DIR/$DATE"

Sync new entries to Google Sheets#

#!/bin/bash
# sync-to-sheets.sh — export leads to CSV and upload to Google Sheets
 
OUTPUT="/tmp/denchclaw-leads-$(date '+%Y%m%d').csv"
 
openclaw db query \
  "SELECT name, email, company, status, created_at FROM v_person ORDER BY created_at DESC" \
  --format csv > "$OUTPUT"
 
# Use gog (Google Workspace skill) or the Sheets API
openclaw skill run gog "Upload $OUTPUT to the 'DenchClaw Leads' spreadsheet, sheet 'Leads', replacing all content"
 
echo "Synced to Google Sheets."

Useful Shell Aliases#

Add these to your ~/.zshrc or ~/.bashrc:

# DenchClaw shortcuts
alias dc='openclaw'
alias dcs='openclaw gateway status'
alias dcstart='openclaw gateway start'
alias dcstop='openclaw gateway stop'
alias dclog='openclaw gateway logs --tail 50'
alias dcq='openclaw db query'
alias dcm='openclaw message'
alias dcsh='openclaw db shell'
 
# Quick lead count
alias leads='openclaw db query "SELECT count(*) as leads FROM v_person WHERE status='"'"'lead'"'"'" --raw'
 
# Pipeline summary
alias pipeline='openclaw db query "SELECT stage, count(*) as deals, sum(CAST(value AS DECIMAL)) as value FROM v_deal GROUP BY stage ORDER BY value DESC"'
 
# Morning briefing
alias briefing='openclaw message "Morning briefing: new leads, open deals, overdue follow-ups"'

Useful One-Liners#

# Find duplicate email addresses
openclaw db query "SELECT email, count(*) as n FROM v_person GROUP BY email HAVING n > 1"
 
# Get all people added in the last week
openclaw db query "SELECT name, email, created_at FROM v_person WHERE created_at > now() - INTERVAL '7 days'"
 
# Watch the gateway log in real time
openclaw gateway logs --follow
 
# Check which integrations are connected
openclaw integration list
 
# Send a test message via Telegram
openclaw message --channel telegram "test: can you hear me?"
 
# Show all available skills
openclaw skill list --installed
 
# Run a health check
openclaw health
 
# Show workspace info
openclaw workspace info

Configuration#

DenchClaw's config lives at ~/.openclaw-dench/workspace/config.json. Edit it directly or use the CLI:

# Show current config
openclaw config show
 
# Set a value
openclaw config set gateway.port 3001
 
# Set an integration token
openclaw config set integrations.telegram.token "your-bot-token"
 
# Reload config without restart
openclaw config reload

The CLI is the fastest way to manage DenchClaw once you're past the initial setup. Most of what you'd normally do in a GUI — querying data, running imports, checking status — is faster from the terminal once you've got your aliases set up.

Ready to try DenchClaw? Install in one command: npx denchclaw. Full setup guide →

Mark Rachapoom

Written by

Mark Rachapoom

Building the future of AI CRM software.

Continue reading

DENCH

© 2026 DenchHQ · San Francisco, CA