claude-better-cli

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

claude-better

claude-better

Skill by ara.so — Daily 2026 Skills collection.
claude-better
is a compatibility-first reimplementation of the Claude CLI focused on aggressive performance improvements: up to 73% faster startup and up to 80% lower resident memory, while maintaining 100% command-level compatibility with the original Claude CLI.
ara.so 开发的Skill — 2026年度每日技能系列。
claude-better
是一款以兼容性优先的Claude CLI重实现,主打极致性能提升:启动速度最高快73%,常驻内存占用最高降低80%,同时与原版Claude CLI保持100%的命令级兼容性。

What It Does

核心特性

  • Faster cold starts:
    --help
    goes from 182ms → 49ms;
    chat
    session bootstrap from 311ms → 102ms
  • Lower memory: sustained interactive sessions drop from ~412MB → ~83MB RSS
  • Drop-in compatible: 100% pass rate on primary command forms, 100% exit-code match, 98.7% byte-for-byte output parity
  • Zero migration cost: existing scripts, aliases, and muscle memory continue to work unchanged
  • 更快的冷启动速度
    --help
    命令耗时从182ms降至49ms;
    chat
    会话启动从311ms降至102ms
  • 更低的内存占用:持续交互会话的RSS从412MB降至83MB
  • 可直接替换:核心命令形式通过率100%,退出码100%匹配,逐字节输出一致性达98.7%
  • 零迁移成本:现有脚本、别名、使用习惯无需任何改动即可继续使用

Availability

可用性

⚠️ Source code is provided for selected high-profile customers only and available upon request. Contact the maintainer at krzyzanowskim/claude-better for access.
If you have access, install as described in your onboarding materials. The binary is a drop-in replacement — substitute it wherever you invoke
claude
.
⚠️ 源代码仅向选定的高优先级客户提供,可按需申请。请通过 krzyzanowskim/claude-better 联系维护者获取访问权限。
如果你有访问权限,请按照接入材料中的说明安装。该二进制文件是可直接替换的替代版本,你可以在任何调用
claude
的地方替换使用它。

Installation (Once You Have Access)

安装(获得访问权限后)

bash
undefined
bash
undefined

Typical binary drop-in replacement pattern

Typical binary drop-in replacement pattern

Place the claude-better binary in your PATH before the original claude

Place the claude-better binary in your PATH before the original claude

export PATH="/path/to/claude-better/bin:$PATH"
export PATH="/path/to/claude-better/bin:$PATH"

Verify it's being picked up

Verify it's being picked up

which claude claude --version

```bash
which claude claude --version

```bash

Or alias it explicitly without touching PATH

Or alias it explicitly without touching PATH

alias claude='/path/to/claude-better/bin/claude-better'
undefined
alias claude='/path/to/claude-better/bin/claude-better'
undefined

Key Commands

核心命令

claude-better
mirrors the Claude CLI surface exactly. All commands you know work as-is:
bash
undefined
claude-better
完全复刻了Claude CLI的命令界面,你熟悉的所有命令都可以原样使用:
bash
undefined

Show help (cold start: ~49ms vs 182ms baseline)

Show help (cold start: ~49ms vs 182ms baseline)

claude --help
claude --help

Check auth status (warm start: ~58ms vs 146ms baseline)

Check auth status (warm start: ~58ms vs 146ms baseline)

claude auth status
claude auth status

Start an interactive chat session (~102ms bootstrap vs 311ms baseline)

Start an interactive chat session (~102ms bootstrap vs 311ms baseline)

claude chat
claude chat

One-shot non-interactive command (~131ms vs 428ms baseline)

One-shot non-interactive command (~131ms vs 428ms baseline)

claude -p "Summarize this file" < input.txt
claude -p "Summarize this file" < input.txt

All standard flags pass through unchanged

All standard flags pass through unchanged

claude --model claude-opus-4-5 chat claude --output-format json -p "List 3 facts about Rust"
undefined
claude --model claude-opus-4-5 chat claude --output-format json -p "List 3 facts about Rust"
undefined

Configuration

配置

claude-better
reads the same configuration as the original Claude CLI. No new config format is required.
bash
undefined
claude-better
读取与原版Claude CLI相同的配置,无需使用新的配置格式。
bash
undefined

Standard Claude CLI env vars are respected

Standard Claude CLI env vars are respected

export ANTHROPIC_API_KEY=$ANTHROPIC_API_KEY
export ANTHROPIC_API_KEY=$ANTHROPIC_API_KEY

The tool reads ~/.claude/ config directory as normal

The tool reads ~/.claude/ config directory as normal

No migration of config files needed

No migration of config files needed

undefined
undefined

Performance Characteristics

性能表现

ScenarioBaselineclaude-betterImprovement
--help
cold start
182ms49ms73% faster
auth status
warm
146ms58ms60% faster
chat
bootstrap
311ms102ms67% faster
One-shot command428ms131ms69% faster
RSS after 30min session412MB83MB80% less
Streaming jitter p9591ms24ms74% lower
场景原版基线claude-better提升幅度
--help
冷启动
182ms49ms快73%
auth status
热启动
146ms58ms快60%
chat
会话启动
311ms102ms快67%
单次非交互命令428ms131ms快69%
30分钟会话后RSS412MB83MB少80%
流式传输抖动p9591ms24ms低74%

