agent-whisker 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/README.md +12 -3
  2. package/README.zh-CN.md +12 -3
  3. package/package.json +3 -2
  4. package/packages/antigravity-plugin/package.json +1 -1
  5. package/packages/antigravity-plugin/plugin.json +1 -1
  6. package/packages/claude-plugin/.claude-plugin/plugin.json +1 -1
  7. package/packages/claude-plugin/.codex-plugin/plugin.json +1 -1
  8. package/packages/claude-plugin/README.md +11 -1
  9. package/packages/claude-plugin/README.zh-CN.md +4 -1
  10. package/packages/claude-plugin/bin/taskstate +145 -4
  11. package/packages/claude-plugin/hooks/codex.json +8 -8
  12. package/packages/claude-plugin/package.json +1 -1
  13. package/packages/cli/README.md +76 -3
  14. package/packages/cli/README.zh-CN.md +76 -3
  15. package/packages/cli/package.json +1 -1
  16. package/packages/cli/src/command.js +20 -3
  17. package/packages/cli/src/commands/catalog.js +26 -7
  18. package/packages/cli/src/commands/doctor.js +31 -27
  19. package/packages/cli/src/commands/exclude.js +156 -0
  20. package/packages/cli/src/commands/extract.js +4 -2
  21. package/packages/cli/src/commands/index-command.js +1 -1
  22. package/packages/cli/src/commands/index.js +4 -0
  23. package/packages/cli/src/commands/install.js +12 -1
  24. package/packages/cli/src/commands/nudge.js +39 -37
  25. package/packages/cli/src/commands/read.js +2 -1
  26. package/packages/cli/src/commands/search.js +33 -3
  27. package/packages/cli/src/commands/sessions.js +20 -12
  28. package/packages/cli/src/commands/status.js +6 -3
  29. package/packages/cli/src/commands/tui.js +62 -0
  30. package/packages/cli/src/commands/version.js +4 -4
  31. package/packages/cli/src/exclusion.js +88 -0
  32. package/packages/cli/src/install/codex-plugin.js +6 -5
  33. package/packages/cli/src/install/external.js +48 -37
  34. package/packages/cli/src/install/handlers.js +4 -3
  35. package/packages/cli/src/install/mcp.js +3 -3
  36. package/packages/cli/src/install/steps.js +43 -15
  37. package/packages/cli/src/install/wrapper.js +28 -5
  38. package/packages/cli/src/main.js +9 -12
  39. package/packages/cli/src/node-version.js +25 -0
  40. package/packages/cli/src/run.js +25 -5
  41. package/packages/cli/src/tui/app.js +1430 -0
  42. package/packages/cli/src/tui/data/call.js +83 -0
  43. package/packages/cli/src/tui/data/poll.js +24 -0
  44. package/packages/cli/src/tui/glyphs.js +93 -0
  45. package/packages/cli/src/tui/i18n.js +342 -0
  46. package/packages/cli/src/tui/model.js +251 -0
  47. package/packages/cli/src/tui/pages/common.js +71 -0
  48. package/packages/cli/src/tui/pages/library.js +154 -0
  49. package/packages/cli/src/tui/pages/sessions.js +96 -0
  50. package/packages/cli/src/tui/pages/system.js +124 -0
  51. package/packages/cli/src/tui/pages/tasks.js +297 -0
  52. package/packages/cli/src/tui/run.js +216 -0
  53. package/packages/cli/src/tui/term/keys.js +152 -0
  54. package/packages/cli/src/tui/term/screen.js +88 -0
  55. package/packages/cli/src/tui/term/term.js +157 -0
  56. package/packages/cli/src/tui/term/width.js +290 -0
  57. package/packages/cli/src/tui/ui/widgets.js +247 -0
  58. package/packages/core/README.md +1 -1
  59. package/packages/core/README.zh-CN.md +2 -2
  60. package/packages/core/package.json +1 -1
  61. package/packages/core/src/catalog.js +13 -1
  62. package/packages/core/src/clairic.js +1 -1
  63. package/packages/core/src/convert.js +1 -1
  64. package/packages/core/src/db.js +6 -1
  65. package/packages/core/src/host.js +104 -0
  66. package/packages/core/src/index.js +2 -2
  67. package/packages/core/src/library-read.js +12 -8
  68. package/packages/core/src/nudge.js +34 -1
  69. package/packages/core/src/schema.js +17 -0
  70. package/packages/core/src/sessions-read.js +23 -11
  71. package/packages/dsh-plugin/package.json +1 -1
  72. package/packages/herdr-plugin/herdr-plugin.toml +1 -1
  73. package/packages/herdr-plugin/package.json +1 -1
  74. package/packages/mcp/README.md +5 -5
  75. package/packages/mcp/README.zh-CN.md +5 -5
  76. package/packages/mcp/package.json +1 -1
  77. package/packages/pi-extension/README.md +1 -1
  78. package/packages/pi-extension/README.zh-CN.md +1 -1
  79. package/packages/pi-extension/package.json +1 -1
  80. package/packages/pi-extension/src/extension.ts +3 -3
  81. package/packages/service/package.json +1 -1
  82. package/packages/service/src/index.js +1 -1
  83. package/packages/service/src/runtime.js +4 -0
