Skip to content

AurevoirNeo/ClaudeCodePilot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ClaudeCodePilot

Claude Code 的状态仪表盘插件 — 在 statusline 中实时显示上下文消耗、工具调用、Git 状态和当前操作。

效果预览

cc_pilot  main +2 ~1 ?3 ↑2↓0  ◈Sonnet

CTX  ████████████████░░░░  82%  164k/200k

▶ Agent:5  ✓ Tool:89  ✗ Err:3  ⚙ Rule:8  🔌 MCP:5  ✦ Skill:50

  ├─ ✓ Explore: codebase scan (12s)
  ├─ ⏳ Plan: implementation design (45s...)
  │   └─ ⏳ Explore: sub-search (20s...)
  └─ ✓ code-reviewer (3s)

♥ 47min  ✓ 92%  ▶ 5/5  压缩 0次

第 1 行:标题栏

cc_pilot  main +2 ~1 ?3 ↑2↓0  ◈Sonnet
│         │     │        │    │     └── 当前使用的模型
│         │     │        │    └── 落后远程 0 个,领先 0 个
│         │     │        └── 未跟踪文件 3 个
│         │     └── 已修改 1 个,已删除 0 个,已暂存 2 个
│         └── 当前 Git 分支
└── 项目名(当前工作目录名)

第 2 行:上下文进度条

CTX  ████████████████░░░░  82%  164k/200k
│    │                   │     │      └── 上下文窗口上限
│    │                   │     └── 已使用 token 数
│    │                   └── 使用百分比
│    └── 像素风格进度条(█=已用 ░=剩余)
└── 标签

颜色随使用率变化:绿 <70% → 70-84% → >=85%

第 3 行:统计行

▶ Agent:5  ✓ Tool:89  ✗ Err:3  ⚙ Rule:8  🔌 MCP:5  ✦ Skill:50
│           │          │        │           │          └── 已安装的 Skill 数
│           │          │        │           └── 已加载的 MCP 服务器数
│           │          │        └── 已加载的 Rule 文件数
│           │          └── 工具调用失败次数
│           └── 工具调用成功次数
└── 子 Agent 调用总数

第 4 行:活跃操作

运行中时显示所有 Agent/工具的平铺列表:

  ├─ ✓ Explore: codebase scan (12s)
  ├─ ⏳ Plan: implementation design (45s...)
  │   └─ ⏳ Explore: sub-search (20s...)
  └─ ✓ code-reviewer (3s)
│  │  │   │                └── 已运行时间
│  │  │   └── 操作描述
│  │  └── ⏳=等待中  ✓=已完成
│  └── 树形连接符(├─ 中间项  └─ 末尾项)
└── 缩进(└─ 表示子 Agent)

连续 3 次工具失败时显示警告:

  ⚠ 连续 4 次失败: Bash(×2) → Edit(×1) → Bash(×1)

空闲时显示最近 3 个完成的操作。

第 5 行:会话健康度

♥ 47min  ✓ 92%  ▶ 5/5  压缩 0次
│         │       │      └── 上下文压缩次数
│         │       └── Agent 完成/总数
│         └── 工具成功率(成功/总调用)
└── 会话时长

当成功率 <70% 或压缩 >=3 次时追加警告:⚠ 建议开新会话

功能

内容 说明
1 标题栏 项目名、Git 分支、变更统计(+N ~N -N ?N)、前后差异(↑N↓N)、模型名
2 上下文进度条 像素风格进度条,绿/黄/红三级着色,token 用量 / 上限
3 统计行 Agent 数、工具调用数、错误数、Rules、MCP、Skills 数量
4 活跃操作 多 Agent 平铺列表(⏳ 等待中)、错误连击警报(⚠ 连续失败);空闲时显示最近 3 个完成操作
5 会话健康度 会话时长、工具成功率、Agent 完成率、压缩次数、不健康警告

安装

前置要求: Node.js >= 18

方式一:一键安装(推荐)

curl -fsSL https://raw.githubusercontent.com/AurevoirNeo/ClaudeCodePilot/main/install.sh | bash

安装脚本会自动:

  1. 检测 Node.js 版本
  2. 克隆仓库并编译 TypeScript
  3. 复制编译产物到 ~/.claude/ClaudeCodePilot/
  4. 注册到 Claude Code 的 statusLine

方式二:从源码安装

git clone https://github.com/AurevoirNeo/ClaudeCodePilot.git ~/.claude/ClaudeCodePilot
cd ~/.claude/ClaudeCodePilot
npm install
npm run build

然后将以下内容添加到 ~/.claude/settings.json

{
  "statusLine": {
    "type": "command",
    "command": "node ~/.claude/ClaudeCodePilot/dist/index.js",
    "padding": 0
  }
}

方式三:npm 安装

npm install -g claudecodepilot

安装后编辑 ~/.claude/settings.json,添加:

{
  "statusLine": {
    "type": "command",
    "command": "node $(npm root -g)/claudecodepilot/dist/index.js",
    "padding": 0
  }
}

配置

安装后编辑 ~/.claude/ClaudeCodePilot/config.json 控制每行显示:

{
  "showTitle": true,
  "showContext": true,
  "showStats": true,
  "showActive": true,
  "showHealth": true
}
配置项 默认值 说明
showTitle true 标题栏(分支、模型等)
showContext true 上下文进度条
showStats true 统计行(Agent/Tool/Err/Rule/MCP/Skill)
showActive true 活跃操作 + 错误连击警报
showHealth true 会话健康度(时长、成功率、压缩次数)

不创建配置文件时所有行默认显示。

卸载

rm -rf ~/.claude/ClaudeCodePilot

然后从 ~/.claude/settings.json 中移除 statusLine 配置。

技术细节

  • 零依赖 — 仅使用 Node.js 内置模块
  • 300ms 预算 — 所有数据获取在 300ms 内完成(Claude Code statusLine 调用间隔)
  • 智能缓存 — 基于文件路径的 SHA-256 缓存键,mtime+size 失效校验,避免重复解析 transcript
  • 错误连击检测 — 连续 3 次工具失败自动警告,显示失败工具列表
  • 压缩事件检测 — 解析 transcript 中的 compact_boundary 系统事件,统计上下文压缩次数
  • 像素风格/ 块字符进度条,无边框多行布局
  • ANSI 颜色 — 上下文条按使用率分级着色(绿 <70% / 黄 70-84% / 红 >=85%)

开发

npm install          # 安装开发依赖
npm run build        # 编译 TypeScript
npx tsc --noEmit     # 类型检查
npm test             # 运行测试

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors