@christang/keel 5.106.0 → 5.107.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 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.107.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.107.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.107.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.107.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.107.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.107.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.107.0"
51
+ PROTOCOL_VERSION = "5.107.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
@@ -8602,6 +8602,72 @@ def validate_context_per_worktree_scenario() -> int:
8602
8602
  return 0
8603
8603
 
8604
8604
 
8605
+ def validate_session_role_identity_scenario() -> int:
8606
+ """Issue #245: the chat role is the session's identity.
8607
+
8608
+ `keel context` carries the bound role and the SessionStart projection
8609
+ names it; an unbound worktree among bound ones is reminded; a repository
8610
+ with no roles is unchanged.
8611
+ """
8612
+ label = "session-role-identity:"
8613
+ with tempfile.TemporaryDirectory(prefix="keel-role-identity-") as raw:
8614
+ base = Path(raw)
8615
+ repo = mailbox_repository(base / "repo")
8616
+ plain = mailbox_repository(base / "plain")
8617
+ # The SessionStart hook projects only where OpenSpec is present.
8618
+ for root in (repo, plain):
8619
+ write_text(root / "openspec/specs/.keep", "")
8620
+ subprocess.run(["git", "add", "-A"], cwd=root, check=True, capture_output=True)
8621
+ subprocess.run(["git", "commit", "-q", "-m", "openspec"], cwd=root, check=True, capture_output=True)
8622
+ rtl = chat_worktree(repo, base / "rtl")
8623
+ loose = chat_worktree(repo, base / "loose")
8624
+ env = chat_environment()
8625
+ run_keel(rtl, "chat", "role", "--set", "rtl", env=env)
8626
+
8627
+ def both(cwd: Path) -> tuple[dict, str]:
8628
+ context = json.loads(run_keel(cwd, "context", "--json", env=env).stdout)
8629
+ session = run_session_start_hook(
8630
+ cwd, {"hook_event_name": "SessionStart", "source": "startup", "cwd": str(cwd)},
8631
+ keel_cli=f'node "{ROOT / "bin" / "keel.js"}"',
8632
+ )
8633
+ return context, session_start_context(session) or ""
8634
+
8635
+ context, note = both(rtl)
8636
+ if context.get("role") != "rtl":
8637
+ report(f"{label} rtl's context carries role {context.get('role')!r}, not 'rtl'.")
8638
+ return 1
8639
+ if "chat role: rtl" not in note:
8640
+ report(f"{label} rtl's projection does not name its role: {note!r}")
8641
+ return 1
8642
+
8643
+ context, note = both(loose)
8644
+ if context.get("role") is not None:
8645
+ report(f"{label} the unbound worktree carries role {context.get('role')!r}.")
8646
+ return 1
8647
+ if not any("keel chat role --set" in w for w in context.get("warnings", [])):
8648
+ report(f"{label} the unbound worktree is not reminded: {context.get('warnings')!r}")
8649
+ return 1
8650
+ if "keel chat role --set" not in note:
8651
+ report(f"{label} the unbound worktree's projection carries no reminder: {note!r}")
8652
+ return 1
8653
+
8654
+ context, note = both(plain)
8655
+ if "role" not in context:
8656
+ report(f"{label} a role-less repository's context has no role field: {context}")
8657
+ return 1
8658
+ if context.get("role") is not None:
8659
+ report(f"{label} a role-less repository carries role {context.get('role')!r}.")
8660
+ return 1
8661
+ if any("keel chat role --set" in w for w in context.get("warnings", [])):
8662
+ report(f"{label} a role-less repository is warned: {context.get('warnings')!r}")
8663
+ return 1
8664
+ if "chat role:" in note:
8665
+ report(f"{label} a role-less repository's projection has a role line: {note!r}")
8666
+ return 1
8667
+ report("session-role-identity scenario passed.")
8668
+ return 0
8669
+
8670
+
8605
8671
  def validate_read_only_role_scenario() -> int:
8606
8672
  """Issue #246: a role listed in `read_only_roles:` infers nothing.
8607
8673
 
@@ -38136,6 +38202,7 @@ SCENARIOS: tuple = (
38136
38202
  ("stateless-continuity", validate_stateless_continuity_scenario),
38137
38203
  ("context-per-worktree", validate_context_per_worktree_scenario),
38138
38204
  ("read-only-role", validate_read_only_role_scenario),
38205
+ ("session-role-identity", validate_session_role_identity_scenario),
38139
38206
  ("core-gates", validate_core_gates_scenario),
38140
38207
  ("scope-rename-attribution", validate_scope_rename_attribution_scenario),
38141
38208
  ("target-capability-adapters", validate_target_capability_adapters_scenario),
@@ -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