Scripting Patterns

脚本使用模式

Since compatibility is 100%, all existing scripting patterns work unchanged:
bash
#!/usr/bin/env bash
由于兼容性为100%,所有现有脚本使用模式无需改动即可生效:
bash
#!/usr/bin/env bash

Existing Claude CLI scripts work without modification

Existing Claude CLI scripts work without modification

Non-interactive pipeline usage

Non-interactive pipeline usage

echo "Explain this error:" | cat - error.log | claude -p /dev/stdin
echo "Explain this error:" | cat - error.log | claude -p /dev/stdin

Exit code handling (100% compatible)

Exit code handling (100% compatible)

if claude auth status; then echo "Authenticated" else echo "Not authenticated — run: claude auth login" exit 1 fi
if claude auth status; then echo "Authenticated" else echo "Not authenticated — run: claude auth login" exit 1 fi

JSON output parsing

JSON output parsing

claude --output-format json -p "What is 2+2?" | jq '.content'

```bash
#!/usr/bin/env bash
claude --output-format json -p "What is 2+2?" | jq '.content'

```bash
#!/usr/bin/env bash

Long-lived interactive session — memory pressure is significantly reduced

Long-lived interactive session — memory pressure is significantly reduced

Useful on memory-constrained machines (laptops, CI runners)

Useful on memory-constrained machines (laptops, CI runners)

claude chat
undefined
claude chat
undefined

Compatibility Notes

兼容性说明

  • CLI surface: 100% compatible with targeted Claude CLI command forms
  • Exit codes: 100% match on documented exit-code behavior
  • Output parity: 98.7% byte-for-byte; 100% semantic parity after whitespace/timestamp/terminal-width normalization
  • Tested environments: macOS (Apple Silicon), Linux, containerized CI
  • Tested against: 1,200 synthetic invocations, 87 flag combinations, 42 interactive flows, 14 failure-mode scenarios
  • 命令界面:与目标Claude CLI命令形式100%兼容
  • 退出码:文档记录的退出码行为100%匹配
  • 输出一致性:逐字节一致性为98.7%;经过空白符/时间戳/终端宽度归一化后,语义一致性为100%
  • 测试环境:macOS(苹果芯片)、Linux、容器化CI
  • 测试覆盖:1200次模拟调用、87种标志组合、42种交互流程、14种故障模式场景

Troubleshooting

故障排查

Binary not found after install
bash
undefined
安装后找不到二进制文件
bash
undefined

Ensure claude-better/bin is earlier in PATH than original claude

Ensure claude-better/bin is earlier in PATH than original claude

echo $PATH | tr ':' '\n' | grep -n claude which claude # should point to claude-better

**Unexpected output differences**
```bash
echo $PATH | tr ':' '\n' | grep -n claude which claude # should point to claude-better

**输出差异不符合预期**
```bash

1.3% of outputs differ before normalization (timestamps, whitespace, terminal width)

1.3% of outputs differ before normalization (timestamps, whitespace, terminal width)

If a script breaks on exact output matching, add normalization:

If a script breaks on exact output matching, add normalization:

claude -p "..." | tr -s ' ' | sed 's/[[:space:]]*$//'

**Auth not recognized**
```bash
claude -p "..." | tr -s ' ' | sed 's/[[:space:]]*$//'

**无法识别认证信息**
```bash

claude-better reads the same auth store as the original CLI

claude-better reads the same auth store as the original CLI

If auth fails, re-authenticate via the standard flow:

If auth fails, re-authenticate via the standard flow:

claude auth login

**Falling back to original CLI**
```bash
claude auth login

**回退到原版CLI**
```bash

If you hit an edge case, unset the alias/PATH change to revert instantly

If you hit an edge case, unset the alias/PATH change to revert instantly

unalias claude
unalias claude

or

or

export PATH="<original-path-without-claude-better>"
undefined
export PATH="<original-path-without-claude-better>"
undefined

Architecture Notes (For Contributors / Evaluators)

架构说明(面向贡献者/评估者)

The performance gains come from specific implementation choices documented in the README:
  • Zero-copy streaming pipeline for token output (reduces streaming jitter)
  • Precomputed command registry instead of dynamic startup discovery (cuts cold-start time)
  • Aggressively bounded allocation for session state (drives memory reduction)
  • Lazy subsystem initialization — only the active command path pays startup cost
  • Compatibility shim layer that preserves flags/behavior without carrying the full original stack
性能提升来自README中记录的特定实现选择:
  • 令牌输出采用零拷贝流式管道(降低流式传输抖动)
  • 使用预计算命令注册表替代动态启动发现(缩短冷启动时间)
  • 会话状态采用严格边界的内存分配(实现内存占用降低)
  • 子系统懒加载:仅活跃命令路径需要支付启动成本
  • 兼容垫片层:保留所有标志/行为,无需承载完整的原版技术栈