@seanyao/roll 4.707.1 → 4.710.2

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/docs/INDEX.md CHANGED
@@ -6,6 +6,7 @@
6
6
 
7
7
  | Path | Title | Category | Description |
8
8
  |------|-------|----------|-------------|
9
+ | `docs/acceptance-contract.md` | 验收契约权属 / Acceptance Contract Ownership | process | 契约是设计层拥有的冻结产物(cycle 起始快照+漂移检测)、证据分类(web/cmd/roll-capture/named-tests)、能力天花板(存在性/绑定/权属 vs evaluator 判内容) |
9
10
  | `docs/architecture.md` | 系统设计 / System Architecture | architecture | 产品定位、设计原则、系统架构、领域模型、行为合同、事实来源 (US-TRUTH)、结构化交付真相、唯一查询入口、存储裁定、消费者契约 |
10
11
  | `docs/difftest-freeze-paradigm.md` | 快照冻结测试范式 | testing | CLI 命令输出用 Vitest 快照冻结的行为契约测试范式与可移植性陷阱 |
11
12
  | `docs/live-console.md` | 实时控制台指南 / Live Console Guide | guide | CLI-first 实时可观测指南:`roll loop cycle watch` 用法、三流契约、静态导出 vs 实时服务、证据按构造 |
@@ -15,8 +16,8 @@
15
16
 
16
17
  ## Coverage Summary
17
18
 
18
- - Total docs indexed: 6
19
- - By category: architecture (1) / guide (1) / migration (1) / testing (1) / product (1) / process (1)
19
+ - Total docs indexed: 7
20
+ - By category: architecture (1) / guide (1) / migration (1) / testing (1) / product (1) / process (2)
20
21
 
21
22
  ## Key Architecture Chapters (US-TRUTH epic)
22
23
 
