---
title: "crit-tui"
url: "https://claudemods.dev/zh-cn/builds/crit-tui-ad49d9"
source: "https://github.com/tomasz-tomczyk/crit/tree/main/integrations/claude-code-tui"
source_type: "github"
repo: "https://github.com/tomasz-tomczyk/crit/tree/main/integrations/claude-code-tui"
author: "tomasz-tomczyk"
author_handle: "tomasz-tomczyk"
stars: 1354
category: "工作流与 CI"
categories: ["workflow"]
tags: ["claude-code", "code-review", "crit", "hooks", "mcp-tools", "plugin", "tui"]
permission_level: 2
scan_complete: true
install: "claude plugin marketplace add tomasz-tomczyk/crit\nclaude plugin install crit-tui@crit"
added: "2026-10-05T17:23:41.137Z"
updated: "2026-11-21T14:16:04Z"
locale: "zh-cn"
content_locale: "zh-cn"
---

# crit-tui

Claude Code 内的早期 crit：在面板中评论对话、差异或文件，把审查发送给 Claude，并在线程中阅读 Claude 的回复。

## Description

# crit-tui

Claude Code 内的审查循环，以 mod 形式运行。你可以在面板中评论对话内容、工作区差异或文件，一次性把审查发送给 Claude。Claude 会通过工具在线程中逐条回复。

**早期版本。**

## 安装

需要 Claude Code 2.1.287 或更高版本（mods），并且 `crit` CLI 必须在 PATH 中。

```
/plugin marketplace add tomasz-tomczyk/crit
/plugin install crit-tui@crit
```

它与同一市场中的主 `crit` 外挂并列安装；两者可以同时使用。要从 checkout 试用，请运行：

```sh
claude --plugin-dir integrations/claude-code-tui
```

## 使用

- `/crit-tui` 打开面板（使用上次的来源，首次打开时显示对话）
- `/crit-tui chat`、`/crit-tui diff`、`/crit-tui file <path>` 选择来源
- `/crit-tui send` 发送审查，`/crit-tui close` 关闭面板

面板是一个 `Client` 区域：它会接收原始按键和鼠标事件。点击一次即可让它接管按键（按 Esc 将按键交还给提示框）。

| 输入 | 功能 |
| --- | --- |
| 点击一行 | 将光标移到该行 |
| 拖动 | 选择行 |
| 点击线程 | 为 `r` / `x` 选中线程 |
| `j` `k`、↑ ↓、滚轮 | 移动 |
| shift+↑ ↓，或按 `v` 后移动 | 选择行 |
| 空格 / pagedown，ctrl+u / pageup | 翻页 |
| `g` `G`、home end | 顶部、底部 |
| `n` `p`、→ ← | 下一条、上一条消息或文件 |
| `l`、tab | 下一个线程 |
| `c`、enter | 评论当前行或选区 |
| `r` | 回复选中的线程，或当前行上的线程 |
| `x` | 解决线程 |
| `s` | 将草稿和回复发送给 Claude |
| `a` | 请求 Claude 审查差异并留下评论 |
| `1` `2` `3` | 对话、差异、文件 |
| `h` | 显示或隐藏已解决的线程 |
| `f` | 重新加载来源 |

输入评论时：enter 保存，shift+enter 换行，ctrl+u 清空。要取消：在空输入框中按 enter 或 backspace，或者点击 `cancel`。ctrl+c 和 Esc 不会传入面板：Claude Code 会接管它们。

面板关闭时，提示框上方的横条会显示 Claude 的草稿和新回复，并提供 `send` 和 `open` 按钮。状态列会显示相同的数量。包含评论的回复会在转录中追加一行，显示评论数量。

## Claude 能看到的内容

三个工具：

- `mcp__crit-tui__reply` `{ id, body, resolve? }`：回复评论
- `mcp__crit-tui__comment` `{ file, line, end_line?, body }`：在代码上留下评论
- `mcp__crit-tui__threads` `{ include_resolved? }`：列出未解决的线程

`send` 会提交一条提示，其中包含每条新评论（位置、引用行、内容、id）以及每条新回复，并要求 Claude 用 `reply` 回复每一项。

## 评论保存位置

所有内容都会通过 CLI 写入 crit，因此浏览器中的 crit UI 和 `crit comments` 能看到相同的审查。

- **差异和文件评论** 写入仓库的审查文件，并使用 `crit comment --json`。部分选区会带有 `quote` 和 `quote_offset`，就像网页 UI 的文字选取一样（旧版 crit 会忽略这两个字段）。
- **聊天评论** 写入名为 `claude-chat-<session id>` 的 crit 计划。第一次聊天评论时，mod 会用 `crit plan --name <slug> --no-wait` 保存对话（每行一条），然后用 `crit comment --plan <slug>` 留言。每轮之后都会再次保存；只有文本发生变化时，crit 才会新增版本。没有聊天评论的工作阶段不会创建任何内容。需要支持 `crit plan --no-wait` 的 crit；使用旧版 crit 时，聊天评论会留在工作阶段段中。
- **Claude 的回复** 使用 `--author Claude` 写入。
- 没有 crit CLI（设置 `critBin`）时，所有评论都会留在工作阶段中。

## 面板的构成

- `hooks/register.tsx` 负责数据（文档、线程、crit 同步），并将面板绘制成一个 `<Client module="./client.tsx">`。
- `hooks/client.tsx` 负责光标、选区、滚动和评论框，并通过 `ui.message` 把每个变更（`comment`、`reply`、`resolve`、`send` 等）发给 hooks 模块。
- Client 的 props 上限约为 100k 字符，因此它会取得光标附近的一段行，并在接近边缘时请求新的窗口。
- Client 绘制时引擎会忽略 `setState`，所以 Client 把状态放在模块变量中，只在按键和鼠标处理程序里调用 `setState`。

