Model or dataset
he-yufeng/CoreCoder avatar
he-yufeng/CoreCoder

CoreCoder: A 1,161-Line Coding Agent You Can Read in an Afternoon

Minimal AI coding agent (~1,000 lines of Python) inspired by Claude Code. Works with any LLM. Think NanoGPT for coding agents. Formerly NanoCoder.

1,740 stars414 forksPythonMIT

At a glance

What is it?
CoreCoder is a minimal Python coding agent that runs a real read-edit-execute loop against any OpenAI-compatible model. It is built as a runnable reference for engineers who want to understand or fork an agent, not as a daily driver.
Who is it for?
Adopt CoreCoder if your goal is to read, breakpoint and fork an agent loop rather than to replace your terminal assistant. Skip it if you need multi-file refactoring at scale or a mature plugin ecosystem; the README states the gaps are deliberate.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 2 days ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 15, 2026, and from our analysis. They are not legal advice.

DEEP OPEN-SOURCE ANALYSIS

The problem CoreCoder picks: agents explained badly

Most writing about coding agents treats them as opaque. CoreCoder starts from the opposite claim, stated in the README: strip a tool like Claude Code or Cursor down and the core is a while loop around a large model plus seven or eight tools. The project exists to write that core out honestly so you can read it in one sitting. It is aimed at engineers who want to understand the mechanism, or who intend to fork their own agent and need a foundation small enough to hold in their head. The README frames the comparison table against Claude Code and aider explicitly as a learning reference rather than a competitor: CoreCoder is what you stand on while you learn from the others, not an entry in the same race. If your goal is a production assistant, this is the wrong framing. If your goal is to know exactly what an agent loop does on every line, the framing is the whole product.

What actually sits in the 1,161 lines

The engine covers the loop, the model interface, context handling, tools and sessions, and the README counts 1,161 lines once blank lines and comments are dropped. Counting the outer CLI, config and packaging, the package is 24 files at 2,384 physical lines and 1,931 net. The repository layout puts agent.py first at 213 lines, described as the agent loop plus parallel tool execution, with llm.py handling streaming. The README points readers to start at agent.py because it is the heart of the whole agent. Behaviour the documentation claims: it reads and writes files, executes shell, spawns sub-agents, compacts context in three tiers, and reports tokens and dollars for a run on request. Anything that would mutate disk or run a command stops for consent first. The README states 146 tests pass. I have not run them; that figure comes from the README and the CI badge. The design intent is that the loop is the easy part and everything the loop copes with in the real world is the hard part, which is why the permission layer, checkpoints and compaction get their own releases rather than being left as exercises.

Getting a session running against your own provider

The README recommends cloning and installing editable so you can read and change as you go: git clone https://github.com/he-yufeng/CoreCoder, cd CoreCoder, pip install -e . A plain pip install corecoder also works if you only want it running. CoreCoder speaks the OpenAI-compatible API by default and switching providers is usually two environment variables. For DeepSeek the README gives OPENAI_API_KEY, OPENAI_BASE_URL=https://api.deepseek.com and CORECODER_MODEL=deepseek-chat. For a local Ollama instance it gives OPENAI_API_KEY=ollama, OPENAI_BASE_URL=http://localhost:11434/v1 and CORECODER_MODEL=qwen2.5-coder. The default model is named as gpt-5.5. Credentials can be exported directly or placed in a .env at the project root, which is loaded on startup. For providers without an OpenAI-compatible endpoint, an optional LiteLLM backend installs via pip install "corecoder[litellm]". Two entry points are documented: corecoder for an interactive REPL, and corecoder -p "add error handling to parse_config()" for one-shot mode that exits when done. One constraint worth noting before you script it: the README states that -p refuses mutating tools unless you pass --yes, by design.

The permission gate is the most opinionated design choice

Version 0.5.0 added a permission layer, and it is the part most likely to shape how you use CoreCoder rather than how you read it. Every action that would mutate your disk or run a command stops for consent first, according to the README. That is a sensible default for a tool you are experimenting with, and it is also a cost: an agent that pauses on each write is not the flow a terminal pair-programmer user expects. The -p flag compounds this. Because one-shot mode refuses mutating tools unless --yes is passed, a scripted run that you expect to edit files will do nothing destructive and exit, which is easy to misread as a broken agent. The README calls this deliberate. Treat the gate as the project's statement about trust: the agent is not asking you to believe it, it is asking you to approve each step. If you want unattended operation you will be passing --yes and accepting the risk that the gate exists to remove.