@@ -0,0 +1,105 @@
1
+ # 验收契约权属 / Acceptance Contract Ownership
2
+
3
+ > Category: process. The design-owned acceptance contract, the evidence taxonomy,
4
+ > and the honest ceiling of what the harness can guarantee. Companion to
5
+ > `docs/verification.md` (which specifies per-story AC + evidence shape).
6
+
7
+ ## 1. 契约是设计层拥有的冻结产物 / The contract is a design-owned, frozen artifact
8
+
9
+ A story's **acceptance contract** is the set of things its delivery is judged
10
+ against: its **AC criteria** and its **evidence surface** (`deliverable_url` /
11
+ `deliverable_cmd` / physical screenshot / `screenshot_exempt`). Ownership is
12
+ strict and one-directional:
13
+
14
+ - **Designer owns it.** The contract is authored with the story and does not
15
+ change during a build.
16
+ - **Builder only satisfies it.** The builder produces code + evidence to meet
17
+ the contract; it never authors or edits the contract.
18
+ - **Evaluator only reads and judges it.** Attest reads the contract and decides
19
+ Done; it never lets the builder's own edits redefine the bar.
20
+
21
+ **Enforced by topology, not per-agent tool permissions.** Roll runs a
22
+ heterogeneous agent fleet; there is no uniform per-agent write-lock. Instead the
23
+ contract is **frozen at cycle start** into a snapshot (a projection of the
24
+ evidence-surface frontmatter + the set of AC criteria texts, hashed), taken from
25
+ **design truth** — not the builder-writable worktree copy. The attest gate
26
+ judges against that frozen snapshot; a worktree spec whose contract projection
27
+ no longer matches the snapshot is **drift** and is surfaced as an alert. The
28
+ projection deliberately EXCLUDES completion claims (checkbox state, the `✅`
29
+ tick, the `**Status**` line, Delivery/narrative sections) so the ordinary
30
+ stale-claim reset is never mistaken for tampering.
31
+
32
+ **Ingest is shift-left and soft.** A story with an AC block must declare a
33
+ capture surface OR a `screenshot_exempt` reason. A card that declares neither is
34
+ recorded to a hold list and alerted at authoring time — never a hard block of
35
+ ingestion, and runtime `pick_story` is never blocked (a false positive must not
36
+ stall the loop).
37
+
38
+ **Exemptions are design-time and audited.** `screenshot_exempt` is part of the
39
+ frozen contract (a builder cannot introduce one that counts). "Exempt from
40
+ screenshot" is not "exempt from evidence": an exempt card still owes another
41
+ capturable evidence form (command output or named tests). The existing
42
+ exemption rate is an observability smell signal (surfaced overall + per epic);
43
+ legacy per-card exemptions and any policy epic-level blanket exempt
44
+ (`acceptance.screenshot_exempt_epics`) are auditable read-only for batch review,
45
+ forward-enforced and never retroactively blocked.
46
+
47
+ ## 2. 证据分类 / Evidence taxonomy
48
+
49
+ Every AC-bearing story binds **at least one real, gate-resolvable capturable
50
+ evidence**. There is no "give nothing" path. Screenshot is one kind, not the
51
+ only kind:
52
+
53
+ | Surface | Capture | Bound by |
54
+ |---|---|---|
55
+ | Web page (`deliverable_url`) | headless screenshot | harness |
56
+ | CLI/terminal (`deliverable_cmd`, read-only roll command) | captured terminal output | harness |
57
+ | Physical desktop / real terminal | **roll-capture** (real screen pixels) | harness |
58
+ | Library / pure backend | named test-pass references | builder (non-captured) |
59
+
60
+ For **captured** artifacts (the first three), the harness — which knows what it
61
+ captured — is the intended owner of the ac-map binding, so the builder does not
62
+ type or confirm those paths; the builder's ac-map covers only **non-captured**
63
+ evidence (named tests, manual verification notes). "No screenshot" therefore
64
+ still requires a declared `deliverable_cmd` or named tests — not silence.
65
+
66
+ ## 3. 能力天花板 / What this guarantees — and what it does not
67
+
68
+ These mechanisms guarantee, structurally:
69
+
70
+ - the contract cannot be silently tampered by the builder (frozen snapshot +
71
+ drift detection);
72
+ - an AC-bearing card cannot enter the backlog with no declared way to produce
73
+ evidence (shift-left ingest);
74
+ - captured evidence is bound to real on-disk artifacts, not invented paths.
75
+
76
+ They do **not** guarantee that the evidence CONTENT actually proves the AC. A
77
+ `deliverable_cmd: echo ok` or a vacuous test resolves as "evidence present" yet
78
+ demonstrates nothing. **Judging whether the evidence genuinely satisfies the
79
+ criterion is the Evaluator's semantic job** — read the content, score it — and
80
+ is out of scope for the existence/binding/ownership guarantees above. The
81
+ harness makes tampering hard and evidence necessarily present and correctly
82
+ bound; it does not replace the reviewer reading the proof.
83
+
84
+ ## 4. 现状 / Implementation status (honest, not target-washed)
85
+
86
+ This model is delivered incrementally; the doc describes the intended contract,
87
+ and this section states what is LIVE vs DESIGNED so nothing above is read as
88
+ more-enforced than it is.
89
+
90
+ - **Live** (US-EVID-020/021/022): the contract PROJECTION + cycle-start frozen
91
+ snapshot (`contract-projection.ts`, `contract-snapshot.ts`); the attest gate's
92
+ worktree-vs-snapshot **drift alert** (`attest-gate.ts`, alert-only); the
93
+ **shift-left ingest** surface check + hold list (`ingest-gate.ts`), phased and
94
+ **default observe-only** (`metric`) — `alert`/`block` are opt-in via policy.
95
+ - **Function delivered, surfacing pending** (US-EVID-026/027): the exemption-rate
96
+ computation (`exemption-stats.ts`) and read-only audit (`exemption-audit.ts`)
97
+ are implemented and unit-tested, but not yet wired into a board/`roll status`
98
+ line or a CLI command — they have no production caller yet.
99
+ - **Designed / in progress**: harness-owned binding of captured artifacts into
100
+ the ac-map (US-EVID-023 — the read primitive exists; the draft-generator
101
+ wiring + capture-failure surfacing are not yet wired); the confirmed-ac-map
102
+ dangling-evidence remediation trigger (US-EVID-024); design-time hetero-
103
+ consensus confirmation of exemptions + the enforced substitute-evidence
104
+ requirement (US-EVID-025). Until those land, "no give-nothing path" and
105
+ "harness owns the binding" are the DESIGN intent, not a runtime guarantee.
@@ -266,7 +266,7 @@ cycle 写 `loop:pending`,只做恢复探测,不启动 Builder、不把卡记
266
266
  Roll 的运行模式只有两个:`guided` 和 `autonomous`。它们不是两套 agent 配置,而是同一套 backlog、truth、route profile、execution profile、attest evidence、Evaluator 和 release gates 之上的两种触发方式。
267
267
 
268
268
  - `guided`:owner 通过 `roll supervisor status/next/why` 理解状态和下一步,再显式运行 `roll loop go --cards <id>` 等命令。guided 模式不会静默启动长时间 Story 执行。
