对照 /Users/konghayao/code/knowledgebase/origin/acp 规范审计并修复 53 条合规性
发现(critical 5 / major 17 / minor 20 / nit 11),完整审计报告见
docs/acp-compliance-audit.md。
Agent 端 (src/services/acp/agent.ts):
- initialize() 补齐 authMethods,promptCapabilities.image 降级为 false(声明与
实现脱节,按 initialization.mdx 不声明的 capability 视为不支持)
- sessionCapabilities.fork 移至 _meta.claudeCode.forkSession(fork 在
meta.unstable.json 中,避免在 stable sessionCapabilities 中暴露 unstable 特性)
- unstable_resumeSession 传 replay:false,不再通过 session/update 重放历史
(session-setup.mdx:239 明确禁止)
- PromptResponse.usage 移至 _meta.claudeCode.usage
(extensibility.mdx:39 禁止在 spec 类型根添加自定义字段)
- 空字符串 prompt 改为显式 throw(不再误返 end_turn)
Bridge (src/services/acp/bridge.ts):
- 删除全部 usage_update discriminator(不在 stable v1 schema 中)
- 显式映射 refusal stop_reason(之前误报 end_turn)
- max_tokens / isError 检查互斥
- Read/Write/Edit/Glob 路径全部绝对化(协议规定路径 MUST 绝对)
- 补全 resource_link / resource ContentBlock 渲染
Permissions (src/services/acp/permissions.ts):
- 补齐 reject_always PermissionOption(schema 规定的四个 option 之一)
- checkTerminalOutput 优先检查标准 clientCapabilities.terminal,
回退到 _meta.terminal_output
- 新增 onPermissionCancelled 回调:cancelled permission outcome →
StopReason::Cancelled(schema.json:629)
- ExitPlanMode cancelled 分支补上 toolUseID 字段
PromptConversion (src/services/acp/promptConversion.ts):
- resource 分支处理 BlobResource(之前静默丢弃 blob 内容)
acp-link 代理 (packages/acp-link/src/):
- WS 协议从专有 {type, payload} 改造为标准 JSON-RPC 2.0
(transports.mdx:52 要求自定义 transport MUST 保留 JSON-RPC 消息格式),
同时向后兼容旧 envelope
- 实现 $/cancel_request 处理
- 使用 JSON-RPC 标准错误码 -32700 / -32600 / -32601 / -32602 / -32603
- capability / agentInfo / protocolVersion 完整透传
验证:bun run precheck 全部通过(tsc 零错误、biome ci 零警告、5841/5841 测试通过);
ACP 专项测试 221/221 通过。独立 verification agent 抽查全部 PASS。
已知暂缓项(审计文档附录 B/C):
- §3.5 traceparent/trace-context 传播(QueryEngine 无 header hook)
- §5.2 terminal/create 完整生命周期(P1,非阻断,需新 RPC 流程)
- §4.2 in_progress tool_call status(SHOULD 级)
- §8.8/8.9/8.14 stale types.ts(不在 owner 分配集合,runtime 已修正)
Co-Authored-By: glm-5.2 <zai-org@claude-code-best.win>
Claude Code Best V5 (CCB)
Which Claude do you like? The open source one is the best.
A reverse-engineered / decompiled source restoration of Anthropic's official Claude Code CLI tool. The goal is to reproduce most of Claude Code's functionality and engineering capabilities. It's abbreviated as CCB.
Documentation (Chinese) — PR contributions welcome.
Sponsor placeholder.
- v1: Basic runability and type checking pass
- V2: Complete engineering infrastructure
- Biome formatting may not be implemented first to avoid code conflicts
- Build pipeline complete, output runnable on both Node.js and Bun
- V3: Extensive documentation and documentation site improvements
- V4: Large-scale test suite for improved stability
- V5: Enterprise-grade monitoring/reporting, missing tools补全, restrictions removed
- Removed anti-distillation code
- Web search capability (using Bing) Docs
- Debug mode support Docs
- Disabled auto-updates
- Custom Sentry error reporting support Docs
- Custom GrowthBook support (GB is open source — configure your own feature flag platform) Docs
- Custom login mode — configure Claude models your way
- V6: Large-scale refactoring, full modular packaging
- V6 will be a new branch; main branch will be archived as a historical version
I don't know how long this project will survive. Star + Fork + git clone + .zip is the safest bet.
This project updates rapidly — Opus continuously optimizes in the background, with new changes almost every few hours.
Claude has burned over $1000, out of budget, switching to GLM to continue; @zai-org GLM 5.1 is quite capable.
Quick Start
Prerequisites
Make sure you're on the latest version of Bun, otherwise you'll run into all sorts of weird bugs. Run bun upgrade!
- Bun >= 1.3.11
Install Bun:
# Linux and macOS
curl -fsSL https://bun.sh/install | bash
# Windows (PowerShell)
powershell -c "irm bun.sh/install.ps1 | iex"
Post-installation steps:
-
Make
bunavailable in the current terminalThe installer adds
~/.bun/binto the matching shell configuration file. On macOS with the default zsh shell, you may see:Added "~/.bun/bin" to $PATH in "~/.zshrc"Restart the current shell as the installer suggests:
exec /bin/zshIf you use bash, reload the bash configuration:
source ~/.bashrcWindows PowerShell users can close and reopen PowerShell.
-
Verify that Bun is available:
bun --help bun --version -
Update to latest version (if already installed):
bun upgrade
- Standard Claude Code configuration — each provider has its own setup method
Command Execution Location
- Bun installation and checking commands can be run from any directory:
curl -fsSL https://bun.sh/install | bash,bun --help,bun --version,bun upgrade - Project dependency installation, development mode, and builds must be run from this repository root, the directory containing
package.json.
Install
cd /path/to/claude-code
bun install
Run
# Dev mode — if you see version 888, it's working
bun run dev
# Build
bun run build
The build uses code splitting (build.ts), outputting to dist/ (entry dist/cli.js + ~450 chunk files).
The build output runs on both Bun and Node.js — you can publish to a private registry and run directly.
If you encounter a bug, please open an issue — we'll prioritize it.
First-time Setup /login
After the first run, enter /login in the REPL to access the login configuration screen. Select Anthropic Compatible to connect to third-party API-compatible services (no Anthropic account required).
Fields to fill in:
| Field | Description | Example |
|---|---|---|
| Base URL | API service URL | https://api.example.com/v1 |
| API Key | Authentication key | sk-xxx |
| Haiku Model | Fast model ID | claude-haiku-4-5-20251001 |
| Sonnet Model | Balanced model ID | claude-sonnet-4-6 |
| Opus Model | High-performance model ID | claude-opus-4-6 |
- Tab / Shift+Tab to switch fields, Enter to confirm and move to the next, press Enter on the last field to save
- Model fields auto-fill from current environment variables
- Configuration saves to
~/.claude/settings.jsonunder theenvkey, effective immediately
You can also edit ~/.claude/settings.json directly:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.example.com/v1",
"ANTHROPIC_AUTH_TOKEN": "sk-xxx",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-4-5-20251001",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-4-6",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-4-6"
}
}
Supports all Anthropic API-compatible services (e.g., OpenRouter, AWS Bedrock proxies, etc.) as long as the interface is compatible with the Messages API.
Feature Flags
All feature toggles are enabled via FEATURE_<FLAG_NAME>=1 environment variables, for example:
FEATURE_BUDDY=1 FEATURE_FORK_SUBAGENT=1 bun run dev
See docs/features/ for detailed descriptions of each feature. Contributions welcome.
VS Code Debugging
The TUI (REPL) mode requires a real terminal and cannot be launched directly via VS Code's launch config. Use attach mode:
Steps
-
Start inspect server in terminal:
bun run dev:inspectThis outputs an address like
ws://localhost:8888/xxxxxxxx. -
Attach debugger from VS Code:
- Set breakpoints in
src/files - Press F5 → select "Attach to Bun (TUI debug)"
- Set breakpoints in
Documentation & Links
- Online docs (Mintlify): ccb.agent-aura.top — source in
docs/, PR contributions welcome - DeepWiki: https://deepwiki.com/claude-code-best/claude-code
Contributors
Star History
License
This project is for educational and research purposes only. All rights to Claude Code belong to Anthropic.