pi-claude-supervisor 0.5.1 → 0.5.3
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.
- package/CHANGELOG.md +30 -0
- package/README.cn.md +50 -32
- package/README.md +75 -38
- package/docs/architecture.md +96 -39
- package/docs/automation-hardening-plan.md +212 -0
- package/docs/autonomy-target.md +127 -0
- package/docs/engineering-plan.md +148 -128
- package/docs/implementation-review.md +29 -14
- package/docs/independent-review.md +23 -18
- package/docs/releasing.md +7 -2
- package/docs/testing.md +90 -36
- package/package.json +1 -1
- package/src/acceptance.ts +16 -0
- package/src/config.ts +31 -0
- package/src/decision-session-store.ts +19 -1
- package/src/decision-worker.ts +101 -26
- package/src/index.ts +64 -53
- package/src/notifications.ts +29 -11
- package/src/policy.ts +196 -21
- package/src/redaction.ts +2 -1
- package/src/reviewer.ts +94 -16
- package/src/state.ts +7 -6
- package/src/supervisor.ts +543 -132
- package/src/types.ts +29 -2
- package/src/verifier.ts +257 -20
- package/src/worker/environment.ts +169 -0
- package/src/worker/process-adapter.ts +260 -47
- package/src/worker/tmux-adapter.ts +42 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented here.
|
|
4
4
|
|
|
5
|
+
## [0.5.3](https://github.com/btnalit/pi-claude-supervisor/compare/v0.5.2...v0.5.3) (2026-09-15)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* harden unattended local lifecycle ([#27](https://github.com/btnalit/pi-claude-supervisor/issues/27)) ([2bb29d3](https://github.com/btnalit/pi-claude-supervisor/commit/2bb29d3c31f5196f208716723d89b6b538777939))
|
|
11
|
+
|
|
12
|
+
## [0.5.2](https://github.com/btnalit/pi-claude-supervisor/compare/v0.5.1...v0.5.2) (2026-09-14)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* harden automatic review lifecycle ([fefa5c5](https://github.com/btnalit/pi-claude-supervisor/commit/fefa5c5b39fd2411b5e82df384074983252263ca))
|
|
18
|
+
|
|
5
19
|
## [0.5.1](https://github.com/btnalit/pi-claude-supervisor/compare/v0.5.0...v0.5.1) (2026-09-14)
|
|
6
20
|
|
|
7
21
|
|
|
@@ -18,6 +32,22 @@ All notable changes to this project will be documented here.
|
|
|
18
32
|
|
|
19
33
|
## [Unreleased]
|
|
20
34
|
|
|
35
|
+
### Hardening implemented in working tree (not yet released)
|
|
36
|
+
|
|
37
|
+
- Split JSONL in-process `repairableSession` from cross-restart `persistentSession` and eliminate duplicate terminal transitions.
|
|
38
|
+
- Make `verifying` stop/shutdown cleanup authoritative, with abortable acceptance and Reviewer operations.
|
|
39
|
+
- Pause and rebase the no-output watchdog clock across pause/resume while retaining the cumulative deadline.
|
|
40
|
+
- Include staged, unstaged and bounded untracked evidence in independent Review, with symlink/path safety and fail-closed completeness.
|
|
41
|
+
- Harden assistant-message output framing, startup/runtime preflight, permission gates, bounded acceptance buffers and lifecycle progress reporting.
|
|
42
|
+
- Close automatic startup baseline/worktree/branch validation gaps, including persisted recovery baselines and the final pre-spawn boundary recheck.
|
|
43
|
+
- Replace shell-policy lexical bypasses with quote-aware parsing, nested-shell inspection and protected Git-ref checks; deny dynamic shell expansions while preserving literal argv values, and reject arbitrary non-Claude automatic executables.
|
|
44
|
+
- Normalize malformed custom Reviewer values to blocking reports, persist recovery baselines and the resolved Claude executable identity, filter automatic environment variables with a deny-by-default allowlist, and compare the exact startup HEAD at the adapter spawn boundary.
|
|
45
|
+
- Keep protected CI checks on the exact checked-out commit while giving automatic-mode fixtures a local validation branch and an owned deterministic Claude executable.
|
|
46
|
+
|
|
47
|
+
### Remaining hardening gate
|
|
48
|
+
|
|
49
|
+
- Open the protected pull request and complete independent CI/integration review; the exact-head read-only review, real editable Claude `2.1.270` repair/reacceptance drill and cleanup/lease evidence are recorded in `docs/automation-hardening-plan.md`.
|
|
50
|
+
|
|
21
51
|
### Added
|
|
22
52
|
|
|
23
53
|
- Structured task specifications with Goal, scope, constraints, forbidden actions and multiple argv-based acceptance checks.
|
package/README.cn.md
CHANGED
|
@@ -8,20 +8,33 @@
|
|
|
8
8
|
|
|
9
9
|
用于 Pi 的 Claude Code Worker 监督扩展。MVP 中 Pi 负责生命周期、状态机、策略门和独立验收;Worker 只是被显式启动的子进程。
|
|
10
10
|
|
|
11
|
-
>
|
|
11
|
+
> `v0.5.2` 已发布为单 Worker recovery 基线。默认手动 transport 是无额外依赖的
|
|
12
|
+
> process pipe,不是 PTY;自动模式只使用 Claude JSONL,tmux 保留为手动交互。当前工作树已实现
|
|
13
|
+
> repairable/persistent 能力拆分、可取消验收/Reviewer、证据完整性门禁、启动前
|
|
14
|
+
> preflight 和阶段进度通知;真实 Claude Code `2.1.270` 允许编辑的
|
|
15
|
+
> repair/reacceptance 演练已在隔离临时 worktree 通过。确认的产品目标是本地开发
|
|
16
|
+
> 完全无人值守;详见 [自动化目标](docs/autonomy-target.md)。代码进入远程仓库或
|
|
17
|
+
> main/integration 分支必须经过独立边界,Worker 不拥有 push/merge 权限;自动模式仅使用
|
|
18
|
+
> JSONL,tmux 保留为手动交互 transport。
|
|
19
|
+
>
|
|
20
|
+
> **无人值守状态:** 自动模式会自主完成本地修改、测试、有限修复、验收、独立 Review
|
|
21
|
+
> 和本地提交检查;无法形成候选时自动挂起为不可发布候选。可选出站通知不授予权限,
|
|
22
|
+
> push 和 main/integration merge 仍必须经过独立边界。
|
|
12
23
|
|
|
13
24
|
## 关键安全边界
|
|
14
25
|
|
|
15
26
|
- 不会在扩展加载时自动启动 Worker。
|
|
16
27
|
- 不经过 shell 启动子进程。
|
|
17
|
-
- Worker
|
|
18
|
-
-
|
|
19
|
-
- Linux 上优先使用可写的 cgroup v2 清理后代进程,包括 `setsid()` 后代;不可用时回退到进程组清理。需要强制失败闭环时,embedding 集成可使用 `cgroupMode: "required"
|
|
20
|
-
-
|
|
28
|
+
- Worker 只继承最小环境;自动模式采用默认拒绝的环境变量 allowlist,过滤远程凭据并禁用 Git/包管理器 credential helper。自动模式只能选择文档列出的 Claude provider 变量;任意自定义变量仅限手动集成。
|
|
29
|
+
- 本地命令和权限行为按任务/运行时授权策略处理;超出授权的动作自动拒绝或挂起,不要求同步人工响应。
|
|
30
|
+
- Linux 上优先使用可写的 cgroup v2 清理后代进程,包括 `setsid()` 后代;不可用时回退到进程组清理。需要强制失败闭环时,embedding 集成可使用 `cgroupMode: "required"`,并会在 Claude 启动前执行 preflight。
|
|
31
|
+
- 自动模式只接受裸的 `claude`/`claude.exe` 命令名,并从 Supervisor 的 PATH 解析、固定由操作者拥有的可执行文件(或使用 `PI_CLAUDE_SUPERVISOR_TRUSTED_CLAUDE` 固定路径);显式路径和可写/不可信位置会被拒绝。它请求 fail-closed 的 Claude Code Bash sandbox,禁止 Bash 子进程出站联网;命令策略仍是第二道门。手动/自定义集成必须自行提供等效 host/network 边界。
|
|
21
32
|
- Worker 声称完成只会进入 `verifying`,不能作为成功证据。
|
|
22
33
|
- 默认独立验收命令为 `git diff --check`。
|
|
23
|
-
-
|
|
24
|
-
-
|
|
34
|
+
- 目标是任务启动后本地开发无人值守:Worker 可以修改、测试、修复和本地提交;Worker 必须没有远程 push 或合并到 `main`/integration 分支的权限。
|
|
35
|
+
- 扩展运行时不执行 merge、deploy、release 或 publish;远程/main 集成和仓库 Release 必须经过独立受保护边界。
|
|
36
|
+
- 默认 4 小时总时限、20 分钟无输出 watchdog 超时即停止 Worker;paused 期间不消耗无输出预算,resume 会重建基准但不会重置总时限。嵌入调用方可将对应选项设为 `0` 关闭。
|
|
37
|
+
- 验收命令、仓库证据收集和独立 Reviewer 共用 abort signal,人工 stop/shutdown 不必等待完整超时。
|
|
25
38
|
|
|
26
39
|
## 安装和使用
|
|
27
40
|
|
|
@@ -36,14 +49,14 @@ pi install npm:pi-claude-supervisor
|
|
|
36
49
|
```bash
|
|
37
50
|
export PI_CLAUDE_SUPERVISOR_MODE=auto
|
|
38
51
|
export PI_CLAUDE_SUPERVISOR_WORKER='claude --safe-mode --tools Bash'
|
|
39
|
-
#
|
|
52
|
+
# 可选:候选/失败通知;generic 或 wecom
|
|
40
53
|
export PI_CLAUDE_SUPERVISOR_HUMAN_WEBHOOK_URL='https://example.invalid/webhook'
|
|
41
54
|
export PI_CLAUDE_SUPERVISOR_HUMAN_WEBHOOK_FORMAT=generic
|
|
42
55
|
# export PI_CLAUDE_SUPERVISOR_HUMAN_WEBHOOK_SECRET='shared-secret'
|
|
43
56
|
```
|
|
44
57
|
|
|
45
|
-
|
|
46
|
-
`exit` 事件唤醒 Decision Worker
|
|
58
|
+
自动模式默认并且只能使用 `claude-jsonl`,通过 `result`、`control_request` 和进程
|
|
59
|
+
`exit` 事件唤醒 Decision Worker;tmux 仅用于手动屏幕交互,不使用 JSONL 权限协议,也不会依赖 `/supervise poll` 轮询。本版本固定按已验证设备的
|
|
47
60
|
Claude CLI `2.1.270` 运行,跨版本兼容性不在本轮范围内。
|
|
48
61
|
|
|
49
62
|
然后在 Pi 中使用:
|
|
@@ -73,41 +86,47 @@ Claude CLI `2.1.270` 运行,跨版本兼容性不在本轮范围内。
|
|
|
73
86
|
"acceptance": [
|
|
74
87
|
{ "id": "tests", "name": "tests", "command": "npm", "args": ["test"], "required": true }
|
|
75
88
|
],
|
|
76
|
-
"maxRepairRounds": 3
|
|
89
|
+
"maxRepairRounds": 3,
|
|
90
|
+
"autonomy": {
|
|
91
|
+
"unattended": true,
|
|
92
|
+
"requireLocalCommit": true,
|
|
93
|
+
"maxDecisionRetries": 2
|
|
94
|
+
}
|
|
77
95
|
}
|
|
78
96
|
```
|
|
79
97
|
|
|
80
|
-
|
|
98
|
+
候选/失败通知的 generic JSON 格式为(旧 human-intervention webhook 名称保持兼容):
|
|
81
99
|
|
|
82
100
|
```json
|
|
83
101
|
{
|
|
84
|
-
"schema": "pi-claude-supervisor/
|
|
85
|
-
"event": "
|
|
102
|
+
"schema": "pi-claude-supervisor/candidate/v1",
|
|
103
|
+
"event": "candidate_status",
|
|
86
104
|
"task": { "id": "...", "goal": "...", "cwd": "..." },
|
|
87
105
|
"worker": { "id": "..." },
|
|
88
106
|
"reason": "...",
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
107
|
+
"status": "ready|blocked|failed",
|
|
108
|
+
"deliverable": false,
|
|
109
|
+
"note": "This notification does not grant remote push or main/integration merge permission."
|
|
92
110
|
}
|
|
93
111
|
```
|
|
94
112
|
|
|
95
|
-
当前 webhook
|
|
113
|
+
当前 webhook 只是出站候选通知,不直接接受批准命令;显式 stop、takeover 等兼容控制仍通过 Pi。
|
|
96
114
|
自动模式会将 Decision Worker 会话持久化到状态目录。Pi 非正常重启后,`/supervise sessions`
|
|
97
115
|
会显示 `recoverable` 任务;显式执行 `/supervise recover [--takeover] <task-id>` 会恢复 Decision Worker 上下文并
|
|
98
116
|
重新启动 Claude Worker,不会静默恢复或重复执行任务。旧 Pi 进程已退出且租约确认旧 Worker
|
|
99
117
|
进程组已消失且 cgroup 仍是真实、可读取的空边界时,才可显式添加 `--takeover`;缺失、仍存活或无法确认的 Worker 会被拒绝。持久 tmux
|
|
100
118
|
Worker 应使用 `adopt-tmux`,而不是 takeover。
|
|
101
|
-
自动模式下,Decision Worker
|
|
102
|
-
再根据任务和仓库证据自动回答;无法确定时才升级人工。如需微信内闭环,需要另建带签名验证、
|
|
103
|
-
一次性 action token 和重放保护的入站 callback 服务。
|
|
119
|
+
自动模式下,Decision Worker 在任务授权范围内自动处理普通问题、测试失败和修复轮次,记录假设和证据;无法形成可交付候选时自动挂起并保留证据,而不是要求人工必须在线。可通过 `PI_CLAUDE_SUPERVISOR_REQUIRE_LOCAL_COMMIT=0` 或 task `autonomy.requireLocalCommit` 关闭本地 commit 要求,但自动模式仍要求有效 Git baseline 和非保护 worktree;远程 push 和 main/integration merge 仍由独立边界控制。
|
|
104
120
|
|
|
105
121
|
`v0.5.0` 已完成并发布“多命令验收—独立只读 Reviewer—结构化修复轮次—再次验收”闭环。
|
|
106
|
-
任务可通过 API 或 JSON spec 提供 `goal`、`scope`、`constraints`、`forbidden
|
|
107
|
-
`acceptance`
|
|
108
|
-
`read`、`grep`、`find`、`ls
|
|
109
|
-
|
|
110
|
-
|
|
122
|
+
任务可通过 API 或 JSON spec 提供 `goal`、`scope`、`constraints`、`forbidden`、多个
|
|
123
|
+
`acceptance` 命令和 `autonomy` 控制;旧的纯文本任务继续使用默认 `git diff --check`。
|
|
124
|
+
Reviewer 只能使用 `read`、`grep`、`find`、`ls`,不会修改工作树或批准权限。自动模式在
|
|
125
|
+
Worker 启动前捕获 git baseline,要求完整的 baseline-relative tracked/commit/untracked evidence,
|
|
126
|
+
并在默认情况下要求 Worker 在非保护分支本地 commit;无效输出、证据不完整、重复 finding、P0/P1 或预算耗尽
|
|
127
|
+
会自动挂起候选。自动模式拒绝 process-pipe 和 tmux,并在模型执行前检查目录、可执行文件、依赖
|
|
128
|
+
和 cgroup;Worker 环境会过滤远程仓库凭据并禁用 Git 全局凭据 helper。详见 [自动化目标](docs/autonomy-target.md)。协同多 Worker 属于后续独立开发阶段,
|
|
129
|
+
自动模式只接受裸的直接 Claude 命令名,会固定解析后的操作者拥有的可执行文件,并请求 fail-closed 的 Claude Code Bash sandbox;任意自定义可执行文件和显式可执行路径会在自动模式拒绝。需要固定路径时设置 `PI_CLAUDE_SUPERVISOR_TRUSTED_CLAUDE`。手动/自定义 Worker 的完整 host-level sandbox 仍需由集成方提供。
|
|
111
130
|
|
|
112
131
|
### tmux/PTY 交互模式
|
|
113
132
|
|
|
@@ -116,8 +135,7 @@ Worker 应使用 `adopt-tmux`,而不是 takeover。
|
|
|
116
135
|
```bash
|
|
117
136
|
export PI_CLAUDE_SUPERVISOR_TRANSPORT=tmux
|
|
118
137
|
export PI_CLAUDE_SUPERVISOR_WORKER='claude --permission-mode plan'
|
|
119
|
-
#
|
|
120
|
-
# export PI_CLAUDE_SUPERVISOR_MODE=auto
|
|
138
|
+
# tmux 仅为手动交互;无人值守 Decision Worker 必须使用 JSONL。
|
|
121
139
|
# 接管非默认 tmux server 时可选:
|
|
122
140
|
# export PI_CLAUDE_SUPERVISOR_TMUX_SOCKET=/path/to/tmux.sock
|
|
123
141
|
```
|
|
@@ -125,7 +143,8 @@ export PI_CLAUDE_SUPERVISOR_WORKER='claude --permission-mode plan'
|
|
|
125
143
|
`/supervise start <task>` 会在私有 tmux server 中启动 Claude,并返回可复制的 attach 命令。
|
|
126
144
|
可以在另一个终端 attach 到同一个 PTY,观察或人工输入。多行消息通过 tmux buffer 和 Enter
|
|
127
145
|
发送,不会把消息拼接进 shell 命令;`pipe-pane` 记录原始输出,`capture-pane` 检测稳定的 Claude
|
|
128
|
-
输入提示,并复用 watchdog
|
|
146
|
+
输入提示,并复用 watchdog、审计和独立验收流程;由于 tmux 没有结构化权限边界,
|
|
147
|
+
不会在 tmux 中启用自动 Decision Worker 或无人值守远程边界策略。
|
|
129
148
|
|
|
130
149
|
如果 Claude 已由你在 tmux 中启动,可以显式接管且不会重放原始任务:
|
|
131
150
|
|
|
@@ -140,8 +159,7 @@ export PI_CLAUDE_SUPERVISOR_WORKER='claude --permission-mode plan'
|
|
|
140
159
|
`tmux kill-session`。`/supervise takeover <task-id>` 会暂停 Decision Worker 自动发送,只有
|
|
141
160
|
`/supervise resume-auto <task-id>` 才恢复。
|
|
142
161
|
|
|
143
|
-
PTY 屏幕文字不是 Claude JSONL
|
|
144
|
-
屏幕文字当作结构化权限证据。普通终端里已经运行的 Claude 不能安全迁移进 tmux;`--resume`
|
|
162
|
+
PTY 屏幕文字不是 Claude JSONL,不能把屏幕文字当作结构化权限证据。TUI 决策应按任务授权策略处理并记录;无法形成候选时可以自动挂起,不要求人工持续在线。普通终端里已经运行的 Claude 不能安全迁移进 tmux;`--resume`
|
|
145
163
|
是读取历史的新进程,不是实时 attach。实时测试请使用 plan/read-only 参数。
|
|
146
164
|
|
|
147
165
|
可以从不同工作目录启动多个任务会话;活动会话不能共享同一 cwd,建议每个任务使用独立 worktree:
|
|
@@ -160,4 +178,4 @@ PTY 屏幕文字不是 Claude JSONL。权限/信任对话框和无法确定的 T
|
|
|
160
178
|
|
|
161
179
|
Pull Request 必须通过聚合的 `CI / Quality gate`。Release Please 根据 Conventional Commits 创建版本 PR;维护者合并后,Release workflow 会针对精确 tag commit 重新验证,并通过受保护的 `npm` environment 使用 npm provenance 发布。
|
|
162
180
|
|
|
163
|
-
详细内容见 [engineering-plan.md](docs/engineering-plan.md)、[independent-review.md](docs/independent-review.md)、[architecture.md](docs/architecture.md)、[testing.md](docs/testing.md) 和 [releasing.md](docs/releasing.md)。
|
|
181
|
+
详细内容见 [engineering-plan.md](docs/engineering-plan.md)、[autonomy-target.md](docs/autonomy-target.md)、[independent-review.md](docs/independent-review.md)、[architecture.md](docs/architecture.md)、[testing.md](docs/testing.md) 和 [releasing.md](docs/releasing.md)。
|
package/README.md
CHANGED
|
@@ -10,24 +10,36 @@ A policy-gated [Pi](https://pi.dev) extension for supervising a Claude Code work
|
|
|
10
10
|
The MVP keeps Pi in control of lifecycle, state, policy and verification while the
|
|
11
11
|
worker remains an explicitly started child process.
|
|
12
12
|
|
|
13
|
-
> **
|
|
14
|
-
>
|
|
15
|
-
>
|
|
16
|
-
>
|
|
17
|
-
>
|
|
13
|
+
> **Release status:** `v0.5.2` is the released single-Worker recovery baseline. The
|
|
14
|
+
> default manual transport is dependency-free process pipes, not PTY. Automatic
|
|
15
|
+
> supervision uses Claude JSONL only; tmux is manual-only because it has no structured
|
|
16
|
+
> permission boundary. Repairable-vs-persistent capabilities,
|
|
17
|
+
> cancellable verification, evidence completeness gates, startup preflight and phase
|
|
18
|
+
> progress reporting. A real edit-capable Claude Code `2.1.270` repair/reacceptance
|
|
19
|
+
> drill passed in an isolated temporary worktree. The confirmed product target is
|
|
20
|
+
> unattended local development; see [the autonomy target](docs/autonomy-target.md).
|
|
21
|
+
> Remote push and merge into the main/integration branch remain outside Worker authority
|
|
22
|
+
> and must cross an independent boundary.
|
|
23
|
+
>
|
|
24
|
+
> **Autonomy status:** automatic mode continues local editing, testing, bounded repair,
|
|
25
|
+
> acceptance, independent Review and local-commit enforcement without a synchronous human
|
|
26
|
+
> callback. Unresolvable work is parked as a non-publishable candidate; optional outbound
|
|
27
|
+
> notifications do not approve actions.
|
|
18
28
|
|
|
19
29
|
## Safety boundary
|
|
20
30
|
|
|
21
31
|
- The extension never starts a worker automatically.
|
|
22
32
|
- Worker commands are launched without a shell.
|
|
23
|
-
- Workers receive a minimal environment; credentials
|
|
24
|
-
-
|
|
25
|
-
-
|
|
33
|
+
- Workers receive a minimal environment; automatic mode uses a deny-by-default variable allowlist, strips remote credentials and disables Git/package credential helpers. Only documented Claude provider variables may be selected for automatic mode; arbitrary custom variables remain manual-only.
|
|
34
|
+
- Local command and permission behavior follows the configured task/runtime policy; actions outside that authority are rejected or parked without requiring a synchronous human response.
|
|
35
|
+
- Automatic mode admits only the bare `claude`/`claude.exe` command name, resolves and pins an operator-owned executable from the supervisor PATH (or `PI_CLAUDE_SUPERVISOR_TRUSTED_CLAUDE`), and rejects explicit paths or writable/untrusted locations. It requests a fail-closed Claude Code Bash sandbox with no outbound domains; command policy remains a second guard. Manual/custom integrations must provide their own equivalent host/network boundary.
|
|
26
36
|
- A worker completion is only a transition to `verifying`; it is not evidence of success.
|
|
27
37
|
- Verification is an independent host command (default: `git diff --check`).
|
|
28
|
-
-
|
|
38
|
+
- Target local development runs unattended after a task starts: the Worker may edit, test, repair and commit locally. The Worker must have no authority or credentials to push remotely or merge into `main`/an integration branch.
|
|
39
|
+
- The extension never performs merge, deploy, release, or publish at runtime. Remote/main integration and repository releases cross independent protected boundaries.
|
|
29
40
|
- A 4-hour wall-clock and 20-minute no-output watchdog stop a worker by default for long development tasks; embedding callers can set either to `0` to disable.
|
|
30
|
-
- On Linux, the adapter automatically uses a writable cgroup v2 for descendant cleanup, including `setsid()` descendants; it falls back to process-group cleanup when unavailable. Use
|
|
41
|
+
- On Linux, the adapter automatically uses a writable cgroup v2 for descendant cleanup, including `setsid()` descendants; it falls back to process-group cleanup when unavailable. Use `cgroupMode: "required"` for a fail-closed integration; required mode is preflighted before Claude starts.
|
|
42
|
+
- Acceptance commands, repository evidence collection and independent Review share an abort signal, so operator stop/shutdown does not wait for a full command or model timeout.
|
|
31
43
|
- Events are append-only JSONL records in `~/.pi/agent/claude-supervisor/events.jsonl`.
|
|
32
44
|
|
|
33
45
|
## Install
|
|
@@ -81,7 +93,12 @@ a shell), for example:
|
|
|
81
93
|
"acceptance": [
|
|
82
94
|
{ "id": "tests", "name": "tests", "command": "npm", "args": ["test"], "required": true }
|
|
83
95
|
],
|
|
84
|
-
"maxRepairRounds": 3
|
|
96
|
+
"maxRepairRounds": 3,
|
|
97
|
+
"autonomy": {
|
|
98
|
+
"unattended": true,
|
|
99
|
+
"requireLocalCommit": true,
|
|
100
|
+
"maxDecisionRetries": 2
|
|
101
|
+
}
|
|
85
102
|
}
|
|
86
103
|
```
|
|
87
104
|
|
|
@@ -104,22 +121,37 @@ worktrees; same-directory starts are rejected even when concurrent, and
|
|
|
104
121
|
parallelism, not coordinated multi-worker collaboration. A future multi-worker
|
|
105
122
|
milestone will add explicit parent/child task graphs, dependencies, bounded
|
|
106
123
|
scheduling, structured handoffs, aggregate acceptance and graph-aware recovery;
|
|
107
|
-
it will not
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
124
|
+
it will not grant any Worker remote push or main/integration merge authority.
|
|
125
|
+
Unattended local development is the target operating mode; a blocked or failed
|
|
126
|
+
candidate is parked with its evidence rather than made dependent on a human being
|
|
127
|
+
online. Automatic mode accepts only the bare direct Claude command name, pins its
|
|
128
|
+
operator-owned resolved executable path, and uses a fail-closed Bash sandbox with no
|
|
129
|
+
outbound domains; arbitrary custom executables and explicit executable paths are rejected
|
|
130
|
+
in automatic mode. Set `PI_CLAUDE_SUPERVISOR_TRUSTED_CLAUDE` when the resolved path must
|
|
131
|
+
be pinned explicitly. Manual/custom integrations must provide an equivalent host/network
|
|
132
|
+
boundary.
|
|
133
|
+
Set `PI_CLAUDE_SUPERVISOR_REQUIRE_LOCAL_COMMIT=0` only for a task that intentionally
|
|
134
|
+
produces no local commit candidate, or set `autonomy.requireLocalCommit` in its spec;
|
|
135
|
+
automatic mode still requires a valid Git baseline and non-protected worktree.
|
|
136
|
+
`PI_CLAUDE_SUPERVISOR_UNATTENDED=0` opts a task out of automatic Decision Worker control;
|
|
137
|
+
a required local commit is checked on a non-protected task branch;
|
|
138
|
+
`PI_CLAUDE_SUPERVISOR_MAX_DECISION_RETRIES` bounds transient Decision Worker retries.
|
|
112
139
|
|
|
113
140
|
The `v0.5.0` automation milestone adds a structured acceptance pipeline:
|
|
114
141
|
multiple argv-based checks, an independent read-only Reviewer, bounded structured
|
|
115
142
|
findings and repair rounds. Legacy text tasks keep the default `git diff --check`.
|
|
116
143
|
The Reviewer only has `read`, `grep`, `find` and `ls`; it cannot edit files or grant
|
|
117
|
-
permissions.
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
144
|
+
permissions. Automatic mode requires complete baseline-relative tracked, commit and
|
|
145
|
+
bounded untracked evidence, repairs a live `repairableSession` Worker within a
|
|
146
|
+
bounded budget, enforces a local commit when enabled, and prevents a non-publishable
|
|
147
|
+
candidate from crossing the remote/main boundary. Automatic mode rejects explicit
|
|
148
|
+
`process-pipe` and preflights runtime prerequisites. Invalid output, unavailable
|
|
149
|
+
evidence, duplicate findings, P0/P1 findings and exhausted repair budgets park the
|
|
150
|
+
candidate without waiting for a human; see [the autonomy target](docs/autonomy-target.md).
|
|
151
|
+
Coordinated multi-worker scheduling is a later milestone; CI uses deterministic fake
|
|
152
|
+
Workers/replay fixtures, and real multi-worker Claude tests remain authenticated
|
|
153
|
+
manual Spikes. Full host-level sandboxing and low-privilege execution for custom
|
|
154
|
+
integrations remain separate hardening work.
|
|
123
155
|
|
|
124
156
|
Automatic mode persists the Pi Decision Worker session under the configured state
|
|
125
157
|
directory. After an unclean Pi restart, `/supervise sessions` lists recoverable
|
|
@@ -130,9 +162,12 @@ the old Worker's process group is gone and its cgroup is a real, readable empty
|
|
|
130
162
|
boundary; missing or unverifiable Worker evidence is refused.
|
|
131
163
|
For a persistent tmux Worker, use explicit `adopt-tmux` instead of takeover.
|
|
132
164
|
The adapter intentionally does not inherit arbitrary host environment variables.
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
`PI_CLAUDE_SUPERVISOR_WORKER_ENV=ANTHROPIC_API_KEY
|
|
165
|
+
Manual embedding integrations may pass credentials through an explicit
|
|
166
|
+
`WorkerStartInput.env`; automatic mode accepts only documented Claude provider
|
|
167
|
+
variables, for example `PI_CLAUDE_SUPERVISOR_WORKER_ENV=ANTHROPIC_API_KEY`, and
|
|
168
|
+
filters remote credentials and configuration-injection variables. The host-side
|
|
169
|
+
`PI_CLAUDE_SUPERVISOR_TRUSTED_CLAUDE` setting pins the executable identity and is not
|
|
170
|
+
passed into the Worker environment.
|
|
136
171
|
|
|
137
172
|
### tmux/PTY transport
|
|
138
173
|
|
|
@@ -142,19 +177,20 @@ For an interactive Claude Code window, opt in to the tmux transport:
|
|
|
142
177
|
export PI_CLAUDE_SUPERVISOR_TRANSPORT=tmux
|
|
143
178
|
export PI_CLAUDE_SUPERVISOR_WORKER='claude --permission-mode plan'
|
|
144
179
|
# tmux does not support cgroup required mode; use cgroup mode auto/off.
|
|
145
|
-
#
|
|
146
|
-
# export PI_CLAUDE_SUPERVISOR_MODE=auto
|
|
180
|
+
# tmux is manual-only; automatic Decision Worker supervision requires JSONL.
|
|
147
181
|
# Optional, only when adopting a non-default tmux server:
|
|
148
182
|
# export PI_CLAUDE_SUPERVISOR_TMUX_SOCKET=/path/to/tmux.sock
|
|
149
183
|
```
|
|
150
184
|
|
|
151
185
|
`/supervise start <task>` starts Claude in a private tmux server and reports a
|
|
152
186
|
literal attach command. Use that command in another terminal to watch or
|
|
153
|
-
manually interact with the same PTY
|
|
187
|
+
manually interact with the same PTY; attaching is optional for unattended local
|
|
188
|
+
development. The adapter sends multi-line input through
|
|
154
189
|
tmux buffers and Enter, never by interpolating the message into a shell command.
|
|
155
|
-
It records the PTY stream with `pipe-pane
|
|
156
|
-
stable Claude input prompt
|
|
157
|
-
|
|
190
|
+
It records the PTY stream with `pipe-pane` and uses `capture-pane` to detect a
|
|
191
|
+
stable Claude input prompt. Because tmux has no structured permission boundary,
|
|
192
|
+
automatic Decision Worker supervision is disabled for this transport; use JSONL for
|
|
193
|
+
unattended decisions, repair and protected command enforcement.
|
|
158
194
|
|
|
159
195
|
A session that you started yourself can be explicitly adopted without replaying
|
|
160
196
|
the task:
|
|
@@ -175,12 +211,13 @@ kill-session` yourself when the adopted window should be closed.
|
|
|
175
211
|
`/supervise takeover <task-id>` disables automatic Decision Worker messages;
|
|
176
212
|
resume them only with `/supervise resume-auto <task-id>`.
|
|
177
213
|
|
|
178
|
-
PTY screen text is not Claude JSONL
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
`adopt-tmux` after restart. Use
|
|
214
|
+
PTY screen text is not Claude JSONL and must not be treated as structured
|
|
215
|
+
permission evidence. TUI decisions follow the configured autonomy policy and are
|
|
216
|
+
recorded; an unresolved task may be parked without requiring a human to remain
|
|
217
|
+
online. A normal terminal Claude process cannot be migrated into tmux, and
|
|
218
|
+
`--resume` is historical recovery rather than live PTY attach. Owned tmux sessions
|
|
219
|
+
survive a Pi disconnect and require an explicit `adopt-tmux` after restart. Use
|
|
220
|
+
plan/read-only flags for live testing.
|
|
184
221
|
|
|
185
222
|
## Development
|
|
186
223
|
|
|
@@ -194,7 +231,7 @@ npm run check:workflows
|
|
|
194
231
|
npm run build
|
|
195
232
|
```
|
|
196
233
|
|
|
197
|
-
See [the engineering plan](docs/engineering-plan.md), [the independent review](docs/independent-review.md),
|
|
234
|
+
See [the engineering plan](docs/engineering-plan.md), [the confirmed autonomy target](docs/autonomy-target.md), [the independent review](docs/independent-review.md),
|
|
198
235
|
[architecture](docs/architecture.md), [testing](docs/testing.md), and [releasing](docs/releasing.md).
|
|
199
236
|
|
|
200
237
|
Pull requests are gated by the aggregated `CI / Quality gate`. Release Please
|