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 · 3 小时 37 分钟前 · 175 次点击

    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  
       3 小时 3 分钟前
    一次额妹子嘤
    Linqi686
        2
    Linqi686  
       2 小时 48 分钟前
    用英文发帖何意味
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   3183 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 12:00 · PVG 20:00 · LAX 05:00 · JFK 08:00
    ♥ Do have faith in what you're doing.