269
- - `autonomous`:`roll loop on` 安装 scheduler;scheduler 可以在 pause、budget、route、evidence、Evaluator 和 release gates 内领取合格 Todo。`roll loop pause` / `roll loop off` 回到 guided;`roll loop resume` / `roll loop on` 显式切回 autonomous。
269
+ - `autonomous`:`roll loop on` 安装 scheduler;scheduler 可以在 pause、budget、route、evidence、Evaluator 和 release gates 内领取合格 Todo。`roll loop pause` / `roll loop off` 回到 guided;`roll loop off --all` 是本机所有 `com.roll.*` LaunchAgent 的急停;`roll loop resume` / `roll loop on` 显式切回 autonomous。
270
270
  - 持久化来源只使用已有 loop/supervisor 状态:launchd plist、PAUSE/DORMANT marker、events/runs/backlog。不得新增独立 `mode.yaml` 之类的第二真相。
271
271
 
272
272
  ### BC9 · Supervisor 与执行剖面(v4)
package/guide/en/loop.md CHANGED
@@ -206,6 +206,7 @@ roll loop on # Install launchd scheduler (loop + pr + dream)
206
206
  roll loop off # Remove launchd scheduler
207
207
 
208
208
  roll loop now # Run one cycle immediately (same as launchd fires)
209
+ roll loop now --cards US-1,FIX-2 # Run one immediate cycle scoped to selected cards
209
210
  roll loop test # Quick smoke test: verify tmux/popup/stream chain works
210
211
 
211
212
  roll loop status # Show scheduler state and current loop state
@@ -275,6 +276,8 @@ gates still decide eligibility.
275
276
  `roll loop go` is a manual goal session, not a launchd scheduler tick. While it
276
277
  runs, Roll holds `.roll/loop/go.lock`; scheduled ticks yield when they see that
277
278
  lock, record `goal:tick_skipped`, and do not start another `roll loop run-once`.
279
+ `roll loop now --cards <ids>` uses the same card allow-list for its one-shot
280
+ runner, so a manual tick cannot silently pick a different backlog card.
278
281
 
279
282
  Goal mode can run when the scheduler is off because it starts its own session
280
283
  and does not depend on launchd. For paused projects, run `roll loop resume`
@@ -298,6 +301,12 @@ dirty, the goal pauses with `bootstrap_artifacts_unconfirmed` and prints the
298
301
  files to confirm. Commit or clean them, then run `roll loop go` again. This
299
302
  preflight does not start a cycle and does not count as no-progress.
300
303
 
304
+ For the Roll repository itself, `roll loop go`, `roll loop resume`, and
305
+ `roll loop now` print the runner binary and version before starting autonomous
306
+ work. They fail loud with `runner_stale_for_repo` if the repo-local
307
+ `@seanyao/roll` package version is newer than the running runner; install or
308
+ publish the local build before resuming autonomous work.
309
+
301
310
  `roll loop go` enforces safety only at cycle boundaries. `--budget <usd>` uses
302
311
  the effective run cost ledger and moves the goal to `budget_limited` when the
303
312
  budget is reached. An idle or aborted cycle that ran no agent counts as a known
package/guide/zh/loop.md CHANGED
@@ -176,6 +176,7 @@ roll loop on # 安装 launchd 调度器(loop + pr + dream 三个服
176
176
  roll loop off # 卸载 launchd 调度器
177
177
 
178
178
  roll loop now # 立即执行一次循环(与 launchd 触发的流程完全一致)
179
+ roll loop now --cards US-1,FIX-2 # 立即执行一次循环,但只允许指定卡片
179
180
  roll loop test # 快速冒烟测试:验证 tmux/弹窗/流式输出链路是否正常
180
181
 
181
182
  roll loop status # 显示调度器状态和当前 loop 状态
@@ -244,6 +245,8 @@ Hold、Cut、未满足依赖、skip-list、open PR、已合并交付和 pending-
244
245
  `roll loop go` 是手动 goal session,不是 launchd 定时 tick。运行期间 Roll 会持有
245
246
  `.roll/loop/go.lock`;定时 tick 看到该锁就让路,记录 `goal:tick_skipped`,不会再启动
246
247
  另一个 `roll loop run-once`。
248
+ `roll loop now --cards <ids>` 对它触发的单次 runner 使用同一份卡片 allow-list,
249
+ 所以手动 tick 不能静默改选其他 backlog 卡。
247
250
 
248
251
  goal mode 在 scheduler off 时也能运行,因为它自己启动会话,不依赖 launchd。loop 处于
249
252
  paused 状态时不建议直接启动:`PAUSE-<slug>` 标记仍会在 cycle 边界生效,所以应先执行
@@ -271,6 +274,11 @@ Roll-owned 文件提交并推送;如果历史版本或手工路径仍然只留
271
274
  `bootstrap_artifacts_unconfirmed` 暂停,并打印待确认文件。提交或清理后,再重新运行
272
275
  `roll loop go`。这个 preflight 不会启动 cycle,也不会累加 no-progress。
273
276
 
