@christang/keel 5.176.0 → 5.178.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keel",
3
- "version": "5.176.0",
3
+ "version": "5.178.0",
4
4
  "description": "Keel OpenSpec execution discipline: stateless continuity, task capsules, deterministic gates, and expectation alignment for Codex and Claude Code.",
5
5
  "author": {
6
6
  "name": "TanglmChris",
package/README.md CHANGED
@@ -226,6 +226,9 @@ A task that authors no `Autonomy boundary:` inherits the declaration, and the co
226
226
  names `keel/config.yaml` as that entry's source so an inherited authorization is never mistaken
227
227
  for one the task decided. A task that authors its own boundary keeps it.
228
228
 
229
+ The ordinals below count names, not the forms in that comment: `push` and `push:<branch glob>` are
230
+ one name, so the vocabulary is thirteen names long and `continuation` is the fifth.
231
+
229
232
  `continuation`, the fifth name, is accepted and changes nothing. Moving from a durably complete
230
233
  task to the next unchecked task of the same change, inside a change whose `tasks.md` you approved,
231
234
  needs no confirmation by default (#414). The next task still starts through `keel gate task-start`
@@ -238,7 +241,7 @@ nothing until corrected — fail-closed, never a silent grant.
238
241
 
239
242
  `issue:<owner>/<repo>`, the sixth name, names the resource it reaches, and it is refused without
240
243
  one; `chat-reply:<group>`, the eighth, `issue-close:<owner>/<repo>` and `cleanup:scratch`, the ninth
241
- and tenth, and `push-protected:<branch glob>`, the eleventh, are the others that do. The other names act on the checkout the declaration sits in, so each is already bounded by the repository you declared it in. The credentials that open an issue are not:
244
+ and tenth, and `push-protected:<branch glob>`, the eleventh, are the others that do. The other names, `push` included, act on the checkout the declaration sits in, so each is already bounded by the repository you declared it in. The credentials that open an issue are not:
242
245
  `gh` is account-wide, so a bare `issue` would reach every repository your account can touch —
243
246
  silently the widest entry in the file, and wider than `push`. Naming the repository keeps the
244
247
  grant the size of what it says. Keel carries that scope to `keel --doctor` and to the compiled
@@ -282,7 +285,7 @@ enforced: the role decides only which session reads them.
282
285
 
283
286
  `shift-restore` (#319) covers the two things a session started by a shift change on the Claude
284
287
  desktop app must do right after `keel shift resume`: turn its own Remote Control back on if it came
285
- back off, and rename itself back to its working title. A clear there keeps no title. Without the declaration, the woken
288
+ back off, and rename itself back to its working title. On the desktop app a cleared session does not keep its title. Without the declaration, the woken
286
289
  session reads that restore as another session's request and stops to ask you. It reaches only that
287
290
  session, so it takes no scope, and it covers no other session, no clear or archive, and no repository
288
291
  action.
@@ -832,7 +835,7 @@ the brief, so `egress_deny` guards what is handed over, not what it can open.
832
835
 
833
836
  ## Shared resource leases
834
837
 
835
- Sessions coordinate shared resources across worktrees through bounded leases. Other holders are refused and recorded as waiters; release and noticed expiry tell them through direct chat messages. A lease enforces nothing on Git or the filesystem. The shift check reports those its worktree still holds. See [docs/resource-lock.md](docs/resource-lock.md).
838
+ Sessions coordinate shared resources across worktrees through bounded leases. Other holders are refused and recorded as waiters; when a holder releases a lease, or a lease is found to have expired, the waiters are told through direct chat messages. A lease enforces nothing on Git or the filesystem. The shift check reports those its worktree still holds. See [docs/resource-lock.md](docs/resource-lock.md).
836
839
 
837
840
  ## Worktree overview
838
841
 
@@ -1008,6 +1011,8 @@ keel openspec <args>
1008
1011
  ```
1009
1012
 
1010
1013
  Commands take the repository as a positional path or as `--repo <path>`; `keel --help` shows which.
1014
+ Each group prints its full subcommand list: `keel chat help`, `keel mail help`, `keel shift --help`,
1015
+ `keel lock --help`, `keel patrol --help`, and `keel agents --help`.
1011
1016
 
1012
1017
  Exit codes: `0` pass · `1` input error · `2` usage error (an unknown flag or a flag the command refuses) · `3` policy failure · `4` missing semantic review. `keel patrol` uses `2` and `3` for what it found; see Coordinator patrol.
1013
1018
 
package/README.zh-CN.md CHANGED
@@ -194,6 +194,9 @@ authorize: # accepted names: commit, push, push:<branch glob>[@<role>],
194
194
  没有自己写 `Autonomy boundary:` 的 task 会继承这份声明,编译出的 capsule 会把 `keel/config.yaml`
195
195
  标为该条目的来源,这样继承来的授权永远不会被误当成 task 自己做的决定。自己写了边界的 task 保留自己的边界。
196
196
 
197
+ 下文的序数按名字计,不按上面注释里的写法计:`push` 和 `push:<branch glob>` 是同一个名字,所以词汇共 13 个名字,
198
+ `continuation` 是第五个。
199
+
197
200
  `continuation`(第五个名字)会被接受,但什么都不改变。在你批准过 `tasks.md` 的同一个 change 里,
198
201
  从一个已持久完成的 task 转到下一个未勾选的 task,默认就不需要确认(#414)。下一个 task 照样通过
199
202
  `keel gate task-start` 启动、记录自己的 fingerprint;每个门禁、证据要求、语义 Review 和写入守卫都照常运行;
@@ -234,7 +237,7 @@ chat 角色与之匹配的会话。会话在 capsule、`keel context`、`keel --
234
237
  携带、不被强制执行:角色只决定由哪个会话读到它们。
235
238
 
236
239
  `shift-restore`(#319)涵盖 Claude 桌面应用上因换班而启动的会话在 `keel shift resume` 之后必须马上做的两件事:
237
- 如果自己的 Remote Control 回来时是关着的,就把它重新打开;把自己的名字改回工作标题。那里的 clear 不保留标题。
240
+ 如果自己的 Remote Control 回来时是关着的,就把它重新打开;把自己的名字改回工作标题。桌面应用上被清空的会话不会保留原来的标题。
238
241
  没有这份声明时,被唤醒的会话会把这次恢复当成另一个会话的请求,停下来问你。它只作用于那个会话,所以不带范围;
239
242
  它不涵盖任何其他会话,不涵盖 clear 或 archive,也不涵盖任何仓库操作。
240
243
 
@@ -689,8 +692,8 @@ external_agents:
689
692
 
690
693
  ## 共享资源租约
691
694
 
692
- 会话通过有期限的租约在各 worktree 之间协调共享资源。其他持有者会被拒绝并记为等待者;释放和被察觉的过期会通过
693
- 私信通知他们。租约对 Git 或文件系统不做任何强制。换班检查会报告本 worktree 仍持有的租约。见
695
+ 会话通过有期限的租约在各 worktree 之间协调共享资源。其他持有者会被拒绝并记为等待者;持有者释放租约,或有人发现租约已过期时,
696
+ 等待者会收到私信通知。租约对 Git 或文件系统不做任何强制。换班检查会报告本 worktree 仍持有的租约。见
694
697
  [docs/resource-lock.md](docs/resource-lock.md)。
695
698
 
696
699
  ## worktree 总览
@@ -851,6 +854,8 @@ keel openspec <args>
851
854
  ```
852
855
 
853
856
  命令接受仓库路径,可以是位置参数,也可以是 `--repo <path>`;具体用哪种见 `keel --help`。
857
+ 每组命令都会打印自己的完整子命令列表:`keel chat help`、`keel mail help`、`keel shift --help`、
858
+ `keel lock --help`、`keel patrol --help` 和 `keel agents --help`。
854
859
 
855
860
  退出码:`0` 通过 · `1` 输入错误 · `2` 用法错误(未知 flag,或命令拒绝的 flag) · `3` 策略失败 · `4` 缺少语义 review。`keel patrol` 用 `2` 和 `3` 表示它发现了什么;见「协调者巡查」。
856
861
 
@@ -1,4 +1,4 @@
1
- <!-- keel:start version=5.176.0 -->
1
+ <!-- keel:start version=5.178.0 -->
2
2
  ## Keel Bootstrap
3
3
 
4
4
  - Start every session with `keel context`; OpenSpec artifacts and Git are the durable authority, and memory or transcripts may only inform.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@christang/keel",
3
- "version": "5.176.0",
3
+ "version": "5.178.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@christang/keel",
9
- "version": "5.176.0",
9
+ "version": "5.178.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@fission-ai/openspec": "^1.4.1"
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@christang/keel",
3
3
  "displayName": "Keel",
4
4
  "description": "Keel OpenSpec execution discipline CLI for Claude Code, Codex, and OpenCode.",
5
- "version": "5.176.0",
5
+ "version": "5.178.0",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keel",
3
- "version": "5.176.0",
3
+ "version": "5.178.0",
4
4
  "description": "Keel OpenSpec execution discipline: stateless continuity, task capsules, deterministic gates, and expectation alignment for Codex and Claude Code.",
5
5
  "author": {
6
6
  "name": "TanglmChris",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keel",
3
- "version": "5.176.0",
3
+ "version": "5.178.0",
4
4
  "description": "Keel OpenSpec execution discipline: stateless continuity, task capsules, deterministic gates, and expectation alignment for Codex and Claude Code.",
5
5
  "author": {
6
6
  "name": "TanglmChris",
@@ -51,8 +51,8 @@ REQUIRED_SCRIPTS = [
51
51
  "scripts/validate_plugin.py",
52
52
  ]
53
53
 
54
- PACKAGE_VERSION = "5.176.0"
55
- PROTOCOL_VERSION = "5.176.0"
54
+ PACKAGE_VERSION = "5.178.0"
55
+ PROTOCOL_VERSION = "5.178.0"
56
56
  LEGACY_MANAGED_START = "<!-- keel:start version=2.1 -->"
57
57
  OPENSPEC_SCHEMA_NAME = "keel-spec-driven"
58
58
  # Mirrors KEEL_PACKAGE_NAME in scripts/install_to_repo.py, one of the two
@@ -8338,8 +8338,9 @@ def validate_shift_cli_self_shift_scenario() -> int:
8338
8338
  if readied.returncode != 0:
8339
8339
  report(f"{label} ready --wake in a CLI session failed: {readied.stdout!r} {readied.stderr!r}")
8340
8340
  return 1
8341
- if "claude attach" not in readied.stdout or "--wake" in readied.stderr:
8342
- report(f"{label} ready --wake in a CLI session does not say how the old session is reopened: {readied.stdout!r}")
8341
+ # #418: nothing is kept by default, so the old session is removed and read through Keel's copy.
8342
+ if "keel shift history verify --show" not in readied.stdout or "--wake" in readied.stderr:
8343
+ report(f"{label} ready --wake in a CLI session does not say how the old session is read once removed: {readied.stdout!r}")
8343
8344
  return 1
8344
8345
  note = next((mailbox_common_dir(rtl) / "keel-chat" / "shift").glob("verify.md"), None)
8345
8346
  if not note:
@@ -8446,7 +8447,7 @@ def validate_shift_cli_keeps_old_sessions_scenario() -> int:
8446
8447
  """Issue #397 (owner, 2026-10-20): each CLI shift leaves a stopped session, and the list kept growing.
8447
8448
 
8448
8449
  After a delivered hand-over, the newest `shift: keep_old_sessions:`
8449
- (default 3) stopped background sessions in the role's bound worktrees stay
8450
+ (default 0 since #418, so the shift just handed over goes too) stopped background sessions in the role's bound worktrees stay
8450
8451
  listed; each older one is removed with `claude rm` once Keel's store holds
8451
8452
  a copy of its transcript. Only a session with a transcript, the host's or
8452
8453
  Keel's copy, counts (#401): one whose transcript is nowhere takes no slot and
@@ -8555,14 +8556,21 @@ def validate_shift_cli_keeps_old_sessions_scenario() -> int:
8555
8556
  report(f"{label} shift status does not name the removed sessions: {text!r}")
8556
8557
  return 1
8557
8558
 
8558
- # No declaration keeps three; a value that is not a whole number is named and three applies.
8559
+ # #418 (owner, 2026-10-21): no declaration keeps none, so the shift just handed over leaves the
8560
+ # session list too; a value that is not a whole number is named and none are kept.
8559
8561
  for keep in (None, "many"):
8560
8562
  olds = [old_row(1, bound["verify"]), old_row(2, bound["verify"]), old_row(4, bound["verify"])]
8561
8563
  setup(keep, olds)
8562
8564
  ids = sorted(r["argv"][1] for r in removed())
8563
- if ids != ["01010101"]:
8565
+ if ids != sorted(["01010101", "02020202", "04040404", OLD[:8]]):
8564
8566
  report(f"{label} the default keeps the wrong number of old sessions (keep_old_sessions {keep!r}): removed {ids!r}")
8565
8567
  return 1
8568
+ if not all(r["kept"] for r in removed()):
8569
+ report(f"{label} a session was removed before Keel's store held its transcript: {removed()!r}")
8570
+ return 1
8571
+ if f"keel shift history verify --show {OLD[:8]}" not in run_keel(rtl, "shift", "status", env=env).stdout:
8572
+ report(f"{label} shift status does not say how the removed old shift is read: {run_keel(rtl, 'shift', 'status', env=env).stdout!r}")
8573
+ return 1
8566
8574
  if keep == "many" and "keep_old_sessions" not in run_keel(rtl, "shift", "status", env=env).stdout:
8567
8575
  report(f"{label} an unreadable keep_old_sessions is not named: {run_keel(rtl, 'shift', 'status', env=env).stdout!r}")
8568
8576
  return 1
@@ -39550,6 +39558,93 @@ def validate_readme_zh_matches_english_scenario() -> int:
39550
39558
  return 0
39551
39559
 
39552
39560
 
39561
+ def validate_config_documents_in_declaration_order_scenario() -> int:
39562
+ """Issue #413: the configuration file documents what it says it documents.
39563
+
39564
+ `CONFIG_DECLARATIONS` is "in the order the file documents them", and the
39565
+ file had drifted: owner_language first, patrol twice, executor_tier never.
39566
+ The order is read from the code, so a declaration added there without its
39567
+ block, or a block written out of place, fails here.
39568
+ """
39569
+ label = "config-documents-in-declaration-order:"
39570
+ source = (ROOT / "src/core/config.js").read_text(encoding="utf-8")
39571
+ declared = re.search(r"const CONFIG_DECLARATIONS = \[(.*?)\];", source, re.S)
39572
+ names = re.findall(r'^\s*"([a-z_]+)",', declared.group(1), re.M) if declared else []
39573
+ if len(names) < 12:
39574
+ report(f"{label} read {len(names)} declarations from config.js; expected at least 12.")
39575
+ return 1
39576
+ config = (ROOT / "keel/config.yaml").read_text(encoding="utf-8")
39577
+ blocks = re.findall(r"^# ([a-z_]+) \(optional\):", config, re.M)
39578
+ if blocks != names:
39579
+ report(f"{label} keel/config.yaml documents {blocks}, not {names} in that order.")
39580
+ return 1
39581
+ if "`chat-reply`, and `push-protected` are the names" not in config:
39582
+ report(f"{label} keel/config.yaml's scoped-name sentence does not name `push-protected`.")
39583
+ return 1
39584
+ updating = (ROOT / "docs/updating.md").read_text(encoding="utf-8")
39585
+ if "skills and agents" in updating.lower():
39586
+ report(f"{label} docs/updating.md still says Claude reloads skills and agents.")
39587
+ return 1
39588
+ for needle in ("config.toml", "E404"):
39589
+ if needle not in updating:
39590
+ report(f"{label} docs/updating.md does not mention {needle!r}.")
39591
+ return 1
39592
+ for name in ("README.md", "README.zh-CN.md"):
39593
+ text = (ROOT / name).read_text(encoding="utf-8")
39594
+ for phrase in ("A clear there keeps no title", "noticed expiry"):
39595
+ if phrase in text:
39596
+ report(f"{label} {name} still says {phrase!r}.")
39597
+ return 1
39598
+ if "keel chat help" not in text:
39599
+ report(f"{label} {name} does not point to `keel chat help` for the full chat command list.")
39600
+ return 1
39601
+ if label.rstrip(":") not in {name for name, _ in SCENARIOS}:
39602
+ report(f"{label} the scenario registry does not include it.")
39603
+ return 1
39604
+ report(f"{label.rstrip(':')} scenario passed.")
39605
+ return 0
39606
+
39607
+
39608
+ def validate_docs_zh_match_english_scenario() -> int:
39609
+ """Issue #413: each Chinese doc follows its English page.
39610
+
39611
+ `docs/shift-change.zh-CN.md` had five sections against eight and never
39612
+ mentioned `keel patrol` or `keel tick`. Every Chinese page that exists is
39613
+ checked, so a new one is held from the day it is written.
39614
+ """
39615
+ label = "docs-zh-match-english:"
39616
+ pages = sorted((ROOT / "docs").glob("*.zh-CN.md"))
39617
+ if not pages:
39618
+ report(f"{label} found no docs/*.zh-CN.md to check.")
39619
+ return 1
39620
+ for zh_path in pages:
39621
+ en_path = zh_path.with_name(zh_path.name.replace(".zh-CN.md", ".md"))
39622
+ if not en_path.is_file():
39623
+ report(f"{label} {zh_path.name} has no English page {en_path.name}.")
39624
+ return 1
39625
+ en = en_path.read_text(encoding="utf-8").splitlines()
39626
+ zh = zh_path.read_text(encoding="utf-8").splitlines()
39627
+ for what, prefix in (("headings", "#"), ("code fences", "```")):
39628
+ counts = [sum(1 for line in lines if line.startswith(prefix)) for lines in (en, zh)]
39629
+ if counts[0] != counts[1]:
39630
+ report(f"{label} {en_path.name} has {counts[0]} {what} and {zh_path.name} has {counts[1]}.")
39631
+ return 1
39632
+ zh_text = "\n".join(zh)
39633
+ for command in sorted(set(re.findall(r"keel [a-z][a-z-]*", "\n".join(en)))):
39634
+ if command not in zh_text:
39635
+ report(f"{label} {zh_path.name} does not name `{command}`, which {en_path.name} names.")
39636
+ return 1
39637
+ slack = (ROOT / "docs/chat-slack-setup.zh-CN.md").read_text(encoding="utf-8")
39638
+ if "编辑和删除" not in slack:
39639
+ report(f"{label} chat-slack-setup.zh-CN.md does not say edits and deletions carry over.")
39640
+ return 1
39641
+ if label.rstrip(":") not in {name for name, _ in SCENARIOS}:
39642
+ report(f"{label} the scenario registry does not include it.")
39643
+ return 1
39644
+ report(f"{label.rstrip(':')} scenario passed.")
39645
+ return 0
39646
+
39647
+
39553
39648
  def validate_tdd_strategy_guide_scenario() -> int:
39554
39649
  """Issue #389: the skill an executor loads to plan its checks says how to choose.
39555
39650
 
@@ -41671,6 +41766,8 @@ SCENARIOS: tuple = (
41671
41766
  ("surfaces-agree-with-code", validate_surfaces_agree_with_code_scenario),
41672
41767
  ("readme-states-the-cli", validate_readme_states_the_cli_scenario),
41673
41768
  ("readme-zh-matches-english", validate_readme_zh_matches_english_scenario),
41769
+ ("config-documents-in-declaration-order", validate_config_documents_in_declaration_order_scenario),
41770
+ ("docs-zh-match-english", validate_docs_zh_match_english_scenario),
41674
41771
  (
41675
41772
  "a-tier-declares-what-is-skipped",
41676
41773
  validate_a_tier_declares_what_is_skipped_scenario,
@@ -166,6 +166,7 @@ const CONFIG_DECLARATIONS = [
166
166
  "read_only_roles",
167
167
  "issue_roles",
168
168
  "patrol",
169
+ "shift",
169
170
  "owner_language",
170
171
  ];
171
172
 
@@ -995,7 +996,9 @@ function readPatrolDeclaration(repo) {
995
996
  // `shift: permission_mode:` for the session a CLI hand-off starts (#357 D5).
996
997
  const PERMISSION_MODES = ["default", "acceptEdits", "auto", "plan", "bypassPermissions"];
997
998
  // `shift: keep_old_sessions:`, how many stopped old shift sessions a hand-over
998
- // leaves listed per role (#397 D2): a whole number, 3 when absent or unreadable.
999
+ // leaves listed per role (#397 D2): a whole number, 0 when absent or unreadable,
1000
+ // so the old shift leaves the session list where the owner could mistake it for
1001
+ // the current one (#418).
999
1002
  function readShiftDeclaration(repo) {
1000
1003
  const block = configMap(repo, "shift");
1001
1004
  const mode = block.permission_mode;
@@ -1004,9 +1007,9 @@ function readShiftDeclaration(repo) {
1004
1007
  if (PERMISSION_MODES.includes(mode)) permissionMode = mode;
1005
1008
  else if (mode !== undefined) messages.push(`keel/config.yaml shift: permission_mode \`${mode}\` is not one of ${PERMISSION_MODES.join(", ")}, so it is ignored.`);
1006
1009
  const keep = block.keep_old_sessions;
1007
- let keepOldSessions = 3;
1010
+ let keepOldSessions = 0;
1008
1011
  if (keep !== undefined && /^\d+$/.test(String(keep).trim())) keepOldSessions = Number(String(keep).trim());
1009
- else if (keep !== undefined) messages.push(`keel/config.yaml shift: keep_old_sessions \`${keep}\` is not a whole number, so 3 apply.`);
1012
+ else if (keep !== undefined) messages.push(`keel/config.yaml shift: keep_old_sessions \`${keep}\` is not a whole number, so 0 applies.`);
1010
1013
  return { permissionMode, keepOldSessions, message: messages.length ? messages.join(" ") : null };
1011
1014
  }
1012
1015
 
package/src/core/shift.js CHANGED
@@ -1204,8 +1204,13 @@ const CLEAR_HINT = [
1204
1204
  // or — without a chat role — the person who opens it.
1205
1205
  function clearHint(result) {
1206
1206
  if (result.queued) {
1207
+ const own = result.cli.session.slice(0, 8);
1208
+ // Nothing kept by default (#418): the old shift is removed once Keel holds its transcript.
1209
+ const kept = require("./config").readShiftDeclaration(result.worktree).keepOldSessions > 0
1210
+ ? `its conversation is kept, \`claude attach ${own}\` reopens it`
1211
+ : `then removes it from the session list once Keel's store holds its transcript, which \`keel shift history ${result.role} --show ${own}\` prints`;
1207
1212
  return "This is a Claude Code CLI session, which cannot clear itself (#357). End your turn now: once this session has finished, "
1208
- + `a waiter stops it — its conversation is kept, \`claude attach ${result.cli.session.slice(0, 8)}\` reopens it — and starts a new session `
1213
+ + `a waiter stops it — ${kept} — and starts a new session `
1209
1214
  + `named for its start, \`${result.role} · <MM-DD HH:MM>\`, in ${result.worktree} that runs \`keel shift resume\`; \`keel tick\` does the same if the waiter is gone. \`keel shift status\` shows the hand-off.`;
1210
1215
  }
1211
1216
  let last;