• 请不要在回答技术问题时复制粘贴 AI 生成的内容
goozi
V2EX  ›  程序员

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

  •  
  •   goozi · Apr 1 · 1305 views
    This topic created in 56 days ago, the information mentioned may be changed or developed.

    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.

    3 replies    2026-04-02 08:01:00 +08:00
    tomcrowley
        1
    tomcrowley  
       Apr 1
    一次额妹子嘤
    Linqi686
        2
    Linqi686  
       Apr 1
    用英文发帖何意味
    needpp
        3
    needpp  
       Apr 2
    估计是买的号上来加外链的
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4151 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 152ms · UTC 10:11 · PVG 18:11 · LAX 03:11 · JFK 06:11
    ♥ Do have faith in what you're doing.