Clio — Claude Code CLI banner
icebear0828 icebear0828

Clio — Claude Code CLI

Development community intermediate

Description

功能丰富的 Claude Code 开源替代品,在终端中运行。连接 Anthropic API(或任何兼容端点),提供交互式智能编程助手,支持本地工具执行。 46 个源文件,约 9200 行 TypeScript。运行时零外部依赖(仅 `fast-glob`)。

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

Repository README

This is the README for icebear0828/clio, shared by 2 entries in this directory. It describes the repository, not this entry specifically.

中文 | [English](README.md)

Clio — Claude Code CLI

功能丰富的 Claude Code 开源替代品,在终端中运行。连接 Anthropic API(或任何兼容端点),提供交互式智能编程助手,支持本地工具执行。

46 个源文件,约 9200 行 TypeScript。运行时零外部依赖(仅 `fast-glob`)。

快速开始

# 克隆并安装
git clone https://github.com/icebear0828/clio.git
cd clio
npm install

# 设置 API 密钥(任选一种)
export CLIO_API_KEY=sk-ant-xxx          # Linux/macOS
set CLIO_API_KEY=sk-ant-xxx             # Windows CMD
$env:CLIO_API_KEY = "sk-ant-xxx"        # PowerShell

# 免构建运行(开发模式)
npm run dev

# 或构建后全局安装
npm run build
npm link                                # 之后可在任意目录使用 `clio`

# 在任意项目中使用
cd your-project
clio

功能特性

  • Agent 循环 — 多轮工具调用:Claude 读取文件、编写代码、运行命令,迭代直到完成
  • 21 个工具 — Read, Write, Edit, Bash, Glob, Grep, WebFetch, WebSearch, Agent, AskUserQuestion, EnterPlanMode, ExitPlanMode, TaskCreate/Update/List/Get, Skill, ToolSearch, TeamCreate/Delete, SendMessage
  • 流式输出 — 实时 Markdown 渲染,语法高亮代码块、标题、列表、行内格式
  • Prompt 缓存 — 系统提示词、工具、消息历史的 cache_control,节省约 90% 输入 token
  • 模型感知上下文 — 按模型动态上下文限制(Opus 1M,Sonnet/Haiku 200k),85% 时自动压缩
  • 权限系统 — 三种模式(default/auto/plan),Y/n/a 提示,正则允许/拒绝规则,两阶段自动分类器(模式匹配 + LLM),Shift+Tab 切换
  • 上下文加载 — 自动加载 CLAUDE.md 文件(向上遍历)+ git 分支/状态/提交信息
  • 会话管理 — 自动保存对话,--resume 恢复,--fork-session 分叉
  • Git 工作流/commit/pr/review 命令,AI 生成提交信息
  • MCP 支持 — 基于 stdio 的 JSON-RPC 2.0,服务器生命周期管理,mcp__ 前缀工具发现
  • 自定义 Agent — 在 .clio/agents/*.md 中定义 agent,支持 front-matter(tools, model, max_iterations)
  • 后台 Agentrun_in_background 异步子 agent 执行,完成通知
  • Worktree 隔离 — 在隔离的 git worktree 中运行子 agent
  • Agent 团队 — TeamCreate/TeamDelete/SendMessage 实现 agent 间消息传递和协作
  • 扩展思考 — 使用 --thinking 显示 Claude 的推理过程,自适应思考预算
  • 图片输入 — 粘贴图片文件路径发送截图给 Claude
  • Hooks — 通过 settings.json 配置工具执行前/后钩子,支持环境变量和工具过滤
  • 插件系统 — 清单驱动的插件(plugin.json),支持 skills、agents、hooks、MCP、LSP、commands 注入
  • LSP 集成 — LspClient/LspManager,Content-Length 帧协议,诊断信息注入系统提示词
  • Skills — Skill/ToolSearch 工具,延迟加载工具和内置 skill 执行
  • 沙箱 — 路径限制、环境变量过滤、网络控制、资源限制
  • 状态栏 — 可配置底部状态栏(模型/token/费用/模式/详细/会话)
  • 语法高亮 — 支持 TS/JS/Python/Rust/Go/Bash/JSON/CSS/HTML 语言感知着色
  • 撤销/重做 — 输入中 Ctrl+Z / Ctrl+Shift+Z,基于快照的撤销栈
  • 检查点回滚 — Esc-Esc 恢复 Write/Edit 修改的文件
  • 任务管理 — TaskCreate/Update/List/Get 跟踪多步骤工作流
  • 智能截断 — Grep 分页(head_limit/offset),Bash 输出上限 500 行,Glob 分页
  • 费用追踪/cost 命令 + 状态栏显示按模型计算的 USD 费用
  • 打印模式-p 标志非交互输出,支持 JSON
  • 快捷键 — 通过 keybindings.json 自定义键盘快捷键
  • OpenAI 兼容--api-format openai 支持任何 OpenAI 兼容端点

配置

命令行参数

--api-url           API 基础 URL(默认:https://api.anthropic.com)
--api-key           API 密钥
--api-format        anthropic | openai(默认:anthropic)
--model           模型名称(默认:claude-sonnet-4-20250514)
--resume             恢复之前的会话
--fork-session       从已有会话分叉
--thinking       启用扩展思考并设置 token 预算
--permission-mode  default | auto | plan
--allow         自动允许匹配 glob 模式的 Bash 命令(可重复)
--deny          始终拒绝匹配模式的 Bash