# Nanocoder

> A community-built terminal coding agent that runs on whichever model you point it at, local or hosted

- Category: AI Coding / Autonomous Coding Agents
- Language: TypeScript
- Licence: MIT
- Repository: https://github.com/Nano-Collective/nanocoder
- Website: https://docs.nanocollective.org/nanocoder
- Canonical page: https://ai-tldr.dev/tools/nanocoder/

## In short

Nanocoder is an open-source coding agent that lives in your terminal. It sits in the Autonomous Coding Agents category of the AI Coding tools and is open-source, written in TypeScript and licensed MIT. To get started: install the CLI.

## Overview

Nanocoder is an open-source coding agent that lives in your terminal. You start it in a project directory, describe what you want in plain language, and it reads files, edits code, runs shell commands and reports back, asking for approval along the way according to the mode you picked. It is built by the Nano Collective, a community group rather than a company, and the project states plainly that there are no paid tiers and no closed-source features gating the useful parts.

The defining choice is that the model is yours. Nanocoder talks to local models through Ollama or to any OpenAI-compatible API, and the README names OpenRouter, Anthropic and Google as examples; the CLI also has device-code logins for GitHub Copilot and ChatGPT/Codex. Providers are declared in an `agents.config.json` file — per user, per project, or both — and a `--provider` / `--model` pair on the command line picks one for a single run. The collective frames this as a principle: the harness stays multi-provider so you are never tied to one vendor, and your code does not leave your machine unless you send it to a hosted model.

Control over what the agent may do is organised into five development modes, cycled with Shift+Tab: normal (confirm every tool that can change something), auto-accept (most tools run, but bash and commits still prompt), yolo (nothing prompts), plan (mutation tools are removed and the agent writes a plan for you to approve) and architect (edits run, then you keep or revert the whole turn). Around that sit the pieces you would expect from a mature agent: checkpoints you can roll back to, auto-saved sessions you can resume, context compaction, a task list, and a `@` file picker with line-range support.

It is also built to be extended and embedded. Skills bundle custom slash commands, subagents with their own context and model, model-callable shell-script tools and cron or file-change triggers run by a per-project daemon. Lifecycle hooks run your own shell command before or after a tool call and can veto it. MCP servers add tools, `nanocoder --acp` turns it into an Agent Client Protocol server for editors such as Zed, and a VS Code extension shows live diffs of proposed changes. A non-interactive `run` command with optional JSON output covers scripts and CI.

## What it does

- Bring your own model: local models via Ollama or any OpenAI-compatible API, configured per user or per project in agents.config.json and switchable mid-session with /model
- Five development modes — normal, auto-accept, yolo, plan and architect — cycled with Shift+Tab or chosen at launch with --mode
- Checkpoints, auto-saved and resumable sessions, context compaction and a built-in task list for long pieces of work
- Skills that bundle slash commands, subagents, custom shell-script tools and cron or file-change triggers, plus lifecycle hooks that can block a tool call
- MCP servers for extra tools, an ACP server mode for Zed and other editors, and a VS Code extension with live diff previews
- Headless `nanocoder run` for scripts and CI, with a --json flag that prints one structured result object, and a `nanocoder review` command for branch or PR diffs

## Getting started

Nanocoder is a Node.js CLI published on npm, with Homebrew and Nix Flakes as alternatives. You install it once, then run it inside whichever project you want to work on.

1. Install the CLI

   npm is the documented default. On macOS or Linux you can use the project's own Homebrew tap instead.

```bash
npm install -g @nanocollective/nanocoder

# or, with Homebrew
brew tap nano-collective/nanocoder https://github.com/Nano-Collective/nanocoder
brew install nanocoder
```

2. Start it in a project and add a provider

   The first launch in a directory asks you to confirm that you trust it. Configure a provider when prompted, or open the interactive wizard with `/settings providers`. Providers are stored in `agents.config.json`.

```bash
cd your-project
nanocoder
```

3. Give it project context

   `nanocoder init` analyses the repository and writes an `AGENTS.md` that is loaded into every session. Bundled presets add stack-specific guidance, a `.nanocoderignore` and a `/check` command.

```bash
nanocoder init
# or with a preset
nanocoder init --preset nextjs
```

4. Work interactively

   Type a request and press Enter. Use `@` to attach a file (optionally a line range such as `@src/utils.ts:45-80`), `!` to run a shell command whose output becomes context, and Shift+Tab to change how much the agent may do without asking. `/help` lists every slash command.

5. Pick a provider and mode from the command line

   Flags choose the provider, model and starting mode for one launch. The provider name must match one in your config.

```bash
nanocoder --provider ollama --model llama3.1
nanocoder --mode plan
```

6. Run it headless

   `run` executes one prompt and exits, auto-accepting tools by default; add `--mode` to change that. `--trust-directory` skips the first-run trust prompt in CI.

```bash
nanocoder run "write unit tests for all functions in utils.js"
nanocoder --trust-directory --mode plan run "audit the auth module"
```

## When to use it

- Reach for it when you want a terminal coding agent that runs against a local Ollama model, so the code and the prompts stay on your machine
- Reach for it when your team mixes providers and you want one agent, one config file and one set of habits across all of them
- Reach for it to script coding tasks in CI with `nanocoder run`, using plan mode for read-only audits and JSON output for parsing the result
- Reach for it when you prefer a community-governed, MIT-licensed tool with no paid tier over a vendor's own agent