## 开发

```sh
claude plugin validate integrations/claude-code-tui
claude plugin test integrations/claude-code-tui
```

## 这个早期版本的限制

- crit 路径按仓库根目录的相对路径处理。请从仓库根目录启动 Claude Code。
- 被移除的（`-`）差异行锚定到新侧行号；crit 在 `crit comment --json` 中没有旧侧锚点。
- `crit comment --plan` 会让 `anchor` 为空（crit 的 bug），因此如果对话前面的内容发生变化，聊天评论不会跟着原文移动。
- 重新打开已解决的 crit 线程需要使用 crit 浏览器 UI。
- 差异是 `git diff HEAD`，再加上最多 20 个未跟踪文件。

## Install

```
claude plugin marketplace add tomasz-tomczyk/crit
claude plugin install crit-tui@crit
```

## Original README

# crit-tui

A crit review loop inside Claude Code, as a mod. Comment on lines of the
conversation, the working-tree diff, or a file in a pane. Send the review to
Claude in one go. Claude answers each comment in its thread through a tool.

**Early version.**

## Install

Needs Claude Code 2.1.287 or later (mods) and the `crit` CLI on your PATH.

```
/plugin marketplace add tomasz-tomczyk/crit
/plugin install crit-tui@crit
```

It sits next to the main `crit` plugin from the same marketplace; you can
have both. To try it from a checkout instead:

```sh
claude --plugin-dir integrations/claude-code-tui
```

## Use

- `/crit-tui` opens the pane (last source used, the conversation at first)
- `/crit-tui chat`, `/crit-tui diff`, `/crit-tui file <path>` pick the source
- `/crit-tui send` sends the review, `/crit-tui close` closes the pane

The pane is one `Client` region: it gets raw keys and mouse events. Click
it once to give it the keys (Esc gives them back to the prompt).

| input | does |
| --- | --- |
| click a line | move the cursor there |
| drag | select rows |
| click a thread | pick it for `r` / `x` |
| `j` `k`, ↑ ↓, wheel | move |
| shift+↑ ↓, or `v` then move | select rows |
| space / pagedown, ctrl+u / pageup | page |
| `g` `G`, home end | top, bottom |
| `n` `p`, → ← | next, previous message or file |
| `l`, tab | next thread |
| `c`, enter | comment on the line or selection |
| `r` | reply to the picked thread, or the one on this line |
| `x` | resolve it |
| `s` | send drafts and replies to Claude |
| `a` | ask Claude to review the diff and leave comments |
| `1` `2` `3` | conversation, diff, file |
| `h` | show or hide resolved threads |
| `f` | reload the source |

While typing a comment: enter saves, shift+enter adds a line, ctrl+u
clears. To cancel: enter or backspace on an empty box, or click `cancel`.
ctrl+c and Esc never reach the pane: Claude Code takes them.

While the pane is closed, a band above the prompt shows drafts and new
replies from Claude, with `send` and `open` buttons. The status line shows
the same counts. A reply in the transcript that has comments gets a line
under it with the count.

## What Claude gets

Three tools:

- `mcp__crit-tui__reply` `{ id, body, resolve? }`: answer a comment
- `mcp__crit-tui__comment` `{ file, line, end_line?, body }`: leave a comment on code
- `mcp__crit-tui__threads` `{ include_resolved? }`: list open threads

`send` submits one prompt with each new comment (where, quoted lines, body,
id) and each new reply, and asks Claude to answer every item with `reply`.

## Where comments live

Everything goes to crit through its CLI, so the crit browser UI and
`crit comments` see the same review.

- **Diff and file comments** go to the repo's review file with
  `crit comment --json`. A partial selection carries `quote` and
  `quote_offset`, as a web UI text selection does (an older crit ignores
  the two fields).
- **Chat comments** go to a crit plan named `claude-chat-<session id>`.
  On the first chat comment the mod saves the conversation with
  `crit plan --name <slug> --no-wait` (one row per line), then comments
  with `crit comment --plan <slug>`. After each turn it saves again; crit
  adds a version only when the text changed. Sessions with no chat comments
  create nothing. Needs a crit with `crit plan --no-wait`; with an older
  crit, chat comments stay in the session.
- **Claude's replies** are written with `--author Claude`.
- Without the crit CLI (setting `critBin`), all comments stay in the session.

## How the pane is built

- `hooks/register.tsx` owns the data (documents, threads, crit sync) and
  draws the pane as one `<Client module="./client.tsx">`.
- `hooks/client.tsx` owns the cursor, selection, scrolling and the comment
  box, and posts each change (`comment`, `reply`, `resolve`, `send`, ...) to
  the hooks module through `ui.message`.
- A Client's props are capped near 100k characters, so it gets a window of
  rows around the cursor and asks for a new window near the edges.
- The engine ignores a `setState` made while the Client draws, so the
  Client keeps its state in a module variable and calls `setState` only
  from its key and mouse handlers.

## Developing

```sh
claude plugin validate integrations/claude-code-tui
claude plugin test integrations/claude-code-tui
```

## Limits of this early version

- crit paths are taken as repo-root relative. Start Claude Code at the repo root.
- Removed (`-`) diff lines anchor to the new-side line they sit at; crit has
  no old-side anchor in `crit comment --json`.
- `crit comment --plan` leaves `anchor` empty (crit bug), so a chat comment
  does not follow its text if earlier lines of the conversation change.
- Reopening a resolved crit thread is left to the crit browser UI.
- The diff is `git diff HEAD` plus up to 20 untracked files.
