@christang/keel 5.106.0 → 5.108.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/README.md CHANGED
@@ -756,7 +756,7 @@ Without a known default branch, no issue range is inferred.
756
756
 
757
757
  ## Group chat between sessions
758
758
 
759
- 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. 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. 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.
759
+ 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; `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. 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.
760
760
 
761
761
  ## Commands
762
762
 
@@ -1,4 +1,4 @@
1
- <!-- keel:start version=5.106.0 -->
1
+ <!-- keel:start version=5.108.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.106.0",
3
+ "version": "5.108.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@christang/keel",
9
- "version": "5.106.0",
9
+ "version": "5.108.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.106.0",
5
+ "version": "5.108.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.106.0",
3
+ "version": "5.108.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.106.0",
3
+ "version": "5.108.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",
@@ -653,6 +653,15 @@ function main() {
653
653
  lines.push(`- ${drift}`);
654
654
  human.splice(human.length - 1, 0, drift[0].toUpperCase() + drift.slice(1));
655
655
  }
656
+ // The role other sessions address this one by (#245).
657
+ if (context.role) {
658
+ lines.push(`- chat role: ${context.role} (other sessions address this one by it).`);
659
+ } else if (context.roleReminder) {
660
+ lines.push(
661
+ "- chat role: none bound here while other worktrees have one; bind one "
662
+ + "with `keel chat role --set <name>`."
663
+ );
664
+ }
656
665
  const pointer = precedentPointer(cwd);
657
666
  if (pointer) lines.push(`- ${pointer}`);
658
667
  // A note from the previous shift (shift-without-role D3), on every host.
@@ -47,8 +47,8 @@ REQUIRED_SCRIPTS = [
47
47
  "scripts/validate_plugin.py",
48
48
  ]
49
49
 
50
- PACKAGE_VERSION = "5.106.0"
51
- PROTOCOL_VERSION = "5.106.0"
50
+ PACKAGE_VERSION = "5.108.0"
51
+ PROTOCOL_VERSION = "5.108.0"
52
52
  LEGACY_MANAGED_START = "<!-- keel:start version=2.1 -->"
53
53
  OPENSPEC_SCHEMA_NAME = "keel-spec-driven"
54
54
  # Mirrors KEEL_PACKAGE_NAME in scripts/install_to_repo.py, one of the two
@@ -2521,6 +2521,63 @@ def validate_chat_supersedes_scenario() -> int:
2521
2521
  return 0
2522
2522
 
2523
2523
 
2524
+ def validate_chat_listen_only_scenario() -> int:
2525
+ """Issue #248: a listen-only member hears a group but does not post in it.
2526
+
2527
+ It has records unread and is woken like any member, may acknowledge and
2528
+ close its assigned todos, and is refused posting, opening a todo, and
2529
+ changing the group.
2530
+ """
2531
+ label = "chat-listen-only:"
2532
+ with tempfile.TemporaryDirectory(prefix="keel-chat-listen-") as raw:
2533
+ base = Path(raw)
2534
+ rtl, verify, env = chat_scratch_group(base)
2535
+ review = chat_worktree(rtl, base / "review")
2536
+
2537
+ def chat(cwd: Path, *args: str) -> subprocess.CompletedProcess[str]:
2538
+ return run_keel(cwd, "chat", *args, env=env)
2539
+
2540
+ chat(review, "role", "--set", "review")
2541
+ added = chat(rtl, "group", "add", "soc", "review", "--listen")
2542
+ if added.returncode != 0:
2543
+ report(f"{label} group add --listen failed: {added.stderr}")
2544
+ return 1
2545
+ asked = chat_json(chat(rtl, "post", "soc", "@review is clause 4 waived?", "--ack", "--json")).get("id", "")
2546
+ unread = [r.get("id") for r in chat_json(chat(review, "unread", "--json")).get("unread", [])]
2547
+ if asked not in unread:
2548
+ report(f"{label} the listen-only member does not have the mention unread: {unread!r}")
2549
+ return 1
2550
+ if chat(review, "notice", "--check").returncode != 0:
2551
+ report(f"{label} the listen-only member is not woken by a mention.")
2552
+ return 1
2553
+ todo = chat_json(chat(rtl, "todo", "soc", "--assignee", "review", "check clause 4", "--json")).get("id", "")
2554
+ for what, result in (
2555
+ ("ack", chat(review, "ack", asked)),
2556
+ ("done", chat(review, "done", todo)),
2557
+ ):
2558
+ if result.returncode != 0:
2559
+ report(f"{label} the listen-only member could not {what}: {result.stderr}")
2560
+ return 1
2561
+ for what, result in (
2562
+ ("post", chat(review, "post", "soc", "waived")),
2563
+ ("todo", chat(review, "todo", "soc", "--assignee", "rtl", "waive it")),
2564
+ ("group add", chat(review, "group", "add", "soc", "spec")),
2565
+ ("group archive", chat(review, "group", "archive", "soc")),
2566
+ ):
2567
+ if result.returncode == 0:
2568
+ report(f"{label} the listen-only member's {what} was accepted.")
2569
+ return 1
2570
+ if "listen-only" not in result.stderr:
2571
+ report(f"{label} the listen-only member's {what} was refused without naming listen-only: {result.stderr}")
2572
+ return 1
2573
+ listed = chat(rtl, "group", "list").stdout
2574
+ if "review (listen)" not in listed:
2575
+ report(f"{label} group list does not mark the listen-only member: {listed!r}")
2576
+ return 1
2577
+ report("chat-listen-only scenario passed.")
2578
+ return 0
2579
+
2580
+
2524
2581
  def validate_chat_ack_scenario() -> int:
2525
2582
  """Issue #253: a record asks for an acknowledgement and the sender sees who gave it.
2526
2583
 
@@ -8602,6 +8659,72 @@ def validate_context_per_worktree_scenario() -> int:
8602
8659
  return 0
8603
8660
 
8604
8661
 
8662
+ def validate_session_role_identity_scenario() -> int:
8663
+ """Issue #245: the chat role is the session's identity.
8664
+
8665
+ `keel context` carries the bound role and the SessionStart projection
8666
+ names it; an unbound worktree among bound ones is reminded; a repository
8667
+ with no roles is unchanged.
8668
+ """
8669
+ label = "session-role-identity:"
8670
+ with tempfile.TemporaryDirectory(prefix="keel-role-identity-") as raw:
8671
+ base = Path(raw)
8672
+ repo = mailbox_repository(base / "repo")
8673
+ plain = mailbox_repository(base / "plain")
8674
+ # The SessionStart hook projects only where OpenSpec is present.
8675
+ for root in (repo, plain):
8676
+ write_text(root / "openspec/specs/.keep", "")
8677
+ subprocess.run(["git", "add", "-A"], cwd=root, check=True, capture_output=True)
8678
+ subprocess.run(["git", "commit", "-q", "-m", "openspec"], cwd=root, check=True, capture_output=True)
8679
+ rtl = chat_worktree(repo, base / "rtl")
8680
+ loose = chat_worktree(repo, base / "loose")
8681
+ env = chat_environment()
8682
+ run_keel(rtl, "chat", "role", "--set", "rtl", env=env)
8683
+
8684
+ def both(cwd: Path) -> tuple[dict, str]:
8685
+ context = json.loads(run_keel(cwd, "context", "--json", env=env).stdout)
8686
+ session = run_session_start_hook(
8687
+ cwd, {"hook_event_name": "SessionStart", "source": "startup", "cwd": str(cwd)},
8688
+ keel_cli=f'node "{ROOT / "bin" / "keel.js"}"',
8689
+ )
8690
+ return context, session_start_context(session) or ""
8691
+
8692
+ context, note = both(rtl)
8693
+ if context.get("role") != "rtl":
8694
+ report(f"{label} rtl's context carries role {context.get('role')!r}, not 'rtl'.")
8695
+ return 1
8696
+ if "chat role: rtl" not in note:
8697
+ report(f"{label} rtl's projection does not name its role: {note!r}")
8698
+ return 1
8699
+
8700
+ context, note = both(loose)
8701
+ if context.get("role") is not None:
8702
+ report(f"{label} the unbound worktree carries role {context.get('role')!r}.")
8703
+ return 1
8704
+ if not any("keel chat role --set" in w for w in context.get("warnings", [])):
8705
+ report(f"{label} the unbound worktree is not reminded: {context.get('warnings')!r}")
8706
+ return 1
8707
+ if "keel chat role --set" not in note:
8708
+ report(f"{label} the unbound worktree's projection carries no reminder: {note!r}")
8709
+ return 1
8710
+
8711
+ context, note = both(plain)
8712
+ if "role" not in context:
8713
+ report(f"{label} a role-less repository's context has no role field: {context}")
8714
+ return 1
8715
+ if context.get("role") is not None:
8716
+ report(f"{label} a role-less repository carries role {context.get('role')!r}.")
8717
+ return 1
8718
+ if any("keel chat role --set" in w for w in context.get("warnings", [])):
8719
+ report(f"{label} a role-less repository is warned: {context.get('warnings')!r}")
8720
+ return 1
8721
+ if "chat role:" in note:
8722
+ report(f"{label} a role-less repository's projection has a role line: {note!r}")
8723
+ return 1
8724
+ report("session-role-identity scenario passed.")
8725
+ return 0
8726
+
8727
+
8605
8728
  def validate_read_only_role_scenario() -> int:
8606
8729
  """Issue #246: a role listed in `read_only_roles:` infers nothing.
8607
8730
 
@@ -38136,6 +38259,7 @@ SCENARIOS: tuple = (
38136
38259
  ("stateless-continuity", validate_stateless_continuity_scenario),
38137
38260
  ("context-per-worktree", validate_context_per_worktree_scenario),
38138
38261
  ("read-only-role", validate_read_only_role_scenario),
38262
+ ("session-role-identity", validate_session_role_identity_scenario),
38139
38263
  ("core-gates", validate_core_gates_scenario),
38140
38264
  ("scope-rename-attribution", validate_scope_rename_attribution_scenario),
38141
38265
  ("target-capability-adapters", validate_target_capability_adapters_scenario),
@@ -38519,6 +38643,7 @@ SCENARIOS: tuple = (
38519
38643
  ("resource-lock", validate_resource_lock_scenario),
38520
38644
  ("chat-supersedes", validate_chat_supersedes_scenario),
38521
38645
  ("chat-ack", validate_chat_ack_scenario),
38646
+ ("chat-listen-only", validate_chat_listen_only_scenario),
38522
38647
  ("chat-summary", validate_chat_summary_scenario),
38523
38648
  ("worktree-overview", validate_worktree_overview_scenario),
38524
38649
  ("init-never-downgrades-openspec", validate_init_never_downgrades_openspec_scenario),
@@ -17,7 +17,7 @@ const { ChatError } = store;
17
17
  const USAGE = [
18
18
  "keel chat role [--set <name>] [--alias <alias>] [--json]",
19
19
  "keel chat group create <group> [--member <role>]...",
20
- "keel chat group add|remove <group> <role>",
20
+ "keel chat group add|remove <group> <role> [--listen] (--listen: receives the group, may ack and close its todos, does not post)",
21
21
  "keel chat group archive <group>",
22
22
  "keel chat group list [--all] [--json] (also: keel chat list)",
23
23
  "keel chat post <group> <text...> [--reply-to <id>] [--supersedes <id>] [--ack] [--json] (also: keel chat <group> <text...>)",
@@ -69,10 +69,10 @@ const VALUED = {
69
69
  "--compact-at": "compactAt",
70
70
  };
71
71
  const REPEATED = { "--member": "members" };
72
- const SWITCHES = { "--json": "json", "--peek": "peek", "--all": "all", "--mine": "mine", "--follow": "follow", "--once": "once", "--mail": "mail", "--check": "check", "--ack": "ack" };
72
+ const SWITCHES = { "--json": "json", "--peek": "peek", "--all": "all", "--mine": "mine", "--follow": "follow", "--once": "once", "--mail": "mail", "--check": "check", "--ack": "ack", "--listen": "listen" };
73
73
 
74
74
  function parseChatArgs(argv) {
75
- const options = { positionals: [], members: [], json: false, peek: false, all: false, mine: false, follow: false, once: false, mail: false, check: false, ack: false };
75
+ const options = { positionals: [], members: [], json: false, peek: false, all: false, mine: false, follow: false, once: false, mail: false, check: false, ack: false, listen: false };
76
76
  for (const key of Object.values(VALUED)) options[key] = null;
77
77
  for (let index = 0; index < argv.length; index += 1) {
78
78
  const arg = argv[index];
@@ -187,7 +187,7 @@ function runGroup(where, options) {
187
187
  const groups = store.listGroups(where, { includeArchived: options.all });
188
188
  if (options.json) out(JSON.stringify({ groups }));
189
189
  else if (!groups.length) out("No groups. Create one with `keel chat group create <group>`.");
190
- else out(groups.map((g) => `${g.name}${g.archived ? " (archived)" : ""}: ${g.members.join(", ")}`).join("\n"));
190
+ else out(groups.map((g) => `${g.name}${g.archived ? " (archived)" : ""}: ${g.members.map((m) => (g.listeners.includes(m) ? `${m} (listen)` : m)).join(", ")}`).join("\n"));
191
191
  return 0;
192
192
  }
193
193
  const actor = store.requireRole(where);
@@ -201,8 +201,8 @@ function runGroup(where, options) {
201
201
  case "add":
202
202
  case "remove": {
203
203
  if (!member) throw new ChatError(`keel chat group ${action} needs a role.`);
204
- store.changeMember(where, actor, group, member, action === "add" ? "join" : "leave");
205
- out(`${action === "add" ? "Added" : "Removed"} ${member} ${action === "add" ? "to" : "from"} ${group}.`);
204
+ store.changeMember(where, actor, group, member, action === "add" ? "join" : "leave", { listen: options.listen });
205
+ out(`${action === "add" ? "Added" : "Removed"} ${member} ${action === "add" ? "to" : "from"} ${group}${action === "add" && options.listen ? " as listen-only" : ""}.`);
206
206
  return 0;
207
207
  }
208
208
  case "archive":
@@ -41,7 +41,7 @@ const READABLE_KINDS = new Set(["message", "todo", "system"]);
41
41
  const LIST_FIELDS = new Set(["mentions", "refs"]);
42
42
  const FIELD_ORDER = [
43
43
  "id", "group", "kind", "from", "created", "mentions", "reply_to", "supersedes", "ack",
44
- "assignee", "issue", "target", "refs", "origin", "slack_channel", "slack_ts",
44
+ "assignee", "issue", "target", "access", "refs", "origin", "slack_channel", "slack_ts",
45
45
  ];
46
46
 
47
47
  // A group may not take a name `keel chat <group>` would read as a subcommand.
@@ -409,13 +409,22 @@ function signalTargets(record) {
409
409
 
410
410
  function groupState(records) {
411
411
  const members = new Set();
412
+ // Listen-only members (#248): a member's latest join decides it.
413
+ const listeners = new Set();
412
414
  let archived = false;
413
415
  for (const record of records) {
414
- if (record.kind === "join" && record.target) members.add(record.target);
415
- if (record.kind === "leave" && record.target) members.delete(record.target);
416
+ if (record.kind === "join" && record.target) {
417
+ members.add(record.target);
418
+ if (record.access === "listen") listeners.add(record.target);
419
+ else listeners.delete(record.target);
420
+ }
421
+ if (record.kind === "leave" && record.target) {
422
+ members.delete(record.target);
423
+ listeners.delete(record.target);
424
+ }
416
425
  if (record.kind === "archive") archived = true;
417
426
  }
418
- return { members, archived, exists: records.length > 0 };
427
+ return { members, listeners, archived, exists: records.length > 0 };
419
428
  }
420
429
 
421
430
  function isDirect(group) {
@@ -448,6 +457,17 @@ function requireOpenMembership(group, state, role) {
448
457
  }
449
458
  }
450
459
 
460
+ // Posting and changing the group are what a listen-only member may not do
461
+ // (#248 D3); reading, acknowledging, and closing its own todos stay open.
462
+ function requireSpeaker(group, state, role) {
463
+ requireOpenMembership(group, state, role);
464
+ if (state.listeners && state.listeners.has(role)) {
465
+ throw new ChatError(
466
+ `Role ${role} is a listen-only member of group ${group}: it receives the group but does not post or change it here.`
467
+ );
468
+ }
469
+ }
470
+
451
471
  function createGroup(where, actor, group, members, { direct = false } = {}) {
452
472
  checkName(group, "Group");
453
473
  if (RESERVED_GROUPS.has(group)) {
@@ -467,25 +487,25 @@ function createGroup(where, actor, group, members, { direct = false } = {}) {
467
487
  return everyone;
468
488
  }
469
489
 
470
- function changeMember(where, actor, group, member, kind) {
490
+ function changeMember(where, actor, group, member, kind, { listen = false } = {}) {
471
491
  checkName(member, "Member");
472
492
  if (isDirect(group)) {
473
493
  throw new ChatError(`Direct group ${group} has fixed members.`);
474
494
  }
475
495
  const { state } = loadGroup(where, group);
476
- requireOpenMembership(group, state, actor);
496
+ requireSpeaker(group, state, actor);
477
497
  if (kind === "join" && state.members.has(member)) {
478
498
  throw new ChatError(`Role ${member} is already a member of group ${group}.`);
479
499
  }
480
500
  if (kind === "leave" && !state.members.has(member)) {
481
501
  throw new ChatError(`Role ${member} is not a member of group ${group}.`);
482
502
  }
483
- return writeRecord(where, { group, kind, from: actor, target: member });
503
+ return writeRecord(where, { group, kind, from: actor, target: member, access: kind === "join" && listen ? "listen" : null });
484
504
  }
485
505
 
486
506
  function archiveGroup(where, actor, group) {
487
507
  const { state } = loadGroup(where, group);
488
- requireOpenMembership(group, state, actor);
508
+ requireSpeaker(group, state, actor);
489
509
  return writeRecord(where, { group, kind: "archive", from: actor });
490
510
  }
491
511
 
@@ -495,7 +515,7 @@ function listGroups(where, { includeArchived = false } = {}) {
495
515
  const state = groupState(readLog(where, name));
496
516
  if (!state.exists) continue;
497
517
  if (state.archived && !includeArchived) continue;
498
- groups.push({ name, members: [...state.members].sort(), archived: state.archived, direct: isDirect(name) });
518
+ groups.push({ name, members: [...state.members].sort(), listeners: [...state.listeners].sort(), archived: state.archived, direct: isDirect(name) });
499
519
  }
500
520
  return groups;
501
521
  }
@@ -545,7 +565,7 @@ function post(where, options) {
545
565
  const text = String(options.text || "");
546
566
  if (!text.trim()) throw new ChatError("A post needs text: give it after the group, or on stdin.");
547
567
  const { records, state } = loadGroup(where, group);
548
- requireOpenMembership(group, state, from);
568
+ requireSpeaker(group, state, from);
549
569
  const mentions = resolveMentions(where, group, state, text);
550
570
  // Loaded here rather than at the top: the guards read the store's own API.
551
571
  require("./guards").checkPost(module.exports, where, from, group, records);
@@ -808,6 +808,30 @@ function resolveContext(repo, options) {
808
808
  : readOnlyContext(repo, readOnly) || inferContext(repo);
809
809
  }
810
810
  if (readOnly.message) context.warnings.push(readOnly.message);
811
+ // The chat role is the session's identity (#245): other sessions address it
812
+ // by role, and Keel cannot see the host's session title. A worktree with no
813
+ // role while others here have one is reminded; a repository that uses no
814
+ // roles hears nothing.
815
+ context.role = null;
816
+ try {
817
+ const store = require("./chat/store");
818
+ const where = store.locate(repo);
819
+ context.role = store.currentRole(where);
820
+ if (!context.role) {
821
+ const bound = Object.entries(store.readJsonFile(path.join(where.root, "roles.json")))
822
+ .filter(([worktree, role]) => worktree !== where.worktree && role);
823
+ if (bound.length) {
824
+ context.warnings.push(
825
+ "This worktree has no chat role while other worktrees here have one; "
826
+ + "sessions address each other by role. Bind one with "
827
+ + "`keel chat role --set <name>`."
828
+ );
829
+ context.roleReminder = true;
830
+ }
831
+ }
832
+ } catch {
833
+ context.role = null;
834
+ }
811
835
  context.warnings.push(...gitWarnings(repo));
812
836
  // A broken `authorize:` declaration is otherwise reported only by
813
837
  // `keel --doctor`, an explicitly-invoked diagnostic — surfaced here too so a