277
+ 在 Roll 仓自身里,`roll loop go`、`roll loop resume` 和 `roll loop now`
278
+ 开工前都会打印当前 runner 的 binary 与版本。repo-local `@seanyao/roll`
279
+ 包版本高于正在运行的 runner 时,它们会以 `runner_stale_for_repo`
280
+ fail-loud;先安装或发布本地构建,再恢复自治施工。
281
+
274
282
  每次安全闸触发都会记录 `goal:gate_tripped`,`roll loop goal` 会显示最近一次安全闸读数。
275
283
 
276
284
  ### `roll loop goal` 字段含义
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seanyao/roll",
3
- "version": "4.707.1",
3
+ "version": "4.710.2",
4
4
  "description": "Roll — Roll out features with AI agents",
5
5
  "packageManager": "pnpm@11.1.3",
6
6
  "scripts": {
@@ -975,6 +975,62 @@ or the cap), not in it. A RESIZE is never emitted for a pure quality problem.
975
975
 
976
976
  ---
977
977
 
978
+ ## Construction-time independence & shift-left evidence (US-SKILL-031/032/033)
979
+
980
+ The Review Score (FIX-343) and Phase 6 Agent 4 add independence *downstream* of a
981
+ single builder that wrote BOTH the tests and the implementation. These three
982
+ gates add independence and evidence freshness *during* construction. They were
983
+ distilled from the US-EVID-026 delivery retro.
984
+
985
+ ### US-SKILL-031 — Adversarial pairing mode (verified / designed profiles)
986
+
987
+ Under the `verified` and `designed` execution profiles, the **test author and the
988
+ implementer are DIFFERENT, heterogeneous agents** — the agent that makes a test
989
+ pass is never the one that wrote it, so tests and implementation cannot be
990
+ co-shaped to be mutually flattering. The loop is:
991
+
992
+ 1. Test author writes a RED test for the next micro-step.
993
+ 2. Implementer (a different agent) writes ONLY production code to turn it green;
994
+ it must not edit the test.
995
+ 3. **Attack round** — once green, the test author writes ≥1 *breaking* test
996
+ targeting an untested failure mode; the implementer fixes; repeat until the
997
+ attacker is dry (N consecutive rounds surface no new hole).
998
+ 4. The attacker's breaking tests are added to the Phase 6 **Agent 4** test-audit
999
+ input, so "these failure modes are now pinned" is auditable.
1000
+
1001
+ Cost: this approximately 2–3× the agent calls, so it is **bound to `verified` /
1002
+ `designed`** (high-stakes cards). `standard` keeps the single-builder + downstream
1003
+ audit unchanged. The profile choice is recorded (which was picked, and why).
1004
+ Independence is by session/context, not vendor (same FIX-343 red line): the
1005
+ test-author session must not be the implementer's session or a sub-agent of it.
1006
+
1007
+ ### US-SKILL-032 — Independent heterogeneous code review
1008
+
1009
+ Phase 6's code review is performed by a **randomly-picked independent
1010
+ heterogeneous agent** (e.g. pi / kimi), NOT a sub-agent of the builder's session,
1011
+ and it emits a **structured verdict** — PASS/FAIL per AC plus a blocking-issue
1012
+ list — recorded with `reviewedBy` + session id so independence is verifiable (the
1013
+ same `scoredBy` contract as the Review Score). Independence is by session/context,
1014
+ not vendor. If no heterogeneous agent is available, fall back to `$roll-.review
1015
+ staged`, but **record the independence degradation explicitly** — never silently
1016
+ present a self-review as independent. This never becomes a hard block; its output
1017
+ feeds the existing fix-and-recheck loop.
1018
+
1019
+ ### US-SKILL-033 — Shift-left per-AC evidence
1020
+
1021
+ Each AC's evidence is captured **at the moment that AC's TCR turns green** — fresh
1022
+ and bound to the micro-step — not batched at Phase 11. Phase 11 therefore
1023
+ DOWNGRADES from "collect evidence" to "**summarize already-captured evidence +
1024
+ generate the ac-map + render the report**"; an AC that reaches Phase 11 with no
1025
+ captured evidence is a **red flag** (its TCR never captured), not an invitation to
1026
+ now-collect. This is fully consistent with FIX-329 ("attest is earned during
1027
+ delivery, never backfilled") — it only moves the earning point earlier, from
1028
+ Phase 11 to the per-AC micro-step. Captured-artifact binding stays harness-owned
1029
+ (US-EVID-023); this governs the *timing* of non-captured evidence (command output,
1030
+ named tests).
1031
+
1032
+ ---
1033
+
978
1034
  ## TCR Recovery Patterns
979
1035
 
980
1036
  ### Pattern 1: Red After Multiple Attempts