Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

nanocode-cli

A coding agent I use, maintain, and customize in one Python file.

nanocode demo

Editing code and running tools in one interactive session.

中文

Install

Requires Python 3.11+ and uv.

uv tool install nanocode-cli
nanocode --init-config

Configure any OpenAI-compatible provider in ~/.nanocode/config.toml. For example, DeepSeek Flash:

[provider]
active = "default"

[provider.default]
url = "https://api.deepseek.com"
key = "API_KEY"
model = "deepseek-v4-flash"

Replace url, key, and model with the values from your provider.

Then start:

nanocode

Upgrade: uv tool upgrade nanocode-cli

Common flags:

  • -c, --last, --latest: resume the latest session in the current project
  • --resume [UID]: resume a saved session; without UID, resumes latest
  • --yolo: skip tool confirmations
  • --mcp <selector>: choose which MCP servers to enable
  • --config <path>: use a specific TOML config file

A working personal agent

nanocode does not introduce a new kind of coding agent. It combines familiar features—reading and editing files, running commands, follow-ups, sessions, diffs, MCP, and skills—into a tool I use personally.

It works on real repositories, including its own: I use nanocode to build and maintain nanocode. Everything ships in one Python module, so I can change the behavior directly whenever I want the workflow to work differently.

nanocode session

Resuming a saved session with its conversation and tool history.

Highlights

  • Live follow-ups: type while the agent works; queued input joins the next model request or can interrupt the current one.
  • Anchored edits: structured edits use line:hash anchors and reject stale file content instead of guessing.
  • Resumable sessions: conversation, completed tool calls, diffs, and working memory survive interruption and -c or --resume.
  • Built-in diff viewer: /diff shows changes from the latest user round and the net session result.
  • Prompt-cache aware: stable instructions, environment, and tool schemas preserve reusable request prefixes.
  • Provider compatibility: tested with DeepSeek, OpenCode, Alibaba Cloud, and ZenMux; other OpenAI-compatible endpoints should work in principle. Anthropic APIs, remote/local MCP servers, and Markdown skills are also supported.

Common commands

Command Description
/help Show the complete command and tool reference
/status Runtime status: token usage, context %, cache hit rate
/context Model context frame — environment and memory (goal/plan/known/check)
/diff Latest edit diffs and net session diff (interactive, tabbed)
/compact Compact context now
/mcp Manage MCP servers and tools
/model [MODEL] Show or switch model
/yolo Toggle tool confirmations

Run /help for every command and tool. Interactive selectors support j/k, arrows, / search, Enter, and Esc; input supports history completion, Ctrl-R search, and Ctrl-X to edit the current input in $EDITOR (falling back to vim).

Configuration

Config file: ~/.nanocode/config.toml

The generated file documents common provider and runtime options. Multiple [provider.<name>] sections are supported; select one with [provider] active = "name". Use /config to inspect the active configuration and /help for runtime commands.

MCP

Connect to Model Context Protocol servers and expose their tools through MCP.

Remote server (HTTP):

[mcp.example]
url = "https://example.com/mcp"
bearer_token_env_var = "EXAMPLE_MCP_TOKEN"  # optional
enabled = true

Local server (stdio):

[mcp.filesystem]
command = "npx"
args = ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
enabled = true

Runtime management: /mcp to view status, /mcp tools [server] to list tools, /mcp login/logout <server> for OAuth.

Skills

Skills are instruction packs the agent loads on demand. Each skill is a folder with a SKILL.md.

  • Discovery: .nanocode/skills/ (project) and ~/.nanocode/skills/ (user); project wins on name clash
  • Model view: only a name + description index sits in context; the full body loads on Skill(name) call
  • Inline reference: type $name in a message (Tab-completes) to inject that skill's instructions
  • Bundled scripts: {skill_dir} expands to the skill's absolute path for running via Bash
  • Built-in: ships with a nanocode-help skill containing a self-contained manual and auto-generated command/tool/config lists

Safety

Use at your own risk. nanocode can edit files and run shell commands in the environment where it is started. It does not provide sandbox protection. Run it inside your own sandbox, container, VM, or other isolated environment when needed.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nanocode_cli-0.9.9.tar.gz (124.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nanocode_cli-0.9.9-py3-none-any.whl (120.2 kB view details)

Uploaded Python 3

File details

Details for the file nanocode_cli-0.9.9.tar.gz.

File metadata

  • Download URL: nanocode_cli-0.9.9.tar.gz
  • Upload date:
  • Size: 124.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for nanocode_cli-0.9.9.tar.gz
Algorithm Hash digest
SHA256 b5b1a77ca82a2c94236ff573e9988a0ada80149e104636771d3a50e0ba297a8c
MD5 fb4ae907f2a3f5de336820b6f10835fa
BLAKE2b-256 3d841961d2e8359c507e6a6ada7dd7ebd264d81ed22bd6e7f1eaf9ee5812b414

See more details on using hashes here.

File details

Details for the file nanocode_cli-0.9.9-py3-none-any.whl.

File metadata

  • Download URL: nanocode_cli-0.9.9-py3-none-any.whl
  • Upload date:
  • Size: 120.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for nanocode_cli-0.9.9-py3-none-any.whl
Algorithm Hash digest
SHA256 5461525c80c03358f2c7238e2cdd19eba1a165575c94f60d6e0edcc7dff16e52
MD5 72f49ac32bef9ede675960aba38afbc7
BLAKE2b-256 1d051b1b9f4b2753d5e1063deb0f3fffd85287c289357a8de773fab25cbdabe1

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.9.9 This release

2 files

0.9.8

2 files

0.9.7

2 files

0.9.6

2 files

0.9.4

2 files

0.9.2

2 files

0.9.1

2 files

0.7.2

2 files

0.7.1

2 files

0.7.0

2 files

0.6.6

2 files

0.6.4

2 files

0.6.3

2 files

0.6.2

2 files

0.6.1

2 files

0.5.7

2 files

0.5.4

2 files

0.5.2

2 files

0.5.1

2 files

0.5.0

2 files

0.4.9

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page