Skip to content

About

A native Rust CLI for orchestrating AI agents across projects, with persistent sessions, worktrees, and local-first control.

Topics

Resources

Stars

212 stars

Watchers

1 watching

Forks

Latest commit

 

History

153 Commits

Folders and files

Repository files navigation

nca

nca running a task in the terminal

Rust-native coding agent. Single binary. Terminal-first.
v0.69.0 — recommended answers for questions, and a fixed question form in desktop clients

Install · Quick start · What's new · Commands · Providers · Docs


nca is a coding agent that ships as one Rust binary. Run it in a full-screen TUI, a line REPL, a one-shot task, or a background session you can attach to later. It also serves desktop clients over the Agent Client Protocol and emits JSON or NDJSON for scripts.

Highlights

  • Three ways to run: interactive TUI, line REPL, and one-shot or background sessions
  • Sessions you can pick up later: saved as JSON plus event logs, with resume, parent/child lineage, and git-worktree isolation for child agents
  • Context that fits the model window: older turns are compacted while tool calls stay whole
  • Many providers: MiniMax (default), Command Code, OpenAI, Anthropic, OpenRouter, Alibaba DashScope, and custom endpoints
  • Built-in tools and MCP: files, search, shell, web, questions, and MCP servers over stdio or HTTP
  • Skills: discovered from AGENTS.md, project folders, and user folders
  • Desktop clients: T3 Code, Zed, Termul, and any ACP v1 client

