Skip to content
FlyCockpit
Cockpit Code/ Overview & Quick Start
Cockpit Code logo

Cockpit Code — Overview & Quick Start

RustMITTarget v1.0.0
Repository

Terminal coding agent written in Rust with an interactive TUI, headless CLI mode, autonomous goals, and an ACP server for editors.

Platforms: Linux (static musl) · macOS (Apple Silicon & Intel)

Cockpit Code (cockpit-code) is a terminal coding agent written in Rust that you can use in three ways: interactively in a full-screen terminal UI, non-interactively in scripts and CI (-p), or inside editors over the Agent Client Protocol (ACP v1) via cockpit-code acp.

All three interfaces share a single in-process Rust engine. Cockpit Code speaks Anthropic Messages, OpenAI Chat Completions, and OpenAI Responses natively—plus any custom gateway, local server, or subscription CLI wrapped behind its JSONL Command Provider Protocol (cockpit-code.provider/1). All configuration lives in plain JSON files, and credentials stay in environment variables (${VAR}).

Architecture

Cockpit Code is organized as a Rust workspace where one in-process engine drives three front ends:

+--------------------+   +--------------------+   +--------------------+
| Interactive TUI    |   | Headless CLI (-p)  |   | ACP v1 Stdio Server|
| (code-tui)         |   | (apps/cockpit-code)|   | (code-acp -> Zed)  |
+---------+----------+   +---------+----------+   +---------+----------+
          |                        |                        |
          +------------------------+------------------------+
                                   |
                                   v
+----------------------------------+-----------------------------------+
| In-Process Agent Engine (code-engine)                                |
|  - Durable & forkable sessions, compaction, pruning, guidance        |
|  - Permission gate (manual / auto / unattended / yolo)               |
|  - Subagent trees/flat workers, autonomous /goal contracts & review  |
|  - Tools: file ops, grep, AST code, PTY bash/jobs, Monty Python VM   |
|  - MCP client (stdio / http / sse) & bring-your-own local LSPs       |
+-----------------+----------------------------------+-----------------+
                  |                                  |
                  v                                  v
+-----------------+----------+     +-----------------+-----------------+
| Configuration (code-config)|     | Model Providers                   |
| ~/.config/cockpit-code/    |     | - Native HTTP: anthropic,         |
| (or $COCKPIT_CODE_HOME)    |     |   openai-chat, openai-responses   |
| Live reload at turn bounds |     | - Command providers (JSONL/text)  |
+----------------------------+     | - Usage readers (usage/1)         |
                                   +-----------------------------------+
Crate / Binary Responsibility
apps/cockpit-code Main binary: CLI argument parsing, init, doctor, discover, provider, sessions, compact, prune, guidance, and headless -p runner.
crates/code-engine Core agent engine: sessions, tool execution, models, permission gates, MCP, LSP, subagents, goals, and usage cache.
crates/code-tui Full-screen interactive terminal UI with mouse support, vim composer, diff/cost/usage dialogs, agent tree, and private user terminal sidebar.
crates/code-acp Agent Client Protocol (v1) stdio server for editors such as Zed.
crates/code-config Configuration directory resolution, JSON validation, ${ENV} expansion, and live reload.

Platforms & Prerequisites

  • Prebuilt binaries: Linux (x86_64-unknown-linux-musl, aarch64-unknown-linux-musl—statically linked with musl to run on any glibc or musl distro) and macOS (aarch64-apple-darwin, x86_64-apple-darwin). HTTPS uses the OS certificate store with bundled Mozilla root certificates as fallback.
  • Building from source: Linux or macOS, Rust 1.99+ (2024 edition via rustup), and a C compiler (required by tree-sitter grammars and aws-lc/ring crypto dependencies).

Installation

Prebuilt Release Binaries

Download the archive and SHA256SUMS from GitHub Releases, verify the checksum and GitHub build provenance attestation, and install onto your PATH:

