samagotchi 0.194.0 → 0.196.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.
Files changed (152) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +80 -1
  3. data/docs/architecture.md +2 -1
  4. data/docs/bundle-authoring.md +23 -23
  5. data/docs/bundles.md +201 -7
  6. data/docs/cli.md +5 -1
  7. data/docs/configuration.md +25 -4
  8. data/docs/context.md +13 -3
  9. data/docs/guardrails.md +6 -4
  10. data/docs/hooks.md +3 -1
  11. data/docs/internals/attached-context.md +2 -0
  12. data/docs/internals/block-renderers.md +4 -1
  13. data/docs/internals/bridge.md +4 -0
  14. data/docs/internals/engine.md +15 -2
  15. data/docs/internals/knowledge.md +215 -0
  16. data/docs/internals/pages.md +17 -9
  17. data/docs/internals/panes.md +51 -13
  18. data/docs/internals/participants.md +15 -3
  19. data/docs/internals/peers.md +14 -9
  20. data/docs/internals/session-lifecycle.md +26 -12
  21. data/docs/internals/web-frontend.md +64 -27
  22. data/docs/memory.md +4 -2
  23. data/docs/pages.md +72 -1
  24. data/docs/peers.md +25 -14
  25. data/docs/plugins.md +132 -6
  26. data/docs/releasing.md +1 -1
  27. data/docs/scheduling.md +4 -0
  28. data/docs/sessions.md +9 -2
  29. data/docs/system-one.md +3 -1
  30. data/docs/testing.md +3 -1
  31. data/lib/samagotchi/bundle_manifest.rb +30 -5
  32. data/lib/samagotchi/bundles/claude-peer/manifest.yml +8 -5
  33. data/lib/samagotchi/bundles/claude-peer/plugin.rb +2 -2
  34. data/lib/samagotchi/bundles/codex-peer/manifest.yml +8 -5
  35. data/lib/samagotchi/bundles/codex-peer/plugin.rb +3 -3
  36. data/lib/samagotchi/bundles/coordinator/manifest.yml +7 -4
  37. data/lib/samagotchi/bundles/coordinator/plugin.rb +15 -5
  38. data/lib/samagotchi/bundles/coordinator/skill_coordinator.md +10 -0
  39. data/lib/samagotchi/bundles/core/manifest.yml +2 -2
  40. data/lib/samagotchi/bundles/cost-cap/manifest.yml +4 -4
  41. data/lib/samagotchi/bundles/cost-cap/plugin.rb +54 -3
  42. data/lib/samagotchi/bundles/dev/manifest.yml +3 -2
  43. data/lib/samagotchi/bundles/github-pr/manifest.yml +4 -2
  44. data/lib/samagotchi/bundles/knowledge/adapters.rb +205 -0
  45. data/lib/samagotchi/bundles/knowledge/catalog.rb +151 -0
  46. data/lib/samagotchi/bundles/knowledge/chi_adapters.rb +178 -0
  47. data/lib/samagotchi/bundles/knowledge/chunker.rb +55 -0
  48. data/lib/samagotchi/bundles/knowledge/github.rb +246 -0
  49. data/lib/samagotchi/bundles/knowledge/manifest.yml +27 -0
  50. data/lib/samagotchi/bundles/knowledge/plugin.rb +807 -0
  51. data/lib/samagotchi/bundles/knowledge/query.rb +30 -0
  52. data/lib/samagotchi/bundles/knowledge/query_log.rb +55 -0
  53. data/lib/samagotchi/bundles/knowledge/refresh.rb +133 -0
  54. data/lib/samagotchi/bundles/knowledge/store.rb +264 -0
  55. data/lib/samagotchi/bundles/reflect/manifest.yml +17 -0
  56. data/lib/samagotchi/bundles/reflect/scripts/reflect.rb +439 -0
  57. data/lib/samagotchi/bundles/reflect/skill_reflect.md +100 -0
  58. data/lib/samagotchi/bundles/system/manifest.yml +1 -1
  59. data/lib/samagotchi/context_change.rb +44 -0
  60. data/lib/samagotchi/context_note.rb +1 -1
  61. data/lib/samagotchi/context_providers.rb +14 -0
  62. data/lib/samagotchi/context_sources.rb +3 -25
  63. data/lib/samagotchi/engine/plugins.rb +21 -0
  64. data/lib/samagotchi/events.rb +1 -0
  65. data/lib/samagotchi/guardrails/pair_boundary.rb +12 -4
  66. data/lib/samagotchi/guardrails/review_paths.rb +13 -3
  67. data/lib/samagotchi/guardrails/targets.rb +24 -2
  68. data/lib/samagotchi/guardrails_command.rb +3 -9
  69. data/lib/samagotchi/hook_label.rb +19 -0
  70. data/lib/samagotchi/hook_routes.rb +3 -2
  71. data/lib/samagotchi/installed_bundles/manifest.rb +7 -1
  72. data/lib/samagotchi/memory_bundle/builder.rb +2 -1
  73. data/lib/samagotchi/memory_bundle/installed_copy.rb +2 -1
  74. data/lib/samagotchi/page_command.rb +90 -6
  75. data/lib/samagotchi/pages/launch.rb +16 -8
  76. data/lib/samagotchi/pages/runner.rb +7 -2
  77. data/lib/samagotchi/pages/runtime.rb +62 -2
  78. data/lib/samagotchi/pages.rb +4 -0
  79. data/lib/samagotchi/panes/kitty.rb +20 -5
  80. data/lib/samagotchi/panes.rb +81 -12
  81. data/lib/samagotchi/participants.rb +17 -6
  82. data/lib/samagotchi/peer_exchanges.rb +1 -2
  83. data/lib/samagotchi/peer_note.rb +38 -5
  84. data/lib/samagotchi/peer_presence.rb +20 -7
  85. data/lib/samagotchi/plugin/api.rb +11 -1
  86. data/lib/samagotchi/plugin/attached_context.rb +46 -1
  87. data/lib/samagotchi/plugin/chips.rb +125 -0
  88. data/lib/samagotchi/plugin/context.rb +43 -8
  89. data/lib/samagotchi/plugin/panes.rb +52 -9
  90. data/lib/samagotchi/plugin/peer_pairing.rb +2 -2
  91. data/lib/samagotchi/plugin/peer_start.rb +61 -36
  92. data/lib/samagotchi/plugin/peers.rb +6 -3
  93. data/lib/samagotchi/plugin/project.rb +63 -0
  94. data/lib/samagotchi/plugin/sessions.rb +36 -1
  95. data/lib/samagotchi/plugin/tool_spec.rb +28 -9
  96. data/lib/samagotchi/schedules.rb +8 -2
  97. data/lib/samagotchi/session.rb +22 -9
  98. data/lib/samagotchi/session_access/local.rb +34 -33
  99. data/lib/samagotchi/session_chain/sharing.rb +79 -0
  100. data/lib/samagotchi/session_chain/successor.rb +4 -2
  101. data/lib/samagotchi/session_chips.rb +133 -0
  102. data/lib/samagotchi/session_inbox_delivery.rb +11 -11
  103. data/lib/samagotchi/session_manager/emptiness.rb +4 -1
  104. data/lib/samagotchi/session_observer.rb +1 -1
  105. data/lib/samagotchi/session_stats.rb +437 -0
  106. data/lib/samagotchi/session_stores.rb +3 -0
  107. data/lib/samagotchi/session_window.rb +30 -0
  108. data/lib/samagotchi/speaker.rb +228 -0
  109. data/lib/samagotchi/steer.rb +36 -132
  110. data/lib/samagotchi/system_one/approval_choice.rb +22 -0
  111. data/lib/samagotchi/system_one/approval_label.rb +4 -6
  112. data/lib/samagotchi/system_prompt.rb +3 -1
  113. data/lib/samagotchi/terminal_ui/attach_launcher.rb +30 -0
  114. data/lib/samagotchi/testing/boundary.rb +17 -4
  115. data/lib/samagotchi/testing/bundle.rb +5 -0
  116. data/lib/samagotchi/testing/host.rb +1 -0
  117. data/lib/samagotchi/testing/recorder.rb +10 -0
  118. data/lib/samagotchi/testing/sessions.rb +11 -3
  119. data/lib/samagotchi/toolkit.rb +11 -4
  120. data/lib/samagotchi/toolkit_report_command.rb +14 -18
  121. data/lib/samagotchi/toolkit_suggest.rb +9 -2
  122. data/lib/samagotchi/tools/registry.rb +48 -18
  123. data/lib/samagotchi/tools/tool_index.rb +6 -2
  124. data/lib/samagotchi/turn_excerpts.rb +302 -0
  125. data/lib/samagotchi/turn_stages/toolkit_suggestion.rb +9 -0
  126. data/lib/samagotchi/version.rb +1 -1
  127. data/lib/samagotchi/web/app.rb +21 -10
  128. data/lib/samagotchi/web/participant_view.rb +1 -1
  129. data/lib/samagotchi/web/peer_routes.rb +5 -2
  130. data/lib/samagotchi/web/plugin_chip_rows.rb +39 -0
  131. data/lib/samagotchi/web/public/agent_rows.js +1 -0
  132. data/lib/samagotchi/web/public/app.js +17 -25
  133. data/lib/samagotchi/web/public/chains.js +0 -26
  134. data/lib/samagotchi/web/public/command_list.js +2 -3
  135. data/lib/samagotchi/web/public/composer.js +2 -3
  136. data/lib/samagotchi/web/public/composer_mount.js +3 -6
  137. data/lib/samagotchi/web/public/context_chips.js +240 -93
  138. data/lib/samagotchi/web/public/context_groups.js +84 -0
  139. data/lib/samagotchi/web/public/draft_follow.js +33 -0
  140. data/lib/samagotchi/web/public/drafts.js +26 -22
  141. data/lib/samagotchi/web/public/index.html +32 -0
  142. data/lib/samagotchi/web/public/peer_chip_kind.js +49 -0
  143. data/lib/samagotchi/web/public/peer_note.js +2 -2
  144. data/lib/samagotchi/web/public/peer_row.js +10 -5
  145. data/lib/samagotchi/web/public/peer_wait.js +4 -2
  146. data/lib/samagotchi/web/public/plugin_chip.js +55 -0
  147. data/lib/samagotchi/web/public/plugin_chip_kind.js +48 -0
  148. data/lib/samagotchi/web/public/send_turn.js +8 -21
  149. data/lib/samagotchi/web/public/session_actions.js +10 -23
  150. data/lib/samagotchi/web/public/session_view.js +7 -3
  151. data/lib/samagotchi/web/public/stream_handlers.js +2 -0
  152. metadata +33 -1