What's new in 0.69.0

  • Recommended answers. When the agent asks a question, the option it recommends is marked (recommend) and pre-selected. Press Enter or run /auto-answer in the TUI to take it. This works in the TUI, the CLI, and ACP clients.
  • Question form fixed in desktop clients. ACP clients now get the options as a choice list, plus an optional field for a custom answer. Before this, they got a single free-text box and never showed the options (#90). Clients without form support see the question and its options in the transcript.
Earlier releases

0.68.1

  • 200k fallback context window for unlisted models (was 32k), so early turns no longer compact aggressively.
  • Higher default output budget of 32,768 tokens (was 8,192), so reasoning models don't run out before they reply.
  • Clearer ACP output-limit messages before StopReason::MaxTokens.

0.68.0

  • Opt-in Parallel MCP web search. Add "parallel" to web.search_backends, for example search_backends = ["parallel", "keenable"]. No API key needed. See Configuration.
  • Fixed TUI external editor (/editor, Ctrl+X e). The editor gets the real terminal, and the TUI redraws afterward.

0.67.0

  • Command Code provider (commandcode). Set COMMAND_CODE_API_KEY. Claude models route to the messages API automatically. See Providers.
  • Raw completion mode (nca run --raw). Direct model calls with no agent prompt, no workspace context, and no tools. Supports multi-model sweeps, --max-cost, and JSONL logs.
  • Secret leak scanner (nca check-leaks <path>) finds leaked keys without printing them.

0.66.0

  • Regex search in pickers for models, sessions, branches, the command palette, and /connect.
  • Alibaba DashScope (Qwen) provider. Set DASHSCOPE_API_KEY or ALIBABA_API_KEY.
  • Dynamic installer and nca --version.
  • Word-wise editing: Ctrl+Left/Ctrl+Right move by word, and Ctrl+Backspace/Ctrl+Delete delete by word.

0.6.0

  • Cost matches your provider. Each model uses its own list price. A model with no known price shows cost n/a. You can add a [pricing] entry. See Configuration.
  • Cache hit share shown in the TUI sidebar and status bar (cached N%).
  • Compaction keeps the conversation. The summary now sees the real messages.
  • Search fallback chain. web_search tries Keenable first, then keyed APIs, then keyless engines.
  • ACP editors can supply MCP servers through session/new.
  • New default models: MiniMax-M3.1-Flash, gpt-6-luna (OpenAI and OpenRouter), and claude-sonnet-5-5 (Anthropic). If you want the previous models, set [model] and [provider] in config.

0.5.5

  • ACP desktop clients (nca acp), with streamed replies, tool cards, approvals, plans, modes, a model picker, and session load and delete.
  • Context always fits the model window. Old groups are evicted oldest first, and tool groups stay whole.
  • Prompts only for dangerous actions in default and accept-edits modes.
  • show_image shows a picture in the chat.

0.5.0

  • Read before edit. edit_file, apply_patch, and overwriting write_file need a prior read_file of the same file.
  • Paged reads. read_file takes start_line and end_line.
  • Resilient provider calls with backoff that honors Retry-After.
  • Desktop tools on macOS (preview): app_input and screen_record. See Desktop tools.
  • Remote MCP servers over streamable HTTP.

Install

One line (macOS and Linux). This installs the latest release to /usr/local/bin:

curl -fsSL https://nca-cli.com/install | bash
  • NCA_INSTALL_DIR changes the install path.
  • NCA_VERSION pins a version.
  • Windows: download the .zip from Releases and put nca.exe on your PATH.

Pre-built archives for macOS (Apple Silicon and Intel), Linux (x86_64 and ARM64), and Windows (x86_64) are on the Releases page.

Build from source

Requires Rust edition 2024 (use a recent toolchain).

git clone https://github.com/madebyaris/native-cli-ai.git
cd native-cli-ai
cargo build --release
cp target/release/nca /usr/local/bin/

Quick start

export MINIMAX_API_KEY="your-api-key"    # or run /connect in the TUI

nca                                                        # full-screen TUI
nca --no-tui                                               # line REPL
nca run --prompt "Explain this repository"                 # one task, then exit
nca spawn --prompt "Inspect the repo and draft a plan"     # background session
nca sessions                                               # list sessions
nca attach <session_id>                                    # attach to a running session

The full-screen UI opens when stdin and stdout are terminals and --stream human is active. Otherwise nca uses the line REPL or one-shot mode.

Check your setup with nca doctor, and inspect model selection with nca models.

Commands

Command What it does
nca Open the interactive UI. Resumes the last session unless you pass --no-resume.
nca run --prompt ... Run one task in the foreground. Add --raw for direct completions with no agent overhead.
nca spawn --prompt ... Start a detached session and return immediately.
nca resume <id> Resume a saved session.
nca attach <id> Attach to a running session over IPC.
nca logs <id> Read or follow the event log.
nca status <id> Show session status and metadata.
nca cancel <id> Mark a detached session as cancelled.
nca sessions List sessions. Filter with --status, --since-hours, or --search.
nca models Show configured models. Use --provider <name> [--grep <text>] to inspect a live catalog.
nca doctor Check provider readiness, skills, and config paths.
nca config Print the effective config and resolved paths.
nca memory list|add Inspect or add workspace memory notes.
nca skills List discovered skills and where each came from.
nca mcp List configured MCP servers.
nca check-leaks <path> Scan files for leaked API keys or secrets without printing them.
nca acp Serve the Agent Client Protocol on stdin and stdout for desktop clients.
nca index build|show Build or inspect the cached CLI index.
nca autoresearch once <program.md> Run a metric-driven research program and print parsed results.
nca completion <shell> Generate shell completions.

Lifecycle commands such as spawn, sessions, status, models, and doctor accept --json.

Interactive mode

The full-screen TUI has a transcript with markdown and syntax highlighting, a composer, overlays (palette, pickers, connect wizard), approvals, structured questions, a session sidebar, and a branch chip. The line REPL is for scripts, non-TTY sessions, and --no-tui.

All slash commands, the command palette, autocomplete, and /help come from one registry. In the palette, Enter runs the command.

Common slash commands

Command What it does
/help Show help.
/agent Pick an agent profile: build, plan, review, fix, or test.
/plan /review /fix /test Run a preset turn for that profile.
/skills Browse skills. /{skill} runs one.
/model Open the model picker.
/connect Choose a provider, enter an API key, or add a custom endpoint.
/status Session status and health (also /cost, /doctor).
/permissions Pick a permission mode.
/compact Compact the session context.
/copy Copy the last assistant reply.
/todos Show the session todo list.
/sessions /new /export /attach /logs Session lifecycle and inspection.
/image Stage a clipboard or file image for the next message.
/editor Open the external editor.
/mcp /diff /thinking /stop /clear /exit Tools and turn controls.
/auto-answer Accept the suggested answer for a pending question.

Keyboard shortcuts (TUI)

Key Action
Ctrl+P Open the command palette.
Ctrl+V Paste an image from the clipboard.
Ctrl+Shift+C Copy the last assistant reply.
Ctrl+X then m e l n c s a h q Leader shortcuts: model, editor, sessions, new, compact, status, agent, help, exit.
Ctrl+Y / Ctrl+N / Ctrl+U Approve, deny, or always allow a pending tool.
Tab Complete an @ path or / command. Otherwise cycle the agent profile.
F2 / Shift+F2 Cycle recent models.
Ctrl+L Clear the transcript.
Esc / Ctrl+C Cancel the current turn while busy.
! <cmd> Run a shell command.
@ <path> Mention a file with fuzzy completion.

Click the branch chip in the status line to switch or create branches.

Images

In the TUI, attach images to the next message with Ctrl+V, /image paste, or /image path/to/file.png. /image clear removes staged images. MiniMax image analysis runs in Rust. If the selected model can't take images, nca returns an error instead of dropping them silently.

Providers

MiniMax is the default. nca also supports Command Code, OpenAI, Anthropic, OpenRouter, Alibaba DashScope, and custom endpoints. Set the key for the provider you use:

Provider Environment variable
MiniMax (default) MINIMAX_API_KEY
Command Code COMMAND_CODE_API_KEY (env only; never written to config or logs)
OpenAI OPENAI_API_KEY
Anthropic ANTHROPIC_API_KEY
OpenRouter OPENROUTER_API_KEY
Alibaba DashScope DASHSCOPE_API_KEY or ALIBABA_API_KEY
Custom OpenAI- or Anthropic-compatible endpoint CUSTOM_PROVIDER_API_KEY

You can also add a provider from the TUI with /connect. Config loads in this order: built-in defaults, ~/.local/share/ncacli/config.toml, <workspace>/.nca/config.local.toml, then environment variables. See Providers for details.

Command Code and raw mode

Command Code routes non-Claude models to its chat completions API and Claude models to its messages API. Plan-blocked models are cached and flagged in nca models.

export COMMAND_CODE_API_KEY="your-command-code-key"

# Find models by name
nca models --provider commandcode --grep gemini

# One raw completion: no agent prompt, no workspace context, no tools
nca run --raw --provider commandcode -m google/gemini-3.8-flash \
  --system brief.md "Write 5 concise landing-page headlines."

# A/B sweep across models, with per-model output, a JSONL cost log, and a budget cap
nca run --raw --provider commandcode \
  --system brief.md --max-tokens 16000 --reasoning-effort low --temperature 0.5 \
  -m google/gemini-3.8-flash -m Qwen/Qwen4-Max \
  --out results/ --log results/calls.jsonl --max-cost 0.50 \
  "Draft launch copy for the CLI release."

# Scan the output before you share or commit it
nca check-leaks results/

Desktop clients (ACP)

nca acp turns the same binary into an Agent Client Protocol server. Desktop clients run it as a local subprocess:

Command: nca
Args:    acp

Clients get streamed replies, tool cards with file locations, approvals, plans, a model picker, permission modes, session list, load, and delete with history replay, slash commands, compaction updates, and a context-usage meter. Questions appear as a choice list with the recommended option pre-selected. See Desktop clients.

Tools

The built-in tools cover file editing, search, diffs, patches, shell, web access, ask_question, and spawn_subagent. MCP tools load dynamically from your config. See Tools for parameters.

  • Search: search_code returns structured matches, and query_symbols does literal Rust symbol lookup.
  • Edits: edit_file and apply_patch fail loudly on ambiguous matches. replace_match edits one search result by path, line, and column.
  • Read before edit: existing files must be read in the session before they're changed.

Desktop tools (macOS)

  • app_input lists an app's controls, presses a control, types text into a background app, or opens an http(s) link in an app without taking focus. It needs Accessibility permission.
  • screen_record records one window for up to 600 seconds, stops a recording, or saves a screenshot. It needs Screen Recording permission.

Both ask for approval by default and are denied in Plan and DontAsk modes. Calculator and Dia are the apps tested so far.

Sessions, skills, and context

  • Sessions are saved as JSON snapshots with JSONL event logs. The runtime supervisor owns lifecycle, IPC, approvals, questions, and persistence. Child sessions record their lineage and can run in their own git worktrees.
  • Skills come from AGENTS.md (each ## Heading becomes a skill), .nca/skills/, ~/.local/share/ncacli/skills/, and ~/.claude/skills/. Run nca skills --json to see the sources.
  • Context is fitted to the model window on every request. Long sessions shrink instead of overflowing, and tool groups stay whole. Configure it under [memory.context]. The default smart_compaction_mode = "on" leaves saved history intact. Use dry_run to see the savings in /status.

Output and automation

  • --stream off prints only the final output.
  • --stream human shows the normal terminal view.
  • --stream ndjson emits newline-delimited event envelopes.
  • --json is available on lifecycle commands.
  • NCA_ORCH_* environment variables attach orchestration metadata. See Orchestration contract.

Where things live

nca stores session, memory, and cache data under the product home: $NCA_HOME, $XDG_DATA_HOME/ncacli, or ~/.local/share/ncacli/.

Path What it holds
~/.local/share/ncacli/config.toml Global config.
<workspace>/.nca/config.local.toml Workspace overrides.
~/.local/share/ncacli/workspaces/<id>/sessions/ Session state (.json) and event logs (.events.jsonl).
<workspace>/AGENTS.md Repo instructions. Each ## Heading is also a skill.
<repo>/.nca/worktrees/<session-id> Worktree for an isolated child session.

The full list is in Configuration.

Speed and memory

On one Mac (Darwin 27), nca used about 6 MB of RAM for a short prompt. That compares with 59 MB for Grok CLI and 162 MB for Claude Code. Wall time mostly reflects each provider's model, so RAM and CPU are the fair client-side numbers. Details and method: CLI speed and footprint.

Crate layout

Crate Responsibility
crates/common Shared config, events, sessions, messages, tool schemas, and orchestration metadata.
crates/core Agent loop, provider abstraction, harness, skills, approvals, and tool registry.
crates/runtime Session supervision, IPC, persistence, worktrees, memory, context management, and subagents.
crates/tui Full-screen TUI, line REPL, slash commands, overlays, and transcript rendering.
crates/acp Agent Client Protocol server for desktop clients.
crates/cli The nca binary, clap commands, and stream rendering.
crates/autoresearch Metric-driven research helpers and experiment runner.

The shipped app is a single binary, nca.

Documentation

Full user documentation lives in docs/documentation/:

Page What it covers
Getting started Installation, first run, and initial config
Commands Full CLI and flag reference
Interactive mode TUI, REPL, slash commands, and shortcuts
Configuration Config files, TOML format, and environment variables
Providers Setup for each LLM provider
Tools Every agent tool
Sessions Lifecycle, persistence, resume
Permissions Approvals, permission modes, and safe mode
Skills Discovery, installation, and authoring
Advanced Sub-agents, MCP servers, hooks, and IPC
Desktop clients (ACP) Running nca from T3 Code, Zed, and other clients

Design docs: Architecture · Product requirements · Tech stack · Context management · Orchestration

Funding

nca is an independent project built by Aris Setia. It is not backed by a company and isn't tied to a single provider. MiniMax has supported the work through content collaboration and developer events in Indonesia.

If nca is useful to you and you want to help keep it going:

Channel Link
GitHub Sponsors github.com/madebyaris
PayPal paypal.me/airs (arissetia.m@gmail.com)

License

MIT

About

A native Rust CLI for orchestrating AI agents across projects, with persistent sessions, worktrees, and local-first control.

Topics

Resources

Stars

212 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages