@christang/keel 5.96.0 → 5.97.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,4 +1,4 @@
1
- <!-- keel:start version=5.96.0 -->
1
+ <!-- keel:start version=5.97.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.
@@ -20,4 +20,4 @@ Prefer behavior evidence appropriate to the layer: simulation or testbench evide
20
20
 
21
21
  ## Execution and review checks
22
22
 
23
- While implementing and reviewing, prove behavior at the interface: drive reset entry and exit, valid-ready handshakes including stall and backpressure, and ordering through simulation before trusting lint; a protocol or CSR field change needs testbench evidence for both legal and illegal accesses. Watch for silent X-propagation, unregistered CDC crossings, and new reset-domain assumptions introduced by the change. In review, reject waveform screenshots without a repeatable run command, require assertion or formal evidence for invariants simulation cannot exhaustively cover, and confirm any golden trace update carries an explicit rationale tied to Acceptance.
23
+ While implementing and reviewing, prove behavior at the interface: drive reset entry and exit, valid-ready handshakes including stall and backpressure, and ordering through simulation before trusting lint; a protocol or CSR field change needs testbench evidence for both legal and illegal accesses. Watch for silent X-propagation, unregistered CDC crossings, and new reset-domain assumptions introduced by the change. Some tools silently accept a broken reference — Verilator binds an SVA to a missing signal as a dangling constant without a warning, so the assertion never fires — and a passing run proves nothing about them; such a reference needs a check of its own, such as a static name check of every bind target. In review, reject waveform screenshots without a repeatable run command, require assertion or formal evidence for invariants simulation cannot exhaustively cover, and confirm any golden trace update carries an explicit rationale tied to Acceptance.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@christang/keel",
3
- "version": "5.96.0",
3
+ "version": "5.97.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@christang/keel",
9
- "version": "5.96.0",
9
+ "version": "5.97.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.96.0",
5
+ "version": "5.97.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.96.0",
3
+ "version": "5.97.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.96.0",
3
+ "version": "5.97.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",
@@ -25,6 +25,8 @@ Read the selected task's compiled capsule: resolved Acceptance, Verify strategy
25
25
 
26
26
  Red-green strategies (`vertical-tdd`, `regression-first`) must record concrete per-label `.red` and `.green` Evidence entries for the same check; `keel gate task-complete` rejects absent or pending entries.
27
27
 
28
+ A check's `Fails with:` declares one literal its red must show. Declare one that every red of the check shares — the scenario or test label the check prints, a stable message prefix — rather than one exception type: a first red is often mixed, mostly one error with a few others, and a literal only some of them carry forces a re-record that predicts nothing new.
29
+
28
30
  A check's Evidence may read `artifact <path> sha256:<digest>` instead of retelling the output. `keel gate task-complete` checks the file exists and the digest matches, and refuses a path outside the change's own directory — archiving moves that directory, so a pointer outside it breaks. Keel hashes the bytes and reads nothing inside them: the claim the artifact supports stays yours.
29
31
 
30
32
  ## Domain lenses
@@ -47,8 +47,8 @@ REQUIRED_SCRIPTS = [
47
47
  "scripts/validate_plugin.py",
48
48
  ]
49
49
 
50
- PACKAGE_VERSION = "5.96.0"
51
- PROTOCOL_VERSION = "5.96.0"
50
+ PACKAGE_VERSION = "5.97.0"
51
+ PROTOCOL_VERSION = "5.97.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
@@ -3311,7 +3311,9 @@ def validate_chat_bridge_inbound_scenario() -> int:
3311
3311
  if " - verify" not in owner_record:
3312
3312
  report(f"{label} the owner's @verify did not become a mention:\n{owner_record}")
3313
3313
  return 1
3314
- if not signal.exists() or not signal.stat().st_size:
3314
+ # The record is written before the signal is appended (#231), so
3315
+ # wait for the signal rather than reading it once.
3316
+ if not slack.wait_for(lambda: signal.exists() and signal.stat().st_size, 5):
3315
3317
  report(f"{label} the owner's mention did not touch verify's signal file.")
3316
3318
  return 1
3317
3319
 
@@ -3706,6 +3708,73 @@ def validate_chat_role_direct_scenario() -> int:
3706
3708
  return 0
3707
3709
 
3708
3710
 
3711
+ def validate_chat_shared_app_direct_scenario() -> int:
3712
+ """Owner's decision of 2026-10-05: the shared app may serve one role.
3713
+
3714
+ Mapping the shared app's own bot user to a role in `slack.bots` makes it
3715
+ take that role's direct messages on its existing connection, without a
3716
+ second one, and post the role's answers as itself.
3717
+ """
3718
+ label = "chat-shared-app-direct:"
3719
+ if chat_bridge_node_missing("chat-shared-app-direct"):
3720
+ return 3
3721
+ FakeSlack = fake_slack_class()
3722
+ with tempfile.TemporaryDirectory(prefix="keel-chat-shared-direct-") as raw, FakeSlack() as slack:
3723
+ base = Path(raw)
3724
+ rtl, _verify, env = chat_scratch_group(base)
3725
+ chat_slack_config(rtl, {"soc": "CSOC"}, bots={"UBOT": "rtl"})
3726
+ benv = chat_bridge_environment(env, base / "home", slack)
3727
+ run_keel(rtl, "chat", "bridge", "add", env=benv)
3728
+ bridge = start_chat_bridge(rtl, benv)
3729
+ try:
3730
+ if not slack.wait_for(lambda: slack.sockets_for("xapp-test-app"), 10):
3731
+ report(f"{label} the shared app never connected: {stop_chat_bridge(bridge).strip()}")
3732
+ return 1
3733
+ slack.push(slack_event("DUOWNER", channel_type="im", user="UOWNER", text="status?", ts="1800000001.000100"), app="xapp-test-app")
3734
+ if not slack.wait_for(lambda: chat_records_with(rtl, "dm-owner--rtl", "status?")):
3735
+ report(f"{label} the owner's direct message to the shared app did not reach dm-owner--rtl.")
3736
+ return 1
3737
+ if "from: owner" not in chat_records_with(rtl, "dm-owner--rtl", "status?")[0]:
3738
+ report(f"{label} the direct message was not recorded from owner.")
3739
+ return 1
3740
+ answered = run_keel(rtl, "chat", "dm", "owner", "all green", env=benv)
3741
+ if answered.returncode != 0:
3742
+ report(f"{label} keel chat dm owner failed: {answered.stderr.strip()}")
3743
+ return 1
3744
+ if not slack.wait_for(lambda: any("all green" in m.get("text", "") for m in slack.messages.get("DUOWNER", []))):
3745
+ report(f"{label} rtl's answer never reached the owner's direct-message channel.")
3746
+ return 1
3747
+ sent = [c["params"] for c in slack.calls_to("chat.postMessage") if "all green" in c["params"].get("text", "")]
3748
+ if len(sent) != 1:
3749
+ report(f"{label} rtl's answer was posted {len(sent)} times, not once.")
3750
+ return 1
3751
+ if sent[0].get("_auth") != "Bearer xoxb-test-bot":
3752
+ report(f"{label} rtl's answer did not use the shared token: {sent[0].get('_auth')!r}")
3753
+ return 1
3754
+ if len(slack.sockets_for("xapp-test-app")) != 1:
3755
+ report(f"{label} the shared app token holds {len(slack.sockets_for('xapp-test-app'))} connections, not one.")
3756
+ return 1
3757
+ if bot_status(rtl, benv, "shared").get("direct") is not True:
3758
+ report(f"{label} status does not report the shared app's direct messages as connected: {bot_status(rtl, benv, 'shared')!r}")
3759
+ return 1
3760
+ finally:
3761
+ stop_chat_bridge(bridge)
3762
+
3763
+ for relative in ("docs/chat-slack-setup.md", "docs/chat-slack-setup.zh-CN.md"):
3764
+ text = (ROOT / relative).read_text(encoding="utf-8")
3765
+ if "im:history" not in text:
3766
+ report(f"{label} {relative} does not name the im:history scope direct messages need.")
3767
+ return 1
3768
+ if not any(phrase in text for phrase in ("shared app's own bot user", "共用 app 自己的 bot 用户")):
3769
+ report(f"{label} {relative} does not describe direct messages through the shared app.")
3770
+ return 1
3771
+ if "chat-shared-app-direct" not in {name for name, _ in SCENARIOS}:
3772
+ report(f"{label} scenario is not registered.")
3773
+ return 1
3774
+ report("chat-shared-app-direct scenario passed.")
3775
+ return 0
3776
+
3777
+
3709
3778
  def validate_chat_shared_bots_scenario() -> int:
3710
3779
  """Issue #187: one registered bot is a different role in each project.
3711
3780
 
@@ -4321,6 +4390,9 @@ def validate_chat_owner_mention_scenario() -> int:
4321
4390
  if "decide" not in told:
4322
4391
  report(f"{label} the notice does not say which messages need @owner: {told!r}")
4323
4392
  return 1
4393
+ if "its own message" not in told:
4394
+ report(f"{label} the notice does not say a risk or decision goes in its own message: {told!r}")
4395
+ return 1
4324
4396
 
4325
4397
  run_keel(rtl, "chat", "bridge", "add", env=benv)
4326
4398
  record_id = chat_json(run_keel(rtl, "chat", "post", "soc", "@owner 需要你决定 CSR 复位值", "--json", env=benv)).get("id", "")
@@ -4353,6 +4425,38 @@ def validate_chat_owner_mention_scenario() -> int:
4353
4425
  return 0
4354
4426
 
4355
4427
 
4428
+ def validate_collected_feedback_is_recorded_scenario() -> int:
4429
+ """Feedback from rtl_ppa_prj sessions on 2026-10-05 reaches Keel's surfaces.
4430
+
4431
+ The codex catalog warns that a run can exit non-zero after its products
4432
+ exist, the general pitfalls warn against `pkill -f`, the bundled hardware
4433
+ lens names tools that silently accept a missing signal, and the tdd skill
4434
+ advises a `Fails with:` literal every red of the check shares.
4435
+ """
4436
+ label = "collected-feedback-is-recorded:"
4437
+ with tempfile.TemporaryDirectory(prefix="keel-feedback-") as raw:
4438
+ repo = Path(raw)
4439
+ subprocess.run(["git", "init", "-q"], cwd=repo, check=True)
4440
+ shown = run_keel(repo, "agents", "codex").stdout or ""
4441
+ for needle in ("result file", "non-zero", "pkill -f"):
4442
+ if needle not in shown:
4443
+ report(f"{label} `keel agents codex` does not mention {needle!r}.")
4444
+ return 1
4445
+ lens = (ROOT / "assets/lenses/hardware.md").read_text(encoding="utf-8")
4446
+ if "silently" not in lens or "missing signal" not in lens:
4447
+ report(f"{label} the hardware lens does not name tools that silently accept a missing signal.")
4448
+ return 1
4449
+ skill = (ROOT / PLUGIN_ROOT / "skills/keel-tdd-or-test-first/SKILL.md").read_text(encoding="utf-8")
4450
+ if "Fails with:" not in skill or "every red" not in skill:
4451
+ report(f"{label} the tdd skill does not advise a Fails with: literal every red shares.")
4452
+ return 1
4453
+ if "collected-feedback-is-recorded" not in {name for name, _ in SCENARIOS}:
4454
+ report(f"{label} scenario is not registered.")
4455
+ return 1
4456
+ report("collected-feedback-is-recorded scenario passed.")
4457
+ return 0
4458
+
4459
+
4356
4460
  def validate_chat_archive_scenario() -> int:
4357
4461
  """Issue #187: chat history is archived to an orphan branch, never exposed.
4358
4462
 
@@ -20774,6 +20878,9 @@ def _protocol_refresh_m2(tmp: Path) -> str | None:
20774
20878
  lines = _protocol_lines(repo)
20775
20879
  if len(lines) != 1 or "standing-authorized" not in lines[0]:
20776
20880
  return f"M2 context did not read protocol-refresh as authorized: {lines!r}"
20881
+ # Issue #238: the authorization covers the refresh, not its commit.
20882
+ if "committing it is a separate action" not in lines[0]:
20883
+ return f"M2 context does not say committing the refresh is a separate action: {lines!r}"
20777
20884
  doctor = run_keel(repo, "--doctor").stdout or ""
20778
20885
  if "protocol-refresh: authorized" not in doctor or "commit: not authorized" not in doctor:
20779
20886
  return (
@@ -32388,6 +32495,14 @@ def validate_coverage_claim_is_compared_scenario() -> int:
32388
32495
  f"{problem_text(quiet)!r}."
32389
32496
  )
32390
32497
  return 1
32498
+ # Issue #239: the warning names the identifiers that make an entry
32499
+ # compared, so a reader can tell how to make it count.
32500
+ if "D<n>, F<n>, A<n>, or Q<n>" not in said(quiet):
32501
+ report(
32502
+ f"{label}: the uncompared-entry warning does not name the "
32503
+ f"identifiers that count; {said(quiet)!r}."
32504
+ )
32505
+ return 1
32391
32506
 
32392
32507
  # D3: the report's second suggestion is unnecessary, because the
32393
32508
  # comparison already refuses the case it was aimed at.
@@ -36523,6 +36638,10 @@ SCENARIOS: tuple = (
36523
36638
  "chat-role-direct",
36524
36639
  validate_chat_role_direct_scenario,
36525
36640
  ),
36641
+ (
36642
+ "chat-shared-app-direct",
36643
+ validate_chat_shared_app_direct_scenario,
36644
+ ),
36526
36645
  (
36527
36646
  "chat-role-apps-are-documented",
36528
36647
  validate_chat_role_apps_are_documented_scenario,
@@ -36803,6 +36922,7 @@ SCENARIOS: tuple = (
36803
36922
  ("directory-tree-is-the-package-renamed", validate_directory_tree_is_the_package_renamed_scenario),
36804
36923
  ("init-declares-plugin-auto-update", validate_init_declares_plugin_auto_update_scenario),
36805
36924
  ("context-names-the-protocol-refresh", validate_context_names_the_protocol_refresh_scenario),
36925
+ ("collected-feedback-is-recorded", validate_collected_feedback_is_recorded_scenario),
36806
36926
  ("init-never-downgrades-openspec", validate_init_never_downgrades_openspec_scenario),
36807
36927
  ("native-plugin-marketplaces", validate_native_plugin_marketplaces_scenario),
36808
36928
  ("native-plugin-install-matrix", validate_native_plugin_install_matrix_scenario),
@@ -62,6 +62,11 @@ const BUNDLED = {
62
62
  source: "codex exec --help, codex-cli 0.159.3",
63
63
  text: "`-s` takes read-only, workspace-write, or danger-full-access. `-C` sets the directory it works in and `-o` the file its last message is written to.",
64
64
  },
65
+ {
66
+ date: "2026-10-05",
67
+ source: "rtl_ppa_prj design session, codex_wcmux run",
68
+ text: "A run can exit non-zero after its products exist: one hit its quota while tidying up and never wrote its result file. Have the brief write the result file before any cleanup, and on a non-zero exit read the products before calling the run failed.",
69
+ },
65
70
  ],
66
71
  },
67
72
  dsh: {
@@ -96,6 +101,11 @@ const BUNDLED = {
96
101
 
97
102
  // Pitfalls of handing work to any external process, whichever CLI it is.
98
103
  const GENERAL_PITFALLS = [
104
+ {
105
+ date: "2026-10-05",
106
+ source: "rtl_ppa_prj verify session",
107
+ text: "Stop a delegate by its PID or by its own output directory, never `pkill -f <pattern>`: a pattern matched other sessions' processes of the same command and killed them, twice in one day.",
108
+ },
99
109
  {
100
110
  date: "2026-10-04",
101
111
  source: RTL_TOOLCHAIN,
@@ -582,6 +582,10 @@ async function handleEvent(ctx, event) {
582
582
  return;
583
583
  }
584
584
  if (event.type !== "message") return;
585
+ if (event.channel_type === "im") {
586
+ if (ctx.sharedDirect) handleDirectEvent(ctx, ctx.sharedDirect, event);
587
+ return;
588
+ }
585
589
  const channel = event.channel;
586
590
  if (!projectsFor(ctx, channel).length) return;
587
591
  switch (event.subtype) {
@@ -753,13 +757,13 @@ function botReport(ctx) {
753
757
  return [...(ctx.bots || new Map()).values()].map((app) => {
754
758
  let directNote = null;
755
759
  if (app.state === "verified" && app.appToken && app.serves.length > 1) directNote = `off: serves ${app.serves.length} roles, and a direct message cannot say which project it is for`;
756
- else if (app.state === "verified" && !app.appToken) directNote = `off: no app:${app.name} token`;
760
+ else if (app.state === "verified" && !app.appToken) directNote = app.shared ? "off: no shared app-level token" : `off: no app:${app.name} token`;
757
761
  return {
758
762
  bot: app.name,
759
763
  state: app.state,
760
764
  ...(app.reason ? { reason: app.reason } : {}),
761
765
  roles: app.serves.map((entry) => entry.label),
762
- direct: Boolean(app.connected),
766
+ direct: Boolean(app.shared ? app.serves.length === 1 && ctx.connected : app.connected),
763
767
  ...(directNote ? { direct_note: directNote } : {}),
764
768
  invite: [...app.invite].sort(),
765
769
  };
@@ -787,6 +791,14 @@ async function verifyBots(ctx) {
787
791
  }
788
792
  bots.set(name, app);
789
793
  }
794
+ // The shared app serves a role too when a project maps its own bot user to
795
+ // one (chat-shared-app-direct D1). Its tokens and connection are ctx's.
796
+ if (ctx.self.user_id && ctx.projects.some((project) => project.settings.bots[ctx.self.user_id])) {
797
+ bots.set("shared", {
798
+ name: "shared", shared: true, role: null, token: ctx.token, appToken: ctx.appToken, state: "verified", reason: null,
799
+ user_id: ctx.self.user_id, bot_id: ctx.self.bot_id, serves: [], invite: new Set(), connected: false, socket: null, ims: new Map(),
800
+ });
801
+ }
790
802
  for (const project of ctx.projects) {
791
803
  project.roleBots = new Map();
792
804
  for (const app of bots.values()) {
@@ -886,9 +898,18 @@ async function createContext(log, { needApp }) {
886
898
  ctx.bots = await verifyBots(ctx);
887
899
  for (const project of ctx.projects) project.directApps = directApps(ctx).filter((app) => app.serves[0].project === project);
888
900
  for (const app of directApps(ctx)) {
901
+ if (app.shared) continue;
889
902
  app.onHello = () => catchUpDirect(ctx, app);
890
903
  app.onEvent = (event) => handleDirectEvent(ctx, app, event);
891
904
  }
905
+ // Direct messages to the shared app arrive on its one connection (D3).
906
+ ctx.sharedDirect = directApps(ctx).find((app) => app.shared) || null;
907
+ if (ctx.sharedDirect) {
908
+ ctx.onHello = async () => {
909
+ await catchUp(ctx);
910
+ await catchUpDirect(ctx, ctx.sharedDirect);
911
+ };
912
+ }
892
913
  // Posts and actions through a verified role app are this bridge's own (D5).
893
914
  const verified = [...ctx.bots.values()].filter((app) => app.state === "verified");
894
915
  ctx.ownBots = new Set([ctx.self.bot_id, ...verified.map((app) => app.bot_id)].filter(Boolean));
@@ -971,7 +992,7 @@ async function keepConnected(ctx, conn) {
971
992
  }
972
993
 
973
994
  function connections(ctx) {
974
- return [ctx, ...directApps(ctx)];
995
+ return [ctx, ...directApps(ctx).filter((app) => !app.shared)];
975
996
  }
976
997
 
977
998
  function packageVersion() {
@@ -148,7 +148,8 @@ function bridgeLine(where) {
148
148
  // the owner only for a mention, and the bridge mentions them only for
149
149
  // `@owner`, so whether a message reaches their phone is the session's choice.
150
150
  const OWNER_RULE = "Slack notifies the owner only for messages that write `@owner`: write it in any message the owner "
151
- + "needs to see or decide on, and leave it out of routine discussion.";
151
+ + "needs to see or decide on, and leave it out of routine discussion. Send a risk or decision as its own message "
152
+ + "with `@owner` rather than inside a status update.";
152
153
 
153
154
  const HOST_EVENTS = {
154
155
  "session-start": "SessionStart",
@@ -792,7 +792,8 @@ function renderProtocol(protocol) {
792
792
  }
793
793
  return protocol.authorized
794
794
  ? `${head} — standing-authorized (authorize: protocol-refresh); run it `
795
- + "before other work and leave the diff for the owner to commit"
795
+ + "before other work and leave the diff uncommitted: the authorization "
796
+ + "covers the refresh, and committing it is a separate action"
796
797
  : `${head} — ask before running it; keel/config.yaml does not `
797
798
  + "standing-authorize protocol-refresh";
798
799
  }
package/src/core/gates.js CHANGED
@@ -2137,8 +2137,9 @@ function expectationProblems(repo, content, tasks, change) {
2137
2137
  ? `Expectation Coverage: compared ${compared} of ${compared + uncited} `
2138
2138
  + `\`Covered by:\` ${compared + uncited === 1 ? "entry" : "entries"} `
2139
2139
  + `against the Covers of the task named; ${uncited} cited no `
2140
- + `expectation identifier and ${uncited === 1 ? "was" : "were"} not `
2141
- + "compared."
2140
+ + "D<n>, F<n>, A<n>, or Q<n> identifier before `Covered by:` and "
2141
+ + `${uncited === 1 ? "was" : "were"} not compared`
2142
+ + (uncited > 0 ? " (cite one there, as in `E1: … (D2). Covered by: 1.1`)." : ".")
2142
2143
  : null;
2143
2144
  return { problems, report };
2144
2145
  }