ClaudeMods
☰
ZH-CN
● 0 人在线 · 浏览 0 次
赞助提交作品
GitHub 仓库 · 发布者 jobbin-ab

witness

将 witness 连接到 Claude Code:在以你的名义将卡片标记为 Done 前先询问,编辑文件前指出覆盖该文件的卡片,并显示工作阶段的 rail(pull request、卡片、artifacts、分支)。

jobbin-ab@jobbin-ab

jobbin-ab/witness-plugins/tree/main/plugins/witness

已翻译

关于这个 mod

Claude Code 会在进行过程中处理你的 witness project;在你表示已经看过工作之前,不会以你的名义将任何内容标记为 Done。它作为插件从 witness-plugins marketplace 安装(claude plugin marketplace add jobbin-ab/witness-plugins,然后 claude plugin install witness),接着运行 /mcp 并登录;无需复制 key,需要 Claude Code 2.1.289+。它通过 witness 的 MCP server 连接 project、工作规则和卡片,在第一次写入前读取规则,并在工作过程中创建卡片。将卡片标记为经你确认的 Done 前,Claude Code 会先询问;选择「Not yet」会将卡片转到 Needs verification。agent 第一次编辑某个文件时,会指出覆盖该文件的卡片;transcript 旁的 rail 会显示 pull request、工作阶段卡片、已发布的 artifacts 和分支,每一列都可打开它所指向的内容(/witness 可切换)。它会在没有 prompt 的情况下调用 witness 两次(第一次编辑文件时使用开启 covers 的 witness_list_cards,每个 project 一次 witness_agent_md),并为 rail 运行 git rev-parse --abbrev-ref HEAD 和 gh pr view --json ...。文件内容和命令输出不会离开机器;在 claude -p 中,Done 会直接通过而未经确认。

安装

请先查看作者 README 确认 marketplace 和插件名称;命令可能随仓库结构改变。

claude plugin marketplace add jobbin-ab/witness-plugins
claude plugin install witness
原文 / README

witness for Claude Code

Claude Code works your witness project as it goes, and nothing goes to Done in your name until you say you watched it work.

Install

claude plugin marketplace add jobbin-ab/witness-plugins
claude plugin install witness

Then /mcp in Claude Code and sign in. There is no key to copy. Needs Claude Code 2.1.289 or later.

What it does

Connects witness. Your projects, their working rules and their cards, through witness's MCP server. The agent reads the rules before its first write and files cards as it works.

Asks before a Done goes in your name. When the agent is about to mark a card Done, verified by you, Claude Code asks you first. "Not yet" stops it, and the agent is told to send the card to Needs verification instead.

 ☐ witness
GN-412 goes to Done, verified by Robin. Did you watch it work?
❯ 1. I watched it work
  2. Not yet

Names the cards that cover a file. The first time the agent edits a file, it is told which cards cover that file and where each stands.

Shows the session's rail. Beside the transcript: the pull request, the cards this session holds with their status, the artifacts it published, and the branch. Each row opens what it names. /witness shows or hides it.

                                                             │ PULL REQUEST
                                                             │   Sessions: a pasted screenshot is kept o…
                                                             │   #365 · Draft
                                                             │
❯ Take GN-304 and GN-433.                                    │ CARDS
                                                             │   ◕ GN-304 Sessions: a pasted screenshot …
  Called witness 2 times                                     │   ○ GN-433 Sessions: how long an archived…
                                                             │
● Claimed both. Starting with GN-304.                        │ ABOUT
                                                             │   claude/gn-304-6355
                                                             │   witness from main

What the plugin does on your machine and network

What it sends. Its own calls go only to witness, through the MCP connection your session's witness tools use. It makes two calls there without the agent asking:

  • witness_list_cards with covers, the first time the agent edits a file in a session, once the session has read a project. It sends the file's path relative to the repository, with the project id and read proof the agent's own witness calls used.
  • witness_agent_md, once per project, when a card arrives before the session knows the project's page (a resumed session, or one past a compaction). It sends the project id, and keeps the page address for the rail's links.

Nothing else leaves your machine: no file contents, no command output, nothing else from the conversation.

What it runs. Two fixed commands in the session's folder, for the rail's pull request and branch: git rev-parse --abbrev-ref HEAD and gh pr view --json number,title,url,state,isDraft,baseRefName, which asks GitHub for the branch's pull request with your own gh login. They run at session start, after a Bash call holding gh pr or git push, and at /witness. Never polled, and never where nothing can show the rail (claude -p). No gh, no pull request section.

What it reads. These tool calls, keeping what the rail and the questions need for the session:

  • witness tools: input and result, for the cards the session holds (id, title, status), each project's read proof, and its page address. A write that puts a card Done with verifiedBy waits for your answer.
  • Bash: the command's text, only to see whether it holds gh pr or git push.
  • Artifact: a publish's result, for its URL and title.
  • Edit, Write, MultiEdit and NotebookEdit: the file's path, for the covers check. A covering card is added as a note to the edit's result, which waits at most two seconds for the answer.

It changes no tool's input, and the only call it stops is a Done you did not confirm. /witness is the one command it answers: it opens or closes the rail, and opening reads the pull request and branch as above.

Good to know

  • The rail opens by itself once, when the session takes its first card, in Claude Code's fullscreen layout. Elsewhere it waits for /witness, and the line under the prompt lists the cards meanwhile: ◕ GN-304 · ○ GN-433 · /witness.
  • In claude -p, or anywhere nobody can be asked, a Done passes through to witness as it would without the plugin.
  • If you added witness with claude mcp add before, remove it (claude mcp remove witness). The plugin brings its own, and with both the agent sees every tool twice.

witness.nu · docs

更多类似作品