Whale

Features

Everything you need for efficient AI-assisted coding in the terminal.

Cache-First Loop

Whale's context layout treats DeepSeek's prefix-cache as a first-class citizen. The system prompt, tool specs, and skills form an immutable prefix that stays stable across turns. Conversation history appends in append-only mode. This means long sessions keep benefiting from cached prefixes — delivering ~90% cache hit rates in practice.

┌─────────────────────────────────────┐
│ Immutable prefix                    │ ← fixed across turns
│ system + tool specs + skills        │    cache target
├─────────────────────────────────────┤
│ Append-only dialog log              │ ← appended each turn
│ [user][assistant][tool][user]...    │    keeps prefix stable
├─────────────────────────────────────┤
│ Scratch area                        │ ← reset each turn
│ reasoning / intermediate results    │    no downstream reuse
└─────────────────────────────────────┘

Tool-Call Repair

DeepSeek's tool-call output can include malformed JSON, escaped content, or missing parameters. Whale includes a dedicated repair layer that handles these edge cases.

Scavenge

Recovers tool-calls from reasoning content when the model emits them outside the tool block.

Flatten

Automatically flattens deep schemas to prevent parameter drops.

Recovery

Handles JSON truncation, stringified arrays, null fields, and callback storms.

TUI & Slash Commands

Whale's terminal UI is built with Bubble Tea in Go. Every interaction stays inside your terminal.

Command Purpose
whaleStart the interactive TUI
whale exec "prompt"Run a one-shot prompt non-interactively
whale setupSave a DeepSeek API key
whale doctorRun health checks
whale resumeReopen a previous session
/askRead-only question mode
/planPlan first, decide whether to execute
/reviewCode review for local changes, branches, PRs
/compactCompact the current conversation context
/focusToggle focused view (hide thinking/tool details)

MCP & Skills

Extend Whale's capabilities without modifying the core toolset.

MCP Support

Load external tools from MCP servers. Whale connects to standard MCP servers to add custom tooling for databases, APIs, cloud services, and more.

Agent Skills

Reusable workflows for team conventions, code review, testing, or tool-specific guidance. Type $skill-name in the TUI to invoke a skill.

Isolated Worktrees

Use whale --worktree <name> to create an isolated git worktree for each feature or bug fix. Changes stay in their own branch, and Whale cleans up after you.

whale --worktree feature-x
whale exec --worktree feature-x "implement and test this change"