Context compaction, checkpoints and the undo story

Three tiers of context compaction are named in the README, though the material does not give the thresholds or the algorithm behind them. That is a real gap for anyone evaluating long sessions: compaction is where agent behaviour degrades first, and without the numbers you cannot predict when a long refactor will start losing earlier decisions. Version 0.4.2 added /undo checkpoints, which is the counterweight. A checkpoint before mutation plus an undo command means a bad edit is recoverable inside the session rather than only through git. The two features pull in opposite directions: compaction discards context to stay inside the window, checkpoints preserve the ability to reverse a change. Neither is a substitute for version control, and the README does not present them as one. If you fork CoreCoder, the compaction tiers are the first place I would expect to change behaviour, and the material here does not tell you enough to leave them alone.

What 0.6.0 added, and what the README leaves open

The most recent release listed is v0.6.0, dated 2026-09-06, adding MCP, hooks and plan mode. The README does not describe the configuration keys or the interfaces for any of the three. MCP support in particular is the kind of feature whose value depends entirely on how servers are registered and how tool results are surfaced, and none of that is in the supplied material. Hooks raise the same question: without a documented event list, you cannot tell whether a hook fires before or after a tool call, or whether it can veto one. Plan mode is named without a description of what changes in the loop. This is the honest boundary of what can be assessed from the repository description and README alone. The release cadence is visible: 0.4.2 on 2026-09-02, 0.5.0 on 2026-09-04, 0.6.0 on 2026-09-06. Four days between the permission layer and MCP, hooks and plan mode is fast. Fast is fine for a reference project; it does mean the README lags the code.

Where CoreCoder is the wrong tool, and what to use instead

CoreCoder is the wrong tool when the job is a large, multi-file refactor under time pressure. A 1,161-line engine cannot carry the heuristics that a production assistant accumulates for repository-wide reasoning, and the README says so in its own comparison table rather than pretending otherwise. The honest alternative is aider. The difference is not quality, it is approach: aider is described here as tens of thousands of lines of Python for terminal pair-programming, which means a few days of reading and an edit loop designed for sustained use. CoreCoder is 1,161 lines you can read in an afternoon and fork, with deliberate gaps the README calls the point rather than unfinished work. If you want to understand the mechanism, read CoreCoder. If you want to refactor a codebase this afternoon, install aider. The nanoGPT comparison in the README makes the same distinction: nanoGPT teaches you to train a GPT, CoreCoder teaches you to build an agent that edits code.

Licence, maintenance surface, and what to check before you fork

CoreCoder is MIT licensed, which permits forking, modification and redistribution provided the licence notice is preserved. That matters here because forking is the stated intended use, and MIT is the permissive option that keeps a fork unencumbered. This is a description of the licence, not legal advice; read the LICENSE file yourself before shipping a derivative. The maintenance surface is small by construction: 24 files and 1,931 net lines means a fork is something one person can keep current. The trade-off is the reverse side of the same number. Anything you build on top depends on an engine that changes quickly, and the README does not commit to interface stability across minor versions. The upgrade cost is therefore mostly your own diff against agent.py and llm.py rather than a dependency bump. Before forking, verify three things: that the 1,161-line engine count holds on the commit you pin, that the three-tier compaction thresholds suit your context window, and that the permission layer's consent prompts match how you intend to run it, especially if you plan to use -p in scripts. Those three determine whether the foundation fits before you write a line on top of it.

Editorial conclusion

Adopt CoreCoder if your goal is to read, breakpoint and fork an agent loop rather than to replace your terminal assistant. Skip it if you need multi-file refactoring at scale or a mature plugin ecosystem; the README states the gaps are deliberate. Before committing, run the clone-and-editable-install path, point it at your own provider, and read agent.py end to end to confirm the 1,161-line claim matches what you need to change.

Official sources

  1. he-yufeng/CoreCoder on GitHub
  2. License: MIT
  3. Project website
  4. README
  5. Releases
Community notes

Community notes