CodeWhale
Section 02 · Documentation

Documentation文档

How it works in short. For the full architecture walk-through, see docs/ARCHITECTURE.md.

Modes模式

Three operating modes — orthogonal to the approval system. Cycle with Tab.

Plan 计划

Read-only investigation. The agent can grep, read files, list dirs, fetch URLs — never write or shell out.

Agent 代理

Default. Multi-step tool use. Shell and side-effectful tools require approval per `approval_mode`.

YOLO 全权

Auto-approve everything + enable trust mode. Workspace boundary lifts. Use carefully.

Tools工具

Curated surface — see docs/TOOL_SURFACE.md for design rationale.

File ops
read_file · list_dir · write_file · edit_file · apply_patch
Search
grep_files · file_search · web_search · fetch_url
Shell
exec_shell · exec_shell_wait · exec_shell_interact
Git / diag / test
git_status · git_diff · diagnostics · run_tests
Sub-agents
agent_open · agent_eval · agent_close — persistent sessions, parallel execution, bounded results via var_handle
Recursive LM (RLM)
rlm_open · rlm_eval · rlm_configure · rlm_close — sandboxed Python REPL with peek/search/chunk/sub_query_batch
MCP
mcp_<server>_<tool> — auto-registered from ~/.codewhale/mcp.json

Approval & Sandbox审批

Mode and approval are independent axes. Set via /config.

suggest 建议

Default — uses per-mode rules. Asks before risky ops.

auto 自动

Auto-approve all tool calls. Equivalent to YOLO without trust.

never 拒绝

Block anything not safe / read-only. Investigation only.

Sandbox: bwrap, landlock (Linux), process_hardening, seatbelt (macOS), seccomp. Workspace boundary defaults to --workspace. /trust lifts the boundary.

Configuration配置

# ~/.codewhale/config.toml
api_key = "sk-..."
base_url = "https://api.deepseek.com"
default_text_model = "deepseek-v4-pro"

[ui]
default_mode = "agent"      # plan | agent | yolo
approval_mode = "suggest"   # suggest | auto | never
reasoning_effort = "high"   # off | high | max

[hooks]
enabled = true
default_timeout_secs = 30

[[hooks.hooks]]
event = "session_start"     # tool_call_before / tool_call_after / message_submit / mode_change / on_error / shell_env
command = "~/.codewhale/hooks/pre.sh"

Full reference: config.example.toml.

MCP ServersMCP

codewhale speaks the Model Context Protocol both ways: as a client (loads servers from ~/.codewhale/mcp.json) and as a server (codewhale mcp). Tools surface as mcp_<server>_<tool>.

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/me"]
    },
    "sqlite": {
      "command": "uvx",
      "args": ["mcp-server-sqlite", "--db-path", "./data.db"]
    }
  }
}

Skills技能

A skill is a folder under ~/.codewhale/skills/<name>/ with a SKILL.md at the root. The agent loads skill names + descriptions on startup and can pull in the full body via the Skill tool when relevant.

Finauto-routing

Fin is CodeWhale's model auto-routing layer. It analyses each task — complexity, context size, tool needs — and dispatches to the best model backend automatically.

Fast lane 快速通道

Lightweight turns (file ops, fetch, simple shell) auto-route to a flash-tier model for lower latency and cost.

Deep lane 深度通道

Complex reasoning, large refactors, multi-step plans escalate to a full-size reasoning model.

Providers提供商

Switch with codewhale auth set --provider <id>. The table below is a live projection of the ApiProvider enum in crates/tui/src/config.rs — currently 12 providers.

DeepSeek
deepseek
DEEPSEEK_API_KEY
NVIDIA NIM
nvidia-nim
NVIDIA_API_KEY / NVIDIA_NIM_API_KEY
OpenAI-compatible
openai
OPENAI_API_KEY
AtlasCloud
atlascloud
ATLASCLOUD_API_KEY
Wanjie Ark
wanjie-ark
WANJIE_ARK_API_KEY / WANJIE_API_KEY / WANJIE_MAAS_API_KEY
OpenRouter
openrouter
OPENROUTER_API_KEY
Novita AI
novita
NOVITA_API_KEY
Fireworks AI
fireworks
FIREWORKS_API_KEY
Moonshot/Kimi
moonshot
MOONSHOT_API_KEY / KIMI_API_KEY
SGLang
sglang
SGLANG_API_KEY
vLLM
vllm
VLLM_API_KEY
Ollama
ollama
OLLAMA_API_KEY

Open-model direction: support is expanding for OpenRouter, Hugging Face, and self-hosted endpoints — from cloud APIs to local deployments.

Shortcuts快捷键

TabCycle mode (Plan / Agent / YOLO)
Shift+TabCycle reasoning effort
Ctrl+LClear screen, keep session
Ctrl+CCancel current turn
Ctrl+DExit
/helpSlash command palette
/configEdit config interactively
/trustLift workspace boundary for session