data/docs/plugins.md CHANGED
@@ -302,11 +302,48 @@ run by `call_tool` as the tool itself ([the chi group](#chitool_sourcecall-acts_
302
302
  each key optional, says what a call acts on, for [guardrails](#guardrails).
303
303
  - `refs`: `->(args) { [{ kind:, target:, label:, actions: [] }, …] }`, what the call's row traces to in the web
304
304
  (display only, the model never sees them). See [Refs on a tool's row](#refs-on-a-tools-row).
305
+ - `declare`: `:always` or `:kit`, which toolkits declare it (below); omitted, a kit's list decides, as for a built-in.
306
+ - `participant`: `:deny` keeps it for the owner: a participant's turn is refused it (below); default `:allow`.
305
307
 
306
308
  The block returns the result text. If it starts with `Error:`, it counts as
307
309
  a failure. If it raises, the model gets `Error: <message>`. To return images
308
310
  too, see [Returning images](#returning-images).
309
311
 
312
+ #### `declare:`: which kits declare it
313
+
314
+ - **`declare: :always`**: every toolkit declares it (`lean`, `child`, a config kit on `lean` that no `add:` of
315
+ yours reaches) unless the toolkit or the session removes it (`remove:`, `--no-tool`, `/toolkit remove`). For a
316
+ tool every session should have, such as the knowledge bundle's `knowledge_search`; it costs its declaration's
317
+ tokens in every request, so keep its description short.
318
+ - **`declare: :kit`**: only a toolkit that adds it declares it (a kit's `add:`, `--tool`, `/toolkit add`), never
319
+ `full` by itself: for tools a kind of session needs (the knowledge bundle's catalog tools, which the coordinator
320
+ kit adds). A kit that doesn't add it doesn't "leave it out": no prompt names it (not the not-loaded line, not
321
+ `find_tools`' description) and `full` shows no chip for it, so registering one leaves the system prompt and the
322
+ declared tools of every session that doesn't add it as they were. Where the tool index is up (an MCP server, a kit
323
+ leaving built-ins out) `find_tools` finds it and `call_tool` reaches it as `chi/<name>` (a kit's chip lists it as
324
+ reachable; on a host that loads tools it is among the deferred ones, after the cached part), but it never brings
325
+ `find_tools` and `call_tool` into a session that had none. Called by its own name where it isn't declared, it gets
326
+ the unknown-tool answer.
327
+ - Anything else is a load error (`tool x: declare must be :kit or :always`). A changed `declare:` in
328
+ `chi.replace_tools` is a change (the prompts are built again). The toolkit report (`chi toolkit report`) grades an
329
+ `:always` tool covered on every kit but one removing it, and a `:kit` one only by a kit's adds.
330
+ - `declare:` needs a chi newer than 0.194.0: an older chi refuses the keyword, a load error, so a bundle passing it
331
+ sets `requires_chi` past that (`chi bundle check` warns on a lower one).
332
+
333
+ #### `participant:`: the owner's only
334
+
335
+ `participant: :deny` keeps a tool for the session's owner: a [participant's](cli.md#participants) pair turn that
336
+ calls it, by its name or through `call_tool` (`chi/<name>`), is refused by the pair boundary
337
+ (`PairBoundary::BUNDLE_OWNER`, [guardrails](guardrails.md#a-participants-pair-boundary)) before any path or command
338
+ check and before any ask: the owner is never asked about a call that is refused anyway, and the handler never runs.
339
+ The default, `:allow`, leaves the call to the boundary's checks as before (one whose `targets:` name no command or
340
+ path asks the owner). It is per tool, not per argument: a rule on a call's arguments (a participant may search, but
341
+ not a named catalog, say) stays in the handler, with `ctx.turn_author`. Anything else (`"deny"` too) is a load error
342
+ (`tool x: participant must be :allow or :deny`). A changed `participant:` in `chi.replace_tools` takes effect from
343
+ the next call without building the prompts again (it never reaches them). A handler that runs another bundle tool
344
+ itself, not through a tool call, goes around the boundary: that is the bundle's to check. It needs a chi newer than
345
+ 0.195.0: an older chi refuses the keyword, a load error, so a bundle passing it sets `requires_chi` past that.
346
+
310
347
  #### `args`
311
348
 
312
349
  `args` is a frozen Hash with **string keys**: the arguments the model gave,
@@ -926,6 +963,7 @@ full label, `plugin.rb (bundle my-bundle)`.
926
963
  | `ctx.session_id` | the session's id (nil before there is one) |
927
964
  | `ctx.cwd` | the session's working directory |
928
965
  | `ctx.repo_root` | the git checkout holding `cwd`, or nil |
966
+ | `ctx.project` | the project `cwd` belongs to, as chi's memories find it, frozen: `kind` (`:git`, `:marker` for a `chi project init` folder, `:none`), `root` (a repository's **main checkout**, for every linked worktree too; the marked folder; nil for none), `key` (the memories key, `<name>_<hash>` or the marker's id; nil for none), `memories_dir` (where `memory_read`/`memory_write`'s project scope is for this folder: a folder in no project has its own), `system_memories_dir`, `chi_dirs` (chi's state dir, config dir and an outside hooks dir), `secret_root?(path)` (a folder a participant's turn never reads: chi's dirs, `~/.ssh` and the other home secrets, as given and as it resolves) and `secret_name?(relative_path)` (a file inside an allowed folder named like a secret: `.env*`, `credentials*`, keys, a `.git` config). Use it rather than chi's memory paths. One known gap: a session saved with a project root before its marked folder moved keeps that root in `Session#project_root`, while `ctx.project` reads the folder now. Needs a chi newer than 0.194.0 (guard it with `ctx.respond_to?(:project)`) |
929
967
  | `ctx.scratch?` | whether the session is a `chi scratch` one (deleted when it ends) |
930
968
  | `ctx.delegate?` | whether the session is a delegate child: a task another session handed over |
931
969
  | `ctx.frontend` | what runs the session, read now: `:one_shot` (`-p --non-interactive`: one turn, then exit) or `:worker` (a session worker: the web, an attached TUI). There is no `:repl` any more: a bundle that checks for it never matches. Only a worker's answers reach the web while it runs; a one-shot's show there once the session is opened. Until the host sets it (while the plugins load, inside `Engine.new`) it reads `:one_shot`, so read it in hooks and init tasks, not in `register` |
@@ -944,6 +982,7 @@ full label, `plugin.rb (bundle my-bundle)`.
944
982
  | `ctx.session_dir` | this session's own folder there, created on use, read now; nil with no session yet. `ctx.session_dir(create: false)` is the same path with no folder made, for a read, so a session that saved nothing leaves none (a `File.read` of what isn't there raises `Errno::ENOENT`); needs chi newer than 0.143.0. chi removes it when the session is deleted, discarded or pruned, so don't build the path yourself. A `sessions/<id>.json` an older version of your bundle kept moves in as `state.json` (chi still removes one left there). Needs chi newer than 0.142.0 |
945
983
  | `ctx.log` | `ctx.log.info(:event, key: value)`: debug-log records tagged `plugins`, with `bundle=<bundle>` |
946
984
  | `ctx.messages` | the conversation, as a frozen copy, without the system prompt. While a turn runs, a session worker's (attached, web) adds that turn so far: its prompt, the model's text and the lines merged into it (no tool calls or thinking); a `--non-interactive` one-shot's is the conversation before that turn. An entry may carry `at`, when it happened (docs/sessions.md, Message times) |
985
+ | `ctx.speaker(message)` | who wrote a message of `ctx.messages` or `ctx.sessions.read`: `:owner`, `:participant`, `:chi` (a note, a reminder, a `!cmd` line), `:sender` (an agent, a parent, `chi send`), `:plugin`, `:model` or `:tool`; nil for a non-Hash. Read it rather than the message's keys, which stay chi's own. Needs the next chi (guard it with `ctx.respond_to?(:speaker)`) |
947
986
  | `ctx.last_answer` | the newest answer's text as the user saw it: the newest answer bubble of `ctx.messages`, its thoughts (one cut off before it closed too) and tool-call markup taken out, the rule chi's continue note uses. nil when there is none or it was a thought alone; mid-turn, a worker's can be the running turn's interim text. Needs chi newer than 0.153.0 |
948
987
  | `ctx.messages_partial?` | whether `ctx.messages` leaves out a running turn (a `--non-interactive` one-shot mid-turn), so a plugin can say what its answer is about |
949
988
  | `ctx.prompt_files` | the files whose text is in the session's system prompt now: the AGENTS.md chain (the work tree top down to the cwd) and the appended files (`append_system_prompt:`, `--append-system-prompt`); absolute paths, in prompt order, `[]` before the first build |
@@ -961,6 +1000,7 @@ full label, `plugin.rb (bundle my-bundle)`.
961
1000
  | `ctx.judge(name, state:)`, `ctx.judge_later(name, state:) { |result| … }`, `ctx.judgments` | a cheap System 1 question this bundle declared, saved as a run: see [Judgments](#judgments-chijudgment-and-ctxjudge) |
962
1001
  | `ctx.sign_in(title:, button:, timeout: 300, port: nil, path: "/callback", cancel: nil) { \|redirect_uri\| address }` | send the owner to an address and get back where the browser was sent: see [Sign-in](#sign-in-ctxsign_in) |
963
1002
  | `ctx.secrets` | the bundle's tokens, kept apart from its data files (`get`, `set`, `delete`, `update`): see [Secrets](#secrets-ctxsecrets) |
1003
+ | `ctx.chips` | the bundle's own chips in chi web's session bar (`set`, `remove`, `list`): see [Chips](#chips-ctxchips) |
964
1004
  | `ctx.http` | an HTTP client for calling services (`get`, `post_json`, `request`, `stream`): see [Calling services](#calling-services-ctxhttp) |
965
1005
  | `ctx.sessions` | fork, send to, read, list and stop other sessions: see [Other sessions](#other-sessions-ctxsessions) |
966
1006
  | `ctx.toolkit` | the name of the session's toolkit (`full` for a session from before toolkits); nil with no session |
@@ -1099,6 +1139,48 @@ in_turn:}` (`source` is the bundle; each action `{label:, command:}` or
1099
1139
  `{label:, url:}`), plus `command:` when a session command
1100
1140
  showed it (`"/short"`), logged as `card` with its source, id and title.
1101
1141
 
1142
+ ## Chips: `ctx.chips`
1143
+
1144
+ A bundle can draw a chip of its own in chi web's session bar, after the peer chips and the attached sources: a short
1145
+ label for something that holds for the whole session (cost-cap's `cap · $4.10 of $5.00`). A tap opens a small card
1146
+ with the bundle's text and up to four buttons, in a card's shape. The chips are stored with the session, so chi web
1147
+ shows them when no worker runs, and they stay until the bundle removes them.
1148
+
1149
+ ```ruby
1150
+ ctx.chips.set("cap", label: "cap · $4.10 of $5.00", state: :warn,
1151
+ title: "cost-cap: 82% of this session's cap",
1152
+ body: "This session has used **$4.10** of its **$5.00** cap.",
1153
+ actions: [{ label: "Raise to $10", command: "/cap 10", primary: true },
1154
+ { label: "Turn the cap off", command: "/cap off" }])
1155
+ ctx.chips.remove("cap") # => true when there was one
1156
+ ctx.chips.list # => this bundle's chips by name: {label:, state:, dot:, title:, at:, body:, actions:, set_at:}
1157
+ ```
1158
+
1159
+ - The name follows a source name's rules (lowercase letters, digits and `-`, at most 40). A chip is its bundle's: a
1160
+ bundle sees and changes only its own, at most 3 (a 4th `set` raises `ArgumentError`).
1161
+ - `label:` is required: one line, cut at 40 characters. `state:` is `:ok` (the default), `:warn` or `:error`, core's
1162
+ three looks: a bundle brings no colours or styles of its own. `dot: true` adds a dot. `title:` is the tooltip.
1163
+ `at:` (a Time or an ISO 8601 string) draws an age after the label (`· 3m`) that ticks every minute, so a chip that
1164
+ stops being updated shows how old it is.
1165
+ - `body:` is markdown, as a card's. `actions:` are a card's actions (a `command:` or an http(s) `url:`, `primary:`
1166
+ drawn solid), at most 4. A command runs as a card's button runs it: its reply shows in the conversation, the line
1167
+ isn't echoed as typed, and it never asks for the cache. A url opens in a new tab, its host named under the buttons.
1168
+ A chip with no body and no actions opens nothing: it is a label only.
1169
+ - `set` returns whether it changed anything. The same chip again writes nothing and tells no one, so a hook may call
1170
+ it each time (cost-cap sets its chip after every generation, never per streamed token). A change is one small file
1171
+ write, one event to the open tabs and one read of the strip from each.
1172
+ - With no session yet (`chi.ctx` at load, an init task before the first session) `set` and `remove` do nothing and
1173
+ return false, `list` is `{}`.
1174
+ - The chips live in the session's folder (`chips.json`) and don't make a session count as used: a bundle that sets
1175
+ one at session start leaves an untouched session discardable. A continue or a fork copies none (set them again
1176
+ there); deleting the session removes them. A bundle that is uninstalled (or one this chi refuses) has its chips
1177
+ left out of the strip.
1178
+ - chi web only: the terminal draws no chips. A `--non-interactive` one-shot sets them too, shown when the session is
1179
+ opened in chi web later. A participant never sees them.
1180
+ - It needs a chi newer than 0.195.0: guard with `ctx.respond_to?(:chips)` and mark the bundle `requires_chi_next`
1181
+ ([releasing](releasing.md)). In the test kit chips are in memory: `bundle.chips` (this bundle's, by name, as
1182
+ stored) and `bundle.chip_writes` (how many changes were written).
1183
+
1102
1184
  ## Side answers: `ctx.ask_model`
1103
1185
 
1104
1186
  ```ruby
@@ -1520,6 +1602,8 @@ ctx.sessions.send(id, "then the docs", delivery: :queue) # after its running tu
1520
1602
  ctx.sessions.read(id) # => {id:, title:, status:, parent_id:, running:, messages:} (title: its /title, else its preview)
1521
1603
  ctx.sessions.children # => [{id:, short_id:, state:, branch:, last_reply:, reported:, ...}]
1522
1604
  ctx.sessions.stop(id) # one of this session's own children
1605
+ ctx.sessions.list(changed_since: nil) # => [{id:, title:, updated_at:, archived:}] this project's saved sessions
1606
+ ctx.sessions.present_ids # => ["3f2a9c1e-…", …] every saved session's id
1523
1607
  ```
1524
1608
 
1525
1609
  - `fork(messages:, title: nil, prompt: nil)` starts a child session in its
@@ -1572,6 +1656,17 @@ ctx.sessions.stop(id) # one of this session's own children
1572
1656
  - `stop(id)` stops one of this session's own children, as
1573
1657
  `chi sessions stop` does, and waits up to 2 s for its worker to let go. It
1574
1658
  returns the child's id. Any other session raises.
1659
+ - `list(changed_since: nil)` lists this project's saved sessions
1660
+ (`ctx.project.root`'s; a session in no project lists the ones in none),
1661
+ newest updated first, archived ones included, never a scratch or test_run
1662
+ one: the listing `SessionStats.summaries` gives (reflect's counts read it
1663
+ too). Each file is parsed, so call it from your own thread, not every
1664
+ turn; `changed_since:` (a Time) parses only the files written after it.
1665
+ Read a row's messages with `read(id)`. `present_ids` is every saved
1666
+ session's id from the file names, nothing parsed (~2 ms): what an index of
1667
+ sessions keeps rows for (the knowledge bundle drops a deleted session's
1668
+ with it). Both need a chi newer than 0.194.0 (`chi bundle check` warns
1669
+ below that).
1575
1670
  - Each raises `Samagotchi::Plugin::Sessions::Error` with the reason.
1576
1671
 
1577
1672
  ## Attached context: `ctx.context`
@@ -1580,6 +1675,7 @@ ctx.sessions.stop(id) # one of this session's own children
1580
1675
  ctx.context.attach(url: "https://github.com/acme/app/pull/42", why: "branch feat/x has open PR #42")
1581
1676
  ctx.context.attach(name: "ci", cmd: "bin/ci-status", why: "this branch's CI", every_seconds: 120)
1582
1677
  ctx.context.list # => [{name:, scope:, why:, hint:, fetched_at:, error:, provider:, summary:}]
1678
+ ctx.context.snapshots # => [{name:, scope:, session_id:, hint:, revision:, fetched_at:, text:}]
1583
1679
  ctx.context.decline(url: "https://github.com/acme/app/pull/42") # => "pr-42"
1584
1680
  ctx.context.propose(url: "https://github.com/acme/app/pull/42", title: "#42 Make the thing", mentions: ["#42", "feat/x"])
1585
1681
  ctx.context.candidates # => [#<data Candidate name="pr-42", url="https://…", title="#42 Make the thing", …>]
@@ -1641,6 +1737,13 @@ gets a note when its text changes.
1641
1737
  the session has an id or its file is saved: a command before the first turn). `hint` is the
1642
1738
  one the last text gave (else the source's), `summary` that text's summary
1643
1739
  (nil before any text; chi 0.63.0).
1740
+ - `snapshots` (read-only) gives the latest texts of this project's sources
1741
+ and of the sources this project's sessions keep as their own (a session in
1742
+ no project: the sessions in none), project ones first, then by session id
1743
+ and name; `session_id` is nil for a project's. A source with no text yet
1744
+ is left out, and it never runs a command. It reads every snapshot file, so
1745
+ call it from your own thread (the knowledge bundle's context source does).
1746
+ Needs a chi newer than 0.194.0 (`chi bundle check` warns below that).
1644
1747
  - Two attaches of one source at once (a double click) both return its
1645
1748
  name.
1646
1749
  - `attach`, `decline` and `propose` raise
@@ -1661,12 +1764,13 @@ ctx.peers.last_message("claude") # the newest message still in the mailbox, or n
1661
1764
  ctx.peers.here("claude") # the live Claude Code sessions of this project that announced themselves (PeerHere)
1662
1765
  ctx.peers.pair("claude", address: "/tmp/…sock", from: "…", peer_session: "…") # => PeerPaired (status :paired, or a refusal)
1663
1766
  ctx.peers.unpair("claude") # => PeerUnpaired (unpaired:, waited:): ends the pairing and the wait
1664
- ctx.peers.wait("claude") # this session waits 10 min for one; .waiting(name): the wait (stale? until_at)
1767
+ ctx.peers.wait("claude", app: "Claude Code") # this session waits 10 min for one (app: the waiting chip's name); .waiting(name): the wait (stale? until_at)
1665
1768
  ctx.peers.claim("claude") # takes the wait before pairing against it (nil: none to take); .release(claim)
1666
1769
  ctx.peers.claimed?("claude") # another pairing holds the wait right now (a pair then writes nothing)
1667
1770
  ctx.panes.find(pid: 1234) # the kitty window a pid runs in (title, cwd), or nil
1668
1771
  ctx.panes.show(pane) # brings it to the front: only when ctx.user_typed? (else raises)
1669
1772
  ctx.panes.open(command: argv, cwd: dir, title: "…") # a background kitty tab: a PaneRef; only when ctx.user_typed?
1773
+ ctx.panes.open(command: argv, cwd: dir, title: "…", in: :pane) { |placed| … } # next to this session's chi terminal, else a tab
1670
1774
  ctx.panes.alive?(ref) # its window is still there
1671
1775
  ctx.panes.paste(ref, text, enter: true) # one bracketed paste, then Enter: only when ctx.user_typed? (false: gone)
1672
1776
  ctx.peers.stop_waiting("claude", mark) # ends the wait #wait returned, only while it is that one
@@ -1685,7 +1789,15 @@ and the session's wait (`wait`, `claim`). `ctx.panes`
1685
1789
  `ctx.user_typed?` (else `Plugin::Panes::NotTyped`), which is also what gates a
1686
1790
  write to another agent's settings. `open` raises
1687
1791
  `Samagotchi::Panes::Unavailable` when no kitty answers ("kitty isn't running or
1688
- `kitty.listen_on` isn't set"), its one refusal. Keep a `PaneRef` in your own
1792
+ `kitty.listen_on` isn't set"), its one refusal. With `in: :pane` (the next chi:
1793
+ on 0.194.0 the keyword is an `ArgumentError`, and so is any value but the
1794
+ symbols `:pane` and `:tab`, a string too) it opens a window next to this
1795
+ session's attached chi terminal in kitty, in that terminal's tab, and a
1796
+ background tab when there is none (a start from chi web with no TUI attached,
1797
+ a TUI outside kitty), that tab is in kitty's stack layout, or kitty refuses
1798
+ the launch there; the block, when given, gets a `Plugin::Panes::Placed`:
1799
+ `kind` `:pane` or `:tab`, and `why` a tab when a pane was asked for, in words
1800
+ for your reply. The return is the same `PaneRef` either way. Keep a `PaneRef` in your own
1689
1801
  session state (`ctx.session_dir`), never in the mailbox; `ctx.panes` takes a ref
1690
1802
  only on a socket `kitty.listen_on` names, and a caller checks what runs in the
1691
1803
  window before it pastes. The seam is an accident guard: no tool call, `chi send`,
@@ -1710,6 +1822,7 @@ context_providers:
1710
1822
  cmd: '{ruby} {bundle_dir}/scripts/pr_context.rb {url}'
1711
1823
  why: GitHub PR # optional
1712
1824
  every_seconds: 300 # optional, at least 30
1825
+ context_group: PRs # optional: the web's one chip for two or more of its sources
1713
1826
  ```
1714
1827
 
1715
1828
  - `scripts:` are files in the bundle's `scripts/` folder. Install copies them
@@ -1728,6 +1841,14 @@ context_providers:
1728
1841
  version), and a source already attached to one — before a chi downgrade,
1729
1842
  say — is refused by name, as a changed script is.
1730
1843
  - The command follows [the contract](context.md#the-command-contract).
1844
+ - `context_group:` (optional, one per bundle: a source records its bundle, not
1845
+ which provider made it) is a label of 1–16 characters on one line; anything
1846
+ else is refused at install and by `chi bundle check`. With it, two or more
1847
+ of the bundle's sources in a session are one chip in the web's session bar,
1848
+ `PRs 3 · 2m`, that lists them ([Attached context](context.md)); without it
1849
+ they never group. It is read from the installed bundle's kept
1850
+ `manifest.yml` when the list is read, so sources attached before the label
1851
+ existed group as soon as the bundle that names it is installed.
1731
1852
 
1732
1853
  ## Block renderers
1733
1854
 
@@ -1796,7 +1917,8 @@ pages: [schedules.rb] # scripts: keys named NAME.rb: the page NAME
1796
1917
  - The owner's own `NAME.rb` in the pages folder replaces a bundle's page, and a bundle's page can't be removed but
1797
1918
  by uninstalling the bundle ([Pages from a bundle](pages.md#pages-from-a-bundle)).
1798
1919
  - The script is a page script like any other: `page`, `ui` and `runtime` ([pages.md](pages.md)). The shipped
1799
- schedules bundle is the example (`lib/samagotchi/bundles/schedules/`).
1920
+ schedules bundle is the example (`lib/samagotchi/bundles/schedules/`); the reflect bundle
1921
+ (`lib/samagotchi/bundles/reflect/`) is a second, with `settings:` its page reads through `runtime.settings`.
1800
1922
 
1801
1923
  ## Stable for bundles
1802
1924
 
@@ -1850,7 +1972,7 @@ that calls it, or for a real external bundle that does. No method on the chance
1850
1972
  7. **The manifest schema**: the manifest's keys and shapes, as [A bundle with a plugin](#a-bundle-with-a-plugin)
1851
1973
  and [bundles.md](bundles.md) document them — `name`, `version`, `scope`, `description`, `files`, `hooks`,
1852
1974
  `trust_level`, `plugin`, `requires_chi`, `requires_chi_next` (shipped bundles only: the release tooling
1853
- reads it, chi doesn't), `needs`, `scripts`, `context_providers`, `block_renderers`, `pages`, `includes`,
1975
+ reads it, chi doesn't), `needs`, `scripts`, `context_providers`, `context_group`, `block_renderers`, `pages`, `includes`,
1854
1976
  `session_settings`, `settings`. Those are `BundleManifest::KEYS`; `BundleManifest::SINCE` is the chi release each
1855
1977
  key or shape first worked in, and the docs don't copy it — the code is its truth.
1856
1978
  - A key keeps its meaning. A new key gets a `SINCE` entry and a CHANGELOG line, and an older chi says
@@ -1865,7 +1987,9 @@ that calls it, or for a real external bundle that does. No method on the chance
1865
1987
  - `pages:` and the page script DSL a bundle's page (or anyone's) is written in: `page`, `ui.text` / `ui.table` /
1866
1988
  `ui.walk`, and `runtime` with what it returns (`runtime.schedules`: its members, `rows`, `warning`,
1867
1989
  `unreadable_ids`, `Pages::Runtime::Unreadable`) ([pages.md](pages.md)). A page runs in the page runner, not as a
1868
- plugin, so the scan below doesn't see it either.
1990
+ plugin, so the scan below doesn't see it either. `runtime.sessions(project:)`, `runtime.turn_excerpts`,
1991
+ `runtime.launch_dir` and `runtime.settings` are **experimental**: their members may still change
1992
+ ([pages.md](pages.md#reading-chis-data-runtime)).
1869
1993
 
1870
1994
  `Samagotchi::Testing::Boundary::ALLOWED` is the checked copy of items 1-6,
1871
1995
  and `Boundary::EXCEPTIONS` the per-bundle list of what each shipped bundle
@@ -1904,7 +2028,8 @@ bundle.command("/tone x", confirm: true) # sent from a web tab o
1904
2028
  bundle.set(history: true, context_tokens: 900) # a model reply to restart (ctx.cache_confirm), its size
1905
2029
  bundle.set(model_names: %w[tiny box:gemma gemma]) # ctx.model_names (default: model_name and its id)
1906
2030
  bundle.prompt_text # the prompt sections' text, as a build runs them
1907
- bundle.tool("my_tool", path: "a.txt") # → the text the model reads
2031
+ bundle.tool("my_tool", path: "a.txt") # → the text the model reads (no guardrails: the handler as given)
2032
+ bundle.tools["my_tool"].participant # its participant: (:allow, :deny): what the pair boundary reads
1908
2033
  verdict = bundle.tool_call({ name: "execute", content: "rm -rf /" })
1909
2034
  verdict.deny? # a real Guardrails::Verdict (votes: verdict.votes)
1910
2035
  bundle.notices.map(&:text) # also cards, steers, stops, generation_stops, questions
@@ -1921,6 +2046,7 @@ bundle.http.stub(:post, "http://127.0.0.1:9000/classify", json: { label: "safe"
1921
2046
  bundle.set(running: false) # the session's values: cwd:, messages:, cancelled: …
1922
2047
  bundle.set(declared_tools: %w[read]) # ctx.declared_tools (default: every tool, as on full)
1923
2048
  bundle.set(cost: 2.5) # ctx.cost: reported USD, or { reported:, estimated:, side:, known: }
2049
+ bundle.chips["cap"]["label"] # ctx.chips, in memory; bundle.chip_writes counts the changes written
1924
2050
  bundle.set(usage: { tool_calls: 40, active_ms: 600_000 }) # ctx.usage: { turns:, tool_calls:, tool_calls_by_tool:, steps:, active_ms:, tool_ms_by_tool: }
1925
2051
  bundle.set(turn_author: "p:p_0123abcd") # a participant's turn: ctx.turn_author, and author: on every event
1926
2052
  bundle.set(turn_interactive: false) # ctx.turn_interactive? (default true: the owner's turn from a screen)
data/docs/releasing.md CHANGED
@@ -13,7 +13,7 @@ can run the whole release; the user approves the notes before the tag and the
13
13
  and `rake release:check` enforce it). The system bundle upgrades itself when
14
14
  chi starts.
15
15
  - **Every other shipped bundle** (btw, check-in, guardrails, known-names,
16
- loop-guard, mcp, skills, slow-commands, agents-md, cost-cap, work-cap, source-links, github-pr, coordinator, claude-peer, codex-peer, ruby, model-notes, decision-card, inline-widgets, web-search, schedules, and the profiles core and dev) has its own semver in its
16
+ loop-guard, mcp, skills, slow-commands, agents-md, cost-cap, work-cap, source-links, github-pr, coordinator, claude-peer, codex-peer, ruby, model-notes, decision-card, inline-widgets, knowledge, web-search, schedules, reflect, and the profiles core and dev) has its own semver in its
17
17
  `manifest.yml` and, when it needs a newer chi, a `requires_chi:` line. They never upgrade by themselves: users run
18
18
  `chi update` (all of them, with the gem) or `chi bundle upgrade NAME`. So:
19
19
  - a change to a bundle's files bumps that bundle's `version:`
data/docs/scheduling.md CHANGED
@@ -93,6 +93,10 @@ the fold. If a local moment does not exist (a spring-forward gap), it fires at t
93
93
  next valid minute. Schedules use the machine's local clock; there are no named
94
94
  time zones.
95
95
 
96
+ A daily chain, for example a project's nightly reflect ([bundles.md](bundles.md#a-nightly-reflect-session)):
97
+ `chi schedule add --session <ID> --every 1d --title "reflect <project>" --keep-links 14 --max-skips 288 -m "Reflect
98
+ on this project's last day: follow skill_reflect."`, run at the hour you want it to fire.
99
+
96
100
  `catch_up` says what an overdue entry does when the tick arrives after its moment:
97
101
 
98
102
  - `once` (default): fire once now, then reschedule normally.
data/docs/sessions.md CHANGED
@@ -87,6 +87,13 @@ order: `recap`, else the asking bundle's name). It has no records: the block its
87
87
  by the turn's end during one) and loaded; it is never in `tokens` or `model_segments`. `chi sessions stats --format
88
88
  json` has it in `metrics.side`; a file without it (older, or no side requests) has none.
89
89
 
90
+ Two read-only readers outside the worker read the session file, `analytics.json` and `cards.json` too: `SessionStats`
91
+ (a page's `runtime.sessions`: counts) and `TurnExcerpts` (`runtime.turn_excerpts`: a turn's failing calls), both
92
+ treating every field as optional ([pages.md](pages.md#reading-chis-data-runtime)). A shape change to those files must
93
+ keep them working (`spec/session_stats_spec.rb`, `spec/turn_excerpts_spec.rb`). `SessionStats.summaries` (archived
94
+ included, no test_run or scratch session, by project) is the one listing both its counts and the knowledge bundle's
95
+ sessions source (`ctx.sessions.list`) read; `Session.list(changed_since:)` skips an unchanged file before parsing it.
96
+
90
97
  Each turn record in `analytics.json` names the model the turn ran on as `model_ref` (the asked `host:model`, from its first generation; `model` stays the name the server says it served); a turn stopped before it asked a model has none. The first turn after a `/model` switch (or a hook's) to another model also records what its first generation prefilled on the new model: `switch_prefill_tokens` (the prompt less the cached reads; none under 128 tokens, or for a generation with estimated counts) and `switch_prefill_cost_estimate` (from the new model's configured price, no completion; none without a price). A session saved before this has no `model_ref` on its records.
91
98
 
92
99
  A session whose worker waits for an answer (a question, a hook's question, a guardrail approval, or the step-limit question of a turn that ran out of steps, which waits between turns) reads `waiting` in the status column, and json has `waiting: "question"|"approval"|"hook"|"continue"` and `waiting_id`, the question's id for `chi answer --question` (both null otherwise). A delegate's approval its parent relayed to its own card (see *Delegating*) reads `waiting (in parent ab12)`, json `relayed_to: "ab12…"` (the parent's short id, else null). Only while a worker runs it: a question a dead worker left in the file shows the saved status. Answer it with `chi answer`, the web or `chi --attach ID`; `chi sessions stop ID` frees the worker instead.
@@ -172,7 +179,7 @@ chi sessions clean --dry-run --days 7 # test sessions older than 7 da
172
179
  | `working_set_pins` | The working-set items the user pinned (`/working-set pin`); kept by a respawn, a continue and a fork. | the Engine's command |
173
180
  | `review` | An older chi's review session's subjects and source (`SessionReview`), kept as written, never read: see [Older review sessions](#older-review-sessions). | an older chi |
174
181
  | `first_turn_id` | The id the creating prompt's turn gets, so a wait can name it (`chi send --new --wait`, `--wait --turn T ID`); `null` for a session created idle. | `SessionManager.spawn_session` |
175
- | `first_turn_client_id` | Who sent the creating prompt when no person did (`delegate:<parent8>` for a delegate's task, `system:schedule:<id>` for a chain schedule's link): that first turn's origin, so its line is no command of the owner's (docs/guardrails.md, Who may run a session command) and `last_turn` names the sender. Written only when set; not carried by a fork, a continue or a delegate. An older chi keeps it but runs the first prompt as a person's. | `SessionManager.spawn_session` (its `client_id:`) |
182
+ | `first_turn_client_id` | Who sent the creating prompt: any sender that is no human's (`delegate:<parent8>` for a delegate's task, `system:schedule:<id>` for a chain schedule's link, `agent:<name>`) and an interactive one (a web tab's `web:…`, a TUI's `tui:…`); none for `chi send --new`, an idle create, and a file from before interactive ids were kept: that first turn's origin, so its line is no command of the owner's (docs/guardrails.md, Who may run a session command) and `last_turn` names the sender. Written only when set; not carried by a fork, a continue or a delegate. An older chi keeps it but runs the first prompt as a person's. | `SessionManager.spawn_session` (its `client_id:`) |
176
183
  | `verify_fresh` | A Verify fresh child's requester, rules and claim (`VerifyFreshOrigin`). | `VerifyFresh.start`, once |
177
184
 
178
185
  ## Context notes
@@ -405,7 +412,7 @@ A session can **continue** an earlier one: "the next run of the same routine" (a
405
412
  - **If the continue fails part-way:** what a continue carries (its delegates, attached context, objectives and notes, in that order) and how each is given back is one list, `SessionContinue::CARRY` (the per-session stores it leaves behind, and why, are `SessionContinue::NOT_CARRIED`). A new link that fails to start gives its moved delegates back before it is deleted (each gets a note saying so; its worker is stopped first, if one started, and a worker that won't stop is reported, the link left), with any report one of them rang it with meanwhile, and the notes it moved with any sent to it meanwhile (never the continue's own: the carry note, the attached-context note, the objectives' list): its session file goes first, so a note sent to the previous link from then on stays there, then the notes go back, then its folder goes, and a note an older chi writes into it after that is given back too (a note for a session with no file and no folder is refused, never a stray folder); the previous link, back in the lists, is woken for reports waiting. A continue that dies in the middle leaves a `move.json` in the new link's folder: the new link's next worker finishes that move (only the delegates it names, and without a second note to one already told) as it starts. Its `continue.json` intent remains in the previous link's folder too, so a later list can restore it if the successor was never saved. Until the new link's own worker holds it, a ring from a moved delegate doesn't start another (a `starting` marker in its folder, which that worker removes; a stale one, over 60 s old or from a process that is gone, is ignored). An open delegate below an archived delegate refuses the continue (`under archived …`): unarchive that one, or archive this one.
406
413
  - **Refused too:** a link that is continued already (`session 3f9a1c2e was continued as 7b2d41aa-…; continue that one (or last:3f9a1c2e)`; a schedule's anchor whose successor a prune deleted counts as continued by the schedule's head, so no second line starts beside the chain), a previous link whose folder is gone, and one whose model's host can't run it when no default model is configured to fall back to. A refusal starts nothing and archives nothing; a new link that fails to start puts back what was archived. Every refusal that can be known up front (the archive's ones included) comes before the recap wait. One continue of a session runs at a time (a lock in its folder; other chains don't wait), so a double click finds the first one's link and is refused, while a `last:<id>` continue that waited follows the chain to its new end.
407
414
  - **Web:** `POST /api/sessions` takes `continues: "<id, prefix or last:id>"`, with `idle: true` (a new link waiting for its first message, previewed by the previous link's, or `preview`) or a `prompt`, and `model` (or `model_name`) for the new link's model, but not `dir`, `llm_context`, `thinking`, `settings`, `toolkit`, `tools`, `no_tools` or `parent_answers` (400 `invalid_continues`: the previous link's are taken). 201 is the new session's summary, `continues` set, with `moved`: the ids of the delegates that moved to it (`[]` for none), and `model_warning`: the default-model fallback's warning, then any about the model id, joined by `; ` (`null` for none), and `opener`: the previous link's first typed message, in full, when that link continues one itself (`null` otherwise: a chain's first link's first message is its task), and `moved_context`: `{moved: [names], stayed: [{name, why}]}`, the attached context it took (`why` `pushed` or `not movable`); 404 `not_found`; 400 `ambiguous_id` for a prefix of several sessions, `invalid_model` for a given model whose host config.yml doesn't have (or a fallback with no default model); 409 `continued` with `next_id` (the link that continues it already, which the page opens instead), `open_children` with `ids` (open delegates that can't move), `folder_gone`, `transition_busy` (another continue or change of it held its transition lock past 10 s), `busy`, `scratch` or `owned_by_tui`. Every session summary carries `continues`.
408
- - **The page:** the info bar's `continue →` continues the open session (`continues: <id>, idle: true`; it reads `continuing…` through the recap wait) and opens the new link with the session's draft in its composer (text typed while it waited too, images included), or with none an opener, not sent; the draft moves to the new link even when another session is open as it lands (that session keeps its own; the toast's Open shows the link): the opener is the previous link's own first typed message when that link continues one (the 201's `opener`; a `!shell` line isn't taken), else `Continue where we left off.`. So whatever you sent on the last link comes back on the next one, and editing it once changes it for every later link; the previous link is archived, a toast says so (`Continued 3fa2c1d0 in 4b7e9a01; 3fa2c1d0 is archived; 1 open delegate moved`), and a moved delegate's card folds under the new link. When the previous link's model's host is gone the link starts on the default model and the toast carries the server's `model_warning` too, and then stays until closed. A fresh link (one with no turn yet, however it was made: `continue →`, `chi send --new --continues`, a reload) shows the model picker in its composer with the link's model, until its first turn starts (a failed or canceled first turn ends it too); a pick runs `/model <name>` in the link (a command bubble; the info bar follows) and changes neither the start page's remembered model nor its Recent list, and a Send right after it waits for the `/model` to be taken. A link a one-turn `chi --non-interactive` run has, or one continued already, shows none. A link continued already has no `continue →`: its `→` link goes to the next link (a stale page's continue answered 409 `continued` opens `next_id`). A continue refused for open delegates that can't move shows a toast that names each one (its preview and what the server says to do: `older chi worker 0.46.1; restart it`, `in use by a one-turn chi --non-interactive run or an older chi's terminal; let it finish`), each a link to its page; any other refusal shows the server's words. The info bar of a link carries `← 2026-10-08` (the previous link's day) and, on an earlier link, `2026-10-10 →`, each a link with its id, its full start (`2026-10-10 14:32`) and its preview in the tooltip; a neighbour that started on the open link's own day shows its time instead (`← 09:12`, `14:32 →`). A link made by `continue →` inherits the previous link's preview (and its title, if it has one) when it is created, so its card keeps its chain's title whatever opener it is sent, and its top bar and browser tab show its card's title. A link with a recap of its own reads its auto title, else its recap's first sentence, instead (a link without one reads its chain's name, and a first link's recap names its chain). A link whose title is the opener and nothing else (a `chi send --new --continues` link whose first message is `Continue where we left off.`) shows its chain's first link's title instead, on its card, in the popover and in its info bar's title line, display only (its messages and data keep the opener; its own title when the first link is gone). The lists fold a chain into the card of its latest listed link, whatever the earlier links' archived state (typing in an archived link brings it back, folded there still), their delegates with them: the card's `↩ #N` chip (`#N of M` when later links aren't listed; its tooltip `Session chain: link N of M`) opens a popover of the other links, newest first (`#N`, its date, with its time (`2026-10-17 14:32`) when another link of the chain started the same day, its own title when it differs from the card's (a link inherits its chain's, so mostly it doesn't), else its recap's first sentence, else its preview, `archived`), a click opens one; the chip shows a live dot or `waiting` for a link that has a worker or waits on the user, and a waiting link puts its chain's card first. All sessions folds nothing while a search is typed or the `archived` toggle is on: every link is a card of its own then, its chip `#N of M`, with its own delegates folded in, so a search finds an earlier link and its delegates.
415
+ - **The page:** the info bar's `continue →` continues the open session (`continues: <id>, idle: true`; it reads `continuing…` through the recap wait) and opens the new link with the session's draft in its composer (text typed while it waited too, images included), or with none an opener, not sent; the draft moves to the new link even when another session is open as it lands (that session keeps its own; the toast's Open shows the link); a continue made anywhere else (a terminal's `/continue`, a chain schedule, `chi send --new --continues`, another tab) moves the draft to the chain's newest link the same way, without an opener, once that session isn't on view (while it is, the box keeps the text until you leave it), and a next link with a draft of its own keeps it: the opener is the previous link's own first typed message when that link continues one (the 201's `opener`; a `!shell` line isn't taken), else `Continue where we left off.`. So whatever you sent on the last link comes back on the next one, and editing it once changes it for every later link; the previous link is archived, a toast says so (`Continued 3fa2c1d0 in 4b7e9a01; 3fa2c1d0 is archived; 1 open delegate moved`), and a moved delegate's card folds under the new link. When the previous link's model's host is gone the link starts on the default model and the toast carries the server's `model_warning` too, and then stays until closed. A fresh link (one with no turn yet, however it was made: `continue →`, `chi send --new --continues`, a reload) shows the model picker in its composer with the link's model, until its first turn starts (a failed or canceled first turn ends it too); a pick runs `/model <name>` in the link (a command bubble; the info bar follows) and changes neither the start page's remembered model nor its Recent list, and a Send right after it waits for the `/model` to be taken. A link a one-turn `chi --non-interactive` run has, or one continued already, shows none. A link continued already has no `continue →`: its `→` link goes to the next link (a stale page's continue answered 409 `continued` opens `next_id`). A continue refused for open delegates that can't move shows a toast that names each one (its preview and what the server says to do: `older chi worker 0.46.1; restart it`, `in use by a one-turn chi --non-interactive run or an older chi's terminal; let it finish`), each a link to its page; any other refusal shows the server's words. The info bar of a link carries `← 2026-10-08` (the previous link's day) and, on an earlier link, `2026-10-10 →`, each a link with its id, its full start (`2026-10-10 14:32`) and its preview in the tooltip; a neighbour that started on the open link's own day shows its time instead (`← 09:12`, `14:32 →`). A link made by `continue →` inherits the previous link's preview (and its title, if it has one) when it is created, so its card keeps its chain's title whatever opener it is sent, and its top bar and browser tab show its card's title. A link with a recap of its own reads its auto title, else its recap's first sentence, instead (a link without one reads its chain's name, and a first link's recap names its chain). A link whose title is the opener and nothing else (a `chi send --new --continues` link whose first message is `Continue where we left off.`) shows its chain's first link's title instead, on its card, in the popover and in its info bar's title line, display only (its messages and data keep the opener; its own title when the first link is gone). The lists fold a chain into the card of its latest listed link, whatever the earlier links' archived state (typing in an archived link brings it back, folded there still), their delegates with them: the card's `↩ #N` chip (`#N of M` when later links aren't listed; its tooltip `Session chain: link N of M`) opens a popover of the other links, newest first (`#N`, its date, with its time (`2026-10-17 14:32`) when another link of the chain started the same day, its own title when it differs from the card's (a link inherits its chain's, so mostly it doesn't), else its recap's first sentence, else its preview, `archived`), a click opens one; the chip shows a live dot or `waiting` for a link that has a worker or waits on the user, and a waiting link puts its chain's card first. All sessions folds nothing while a search is typed or the `archived` toggle is on: every link is a card of its own then, its chip `#N of M`, with its own delegates folded in, so a search finds an earlier link and its delegates.
409
416
  - **CLI:** `chi send --new --continues (ID|PREFIX|last:ID) [--model M] [-m TEXT]` (see *Starting a session*).
410
417
  - **Which link:** an id, a unique prefix, or `last:<id or prefix>`, the latest link of the chain that session is in. It walks the links that still exist: a deleted link in the middle (`chi sessions delete`, the retention sweep of an unarchived one) ends the walk before it, so `last:` of an earlier link then names that earlier link, and continuing it starts a second line beside the links after the gap; name a link after the gap instead. The one exception is a schedule's anchor (below). A trigger names the chain this way: a person's message to an archived link that nobody continued brings it back (a human's input), it doesn't continue the chain; an unattended sender's is refused (*Who may wake a session*). That is the rule: `chi send` and a note go to the chain's newest link (*Sending a message*, *Context notes*); the web composer, a participant's turn and `delegate(session:)` go to the link they name. One walker answers every one of these (`SessionChain::Links`: one session listing, archive flags read once; the earliest created successor wins a fork a hand edit made, a loop ends where it would repeat), with two rules on it, not unified on purpose: `last:` and a schedule take the chain's **end** (`Links#latest`: a continue refuses a link continued already, and a schedule never un-archives a chain you retired), `chi send` and a note the **first link not archived** (`Links#first_live`: a person's input goes where the chain is live, and brings back an archived end). A chain pruned by a schedule keeps its `anchor`, and the prune deletes the links behind its window, the anchor's successor among them, so nobody continues the anchor any more. The addressing walks bridge that gap: at an archived link nobody continues, `last:`, `chi send`, a note and the peer/context refusals' `next_id` go on at the head of a schedule anchored there (`Links#anchor_forward`; the first entry in `schedules.json` whose head still exists and isn't the anchor, disabled ones too), so `last:<anchor>` names the chain's end and a send to the anchor reaches the live link (`3f9a1c2e → 7b2d41aa (continued)`), as for any continued link; a continue of the anchor itself (without `last:`) is refused as continued already, naming the head. The graph stays raw: `next_of`, the chain's links (`Links#chain`: the anchor alone), the deletes and a delegate's ring never cross the gap. With the head gone (no forward) the walk stops at the anchor, as before; an anchor a person's send brought back before this (no longer archived) isn't bridged either. Backward, the kept window's oldest link still names a link that is gone, so the walk back stops there; the page's chip counts from the surviving root (pruning renumbers the links) and its popover says `earlier links pruned` where the walk stops, rather than linking to a deleted session.
411
418
  - **Deleting a link** (`SessionChain::Delete`; the CLI, the web and `/exit --delete`): a link of a chain is deleted alone by default, and what follows depends on where it is. **The newest link** (nobody continues it, it isn't archived itself, the link before it is archived) undoes its continue: the delegates the continue moved go back to the previous link, finished ones too (`continued_from.json`'s `moved_ids`, still under the link; without the record, its children whose `parent.json` says they came from the previous link), each with a note saying the link was deleted; every note waiting in the link but the continue's own goes back too (`NoteMove.give_back`); then the previous link and what the continue archived with it come back to the lists (without the record, the previous link alone). The previous link is **not started**: reports a moved-back delegate left wait for its next start. What dies with the link: its turns, context sources, objectives edits, session approvals and participant grants (the previous link kept its own copies). Every refusal comes before anything goes: the link's delegates that would go are checked too (a schedule on one through `SessionProtection.hold`, a one-turn run), and they and the link are removed (and the undo runs) only under their `owner.lock`s (kind deleting, taken without waiting, so a worker that took one refuses it); a moved delegate that can't go back (`ChildMove.unmovable`: an older chi's worker, a one-turn run) refuses it (`delegate_unmovable`, naming it), as does a worker that took the link after the stop. Deleting the links one after another undoes each continue by its own record. **A middle link** splits the chain (the earlier links stay archived, the later ones go on as their own chain); nothing is undone or re-linked. A link whose chain is all archived stays archived around the gap. **The link's own delegates** (any position) follow one rule, `SessionManager::DELEGATES` (`SessionManager::DelegateRule`; one shared preview row snapshot): a running one (a worker owns it or is starting for it, a one-turn run; a saved `running` with no worker is a crashed run, and goes) is left running with its whole subtree, its file untouched (its parent's id names a deleted session; its reports are refused as for any gone parent); every other node under the link goes, deepest first, before the link. A session in no chain (a link alone past a gap too) is a link with nothing to undo: its delegates follow the same rule (*Deleting a session*). **The web asks first**: chi web's delete sheet reads `GET /api/sessions/:id/delete_plan` (`:owner`; no query or body; no-store) for any session, `SessionChain::Delete::Preview` over the same `LinkPlan`/`ChainPlan` and checks the delete runs (`check_link!`, `check_chain!`): the link's place in the chain, what comes back and goes for each choice, and each choice's refusal now (a schedule on the chain, the link or a delegate that would go, a continue under way, a one-turn run, a moved delegate that can't go back and whether the page can stop it). A session in no chain answers `{chained: false, session_id, link}`, the same `link` a chained one gets (`previous_id` null, `earlier`/`later` 0, `next_id` null); an older page reads only `chained`. Each choice (`link`, `chain`) also carries `delegates` (`{delete: [ids], leave: [{id, running}]}`; `running` false for a stopped session left under a running delegate, beside the counts `deletes` and `left_running`), `tasks` (`{running, unverified, unreadable}`: `RunningTasks.of` the ids the choice deletes) and `worker` (a link's: `"turn"` when a worker owns it and a turn runs, `"idle"` when a worker owns it or is starting, null; a chain's `{idle, turn}` counts over its links). No titles: the page names each id from its own list. One shared session-row snapshot serves the link and chain choices; Links lists on its own, and a folder whose session file is gone answers too (the delete still takes it). Each call read-only checks each link's continue lock (a session in no chain too), and writes nothing else but the listing's own repair of an interrupted continue; an unknown id is the usual 404. chi web lists `delete_plan_all` in `/api/info`'s features (`Web::App::DELETE_PLAN_FEATURE`). **The tap stops only what the sheet named**: whenever the choice lists any task, the page sends `stop_tasks=true&tasks=<id,id>`, the choice's running ids (`tasks=` when it has only unverified or unreadable records, which a stop never signals, so such a session can still be deleted); archive's sheet sends `{"stop_tasks": true, "tasks": [ids]}` in its body. `tasks` works only with `stop_tasks`; without it, it is ignored, and `stop_tasks` without `tasks` (the CLI's `--stop-tasks`, an older page) takes every running task the operation can stop. A running task not named refuses (`tasks_running`), and the sheet reads the plan again and shows it with "changed; check again". A chain stops link by link: a link refused that way leaves it and the earlier links whole. The moved count is each moved delegate with its subtree (they come back with it), and a `delegate_unmovable` 409 says `stoppable` itself. Each choice carries a `digest` (`SessionChain::Delete.digest`: the sorted ids it deletes, leaves, revives and moves back); the sheet's DELETE sends it as `expect=`, and the delete compares it with the plan it runs (a link's under its holds, as `delete_link` starts; the chain's before its checks) and refuses `plan_changed` (409) before anything changes; a session in no chain is compared the same way (a sheet shown for a link whose chain is gone since deletes when its ids still match). Without `expect` (the CLI, an older page) it deletes as it plans then.
data/docs/system-one.md CHANGED
@@ -106,7 +106,9 @@ Later lines name their run by `run_id` and may sit in a later day's file, or in
106
106
  the run: a join happens at read, and a line whose run is gone is dropped.
107
107
 
108
108
  - `label` {`value`, `by`, `strength`, `question`, `at`}.
109
- - Approvals (`SystemOne::ApprovalLabel`, the one reading of an answer for the log and the run):
109
+ - Approvals (`SystemOne::ApprovalLabel`, the one reading of an answer for the log and the run; its
110
+ `ApprovalLabel.choice(index, scopes)`, in `system_one/approval_choice.rb` with no requires, is the chosen scope
111
+ as the value, shared with `chi guardrails replay` and `SessionStats`):
110
112
  `allow_once`, `allow_wide`, `deny` by `user`, strong; `should_have_asked` from `/guardrails wrong` or the
111
113
  web's **should have asked**, strong; `deny` by `parent`, weak, only where the parent could have allowed; a
112
114
  parent's allow is no label; `none` for a cancelled ask, which is not an answer.
data/docs/testing.md CHANGED
@@ -56,7 +56,9 @@ chose spawn with `GitEnv::UNSET`, in any run.
56
56
  `chi web --tunnel tailscale` spec writes a fake one and sets the variable.
57
57
  No spec reaches a running kitty either (Panes opens tabs and pastes into windows): the spec config has no
58
58
  `kitty.listen_on` and `spec_helper.rb` drops `SAMAGOTCHI_KITTY_LISTEN_ON`; a pane spec stubs `Config.get("kitty.*")`
59
- with `spec/fixtures/desktop/fake_kitty` (`ls`, `launch`, `focus-window`, `send-text`, `send-key`).
59
+ with `spec/fixtures/desktop/fake_kitty` (`ls`, `launch`, `focus-window`, `send-text`, `send-key`). It drops
60
+ `KITTY_WINDOW_ID` too, so an attached TUI a spec runs never marks the developer's kitty window (the `chi_session`
61
+ user var, [internals/panes.md](internals/panes.md)).
60
62
 
61
63
  Goldens (`*_golden_spec.rb`, the prompt snapshots) hold no machine state, so they pass on any runner: no absolute
62
64
  paths (replace them with placeholders), no PATH tools (the suite pins `rg` as found, `spec_helper.rb`; an example
@@ -48,6 +48,9 @@ module Samagotchi
48
48
  # cmd: '{ruby} {bundle_dir}/scripts/pr_context.rb {url}'
49
49
  # why: GitHub PR # optional
50
50
  # every_seconds: 300 # optional
51
+ # context_group: PRs # optional — the label of one chip the web's
52
+ # # session bar folds two or more of this
53
+ # # bundle's sources into (1–16 characters)
51
54
  # block_renderers: # optional — a fence's language → the scripts/
52
55
  # - lang: mermaid # files chi web's page loads to draw it
53
56
  # load: [lib.js, draw.js] # (BlockRenderers); each one a scripts: key
@@ -113,7 +116,7 @@ module Samagotchi
113
116
  # here is one this chi ignores: #unknown_keys, which `chi bundle check`
114
117
  # and the Installer say.
115
118
  KEYS = %w[name version scope description files hooks trust_level plugin requires_chi requires_chi_next needs
116
- scripts context_providers block_renderers pages includes session_settings settings].freeze
119
+ scripts context_providers context_group block_renderers pages includes session_settings settings].freeze
117
120
 
118
121
  # The first chi release that reads each manifest key or shape (from git:
119
122
  # the first tag whose manifest.rb reads it), for `chi bundle check`'s
@@ -137,13 +140,14 @@ module Samagotchi
137
140
  "block_renderers" => "0.151.0",
138
141
  "plugin.required" => "0.157.0",
139
142
  "plugin.parts" => "0.183.0",
140
- "pages" => "0.189.0"
143
+ "pages" => "0.189.0",
144
+ "context_group" => "0.196.0"
141
145
  }.freeze
142
146
 
143
147
  # files: name → "sha256:<hex>" (both forms); file_descriptions: name →
144
148
  # the description a mapping gave, for the files that have one.
145
149
  attr_reader :name, :version, :scope, :description, :files, :file_descriptions, :trust_level, :plugin, :requires_chi, :needs, :includes,
146
- :scripts, :context_providers, :block_renderers, :pages, :session_settings, :session_setting_types, :settings, :setting_types, :unknown_keys
150
+ :scripts, :context_providers, :context_group, :block_renderers, :pages, :session_settings, :session_setting_types, :settings, :setting_types, :unknown_keys
147
151
 
148
152
  def initialize(path:)
149
153
  @path = path
@@ -173,6 +177,7 @@ module Samagotchi
173
177
  @needs = self.class.parse_needs(raw["needs"])
174
178
  @scripts = parse_scripts(raw["scripts"])
175
179
  @context_providers = parse_context_providers(raw["context_providers"])
180
+ @context_group = self.class.parse_context_group(raw["context_group"])
176
181
  @block_renderers = parse_block_renderers(raw["block_renderers"])
177
182
  @pages = parse_pages(raw["pages"])
178
183
  @includes = parse_includes(raw["includes"])
@@ -206,7 +211,7 @@ module Samagotchi
206
211
  # that key, which reads as empty with its message in the problems:
207
212
  # name, version (never checked: identity is the record's), scope;
208
213
  # files and their descriptions, scripts, plugin (hooks: is ignored,
209
- # HooksRetired); needs, context_providers; block_renderers and pages
214
+ # HooksRetired); needs, context_providers, context_group; block_renderers and pages
210
215
  # (against +fallback_scripts+ when scripts: failed); includes (after
211
216
  # what its check reads); session_settings with its types, settings
212
217
  # with theirs (one raw value each, so one problem); requires_chi,
@@ -309,6 +314,7 @@ module Samagotchi
309
314
  found["includes"] = SINCE["includes"] unless @includes.empty?
310
315
  found["scripts"] = SINCE["scripts"] unless @scripts.empty?
311
316
  found["context_providers"] = SINCE["context_providers"] unless @context_providers.empty?
317
+ found["context_group"] = SINCE["context_group"] if @context_group && SINCE.key?("context_group")
312
318
  found["block_renderers"] = SINCE["block_renderers"] unless @block_renderers.empty?
313
319
  found["pages"] = SINCE["pages"] if !@pages.empty? && SINCE.key?("pages")
314
320
  found["plugin.required"] = SINCE["plugin.required"] if @plugin&.dig(:required) && SINCE.key?("plugin.required")
@@ -324,7 +330,7 @@ module Samagotchi
324
330
  # Writes a fresh manifest.yml from computed checksums at `dir`.
325
331
  # +file_descriptions+ (name → text) writes those files as mappings.
326
332
  def self.write(dir:, name:, version:, files:, scope: nil, description: "", trust_level: nil,
327
- plugin: nil, requires_chi: nil, needs: nil, scripts: {}, context_providers: [], block_renderers: [], file_descriptions: {},
333
+ plugin: nil, requires_chi: nil, needs: nil, scripts: {}, context_providers: [], context_group: nil, block_renderers: [], file_descriptions: {},
328
334
  session_settings: [], session_setting_types: {}, settings: nil, setting_types: {}, pages: [])
329
335
  FileUtils.mkdir_p(dir)
330
336
  manifest = {
@@ -350,6 +356,7 @@ module Samagotchi
350
356
  manifest["needs"] = needs.map { |n| n.transform_keys(&:to_s).compact } unless needs.empty?
351
357
  manifest["scripts"] = scripts.transform_keys(&:to_s) unless scripts.empty?
352
358
  manifest["context_providers"] = context_providers.map(&:to_h) unless context_providers.empty?
359
+ manifest["context_group"] = context_group.to_s if context_group
353
360
  manifest["block_renderers"] = block_renderers.map(&:to_h) unless block_renderers.empty?
354
361
  manifest["pages"] = pages.map(&:to_s) unless pages.empty?
355
362
  manifest["session_settings"] = session_settings_entry(session_settings, session_setting_types) unless Array(session_settings).empty?
@@ -404,6 +411,23 @@ module Samagotchi
404
411
  keys.to_h { |key| [key, types[key] || "any"] }
405
412
  end
406
413
 
414
+ # The longest context_group: label (a chip's few words).
415
+ CONTEXT_GROUP_MAX = 16
416
+
417
+ # context_group: → the label, stripped; nil when absent. Anything but a
418
+ # one-line string of 1–CONTEXT_GROUP_MAX characters is a ValidationError.
419
+ def self.parse_context_group(raw)
420
+ return nil if raw.nil?
421
+ raise ValidationError, "context_group: must be a short label, not #{raw.inspect}" unless raw.is_a?(String)
422
+
423
+ label = raw.strip
424
+ if label.empty? || label.length > CONTEXT_GROUP_MAX || label.match?(/[[:cntrl:]]/)
425
+ raise ValidationError, "context_group: #{raw.inspect} isn't a one-line label of 1–#{CONTEXT_GROUP_MAX} characters"
426
+ end
427
+
428
+ label
429
+ end
430
+
407
431
  # needs: → [{command:, why:, hint:}] (why/hint a String or nil), [] when
408
432
  # absent. Takes the manifest's string-keyed YAML or the symbol-keyed
409
433
  # form provenance stores. Duplicates merge (the first one's why/hint
@@ -458,6 +482,7 @@ module Samagotchi
458
482
  # An old kept manifest's hooks: is no problem: it isn't read (HooksRetired).
459
483
  @needs = tolerate(problems, "needs", []) { self.class.parse_needs(raw["needs"]) }
460
484
  @context_providers = tolerate(problems, "context_providers", []) { parse_context_providers(raw["context_providers"]) }
485
+ @context_group = tolerate(problems, "context_group", nil) { self.class.parse_context_group(raw["context_group"]) }
461
486
  script_names = problems.key?("scripts") ? fallback_scripts.map(&:to_s) : @scripts.keys
462
487
  @block_renderers = tolerate(problems, "block_renderers", []) { parse_block_renderers(raw["block_renderers"], script_names) }
463
488
  @pages = tolerate(problems, "pages", []) { parse_pages(raw["pages"], script_names) }
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: claude-peer
3
- version: 0.9.0
3
+ version: 0.10.0
4
4
  scope: system
5
5
  description: "Pair this session with a Claude Code session you work with: the claude_send tool and /claude send it a part of the work (a plan step, a diff, a finding) to validate or as context, and Claude's answer comes back as a message with its text (chi peer say); /claude install-skill installs Claude's chi-peer skill, which pairs"
6
6
  trust_level: reviewed
@@ -10,15 +10,18 @@ files:
10
10
  description: "Send a part of the work to the paired Claude Code session (claude_send): only when the user asks, or to reply to its answer in a peer turn; validate, context or question; Claude's answer comes as a message with its text"
11
11
  plugin:
12
12
  file: plugin.rb
13
- sha256: sha256:14fe3e36e84dd25172fd3fb0dba54a4aa94d4b8cdb4101573431927e84551657
13
+ sha256: sha256:a20b84513f78a4c46d1d396e9d8b72fd719a4ed66e48cdf628cb8f8bea492fb6
14
14
  scripts:
15
15
  pair-remote: sha256:d7681f87a194e540b629564f84cad9f2d0a763197502c74614276ef88a8920cc
16
16
  pair: sha256:626b1c4acba6b1ab8a9d9615c709d69da6953d89d32469f370c2eaad145a8bb8
17
17
  chi-peer-SKILL.md: sha256:e3d5bd01d221a3206e203098bf7e1e1fbbbf72b2124bae744eace1816d8eca0c
18
- # config.yml bundles: <name>: start_command: the shell line /<peer> start runs in its kitty tab (another key warns)
19
- settings: [start_command]
18
+ # config.yml bundles: <name>: start_command: the shell line /<peer> start runs in its kitty window; open_in: pane
19
+ # (the default: a pane next to this session's chi terminal in kitty, else a background tab) or tab (always a
20
+ # background tab). Another key warns.
21
+ settings: {start_command: string, open_in: string}
20
22
  # The plugin needs Samagotchi::Plugin::Peer on the mailbox: chi.peer and
21
23
  # ctx.peers, and the skill's chi peer pair|say, are the next chi's (an older
22
24
  # chi has no chi.peer: the plugin fails to load there).
23
- requires_chi: ">= 0.194.0"
25
+ requires_chi: ">= 0.195.0"
24
26
  # The pair script's no-id form (chi peer pair --here), --peer-session, /<peer> pair and the start hook are the next chi's.
27
+ # open_in (a pane next to the session's chi terminal) is the next chi's.
@@ -75,8 +75,8 @@ class Plugin < Samagotchi::Plugin::Peer
75
75
  SKILL_CARD = "claude-skill"
76
76
  USAGE = "usage: /claude — whether a Claude Code session is paired (else the ones here); /claude pair — pair the one " \
77
77
  "here, or wait for one and list them; /claude pair <id8> — pair that one; /claude show <id8> — bring its kitty " \
78
- "window to the front; /claude start — open Claude Code in a kitty tab, paired when it starts; /claude show — bring " \
79
- "that tab to the front; /claude unpair — end the pairing or the wait; /claude validate <text> | context <text> — " \
78
+ "window to the front; /claude start — open Claude Code in a kitty window, paired when it starts; /claude show — " \
79
+ "bring that window to the front; /claude unpair — end the pairing or the wait; /claude validate <text> | context <text> — " \
80
80
  "send the text to it; /claude last — send the last answer as context; /claude install-skill — install Claude's " \
81
81
  "chi-peer skill, which pairs; /claude install-hook [--yes] — Claude Code's start hook, which lists a Claude here"
82
82
  # The shipped bundle keeps scripts/ beside plugin.rb; an installed one
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: codex-peer
3
- version: 0.8.0
3
+ version: 0.9.0
4
4
  scope: system
5
5
  description: "Pair this session with an OpenAI Codex CLI session you work with: the codex_send tool and /codex send it a part of the work (a plan step, a diff, a finding) to validate or as context, with codex queue, and Codex's answer comes back as a message with its text (chi peer say); /codex install-skill installs Codex's chi-peer skill, which pairs"
6
6
  trust_level: reviewed
@@ -10,14 +10,17 @@ files:
10
10
  description: "Send a part of the work to the paired Codex CLI session (codex_send): only when the user asks, or to reply to its answer in a peer turn; validate, context or question; Codex's answer comes as a message with its text"
11
11
  plugin:
12
12
  file: plugin.rb
13
- sha256: sha256:c656ff80192292bf9db1321dfd7aa8711687ea4e6c8a83c9251357f86a6076bb
13
+ sha256: sha256:f1c328b6afd3b13b4c52dc777b79f4cfcbc3852c0e76b5434ac54326b6524a34
14
14
  scripts:
15
15
  pair: sha256:17d804d2f27e5034b26fe83e675a41720b95fddb7209fc7828253f40445f55f8
16
16
  chi-peer-SKILL.md: sha256:0a793a97673c2831a3f974771bd20b16f4b28f1b9c3da710de7a17dcaae23be4
17
- # config.yml bundles: <name>: start_command: the shell line /<peer> start runs in its kitty tab (another key warns)
18
- settings: [start_command]
17
+ # config.yml bundles: <name>: start_command: the shell line /<peer> start runs in its kitty window; open_in: pane
18
+ # (the default: a pane next to this session's chi terminal in kitty, else a background tab) or tab (always a
19
+ # background tab). Another key warns.
20
+ settings: {start_command: string, open_in: string}
19
21
  # The plugin needs Samagotchi::Plugin::Peer on the mailbox: chi.peer and
20
22
  # ctx.peers, and the skill's chi peer pair|say, are the next chi's (an older
21
23
  # chi has no chi.peer: the plugin fails to load there).
22
- requires_chi: ">= 0.194.0"
24
+ requires_chi: ">= 0.195.0"
23
25
  # The pair script's no-id form (chi peer pair --here), --peer-session, /<peer> pair and the start hook are the next chi's.
26
+ # open_in (a pane next to the session's chi terminal) is the next chi's.