Hacker News 中文摘要

RSS订阅

克劳德·奇尔:修复终端中克劳德代码的闪烁问题 -- Claude Chill: Fix Claude Code's Flickering in Terminal

文章摘要

这是一个名为claude-chill的GitHub项目,采用MIT开源协议,支持Linux和macOS系统,并包含持续集成的工作流程。项目由David Beesley创建维护。

文章总结

GitHub项目:claude-chill - 优化Claude Code终端输出的PTY代理工具

项目概述

claude-chill是一个基于Rust开发的PTY代理工具,旨在解决Claude Code在终端输出时因全屏刷新导致的性能问题。该项目采用MIT许可证,支持Linux和macOS系统(不支持Windows)。

核心问题

Claude Code使用同步输出标记(\x1b[?2026h...\x1b[?2026l)实现原子性更新,但每次都会发送整个屏幕内容(可能多达5000行),而实际可见区域仅约20行。这会导致: - 终端卡顿和闪烁 - 滚动历史被清空 - 资源浪费

技术方案

  1. 同步块拦截:捕获大规模原子更新
  2. VT100模拟器:跟踪屏幕状态差异
  3. 历史缓存:保存输出内容供回溯查看
  4. 回溯模式:通过快捷键暂停输出查看历史

安装与使用

安装方式: cargo install --path crates/claude-chill

基础用法: bash claude-chill claude claude-chill -- claude --verbose # 传递参数

配置选项: - 历史记录行数(默认10万行) - 回溯快捷键(默认Ctrl+6) - 自动回溯超时(默认5秒空闲触发)

特色功能

  1. 回溯模式:

    • 暂停Claude输出
    • 完整显示历史缓存
    • 支持终端原生滚动
    • 再次按键恢复运行
  2. 自动回溯:

    • 空闲超时后自动显示历史
    • 可通过-a 0禁用

配置文件

位置:~/.config/claude-chill.toml 可配置项: - 历史记录容量 - 触发快捷键 - 渲染帧率(默认20FPS) - 自动回溯超时

技术原理

建立伪终端三层架构: 终端 ↔ claude-chill(代理) ↔ Claude Code(子进程)

工作流程: 1. 输入透传(特殊快捷键除外) 2. 同步块识别处理 3. VT100状态跟踪 4. 差异渲染输出 5. 信号转发(窗口调整/中断等)

注意事项

  • 开发初衷为个人使用,未经全面测试
  • 不建议用于关键场景
  • Windows系统不受支持

(项目贡献指南和MIT许可证详情略)

评论总结

总结评论内容:

  1. 正面评价(解决方案有效/创意好):
  • "Excellent, thank you. This had be causing me headaches!"(alva)
  • "Possibly the greatest contribution to Claude code in months."(laughingcurve)
  1. 对Anthropic公司的批评:
  • "I'm starting to think...it's because they don't want people to see what a mess their code base is."(prodigycorp)
  • "It's embarrassing an OSS fixed their problem before they did after all that money they raised"(LowLevelBasket)
  1. 技术问题反馈:
  • "it now flickers periodically but not like crazy."(meursault334)
  • "it breaks Ghostty's native scrollback...which I want more than I want to solve the flickering."(benzible)
  1. 关于AI参与开发的讨论:
  • "The readme.md format...makes the whole thing Chef's kiss. I love the future."(internet2000)
  • "Did this get written mostly by human hands, or did AI also write this?"(Der_Einzige)
  1. 其他功能建议:
  • "One feature I'd love is a toggle to lock the input to the bottom of the terminal."(ossa-ma)
  • "just make the font-size smaller, and smaller...until no more flickering."(gastonmorixe)