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