nanocode

January 12, 2026 · View on GitHub

Minimal Claude Code alternative. Single Python file, zero dependencies, ~250 lines.

Built using Claude Code, then used to build itself.

screenshot

Features

  • Full agentic loop with tool use
  • Tools: read, write, edit, glob, grep, bash
  • Conversation history
  • Colored terminal output

Usage

export ANTHROPIC_API_KEY="your-key"
python nanocode.py

OpenRouter

Use OpenRouter to access any model:

export OPENROUTER_API_KEY="your-key"
python nanocode.py

To use a different model:

export OPENROUTER_API_KEY="your-key"
export MODEL="openai/gpt-5.2"
python nanocode.py

Commands

  • /c - Clear conversation
  • /q or exit - Quit

Tools

ToolDescription
readRead file with line numbers, offset/limit
writeWrite content to file
editReplace string in file (must be unique)
globFind files by pattern, sorted by mtime
grepSearch files for regex
bashRun shell command

Example

────────────────────────────────────────
❯ what files are here?
────────────────────────────────────────

⏺ Glob(**/*.py)
  ⎿  nanocode.py

⏺ There's one Python file: nanocode.py

License

MIT