@christang/keel 5.177.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.177.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,4 +1,4 @@
1
- <!-- keel:start version=5.177.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.177.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.177.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.177.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.177.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.177.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.177.0"
55
- PROTOCOL_VERSION = "5.177.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
@@ -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;