Skip to main content

Mini Claude Code - 极简教学版 AI 编程助手

Project description

MiniCC

极简版 Claude Code,用于教学。

想知道 Claude Code 这类 AI 编程助手是怎么实现的? 看这个项目就够了。核心代码约 1400 行,架构清晰,注释充分。

能干嘛

  • 读写文件、搜索代码、执行 shell 命令
  • 创建子任务并行处理
  • 终端 UI 界面,支持流式输出

技术栈

快速开始

# 设置 API Key
export ANTHROPIC_API_KEY="your-key"
# 或 export OPENAI_API_KEY="your-key"

# 直接运行(无需安装)
uvx minicc

# 或者安装后运行
uv pip install minicc
minicc

开发

git clone https://github.com/TokenRollAI/miniCC.git
cd miniCC
uv sync
uv run minicc

项目结构

minicc/
├── cli.py       # 入口(仅启动 TUI)
├── core/        # 运行时/模型/事件总线/MCP 预加载
├── tools/       # 工具实现(按职责拆分)
└── tui/         # Textual TUI(消费 stream events)

配置

配置文件在 ~/.minicc/config.json

{
  "provider": "anthropic",
  "model": "claude-sonnet-4-20250514"
}

可选 MCP 配置:

  • 项目级:<project>/.minicc/mcp.json
  • 全局:~/.minicc/mcp.json

MiniCC 会自动加载 MCP servers,并把它们的工具注册给 Agent。

如需启用 MCP(连接/启动 MCP servers),请安装可选依赖:pip install "minicc[mcp]"

Prompt Cache (Anthropic)

按照 pydantic-ai Anthropic 指南 可以在配置里开启 prompt caching:

{
  "provider": "anthropic",
  "model": "claude-sonnet-4-20250514",
  "prompt_cache": {
    "instructions": true,
    "tool_definitions": "1h",
    "messages": true
  }
}
  • instructions 缓存系统提示词;tool_definitions 缓存工具定义;messages 缓存最近一条用户消息
  • true 表示 5 分钟 TTL,或显式写 "5m" / "1h"
  • Anthropic 最多支持 4 个 cache points,pydantic-ai 会按指南自动裁剪超出的 CachePoint

工具列表

工具 作用
read_file 读文件
write_file 写文件
edit_file 改文件
glob_files 按模式搜索文件
grep_search 正则搜索内容
bash 执行命令
task 子任务(默认等待)
wait_subagents 等待所有后台子任务

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

minicc-0.3.1.tar.gz (168.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

minicc-0.3.1-py3-none-any.whl (37.5 kB view details)

Uploaded Python 3

File details

Details for the file minicc-0.3.1.tar.gz.

File metadata

  • Download URL: minicc-0.3.1.tar.gz
  • Upload date:
  • Size: 168.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for minicc-0.3.1.tar.gz
Algorithm Hash digest
SHA256 7962b0445f33671d5a300ab7a3b960a21eeba4d071b4b3575d1fbffd2fd05936
MD5 74b7752199e13ec8026026b742962f8c
BLAKE2b-256 75d45d3238b3bd4815314c6f8024e9188ee0ee667e8d4486638f220a98e479e7

See more details on using hashes here.

File details

Details for the file minicc-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: minicc-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 37.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for minicc-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 77a08eafdd24fbcc5a2dfe6a84dc4b8a06e114d17b9ee228426b41848e1f775a
MD5 11c33d3dd2449bac7fadcf4cfdbfbc3f
BLAKE2b-256 3c3cecfe2b6d4d2eeaf3616a6f4ab28978fb224976d7eac2e222591b3bb264d8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page