VERSION=1.0.0
TARGET=x86_64-unknown-linux-musl   # or aarch64-unknown-linux-musl, aarch64-apple-darwin, x86_64-apple-darwin
BASE="https://github.com/FlyCockpit/cockpit-code/releases/download/v$VERSION"

curl -fsSLO "$BASE/cockpit-code-$VERSION-$TARGET.tar.gz"
curl -fsSLO "$BASE/SHA256SUMS"

# Verify SHA-256 checksum (macOS: shasum -a 256 --check --ignore-missing SHA256SUMS)
sha256sum --check --ignore-missing SHA256SUMS

# Optional: verify signed GitHub build provenance attestation
gh attestation verify "cockpit-code-$VERSION-$TARGET.tar.gz" --repo FlyCockpit/cockpit-code

tar -xzf "cockpit-code-$VERSION-$TARGET.tar.gz"
mkdir -p ~/.local/bin
install -m 0755 "cockpit-code-$VERSION-$TARGET/cockpit-code" ~/.local/bin/

Build from Source

Crates are not published to crates.io. Clone and build directly from Git:

git clone https://github.com/FlyCockpit/cockpit-code.git
cd cockpit-code

# Install full binary (TUI + headless + ACP) into ~/.cargo/bin
cargo install --locked --path apps/cockpit-code

# Or build headless + ACP only (omits the terminal UI)
cargo install --locked --path apps/cockpit-code --no-default-features

Quick Start

1. Scaffold Configuration (cockpit-code init)

Use cockpit-code init to create starter configuration files. init never writes API keys to disk—it writes ${ENV_VAR} references only and keeps existing files unless you pass --force:

cockpit-code init \
  --provider anthropic \
  --key-env ANTHROPIC_API_KEY \
  --default-model anthropic/claude-opus-5-5

Available --provider templates are openrouter, openrouter-anthropic, openai, openai-chat, anthropic, and command (repeatable). Useful optional flags include --default-mode manual|auto|unattended|yolo, --safety-model provider/model, --skill-target claude|codex|<path>, and --json.

Note: init writes a minimal starter model entry (text-only, 8,192 output tokens). Edit providers/<id>.json afterward to set accurate contextWindow, maxOutputTokens, reasoning, capabilities, and cost values.

2. Export Credentials & Verify (cockpit-code doctor)

Export your provider key in your shell environment and verify that configuration, providers, models, MCP servers, and local LSPs resolve cleanly:

export ANTHROPIC_API_KEY="sk-ant-..."
cockpit-code doctor

doctor prints CONFIG, DATA, and CACHE paths, lists loaded providers, models, MCPs, and detected LSPs, and exits non-zero if no usable text-output model exists or if defaultModel / permissions.autoModel cannot resolve. Pass --probe <provider> to test which HTTP API dialects a custom gateway accepts.

3. Run Interactive or Headless

# Start the interactive TUI in the current directory
cockpit-code

# Run a single headless task and exit
cockpit-code -p "fix the failing test"

Known Limitations

  • No built-in OS sandbox: Cockpit Code intentionally does not sandbox the agent. Permission modes decide when to ask for approval, but approved or unprompted tools execute with your user’s OS privileges. Run cockpit-code inside a VM, container, or external sandbox (such as WS Sandbox Proxy) whenever you need OS-level isolation.
  • Bring-your-own LSPs: Cockpit Code detects installed language servers (rust-analyzer, typescript-language-server, basedpyright-langserver/pyright-langserver, gopls, clangd) and shows install hints, but never downloads or manages LSP binaries for you.
  • No MCP OAuth: Remote MCP servers (http / sse) authenticate via ${VAR} headers or environment variables; interactive OAuth flows are not supported for MCP servers.
  • Stateful command providers (history: "latest"): Command providers that maintain server-side conversation state instead of replaying full history disable hidden forks (/btw), automatic session titles, and selfEvaluateWrites.
  • Not published on crates.io: Install from GitHub Releases or build from a Git checkout.