71 lines
1.7 KiB
Markdown
71 lines
1.7 KiB
Markdown
# nanocode
|
|
|
|
Minimal Claude Code alternative. Single Python file, zero dependencies, ~250 lines.
|
|
|
|
Built using Claude Code, then used to build itself.
|
|
|
|

|
|
|
|
## Features
|
|
|
|
- Full agentic loop with tool use
|
|
- Tools: `read`, `write`, `edit`, `glob`, `grep`, `bash`
|
|
- Conversation history
|
|
- Colored terminal output
|
|
|
|
## Usage
|
|
|
|
```bash
|
|
export ANTHROPIC_API_KEY="your-key"
|
|
python nanocode.py
|
|
```
|
|
|
|
### OpenRouter
|
|
|
|
Use [OpenRouter](https://openrouter.ai) to access any model:
|
|
|
|
```bash
|
|
export OPENROUTER_API_KEY="your-key"
|
|
python nanocode.py
|
|
```
|
|
|
|
To use a different model:
|
|
|
|
```bash
|
|
export OPENROUTER_API_KEY="your-key"
|
|
export MODEL="openai/gpt-5.2"
|
|
python nanocode.py
|
|
```
|
|
|
|
## Commands
|
|
|
|
- `/c` - Clear conversation
|
|
- `/q` or `exit` - Quit
|
|
|
|
## Tools
|
|
|
|
| Tool | Description |
|
|
|------|-------------|
|
|
| `read` | Read file with line numbers, offset/limit |
|
|
| `write` | Write content to file |
|
|
| `edit` | Replace string in file (must be unique) |
|
|
| `glob` | Find files by pattern, sorted by mtime |
|
|
| `grep` | Search files for regex |
|
|
| `bash` | Run shell command |
|
|
|
|
## Example
|
|
|
|
```
|
|
ââââââââââââââââââââââââââââââââââââââââ
|
|
⯠what files are here?
|
|
ââââââââââââââââââââââââââââââââââââââââ
|
|
|
|
⺠Glob(**/*.py)
|
|
â¿ nanocode.py
|
|
|
|
⺠There's one Python file: nanocode.py
|
|
```
|
|
|
|
## License
|
|
|
|
MIT |