@christang/keel 5.163.0 → 5.164.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.163.0",
3
+ "version": "5.164.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",
@@ -20,6 +20,9 @@
20
20
  "agents": [
21
21
  "./plugins/keel/agents/keel-single-task-goal-claude.md"
22
22
  ],
23
+ "commands": [
24
+ "./plugins/keel/commands/shift.md"
25
+ ],
23
26
  "hooks": {
24
27
  "SessionStart": [
25
28
  {
@@ -1,4 +1,4 @@
1
- <!-- keel:start version=5.163.0 -->
1
+ <!-- keel:start version=5.164.0 -->
2
2
  ## Keel Bootstrap
3
3
 
4
4
  - Start every session with `keel context`; OpenSpec artifacts and Git are the only durable authority — never native memory, goals, or transcripts.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@christang/keel",
3
- "version": "5.163.0",
3
+ "version": "5.164.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@christang/keel",
9
- "version": "5.163.0",
9
+ "version": "5.164.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.163.0",
5
+ "version": "5.164.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.163.0",
3
+ "version": "5.164.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.163.0",
3
+ "version": "5.164.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",
@@ -0,0 +1,47 @@
1
+ ---
2
+ description: Change this session's own shift — check for loose ends, write the hand-off note, arm the wake
3
+ ---
4
+
5
+ Change this session's shift: leave a note for the next one and let Keel start it. The mechanism is `keel shift`; this command only orders the steps. `docs/shift-change.md` in the Keel package says more when a step below is not enough.
6
+
7
+ ## 1. Check for loose ends
8
+
9
+ ```bash
10
+ keel shift check
11
+ ```
12
+
13
+ Exit 0 means ready. Exit 1 lists items. Deal with each before going on, or stop and ask the owner when one is not yours to settle:
14
+
15
+ - Uncommitted changes, unpushed commits, a write guard, a lock lease, a linked worktree: commit and push, run `keel guard clear`, release the lease, or remove the worktree you made. Do not discard work to make the list empty.
16
+ - A process: tell the host's from yours. A keep-awake the host started under this session, such as `caffeinate -i -t 300`, ends by itself, so it may stay. A server, watcher or job you started is yours: stop it, or ask the owner before leaving it running.
17
+
18
+ A shift in the middle of a task throws away working state that compaction would have kept. If the task is not at a boundary, say so to the owner before going on.
19
+
20
+ ## 2. Write the hand-off note
21
+
22
+ The note is all the next shift has. Put in it:
23
+
24
+ - what you did, and where it lives: branch, worktree, PR, issue, file;
25
+ - the next step, concrete enough to start from;
26
+ - what you are waiting on, and what it unblocks;
27
+ - what you left running or uncommitted on purpose, and why.
28
+
29
+ Name commits and branches by id; `keel shift resume` checks them against the remote. Carry over what the owner already approved, because the next shift cannot ask this one.
30
+
31
+ ## 3. Hand over
32
+
33
+ Use a quoted heredoc, so backticks in the note are not run. When step 1 listed only the host's own processes, add `--force-reason "<which process, and that the host owns it>"`.
34
+
35
+ ```bash
36
+ keel shift ready --wake --file - <<'EOF'
37
+ <the note>
38
+ EOF
39
+ ```
40
+
41
+ Read what it prints and do what it says for this host:
42
+
43
+ - Claude CLI background session: end your turn at once with one short line. A waiter replaces this session when it has finished, so do not start other work or ask the owner anything after `ready`: a session waiting on an answer is not replaced.
44
+ - Claude desktop app: it prints four steps. Take them without pausing when `keel/config.yaml` declares `self-shift` under `authorize:`, and ask the owner first when it does not.
45
+ - No chat role: `ready` is refused and names `keel chat role --set`. Bind a role first, or ask the owner who starts the new session.
46
+
47
+ The one line you end on names the note's path and where the next session starts.
@@ -49,8 +49,8 @@ REQUIRED_SCRIPTS = [
49
49
  "scripts/validate_plugin.py",
50
50
  ]
51
51
 
52
- PACKAGE_VERSION = "5.163.0"
53
- PROTOCOL_VERSION = "5.163.0"
52
+ PACKAGE_VERSION = "5.164.0"
53
+ PROTOCOL_VERSION = "5.164.0"
54
54
  LEGACY_MANAGED_START = "<!-- keel:start version=2.1 -->"
55
55
  OPENSPEC_SCHEMA_NAME = "keel-spec-driven"
56
56
  # Mirrors KEEL_PACKAGE_NAME in scripts/install_to_repo.py, one of the two
@@ -3449,6 +3449,79 @@ def validate_launchd_stable_node_scenario() -> int:
3449
3449
  return 0
3450
3450
 
3451
3451
 
3452
+ def validate_shift_slash_command_scenario() -> int:
3453
+ """Issue #386: a session changes its own shift with one slash command.
3454
+
3455
+ `/keel:shift` is a command file in the Claude plugin that orders what a
3456
+ session does: check, settle each loose end (a keep-awake the host started,
3457
+ such as `caffeinate`, is not one), write the note, `ready --wake`. The
3458
+ scenario finds it through the root manifest and runs its own fenced `keel
3459
+ shift` lines in a clean worktree bound to a role, so a flag `keel` no
3460
+ longer accepts, or a heredoc that stores nothing, fails it.
3461
+ """
3462
+ label = "shift-slash-command:"
3463
+ manifest = json.loads((ROOT / ".claude-plugin" / "plugin.json").read_text(encoding="utf-8"))
3464
+ declared = manifest.get("commands") or []
3465
+ if not declared:
3466
+ report(f"{label} the root manifest declares no command")
3467
+ return 1
3468
+ files = [ROOT / entry for entry in declared if (ROOT / entry).name == "shift.md"]
3469
+ if len(files) != 1 or not files[0].is_file():
3470
+ report(f"{label} the root manifest's commands {declared!r} do not resolve to one plugins/keel/commands/shift.md")
3471
+ return 1
3472
+ if files[0].relative_to(ROOT).parts[:3] != ("plugins", "keel", "commands"):
3473
+ report(f"{label} the command is not under plugins/keel/commands: {files[0]}")
3474
+ return 1
3475
+ text = files[0].read_text(encoding="utf-8")
3476
+ front = re.match(r"---\n(.*?)\n---\n", text, re.S)
3477
+ if not front or not re.search(r"^description: \S", front.group(1), re.M):
3478
+ report(f"{label} the command has no front matter with a description.")
3479
+ return 1
3480
+ for needle in ("caffeinate", "--force-reason", "self-shift", "end your turn"):
3481
+ if needle not in text:
3482
+ report(f"{label} the command does not say {needle!r}.")
3483
+ return 1
3484
+ blocks = re.findall(r"```bash\n(.*?)```", text, re.S)
3485
+ lines = [b for b in blocks if b.lstrip().startswith("keel shift")]
3486
+ if [b.split()[2] for b in lines] != ["check", "ready"]:
3487
+ report(f"{label} the command's keel shift blocks are not check, then ready: {[b.split()[:3] for b in lines]!r}")
3488
+ return 1
3489
+ with tempfile.TemporaryDirectory(prefix="keel-shift-386-") as raw:
3490
+ base = Path(raw)
3491
+ _rtl, verify, env, _ = shift_scratch(base)
3492
+ shim = base / "shim"
3493
+ write_text(shim / "keel", f'#!/bin/sh\nexec node "{ROOT / "bin" / "keel.js"}" "$@"\n')
3494
+ (shim / "keel").chmod(0o755)
3495
+ env = {**env, "PATH": f"{shim}{os.pathsep}{os.environ.get('PATH', '')}", "KEEL_SHIFT_WAKE_TIMEOUT_MS": "2000"}
3496
+ checked = subprocess.run(["sh", "-c", lines[0]], cwd=verify, env=env, text=True, capture_output=True, check=False)
3497
+ if checked.returncode != 0:
3498
+ report(f"{label} the command's check line exited {checked.returncode} in a clean worktree: {checked.stdout!r} {checked.stderr!r}")
3499
+ return 1
3500
+ handed = subprocess.run(["sh", "-c", lines[1]], cwd=verify, env=env, text=True, capture_output=True, check=False)
3501
+ if handed.returncode != 0:
3502
+ report(f"{label} the command's ready line exited {handed.returncode}: {handed.stdout!r} {handed.stderr!r}")
3503
+ return 1
3504
+ body = re.search(r"<<'EOF'\n(.*?)\nEOF", lines[1], re.S)
3505
+ stored = mailbox_common_dir(verify) / "keel-chat" / "shift" / "verify.md"
3506
+ if not body:
3507
+ report(f"{label} the command's ready line carries no quoted heredoc: {lines[1]!r}")
3508
+ return 1
3509
+ if not stored.exists():
3510
+ report(f"{label} the command's ready line stored no note at {stored}: {handed.stdout!r}")
3511
+ return 1
3512
+ if body.group(1).strip() not in stored.read_text(encoding="utf-8"):
3513
+ report(f"{label} the stored note is not the heredoc's: {stored.read_text(encoding='utf-8')!r}")
3514
+ return 1
3515
+ if "wake is armed" not in handed.stdout:
3516
+ report(f"{label} the command's ready line did not arm the wake: {handed.stdout!r}")
3517
+ return 1
3518
+ if "shift-slash-command" not in {name for name, _ in SCENARIOS}:
3519
+ report(f"{label} scenario is not registered.")
3520
+ return 1
3521
+ report("shift-slash-command scenario passed.")
3522
+ return 0
3523
+
3524
+
3452
3525
  def validate_tick_runs_due_patrol_scenario() -> int:
3453
3526
  """The owner's CLI waker (2026-10-19, #356): `keel tick` runs the patrol when due.
3454
3527
 
@@ -42876,6 +42949,7 @@ SCENARIOS: tuple = (
42876
42949
  ("patrol-next", validate_patrol_next_scenario),
42877
42950
  ("tick-runs-due-patrol", validate_tick_runs_due_patrol_scenario),
42878
42951
  ("launchd-stable-node", validate_launchd_stable_node_scenario),
42952
+ ("shift-slash-command", validate_shift_slash_command_scenario),
42879
42953
  ("patrol-exit-says-who-acts", validate_patrol_exit_says_who_acts_scenario),
42880
42954
  ("patrol-nudge", validate_patrol_nudge_scenario),
42881
42955
  ("patrol-escalate", validate_patrol_escalate_scenario),