Opencrabs

The self-improving all channels AI agent. Self-healing. Fully autonomous. Single Rust binary.

adolfousier
作者 adolfousier
编程 · MIT · Rust · 更新时间: 6 months ago
673
星标
62
Forks
已验证
A
安全:
优秀
A
质量:
agent-orchestrationagentic-aiagentic-frameworkautonomous-agentsharnessharness-frameworkopen-sourceopencrabsorchestration-frameworkrecursive-self-improvementrsiself-healingself-learning

Rust Rust Edition Ratatui Docker CI GitHub Stars

🦀 OpenCrabs

The autonomous, self-improving AI agent. Single Rust binary. Every channel.

Autonomous, self-improving multi-channel AI agent built in Rust. Inspired by Open Claw.

    ___                    ___           _
   / _ \ _ __  ___ _ _    / __|_ _ __ _| |__  ___
  | (_) | '_ \/ -_) ' \  | (__| '_/ _` | '_ \(_-<
   \___/| .__/\___|_||_|  \___|_| \__,_|_.__//__/
        |_|

 🦀 The autonomous, self-improving AI agent. Single Rust binary. Every channel.

Author: Adolfo Usier

⭐ Star us on GitHub if you like what you see!


Why OpenCrabs?

OpenCrabs runs as a single binary on your terminal — no server, no gateway, no infrastructure. It makes direct HTTPS calls to LLM providers from your machine. Nothing else leaves your computer.

OpenCrabs vs Node.js Agent Frameworks

OpenCrabs (Rust) Node.js Frameworks (e.g. Open Claw)
Binary size 17–22 MB single binary, zero dependencies 1 GB+ node_modules with hundreds of transitive packages
Runtime None — runs natively Requires Node.js runtime + npm install
Attack surface Zero network listeners. Outbound HTTPS only Server infrastructure: open ports, auth layers, middleware
API key security Keys on your machine only. zeroize clears them from RAM on drop, [REDACTED] in all debug output Keys in env vars or config. GC doesn't guarantee memory clearing. Heap dumps can leak secrets
Data residency 100% local — SQLite DB, embeddings, brain files, all in ~/.opencrabs/ Server-side storage, potential multi-tenant data, network transit
Supply chain Single compiled binary. Rust's type system prevents buffer overflows, use-after-free, data races at compile time npm ecosystem: typosquatting, dependency confusion, prototype pollution
Memory safety Compile-time guarantees — no GC, no null pointers, no data races GC-managed, prototype pollution, type coercion bugs
Concurrency tokio async + Rust ownership = zero data races guaranteed Single-threaded event loop, worker threads share memory unsafely
Native TTS/STT Built-in local speech-to-text (whisper.cpp) and text-to-speech — ~130 MB total stack, fully offline No native voice. Requires external APIs (Google, AWS, Azure) or heavy Python dependencies (PyTorch, ~5 GB+)
Telemetry Zero. No analytics, no tracking, no remote logging Server infra typically includes monitoring, logging pipelines, APM

What stays local (never leaves your machine)

What goes out (only when you use it)


Table of Contents


🎬 Full onboard

https://github.com/user-attachments/assets/f05a1132-5d00-4532-bc89-30fb80e45e22

🎬 Demo

https://github.com/user-attachments/assets/7f45c5f8-acdf-48d5-b6a4-0e4811a9ee23


🎯 Core Features

AI & Providers

Feature Description
Multi-Provider Anthropic Claude, OpenAI, GitHub Copilot (uses your Copilot subscription), OpenRouter (400+ models), MiniMax, Google Gemini, z.ai GLM (General API + Coding API), Claude CLI, OpenCode CLI, Qwen Native (free OAuth with multi-account rotation), Qwen Code CLI (1k free req/day), and any OpenAI-compatible API (Ollama, LM Studio, LocalAI). Model lists fetched live from provider APIs — new models available instantly. Each session remembers its provider + model and restores it on switch
Fallback Providers Configure a chain of fallback providers — if the primary fails, each fallback is tried in sequence automatically. Any configured provider can be a fallback. Config: [providers.fallback] providers = ["openrouter", "anthropic"]
Per-Provider Vision Set vision_model per provider — the LLM calls analyze_image as a tool, which uses the vision model on the same provider API to describe images. The chat model stays the same and gets vision capability via tool call. Gemini vision takes priority when configured. Auto-configured for known providers (e.g. MiniMax) on first run
Real-time Streaming Character-by-character response streaming with animated spinner showing model name and live text
Local LLM Support Run with LM Studio, Ollama, or any OpenAI-compatible endpoint — 100% private, zero-cost
Usage Dashboard Per-message token count and cost displayed in header; /usage opens an interactive dashboard with daily activity charts, cost breakdowns by project/model/activity, core tool usage stats, and period filtering (Today/Week/Month/All-Time). Sessions are auto-categorized on startup (Development, Bug Fixes, Features, Refactoring, Testing, Documentation, CI/Deploy, etc.). Estimated costs for historical sessions shown as ~$X.XX
Context Awareness Live context usage indicator showing actual token counts (e.g. ctx: 45K/200K (23%)); auto-compaction at 70% with tool overhead budgeting; accurate tiktoken-based counting calibrated against API actuals
3-Tier Memory (1) Brain MEMORY.md — user-curated durable memory loaded every turn, (2) Daily Logs — auto-compaction summaries at ~/.opencrabs/memory/YYYY-MM-DD.md, (3) Hybrid Memory Search — FTS5 keyword search + local vector embeddings (embeddinggemma-300M, 768-dim) combined via Reciprocal Rank Fusion. Runs entirely local — no API key, no cost, works offline
Dynamic Brain System System brain assembled from workspace MD files (SOUL, IDENTITY, USER, AGENTS, TOOLS, MEMORY) — all editable live between turns
Multi-Agent Orchestration Spawn typed child agents (General, Explore, Plan, Code, Research) for parallel task execution. Five tools: spawn_agent, wait_agent, send_input, close_agent, resume_agent. Each type gets a role-specific system prompt and filtered tool registry. Configurable subagent provider/model. Children run in isolated sessions with auto-approve — no recursive spawning
Recursive Self-Improvement ⚠️ Experimental. Automatic feedback ledger tracks every tool execution, user correction, and provider error. Three tools: feedback_record (log observations), feedback_analyze (query patterns), self_improve (autonomously apply brain file changes — no human approval). Changes logged to ~/.opencrabs/rsi/improvements.md with daily archives. Startup digest injects performance summary into system prompt. Upstream template sync — automatically detects new releases, fetches updated brain file templates from the repo, diffs against local files, and appends only new sections (never overwrites user customizations). Backups created before every merge. Zero tokens spent when version unchanged. Zero setup — works out of the box via auto-migration

Multimodal Input

Feature Description
Image Attachments Paste image paths or URLs into the input — auto-detected and attached as vision content blocks for multimodal models
PDF Support Attach PDF files by path — native Anthropic PDF support; for other providers, text is extracted locally via pdf-extract
Document Parsing Built-in parse_document tool extracts text from PDF, DOCX, HTML, TXT, MD, JSON, XML
Voice (STT) Voice notes transcribed via Groq Whisper API (whisper-large-v3-turbo), any OpenAI-compatible STT endpoint (set stt_base_url + stt_model — works with self-hosted Whisper, Deepgram-compatible proxies, etc.), Voicebox STT (self-hosted open-source voice stack — point voicebox_stt_base_url at your instance), or Local whisper.cpp via whisper-rs (runs on-device, Tiny 75 MB / Base 142 MB / Small 466 MB / Medium 1.5 GB, zero API cost). All dispatched through a single entry point so every channel gets the same provider priority chain. Choose mode in /onboard:voice. Included by default
Voice (TTS) Agent replies to voice notes with audio via OpenAI TTS API (gpt-4o-mini-tts), any OpenAI-compatible TTS endpoint (set tts_base_url + tts_model + tts_voice — works with self-hosted Coqui/Bark, ElevenLabs-compatible proxies, etc.), Voicebox TTS (async /generate → poll /generate/{id}/status → fetch audio; set voicebox_tts_base_url + voicebox_tts_profile_id), or Local Piper TTS (runs on-device via Python venv, Ryan / Amy / Lessac / Kristin / Joe / Cori, zero API cost). All outputs normalised to OGG/Opus via ensure_opus before delivery — consistent format across every channel regardless of backend. Falls back to text if disabled
Attachment Indicator Attached images show as [IMG1:filename.png] in the input title bar
Image Generation Agent generates images via Google Gemini (gemini-3.1-flash-image-preview "Nano Banana") using the generate_image tool — enabled via /onboard:image. Returned as native images/attachments in all channels

Messaging Integrations

Feature Description
Telegram Bot Full-featured Telegram bot — owner DMs share TUI session, groups get isolated per-group sessions (keyed by chat ID). Photo/voice support (STT transcribes incoming voice notes; TTS replies as OGG/Opus voice notes via send_voice when input was audio). Allowed user IDs, allowed chat/group IDs, respond_to filter (all/dm_only/mention). Passive group message capture — all messages stored for context even when bot isn't mentioned
WhatsApp Connect via QR code pairing at runtime or from onboarding wizard. Text + image + voice (STT transcribes incoming voice notes; TTS replies as voice notes when input was audio and tts_enabled=true). Shared session with TUI, phone allowlist (allowed_phones), session persists across restarts
Discord Full Discord bot — text + image + voice. Owner DMs share TUI session, guild channels get isolated per-channel sessions. Allowed user IDs, allowed channel IDs, respond_to filter. Full proactive control via discord_send (17 actions): send, reply, react, unreact, edit, delete, pin, unpin, create_thread, send_embed, get_messages, list_channels, add_role, remove_role, kick, ban, send_file. Generated images sent as native Discord file attachments
Slack Full Slack bot via Socket Mode — owner DMs share TUI session, channels get isolated per-channel sessions. Text + image + voice (STT transcribes incoming audio attachments; TTS replies upload an OGG/Opus audio file via files.upload — renders inline with waveform UI — when input was audio and tts_enabled=true). Allowed user IDs, allowed channel IDs, respond_to filter. Full proactive control via slack_send (17 actions): send, reply, react, unreact, edit, delete, pin, unpin, get_messages, get_channel, list_channels, get_user, list_members, kick_user, set_topic, send_blocks, send_file. Generated images sent as native Slack file uploads. Bot token + app token from api.slack.com/apps (Socket Mode required). Required Bot Token Scopes: chat:write, channels:history, groups:history, im:history, mpim:history, users:read, files:read, files:write, reactions:write, app_mentions:read
Trello Tool-only by default — the AI acts on Trello only when explicitly asked via trello_send. Opt-in polling via poll_interval_secs in config; when enabled, only @bot_username mentions from allowed users trigger a response. Full card management via trello_send (22 actions): add_comment, create_card, move_card, find_cards, list_boards, get_card, get_card_comments, update_card, archive_card, add_member_to_card, remove_member_from_card, add_label_to_card, remove_label_from_card, add_checklist, add_checklist_item, complete_checklist_item, list_lists, get_board_members, search, get_notifications, mark_notifications_read, add_attachment. API Key + Token from trello.com/power-ups/admin, board IDs and member-ID allowlist configurable

File & Media Input Support

When users send files, images, or documents across any channel, the agent receives the content automatically — no manual forwarding needed. Example: a user uploads a dashboard screenshot to a Trello card with the comment "I'm seeing this error" — the agent fetches the attachment, passes it through the vision pipeline, and responds with full context.

Channel Images (in) Text files (in) Documents (in) Audio (in) Audio reply (out) Image gen (out)
Telegram ✅ vision pipeline ✅ extracted inline ✅ / PDF note ✅ STT ✅ TTS via send_voice (OGG/Opus) ✅ native photo
WhatsApp ✅ vision pipeline ✅ extracted inline ✅ / PDF note ✅ STT ✅ TTS via upload + audio_message (OGG/Opus, ptt=true) ✅ native image
Discord ✅ vision pipeline ✅ extracted inline ✅ / PDF note ✅ STT ✅ TTS as response.ogg attachment ✅ file attachment
Slack ✅ vision pipeline ✅ extracted inline ✅ / PDF note ✅ STT ✅ TTS via files.upload (OGG/Opus, inline waveform) ✅ file upload
Trello ✅ card attachments → vision ✅ extracted inline — — — ✅ card attachment + embed
TUI ✅ paste path → vision ✅ paste path → inline — ✅ STT — (terminal has no native audio) ✅ [IMG: name] display

Images are passed to the active model's vision pipeline if it supports multimodal input, or routed to the analyze_image tool (Google Gemini vision) otherwise. Text files (.txt, .md, .json, .csv, source code, etc.) are extracted as UTF-8 and included inline up to 8 000 characters — in the TUI simply paste or type the file path.

Terminal UI

Feature Description
Cursor Navigation Full cursor movement: Left/Right arrows, Ctrl+Left/Right word jump, Home/End, Delete, Backspace at position
Input History Persistent command history (~/.opencrabs/history.txt), loaded on startup, capped at 500 entries
Inline Tool Approval Claude Code-style ❯ Yes / Always / No selector with arrow key navigation
Inline Plan Approval Interactive plan review selector (Approve / Reject / Request Changes / View Plan)
Session Management Create, rename, delete sessions with persistent SQLite storage; each session remembers its provider + model — switching sessions auto-restores the provider (no manual /models needed); token counts and context % per session
Split Panes Horizontal (| in sessions) and vertical (_ in sessions) pane splitting — tmux-style. Each pane runs its own session with independent provider, model, and context. Run 10 sessions side by side, all processing in parallel. Tab to cycle focus, Ctrl+X to close pane
Parallel Sessions Multiple sessions can have in-flight requests to different providers simultaneously. Send a message in one session, switch to another, send another — both process in parallel. Background sessions auto-approve tool calls; you'll see results when you switch back
Scroll While Streaming Scroll up during streaming without being yanked back to bottom; auto-scroll re-enables when you scroll back down or send a message
Path Normalization Home paths (/home/user/...) automatically collapsed to ~ in system prompt, tool call display, and brain files — keeps context lean and readable
Recent File Memory Agent remembers recently accessed file paths across sessions — no need to re-specify paths you were just working on
Compaction Summary Auto-compaction shows the full summary in chat as a system message — see exactly what the agent remembered
Syntax Highlighting 100+ languages with line numbers via syntect
Markdown Rendering Rich text formatting with code blocks, headings, lists, and inline styles
Tool Context Persistence Tool call groups saved to DB and reconstructed on session reload — no vanishing tool history
Multi-line Input Alt+Enter / Shift+Enter for newlines; Enter to send
Abort Processing Escape×2 within 3 seconds to cancel any in-progress request
Bang Operator (!cmd) Run any shell command directly from the input — no LLM round-trip. Output is shown as a system message in the working directory context
Auto-Update Checks GitHub for new releases on startup and once every 24h in the background. When a new version is found it silently installs and hot-restarts. Disable via [agent] auto_update = false in config.toml to be prompted instead

Agent Capabilities

Feature Description
Full Terminal Access 30+ built-in tools (file I/O, glob, grep, web search, code execution, image gen/analysis, memory search, cron jobs) plus any CLI tool on your system via bash — GitHub CLI, Docker, SSH, Python, Node, ffmpeg, curl, and everything else just work
Per-Session Isolation Each session is an independent agent with its own provider, model, context, and tool state. Sessions can run tasks in parallel against different providers — ask Claude a question in one session while Kimi works on code in another
Self-Healing Detects and recovers from phantom tool calls, gaslighting preambles, text repetition loops, XML tool call failures, and provider errors. Short-circuits repeated failing bash commands and rejects interactive commands that would hang. Automatic context compaction at 65% (soft) and 90% (hard). Sticky fallback promotion when primary recovers
Self-Sustaining Agent can modify its own source, build, test, and hot-restart via Unix exec()
Self-Improving Learns from experience — saves reusable workflows as custom commands, writes lessons learned to memory, updates its own brain files. All local, no data leaves your machine
Dynamic Tools Define custom tools at runtime via ~/.opencrabs/tools.toml — the agent can call them autonomously like built-in tools. HTTP and shell executors, template parameters ({{param}}), enable/disable without restart. The tool_manage meta-tool lets the agent create, remove, and reload tools on the fly
Browser Automation Native browser control via CDP (Chrome DevTools Protocol). Auto-detects your default Chromium-based browser (Chrome, Brave, Edge, Arc, Vivaldi, Opera, Chromium) and uses its profile — your logins, cookies, and extensions carry over. 7 browser tools: navigate, click, type, screenshot, eval JS, extract content, wait for elements. Headed or headless mode with display auto-detection. Note: Firefox is not supported (no CDP) — if Firefox is your default, OpenCrabs falls back to the first available Chromium browser. Feature-gated under browser (included by default)
Natural Language Commands Tell OpenCrabs to create slash commands — it writes them to commands.toml autonomously via the config_manager tool
Live Settings Agent can read/write config.toml at runtime; Settings TUI screen (press S) shows current config; approval policy persists across restarts. Default: auto-approve (use /approve to change)
Web Search DuckDuckGo (built-in, no key needed) + EXA AI (neural, free via MCP) by default; Brave Search optional (key in keys.toml)
Debug Logging --debug flag enables file logging; DEBUG_LOGS_LOCATION env var for custom log directory
Agent-to-Agent (A2A) HTTP gateway implementing A2A Protocol RC v1.0 — peer-to-peer agent communication via JSON-RPC 2.0. Supports message/send, message/stream (SSE), tasks/get, tasks/cancel. Built-in a2a_send tool lets the agent proactively call remote A2A agents. Optional Bearer token auth. Includes multi-agent debate (Bee Colony) with confidence-weighted consensus. Task persistence across restarts
Profiles Run multiple isolated instances from the same installation. Each profile gets its own config, keys, memory, sessions, and database. Create with opencrabs profile create <name>, switch with -p <name>. Migrate config between profiles with profile migrate. Export/import for sharing. Token-lock isolation prevents two profiles from using the same bot credential

CLI

Command Description
opencrabs Launch interactive TUI (default)
opencrabs chat Launch TUI with optional --session <id> to resume, --onboard to force wizard
opencrabs run <prompt> Execute a single prompt non-interactively. --auto-approve / --yolo for unattended. --format text|json|markdown
opencrabs agent Interactive CLI agent — multi-turn conversation in your terminal, no TUI. -m <msg> for single-message mode
opencrabs status System overview: version, provider, channels, database, brain, cron, dynamic tools
opencrabs doctor Full diagnostics: config, provider connectivity, database, brain, channels, CLI tools in PATH
opencrabs init Initialize configuration (--force to overwrite)
opencrabs config Show current configuration (--show-secrets to reveal keys)
opencrabs onboard Run the onboarding setup wizard
opencrabs channel list List all configured channels with enabled/disabled status
opencrabs channel doctor Run health checks on all enabled channels
opencrabs memory list List brain files and memory entries
opencrabs memory get <name> Show contents of a specific memory or brain file
opencrabs memory stats Memory statistics: file count, total size, entry count
opencrabs session list List all sessions with provider, model, token count (--all includes archived)
opencrabs session get <id> Show session details and recent messages
opencrabs db init Initialize database
opencrabs db stats Show database statistics
opencrabs db clear Clear all sessions and messages (--force to skip confirmation)
opencrabs cron add|list|remove|enable|disable|test Manage scheduled cron jobs
opencrabs logs status|view|clean|open Log management
opencrabs service install|start|stop|restart|status|uninstall OS service management (launchd on macOS, systemd on Linux)
opencrabs daemon Run in headless daemon mode — channels only, no TUI
opencrabs completions <shell> Generate shell completions (bash, zsh, fish, powershell)
opencrabs version Print version and exit

Global flags: --debug (enable file logging), --config <path> (custom config file), --profile <name> / -p <name> (run as a named profile).

Profiles — Multi-Instance Crab Agents

Run multiple isolated OpenCrabs instances from the same installation. Each profile gets its own config, brain files, memory, sessions, database, and gateway service.

Command Description
opencrabs profile create <name> Create a new profile with fresh config and brain files
opencrabs profile list List all profiles with last-used timestamps
opencrabs profile delete <name> Delete a profile and all its data
opencrabs profile export <name> -o profile.tar.gz Export a profile as a portable archive
opencrabs profile import profile.tar.gz Import a profile from an archive
opencrabs profile migrate --from <name> --to <name> Copy config and brain files between profiles (no DB or sessions)
opencrabs -p <name> Launch OpenCrabs as the specified profile

Default profile: ~/.opencrabs/ — works exactly as before. No migration needed. Users who never touch profiles see zero difference.

Named profiles live at ~/.opencrabs/profiles/<name>/ with full isolation:

~/.opencrabs/
├── config.toml          # default profile
├── opencrabs.db
├── profiles.toml        # profile registry
├── locks/               # token-lock files
└── profiles/
    ├── hermes/          # named profile
    │   ├── config.toml
    │   ├── keys.toml
    │   ├── opencrabs.db
    │   ├── SOUL.md
    │   └── memory/
    └── scout/
        └── ...

Token-lock isolation: Two profiles cannot use the same bot credential (Telegram token, Discord token, etc.). On startup, each profile acquires a lock on its channel tokens. If another profile already holds the lock, the channel refuses to start — preventing two instances from fighting over the same bot.

Profile migration: Use opencrabs profile migrate --from default --to hermes to copy all .md brain files, .toml config files, and memory/ entries to a new profile. Sessions and database are not copied — the new profile starts clean. Add --force to overwrite existing files in the target profile. After migrating, customize the new profile's SOUL.md, IDENTITY.md, and config.toml to give it a different personality and provider setup.

Daemon & Service

Run profiles as background services:

# Install as system service (macOS launchd / Linux systemd)
opencrabs -p hermes service install
opencrabs -p hermes service start

# Each profile gets its own service
# macOS: com.opencrabs.daemon.hermes
# Linux: opencrabs-hermes.service

# Manage independently
opencrabs -p hermes service status
opencrabs -p hermes service stop
opencrabs -p hermes service uninstall

Multiple profiles can run as simultaneous daemon services with full isolation.

Environment variable: Set OPENCRABS_PROFILE=hermes to select a profile without the -p flag. Useful for systemd services, cron jobs, and daemon mode.


🌐 Supported AI Providers

Provider Auth Models Streaming Tools Notes
Anthropic Claude API key Claude Opus 4.6, Sonnet 4.5, Haiku 4.5+ ✅ ✅ Cost tracking, automatic retry
OpenAI API key GPT-5 Turbo, GPT-5 ✅ ✅
GitHub Copilot OAuth GPT-4o, Claude Sonnet 4+ ✅ ✅ Uses your Copilot subscription — no API charges
OpenRouter API key 400+ models ✅ ✅ Free models available (DeepSeek-R1, Llama 3.3, etc.)
Google Gemini API key Gemini 2.5 Flash, 2.0, 1.5 Pro ✅ ✅ 1M+ context, vision, image generation
MiniMax API key M2.7, M2.5, M2.1, Text-01 ✅ ✅ Competitive pricing, auto-configured vision
z.ai GLM API key GLM-4.5 through GLM-5 Turbo ✅ ✅ General API + Coding API endpoints
Claude CLI CLI auth Via claude binary ✅ ✅ Uses your Claude Code subscription
OpenCode CLI None Free models (Mimo, etc.) ✅ ✅ Free — no API key or subscription needed
Qwen (Native) OAuth Qwen3.6-Plus, Qwen3.5-Plus, Qwen3-Max ✅ ✅ Free tier (60 req/min, 1k/day). Multi-account rotation multiplies quota
Qwen Code CLI OAuth / API key Qwen3-Coder-Plus, Qwen3.5-Plus, Qwen3.6-Plus ✅ ✅ 1k free req/day via Qwen OAuth — no API key needed
Ollama Optional Any pulled model ✅ ✅ Local-first, zero API cost. Auto-detects localhost:11434
Custom Optional Any ✅ ✅ LM Studio, Groq, NVIDIA, any OpenAI-compatible API

Anthropic Claude

Models: claude-opus-4-6, claude-sonnet-4-5-20250929, claude-haiku-4-5-20251001, plus legacy Claude 3.x models

Setup in keys.toml:

[providers.anthropic]
api_key = "sk-ant-api03-YOUR_KEY"

OAuth tokens no longer supported. Anthropic disabled OAuth (sk-ant-oat) for third-party apps as of Feb 2026. Only console API keys (sk-ant-api03-*) work. See anthropics/claude-code#28091.

Features: Streaming, tools, cost tracking, automatic retry with backoff

Claude Code CLI

Use your Claude Code CLI. OpenCrabs spawns the local claude CLI for completion.

Setup:

  1. Install Claude Code CLI and authenticate (claude login)
  2. Enable in config.toml:
[providers.claude_cli]
enabled = true

OpenCrabs handles all tools, memory, and context locally — the CLI is just the LLM backend.

OpenAI

Models: GPT-5 Turbo, GPT-5

Setup in keys.toml:

[providers.openai]
api_key = "sk-YOUR_KEY"

GitHub Copilot

Use your GitHub Copilot subscription — no API charges, no tokens to manage. OpenCrabs authenticates via the same OAuth device flow used by VS Code and other Copilot tools.

Setup — select GitHub Copilot in the onboarding wizard and press Enter. You'll see a one-time code to enter at github.com/login/device. Once authorized, models are fetched from the Copilot API automatically.

Requirements: An active GitHub Copilot subscription (Individual, Business, or Enterprise).

The OAuth token is saved automatically during onboarding. If you need to re-authenticate, run /onboard:provider and select GitHub Copilot.

Enable in config.toml:

[providers.github]
enabled = true
default_model = "gpt-4o"
base_url = "https://api.githubcopilot.com/chat/completions"

Features: Streaming, tools, OpenAI-compatible API at api.githubcopilot.com. Copilot-specific headers (copilot-integration-id, editor-version) are injected automatically. Short-lived API tokens are refreshed in the background every ~25 minutes.

OpenRouter — 400+ Models, One Key

Setup in keys.toml — get a key at openrouter.ai/keys:

[providers.openrouter]
api_key = "sk-or-YOUR_KEY"

Access 400+ models from every major provider through a single API key — Anthropic, OpenAI, Google, Meta, Mistral, DeepSeek, Qwen, and many more. Includes free models (DeepSeek-R1, Llama 3.3, Gemma 2, Mistral 7B) and stealth/preview models as they drop.

Model list is fetched live from the OpenRouter API during onboarding and via /models — no binary update needed when new models are added.

Google Gemini

Models: gemini-2.5-flash, gemini-2.0-flash, gemini-1.5-pro — fetched live from the Gemini API

Setup in keys.toml — get a key at aistudio.google.com:

[providers.gemini]
api_key = "AIza..."

Enable and set default model in config.toml:

[providers.gemini]
enabled = true
default_model = "gemini-2.5-flash"

Features: Streaming, tool use, vision, 1M+ token context window, live model list from /models endpoint

Image generation & vision: Gemini also powers the separate [image] section for generate_image and analyze_image agent tools. See Image Generation & Vision below.

MiniMax

Models: MiniMax-M2.7, MiniMax-M2.5, MiniMax-M2.1, MiniMax-Text-01

Setup — get your API key from platform.minimax.io. Add to keys.toml:

[providers.minimax]
api_key = "your-api-key"

MiniMax is an OpenAI-compatible provider with competitive pricing. It does not expose a /models endpoint, so the model list comes from config.toml (pre-configured with available models).

z.ai GLM

Models: glm-4.5, glm-4.5-air, glm-4.6, glm-4.7, glm-5, glm-5-turbo — fetched live from the z.ai API

Setup — get your API key from open.bigmodel.cn. Add to keys.toml:

[providers.zhipu]
api_key = "your-api-key"

Enable and choose endpoint type in config.toml:

[providers.zhipu]
enabled = true
default_model = "glm-4.7"
endpoint_type = "api"  # "api" (General API) or "coding" (Coding API)

z.ai GLM (Zhipu AI) offers two endpoint types selectable during onboarding or via /models:

Both use the same API key and model names. The endpoint type can be toggled in the onboarding wizard or /models dialog.

Features: Streaming, tools, OpenAI-compatible API, live model list from /models endpoint

OpenCode CLI

Use the OpenCode CLI as a free LLM backend — no API key or subscription needed. OpenCrabs spawns the local opencode binary for completions.

Setup:

  1. Install OpenCode CLI (go install github.com/opencode-ai/opencode@latest or download from releases)
  2. Enable in config.toml:
[providers.opencode_cli]
enabled = true
default_model = "opencode/mimo-v2-pro-free"

Models are fetched live from opencode models. Free models like mimo-v2-pro-free work without any authentication.

Features: Streaming, tools, extended thinking support, NDJSON event protocol

Qwen (Native)

Direct integration with Qwen's API via OAuth device flow — no API key needed. Free tier gives 60 req/min and 1,000 req/day per account.

Setup: Select Qwen in /onboard or /models and follow the browser OAuth flow.

Multi-account rotation: Multiply your free quota by authenticating multiple Qwen accounts. When one account hits rate limits, OpenCrabs automatically rotates to the next — only falling to the fallback provider when all accounts are exhausted.

To enable rotation during setup:

  1. Select Qwen in /onboard or /models
  2. Press Space to toggle rotation
  3. Press 2-9 to set the number of accounts (1 = 10)
  4. Press Enter — authenticate each account in sequence (sign out in your browser between accounts)

Adding more accounts later (e.g. 3→5) is incremental — only the new accounts need authentication. Configured providers show a green ✓ in the provider list.

Rotation accounts are stored in keys.toml:

[[providers.qwen_accounts]]
api_key = "..."
refresh_token = "..."
expiry_date = 1234567890
resource_url = "portal.qwen.ai"

[[providers.qwen_accounts]]
api_key = "..."
refresh_token = "..."
expiry_date = 1234567891
resource_url = "portal.qwen.ai"

With 3 accounts you get 180 req/min and 3,000 req/day before fallback kicks in.

Qwen Code CLI

Use the Qwen Code CLI as a free LLM backend — 1,000 free requests/day via Qwen OAuth. OpenCrabs spawns the local qwen binary for completions.

Setup:

  1. Install Qwen Code CLI (npm install -g @qwen-code/qwen-code or brew install qwen-code)
  2. Authenticate: run qwen and follow the OAuth flow (or set DASHSCOPE_API_KEY for API key auth)
  3. Enable in config.toml:
[providers.qwen_code_cli]
enabled = true
default_model = "qwen3-coder-plus"

Available models: qwen3-coder-plus, qwen3.5-plus, qwen3.6-plus, qwen3-coder-480a35, qwen3-coder-30ba3b, qwen3-max-2026-01-23

Features: Streaming, tools, 256K context window, NDJSON event protocol (Gemini CLI fork)

Ollama

Native built-in provider for Ollama — no custom config needed. OpenCrabs auto-detects localhost:11434 and lists your pulled models via /models.

Setup:

  1. Install Ollama and pull a model: ollama pull qwen2.5-coder:7b
  2. Enable in config.toml:
[providers.ollama]
enabled = true
default_model = "qwen2.5-coder:7b"

Features: Streaming, tools, zero API cost, local-first. Optional api_key for cloud Ollama (api.ollama.com). Models fetched live from Ollama API.

Custom (OpenAI-Compatible)

Use for: LM Studio, Groq, or any OpenAI-compatible API.

Setup in config.toml — every custom provider needs a name (the label after custom.):

[providers.custom.lm_studio]
enabled = true
base_url = "http://localhost:1234/v1"  # or your endpoint
default_model = "qwen2.5-coder-7b-instruct"
# Optional: list your available models — shows up in /models and /onboard
# so you can switch between them without editing config
models = ["qwen2.5-coder-7b-instruct", "llama-3-8B", "mistral-7B-instruct"]

Local LLMs (Ollama, LM Studio): No API key needed — just set base_url and default_model.

Remote APIs (Groq, Together, etc.): Add the key in keys.toml using the same name:

[providers.custom.groq]
api_key = "your-api-key"

Note: /chat/completions is auto-appended to base URLs that don't include it.

Local reasoning models (enable_thinking): when a custom provider's base_url points at a local host (localhost, 127.0.0.1, *.local, or an RFC1918 private IP like 192.168.x.x / 10.x.x.x / 172.16.x.x–172.31.x.x), OpenCrabs injects chat_template_kwargs: {"enable_thinking": true} into every request. This mirrors llama-server --jinja --chat-template-kwargs '{"enable_thinking":true}' — what Unsloth Studio launches with by default — so Qwen3 / Kimi / DeepSeek-R1 templates render <tool_call> tags and reasoning blocks correctly, and tool calls actually execute instead of being hallucinated as text. Set enable_thinking = false in the provider block to disable (falls back to fast, non-thinking mode). Cloud providers are unaffected.

[providers.custom.lm_studio]
enabled = true
base_url = "http://localhost:1234/v1"
default_model = "qwen3-30b-a3b"
enable_thinking = false  # optional — default is true for local providers

Multiple custom providers coexist — define as many as you need with different names and switch between them via /models:

[providers.custom.lm_studio]
enabled = true
base_url = "http://localhost:1234/v1"
default_model = "qwen2.5-coder-7b-instruct"

[providers.custom.ollama]
enabled = false
base_url = "http://localhost:11434/v1"
default_model = "mistral"

The name after custom. is a label you choose (e.g. lm_studio, nvidia, groq). The one with enabled = true is active. Keys go in keys.toml using the same label. All configured custom providers persist — switching via /models just toggles enabled.

Free Prototyping with NVIDIA API + Kimi K2.5

Kimi K2.5 is a frontier-scale multimodal Mixture-of-Experts (MoE) model available for free on the NVIDIA API Catalog — no billing setup or credit card required. It handles complex reasoning and image/video understanding, making it a strong free alternative to paid models like Claude or Gemini for experimentation and agentic workflows.

Tested and verified with OpenCrabs Custom provider setup.

Quick start:

  1. Sign up at the NVIDIA API Catalog and verify your account
  2. Go to the Kimi K2.5 model page and click Get API Key (or "View Code" to see an auto-generated key)
  3. Configure in OpenCrabs via /models or config.toml:
[providers.custom.nvidia]
enabled = true
base_url = "https://integrate.api.nvidia.com/v1"
default_model = "moonshotai/kimi-k2.5"
# keys.toml
[providers.custom.nvidia]
api_key = "nvapi-..."

Provider priority: MiniMax > OpenRouter > Anthropic > OpenAI > GitHub Copilot > Gemini > z.ai GLM > Claude CLI > OpenCode CLI > Custom. The first provider with enabled = true is used on new sessions. Each provider has its own API key in keys.toml — no sharing or confusion.

Per-session provider: Each session remembers which provider and model it was using. Switch to Claude in one session, Kimi in another — when you /sessions switch between them, the provider restores automatically. No need to /models every time. New sessions inherit the current provider.

Fallback Providers

If your primary provider goes down, fallback providers are tried automatically in sequence. Any provider with API keys already configured can be a fallback:

[providers.fallback]
enabled = true
providers = ["openrouter", "anthropic"]  # tried in order on failure

At runtime, if a request to the primary fails, each fallback is tried until one succeeds. Supports single (provider = "openrouter") or multiple providers.

Per-Provider Vision Model

If your default model doesn't support vision but another model on the same provider does, set vision_model. The LLM calls analyze_image as a tool — the vision model describes the image and returns the description to the chat model as context:

[providers.minimax]
default_model = "MiniMax-M2.7"
vision_model = "MiniMax-Text-01"  # describes images for the chat model

MiniMax auto-configures this on first run. Works with any provider — just set vision_model to a vision-capable model on the same API.


🖼️ Image Generation & Vision

OpenCrabs supports image generation and vision analysis via Google Gemini. These features are independent of the main chat provider — you can use Claude for chat and Gemini for images.

Setup

  1. Get a free API key from aistudio.google.com
  2. Run /onboard:image in chat (or go through onboarding Advanced mode) to configure
  3. Or add manually to keys.toml:
[image]
api_key = "AIza..."

And config.toml:

[image.generation]
enabled = true
model = "gemini-3.1-flash-image-preview"

[image.vision]
enabled = true
model = "gemini-3.1-flash-image-preview"

Agent Tools

When enabled, two tools become available to the agent automatically:

Tool Description
generate_image Generate an image from a text prompt — saves to ~/.opencrabs/images/ and returns the file path
analyze_image Analyze an image file or URL via Gemini vision — works even when your main model doesn't support vision

Example prompts:

Model

Both tools use gemini-3.1-flash-image-preview ("Nano Banana") — Gemini's dedicated image-generation model that supports both vision input and image output in a single request.


🤝 Agent-to-Agent (A2A) Protocol

OpenCrabs includes a built-in A2A gateway — an HTTP server implementing the A2A Protocol RC v1.0 for peer-to-peer agent communication. Other A2A-compatible agents can discover OpenCrabs, send it tasks, and get results back — all via standard JSON-RPC 2.0. The agent can also proactively call remote A2A agents using the built-in a2a_send tool.

Enabling A2A

Add to ~/.opencrabs/config.toml:

[a2a]
enabled = true
bind = "127.0.0.1"   # Loopback only (default) — use "0.0.0.0" to expose
port = 18790          # Gateway port
# api_key = "your-secret"  # Optional Bearer token auth for incoming requests
# allowed_origins = ["http://localhost:3000"]  # CORS (empty = blocked)

Endpoints

Endpoint Method Description
/.well-known/agent.json GET Agent Card — discover skills, capabilities, supported content types
/a2a/v1 POST JSON-RPC 2.0 — message/send, message/stream (SSE), tasks/get, tasks/cancel
/a2a/health GET Health check

a2a_send Tool

The agent has a built-in a2a_send tool to communicate with remote A2A agents:

Action Description
discover Fetch a remote agent's Agent Card (no approval needed)
send Send a task message to a remote agent
get Check status of a remote task
cancel Cancel a running remote task

The tool supports optional api_key for authenticated endpoints and context_id for multi-turn conversations.

Connecting Two Agents

VPS agent (config.toml):

[a2a]
enabled = true
bind = "0.0.0.0"
port = 18790
api_key = "shared-secret"

Local agent — connect via SSH tunnel (recommended, no ports to open):

ssh -L 18791:127.0.0.1:18790 user@your-vps

Now the local agent can reach the VPS agent at http://127.0.0.1:18791. The agent will use a2a_send with that URL automatically.

Quick Start Examples

# Discover the agent
curl http://127.0.0.1:18790/.well-known/agent.json | jq .

# Send a message (creates a task)
curl -X POST http://127.0.0.1:18790/a2a/v1 \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer your-secret" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "message/send",
    "params": {
      "message": {
        "role": "user",
        "parts": [{"text": "What tools do you have?"}]
      }
    }
  }'

# Poll a task by ID
curl -X POST http://127.0.0.1:18790/a2a/v1 \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer your-secret" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tasks/get","params":{"id":"TASK_ID"}}'

# Cancel a running task
curl -X POST http://127.0.0.1:18790/a2a/v1 \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer your-secret" \
  -d '{"jsonrpc":"2.0","id":3,"method":"tasks/cancel","params":{"id":"TASK_ID"}}'

Bee Colony Debate

OpenCrabs supports multi-agent structured debate via the Bee Colony protocol — based on ReConcile (ACL 2024) confidence-weighted voting. Multiple "bee" agents argue across configurable rounds, each enriched with knowledge context from QMD memory search, then converge on a consensus answer with confidence scores.

Security & Persistence


🚀 Quick Start

Option 1: Download Binary (just run it)

Grab a pre-built binary from GitHub Releases — available for Linux (amd64/arm64), macOS (amd64/arm64), and Windows.

# Download, extract, run
tar xzf opencrabs-linux-amd64.tar.gz
./opencrabs

The onboarding wizard handles everything on first run.

Terminal permissions required. OpenCrabs reads/writes brain files, config, and project files. Your terminal app needs filesystem access or the OS will block operations.

OS What to do
macOS System Settings → Privacy & Security → Full Disk Access → toggle your terminal app ON (Alacritty, iTerm2, Terminal, etc.). If not listed, click "+" and add it from /Applications/. Without this, macOS repeatedly prompts "would like to access data from other apps".
Windows Run your terminal (Windows Terminal, PowerShell, cmd) as Administrator on first run, or grant the terminal write access to %USERPROFILE%\.opencrabs\ and your project directories. Windows Defender may also prompt — click "Allow".
Linux Ensure your user owns ~/.opencrabs/ and project directories. On SELinux/AppArmor systems, the terminal process needs read/write access to those paths. Flatpak/Snap terminals may need --filesystem=home or equivalent permission.

Linux runtime dependencies: The pre-built binary links against system libraries that may not be installed on minimal/VPS images:

# Debian/Ubuntu
sudo apt-get install libgomp1 libasound2
# Fedora/RHEL
sudo dnf install libgomp alsa-lib
# Arch
sudo pacman -S gcc-libs alsa-lib

libgomp (GCC OpenMP) is required by the local embedding engine (llama-cpp-2). libasound is required for local speech-to-text audio I/O. macOS and Windows binaries have no extra prerequisites.

Local TTS (Piper) additionally requires Python 3 with the venv module:

# Debian/Ubuntu
sudo apt-get install python3 python3-venv
# Fedora/RHEL
sudo dnf install python3
# macOS
brew install python3
# Windows
winget install Python.Python.3

Not needed if you use API TTS (OpenAI) or disable TTS entirely.

Note: /rebuild works even with pre-built binaries — it auto-clones the source to ~/.opencrabs/source/ on first use, then builds and hot-restarts. For active development or adding custom tools, Option 2 gives you the source tree directly.

Option 2: Install via Cargo

cargo install opencrabs

Linux (Debian/Ubuntu): Install system deps first: sudo apt-get install build-essential pkg-config clang libclang-dev libasound2-dev libssl-dev cmake

Large build: The build can use 8GB+ in /tmp. If you run out of space: CARGO_TARGET_DIR=~/.cargo/target cargo install opencrabs

Feature Flags

All features are enabled by default. To customize, use --no-default-features and pick what you need:

# Install with only Telegram and Discord
cargo install opencrabs --no-default-features --features "telegram,discord"

# Everything except browser automation
cargo install opencrabs --no-default-features --features "telegram,whatsapp,discord,slack,trello,local-stt,local-tts"
Feature Crate Description
telegram teloxide Telegram bot channel
whatsapp whatsapp-rust WhatsApp channel via multi-device API
discord serenity Discord bot channel
slack slack-morphism Slack bot channel (Socket Mode)
trello — Trello webhook channel
local-stt rwhisper On-device speech-to-text (requires CMake + C++ compiler)
local-tts opusic-sys On-device text-to-speech (requires python3 + python3-venv at runtime)
browser chromey Browser automation via CDP (Chrome, Brave, Edge, Arc, Vivaldi, Opera — not Firefox)

Option 3: Build from Source (full control)

Required for /rebuild, adding custom tools, or modifying the agent.

Prerequisites:

One-liner setup: bash <(curl -sL https://raw.githubusercontent.com/adolfousier/opencrabs/main/src/scripts/setup.sh) — detects your platform, installs all dependencies, and sets up Rust.

# Clone
git clone https://github.com/adolfousier/opencrabs.git
cd opencrabs

# Build & run (development)
cargo run --bin opencrabs

# Or build release and run directly
cargo build --release
./target/release/opencrabs

Linux on older CPUs (Sandy Bridge / AVX1-only, no AVX2): The local STT and embedding engine require at minimum AVX instructions. If your CPU has AVX but not AVX2 (e.g. Intel Sandy Bridge, Ivy Bridge — roughly 2011–2012), you must build with:

RUSTFLAGS="-C target-cpu=native" cargo run --bin opencrabs
# or for release:
RUSTFLAGS="-C target-cpu=native" cargo build --release

CPUs without AVX at all are not supported for local STT/embedding. API STT mode works on any machine.

API Keys: OpenCrabs uses keys.toml instead of .env for API keys. The onboarding wizard will help you set it up, or edit ~/.opencrabs/keys.toml directly. Keys are handled at runtime — no OS environment pollution.

First run? The onboarding wizard will guide you through provider setup, workspace, and more. See Onboarding Wizard.

Option 3: Docker (sandboxed)

Run OpenCrabs in an isolated container. Build takes ~15min (Rust release + LTO).

# Clone and run
git clone https://github.com/adolfousier/opencrabs.git
cd opencrabs

# Run with docker compose
# API keys are mounted from keys.toml on host
docker compose -f src/docker/compose.yml up --build

Config, workspace, and memory DB persist in a Docker volume across restarts. API keys in keys.toml are mounted into the container at runtime — never baked into the image.

CLI Commands

# Interactive TUI (default)
cargo run --bin opencrabs
cargo run --bin opencrabs -- chat

# Onboarding wizard (first-time setup)
cargo run --bin opencrabs -- onboard
cargo run --bin opencrabs -- chat --onboard   # Force wizard before chat

# Non-interactive single command
cargo run --bin opencrabs -- run "What is Rust?"
cargo run --bin opencrabs -- run --format json "List 3 programming languages"
cargo run --bin opencrabs -- run --format markdown "Explain async/await"

# Configuration
cargo run --bin opencrabs -- init              # Initialize config
cargo run --bin opencrabs -- config            # Show current config
cargo run --bin opencrabs -- config --show-secrets

# Database
cargo run --bin opencrabs -- db init           # Initialize database
cargo run --bin opencrabs -- db stats          # Show statistics

# Profiles — multi-instance isolation
cargo run --bin opencrabs -- profile create hermes
cargo run --bin opencrabs -- profile list
cargo run --bin opencrabs -- -p hermes         # Run as "hermes" profile
cargo run --bin opencrabs -- profile migrate --from default --to hermes
cargo run --bin opencrabs -- profile export hermes -o backup.tar.gz
cargo run --bin opencrabs -- profile import backup.tar.gz
cargo run --bin opencrabs -- profile delete hermes

# Debug mode
cargo run --bin opencrabs -- -d                # Enable file logging
cargo run --bin opencrabs -- -d run "analyze this"

# Log management
cargo run --bin opencrabs -- logs status
cargo run --bin opencrabs -- logs view
cargo run --bin opencrabs -- logs view -l 100
cargo run --bin opencrabs -- logs clean
cargo run --bin opencrabs -- logs clean -d 3

Tip: After cargo build --release, run the binary directly: ./target/release/opencrabs

Make It Available System-Wide

After downloading or building, add the binary to your PATH so you can run opencrabs from any project directory:

# Symlink (recommended — always points to latest build)
sudo ln -sf $(pwd)/target/release/opencrabs /usr/local/bin/opencrabs

# Or copy
sudo cp target/release/opencrabs /usr/local/bin/

Then from any project:

cd /your/project
opencrabs

Use /cd inside OpenCrabs to switch working directory at runtime without restarting.

Output formats for non-interactive mode: text (default), json, markdown


🧙 Onboarding Wizard

First-time users are guided through a 9-step setup wizard that appears automatically after the splash screen.

How It Triggers

The 9 Steps

Step Title What It Does
1 Mode Selection QuickStart (sensible defaults) vs Advanced (full control)
2 Model & Auth Pick provider (Anthropic, OpenAI, GitHub Copilot, Gemini, OpenRouter, Minimax, z.ai GLM, Custom) → enter token/key or sign in via OAuth → model list fetched live from API → select model. Auto-detects existing keys from keys.toml
3 Workspace Set brain workspace path (default ~/.opencrabs/) → seed template files (SOUL.md, IDENTITY.md, etc.)
4 Gateway Configure HTTP API gateway: port, bind address, auth mode
5 Channels Toggle messaging integrations (Telegram, Discord, WhatsApp, Slack, Trello)
6 Voice Choose STT provider: Off / Groq Whisper (API) / OpenAI-compatible (API) / Voicebox (self-hosted) / Local whisper.cpp. Choose TTS provider: Off / OpenAI TTS (API) / OpenAI-compatible (API) / Voicebox (self-hosted) / Local Piper. Local modes show model/voice picker with download progress. OpenAI-compatible modes take base URL + model + key. Voicebox modes take base URL + profile_id (TTS) / base URL (STT)
7 Image Handling Enable Gemini image generation and/or vision analysis — uses a separate Google AI key
8 Daemon Install background service (systemd on Linux, LaunchAgent on macOS)
9 Health Check Verify API key, config, workspace — shows pass/fail summary
10 Brain Personalization Tell the agent about yourself and how you want it to behave → AI generates personalized brain files (SOUL.md, IDENTITY.md, USER.md, etc.)

QuickStart mode skips steps 4-8 with sensible defaults. Advanced mode lets you configure everything.

Type /onboard:voice or /onboard:image in chat to jump directly to Voice or Image setup anytime.

Local STT (whisper.cpp)

Run speech-to-text on-device with zero API cost. Included by default in prebuilt binaries and cargo install opencrabs.

In /onboard:voice, select Local mode, pick a model size, and press Enter to download. Models are stored at ~/.local/share/opencrabs/models/whisper/.

Building from source: Local STT requires CMake and a C++ compiler (for whisper.cpp). To exclude it: cargo install opencrabs --no-default-features --features telegram,whatsapp,discord,slack,trello

Model Size Quality
Tiny ~75 MB Fast, lower accuracy
Base ~142 MB Good balance
Small ~466 MB High accuracy
Medium ~1.5 GB Best accuracy

Config (config.toml):

[voice]
# Core toggles
stt_enabled = true
tts_enabled = true

# --- Local mode (whisper.cpp + Piper) ---
stt_mode = "local"              # "api" (default) or "local"
local_stt_model = "local-base"  # local-tiny, local-base, local-small, local-medium
tts_mode = "local"              # "api" (default) or "local"
local_tts_voice = "ryan"        # ryan, amy, lessac, kristin, joe, cori

# --- OpenAI-compatible API mode (any Whisper/Coqui-compatible endpoint) ---
# STT
stt_base_url = "https://your-stt-host/v1/audio/transcriptions"
stt_model    = "whisper-large-v3"
# TTS
tts_base_url = "https://your-tts-host/v1/audio/speech"
tts_model    = "tts-1"
tts_voice    = "alloy"

# --- Voicebox (self-hosted open-source voice stack) ---
voicebox_stt_enabled   = false
voicebox_stt_base_url  = "http://localhost:8000"
voicebox_tts_enabled   = false
voicebox_tts_base_url  = "http://localhost:8000"
voicebox_tts_profile_id = "your-voice-profile-uuid"

Provider priority (first match wins, enforced in voice::transcribe and voice::synthesize):

All TTS outputs are normalised to OGG/Opus via ensure_opus before reaching a channel — channels can send the bytes directly to send_voice (Telegram), audio_message with ptt=true (WhatsApp), file attachment (Discord), or files.upload (Slack) without format checks of their own.

Brain Personalization (Step 10)

Two input fields: About You (who you are) and Your OpenCrabs (how the agent should behave). The LLM uses these plus the 6 workspace template files to generate personalized brain files.

Wizard Navigation

Key Action
Tab / Shift+Tab Navigate between fields
Up / Down Scroll through lists
Enter Confirm / next step
Space Toggle checkboxes
Esc Go back one step

🔑 API Keys (keys.toml)

OpenCrabs uses ~/.opencrabs/keys.toml as the single source for all API keys, bot tokens, and search keys. No .env files, no OS keyring, no environment variables for secrets. Keys are loaded at runtime and can be modified by the agent.

# ~/.opencrabs/keys.toml — chmod 600!

# LLM Providers
[providers.anthropic]
api_key = "sk-ant-api03-YOUR_KEY"

[providers.openai]
api_key = "sk-YOUR_KEY"

[providers.github]
api_key = "gho_..."                  # OAuth token (auto-saved by onboarding wizard)

[providers.openrouter]
api_key = "sk-or-YOUR_KEY"

[providers.minimax]
api_key = "your-minimax-key"

[providers.zhipu]
api_key = "your-zhipu-key"               # Get from open.bigmodel.cn

[providers.gemini]
api_key = "AIza..."                  # Get from aistudio.google.com

[providers.custom.your_name]
api_key = "your-key"                 # not required for local LLMs

# Image Generation & Vision (independent of main chat provider)
[image]
api_key = "AIza..."                  # Same Google AI key as providers.gemini (can reuse)

# Messaging Channels — tokens/secrets only (config.toml holds allowed_users, allowed_channels, etc.)
[channels.telegram]
token = "123456789:ABCdef..."

[channels.discord]
token = "your-discord-bot-token"

[channels.slack]
token = "xoxb-your-bot-token"
app_token = "xapp-your-app-token"   # Required for Socket Mode

[channels.trello]
app_token = "your-trello-api-key"   # API Key from trello.com/power-ups/admin
token = "your-trello-api-token"     # Token from the authorization URL

# Web Search
[providers.web_search.exa]
api_key = "your-exa-key"

[providers.web_search.brave]
api_key = "your-brave-key"

# Voice (STT/TTS) — dispatched in priority order: Voicebox → OpenAI-compatible → Groq → Local
# STT Groq API (legacy default): uses Groq Whisper
[providers.stt.groq]
api_key = "your-groq-key"

# STT OpenAI-compatible endpoint (any Whisper-compatible server: self-hosted, Deepgram proxy, etc.)
# Also set stt_base_url = "https://…/v1/audio/transcriptions" and stt_model in [voice] of config.toml
[providers.stt.openai_compatible]
api_key = "your-stt-key"

# STT Voicebox (self-hosted open-source voice stack) — no API key required
# Set voicebox_stt_enabled = true and voicebox_stt_base_url in [voice] of config.toml

# STT Local mode: no API key needed — runs whisper.cpp on device
# Set stt_mode = "local" and local_stt_model in config.toml

# TTS OpenAI API (legacy default): uses OpenAI TTS
[providers.tts.openai]
api_key = "your-openai-key"

# TTS OpenAI-compatible endpoint (self-hosted Coqui / Bark / ElevenLabs-compatible proxy)
# Also set tts_base_url = "https://…/v1/audio/speech" + tts_model + tts_voice in [voice]
[providers.tts.openai_compatible]
api_key = "your-tts-key"

# TTS Voicebox (self-hosted) — no API key required
# Set voicebox_tts_enabled = true, voicebox_tts_base_url, voicebox_tts_profile_id in [voice]

# TTS Local mode: no API key needed — runs Piper TTS on device
# Set tts_mode = "local" and local_tts_voice in config.toml

Note: Anthropic OAuth tokens (sk-ant-oat) are no longer supported for third-party apps as of Feb 2026 (anthropics/claude-code#28091). Use console API keys (sk-ant-api03-*) instead.

Trello note: app_token holds the Trello API Key and token holds the Trello API Token — app_token is the app-level credential and token is the user-level credential. Board IDs are configured via board_ids in config.toml.

Security: Always chmod 600 ~/.opencrabs/keys.toml and add keys.toml to .gitignore.


🔐 Secret Sanitization & Redaction

OpenCrabs automatically redacts API keys and tokens from all outputs — conversation history, TUI display, tool approval dialogs, and external channel delivery (Telegram, Discord, Slack, WhatsApp). Secrets never persist to the database or appear in logs.

How It Works

Three layers of defense:

  1. Prefix-based detection — Keys with recognized prefixes are caught instantly (sk-proj-... → sk-proj-[REDACTED])
  2. Hex token detection — Contiguous hex strings of 32+ chars are redacted
  3. Mixed alphanumeric detection — Opaque tokens of 28+ chars containing both letters and digits are caught as a safety net

Structural redaction also applies to:

Supported Key Prefixes

OpenCrabs recognizes 60+ industry-standard key formats out of the box:

Category Prefixes
AI / LLM sk-proj- (OpenAI), sk-ant- (Anthropic), sk-or-v1- (OpenRouter), sk- (generic), gsk_ (Groq), nvapi- (NVIDIA), AIzaSy (Google), pplx- (Perplexity), hf_ (HuggingFace), r8_ (Replicate)
Cloud AKIA / ASIA (AWS), DefaultEndpointsProtocol= (Azure), ya29. (Google OAuth)
Payments sk_live_ / sk_test_ / pk_live_ / pk_test_ / rk_live_ / rk_test_ (Stripe), sq0atp- / sq0csp- (Square)
Git / DevOps ghp_ / gho_ / ghu_ / ghs_ / github_pat_ (GitHub), glpat- / gloas- (GitLab), npm_ (npm), pypi-AgEIcHlwaS (PyPI)
Communication xoxb- / xoxp- / xapp- / xoxs- (Slack), SG. (SendGrid), xkeysib- (Brevo)
SaaS shpat_ / shpca_ / shppa_ / shpss_ (Shopify), ntn_ (Notion), lin_api_ (Linear), aio_ (Airtable), phc_ (PostHog)
Infrastructure sntrys_ (Sentry), dop_v1_ (DigitalOcean), tskey- (Tailscale), tvly- (Tavily), hvs. / vault:v1: (HashiCorp Vault)
Auth / Crypto eyJ (JWT), whsec_ (webhooks), EAA (Facebook/Meta), ATTA (Trello), AGE-SECRET-KEY- (age encryption)

Best Practice: Use Prefixed Keys

If you build or configure services that integrate with OpenCrabs, use industry-standard key prefixes. Keys with recognized prefixes are caught by the first and most reliable layer of redaction. Opaque tokens (random alphanumeric strings with no prefix) rely on the generic safety-net regex, which has a higher threshold to avoid false positives.

Good: av_38947394723jkhkrjkhdfiuo83489732 — prefix makes it instantly recognizable Risky: 38947394723jkhkrjkhdfiuo83489732 — still caught by mixed-alnum regex, but no prefix context in [REDACTED] output

Memory Safety

API keys stored via SecretString are:


🏠 Using Local LLMs

OpenCrabs works with any OpenAI-compatible local inference server for 100% private, zero-cost operation.

LM Studio (Recommended)

  1. Download and install LM Studio
  2. Download a model (e.g., qwen2.5-coder-7b-instruct, Mistral-7B-Instruct, Llama-3-8B)
  3. Start the local server (default port 1234)
  4. Add to config.toml — no API key needed:
[providers.custom.lm_studio]
enabled = true
base_url = "http://localhost:1234/v1"
default_model = "qwen2.5-coder-7b-instruct"   # Must EXACTLY match LM Studio model name
models = ["qwen2.5-coder-7b-instruct", "llama-3-8B", "mistral-7B-instruct"]

Critical: The default_model value must exactly match the model name shown in LM Studio's Local Server tab (case-sensitive).

Ollama

ollama pull mistral

Add to config.toml — no API key needed:

[providers.custom.ollama]
enabled = true
base_url = "http://localhost:11434/v1"
default_model = "mistral"
models = ["mistral", "llama3", "codellama"]

Multiple Local Providers

Want both LM Studio and Ollama configured? Use named providers and switch via /models:

[providers.custom.lm_studio]
enabled = true
base_url = "http://localhost:1234/v1"
default_model = "qwen2.5-coder-7b-instruct"
models = ["qwen2.5-coder-7b-instruct", "llama-3-8B", "mistral-7B-instruct"]

[providers.custom.ollama]
enabled = false
base_url = "http://localhost:11434/v1"
default_model = "mistral"
models = ["mistral", "llama3", "codellama"]

The name after custom. is just a label you choose. The first one with enabled = true is used. Switch anytime via /models or /onboard.

Recommended Models

Model RAM Best For
Qwen-2.5-7B-Instruct 16 GB Coding tasks
Mistral-7B-Instruct 16 GB General purpose, fast
Llama-3-8B-Instruct 16 GB Balanced performance
DeepSeek-Coder-6.7B 16 GB Code-focused
TinyLlama-1.1B 4 GB Quick responses, lightweight

Tips:

Cloud vs Local Comparison

Aspect Cloud (Anthropic) Local (LM Studio)
Privacy Data sent to API 100% private
Cost Per-token pricing Free after download
Speed 1-2s (network) 2-10s (hardware-dependent)
Quality Excellent (Claude 4.x) Good (model-dependent)
Offline Requires internet Works offline

See LM_STUDIO_GUIDE.md for detailed setup and troubleshooting.


📝 Configuration

Configuration Files

OpenCrabs uses three config files — all hot-reloaded at runtime (no restart needed):

File Purpose Secret?
~/.opencrabs/config.toml Provider settings, models, channels, allowed users No — safe to commit
~/.opencrabs/keys.toml API keys, bot tokens Yes — chmod 600, never commit
~/.opencrabs/commands.toml User-defined slash commands No
~/.opencrabs/tools.toml Runtime-defined agent tools (HTTP, shell) No

Changes to any of these files are picked up automatically within ~300ms while OpenCrabs is running. The active LLM provider, channel allowlists, approval policy, and slash command autocomplete all update without restart.

Profiles (Multi-Instance)

Run multiple isolated OpenCrabs instances from the same installation. Each profile gets its own config, memory, sessions, skills, and gateway service.

# Create a new profile
opencrabs profile create hermes

# Run as a specific profile
opencrabs -p hermes

# Or set via environment variable
OPENCRABS_PROFILE=hermes opencrabs daemon

# List all profiles
opencrabs profile list

# Migrate config and brain files from one profile to another
# Copies: *.md, *.toml (config, keys, tools, commands), memory/ directory
# Skips: database, sessions, logs, locks
opencrabs profile migrate --from default --to hermes
opencrabs profile migrate --from default --to hermes --force  # overwrite existing files

# Export/import for sharing or backup
opencrabs profile export hermes -o hermes-backup.tar.gz
opencrabs profile import hermes-backup.tar.gz

# Delete a profile
opencrabs profile delete hermes

Directory layout:

~/.opencrabs/                    # "default" profile (backward compatible)
├── config.toml
├── keys.toml
├── opencrabs.db
├── memory/
├── profiles.toml                # profile registry
├── locks/                       # token-lock files
└── profiles/
    └── hermes/                  # named profile — fully isolated
        ├── config.toml
        ├── keys.toml
        ├── opencrabs.db
        ├── memory/
        └── *.md

Token-lock isolation: Two profiles cannot use the same bot token (Telegram, Discord, Slack, Trello). On startup, OpenCrabs acquires PID-based locks for each channel credential. If another profile already holds that token, the channel refuses to start and notifies the user. Stale locks from crashed processes are automatically cleaned up.

Migration workflow: Use profile migrate to clone your configuration into a new profile, then customize the brain files (SOUL.md, IDENTITY.md) to give the new instance its own personality. The original profile's database and sessions stay untouched.

Search order for config.toml:

  1. ~/.opencrabs/config.toml (primary)
  2. ~/.config/opencrabs/config.toml (legacy fallback)
  3. ./opencrabs.toml (current directory override)

🛠️ Configuration (config.toml)

Full annotated example — the onboarding wizard writes this for you, but you can edit it directly:

# ~/.opencrabs/config.toml

[agent]
approval_policy = "auto-always"  # auto-always (default) | auto-session | ask
working_directory = "~/projects" # default working dir for Bash/file tools

# ── Channels ──────────────────────────────────────────────────────────────────

[channels.telegram]
enabled = true
allowed_users = ["123456789"]    # Telegram user IDs (get yours via /start)
respond_to = "all"               # all | mention | dm_only

[channels.discord]
enabled = true
allowed_users = ["637291214508654633"]  # Discord user IDs
allowed_channels = ["1473207147025137778"]
respond_to = "mention"           # all | mention | dm_only

[channels.slack]
enabled = true
allowed_users = ["U066SGWQZFG"]  # Slack user IDs
allowed_channels = ["C0AEY3C2P9V"]
respond_to = "mention"           # all | mention | dm_only

[channels.whatsapp]
enabled = true
allowed_phones = ["+1234567890"] # E.164 format

[channels.trello]
enabled = true
board_ids = ["your-board-id"]    # From the board URL

# ── Providers ─────────────────────────────────────────────────────────────────

[providers.anthropic]
enabled = true
default_model = "claude-sonnet-4-6"

[providers.gemini]
enabled = false

[providers.openai]
enabled = false
default_model = "gpt-5-nano"

[providers.zhipu]
enabled = false
default_model = "glm-4.7"
endpoint_type = "coding"                 # "api" (General) or "coding" (Coding API)

# ── Image ─────────────────────────────────────────────────────────────────────

[image.generation]
enabled = true
model = "gemini-3.1-flash-image-preview"

[image.vision]
enabled = true
model = "gemini-3.1-flash-image-preview"

# ── Cron Defaults ────────────────────────────────────────────────────────────

[cron]
default_provider = "minimax"      # Provider for cron jobs that don't specify one
default_model = "MiniMax-M2.7"    # Model for cron jobs that don't specify one

API keys go in keys.toml, not here. See API Keys (keys.toml).


📋 Commands (commands.toml)

User-defined slash commands — the agent writes these autonomously via the config_manager tool, or you can edit directly:

# ~/.opencrabs/commands.toml

[[commands]]
name = "/deploy"
description = "Deploy to staging server"
action = "prompt"
prompt = "Run ./deploy.sh staging and report the result."

[[commands]]
name = "/standup"
description = "Generate a daily standup summary"
action = "prompt"
prompt = "Summarize my recent git commits and open tasks for a standup. Be concise."

[[commands]]
name = "/rebuild"
description = "Build and restart OpenCrabs from source"
action = "prompt"
prompt = 'Run `RUSTFLAGS="-C target-cpu=native" cargo build --release` in /srv/rs/opencrabs. If it succeeds, ask if I want to restart now.'

Commands appear instantly in autocomplete (type /) after saving — no restart needed. The action field supports:


🔌 Dynamic Tools (tools.toml)

Runtime-defined tools that the agent can call autonomously — no rebuild, no restart. Unlike slash commands (commands.toml) which are user-triggered shortcuts, dynamic tools appear in the LLM's tool list and the agent decides when to use them.

# ~/.opencrabs/tools.toml

[[tools]]
name = "health_check"
description = "Check if a service is healthy"
executor = "http"
method = "GET"
url = "https://{{host}}/health"
headers = { "Authorization" = "Bearer {{token}}" }
timeout_secs = 10
requires_approval = false

[[tools.params]]
name = "host"
type = "string"
description = "Hostname to check"
required = true

[[tools.params]]
name = "token"
type = "string"
description = "API bearer token"
required = true

[[tools]]
name = "deploy_staging"
description = "Deploy the current branch to staging"
executor = "shell"
command = "cd ~/project && ./deploy.sh {{branch}} staging"
timeout_secs = 120
requires_approval = true

[[tools.params]]
name = "branch"
type = "string"
description = "Git branch to deploy"
required = true

Executor types:

Executor Fields Description
http method, url, headers Makes an HTTP request. Template variables ({{param}}) are substituted in the URL, headers, and body
shell command Runs a shell command. Template variables substituted in the command string

Fields:

Field Required Default Description
name Yes Tool name (used by the agent to call it)
description Yes What the tool does (shown to the LLM)
executor Yes http or shell
enabled No true Whether the tool is active
requires_approval No true Whether the user must approve each call
timeout_secs No 30 Execution timeout in seconds
params No [] Parameter definitions with name, type, description, required

Management via agent: The tool_manage meta-tool lets the agent create, remove, enable/disable, and reload tools at runtime. Tell it "add a tool that checks my server health" and it writes the definition to tools.toml automatically.

Commands vs Tools:

Commands (commands.toml) Tools (tools.toml)
Triggered by User types /command Agent decides autonomously
Appears in Autocomplete menu LLM tool list
Use case Shortcuts, workflows Integrations, automations
Action Sends a prompt to the agent Executes HTTP request or shell command directly

See tools.toml.example for a complete reference.


Example: Hybrid Setup (Local + Cloud)

Keep multiple providers configured — enable the one you want to use, disable the rest. Switch anytime by toggling enabled or using /onboard.

In config.toml:

# Local LLM — currently active
[providers.custom.lm_studio]
enabled = true
base_url = "http://localhost:1234/v1"
default_model = "qwen2.5-coder-7b-instruct"
models = ["qwen2.5-coder-7b-instruct", "llama-3-8B"]

# Cloud API — disabled, enable when you need it
[providers.anthropic]
enabled = false
default_model = "claude-opus-4-6"

In keys.toml:

[providers.anthropic]
api_key = "sk-ant-api03-YOUR_KEY"

Operational Environment Variables

All API keys and secrets are stored in keys.toml — not in environment variables. The only env vars OpenCrabs uses are operational:

Variable Description
DEBUG_LOGS_LOCATION Custom log directory path (default: .opencrabs/logs/)
OPENCRABS_BRAIN_PATH Custom brain workspace path (default: ~/.opencrabs/)

💰 Pricing Customization (usage_pricing.toml)

OpenCrabs tracks real token costs per model using a centralized pricing table at ~/.opencrabs/usage_pricing.toml. It's written automatically on first run with sensible defaults.

Why it matters:

Customizing prices:

# ~/.opencrabs/usage_pricing.toml
# Edit live — changes take effect on next /usage open, no restart needed.

[providers.anthropic]
entries = [
  { prefix = "claude-sonnet-4",  input_per_m = 3.0,  output_per_m = 15.0 },
  { prefix = "claude-opus-4",    input_per_m = 5.0,  output_per_m = 25.0 },
  { prefix = "claude-haiku-4",   input_per_m = 1.0,  output_per_m = 5.0  },
]

[providers.minimax]
entries = [
  { prefix = "minimax-m2.5",     input_per_m = 0.30, output_per_m = 1.20 },
]

# Add any provider — prefix is matched case-insensitively as a substring
[providers.my_custom_model]
entries = [
  { prefix = "my-model-v1",      input_per_m = 1.00, output_per_m = 3.00 },
]

A full example with all built-in providers (Anthropic, OpenAI, MiniMax, Google, DeepSeek, Meta) is available at usage_pricing.toml.example in the repo root.


🔧 Tool System

OpenCrabs includes 30+ built-in tools. The AI can use these during conversation:

File & Code

Tool Description
read_file Read file contents with syntax awareness
write_file Create or modify files
edit_file Precise text replacements in files
bash Execute shell commands — any CLI tool on your system works
ls List directory contents
glob Find files matching patterns
grep Search file contents with regex
execute_code Run code in various languages
notebook_edit Edit Jupyter notebooks
parse_document Extract text from PDF, DOCX, HTML

Search & Web

Tool Description
web_search Search the web (DuckDuckGo, always available, no key needed)
exa_search Neural web search via EXA AI (free via MCP, no API key needed; set key in keys.toml for higher rate limits)
brave_search Web search via Brave Search (set key in keys.toml — free $5/mo credits at brave.com/search/api)
http_request Make HTTP requests
memory_search Hybrid semantic search across past memory logs — FTS5 keyword + vector embeddings (768-dim, local GGUF model) combined via RRF. No API key needed, runs offline

Image

Tool Description
generate_image Generate images via Google Gemini — auto-sent as native images on all channels
analyze_image Analyze images (local files or URLs) via vision model — uses Gemini vision or provider's vision_model

Channel Tools

Tool Description
telegram_send 19 actions: send, reply, edit, delete, pin, forward, send_photo, send_document, polls, buttons, admin ops
discord_send 17 actions: send, reply, react, edit, delete, pin, threads, embeds, roles, kick, ban, send_file
slack_send 17 actions: send, reply, react, edit, delete, pin, blocks, topics, members, send_file
trello_send 22 actions: cards, comments, checklists, labels, members, attachments, board management, search
channel_search Search captured message history across all channels (Telegram, Discord, Slack, WhatsApp)

Agent & System

Tool Description
task_manager Manage agent tasks
plan Create structured execution plans
config_manager Read/write config.toml and commands.toml at runtime (change settings, add/remove commands, reload config)
session_context Access session information
cron_manage Schedule recurring jobs — create, list, enable/disable, delete. Deliver results to any channel
a2a_send Send tasks to remote A2A-compatible agents via JSON-RPC 2.0
tool_manage Manage runtime tools — list, add, remove, enable, disable, reload (tools.toml)
evolve Download latest release binary from GitHub and hot-restart (no Rust toolchain needed). Also runs automatically on startup and every 24h when [agent] auto_update = true (default), and via the /evolve slash command — both paths invoke the tool directly without the LLM, so they can't be dropped or refused by a provider
rebuild Build from source (cargo build --release) and hot-restart

Recursive Self-Improvement (RSI) ⚠️ Experimental

Autonomous feedback loop that tracks performance and enables the agent to improve its own brain files over time — no human approval needed. The agent identifies patterns, applies fixes, and logs everything to ~/.opencrabs/rsi/.

⚠️ Experimental. This feature is being tested and refined over the next few days. Brain file changes are logged and reversible, but monitor your ~/.opencrabs/rsi/improvements.md to see what the agent is changing.

Tool Description
feedback_record Record an observation to the feedback ledger — tool outcomes, user corrections, patterns, provider errors. Auto-recorded for all tool executions; also callable manually
feedback_analyze Query the feedback ledger for patterns — overall summary, per-tool success rates, recent events, failure breakdown
self_improve Autonomously apply improvements to brain files (SOUL.md, AGENTS.md, TOOLS.md, etc.) based on feedback analysis. Changes are logged to ~/.opencrabs/rsi/improvements.md and archived daily in ~/.opencrabs/rsi/history/YYYY-MM-DD.md

How it works: Every tool call automatically records success/failure to an append-only SQLite feedback ledger (fire-and-forget, never blocks). User corrections are detected via pattern matching (~30 negative signal phrases) and recorded automatically. On startup, a performance digest (failure rates, correction count, recent issues) is injected into the system prompt. The agent uses feedback_analyze to drill into patterns and self_improve to apply brain file edits autonomously — changes are logged to ~/.opencrabs/rsi/improvements.md with daily archives. No human approval required.

Upstream template sync: When a new OpenCrabs release is detected, the RSI engine automatically fetches updated brain file templates from the upstream repo, diffs them against your local files, and appends only new sections or subsections. Your personalized content is never overwritten. Backups are created before every merge. If no new release exists, zero network calls and zero tokens are spent.

Browser Automation (feature: browser)

Auto-detects your default Chromium-based browser and uses its native profile (cookies, logins, extensions). Supports Chrome, Brave, Edge, Arc, Vivaldi, Opera, and Chromium. If your default browser is Firefox or another non-Chromium browser, OpenCrabs falls back to the first available Chromium browser on your system. If no Chromium browser is found, a fresh Chrome instance is launched.

Tool Description
browser_navigate Navigate to a URL, returns page title and final URL after redirects
browser_click Click an element by CSS selector
browser_type Type text into an element (by CSS selector or focused element)
browser_screenshot Capture page screenshot (full page or element), returns base64 PNG
browser_eval Execute JavaScript in page context and return the result
browser_content Get page HTML or text-only content, optionally scoped by CSS selector
browser_wait Wait for a CSS selector to appear (polls every 200ms, default 10s timeout)

Why no Firefox? Browser automation uses Chrome DevTools Protocol (CDP). Firefox dropped CDP support entirely — it now uses WebDriver BiDi, which is a different protocol. All Chromium-based browsers speak CDP natively.

Multi-Agent Orchestration

OpenCrabs supports spawning specialized sub-agents that run autonomously in isolated sessions. Each sub-agent gets its own context, tool registry, and cancel token.

Tool Description
spawn_agent Spawn a typed child agent to handle a sub-task autonomously in the background
wait_agent Wait for a spawned sub-agent to complete and return its output (configurable timeout)
send_input Send follow-up input/instructions to a running sub-agent
close_agent Terminate a running sub-agent and clean up resources
resume_agent Resume a completed or failed sub-agent with a new prompt (preserves prior context)

Agent Types — when spawning, an agent_type parameter selects a specialized role:

Type Role Tools
general Full-capability agent (default) All parent tools minus recursive/dangerous
explore Fast codebase navigation — read-only read_file, glob, grep, ls
plan Architecture planning — read + analysis read_file, glob, grep, ls, bash
code Implementation — full write access All parent tools minus recursive/dangerous
research Web search + documentation lookup read_file, glob, grep, ls, web_search, http_client

Sub-agents never have access to recursive tools (spawn_agent, resume_agent, wait_agent, send_input, close_agent) or dangerous system tools (rebuild, evolve).

Subagent Configuration — optionally override the provider/model for all spawned sub-agents in config.toml:

[agent]
subagent_provider = "openrouter"   # provider for child agents (omit to inherit parent)
subagent_model = "qwen/qwen3-235b" # model override for child agents (omit to inherit parent)

This lets you run a powerful model for the main session while using a cheaper/faster model for sub-tasks.

System CLI Tools

OpenCrabs can leverage any CLI tool installed on your system via bash. Common integrations:

Tool Purpose Example
gh GitHub CLI — issues, PRs, repos, releases, actions gh issue list, gh pr create
gog Google CLI — Gmail, Calendar (OAuth) gog gmail search "is:unread", gog calendar events
docker Container management docker ps, docker compose up
ssh Remote server access ssh user@host "command"
node Run JavaScript/TypeScript tools node script.js
python3 Run Python scripts and tools python3 analyze.py
ffmpeg Audio/video processing ffmpeg -i input.mp4 output.gif
curl HTTP requests (fallback when http_request insufficient) curl -s api.example.com

Any tool on your $PATH works. If it runs in your terminal, OpenCrabs can use it.


⌨️ Keyboard Shortcuts

Global

Shortcut Action
Ctrl+C First press clears input, second press (within 3s) quits
Ctrl+N New session
Ctrl+L List/switch sessions
Ctrl+K Clear current session
Page Up/Down Scroll chat history
Mouse Scroll Scroll chat history
Escape Clear input / close overlay

Chat Mode

Shortcut Action
Enter Send message
Ctrl+J New line (vim — also Alt+Enter / Shift+Enter on supported terminals)
← / → Move cursor one character
↑ / ↓ Navigate lines (multiline), jump to start/end (single-line), then history
Ctrl+← / Ctrl+→ Jump by word
Home / End Start / end of current line
Delete Delete character after cursor
Ctrl+W Delete word before cursor (vim)
Ctrl+U Delete to start of line (vim)
Left-click Select/highlight a message
Right-click Copy message to clipboard
Escape ×2 Abort in-progress request
/help Open help dialog
/model Show current model
/models Switch model (fetches live from provider API)
/usage Usage dashboard — interactive overlay with daily activity, cost by project/model/activity, tool stats, and period filtering (T/W/M/A keys). Tab to navigate cards, Esc to close
/onboard Run setup wizard (full flow)
/onboard:provider Jump to provider/API key setup
/onboard:workspace Jump to workspace settings
/onboard:channels Jump to channel config
/onboard:voice Jump to voice STT/TTS setup
/onboard:image Jump to image handling setup
/onboard:gateway Jump to API gateway settings
/onboard:brain Jump to brain/persona setup
/doctor Run connection health check
/sessions Open session manager
/approve Tool approval policy selector (approve-only / session / yolo)
/compact Compact context (summarize + trim for long sessions)
/rebuild Build from source & hot-restart — streams live compiler output to chat, auto exec() restarts on success (no prompt), auto-clones repo if no source tree found
/whisper Voice-to-text — speak anywhere, pastes to clipboard
/cd Change working directory (directory picker)
/settings or S Open Settings screen (provider, approval, commands, paths)
/stop Abort in-progress agent operation (channels only — TUI uses Escape x2)

Channel Commands (Telegram, Discord, Slack, WhatsApp)

When connected via messaging channels, the following slash commands are available directly in chat. These are the channel equivalents of TUI commands — type them as regular messages.

Command Action
/help List available channel commands
/usage Usage dashboard — daily activity, cost breakdowns by project/model/activity, and tool stats with period filtering
/models Switch AI model — shows platform-native buttons (Telegram inline keyboard, Discord buttons, Slack Block Kit). WhatsApp shows a plain text list
/stop Abort the current agent operation immediately — cancels streaming, tool execution, and any pending approvals. Equivalent to double-Escape in the TUI

Model switching via /models changes the model within the current provider and takes effect immediately (no restart needed). The selection persists to config.toml.

Any message that isn't a recognized command is forwarded to the AI agent as normal.

Sessions Mode

Each session shows its provider/model badge (e.g. [anthropic/claude-sonnet-4-6]) and token count. Sessions processing in the background show a spinner; sessions with unread responses show a green dot.

Shortcut Action
↑ / ↓ Navigate sessions
Enter Load selected session (auto-restores its provider + model)
R Rename session
D Delete session
Esc Back to chat

Tool Approval (Inline)

When the AI requests a tool that needs permission, an inline approval prompt appears in chat. Approvals are session-aware: background sessions auto-approve tool calls so they don't block, and switching sessions never loses a pending approval.

Shortcut Action
↑ / ↓ Navigate approval options
Enter Confirm selected option
D / Esc Deny the tool request
V Toggle parameter details

Approval options (TUI and all channels):

Option Effect
Yes Approve this single tool call
Always (session) Auto-approve all tools for this session (resets on restart)
YOLO (permanent) Auto-approve all tools permanently, persists to config.toml
No Deny this tool call

Use /approve to change your approval policy at any time (persisted to config.toml):

Policy Description
Approve-only Prompt before every tool execution. Use this if you want to review each action the agent takes. Set with /approve → "Approve-only (always ask)"
Allow all (session) Auto-approve all tools for the current session only, resets on restart
Yolo mode Execute everything without approval (default for new users). Set with /approve → "Yolo mode"

Note: New installations default to Yolo mode so the agent can work autonomously out of the box. If you prefer to review each tool call, run /approve and select Approve-only (always ask).


🔍 Debug and Logging

OpenCrabs uses a conditional logging system — no log files by default.

# Stack traces on crash
RUST_BACKTRACE=1 opencrabs

# Verbose console output (no file logging)
RUST_LOG=debug opencrabs

# Debug mode: rolling file logs to ~/.opencrabs/logs/, auto-cleanup after 7 days
opencrabs -d

# Both: file logs + verbose console output
RUST_LOG=debug opencrabs -d

All four work the same whether installed via cargo install opencrabs or built from source.

# Log management
opencrabs logs status    # Check logging status
opencrabs logs view      # View recent entries
opencrabs logs clean     # Clean old logs
opencrabs logs clean -d 3  # Clean logs older than 3 days

When debug mode (-d) is enabled:

**When disa

🔓 登录解锁更多
使用 GitHub 登录