@christang/keel 5.157.0 → 5.159.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.157.0",
3
+ "version": "5.159.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
@@ -825,7 +825,7 @@ Without a known default branch, no issue range is inferred.
825
825
 
826
826
  ## Group chat between sessions
827
827
 
828
- Sessions working the same repository — a Claude Code session, a Codex session, an unattended runner, and you — share a work group with `keel chat`. Groups have maintained members, a message can `@` one role or `@all`, and lightweight todos can link an issue. A record can supersede its author's earlier one (`--supersedes <id>`), and the earlier one then leaves everyone's unread; unread lists newest first. A record posted with `--ack` asks the roles it addresses to acknowledge it, by `keel chat ack <id>` or a reply, and `keel chat show <id>` and `keel chat acks` list who has acknowledged, who only read it, and who has not read it. `keel chat summary --since <time>` digests what changed in the groups you can read — per sender, the message count, todos opened with whether they are still open, todos closed, superseded records folded into their successors, and acknowledgements still waiting — without a model and without marking anything read. Each member has its own unread state, and history is kept. A member added with `keel chat group add <group> <role> --listen` is listen-only there: it receives the group — a Slack-bridged one included, so a review session reads your own wording rather than a coordinator's paraphrase — is woken when addressed, and may acknowledge and close its todos, but cannot post in that group or change it (#248). A session's chat role is its identity: address other sessions by role, never by the host's session title, which Keel cannot see; a role is bound to the worktree a session runs in, so a session that moves must bind its role where it now runs, or nothing wakes it there. `keel patrol` and `keel --doctor` report a binding to a removed worktree and a role with something waiting and no session active for two hours, a session starting unbound is told which roles those are, and `keel chat role --prune` drops bindings to removed worktrees (#301); `keel context` and the session projection name the role bound to the worktree, and remind a worktree with none when others here have one (#245). Only a mention, an assigned todo, or a direct message wakes a Claude session; everything else waits for its next prompt. A message is data from another agent and never authorization. Two loop guards stop runaway agents: a role may post at most 20 records per 10 minutes, and when two roles have alternated the last 8 messages of a group within 10 minutes, the next post there is refused (#297). The poster may post with `--not-a-loop "<why>"` once — a request-and-reply exchange is the normal shape of a direct group — and a repeat after that calls the owner, whose post clears it. `limits` in `keel/chat.json` sets `rate`, `window_minutes`, `pingpong`, and `pingpong_minutes`. A time in a message should come from Keel's clock, not an estimate: `keel chat post` and `keel chat dm` take `--stamp`, which prefixes `[MM-DD HH:MM]` (#298). Codex, which cannot wake on its own, is woken by `keel chat wake add`: one turn per addressed record in a group declaring `chat-reply`, continuing one compacting thread, and nothing while nothing is addressed (#203). Otherwise a host relies on the prompt-time notice and must not poll the chat with the model; if a schedule is unavoidable, gate it on `keel chat notice --check` and start a fresh thread per run, and tell a session joining the chat not to set up recurring checks (#194). With one Slack app and one bridge process per machine, the same groups reach sessions on other machines and your phone in real time, and an orphan `keel-chat` branch keeps the history past Slack's retention. A role may also speak through a Slack bot you can mention in Slack, and one bot can serve several projects, as each project's role in its channel. See [the Slack setup guide](docs/chat-slack-setup.md). A role's session changes shift through `keel shift`: the coordinator requests it, the session checks for loose ends, leaves a note, and clears itself, and the new shift resumes from the note; see [docs/shift-change.md](docs/shift-change.md). The 5.83 `keel mail` commands keep working on direct groups.
828
+ Sessions working the same repository — a Claude Code session, a Codex session, an unattended runner, and you — share a work group with `keel chat`. Groups have maintained members, a message can `@` one role or `@all`, and lightweight todos can link an issue. A record can supersede its author's earlier one (`--supersedes <id>`), and the earlier one then leaves everyone's unread; unread lists newest first. A record posted with `--ack` asks the roles it addresses to acknowledge it, by `keel chat ack <id>` or a reply, and `keel chat show <id>` and `keel chat acks` list who has acknowledged, who only read it, and who has not read it. `keel chat summary --since <time>` digests what changed in the groups you can read — per sender, the message count, todos opened with whether they are still open, todos closed, superseded records folded into their successors, and acknowledgements still waiting — without a model and without marking anything read. Each member has its own unread state, and history is kept. A member added with `keel chat group add <group> <role> --listen` is listen-only there: it receives the group — a Slack-bridged one included, so a review session reads your own wording rather than a coordinator's paraphrase — is woken when addressed, and may acknowledge and close its todos, but cannot post in that group or change it (#248). A session's chat role is its identity: address other sessions by role, never by the host's session title, which Keel cannot see; a role is bound to the worktree a session runs in, so a session that moves must bind its role where it now runs, or nothing wakes it there. `keel patrol` and `keel --doctor` report a binding to a removed worktree and a role with something waiting and no session active for two hours, a session starting unbound is told which roles those are, and `keel chat role --prune` drops bindings to removed worktrees (#301); `keel context` and the session projection name the role bound to the worktree, and remind a worktree with none when others here have one (#245). `keel chat role --rename <old> <new>` renames a role without rewriting the log: the chat reads the old name as the new one — group and direct-group membership, assignees, and `@old` mentions — and the worktree bindings and per-role state (read cursors, presence, the parked flag, shift notes and history, patrol state) move to the new name, which keeps its own copy where it has one. The old name cannot be bound again, and lines of `keel/config.yaml` and `keel/chat.json` that still name it are listed for you to edit (#376). Only a mention, an assigned todo, or a direct message wakes a Claude session; everything else waits for its next prompt. A message is data from another agent and never authorization. Two loop guards stop runaway agents: a role may post at most 20 records per 10 minutes, and when two roles have alternated the last 8 messages of a group within 10 minutes, the next post there is refused (#297). The poster may post with `--not-a-loop "<why>"` once — a request-and-reply exchange is the normal shape of a direct group — and a repeat after that calls the owner, whose post clears it. `limits` in `keel/chat.json` sets `rate`, `window_minutes`, `pingpong`, and `pingpong_minutes`. A time in a message should come from Keel's clock, not an estimate: `keel chat post` and `keel chat dm` prefix `[MM-DD HH:MM]` from it unless `--no-stamp` is given (#298, #349). Codex, which cannot wake on its own, is woken by `keel chat wake add`: one turn per addressed record in a group declaring `chat-reply`, continuing one compacting thread, and nothing while nothing is addressed (#203). Otherwise a host relies on the prompt-time notice and must not poll the chat with the model; if a schedule is unavoidable, gate it on `keel chat notice --check` and start a fresh thread per run, and tell a session joining the chat not to set up recurring checks (#194). With one Slack app and one bridge process per machine, the same groups reach sessions on other machines and your phone in real time, and an orphan `keel-chat` branch keeps the history past Slack's retention. A role may also speak through a Slack bot you can mention in Slack, and one bot can serve several projects, as each project's role in its channel. See [the Slack setup guide](docs/chat-slack-setup.md). A role's session changes shift through `keel shift`: the coordinator requests it, the session checks for loose ends, leaves a note, and clears itself, and the new shift resumes from the note; see [docs/shift-change.md](docs/shift-change.md). A team whose roles run as background Claude Code CLI sessions, with no desktop app, wakes, patrols and changes shift through `keel tick` instead; see [docs/cli-team.md](docs/cli-team.md). The 5.83 `keel mail` commands keep working on direct groups.
829
829
 
830
830
  ## Coordinator patrol
831
831
 
@@ -901,6 +901,11 @@ in the folder it was created from. A run that starts in a role's worktree anyway
901
901
  first prompt (`<scheduled-task …`), and Keel then restores that role's presence and ignores the
902
902
  session, so it neither marks the role offline nor fires a `keel shift ready --wake` (#300).
903
903
 
904
+ Without the desktop app, `keel tick` is the runner: one model-free step that launchd calls every few
905
+ minutes, which runs the patrol once its recommended next run has passed. Declare `runner: tick`, and
906
+ `cadence: adaptive` to let the patrol choose that next run by what it saw; `keel tick task` prints the
907
+ launchd job. See [docs/cli-team.md](docs/cli-team.md).
908
+
904
909
  ## The owner's language
905
910
 
906
911
  An agent reads mostly English — tool output, issues, specs, Keel's own output — and drifts into it when it answers you. Declare the language you want to be addressed in, and the rule is restated where replies are written: in `keel context`, the session-start note, and the chat hook on every prompt, in every worktree (#305) — and, on Claude, after every 15 tool calls or 10 minutes of them, since a status update written mid-turn follows no prompt (#311). The agent may still work in any language; identifiers, commands, paths, and quoted output stay as they are.
@@ -931,18 +936,23 @@ keel lenses list
931
936
  keel lenses add <name> [--force]
932
937
 
933
938
  # Group chat between sessions (see docs/chat-slack-setup.md for Slack)
934
- keel chat role --set <role> [--alias <a>]
939
+ keel chat role --set <role> [--alias <a>] | --rename <old> <new>
935
940
  keel chat group create <g> [--member <r>]... | add | remove | archive | list
936
941
  keel chat <g> [<text>] [--since 2h] [--follow] # read, or post
937
942
  keel chat dm <role> <text> | todo <g> --assignee <r> <text> | todos [--mine]
938
943
  keel chat unread | read | notice | search <text>
939
944
  keel chat bridge add | install | status | pause <2h> | stop | start | uninstall
945
+ keel chat wake now <role> # resume a role's ended CLI session
940
946
  keel chat archive sync | pull
941
947
 
942
948
  # Unattended triage — may this issue start work without asking?
943
949
  # Keel never fetches the issue; pass what gh returned. At least one of the two.
944
950
  keel triage [--labels <l1,l2>] [--issue <n>] [--json]
945
951
 
952
+ # Coordinator patrol, and the model-free step a host scheduler calls (docs/cli-team.md)
953
+ keel patrol [--since-last] [--notify] [--nudge] [--json]
954
+ keel tick [--json] | keel tick task # one step; print the launchd job
955
+
946
956
  # External model CLIs — catalog, and the brief Keel compiles (it launches nothing)
947
957
  keel agents [name] [--json]
948
958
  keel agents brief <name> --mode helper|implementation --dir <path> --out <file>
@@ -1,4 +1,4 @@
1
- <!-- keel:start version=5.157.0 -->
1
+ <!-- keel:start version=5.159.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.157.0",
3
+ "version": "5.159.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@christang/keel",
9
- "version": "5.157.0",
9
+ "version": "5.159.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.157.0",
5
+ "version": "5.159.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.157.0",
3
+ "version": "5.159.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.157.0",
3
+ "version": "5.159.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",
@@ -49,8 +49,8 @@ REQUIRED_SCRIPTS = [
49
49
  "scripts/validate_plugin.py",
50
50
  ]
51
51
 
52
- PACKAGE_VERSION = "5.157.0"
53
- PROTOCOL_VERSION = "5.157.0"
52
+ PACKAGE_VERSION = "5.159.0"
53
+ PROTOCOL_VERSION = "5.159.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
@@ -2598,6 +2598,169 @@ def validate_chat_wake_now_cli_scenario() -> int:
2598
2598
  return 0
2599
2599
 
2600
2600
 
2601
+ def validate_chat_role_rename_scenario() -> int:
2602
+ """Issue #376: a renamed role kept nothing but its worktree binding.
2603
+
2604
+ kaiwu-ip renamed nine roles on 2026-10-19 with `role --set <new>`; the old
2605
+ name stayed a member of every direct group, kept the cursors, the shift
2606
+ note and the patrol state, and could not become an alias. `keel chat role
2607
+ --rename <old> <new>` reads the log through the rename and moves the state.
2608
+ """
2609
+ label = "chat-role-rename:"
2610
+ with tempfile.TemporaryDirectory(prefix="keel-rename-376-") as raw:
2611
+ base = Path(raw)
2612
+ rtl, verify, env, _ = shift_scratch(base / "one")
2613
+ run_keel(rtl, "chat", "dm", "verify", "hello there", env=env)
2614
+ run_keel(rtl, "chat", "todo", "soc", "--assignee", "verify", "fix the lint", env=env)
2615
+ run_keel(verify, "chat", "read", env=env)
2616
+ readied = run_keel(verify, "shift", "ready", "--force-reason", "test", "half way through the lint", env=env)
2617
+ if readied.returncode != 0:
2618
+ report(f"{label} shift ready failed: {readied.stdout!r} {readied.stderr!r}")
2619
+ return 1
2620
+ write_text(verify / "keel/config.yaml", "patrol:\n role: verify\n every: 30m\n")
2621
+ for args, why, needle in ((("nobody", "check"), "an unknown role", "no role nobody"),
2622
+ (("verify", "verify"), "a rename onto itself", "itself"),
2623
+ (("verify", "rtl"), "a rename onto a role bound elsewhere", "both bound")):
2624
+ refused = run_keel(verify, "chat", "role", "--rename", *args, env=env)
2625
+ if refused.returncode == 0:
2626
+ report(f"{label} {why} was accepted: {refused.stdout!r}")
2627
+ return 1
2628
+ if needle not in refused.stderr:
2629
+ report(f"{label} {why} was not refused for that reason: {refused.stderr!r}")
2630
+ return 1
2631
+ renamed = run_keel(verify, "chat", "role", "--rename", "verify", "check", env=env)
2632
+ if renamed.returncode != 0:
2633
+ report(f"{label} keel chat role --rename was refused: {renamed.stdout!r} {renamed.stderr!r}")
2634
+ return 1
2635
+ if "role: verify" not in renamed.stdout:
2636
+ report(f"{label} the rename does not list keel/config.yaml's patrol line: {renamed.stdout!r}")
2637
+ return 1
2638
+ groups = json.loads(run_keel(verify, "chat", "group", "list", "--json", env=env).stdout)["groups"]
2639
+ for name in ("soc", "dm-rtl--verify"):
2640
+ members = next((g["members"] for g in groups if g["name"] == name), [])
2641
+ if "check" not in members:
2642
+ report(f"{label} check is not a member of {name}: {groups!r}")
2643
+ return 1
2644
+ todos = json.loads(run_keel(verify, "chat", "todos", "--mine", "--json", env=env).stdout)["todos"]
2645
+ if not any("fix the lint" in t.get("text", "") for t in todos):
2646
+ report(f"{label} check does not hold verify's todo: {todos!r}")
2647
+ return 1
2648
+ unread = json.loads(run_keel(verify, "chat", "unread", "--json", env=env).stdout)
2649
+ if "hello there" in json.dumps(unread):
2650
+ report(f"{label} a record verify had read is unread again: {unread!r}")
2651
+ return 1
2652
+ status = json.loads(run_keel(verify, "shift", "status", "--json", env=env).stdout)
2653
+ if not any(r.get("role") == "check" and r.get("note") for r in status.get("roles", [])):
2654
+ report(f"{label} shift status shows no note under check: {status!r}")
2655
+ return 1
2656
+ posted = run_keel(rtl, "chat", "post", "soc", "@verify please look", "--json", env=env)
2657
+ if posted.returncode != 0:
2658
+ report(f"{label} @verify was refused: {posted.stderr!r}")
2659
+ return 1
2660
+ if "check" not in json.loads(posted.stdout).get("mentions", []):
2661
+ report(f"{label} @verify does not mention check: {posted.stdout!r}")
2662
+ return 1
2663
+ if run_keel(verify, "chat", "notice", "--check", env=env).returncode != 0:
2664
+ report(f"{label} @verify does not wake check")
2665
+ return 1
2666
+ rebound = run_keel(rtl, "chat", "role", "--set", "verify", env=env)
2667
+ if rebound.returncode == 0:
2668
+ report(f"{label} binding the old name was accepted: {rebound.stdout!r}")
2669
+ return 1
2670
+ if "check" not in rebound.stderr:
2671
+ report(f"{label} binding the old name was refused without naming check: {rebound.stderr!r}")
2672
+ return 1
2673
+
2674
+ rtl2, verify2, env2, _ = shift_scratch(base / "two")
2675
+ run_keel(rtl2, "chat", "post", "soc", "first", env=env2)
2676
+ run_keel(verify2, "chat", "read", env=env2)
2677
+ run_keel(rtl2, "chat", "group", "add", "soc", "check", env=env2)
2678
+ run_keel(rtl2, "chat", "post", "soc", "second", env=env2)
2679
+ run_keel(verify2, "chat", "role", "--set", "check", env=env2)
2680
+ run_keel(verify2, "chat", "read", env=env2)
2681
+ merged = run_keel(verify2, "chat", "role", "--rename", "verify", "check", env=env2)
2682
+ if merged.returncode != 0:
2683
+ report(f"{label} keel chat role --rename was refused onto an existing role: {merged.stdout!r} {merged.stderr!r}")
2684
+ return 1
2685
+ left = json.loads(run_keel(verify2, "chat", "unread", "--json", env=env2).stdout)
2686
+ if "second" in json.dumps(left):
2687
+ report(f"{label} check's later cursor was not kept: {left!r}")
2688
+ return 1
2689
+ alias = run_keel(rtl2, "chat", "role", "--alias", "verify", env=env2)
2690
+ if alias.returncode == 0:
2691
+ report(f"{label} --alias verify was accepted: {alias.stdout!r}")
2692
+ return 1
2693
+ if "check" not in alias.stderr:
2694
+ report(f"{label} --alias verify was refused without naming check: {alias.stderr!r}")
2695
+ return 1
2696
+ if "chat-role-rename" not in {name for name, _ in SCENARIOS}:
2697
+ report(f"{label} scenario is not registered.")
2698
+ return 1
2699
+ report("chat-role-rename scenario passed.")
2700
+ return 0
2701
+
2702
+
2703
+ def validate_two_live_sessions_on_one_role_scenario() -> int:
2704
+ """Issue #369 point 4: two live sessions bound to one role are reported.
2705
+
2706
+ On 2026-10-18 a desktop PM session and its CLI copy both ran as `iecc-pm`
2707
+ in one worktree: both posted under the one name and shared one read
2708
+ cursor, and neither knew. Each session now records itself under the role;
2709
+ with two live ones `keel context`, `keel chat post` and `keel chat unread`
2710
+ say so, and the warning goes once one has ended.
2711
+ """
2712
+ label = "two-live-sessions-on-one-role:"
2713
+ with tempfile.TemporaryDirectory(prefix="keel-twins-369-") as raw:
2714
+ base = Path(raw)
2715
+ rtl, verify, env, _ = shift_scratch(base)
2716
+ write_text(verify / "openspec/specs/.keep", "")
2717
+ other = subprocess.Popen(["sleep", "300"])
2718
+ try:
2719
+ def as_session(sid: str, pid: int) -> dict:
2720
+ return {**env, "CLAUDE_CODE_ENTRYPOINT": "cli", "CLAUDE_CODE_SESSION_ID": sid, "CLAUDE_PID": str(pid)}
2721
+
2722
+ def start(sid: str, pid: int) -> None:
2723
+ subprocess.run(["node", str(ROOT / "bin" / "keel.js"), "chat", "hook", "session-start"], cwd=verify,
2724
+ env=as_session(sid, pid), text=True, capture_output=True, check=False,
2725
+ input=json.dumps({"cwd": str(verify), "hook_event_name": "SessionStart", "session_id": sid, "source": "startup"}))
2726
+
2727
+ start("sess-a", os.getpid())
2728
+ alone = json.loads(run_keel(verify, "context", "--json", env=as_session("sess-a", os.getpid())).stdout)
2729
+ if any("live sessions" in w for w in alone.get("warnings", [])):
2730
+ report(f"{label} one session was reported as two: {alone.get('warnings')!r}")
2731
+ return 1
2732
+ start("sess-b", other.pid)
2733
+ context = json.loads(run_keel(verify, "context", "--json", env=as_session("sess-a", os.getpid())).stdout)
2734
+ warning = next((w for w in context.get("warnings", []) if "live sessions" in w), "")
2735
+ for needle in ("verify", "sess-a", "sess-b", "read cursor"):
2736
+ if needle not in warning:
2737
+ report(f"{label} keel context's warning does not name {needle!r}: {context.get('warnings')!r}")
2738
+ return 1
2739
+ posted = run_keel(verify, "chat", "post", "soc", "hello", env=as_session("sess-a", os.getpid()))
2740
+ if "live sessions" not in posted.stderr:
2741
+ report(f"{label} keel chat post does not warn: {posted.stdout!r} {posted.stderr!r}")
2742
+ return 1
2743
+ read = run_keel(verify, "chat", "unread", "--json", env=as_session("sess-a", os.getpid()))
2744
+ if "live sessions" not in read.stderr:
2745
+ report(f"{label} keel chat unread does not warn: {read.stderr!r}")
2746
+ return 1
2747
+ json.loads(read.stdout)
2748
+ other.kill()
2749
+ other.wait()
2750
+ after = json.loads(run_keel(verify, "context", "--json", env=as_session("sess-a", os.getpid())).stdout)
2751
+ if any("live sessions" in w for w in after.get("warnings", [])):
2752
+ report(f"{label} the warning stayed after one session ended: {after.get('warnings')!r}")
2753
+ return 1
2754
+ finally:
2755
+ if other.poll() is None:
2756
+ other.kill()
2757
+ if "two-live-sessions-on-one-role" not in {name for name, _ in SCENARIOS}:
2758
+ report(f"{label} scenario is not registered.")
2759
+ return 1
2760
+ report("two-live-sessions-on-one-role scenario passed.")
2761
+ return 0
2762
+
2763
+
2601
2764
  def validate_chat_supersedes_scenario() -> int:
2602
2765
  """Issue #252: a record supersedes its author's earlier one.
2603
2766
 
@@ -42442,6 +42605,8 @@ SCENARIOS: tuple = (
42442
42605
  ("resource-lock", validate_resource_lock_scenario),
42443
42606
  ("chat-supersedes", validate_chat_supersedes_scenario),
42444
42607
  ("chat-mention-skips-code", validate_chat_mention_skips_code_scenario),
42608
+ ("two-live-sessions-on-one-role", validate_two_live_sessions_on_one_role_scenario),
42609
+ ("chat-role-rename", validate_chat_role_rename_scenario),
42445
42610
  ("chat-wake-now-cli", validate_chat_wake_now_cli_scenario),
42446
42611
  ("chat-ack", validate_chat_ack_scenario),
42447
42612
  ("coordinator-patrol", validate_coordinator_patrol_scenario),
@@ -17,6 +17,7 @@ const { ChatError } = store;
17
17
  const USAGE = [
18
18
  "keel chat role [--set <name>] [--alias <alias>] [--prune] [--json] (--prune: drop bindings to removed worktrees)",
19
19
  "keel chat role --park <role> [--reason <text>] | --unpark <role> (a role parked on purpose is not nudged or reported by the patrol)",
20
+ "keel chat role --rename <old> <new> [--json] (the chat reads <old> as <new>; bindings and per-role state move to <new>)",
20
21
  "keel chat group create <group> [--member <role>]...",
21
22
  "keel chat group add|remove <group> <role> [--listen] (--listen: receives the group, may ack and close its todos, does not post)",
22
23
  "keel chat group archive <group>",
@@ -59,6 +60,7 @@ const USAGE = [
59
60
  const VALUED = {
60
61
  "--set": "set",
61
62
  "--alias": "alias",
63
+ "--rename": "rename",
62
64
  "--park": "park",
63
65
  "--unpark": "unpark",
64
66
  "--reason": "reason",
@@ -366,6 +368,14 @@ function dispatch(where, options) {
366
368
  else out(pruned.length ? pruned.map((entry) => `Pruned ${entry.role} from ${entry.worktree}.`).join("\n") : "No binding points at a removed worktree.");
367
369
  return 0;
368
370
  }
371
+ if (options.rename !== null && options.rename !== undefined) {
372
+ // `--rename <old> <new>` (#376 D7).
373
+ if (!rest[0]) throw new ChatError("keel chat role --rename needs the old and the new name: --rename <old> <new>.");
374
+ const rename = require("./rename");
375
+ const result = rename.rename(where, store.currentRole(where), String(options.rename).toLowerCase(), String(rest[0]).toLowerCase());
376
+ out(options.json ? JSON.stringify(result) : rename.render(result));
377
+ return 0;
378
+ }
369
379
  let role = store.currentRole(where);
370
380
  if (options.set !== null) role = store.setRole(where, options.set);
371
381
  if (options.alias !== null) {
@@ -738,6 +748,11 @@ function runChat(argv) {
738
748
  migrateIfNeeded(where);
739
749
  const role = store.currentRole(where);
740
750
  if (role) notice.touchPresence(where, role);
751
+ // Two live sessions on one role share its name and cursor (#369 D3).
752
+ if (role && ["post", "dm", "todo", "unread", "read"].includes(options.positionals[0])) {
753
+ const twins = notice.twinWarning(where, role);
754
+ if (twins) process.stderr.write(`keel chat: ${twins}\n`);
755
+ }
741
756
  return dispatch(where, options);
742
757
  } catch (error) {
743
758
  if (!(error instanceof ChatError)) throw error;
@@ -104,11 +104,65 @@ function touchPresence(where, role, state = "online", host = null, started = nul
104
104
  };
105
105
  try {
106
106
  store.writeJsonAtomic(where, presenceFile(where, role), record);
107
+ touchSession(where, role, state);
107
108
  } catch {
108
109
  // Presence is a convenience: failing to record it must not fail a command.
109
110
  }
110
111
  }
111
112
 
113
+ // --- one role, several sessions (#369 point 4) ------------------------------------
114
+
115
+ function sessionsFile(where, role) {
116
+ return path.join(where.root, "presence", `${role}.sessions.json`);
117
+ }
118
+
119
+ function thisSession() {
120
+ if (process.env.CLAUDE_CODE_ENTRYPOINT === "claude-desktop" && process.env.CLAUDE_CODE_HOST_SESSION_ID) {
121
+ return { id: process.env.CLAUDE_CODE_HOST_SESSION_ID, pid: require("../shift").desktopProcess(), host: "claude-desktop" };
122
+ }
123
+ if (process.env.CLAUDE_CODE_SESSION_ID) {
124
+ const pid = Number(process.env.CLAUDE_PID);
125
+ return { id: process.env.CLAUDE_CODE_SESSION_ID, pid: Number.isInteger(pid) && pid > 1 ? pid : null, host: "claude-code" };
126
+ }
127
+ return null;
128
+ }
129
+
130
+ const SESSION_STALE_MS = 24 * 60 * 60 * 1000;
131
+ const SESSION_RECENT_MS = 30 * 60 * 1000;
132
+
133
+ function sessionLive(entry, now) {
134
+ const pid = Number(entry.pid);
135
+ if (Number.isInteger(pid) && pid > 1) return running(pid);
136
+ return now - Date.parse(entry.last_active || "") < SESSION_RECENT_MS;
137
+ }
138
+
139
+ // Each session records itself, so two on one role are visible (D1); an
140
+ // ended or stale one is dropped.
141
+ function touchSession(where, role, state) {
142
+ const self = thisSession();
143
+ const file = sessionsFile(where, role);
144
+ const sessions = store.readJsonFile(file);
145
+ const now = Date.now();
146
+ for (const [id, entry] of Object.entries(sessions)) {
147
+ const pid = Number(entry.pid);
148
+ const ended = Number.isInteger(pid) && pid > 1 && !running(pid);
149
+ if (ended || now - Date.parse(entry.last_active || "") > SESSION_STALE_MS) delete sessions[id];
150
+ }
151
+ if (self && state === "offline") delete sessions[self.id];
152
+ else if (self) sessions[self.id] = { pid: self.pid, worktree: where.worktree, host: self.host, last_active: store.isoLocal(new Date()) };
153
+ if (!self && !Object.keys(sessions).length && !fs.existsSync(file)) return;
154
+ store.writeJsonAtomic(where, file, sessions);
155
+ }
156
+
157
+ // The warning for two or more live sessions on a role (D3), or null.
158
+ function twinWarning(where, role, now = Date.now()) {
159
+ const live = Object.entries(store.readJsonFile(sessionsFile(where, role))).filter(([, entry]) => sessionLive(entry, now));
160
+ if (live.length < 2) return null;
161
+ const named = live.map(([id, entry]) => `${id} (pid ${entry.pid || "unknown"}, ${entry.worktree || "unknown worktree"})`).join(", ");
162
+ return `${live.length} live sessions are bound to role ${role}: ${named}. They post under one name and share one read cursor, `
163
+ + "so one can hide unread records from the other; stop one, or bind it to another role with `keel chat role --set`.";
164
+ }
165
+
112
166
  function desktopFields() {
113
167
  const id = process.env.CLAUDE_CODE_HOST_SESSION_ID;
114
168
  if (process.env.CLAUDE_CODE_ENTRYPOINT !== "claude-desktop" || !id) return { desktop_session: null, desktop_pid: null };
@@ -552,6 +606,7 @@ module.exports = {
552
606
  unpark,
553
607
  wakeStep,
554
608
  resumeCli,
609
+ twinWarning,
555
610
  check,
556
611
  bridgeLine,
557
612
  keptFile,
@@ -0,0 +1,202 @@
1
+ "use strict";
2
+
3
+ // `keel chat role --rename <old> <new>` (#376). The log is never rewritten:
4
+ // `renames.json` records the identity and the store reads every role field
5
+ // through it (D1, D2). What moves is the per-role state outside the log (D5).
6
+ const fs = require("fs");
7
+ const path = require("path");
8
+ const store = require("./store");
9
+
10
+ const { ChatError } = store;
11
+
12
+ function exists(file) {
13
+ try {
14
+ fs.statSync(file);
15
+ return true;
16
+ } catch {
17
+ return false;
18
+ }
19
+ }
20
+
21
+ function list(dir) {
22
+ try {
23
+ return fs.readdirSync(dir).sort();
24
+ } catch {
25
+ return [];
26
+ }
27
+ }
28
+
29
+ // Whether the store knows `role` at all: bound, a member file, a member of
30
+ // some group, or state of its own.
31
+ function known(where, role) {
32
+ if (store.knownRoles(where).has(role)) return true;
33
+ return ["cursors", "presence", "parked", "shift"].some((dir) => list(path.join(where.root, dir))
34
+ .some((name) => name === role || name.startsWith(`${role}.`)));
35
+ }
36
+
37
+ function check(where, actor, old, name) {
38
+ store.checkName(old, "Role");
39
+ store.checkName(name, "Role");
40
+ if (name === "keel" || old === "keel") throw new ChatError("Role name keel is reserved for Keel's own system records.");
41
+ if (old === name) throw new ChatError(`Role ${old} cannot be renamed to itself.`);
42
+ const renames = store.readRenames(where.root);
43
+ if (renames[old]) throw new ChatError(`Role ${old} was already renamed to ${store.canonicalRole(where.root, old)}.`);
44
+ if (store.canonicalRole(where.root, name) !== name) {
45
+ throw new ChatError(`Role ${name} is a former name of ${store.canonicalRole(where.root, name)}; rename to that role instead.`);
46
+ }
47
+ if (!known(where, old)) throw new ChatError(`There is no role ${old} in this repository's chat.`);
48
+ if (![old, name, store.OWNER].includes(actor)) {
49
+ throw new ChatError(`Only a worktree bound to ${old} or ${name}, or the owner (KEEL_CHAT_ROLE=owner), can rename ${old}.`);
50
+ }
51
+ const bound = Object.values(store.readRoles(where.root));
52
+ if (bound.includes(old) && bound.includes(name)) {
53
+ throw new ChatError(`Roles ${old} and ${name} are both bound to worktrees, so a rename would merge two live roles; `
54
+ + `rebind one of the worktrees with \`keel chat role --set\` first.`);
55
+ }
56
+ }
57
+
58
+ function rename(where, actor, old, name) {
59
+ check(where, actor, old, name);
60
+ const root = where.root;
61
+ const moved = [];
62
+ const kept = [];
63
+
64
+ const renames = store.readRenames(root);
65
+ for (const [from, to] of Object.entries(renames)) if (to === old) renames[from] = name;
66
+ renames[old] = name;
67
+ store.writeJsonAtomic(where, path.join(root, "renames.json"), renames);
68
+
69
+ const roles = store.readRoles(root);
70
+ for (const [worktree, role] of Object.entries(roles)) {
71
+ if (role !== old) continue;
72
+ roles[worktree] = name;
73
+ moved.push(`binding of ${worktree}`);
74
+ }
75
+ store.writeJsonAtomic(where, path.join(root, "roles.json"), roles);
76
+
77
+ // Aliases join the new role's (D5).
78
+ const former = store.readMember(root, old).aliases;
79
+ if (exists(path.join(root, "members", `${old}.json`))) {
80
+ const member = store.readMember(root, name);
81
+ for (const alias of former) if (!member.aliases.includes(alias) && alias !== name) member.aliases.push(alias);
82
+ store.writeJsonAtomic(where, path.join(root, "members", `${name}.json`), member);
83
+ fs.rmSync(path.join(root, "members", `${old}.json`), { force: true });
84
+ moved.push(`members/${old}.json`);
85
+ }
86
+
87
+ const moveFile = (from, to, edit = null) => {
88
+ const source = path.join(root, from);
89
+ if (!exists(source)) return;
90
+ if (exists(path.join(root, to))) {
91
+ kept.push(`${to} (${from} left in place)`);
92
+ return;
93
+ }
94
+ fs.mkdirSync(path.dirname(path.join(root, to)), { recursive: true });
95
+ if (edit) {
96
+ store.writeJsonAtomic(where, path.join(root, to), edit(store.readJsonFile(source)));
97
+ fs.rmSync(source, { force: true });
98
+ } else {
99
+ fs.renameSync(source, path.join(root, to));
100
+ }
101
+ moved.push(from);
102
+ };
103
+ const withRole = (value) => (value && typeof value === "object" && value.role ? { ...value, role: name } : value);
104
+
105
+ // Cursors: the later id per group wins.
106
+ for (const group of list(path.join(root, "cursors", old))) {
107
+ const mine = store.readCursor(where, old, group);
108
+ if (mine) store.advanceCursor(where, name, group, mine);
109
+ moved.push(`cursors/${old}/${group}`);
110
+ }
111
+ fs.rmSync(path.join(root, "cursors", old), { recursive: true, force: true });
112
+
113
+ moveFile(`presence/${old}.json`, `presence/${name}.json`);
114
+ moveFile(`presence/${old}.sessions.json`, `presence/${name}.sessions.json`);
115
+ moveFile(`parked/${old}.json`, `parked/${name}.json`, withRole);
116
+ moveFile(`shift/${old}.md`, `shift/${name}.md`);
117
+ moveFile(`shift/queue/${old}.json`, `shift/queue/${name}.json`, withRole);
118
+ moveFile(`patrol/${old}.json`, `patrol/${name}.json`);
119
+ for (const file of list(path.join(root, "shift", "history"))) {
120
+ if (file.startsWith(`${old}-`) && /^\d/.test(file.slice(old.length + 1))) {
121
+ moveFile(`shift/history/${file}`, `shift/history/${name}-${file.slice(old.length + 1)}`);
122
+ }
123
+ }
124
+ for (const file of list(path.join(root, "shift", "transcripts", old))) {
125
+ moveFile(`shift/transcripts/${old}/${file}`, `shift/transcripts/${name}/${file}`);
126
+ }
127
+ if (!list(path.join(root, "shift", "transcripts", old)).length) fs.rmSync(path.join(root, "shift", "transcripts", old), { recursive: true, force: true });
128
+
129
+ // Segments concatenate, in start order.
130
+ const segmentsOf = (role) => {
131
+ const value = store.readJsonFile(path.join(root, "shift", "segments", `${role}.json`));
132
+ return Array.isArray(value.segments) ? value.segments : null;
133
+ };
134
+ const oldSegments = segmentsOf(old);
135
+ if (oldSegments) {
136
+ const segments = [...(segmentsOf(name) || []), ...oldSegments].sort((a, b) => String(a.started).localeCompare(String(b.started)));
137
+ store.writeJsonAtomic(where, path.join(root, "shift", "segments", `${name}.json`), { segments });
138
+ fs.rmSync(path.join(root, "shift", "segments", `${old}.json`), { force: true });
139
+ moved.push(`shift/segments/${old}.json`);
140
+ }
141
+
142
+ // The patrol log is appended to the new role's.
143
+ const log = path.join(root, "patrol", "log", `${old}.log`);
144
+ if (exists(log)) {
145
+ fs.appendFileSync(path.join(root, "patrol", "log", `${name}.log`), fs.readFileSync(log));
146
+ fs.rmSync(log, { force: true });
147
+ moved.push(`patrol/log/${old}.log`);
148
+ }
149
+ const nudgesFile = path.join(root, "patrol", "nudges.json");
150
+ const nudges = store.readJsonFile(nudgesFile);
151
+ if (nudges && nudges[old]) {
152
+ if (nudges[name]) kept.push(`patrol/nudges.json ${name} (${old}'s entry dropped)`);
153
+ else {
154
+ nudges[name] = nudges[old];
155
+ moved.push(`patrol/nudges.json ${old}`);
156
+ }
157
+ delete nudges[old];
158
+ store.writeJsonAtomic(where, nudgesFile, nudges);
159
+ }
160
+
161
+ // What describes the old session only is dropped.
162
+ fs.rmSync(path.join(root, "signal", old), { force: true });
163
+ const tickFile = path.join(root, "tick", "state.json");
164
+ const tick = store.readJsonFile(tickFile);
165
+ if (tick && tick.woken && tick.woken[old]) {
166
+ delete tick.woken[old];
167
+ store.writeJsonAtomic(where, tickFile, tick);
168
+ }
169
+
170
+ return { old, role: name, moved, kept, mentions: mentionsOf(where.worktree, old) };
171
+ }
172
+
173
+ // Lines of the files Keel reads but does not own that still name `old` (D6).
174
+ function mentionsOf(worktree, old) {
175
+ const word = new RegExp(`(^|[^a-z0-9-])${old}($|[^a-z0-9-])`);
176
+ const found = [];
177
+ for (const relative of ["keel/config.yaml", "keel/chat.json"]) {
178
+ let text = "";
179
+ try {
180
+ text = fs.readFileSync(path.join(worktree, relative), "utf8");
181
+ } catch {
182
+ continue;
183
+ }
184
+ text.split(/\r?\n/).forEach((line, index) => {
185
+ if (word.test(line)) found.push({ file: relative, line: index + 1, text: line.trim() });
186
+ });
187
+ }
188
+ return found;
189
+ }
190
+
191
+ function render(result) {
192
+ const lines = [`Renamed role ${result.old} to ${result.role}: the chat now reads ${result.old} as ${result.role}, and @${result.old} mentions it.`];
193
+ if (result.moved.length) lines.push(`Moved to ${result.role}: ${result.moved.join(", ")}.`);
194
+ if (result.kept.length) lines.push(`Kept ${result.role}'s own: ${result.kept.join(", ")}.`);
195
+ if (result.mentions.length) {
196
+ lines.push(`Still naming ${result.old}; Keel does not edit these, so update them by hand:`);
197
+ for (const m of result.mentions) lines.push(` ${m.file}:${m.line}: ${m.text}`);
198
+ }
199
+ return lines.join("\n");
200
+ }
201
+
202
+ module.exports = { rename, render };
@@ -129,11 +129,11 @@ function currentRole(where) {
129
129
  const override = (process.env[variable] || "").trim();
130
130
  if (override) {
131
131
  checkName(override, variable);
132
- return override;
132
+ return canonicalRole(where.root, override);
133
133
  }
134
134
  }
135
135
  const bound = readRoles(where.root)[where.worktree];
136
- return validName(bound) ? bound : null;
136
+ return validName(bound) ? canonicalRole(where.root, bound) : null;
137
137
  }
138
138
 
139
139
  function requireRole(where) {
@@ -155,6 +155,8 @@ function setRole(where, name) {
155
155
  checkName(name, "Role");
156
156
  // `keel` signs the loop guard's system records, so no member may take it.
157
157
  if (name === "keel") throw new ChatError("Role name keel is reserved for Keel's own system records.");
158
+ const renamed = canonicalRole(where.root, name);
159
+ if (renamed !== name) throw new ChatError(`Role ${name} was renamed to ${renamed}; bind ${renamed} instead.`);
158
160
  const roles = readRoles(where.root);
159
161
  roles[where.worktree] = name;
160
162
  writeRoles(where, roles);
@@ -188,9 +190,39 @@ function aliasMap(root) {
188
190
  for (const role of listMemberRoles(root)) {
189
191
  for (const alias of readMember(root, role).aliases) map[alias] = role;
190
192
  }
193
+ // A former name addresses its role (#376 D3).
194
+ for (const former of Object.keys(readRenames(root))) map[former] = canonicalRole(root, former);
191
195
  return map;
192
196
  }
193
197
 
198
+ // --- renamed roles (#376) -------------------------------------------------------
199
+
200
+ // `{ "<old>": "<new>" }`: an identity record, never a rewrite of the log (D1).
201
+ function readRenames(root) {
202
+ const parsed = readJson(path.join(root, "renames.json"), {});
203
+ return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
204
+ }
205
+
206
+ // A name's current role, through chains of renames.
207
+ function canonicalRole(root, name, renames = readRenames(root)) {
208
+ let role = name;
209
+ for (let hops = 0; hops < 32 && validName(renames[role]); hops += 1) role = renames[role];
210
+ return role;
211
+ }
212
+
213
+ // Every role field a record carries, read through the renames (D2); a direct
214
+ // group's members come from its name, so they are given as `direct`.
215
+ function mapRecord(record, renames) {
216
+ if (!record || !Object.keys(renames).length) return record;
217
+ const map = (name) => (validName(name) ? canonicalRole(null, name, renames) : name);
218
+ record.from = map(record.from);
219
+ if (record.assignee) record.assignee = map(record.assignee);
220
+ if (Array.isArray(record.mentions)) record.mentions = [...new Set(record.mentions.map(map))];
221
+ if ((record.kind === "join" || record.kind === "leave") && record.target) record.target = map(record.target);
222
+ if (record.group && isDirect(record.group)) record.direct = [...new Set(directMembers(record.group).map(map))];
223
+ return record;
224
+ }
225
+
194
226
  function addAlias(where, role, rawAlias) {
195
227
  const alias = String(rawAlias || "").toLowerCase();
196
228
  checkName(alias, "Alias");
@@ -322,6 +354,7 @@ function readLog(where, group) {
322
354
  return [];
323
355
  }
324
356
  const records = [];
357
+ const renames = readRenames(where.root);
325
358
  for (const name of names) {
326
359
  let parsed = null;
327
360
  try {
@@ -329,7 +362,7 @@ function readLog(where, group) {
329
362
  } catch {
330
363
  continue;
331
364
  }
332
- if (parsed && parsed.id === name.slice(0, -3)) records.push(parsed);
365
+ if (parsed && parsed.id === name.slice(0, -3)) records.push(mapRecord(parsed, renames));
333
366
  }
334
367
  return records;
335
368
  }
@@ -348,7 +381,7 @@ function writeRecord(where, fields, date = new Date()) {
348
381
  // Each worktree bound to a woken role gets its own signal too, which a
349
382
  // session watches from its start whether or not a role was bound yet
350
383
  // (chat-wake-late-binding D2).
351
- const targets = signalTargets(record);
384
+ const targets = signalTargets(mapRecord({ ...record, mentions: [...(record.mentions || [])] }, readRenames(where.root)));
352
385
  const bound = targets.length ? readRoles(where.root) : {};
353
386
  for (const role of targets) {
354
387
  const signals = [path.join(where.root, "signal", role)];
@@ -392,7 +425,7 @@ function wakes(record, role) {
392
425
  if (!READABLE_KINDS.has(record.kind) || record.from === role) return false;
393
426
  if ((record.mentions || []).includes(role)) return true;
394
427
  if (record.kind === "todo" && record.assignee === role) return true;
395
- return directMembers(record.group).includes(role);
428
+ return (record.direct || directMembers(record.group)).includes(role);
396
429
  }
397
430
 
398
431
  function signalTargets(record) {
@@ -400,7 +433,7 @@ function signalTargets(record) {
400
433
  const roles = new Set([
401
434
  ...(record.mentions || []),
402
435
  ...(record.kind === "todo" && record.assignee ? [record.assignee] : []),
403
- ...directMembers(record.group),
436
+ ...(record.direct || directMembers(record.group)),
404
437
  ]);
405
438
  return [...roles].filter((role) => validName(role) && wakes(record, role));
406
439
  }
@@ -489,6 +522,7 @@ function createGroup(where, actor, group, members, { direct = false } = {}) {
489
522
 
490
523
  function changeMember(where, actor, group, member, kind, { listen = false } = {}) {
491
524
  checkName(member, "Member");
525
+ member = canonicalRole(where.root, member);
492
526
  if (isDirect(group)) {
493
527
  throw new ChatError(`Direct group ${group} has fixed members.`);
494
528
  }
@@ -567,7 +601,7 @@ function findRecord(where, id) {
567
601
  const file = path.join(groupDir(where, group), "log", `${id}.md`);
568
602
  if (!fs.existsSync(file)) continue;
569
603
  const record = parseRecord(fs.readFileSync(file, "utf8"));
570
- if (record) return record;
604
+ if (record) return mapRecord(record, readRenames(where.root));
571
605
  }
572
606
  return null;
573
607
  }
@@ -734,6 +768,7 @@ function normalizeIssue(issue) {
734
768
 
735
769
  function todo(where, options) {
736
770
  checkName(options.assignee, "Assignee");
771
+ options = { ...options, assignee: canonicalRole(where.root, options.assignee) };
737
772
  const { state } = loadGroup(where, options.group);
738
773
  if (!canAct(state, options.assignee)) {
739
774
  throw new ChatError(`Assignee ${options.assignee} is not a member of group ${options.group}.`);
@@ -815,6 +850,7 @@ function search(where, text, { group = null } = {}) {
815
850
  function directPost(where, target, text, extra = {}) {
816
851
  const from = requireRole(where);
817
852
  checkName(target, "Recipient");
853
+ target = canonicalRole(where.root, target);
818
854
  if (target === from) throw new ChatError("A direct group needs two different roles.");
819
855
  const group = directName(from, target);
820
856
  if (!groupState(readLog(where, group)).exists) {
@@ -998,6 +1034,10 @@ function readGroups(where, role, group) {
998
1034
  }
999
1035
 
1000
1036
  module.exports = {
1037
+ readRenames,
1038
+ readRoles,
1039
+ knownRoles,
1040
+ canonicalRole,
1001
1041
  wait,
1002
1042
  mentionText,
1003
1043
  openWaits,
@@ -871,6 +871,12 @@ function resolveContext(repo, options) {
871
871
  context.ownerLanguage = language.tag;
872
872
  context.ownerLanguageRule = ownerLanguageRule(language.tag);
873
873
  }
874
+ // Two live sessions on one role post as one and share a cursor (#369).
875
+ if (context.role) {
876
+ const chatWhere = require("./chat/store").locate(repo);
877
+ const twins = chatWhere ? require("./chat/notice").twinWarning(chatWhere, context.role) : null;
878
+ if (twins) context.warnings.push(twins);
879
+ }
874
880
  // The patrolling role is reminded to re-arm its schedule (#260).
875
881
  const patrol = readPatrolDeclaration(repo);
876
882
  if (patrol.message) context.warnings.push(patrol.message);