@christang/keel 5.163.0 → 5.165.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.
- package/.claude-plugin/plugin.json +4 -1
- package/assets/bootstrap/AGENTS.md +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/plugins/keel/.claude-plugin/plugin.json +1 -1
- package/plugins/keel/.codex-plugin/plugin.json +1 -1
- package/plugins/keel/commands/shift.md +47 -0
- package/scripts/validate_plugin.py +86 -9
- package/src/core/shift.js +6 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.165.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
|
{
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@christang/keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.165.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@christang/keel",
|
|
9
|
-
"version": "5.
|
|
9
|
+
"version": "5.165.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@fission-ai/openspec": "^1.4.1"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.165.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.
|
|
3
|
+
"version": "5.165.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.
|
|
53
|
-
PROTOCOL_VERSION = "5.
|
|
52
|
+
PACKAGE_VERSION = "5.165.0"
|
|
53
|
+
PROTOCOL_VERSION = "5.165.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
|
|
|
@@ -8168,8 +8241,8 @@ def validate_shift_cli_self_shift_scenario() -> int:
|
|
|
8168
8241
|
retires it (stop, rename by resuming it with `/rename`, stop) and starts a
|
|
8169
8242
|
new session in the role's worktree that runs `keel shift resume`. `keel
|
|
8170
8243
|
tick` carries out a queued hand-off too, and the two start one session. A
|
|
8171
|
-
session that is busy, or blocked on a question
|
|
8172
|
-
|
|
8244
|
+
session that is busy, or waiting for input (blocked on a question), is left
|
|
8245
|
+
alone; its job state is not read (#393). `keel shift status` shows the queue, and a
|
|
8173
8246
|
failed start is a patrol risk.
|
|
8174
8247
|
"""
|
|
8175
8248
|
label = "shift-cli-self-shift:"
|
|
@@ -8207,6 +8280,8 @@ def validate_shift_cli_self_shift_scenario() -> int:
|
|
|
8207
8280
|
row = {"kind": "background", "name": name, "sessionId": OLD, "id": OLD[:8], "pid": os.getpid(), "state": state, "cwd": str(verify)}
|
|
8208
8281
|
if status:
|
|
8209
8282
|
row["status"] = status
|
|
8283
|
+
if status == "waiting":
|
|
8284
|
+
row["waitingFor"] = "input needed"
|
|
8210
8285
|
agents.write_text(json.dumps([row]))
|
|
8211
8286
|
|
|
8212
8287
|
def rows() -> list[dict]:
|
|
@@ -8248,7 +8323,7 @@ def validate_shift_cli_self_shift_scenario() -> int:
|
|
|
8248
8323
|
report(f"{label} the note does not record the CLI session.")
|
|
8249
8324
|
return 1
|
|
8250
8325
|
|
|
8251
|
-
# A busy session, and one blocked on a question, are left alone.
|
|
8326
|
+
# A busy session, and one blocked on a question (measured: status waiting, state blocked), are left alone.
|
|
8252
8327
|
time.sleep(1.0)
|
|
8253
8328
|
if acted():
|
|
8254
8329
|
report(f"{label} the hand-over acted while the old session was busy: {acted()!r}")
|
|
@@ -8256,14 +8331,15 @@ def validate_shift_cli_self_shift_scenario() -> int:
|
|
|
8256
8331
|
if "pending" not in status_text():
|
|
8257
8332
|
report(f"{label} shift status does not show the pending hand-off: {status_text()!r}")
|
|
8258
8333
|
return 1
|
|
8259
|
-
agents_row("
|
|
8334
|
+
agents_row("waiting", "blocked")
|
|
8260
8335
|
time.sleep(1.0)
|
|
8261
8336
|
if acted():
|
|
8262
|
-
report(f"{label} the hand-over cut off a session blocked on a question (
|
|
8337
|
+
report(f"{label} the hand-over cut off a session blocked on a question (status waiting): {acted()!r}")
|
|
8263
8338
|
return 1
|
|
8264
8339
|
|
|
8265
|
-
# Finished:
|
|
8266
|
-
|
|
8340
|
+
# Finished: idle, though its state still labels its last message `working` (#393, keel-maint's
|
|
8341
|
+
# ended turn). The waiter retires it and starts the next, with no tick.
|
|
8342
|
+
agents_row("idle", "working")
|
|
8267
8343
|
if not wait_for(lambda: len(starts()) >= 1):
|
|
8268
8344
|
report(f"{label} the waiter did not hand over without a tick: {acted()!r}")
|
|
8269
8345
|
return 1
|
|
@@ -42876,6 +42952,7 @@ SCENARIOS: tuple = (
|
|
|
42876
42952
|
("patrol-next", validate_patrol_next_scenario),
|
|
42877
42953
|
("tick-runs-due-patrol", validate_tick_runs_due_patrol_scenario),
|
|
42878
42954
|
("launchd-stable-node", validate_launchd_stable_node_scenario),
|
|
42955
|
+
("shift-slash-command", validate_shift_slash_command_scenario),
|
|
42879
42956
|
("patrol-exit-says-who-acts", validate_patrol_exit_says_who_acts_scenario),
|
|
42880
42957
|
("patrol-nudge", validate_patrol_nudge_scenario),
|
|
42881
42958
|
("patrol-escalate", validate_patrol_escalate_scenario),
|
package/src/core/shift.js
CHANGED
|
@@ -503,13 +503,13 @@ function handOffs(where) {
|
|
|
503
503
|
|
|
504
504
|
const SHIFT_START_TEXT = (role) => `${role}: your new shift starts now. Run keel context, then keel shift resume.`;
|
|
505
505
|
|
|
506
|
-
// The old session has finished when it is gone,
|
|
507
|
-
//
|
|
508
|
-
//
|
|
506
|
+
// The old session has finished when it is gone, stopped (no status), or idle.
|
|
507
|
+
// `busy` and `waiting` (blocked on a question to the owner, measured) wait, and
|
|
508
|
+
// so does anything unknown. The job `state` labels the last message, not the
|
|
509
|
+
// turn: an ended turn that described pending work stayed `working` (#393).
|
|
509
510
|
function finished(row) {
|
|
510
|
-
if (!row) return true;
|
|
511
|
-
|
|
512
|
-
return !row.state || ["done", "idle", "stopped"].includes(row.state);
|
|
511
|
+
if (!row || !row.status) return true;
|
|
512
|
+
return row.status === "idle";
|
|
513
513
|
}
|
|
514
514
|
|
|
515
515
|
function listAgents(claude) {
|