package/README.md CHANGED
@@ -6,6 +6,8 @@ English · [简体中文](README.zh-CN.md)
6
6
 
7
7
  ## Quick start
8
8
 
9
+ On Linux, follow the [manual setup](packages/cli/README.md#linux) instead of running the installer commands below.
10
+
9
11
  From a source checkout (Node runs TypeScript directly; keep the checkout in place because the installed launcher points to it):
10
12
 
11
13
  ```sh
@@ -16,7 +18,7 @@ node packages/cli/src/main.ts install --dry-run
16
18
  node packages/cli/src/main.ts install --apply all
17
19
  ```
18
20
 
19
- From npm (once published, or from a [locally packed tarball](packages/cli/README.md#the-npm-package) with `npm install -g <tarball>`):
21
+ From npm (or from a [locally packed tarball](packages/cli/README.md#the-npm-package) with `npm install -g <tarball>`):
20
22
 
21
23
  ```sh
22
24
  npm install -g agent-whisker
@@ -25,7 +27,7 @@ agent-whisker install --apply all
25
27
  agent-whisker doctor
26
28
  ```
27
29
 
28
- `agent-whisker` is pre-release (`0.1.0`). Runtime requires Node `>=24.22.1 <25` or `>=26.13.0 <27` (with `~/.local/bin` on `PATH` on macOS). Markdown and plain text import directly. PDF text import requires Poppler's `pdftotext` (`qpdf` adds PDF bookmarks and page slicing), and DOCX import requires Pandoc `>=2.15`.
30
+ The current release is `0.2.0`, published to npm as `agent-whisker`. Runtime requires Node `>=24.22.1 <25` or `>=26.13.0 <27` (with `~/.local/bin` on `PATH` on macOS). Markdown and plain text import directly. PDF text import requires Poppler's `pdftotext` (`qpdf` adds PDF bookmarks and page slicing), and DOCX import requires Pandoc `>=2.15`.
29
31
 
30
32
  CI runs checks on macOS, Ubuntu, and Windows. `agent-whisker install` configures launchers, background sync, and agent programs on macOS and Windows; on Linux, the CLI, stdio MCP server, and foreground `service run` work directly. See [Windows setup](packages/cli/README.md#windows).
31
33
 
@@ -95,6 +97,13 @@ agent-whisker sessions sync
95
97
  agent-whisker sessions search "upload retry budget" --project --group session
96
98
  ```
97
99
 
100
+ Browse tasks, the library, sessions, agent setup and `doctor` in one terminal screen (an interactive terminal is required; every write asks first and shows the exact command it runs, see [Terminal interface](packages/cli/README.md#terminal-interface)):
101
+
102
+ ```sh
103
+ agent-whisker tui
104
+ agent-whisker tui --page sessions
105
+ ```
106
+
98
107
  Query the read-only MCP server (`tools/call` payloads):
99
108
 
100
109
  ```json
@@ -149,7 +158,7 @@ Nine workspace packages live under `packages/`:
149
158
 
150
159
  ## Releases
151
160
 
152
- [`main`](https://github.com/Tomatamatom1/agent-whisker/commits/main/) is the development branch. `node scripts/package.ts pack <directory>` builds a self-contained npm tarball from tracked files, and `v*.*.*` release tags publish to npm through GitHub Actions.
161
+ [`main`](https://github.com/Tomatamatom1/agent-whisker/commits/main/) is the development branch. `node scripts/package.ts pack <directory>` builds a self-contained npm tarball from tracked files, and `v*.*.*` release tags publish to npm through GitHub Actions. The first release, `0.1.0` (tag `v0.1.0`), is on npm as `agent-whisker`.
153
162
 
154
163
  ## License
155
164
 
package/README.zh-CN.md CHANGED
@@ -6,6 +6,8 @@
6
6
 
7
7
  ## 快速上手
8
8
 
9
+ 在 Linux 上请按[手动配置指南](packages/cli/README.zh-CN.md#linux)操作,无需运行下方的安装器命令。
10
+
9
11
  从源码检出安装(Node 直接运行 TypeScript;启动器指向该检出目录,请保留仓库位置):
10
12
 
11
13
  ```sh
@@ -16,7 +18,7 @@ node packages/cli/src/main.ts install --dry-run
16
18
  node packages/cli/src/main.ts install --apply all
17
19
  ```
18
20
 
19
- 从 npm 安装(正式发布后,或按 [npm 打包说明](packages/cli/README.zh-CN.md#npm-包) 使用 `npm install -g <tarball>` 安装本地构建包):
21
+ 从 npm 安装(或按 [npm 打包说明](packages/cli/README.zh-CN.md#npm-包) 使用 `npm install -g <tarball>` 安装本地构建包):
20
22
 
21
23
  ```sh
22
24
  npm install -g agent-whisker
@@ -25,7 +27,7 @@ agent-whisker install --apply all
25
27
  agent-whisker doctor
26
28
  ```
27
29
 
28
- `agent-whisker` 当前为预发布版本(`0.1.0`)。运行需要 Node `>=24.22.1 <25` 或 `>=26.13.0 <27`(macOS 上需将 `~/.local/bin` 加入 `PATH`)。Markdown 和纯文本直接导入;导入 PDF 文本需要 Poppler 的 `pdftotext`(装有 `qpdf` 时同时支持书签读取与页面切分),导入 DOCX 需要 Pandoc `>=2.15`。
30
+ 当前版本为 `0.2.0`,已以 `agent-whisker` 为包名发布到 npm。运行需要 Node `>=24.22.1 <25` 或 `>=26.13.0 <27`(macOS 上需将 `~/.local/bin` 加入 `PATH`)。Markdown 和纯文本直接导入;导入 PDF 文本需要 Poppler 的 `pdftotext`(装有 `qpdf` 时同时支持书签读取与页面切分),导入 DOCX 需要 Pandoc `>=2.15`。
29
31
 
30
32
  CI 在 macOS、Ubuntu 与 Windows 上运行检查。`agent-whisker install` 在 macOS 和 Windows 上配置启动器、后台同步及已安装的 agent 程序;在 Linux 上可直接使用 CLI、stdio MCP 服务与前台 `service run`。详见 [Windows 安装指南](packages/cli/README.zh-CN.md#windows)。
31
33
 
@@ -95,6 +97,13 @@ agent-whisker sessions sync
95
97
  agent-whisker sessions search "upload retry budget" --project --group session
96
98
  ```
97
99
 
100
+ 在一个终端界面里浏览任务、文档库、会话、agent 接入状态和 `doctor`(需要交互式终端;每个写操作都先询问,并显示实际执行的命令,见[终端界面](packages/cli/README.zh-CN.md#终端界面)):
101
+
102
+ ```sh
103
+ agent-whisker tui
104
+ agent-whisker tui --page sessions
105
+ ```
106
+
98
107
  调用只读 MCP 服务(`tools/call` 请求参数):
99
108
 
100
109
  ```json
@@ -149,7 +158,7 @@ agent-whisker extract "$DOC_ID" --pages 1,2 --fields '{"invoice_total":{"type":"
149
158
 
150
159
  ## 发布说明
151
160
 
152
- [`main`](https://github.com/Tomatamatom1/agent-whisker/commits/main/) 是日常开发分支。运行 `node scripts/package.ts pack <directory>` 可从受管文件构建自包含的 npm 包,推送 `v*.*.*` 标签后由 GitHub Actions 发布至 npm。
161
+ [`main`](https://github.com/Tomatamatom1/agent-whisker/commits/main/) 是日常开发分支。运行 `node scripts/package.ts pack <directory>` 可从受管文件构建自包含的 npm 包,推送 `v*.*.*` 标签后由 GitHub Actions 发布至 npm。首个版本 `0.1.0`(标签 `v0.1.0`)已以 `agent-whisker` 为包名发布在 npm 上。
153
162
 
154
163
  ## 许可证
155
164
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-whisker",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "dependencies": {
5
5
  "yaml": "2.9.1",
6
6
  "jieba-wasm": "2.4.0"
@@ -30,7 +30,8 @@
30
30
  },
31
31
  "type": "module",
32
32
  "bin": {
33
- "agent-whisker": "packages/cli/src/main.js"
33
+ "agent-whisker": "packages/cli/src/main.js",
34
+ "taskstate": "packages/claude-plugin/bin/taskstate"
34
35
  },
35
36
  "files": [
36
37
  "packages/",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-whisker/antigravity-plugin",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "license": "MIT",
5
5
  "private": true,
6
6
  "type": "module"
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "agent-whisker",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "description": "What the agent-whisker MCP server holds and when to call it, in every turn; at session start, the earlier sessions recorded in this directory and the attached task's view, written only through taskstate; the task-state skill and a review agent"
5
5
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-whisker",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "description": "Task goal, expectations and evidence injected into the session and every subagent, written only through taskstate; a pointer line on the sessions recorded in this directory",
5
5
  "author": { "name": "agent-whisker" },
6
6
  "license": "MIT",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-whisker",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "description": "In Codex: what agent-whisker holds and a pointer to the sessions recorded in this directory at session start; the task state's view at the start, at a prompt and at a subagent's start; the writer named in shell calls that run taskstate; the service nudged when a turn, a subagent or the session ends",
5
5
  "author": { "name": "agent-whisker" },
6
6
  "license": "MIT",
@@ -63,7 +63,7 @@ background to be woken when another session has new entries or has stopped chang
63
63
  - `agents/recall.md`: the `agent-whisker:recall` subagent, for a question about earlier work asked in the user's own
64
64
  words: it searches the sessions and the library with several wordings, opens the hits, and answers with verbatim
65
65
  quotes and where each is (session and entry, document and page), so the searching stays out of the main
66
- conversation. It runs on `haiku` and has every tool but `Write`, `Edit` and `NotebookEdit`.
66
+ conversation. It runs on `haiku` and can use only `ToolSearch` and the agent-whisker MCP tools (`mcp__agent-whisker__*`, `mcp__plugin_agent-whisker_agent-whisker__*`); `Write`, `Edit`, `NotebookEdit` and `Bash` are explicitly disabled.
67
67
  - `skills/task-state/SKILL.md`: the `agent-whisker:task-state` skill: when to open a task, how to state an
68
68
  expectation, what to report before a review, when and on which model to start the review, and how to wait for a
69
69
  review that runs in another session.
@@ -88,6 +88,7 @@ twice, under `mcp__agent-whisker__…` and `mcp__plugin_agent-whisker_agent-whis
88
88
  taskstate attach <T> | close <T> close appends an entry (X…); nothing is deleted
89
89
  taskstate park <T> | unpark <T> | hold [<T>]
90
90
  taskstate show [<T>] | log [<T>] | facts [<T>]
91
+ taskstate list | where every task and its state; where the state is kept
91
92
  taskstate conclude <E> met|not-met|not-verified --basis <id,...> [--not-covered "<text>"] (V…)
92
93
  taskstate gap "<text>" [--check "<proposed command>"] (G…)
93
94
 
@@ -120,6 +121,15 @@ whether tracked files had uncommitted changes then; both are null outside a git
120
121
  `facts` shows them on each run's line and says when an expectation's usable passing runs started on different
121
122
  commits or with uncommitted changes. These are shown, never a reason that refuses `met`.
122
123
 
124
+ `taskstate list` prints every task with its state (`open`, `held`, `parked` or `closed`) and its goal, and
125
+ `taskstate where` the directory that holds the state. `list`, `show [<T>]`, `facts [<T>]` and `where` take `--json`,
126
+ which prints one line of JSON with `"schema": 1` for programs such as `agent-whisker tui`. `facts --json` gives, for
127
+ each expectation, the decision `facts` prints: `runs`, `passing`, `usable`, `seenRed`, `changed`, `failed`, `reasons`
128
+ and `canBeMet`. `show --json` gives the same and each expectation's latest conclusion, with `stale` (a run of the
129
+ expectation was recorded after the conclusion, or the conclusion is `met` and the expectation cannot be met now) and
130
+ `selfReview` (every run its basis names was recorded by the writer of the conclusion itself, the same session and agent, so no other writer's run stands behind it). Without `--json`, what the
131
+ commands print is unchanged.
132
+
123
133
  ## Review
124
134
 
125
135
  A review runs once after a round of changes is merged (a round is the changes recorded under one task), not
@@ -10,7 +10,7 @@ Claude Code 插件 `agent-whisker`。它让 agent 看到自己手上任务的状
10
10
  - `hooks/hooks.json`:SessionStart、UserPromptSubmit 和 SubagentStart 调用 `taskstate hook …` 注入视图。未关联任务的主会话在启动或收到提示时,会自动接管唯一符合条件的任务:任务仍开启、未暂停、最近 7 天有过条目,且在附近做过或被明确指定交接。有多个候选时不会自动关联,只有 SessionStart 会列出最多三个供选择。「附近」指同一目录、其上级或下级;家目录和文件系统根目录只匹配自身。任务有变化或收到压缩信号时立即恢复视图;否则每到第 20 个没有变化的提示就再显示一次。子代理不会自动接管。Bash 上的一个 PreToolUse 钩子只在命令运行 `taskstate` 时启动,它在命令前加上 `export AGENT_WHISKER_TASK_AGENT=…`,这样每个条目都会记下是主会话写的,还是哪个子代理写的。这些钩子从不写 `state.jsonl`,总是以 0 退出;没有要说的、出了任何错误或者缺少 `node` 时,什么也不打印。Stop、SubagentStop 和 SessionEnd 在后台(`"async": true`)运行 `agent-whisker nudge >/dev/null 2>&1; exit 0`:它设置 `<home>/run/nudge` 的修改时间,不打开任何东西。Claude Code 不等它结束;它不会阻塞,什么也不打印,并以 0 退出,即使没有安装 `agent-whisker` 或数据目录尚未初始化也是如此。SessionStart 还会运行 `agent-whisker hook claude`(超时 5 秒),它最多打印一行指引,出了任何问题都不打印;它读取存储,只写每次打开存储都会写的内容,从不写留存的会话、存储的 blob 或索引。`agent-whisker` 不在 PATH 上,或者数据目录尚未初始化时,这个处理器改为给出一条提示,形式是 `systemMessage`,人能看到,模型看不到。SubagentStart 在第二个处理器组里用 matcher `^Explore$` 运行 `command -v agent-whisker >/dev/null 2>&1 && agent-whisker hook claude 2>/dev/null; exit 0`:在那里,这行提示也把主会话计算在内,并提到 `mcp__agent-whisker__session_search`。UserPromptSubmit 也在任务状态处理器旁边运行 `agent-whisker hook claude`,除非 `AGENT_WHISKER_PROMPT_POINTER` 是 `off`(不分大小写,忽略前后的空白):它的 shell 命令行在 `node` 启动之前检查这个变量,所以关掉时只花一个 shell 的开销。提示词前 400 个字节里有两个罕见的词(中文或日文里是相邻的两个字,和索引保存这类文字的方式一样)在一个以前的主会话的同一个条目里同时出现时,它给出一行:用户输入的这两个词、含有它们的主会话数、最近一个这样的条目的日期,以及带上这两个词的调用 `mcp__agent-whisker__session_search`;从不放进记录里的文字。同一对词在一个会话里只说一次,一个会话最多得到三行这样的提示;说过的词对记在 `<home>/run/hook/` 下这个会话自己的一个小文件里,一周后删除。以 `/` 开头的提示词、在时间预算内还没决定的钩子(从进程启动起 300 毫秒,或者 `AGENT_WHISKER_PROMPT_POINTER` 给出的 50 到 5000 之间的整数毫秒),以及会话开始那一行什么也不说的所有情况,都什么也得不到,也没有提示。
11
11
  - `.codex-plugin/plugin.json` 和 `hooks/codex.json`:同一个目录作为 Codex 插件,名称和版本相同。Codex 读取它自己的清单,清单指向 `hooks/codex.json`,所以 Codex 从不运行 `hooks.json`:会话开始时的文字(`agent-whisker hook codex`)、任务视图、在运行 `taskstate` 的 shell 调用里记下写入者(`taskstate hook pre-bash codex`),以及提醒。它的命令从 PATH 运行 `taskstate` 和 `agent-whisker`。`agent-whisker` 不在 PATH 上,或者数据目录尚未初始化时,会话开始的处理器改为给出和 Claude Code 里相同的提示,形式是 `systemMessage`,Codex 把它作为警告显示给你,模型收不到。Codex 只有在你信任这些钩子之后才运行它们,插件每次更新后都会再问一次。
12
12
  - `agents/review.md`:`agent-whisker:review` 子代理([评审](#评审));`review-perspectives.md` 是它的问题清单。
13
- - `agents/recall.md`:`agent-whisker:recall` 子代理,用于用户用自己的话问起以前的工作:它用几种说法搜索会话和文档库,打开命中的地方,用逐字的引文回答,并给出每条引文所在的位置(会话和条目,文档和页码),这样搜索的过程留在主对话之外。它在 `haiku` 上运行,除 `Write`、`Edit` 和 `NotebookEdit` 外有所有工具。
13
+ - `agents/recall.md`:`agent-whisker:recall` 子代理,用于用户用自己的话问起以前的工作:它用几种说法搜索会话和文档库,打开命中的地方,用逐字的引文回答,并给出每条引文所在的位置(会话和条目,文档和页码),这样搜索的过程留在主对话之外。它在 `haiku` 上运行,只能使用 `ToolSearch` 和 agent-whisker 的 MCP 工具(`mcp__agent-whisker__*`、`mcp__plugin_agent-whisker_agent-whisker__*`);明确禁用 `Write`、`Edit`、`NotebookEdit` 和 `Bash`。
14
14
  - `skills/task-state/SKILL.md`:`agent-whisker:task-state` 技能,说明何时开启任务、如何写一条预期、评审之前要报告什么、何时在哪个模型上启动评审,以及如何等待在另一个会话里进行的评审。
15
15
 
16
16
  插件不带 MCP 服务条目。agent-whisker 的 MCP 服务由 `agent-whisker install`(或 `claude mcp add`,见 [MCP 指南](../mcp/README.zh-CN.md#手动注册))用启动脚本的绝对路径注册。插件服务的命令和参数与更高一层已注册的服务完全相同时,Claude Code 只连接一次,并丢弃插件的那一份。但插件无法知道那个路径,而任何别的写法的条目(例如 `agent-whisker mcp`)都会与已注册的那个并列加载。那样一来,一个会话里的每个工具都会出现两次,分别在 `mcp__agent-whisker__…` 和 `mcp__plugin_agent-whisker_agent-whisker__…` 下。这是在 Claude Code 2.1.332 上用 `claude mcp list` 观察到的(见 [CLI 指南](../cli/README.zh-CN.md#安装与诊断))。
@@ -26,6 +26,7 @@ Claude Code 插件 `agent-whisker`。它让 agent 看到自己手上任务的状
26
26
  taskstate attach <T> | close <T> close appends an entry (X…); nothing is deleted
27
27
  taskstate park <T> | unpark <T> | hold [<T>]
28
28
  taskstate show [<T>] | log [<T>] | facts [<T>]
29
+ taskstate list | where every task and its state; where the state is kept
29
30
  taskstate conclude <E> met|not-met|not-verified --basis <id,...> [--not-covered "<text>"] (V…)
30
31
  taskstate gap "<text>" [--check "<proposed command>"] (G…)
31
32
 
@@ -35,6 +36,8 @@ Claude Code 插件 `agent-whisker`。它让 agent 看到自己手上任务的状
35
36
 
36
37
  每次运行都会自动记下(无需传任何参数)启动目录的 git 提交(`HEAD`),以及当时已跟踪的文件有没有未提交的改动;不在 git 工作树里或没有 `git` 时,两者都是 null。`facts` 在每次运行的那一行显示它们;一条预期的可用通过运行起始于不同的提交或带有未提交的改动时,它也会指出来。这些只用于显示,从不作为拒绝 `met` 的理由。
37
38
 
39
+ `taskstate list` 列出所有任务,连同各自的状态(`open`、`held`、`parked` 或 `closed`)和目标;`taskstate where` 打印存放任务状态的目录。`list`、`show [<T>]`、`facts [<T>]` 和 `where` 接受 `--json`,打印一行 JSON,其中含 `"schema": 1`,供 `agent-whisker tui` 这样的程序读取。`facts --json` 对每条预期给出 `facts` 打印的那个判定:`runs`、`passing`、`usable`、`seenRed`、`changed`、`failed`、`reasons` 和 `canBeMet`。`show --json` 给出同样的内容,外加每条预期最新的结论,带 `stale`(结论之后又记录了这条预期的运行,或者结论是 `met` 而这条预期现在已不能判为达成)和 `selfReview`(它依据中的每一次运行都由写结论者本身记录,即同一会话、同一 Agent,没有其他写入者的运行作为支撑)。不带 `--json` 时,这些命令打印的内容不变。
40
+
38
41
  ## 评审
39
42
 
40
43
  评审在一轮改动合并之后运行一次(一轮就是记在同一个任务下的改动),而不是每个 pull request 或每次提交都运行。启动 `agent-whisker:review` 的 agent 交给它任务 id 和已合并的范围,并且在另一个模型上启动它,而不是完成工作的那个模型,因为模型评审自己的工作时往往会认同它。代理文件没有设置 `model`,所以由调用方用 Agent 工具的 `model` 参数选择:要选另一个模型系列的别名,因为调用方自己系列的别名会在调用方的模型上运行([选择模型](https://code.claude.com/docs/en/sub-agents#choose-a-model))。不传这个参数时,评审在 `CLAUDE_CODE_SUBAGENT_MODEL` 指定的模型或调用方的模型上运行;`CLAUDE_CODE_SUBAGENT_MODEL_FORCE` 和 mod 可以覆盖它。评审的回答最后会写明它运行在哪个模型上。
@@ -496,6 +496,127 @@ function factsText(st, T) {
496
496
  return lines.join("\n");
497
497
  }
498
498
 
499
+ // ---------- JSON: the same facts for programs (a terminal or desktop interface), schema 1 ----------
500
+ // Each --json answer is one line of JSON with "schema": 1. Nothing is computed here that factsFor does not decide:
501
+ // an interface shows these fields and never recomputes a verdict. Text fields are the entries' own, unquoted and
502
+ // uncut, since JSON escapes them; an interface sanitises them before it draws them.
503
+ const JSON_SCHEMA = 1;
504
+ const outJson = (value) => out(JSON.stringify({ schema: JSON_SCHEMA, ...value }));
505
+ // A task's state: closed, parked, held (offered for handoff) or open.
506
+ const stateOf = (st, T) => (st.closed.has(T) ? "closed" : st.parked.has(T) ? "parked" : st.held.has(T) ? "held" : "open");
507
+ // The sessions that wrote to the task, by the ids their programs gave them, latest first.
508
+ const sessionIds = (es) => {
509
+ const ids = [];
510
+ for (const e of [...es].reverse()) if (SAFE_ID.test(e.session ?? "") && !ids.includes(e.session)) ids.push(e.session);
511
+ return ids;
512
+ };
513
+ const runJson = (r) => ({
514
+ id: r.id,
515
+ exit: r.exit,
516
+ expectFail: !!r.expect_fail,
517
+ ok: r.ok === true,
518
+ command: String(r.command ?? ""),
519
+ commit: shortCommit(r.commit),
520
+ dirty: r.dirty === true,
521
+ at: r.at ?? null,
522
+ started: r.started ?? null,
523
+ session: r.session ?? null,
524
+ agent: agentLabel(r.agent),
525
+ log: typeof r.log === "string" ? r.log : null,
526
+ targets: (r.targets || []).map((t) => t.path),
527
+ });
528
+ // factsFor of E as JSON: the runs, which pass and which of those are usable, the red runs on a usable run's command,
529
+ // the targets changed and the commands failed again since a passing run, and the reasons E cannot be concluded "met"
530
+ // (canBeMet is their absence).
531
+ function factsJson(st, E) {
532
+ const f = factsFor(st, E);
533
+ return {
534
+ id: E.id,
535
+ core: !!E.core,
536
+ text: String(E.text ?? ""),
537
+ runs: f.runs.map(runJson),
538
+ passing: f.passing.map((r) => r.id),
539
+ usable: f.usable.map((r) => r.id),
540
+ seenRed: f.seenRed.map((r) => r.id),
541
+ changed: Object.fromEntries(f.changed),
542
+ failed: Object.fromEntries(f.failed),
543
+ reasons: f.reasons,
544
+ canBeMet: f.reasons.length === 0,
545
+ };
546
+ }
547
+ // The latest conclusion of E as JSON, or null. stale: a run of E was recorded after the conclusion, or the conclusion
548
+ // is "met" and E cannot be concluded "met" now (a target changed or the command failed again). selfReview: every run
549
+ // its basis names was recorded by the writer of the conclusion itself (the same session and the same agent), so no
550
+ // other writer's run stands behind it. A review that runs a recorded command again and names both runs, as the review
551
+ // agent does, is not a self-review; a subagent has an agent of its own, so it is not its main session.
552
+ function conclusionJson(st, es, E, facts) {
553
+ const v = es.filter((e) => e.kind === "conclusion" && e.for === E.id).pop();
554
+ if (!v) return null;
555
+ const at = es.indexOf(v);
556
+ const later = es.slice(at + 1).some((e) => e.kind === "run" && e.for === E.id);
557
+ const basisRuns = v.basis.map((b) => st.byId.get(b)).filter((e) => e?.kind === "run");
558
+ return {
559
+ id: v.id,
560
+ verdict: v.verdict,
561
+ basis: v.basis,
562
+ notCovered: v.not_covered ?? null,
563
+ at: v.at ?? null,
564
+ session: v.session ?? null,
565
+ agent: agentLabel(v.agent),
566
+ stale: later || (v.verdict === "met" && facts.reasons.length > 0),
567
+ selfReview:
568
+ !!v.session &&
569
+ basisRuns.length > 0 &&
570
+ basisRuns.every((r) => r.session === v.session && agentLabel(r.agent) === agentLabel(v.agent)),
571
+ };
572
+ }
573
+ function taskJson(st, T) {
574
+ const es = ofTask(st, T);
575
+ const t = st.byId.get(T);
576
+ const last = lastOf(st, T);
577
+ return {
578
+ id: T,
579
+ goal: String(t.goal ?? ""),
580
+ state: stateOf(st, T),
581
+ at: t.at ?? null,
582
+ last: last?.at ?? null,
583
+ cwd: typeof t.cwd === "string" ? t.cwd : null,
584
+ sessions: sessionIds(es),
585
+ };
586
+ }
587
+ function listJson(st) {
588
+ const tasks = st.entries
589
+ .filter((e) => e.kind === "task")
590
+ .map((t) => {
591
+ const es = ofTask(st, t.id);
592
+ const exps = es.filter((e) => e.kind === "expectation");
593
+ const marks = exps.map((E) => {
594
+ const facts = factsFor(st, E);
595
+ const v = conclusionJson(st, es, E, facts);
596
+ return { id: E.id, core: !!E.core, verdict: v?.verdict ?? null, stale: v?.stale ?? false, usable: facts.usable.length };
597
+ });
598
+ return { ...taskJson(st, t.id), expectations: marks, gaps: es.filter((e) => e.kind === "gap").length };
599
+ });
600
+ return { home: HOME, tasks };
601
+ }
602
+ function showJson(st, T) {
603
+ const es = ofTask(st, T);
604
+ const expectations = es
605
+ .filter((e) => e.kind === "expectation")
606
+ .map((E) => {
607
+ const facts = factsJson(st, E);
608
+ return { ...facts, conclusion: conclusionJson(st, es, E, facts) };
609
+ });
610
+ const claims = es
611
+ .filter((e) => e.kind === "claim")
612
+ .map((c) => ({ id: c.id, for: c.for ?? null, text: String(c.text ?? ""), at: c.at ?? null, session: c.session ?? null, agent: agentLabel(c.agent) }));
613
+ const gaps = es
614
+ .filter((e) => e.kind === "gap")
615
+ .map((g) => ({ id: g.id, text: String(g.text ?? ""), check: g.check ?? null, at: g.at ?? null, session: g.session ?? null }));
616
+ return { task: taskJson(st, T), expectations, claims, gaps };
617
+ }
618
+ const whereJson = () => ({ home: HOME, state: STATE, runs: RUNS, sessions: SESSIONS });
619
+
499
620
  // ---------- the view ----------
500
621
  // The sessions that wrote to the task, by the ids their programs gave them, latest first: the first few, and a count
501
622
  // of the rest.
@@ -696,6 +817,8 @@ const USAGE = `taskstate: the task state of agent sessions (state in ${HOME})
696
817
  taskstate park <T> | unpark <T> exclude or restore an open task for automatic selection
697
818
  taskstate hold [<T>] attach and offer this task for cross-directory handoff
698
819
  taskstate show [<T>] | log [<T>] | facts [<T>]
820
+ taskstate list | where every task and its state; where the state is kept
821
+ (list, show, facts and where take --json: one line of JSON with "schema": 1)
699
822
  taskstate conclude <E> met|not-met|not-verified --basis <id,id...> [--not-covered "<text>"]
700
823
  taskstate gap "<text>" [--check "<proposed command>"]
701
824
  Pass --task <T> to name the task explicitly on an evidence write.`;
@@ -709,6 +832,7 @@ const OPTIONS = {
709
832
  basis: { type: "string" },
710
833
  "not-covered": { type: "string" },
711
834
  check: { type: "string" },
835
+ json: { type: "boolean" },
712
836
  };
713
837
  const ALLOWED = {
714
838
  open: [],
@@ -720,9 +844,11 @@ const ALLOWED = {
720
844
  unpark: ["task"],
721
845
  hold: ["task"],
722
846
  close: [],
723
- show: ["task"],
847
+ show: ["task", "json"],
724
848
  log: ["task"],
725
- facts: ["task"],
849
+ facts: ["task", "json"],
850
+ list: ["json"],
851
+ where: ["json"],
726
852
  conclude: ["task", "basis", "not-covered"],
727
853
  gap: ["task", "check"],
728
854
  };
@@ -847,14 +973,29 @@ function cli(argv) {
847
973
  if (typeof result === "string") return out(result);
848
974
  return out(`attached this session to ${result.T}\n${viewText(result.st, result.T)}`);
849
975
  }
976
+ case "list":
977
+ case "where": {
978
+ if (p.length) fail(`${cmd} takes no arguments`);
979
+ if (cmd === "where") return o.json ? outJson(whereJson()) : out(HOME);
980
+ const st = load();
981
+ if (o.json) return outJson(listJson(st));
982
+ const tasks = st.entries.filter((e) => e.kind === "task");
983
+ if (!tasks.length) return out("no task");
984
+ return out(
985
+ tasks.map((t) => `${t.id} ${stateOf(st, t.id)} ${quoted(oneLine(t.goal)).text}`).join("\n"),
986
+ );
987
+ }
850
988
  case "show":
851
989
  case "log":
852
990
  case "facts": {
853
991
  const st = load();
854
992
  const T = p[0] || resolveTask(st, o.task);
855
993
  if (!isTask(st, T)) fail(`no task ${T}`);
856
- if (cmd === "show") return out(viewText(st, T));
857
- if (cmd === "facts") return out(factsText(st, T));
994
+ if (cmd === "show") return o.json ? outJson(showJson(st, T)) : out(viewText(st, T));
995
+ if (cmd === "facts")
996
+ return o.json
997
+ ? outJson({ task: T, expectations: ofTask(st, T).filter((e) => e.kind === "expectation").map((E) => factsJson(st, E)) })
998
+ : out(factsText(st, T));
858
999
  return out(
859
1000
  ofTask(st, T)
860
1001
  .map((e) => JSON.stringify(e))
@@ -7,13 +7,13 @@
7
7
  {
8
8
  "type": "command",
9
9
  "command": "if command -v agent-whisker >/dev/null 2>&1; then agent-whisker hook codex 2>/dev/null; else printf '%s\\n' '{\"systemMessage\":\"agent-whisker: the agent-whisker command is not on the PATH Codex started with; the plugin gives no start line and no nudge until it is (agent-whisker install --apply wrapper writes it to ~/.local/bin)\"}'; fi; exit 0",
10
- "commandWindows": "agent-whisker hook codex",
10
+ "commandWindows": "cmd.exe /d /c \"call agent-whisker hook codex 2>nul & exit /b 0\"",
11
11
  "timeout": 5
12
12
  },
13
13
  {
14
14
  "type": "command",
15
15
  "command": "command -v taskstate >/dev/null 2>&1 && taskstate hook session-start codex 2>/dev/null; exit 0",
16
- "commandWindows": "taskstate hook session-start codex",
16
+ "commandWindows": "cmd.exe /d /c \"call taskstate hook session-start codex 2>nul & exit /b 0\"",
17
17
  "timeout": 5
18
18
  }
19
19
  ]
@@ -25,7 +25,7 @@
25
25
  {
26
26
  "type": "command",
27
27
  "command": "command -v taskstate >/dev/null 2>&1 && taskstate hook prompt codex 2>/dev/null; exit 0",
28
- "commandWindows": "taskstate hook prompt codex",
28
+ "commandWindows": "cmd.exe /d /c \"call taskstate hook prompt codex 2>nul & exit /b 0\"",
29
29
  "timeout": 5
30
30
  }
31
31
  ]
@@ -37,7 +37,7 @@
37
37
  {
38
38
  "type": "command",
39
39
  "command": "command -v taskstate >/dev/null 2>&1 && taskstate hook subagent-start codex 2>/dev/null; exit 0",
40
- "commandWindows": "taskstate hook subagent-start codex",
40
+ "commandWindows": "cmd.exe /d /c \"call taskstate hook subagent-start codex 2>nul & exit /b 0\"",
41
41
  "timeout": 5
42
42
  }
43
43
  ]
@@ -50,7 +50,7 @@
50
50
  {
51
51
  "type": "command",
52
52
  "command": "i=$(cat); case \"$i\" in *taskstate*) command -v taskstate >/dev/null 2>&1 && printf %s \"$i\" | taskstate hook pre-bash codex 2>/dev/null;; esac; exit 0",
53
- "commandWindows": "taskstate hook pre-bash codex",
53
+ "commandWindows": "cmd.exe /d /c \"call taskstate hook pre-bash codex 2>nul & exit /b 0\"",
54
54
  "timeout": 5
55
55
  }
56
56
  ]
@@ -63,7 +63,7 @@
63
63
  "type": "command",
64
64
  "async": true,
65
65
  "command": "agent-whisker nudge >/dev/null 2>&1; exit 0",
66
- "commandWindows": "agent-whisker nudge"
66
+ "commandWindows": "cmd.exe /d /c \"call agent-whisker nudge >nul 2>&1 & exit /b 0\""
67
67
  }
68
68
  ]
69
69
  }
@@ -75,7 +75,7 @@
75
75
  "type": "command",
76
76
  "async": true,
77
77
  "command": "agent-whisker nudge >/dev/null 2>&1; exit 0",
78
- "commandWindows": "agent-whisker nudge"
78
+ "commandWindows": "cmd.exe /d /c \"call agent-whisker nudge >nul 2>&1 & exit /b 0\""
79
79
  }
80
80
  ]
81
81
  }
@@ -86,7 +86,7 @@
86
86
  {
87
87
  "type": "command",
88
88
  "command": "agent-whisker nudge >/dev/null 2>&1; exit 0",
89
- "commandWindows": "agent-whisker nudge"
89
+ "commandWindows": "cmd.exe /d /c \"call agent-whisker nudge >nul 2>&1 & exit /b 0\""
90
90
  }
91
91
  ]
92
92
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-whisker/claude-plugin",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "license": "MIT",
5
5
  "private": true,
6
6
  "type": "module"