I built Claude Code-lite, a small local-first coding agent CLI runtime inspired by Claude Code - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
请不要在回答技术问题时复制粘贴 AI 生成的内容
goozi
V2EX    程序员

I built Claude Code-lite, a small local-first coding agent CLI runtime inspired by Claude Code

  •  
  •   goozi 1 小时 54 分钟前 137 次点击

    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

    What 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.

    2 条回复    2026-04-01 17:11:34 +08:00
    tomcrowley
        1
    tomcrowley  
       1 小时 21 分钟前
    一次额妹子嘤
    Linqi686
        2
    Linqi686  
       1 小时 6 分钟前
    用英文发帖何意味
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     3933 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 27ms UTC 10:18 PVG 18:18 LAX 03:18 JFK 06:18
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86