Nano: Coding agent in under 200 lines

kristianp1 pts0 comments

GitHub - pnegahdar/nano: One file. Under 200 lines. Zero dependencies. It's a coding agent. · GitHub

/" data-turbo-transient="true" />

Skip to content

Search or jump to...

Search code, repositories, users, issues, pull requests...

-->

Search

Clear

Search syntax tips

Provide feedback

--><br>We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Cancel

Submit feedback

Saved searches

Use saved searches to filter your results more quickly

-->

Name

Query

To see all available qualifiers, see our documentation.

Cancel

Create saved search

Sign in

/;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up

Appearance settings

Resetting focus

You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

pnegahdar

nano

Public

Notifications<br>You must be signed in to change notification settings

Fork

Star<br>133

main

BranchesTags

Go to file

CodeOpen more actions menu

Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit

History<br>8 Commits<br>8 Commits

.gitignore

.gitignore

README.md

README.md

demo.gif

demo.gif

nano.py

nano.py

View all files

Repository files navigation

nano.py

The models got good enough that the harness doesn't matter anymore.<br>So we made the smallest one that proves it. One file. under 200 lines. Zero dependencies.

python3 curl -s https://raw.githubusercontent.com/pnegahdar/nano/main/nano.py)

That's the whole thing. No, really.

Everything below ships in under 200 lines. We counted.

📂 Reads CLAUDE.md, AGENT.md, AGENTS.md, README.md — automatic repo context, same files the real agents use

🧩 Discovers skill files — finds SKILL.md from .claude/skills, ~/.claude/skills, ~/.codex/skills, ~/.codex/plugins

🛡️ Human-in-the-loop approvals — every command shows what and why before it runs

🔁 200-step agentic loop — keeps going until the job is done, not until it gets bored

💬 Interactive REPL — multi-turn sessions with persistent memory across turns

⚡ Non-interactive CLI — ./nano.py "fix the tests" and walk away

🔄 Session resume — ./nano.py -c picks up where you left off, zero local state (OpenAI stores the conversation)

Plus: interactive REPL · one-shot mode · session resume (-c) · session picker (-s) · GPT-5.5 by default · any model via env var · multi-step tool chaining · approve-one / approve-all / deny · auto-approve mode · per-command cwd, timeout, and env · platform-aware system prompt · output capped at 12KB · forced 5-10 word command descriptions · session reset · zero dependencies · pure stdlib Python · one file you can read in 5 minutes

Most coding agents are built on top of serious infrastructure — frameworks,<br>runtimes, graph orchestrators, thousands of lines of glue.

It turns out you can get surprisingly far with a while loop, one shell tool,<br>and a model that's good enough.

nano.py is that loop. It sends context to GPT-5.5, lets it run shell commands,<br>shows you what it wants to do, waits for your approval, and repeats until the job<br>is done. Pure Python stdlib. Copy it into any repo and go.

Quick Start

# Run it straight from GitHub — no install, no clone, drops into a REPL<br>python3 curl -s https://raw.githubusercontent.com/pnegahdar/nano/main/nano.py)

# Or grab it<br>curl -O https://raw.githubusercontent.com/pnegahdar/nano/main/nano.py && chmod +x nano.py

# One-shot<br>OPENAI_API_KEY=sk-... ./nano.py "find the bug in auth.py and fix it"

# Interactive REPL<br>OPENAI_API_KEY=sk-... ./nano.py

# Continue last session in this directory<br>OPENAI_API_KEY=sk-... ./nano.py -c

# Pick from recent sessions<br>OPENAI_API_KEY=sk-... ./nano.py -s

# YOLO mode (auto-approve everything, godspeed)<br>NANO_APPROVE=all OPENAI_API_KEY=sk-... ./nano.py "run the tests and fix whatever breaks"

What It Doesn't Do

Install packages

Require a config file

Need a Docker container

Have a plugin system

The Architecture

while not done:<br>response = ask_model(context)<br>if response.wants_to_run_command:<br>if human_approves(command):<br>result = subprocess.run(command)<br>context.append(result)<br>else:<br>print(response)<br>done = True

That's the architecture diagram.

Safety

This gives a language model a shell on your computer.

Approval is on by default. Every command shows you what it wants to run and why.

You can approve one at a time , or press a to approve all for the session.

NANO_APPROVE=all skips all prompts. Only use this when you trust the workspace and the task.

Output is capped at 12KB per command so the model can't filibuster itself.

Read the command before you press y. It's under 200 lines — you can audit the whole thing over lunch.

Configuration

Variable<br>Default<br>What it does

OPENAI_API_KEY<br>Required.

OPENAI_MODEL<br>gpt-5.5<br>Any model the Responses API supports.

NANO_MAX_STEPS<br>200<br>Max tool calls per task before...

nano session command lines approve openai_api_key

Related Articles