johntrob14/lens-view
lens-view
一个查看 lens trace(Jacobian lens、logit lens、tuned lens)的查看器,与编码代理并排运行。它提供 Claude Code 插件、/lens-view 命令和一个可由模型调用的工具,可在 Claude Code 内打开窗格;还提供 MCP 前端和独立的终端查看器。
关于这个 mod
lens-view 会读取 Jacobian lens、logit lens 或 tuned lens 在每一层和每个 token 位置报告的内容,并将其显示在产生该 trace 的编码代理旁边。Claude Code 前端是通过插件 marketplace 安装的 mod(/plugin marketplace add johntrob14/lens-view,然后执行 /plugin install lens-view@lens-view),提供 /lens-view <path> 命令和一个由模型调用的工具,二者都会在 Claude Code 内打开窗格。其他代理可以使用 MCP 工具 lens_view,在 tmux 窗格中打开终端查看器;终端查看器也可以独立运行,命令为 lens-view trace.json。所有前端共用一个解析器(src/lens_view/trace.py)并需要 uv;tmux 前端要求代理在 tmux 内运行。trace 格式目前是草案(FORMAT.md),今后会改变。
安装
请先查看作者 README 确认 marketplace 和插件名称;命令可能随仓库结构改变。
claude plugin marketplace add johntrob14/lens-view claude plugin install lens-view
原文 / README
lens-view
A viewer for lens traces: what a Jacobian lens, logit lens or tuned lens reads out at every layer and token position. It runs beside a coding agent, so you can look at a trace while you work on the code that produced it.
The trace format is described in FORMAT.md. It is a draft and will change.
Front ends
| Where | What you get | Install |
| --- | --- | --- |
| Claude Code (default) | A mod: a /lens-view <path> command and a tool the model calls, both opening a pane inside Claude Code | Plugin, below |
| Codex, or any agent with MCP | An MCP tool, lens_view, that opens the terminal viewer in a tmux pane beside the agent | MCP, below |
| A terminal | The terminal viewer on its own: lens-view trace.json | uv tool install git+https://github.com/johntrob14/lens-view |
All three read traces through the Python package (src/lens_view/trace.py). The mod calls lens-view-json, which prints a trace as normalized JSON, so there is one parser.
All three need uv. The tmux front end needs the agent to run inside tmux.
Claude Code plugin
/plugin marketplace add johntrob14/lens-view
/plugin install lens-view@lens-view
Codex and other MCP clients
# ~/.codex/config.toml
[mcp_servers.lens-view]
command = "uv"
args = ["run", "--quiet", "--frozen", "--no-dev", "--project", "/path/to/lens-view", "lens-view-mcp"]
env_vars = ["TMUX", "TMUX_PANE"]
The repository also carries a Codex plugin manifest (.codex-plugin/plugin.json, mcp.json).
Layout
| Path | What |
| --- | --- |
| src/lens_view/trace.py | Trace format: parsing, loading, lens-view-json |
| src/lens_view/app.py | Terminal viewer (Textual), lens-view |
| src/lens_view/pane.py, mcp_server.py | tmux pane launcher and MCP server, lens-view-mcp |
| .claude-plugin/, hooks/, types/ | Claude Code plugin: the mod |
| .codex-plugin/, mcp.json | Codex plugin |
Development
uv run --group dev pytest # Python
claude plugin validate . && claude plugin test . # the mod