Today, I came across the leaked Claude Code CLI source package.
My first reaction was that it was probably just another joke. After checking it, it turned out to be real. I downloaded the package and spent some time reading through it.
The obvious part is the legal and ethical boundary: leaked source should not be republished. That part is not ambiguous.
But after reading it, I also felt there were a lot of runtime ideas worth studying:
- how a coding agent CLI can support TUI, REPL, and headless modes
- how query loop and tool loop are organized
- how tool calling is modeled
- how session and transcript are persisted
- how permission checks are treated as runtime behavior instead of UI-only prompts
- how provider abstraction is done
- how resume/export/cleanup make the CLI usable over time
So instead of republishing anything, I built a small project from scratch based on what I learned from those runtime patterns:
Claude Code-lite
GitHub: https://github.com/goozi/claude-code-lite
Wat it is
This is not a Claude Code clone.
It is not an open-source replacement.
And it is definitely not a repackaged version of leaked code.
The project is positioned as:
a small, hackable, local-first coding agent CLI runtime for learning and extension
The goal is to keep the codebase small enough to read and modify, while still being structurally useful for people building their own coding agents.
What it currently includes
Current version supports:
- TUI, REPL, and headless chat entry points
- OpenAI-compatible and Anthropic providers
- streaming output
- tool loop
- transcript and session index
- resume / inspect / export / cleanup flows
- permission confirmation and session-scoped allow rules
- packaging as a standalone executable, without requiring Node.js on the target machine
So this is already beyond a toy skeleton. It is a minimal usable agent CLI.
Why I made it
A lot of agent projects fall into one of two buckets:
- too small to teach anything beyond “LLM + tools”
- too large and productized to be easy to study
I wanted something in the middle:
- small enough to understand
- structured enough to learn from
- practical enough to extend into your own runtime
If you are working on:
- coding agents
- local-first agent runtimes
- tool calling architecture
- session/transcript systems
- terminal-first AI workflows
then this repo might be useful as a reference point.
What I think is interesting technically
The parts I care most about in this repo are not UI polish. They are runtime boundaries:
query()and turn lifecycle- tool protocol design
- permission engine
- provider abstraction
- session/transcript management
- multi-entry CLI structure
That is also why I wrote extra docs around architecture and core interfaces, instead of only shipping code.
What it is not trying to do
At least for now, I am explicitly not trying to build:
- a full Claude Code clone
- a feature-complete autonomous agent product
- a marketplace/plugin ecosystem
- a huge abstraction-heavy framework
I would rather keep it readable than prematurely complete.
Planned next steps
Likely next areas:
- stronger architecture docs
- unified error model
- tool result budgeting
- minimal MCP support
- minimal subagent implementation
- focused tests for provider adapters and session metadata
Repo
GitHub:
https://github.com/goozi/claude-code-lite
If you are building something similar, I would be interested in feedback on the runtime structure, especially around provider abstraction, permissions, and session lifecycle.
