samagotchi 0.192.0 → 0.194.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 (190) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +128 -1
  3. data/docs/architecture.md +3 -3
  4. data/docs/bundle-authoring.md +1 -1
  5. data/docs/bundles.md +82 -40
  6. data/docs/cli.md +47 -17
  7. data/docs/configuration.md +75 -8
  8. data/docs/context.md +8 -5
  9. data/docs/desktop.md +3 -0
  10. data/docs/guardrails.md +20 -5
  11. data/docs/hooks.md +1 -0
  12. data/docs/internals/bridge.md +3 -1
  13. data/docs/internals/bundles.md +2 -2
  14. data/docs/internals/engine.md +46 -3
  15. data/docs/internals/pages.md +4 -4
  16. data/docs/internals/panes.md +66 -0
  17. data/docs/internals/participants.md +5 -3
  18. data/docs/internals/peers.md +176 -27
  19. data/docs/internals/prompt-caching.md +6 -1
  20. data/docs/internals/remote-sessions.md +6 -0
  21. data/docs/internals/session-lifecycle.md +12 -4
  22. data/docs/internals/web-frontend.md +106 -22
  23. data/docs/internals/working-set.md +5 -1
  24. data/docs/peers.md +150 -27
  25. data/docs/plugins.md +48 -7
  26. data/docs/releasing.md +30 -2
  27. data/docs/scheduling.md +3 -2
  28. data/docs/sessions.md +16 -7
  29. data/docs/sub-agent.md +6 -4
  30. data/docs/system-one.md +4 -0
  31. data/docs/testing.md +38 -3
  32. data/docs/thin-clients.md +27 -11
  33. data/lib/samagotchi/bridge/card_store.rb +1 -1
  34. data/lib/samagotchi/broadcast/triage_model.rb +17 -0
  35. data/lib/samagotchi/bundles/claude-peer/manifest.yml +8 -5
  36. data/lib/samagotchi/bundles/claude-peer/plugin.rb +24 -5
  37. data/lib/samagotchi/bundles/claude-peer/scripts/chi-peer-SKILL.md +61 -24
  38. data/lib/samagotchi/bundles/claude-peer/scripts/pair +31 -8
  39. data/lib/samagotchi/bundles/codex-peer/manifest.yml +8 -5
  40. data/lib/samagotchi/bundles/codex-peer/plugin.rb +62 -6
  41. data/lib/samagotchi/bundles/codex-peer/scripts/chi-peer-SKILL.md +57 -19
  42. data/lib/samagotchi/bundles/codex-peer/scripts/pair +28 -7
  43. data/lib/samagotchi/bundles/coordinator/manifest.yml +2 -2
  44. data/lib/samagotchi/bundles/coordinator/skill_coordinator.md +31 -0
  45. data/lib/samagotchi/bundles/dev/manifest.yml +2 -2
  46. data/lib/samagotchi/bundles/mcp/manifest.yml +2 -2
  47. data/lib/samagotchi/bundles/mcp/plugin.rb +0 -7
  48. data/lib/samagotchi/bundles/system/manifest.yml +1 -1
  49. data/lib/samagotchi/chi_invocation.rb +7 -0
  50. data/lib/samagotchi/client.rb +18 -0
  51. data/lib/samagotchi/codex_rollout.rb +93 -0
  52. data/lib/samagotchi/compat.rb +8 -1
  53. data/lib/samagotchi/config.rb +19 -6
  54. data/lib/samagotchi/continue_offer.rb +13 -1
  55. data/lib/samagotchi/delivery.rb +2 -2
  56. data/lib/samagotchi/effective_model.rb +28 -2
  57. data/lib/samagotchi/engine/cards.rb +9 -4
  58. data/lib/samagotchi/engine/hooks.rb +8 -0
  59. data/lib/samagotchi/engine/models.rb +197 -7
  60. data/lib/samagotchi/engine/plugins.rb +2 -0
  61. data/lib/samagotchi/engine/side_requests.rb +72 -13
  62. data/lib/samagotchi/engine/toolkit.rb +1 -1
  63. data/lib/samagotchi/engine/turn_helpers.rb +1 -1
  64. data/lib/samagotchi/engine.rb +11 -8
  65. data/lib/samagotchi/engine_snapshots.rb +16 -3
  66. data/lib/samagotchi/events.rb +1 -0
  67. data/lib/samagotchi/guardrails/pair_boundary.rb +49 -18
  68. data/lib/samagotchi/hooks.rb +3 -1
  69. data/lib/samagotchi/host_registry.rb +146 -16
  70. data/lib/samagotchi/idle_client.rb +13 -2
  71. data/lib/samagotchi/idle_recap.rb +33 -3
  72. data/lib/samagotchi/idle_target.rb +27 -7
  73. data/lib/samagotchi/jsonl_store.rb +13 -2
  74. data/lib/samagotchi/llm/adapter_common.rb +4 -2
  75. data/lib/samagotchi/llm/anthropic_messages.rb +14 -2
  76. data/lib/samagotchi/llm/errors.rb +35 -4
  77. data/lib/samagotchi/llm/model_listing.rb +19 -0
  78. data/lib/samagotchi/llm/openai_chat.rb +8 -2
  79. data/lib/samagotchi/llm/prompt_cache.rb +5 -0
  80. data/lib/samagotchi/model_binding.rb +46 -4
  81. data/lib/samagotchi/model_catalog.rb +68 -8
  82. data/lib/samagotchi/model_profile.rb +35 -0
  83. data/lib/samagotchi/models_command.rb +8 -4
  84. data/lib/samagotchi/pages/launch.rb +1 -1
  85. data/lib/samagotchi/panes/kitty.rb +122 -0
  86. data/lib/samagotchi/panes.rb +185 -0
  87. data/lib/samagotchi/peer_announce.rb +245 -0
  88. data/lib/samagotchi/peer_cold.rb +92 -0
  89. data/lib/samagotchi/peer_command.rb +121 -20
  90. data/lib/samagotchi/peer_continue.rb +42 -16
  91. data/lib/samagotchi/peer_exchanges.rb +7 -0
  92. data/lib/samagotchi/peer_mailbox.rb +50 -10
  93. data/lib/samagotchi/peer_pair_here.rb +149 -0
  94. data/lib/samagotchi/peer_presence.rb +434 -0
  95. data/lib/samagotchi/peer_receipts.rb +33 -6
  96. data/lib/samagotchi/peer_say.rb +46 -21
  97. data/lib/samagotchi/peer_wait_expiry.rb +47 -0
  98. data/lib/samagotchi/plugin/api.rb +13 -1
  99. data/lib/samagotchi/plugin/card.rb +68 -11
  100. data/lib/samagotchi/plugin/context.rb +33 -2
  101. data/lib/samagotchi/plugin/panes.rb +54 -0
  102. data/lib/samagotchi/plugin/peer.rb +170 -63
  103. data/lib/samagotchi/plugin/peer_pairing.rb +290 -0
  104. data/lib/samagotchi/plugin/peer_start.rb +301 -0
  105. data/lib/samagotchi/plugin/peer_start_hook.rb +207 -0
  106. data/lib/samagotchi/plugin/peers.rb +89 -9
  107. data/lib/samagotchi/recap_setup.rb +40 -3
  108. data/lib/samagotchi/self_report.rb +25 -6
  109. data/lib/samagotchi/send_command.rb +6 -6
  110. data/lib/samagotchi/served_lookup.rb +225 -0
  111. data/lib/samagotchi/served_ref.rb +41 -0
  112. data/lib/samagotchi/session_access/contract.rb +6 -0
  113. data/lib/samagotchi/session_access/local.rb +149 -40
  114. data/lib/samagotchi/session_access/remote.rb +4 -4
  115. data/lib/samagotchi/session_access/remote_peers.rb +8 -5
  116. data/lib/samagotchi/session_chain/links.rb +8 -3
  117. data/lib/samagotchi/session_commands.rb +40 -8
  118. data/lib/samagotchi/session_continue.rb +11 -6
  119. data/lib/samagotchi/session_lifecycle/allowed.rb +4 -2
  120. data/lib/samagotchi/session_manager/delivery.rb +5 -0
  121. data/lib/samagotchi/session_manager/lifecycle.rb +58 -7
  122. data/lib/samagotchi/session_manager/removal.rb +3 -0
  123. data/lib/samagotchi/session_manager/spawn.rb +6 -1
  124. data/lib/samagotchi/session_model_settings.rb +7 -3
  125. data/lib/samagotchi/session_stores.rb +25 -11
  126. data/lib/samagotchi/sessions_command.rb +16 -3
  127. data/lib/samagotchi/system_one/http_backend.rb +111 -10
  128. data/lib/samagotchi/system_one/runs.rb +5 -2
  129. data/lib/samagotchi/system_prompt.rb +11 -4
  130. data/lib/samagotchi/terminal_ui/attached_loop/sending.rb +2 -1
  131. data/lib/samagotchi/terminal_ui/formatting.rb +26 -12
  132. data/lib/samagotchi/terminal_ui/status_row.rb +20 -3
  133. data/lib/samagotchi/terminal_ui.rb +1 -1
  134. data/lib/samagotchi/testing/boundary.rb +0 -1
  135. data/lib/samagotchi/testing/bundle.rb +6 -2
  136. data/lib/samagotchi/testing/host.rb +1 -0
  137. data/lib/samagotchi/testing/recorder.rb +3 -0
  138. data/lib/samagotchi/turn_endings.rb +6 -2
  139. data/lib/samagotchi/user_typed.rb +29 -0
  140. data/lib/samagotchi/version.rb +1 -1
  141. data/lib/samagotchi/web/app.rb +8 -20
  142. data/lib/samagotchi/web/participant_review.rb +1 -1
  143. data/lib/samagotchi/web/participant_view.rb +1 -1
  144. data/lib/samagotchi/web/peer_routes.rb +40 -15
  145. data/lib/samagotchi/web/public/agent_rows.js +206 -0
  146. data/lib/samagotchi/web/public/agent_runs.js +595 -0
  147. data/lib/samagotchi/web/public/answer_fold.js +41 -44
  148. data/lib/samagotchi/web/public/app.js +4 -4
  149. data/lib/samagotchi/web/public/block_fix.js +1 -1
  150. data/lib/samagotchi/web/public/card.js +26 -10
  151. data/lib/samagotchi/web/public/cards_place.js +6 -4
  152. data/lib/samagotchi/web/public/context_chips.js +24 -2
  153. data/lib/samagotchi/web/public/copy.js +8 -2
  154. data/lib/samagotchi/web/public/data.js +2 -1
  155. data/lib/samagotchi/web/public/format.js +9 -1
  156. data/lib/samagotchi/web/public/history_reveal.js +5 -2
  157. data/lib/samagotchi/web/public/index.html +56 -2
  158. data/lib/samagotchi/web/public/info_bar_model.js +1 -1
  159. data/lib/samagotchi/web/public/model_pick.js +18 -5
  160. data/lib/samagotchi/web/public/model_picker.js +1 -1
  161. data/lib/samagotchi/web/public/page_view.js +1 -1
  162. data/lib/samagotchi/web/public/pages.css +1 -7
  163. data/lib/samagotchi/web/public/peer_chip.js +15 -5
  164. data/lib/samagotchi/web/public/peer_data.js +4 -2
  165. data/lib/samagotchi/web/public/peer_mailbox_api.js +2 -1
  166. data/lib/samagotchi/web/public/peer_note.js +4 -2
  167. data/lib/samagotchi/web/public/peer_row.js +37 -0
  168. data/lib/samagotchi/web/public/peer_wait.js +36 -0
  169. data/lib/samagotchi/web/public/quiet_notes.js +12 -1
  170. data/lib/samagotchi/web/public/revise_stack.js +5 -2
  171. data/lib/samagotchi/web/public/send_turn.js +11 -3
  172. data/lib/samagotchi/web/public/served_ref.js +9 -0
  173. data/lib/samagotchi/web/public/session_fields.js +1 -0
  174. data/lib/samagotchi/web/public/session_state.js +4 -0
  175. data/lib/samagotchi/web/public/stage_missing.js +23 -6
  176. data/lib/samagotchi/web/public/stream_handlers.js +16 -0
  177. data/lib/samagotchi/web/public/turn_block.js +4 -0
  178. data/lib/samagotchi/web/public/version_notices.js +7 -1
  179. data/lib/samagotchi/web/session_control.rb +19 -10
  180. data/lib/samagotchi/web/session_show.rb +20 -0
  181. data/lib/samagotchi/web/update_ops.rb +2 -2
  182. data/lib/samagotchi/worker/command_queue.rb +3 -0
  183. data/lib/samagotchi/worker/mail.rb +24 -1
  184. data/lib/samagotchi/worker.rb +8 -5
  185. data/lib/samagotchi/worker_inbound/mail.rb +34 -6
  186. data/lib/samagotchi/worker_inbound.rb +11 -3
  187. data/lib/samagotchi/worker_link.rb +13 -1
  188. data/lib/samagotchi/worker_wakes.rb +33 -5
  189. metadata +22 -2
  190. data/lib/samagotchi/web/public/pages_group.js +0 -67
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 228161de4fb614d97b4240e1f62444b5f3cb1cbba6df18cf4477f69d95b96828
4
- data.tar.gz: '0891bd0649800d9cd0f7c81009c6378a650caff0dccf2a3cd5242fa53a4e1d9b'
3
+ metadata.gz: cd9df1796b9a6819a4c332ecf68acd9fe6334d8d7e0fd0b1569c1379ada2d2c9
4
+ data.tar.gz: 00e00dcf029423a9e49b1f112926f687a7e5cdc1cac9033d4ec89d21591b1063
5
5
  SHA512:
6
- metadata.gz: 62f39f21d2daf2dd9af94c3ef70bfd6bdad52202add14653b0013a407974556a66517a2dd492a4e14d9624c2d88f234fe36401eba35604da2aa2ad8f604f76fe
7
- data.tar.gz: eb2f2a67cd5b5422280650c68d8fb706d3b98cdd828777688004e78ca8170f8d9145ba833e4f4cf212a97577291b1a57dee51dc92b04a1548b5aca54f9632bd7
6
+ metadata.gz: 56e89c0f06cfd5906f5fbfb0ac1e2a8b5b6aa17a68a19b6b22e26529c716e108863cacbc40d39ea4272bdbba33f9417164384f67e3e8e72f1b339d379de125c0
7
+ data.tar.gz: 558295c0be257d570772bc54de08203acefc55538c237af46e79dca5f2d55ead84ce1e79489cd90a4060b18d8b5fc25e0ae0d8b9a526704fd5b4065be207e3c3
data/CHANGELOG.md CHANGED
@@ -8,6 +8,131 @@ and commands may change between minor versions. How releases are made:
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [0.194.0] - 2026-11-29
12
+
13
+ ### Added
14
+
15
+ - Pairing chi with Claude Code without copying an id: `/claude pair` pairs the one Claude Code session open in the
16
+ project, else waits 10 minutes (the next Claude you start pairs on its own) and lists them, each with Show (its
17
+ kitty window to the front) and Pair; in Claude, "pair with chi" with no id pairs the session that waits, else
18
+ the project's one live session (a session paired with another open Claude is refused: unpair there first). A
19
+ `/claude pair` whose paired Claude is gone (its socket missing) ends that pairing and says so. The waiting chip
20
+ counts down and has Cancel; a wait that runs out says so in one line. With claude-peer's start hook (the skill
21
+ card's **Add the start hook…** shows the merged settings as a diff; its Add merges it into Claude Code's
22
+ settings.json on your tap) a `claude --resume` or `/clear` keeps the pairing. `/codex pair` waits for "pair with
23
+ chi" in Codex. New: `chi peer announce`, `chi peer pair --here`, `--peer-session`. Update with `chi update`
24
+ (claude-peer, codex-peer).
25
+ - `/claude start`: chi opens a background kitty tab titled `claude · chi <id8>` in the session's folder, running
26
+ Claude Code, which pairs on its own when it starts (it needs the start hook and kitty's remote control,
27
+ `kitty.listen_on`; the command is the new setting `bundles: claude-peer: start_command:`, default `claude`). `/claude`
28
+ then says "Paired · started by chi" with Show (`/claude show`), and "Its kitty tab is closed" with Start one in kitty
29
+ after; the chip reads "Claude · ended" once the paired Claude is gone. `/codex start` opens Codex the same way with the first prompt "pair with chi" (one Codex turn). Both run only
30
+ from your typing or tap (no tool call, `chi send`, agent, schedule or delegate reaches them). Update with `chi update` (claude-peer, codex-peer).
31
+ - codex-peer's start hook: the `/codex install-skill` card's **Add the start hook…** shows the merged
32
+ `~/.codex/hooks.json` (or `$CODEX_HOME`'s) as a diff, and its Add appends `chi peer announce codex` there on your tap
33
+ (never `config.toml`, every other hook kept in its place). With it, a new Codex in the project pairs with a session
34
+ that waits (`/codex pair`, `/codex start`) at its first message, whatever it says; a `codex exec` or a resume never
35
+ takes the wait (chi reads the session's rollout, checked on Codex 0.172.0), and a Codex subagent should not (untested:
36
+ the check fails closed unless its `thread_source` and `originator` match); a `/new` likely takes it, as a new window
37
+ does. Codex asks you to review
38
+ the hook at its next start (Review hooks, or `/hooks`) and skips it until you trust it; a `/codex start` tab stops
39
+ on that screen the first time (Show it). "pair with chi" in a Codex already paired says paired, even with two live
40
+ chi sessions in the project. Update with `chi update` (codex-peer).
41
+ - Plugins: `ctx.card(rows:)` (a list to pick from, each row with its own buttons), `ctx.peers.pair`, `here`,
42
+ `wait`, `claim`, `stop_waiting`, `ctx.panes` (`find`, `show`, and `open`, `alive?`, `paste` for a background kitty
43
+ tab, only under the user-typed seam), `ctx.user_typed?` and the `:peer_wait_ended` event.
44
+ - A model can be `host:served` (`main:served`; a bare `served` is the default host's): the one model the host's
45
+ `/v1/models` lists now. A session saves `served`, so it and its schedules follow when you load another model;
46
+ each turn names the model it ran on, and a change says `host main now serves Y (was X)`. Settings, notes, prices
47
+ and guardrails go by the model that runs. A host listing none or several refuses it. An alias named `served` is
48
+ ignored. Upgrade every chi that shares your config.yml before writing `served` into it: an older chi sends
49
+ `served` as a model id.
50
+ - `system_one.model: served` judges with whatever `system_one.host` serves now; a judgment the host refuses as not
51
+ served is asked again once with the model it lists. Approvals' clean record stays as it is across a change (as
52
+ after a hand edit), and each change logs `system_one_model_changed`. An older chi with `system_one.model: served`
53
+ gets no judgment at all (every approval goes to you), with only a log line saying why.
54
+ - `recap.model`, `broadcast.triage_model` and `ctx.ask_model(model:)` (btw, block fixes, the objectives' check)
55
+ take `served` too, and the session's own served model is followed between turns: each asks the model the host
56
+ lists now. A recap or `ctx.ask_model` the host refuses as not served is asked once more with the new one; a
57
+ broadcast lists the host just before it asks. A `recap.model: main:served` is no longer resolved once at start.
58
+ - chi web's model picker, `chi models` and `/models` offer `host:served` for a host serving one model, as that
59
+ host's first row (`served`, now `<id>`; `chi models --format json` marks it `served: true`), and a served session
60
+ shows the id it runs on: `served · <id>` in the info bar, `model=main:served·<id>` in the status row,
61
+ `main:served → <id>` in `/model` and `chi self`, a `model:` line in `/stats`. A worker from before this release
62
+ shows `main:served` as it is until it restarts.
63
+
64
+ ### Changed
65
+
66
+ - A turn refused because its model isn't served names the model the host serves now and how to follow it
67
+ (`; host main serves Y now: /model main:served follows it`); nothing switches on its own.
68
+ - `kitty.listen_on` and `kitty.binary` are read live by the worker too (claude-peer's Show), besides the desktop
69
+ helper's copy.
70
+
71
+ - A stopped session's refusals say how to start it again: an agent's `chi sessions restart` and `chi send` on a stopped
72
+ session end "ask your user to start it: `chi --resume ID`, or a message from a terminal or the web", and a peer's
73
+ say reads `chi is stopped: it reads this when its user starts it (chi --resume <id8>)` (with `--remote`,
74
+ `chi --remote NAME --resume …`). The rule is the same: only the owner's message starts a stopped session.
75
+ - `chi sessions restart` and the web's Restart start a stopped session again (one being stopped, once its stop
76
+ finishes); an agent's restart still asks its user, and chi web's restart after an update leaves stopped sessions
77
+ stopped.
78
+
79
+ ### Fixed
80
+
81
+ - Web: a `chi-ui` block chi couldn't draw no longer stays on "asking for a fix…" when the fix fails: it says "a fix
82
+ didn't help", and its Ask in chat puts the sentence in the composer again (it did nothing).
83
+
84
+ Update with `chi update` (claude-peer 0.9.0, codex-peer 0.8.0, the dev profile 0.7.12).
85
+
86
+ ## [0.193.0] - 2026-11-29
87
+
88
+ ### Added
89
+
90
+ - coordinator 0.10.0: the coordinator attaches what can change an epic's scope (another team's PR, a pipeline, a
91
+ planning page) as context, a PR by its URL and the rest through a small script of its own, instead of polling it;
92
+ each script source asks you first.
93
+
94
+ ### Changed
95
+
96
+ - Peers: a message Claude or Codex starts on its own (or a `VERDICT OK` closer) while chi's prompt cache has gone cold
97
+ no longer wakes chi to re-read the whole conversation at the write price: it waits as a note for your next message,
98
+ the say's line says `held: chi's cache is cold`, the chip `held · cold`. An answer chi asked for still wakes it. Only
99
+ where chi's requests carry cache breakpoints (Claude models remotely), past `cache.ttl` since the last turn, and on
100
+ a conversation over 20,000 tokens.
101
+ - Peers: when chi's model sends to a peer it hasn't exchanged anything with for 30 minutes (`peer.quiet_minutes`, 0
102
+ turns it off), you are asked first ("Claude last heard from chi 2 h ago: its session may be cold. Send?") in a turn
103
+ you started from the web or a TUI; in a schedule's, a delegate's or a wake turn the send is refused at once and the
104
+ model told you decide. A `/claude …` you type never asks, and the pairing stays.
105
+ - Peers: a peer's message cut at 4 KiB in a continue's note now says how chi reads the rest (`claude_read` with the
106
+ previous session as its box) instead of pointing at `chi peer ls`, which never printed it.
107
+ - Peers: `peer.turns` counts across a worker restart, so a peer that speaks every 40 minutes is held after its wakes
108
+ as one that speaks every minute is.
109
+ - Peers: a continue takes the Claude or Codex pairing along, and the peer does nothing: no `moved` message, no pair
110
+ script, no turn of its own spent on it. chi's next send names the new id; a `chi peer say`, `pair`, `unpair` or `ls` to
111
+ the old id runs on the new session, and the say's line ends `session continued as <id8>: answer there`. A chain an
112
+ older chi continued still refuses the say, naming the new id. Run `chi update`: claude-peer 0.8.0 and codex-peer
113
+ 0.7.0 (then `/claude install-skill` or `/codex install-skill`, Replace): the chi-peer skill says its answer from a
114
+ file, so a say refused with "try again" is run again without writing the answer twice.
115
+ - The thin-client docs' iOS Shortcut recipe is checked on an iPhone: a JSON request body, Pick's steps spelled out
116
+ and the accepted `request_id` key formats.
117
+ - A participant's turn can no longer list the owner's sessions or reminders or read the session's attached context
118
+ (`list_sessions`, `list_reminders`, `context_read`); every built-in tool is classified for a participant's turn, so
119
+ a new one can't slip through unexamined.
120
+ - chi web: a peer's answer starts closed, one row with the peer, its verdict, its summary and its length (a tap opens
121
+ it), and every delegate report starts closed, a short one too.
122
+ - chi web: delegate reports, peers' answers and background notes side by side show as one closed line, "1 report ·
123
+ Claude: changes · 3 notes"; a tap on a segment shows those rows under it.
124
+ - chi web: a finished turn's steps join that line as "N calls" when a report or a peer's answer is in it ("1 report ·
125
+ Claude: changes · 2 calls"); a tap shows the steps row as before, the working set's footprint in it. A typed turn's
126
+ steps, also next to its notes, and cancelled or failed steps look as before. At a narrow width the line cuts the
127
+ notes first, then the calls, then the reports, then the peers, one at a time.
128
+
129
+ ### Fixed
130
+
131
+ - A send answered `not_found` while another session is open now keeps the line in the new-session draft and names
132
+ the gone session in a toast instead of losing it to the draft sweep; the toast stays until you dismiss it.
133
+
134
+ Update with `chi update` (claude-peer 0.8.0, codex-peer 0.7.0, coordinator 0.10.0, mcp 0.9.4).
135
+
11
136
  ## [0.192.0] - 2026-11-28
12
137
 
13
138
  ### Added
@@ -7024,7 +7149,9 @@ and long-lived sessions.
7024
7149
  - A macOS desktop helper (`chi desktop install`): a "Send to chi" Service and a
7025
7150
  hotkey panel that send selected text or the clipboard to your sessions.
7026
7151
 
7027
- [Unreleased]: https://github.com/dm1try/samagotchi/compare/v0.192.0...HEAD
7152
+ [Unreleased]: https://github.com/dm1try/samagotchi/compare/v0.194.0...HEAD
7153
+ [0.194.0]: https://github.com/dm1try/samagotchi/compare/v0.193.0...v0.194.0
7154
+ [0.193.0]: https://github.com/dm1try/samagotchi/compare/v0.192.0...v0.193.0
7028
7155
  [0.192.0]: https://github.com/dm1try/samagotchi/compare/v0.191.0...v0.192.0
7029
7156
  [0.191.0]: https://github.com/dm1try/samagotchi/compare/v0.190.1...v0.191.0
7030
7157
  [0.190.1]: https://github.com/dm1try/samagotchi/compare/v0.190.0...v0.190.1
data/docs/architecture.md CHANGED
@@ -520,8 +520,8 @@ model: [internals/remote-sessions.md](internals/remote-sessions.md).
520
520
  | `POST /api/sessions/:id/context/:name/push` | owner | `text`, `summary`, `wake`, `hint` (a source's JSON output, checked the same way) | 200 `{status: pushed, name, before, revision, changed}` | 404 `not_found`; 409 `not_push`; 410 `context_continued` (`next_id`, `in_flight` while its continue runs); 423 `context_busy` (another change holds its transition lock); 400 `invalid_text` |
521
521
  | `GET /api/sessions/:id/peers` | owner | | 200 `{peers: [{name, label, paired_at, from, address, can_send, messages, exchanges}]}`: one row per mailbox folder, its newest 20 messages with their receipts and `words`, last 20 joined exchanges, newest first; no text; files only ([internals/peers.md](internals/peers.md)) | 404 `not_found` |
522
522
  | `GET /api/sessions/:id/peers/:name/messages/:serial` | owner | | 200 the message (its text) and its receipt | 404 `no_message`; 400 `invalid_peer` |
523
- | `DELETE /api/sessions/:id/peers/:name` | owner | | 200 `{unpaired}`: the pairing ends, its messages stay | 400 `invalid_peer` |
524
- | `POST /api/sessions/:id/peers/:name/pair`, `…/say` | owner | pair: `address`, `from`; say: `text`, `summary`, `wake`, `re`, `wait` (≤ 30: the server waits for the receipt) | pair 200 `{status: paired, link}`; say 200 `PeerSay` and its `line` | 409 refused (`continued` + `next_id` and `in_flight` while its continue runs, `busy` (a say adds `detail`), `old_worker`, …, the same shape); 400 bad name, text or wait |
523
+ | `DELETE /api/sessions/:id/peers/:name` | owner | | 200 `{unpaired, forwarded_to}`: the pairing ends (a continued session's live link's too, named), its messages stay | 400 `invalid_peer` |
524
+ | `POST /api/sessions/:id/peers/:name/pair`, `…/say` | owner | pair: `address`, `from`; say: `text`, `summary`, `wake`, `re`, `wait` (≤ 30: the server waits for the receipt) | pair 200 `{status: paired, link, forwarded_to}` (a continued session's live link it paired); say 200 `PeerSay` (`forwarded_to` likewise) and its `line` | 409 refused (`continued` + `next_id` and `in_flight` while its continue runs, `busy` (a say adds `detail`), `old_worker`, …, the same shape); 400 bad name, text or wait |
525
525
  | `DELETE /api/sessions/:id/context/:name?own=1` | owner | | 200 `{status: detached}`: the session's own only | 409 `project_source` (chi context rm's words); 404 |
526
526
  | `POST /api/sessions/:id/stop` | owner | `wait?` (seconds, capped at `SessionManager::STOP_WAIT`, 10: `chi --remote NAME sessions stop` sends it) | 200 `{status: stopped, session_id, released}`: `released`, whether the worker let go within the wait (without one `STOP_WAIT_SECONDS`, 2 s: the page's Stop) | 409 `owned_by_tui` |
527
527
  | `DELETE /api/sessions/:id?force=` | owner | `force=true` stops a live worker first (the page sends it) | as before | 409 `worker_running` without it |
@@ -682,7 +682,7 @@ A map of the parts the overview above doesn't name (paths under `lib/samagotchi/
682
682
  | Session file | `session.rb` (`Session`, `Session::FIELDS`), `session_field.rb` (`SessionField`), `session_paths.rb` (`SessionPaths`), `session_setup.rb` (`SessionSetup`) | A session's `<uuid>.json`: one `SessionField` row per key (default, cast, what the file gets; the codec on its type), from which `Session.new`, `.from_h` and `#to_h` are built; `SessionPaths` is where the file and the session's dir are and the id rule, a leaf `Session` extends (so `ArchiveStore` and `ContextSources` name no `Session` constant; both still require session.rb at load); `SessionSetup` the settings a fork and a continue carry (`.of`), applied by member name; every new-session request (chi's run flags, the one-shot, `chi send --new`, chi web's create) builds its setup with `SessionSetup.from_request`, and `spec/session_setup_entrypoints_spec.rb` holds each entrypoint's cell for each member. See [sessions.md](sessions.md#session-file). |
683
683
  | Session config (`--set`) | `session_config.rb` (`SessionConfig`, `SessionConfig::Settings`) | A session's own settings as one value (`Session#settings`, `SessionSetup#settings`): `core`, the `--set KEY=VALUE` values of the core keys marked `session: true` (`Config::Entry`), typed by `Config.coerce!` and read first through `Config.get(key, session:)` (`RecapSetup`; `Engine#session=` rebuilds the recap job, `IdleScheduler#replace_job`), file key `config_settings`; `bundles`, the `--set BUNDLE.KEY=VALUE` values, checked against the manifest's `session_settings:`, laid over `bundles: <name>:` in `ctx.settings` ([plugins.md](plugins.md)), file key `bundle_settings`. `SessionConfig.clash` refuses a bundle setting named like a core one (install, `chi bundle check`). See [configuration.md](configuration.md#per-session-settings). |
684
684
  | Plugin API | `plugin/api.rb` (`Plugin::Api`), `plugin/tool_spec.rb` (`Plugin::ToolSpec`: a checked tool declaration, how it is registered), `plugin/loader.rb`, `plugin/context.rb` (`ctx`), `plugin/http.rb` + `plugin/http_transport.rb` (`ctx.http`), `plugin/http_stream.rb` (`ctx.http.stream`) + `plugin/sse_reader.rb`, `plugin/http_errors.rb`, `plugin/secrets.rb` (`Plugin::Secrets`, `ctx.secrets`) + `plugin/sign_in.rb` (`Plugin::SignIn`, `ctx.sign_in`), `plugin/card.rb` (`Plugin::Card`) | What a bundle's plugin registers: tools, commands, annotation actions, hooks, services, toolkits, peer sources; what its handlers get as `ctx` ([plugins.md](plugins.md)). |
685
- | Peer bundles' base | `plugin/peer.rb` (`Plugin::Peer`), `plugin/peers.rb` (`ctx.peers`) | What claude-peer and codex-peer share (the send and read tools, the command, the cards, payloads, telling the peer a continue's new id); each bundle's subclass sets its strings and transport ([bundles.md](bundles.md#the-claude-peer-bundle)). |
685
+ | Peer bundles' base | `plugin/peer.rb` (`Plugin::Peer`), `plugin/peers.rb` (`ctx.peers`) | What claude-peer and codex-peer share (the send and read tools, the command, the cards, payloads); each bundle's subclass sets its strings and transport ([bundles.md](bundles.md#the-claude-peer-bundle)). |
686
686
  | Peers | `peer_mailbox.rb` (`PeerMailbox`: the peer's side, `mailbox/<id>/<peer>/`), `peer_receipts.rb` (`PeerReceipts`: chi's side), `peer_registry.rb` (`chi.peer`), `peer_note.rb`, `peer_say.rb`, `peer_command.rb` (`chi peer`), `peer_roster.rb`, `peer_continue.rb`, `worker_inbound/mail.rb` (`absorb_mail`), `web/peer_routes.rb` | A peer agent's messages: one file each, taken by the worker in order as its notes, a receipt each, the say's line ([internals/peers.md](internals/peers.md)). |
687
687
  | Shipped bundles | `bundles/` (`mcp`, `github-pr`, `loop-guard`, `skills`, `source-links`, …) | Bundles that ship with chi. |
688
688
  | Hooks | `hooks/registry.rb` (`Hooks::Registry`), `hooks/loader.rb`, `hook_routes.rb` (`HookRoutes`), `event_routes.rb` (`EventRoutes`) | Hook registration and dispatch; what a hook or plugin does beyond reading its event (notice, question, stop, steer) routed to the UIs (cards and notices through one set of routes) ([hooks.md](hooks.md)). |
@@ -64,7 +64,7 @@ value of another type is refused) is read from `ctx.settings` at call time. List
64
64
 
65
65
  `chi.on(event) { |event, ctx| … }` gets a Hash. The events, in a turn's order: `session_start`, `before_turn`,
66
66
  `before_generation`, `generation_progress`, `after_generation`, `before_tool_call`, `question_asked`, `after_tool_call`,
67
- `after_turn`, `session_end` (the fields of each: [hooks.md, Hook Events](hooks.md#hook-events)). A symbol not in
67
+ `after_turn`, `session_end`, between turns `peer_wait_ended` (fields: [hooks.md](hooks.md#hook-events)). A symbol not in
68
68
  that list is never fired (`check` warns). The two a bundle wants most, for an `execute`:
69
69
 
70
70
  ```ruby
data/docs/bundles.md CHANGED
@@ -1033,6 +1033,19 @@ replies wouldn't come back by themselves there.
1033
1033
  - **Resume.** A new coordinator session (or one asked "where were we?")
1034
1034
  reads the open handoff, checks it against git and the session list (git
1035
1035
  wins; mismatches are reported) and goes on from the first open step.
1036
+ - **Watching what can change the scope** (0.10.0). When the plan or you name
1037
+ something outside the branches that can change mid-epic (another team's
1038
+ PR, an issue, a pipeline, a planning page), the skill has the coordinator
1039
+ attach it as [context](context.md) instead of polling it with reminders or
1040
+ schedules: a PR as `chi context add <PR URL>` (the github-pr bundle), the
1041
+ rest through a script of its own in `~/.local/share/chi-watch/<epic-slug>/`
1042
+ (stable text, a summary in its own words, a wake only for a change that
1043
+ can move the scope) added with `chi context add NAME --cmd …`. Each `--cmd`
1044
+ source asks you first (`chi-context-cmd`), every time; a refusal is left
1045
+ as it is. On a change it tells you what it means for the plan and proposes
1046
+ the next step without starting it. The names go into the handoff
1047
+ ("Watching: …"). A source is fetched only while the session's worker is
1048
+ up: nothing is watched once it has exited or been stopped.
1036
1049
  - **`/coordinate <goal>`** sends this session a turn asking the model to
1037
1050
  follow the skill for the goal (when the session can't take a message, as
1038
1051
  in a `--non-interactive` one-shot, it shows the text to send yourself). Asking "do this in parallel" works too: the index line leads
@@ -1107,7 +1120,13 @@ validate or as context, and Claude's answer comes back into chi. This is
1107
1120
  Claude with the context it has, not a fresh review run. Nothing runs until a
1108
1121
  Claude pairs; without one the bundle costs one tool declaration.
1109
1122
 
1110
- - **Pairing is Claude's.** chi can't see Claude's inbox, so Claude pairs:
1123
+ - **Pairing:** `/claude pair` in chi, or "pair with chi" in Claude, no id copied ([peers.md](peers.md#pairing)).
1124
+ `/claude pair` pairs the one Claude Code session open in this project, else waits 10 minutes and lists them
1125
+ (a row each, its kitty window's title, folder and age, with Show and Pair); `/claude pair <id8>` pairs a row,
1126
+ `/claude show <id8>` brings its window to the front (only from your typing or tap), `/claude unpair` ends the
1127
+ pairing or the wait. `/claude start` opens a background kitty tab running Claude Code (the setting
1128
+ `start_command`, default `claude`), which pairs when it starts; `/claude show` alone brings that tab to the front
1129
+ ([peers.md](peers.md#pairing)). Claude lists itself with the start hook (step 1). Either way the pairing is one
1111
1130
  `chi peer pair claude <id> --address <socket>`, the address being its
1112
1131
  per-session inbox socket (`CLAUDE_CODE_MESSAGING_SOCKET`, Claude Code
1113
1132
  2.1.224 or later); its answers come back as messages in the session's
@@ -1121,10 +1140,16 @@ Claude pairs; without one the bundle costs one tool declaration.
1121
1140
  guardrail sees it: the button is your consent. The card also offers the
1122
1141
  Claude Code permission rule `Read(~/.local/state/samagotchi/plugins/claude-peer/**)`
1123
1142
  (your state folder), so Claude isn't asked before reading a long part's
1124
- file; chi never writes Claude's settings.
1125
- 2. In Claude Code you say "pair with chi <id or chi web URL>". The skill runs
1126
- `sh <bundle>/scripts/pair <id or URL>`, one `chi peer pair`. A re-pair
1127
- after a Claude restart only refreshes the socket; Claude's messages stay.
1143
+ file. Its **Add the start hook…** (`/claude install-hook`) shows the merged settings as a diff, and that card's
1144
+ **Add the start hook** (`/claude install-hook --yes`) merges one `SessionStart` hook, `[
1145
+ "$CLAUDE_CODE_SESSION_ATTENDED" = 1 ] && <chi> peer announce claude 2>/dev/null || true`, into
1146
+ `$CLAUDE_CONFIG_DIR/settings.json` (else `~/.claude/settings.json`), every other key kept, its mode kept, and
1147
+ a symlinked settings.json written at the file it points to (the link stays);
1148
+ chi never changes Claude's settings without that tap (not from
1149
+ a tool call or `chi send`). The status card says when the hook points at a chi that is gone.
1150
+ 2. In Claude Code you say "pair with chi" (an id or chi web URL when several chi sessions run in the project).
1151
+ The skill runs `sh <bundle>/scripts/pair [<id or URL>]`, one `chi peer pair`. With the start hook a Claude
1152
+ restart or `/clear` keeps the pairing; without it, pair again after a restart. Claude's messages stay.
1128
1153
  3. Claude answers a validate or a question with `chi peer say claude <id>
1129
1154
  --wake --re <the ref: line> --summary … --wait 8`, which wakes chi, and
1130
1155
  quotes to you the line it prints (`#12 received · woke chi`, or why chi
@@ -1145,7 +1170,21 @@ Claude pairs; without one the bundle costs one tool declaration.
1145
1170
  word: `ok`, `changes`, `unsure`), `answered after 6m`, or `not sent` (the
1146
1171
  send didn't go out); a tap on an answered one jumps down to the answer. The
1147
1172
  row's line of advice to the model is its hover instead. The answer stays
1148
- where it arrived, as a bubble from Claude: "Claude answered", the send it
1173
+ where it arrived, closed to one row, `Claude changes <its summary> 21
1174
+ lines` (the verdict's word, the summary without its `VERDICT` mark, else
1175
+ the first line of its text, and the length of Claude's text; on a phone the
1176
+ summary is cut short, the length stays). A tap opens it, a second closes
1177
+ it; this browser remembers which you opened, per session, and a jump to it
1178
+ (the send's pill, a claim link) opens it. Open, the row stays its top
1179
+ line and Claude's text and "what chi told the agent" are under it. Where
1180
+ An answer next to other agent-to-agent text (a delegate report, another
1181
+ peer's answer, a background note) joins their one line, `1 report ·
1182
+ Claude: changes · 3 notes` (`Claude ×2` for two of its answers, `Claude
1183
+ answered` without a verdict): a tap on `Claude: changes` shows its row under
1184
+ the line, a tap on the row opens its text; a reload shows the line closed
1185
+ again. Where
1186
+ it has no row (in the running turn, before it ends) it is a bubble from
1187
+ Claude: "Claude answered", the send it
1149
1188
  answers (a tap jumps back up to that row, opening a folded turn), its
1150
1189
  verdict (`VERDICT OK` with "round closed" when Claude agreed), its summary,
1151
1190
  the answer's text under it (rendered as markdown), and chi's instruction to
@@ -1157,13 +1196,15 @@ Claude pairs; without one the bundle costs one tool declaration.
1157
1196
  validate or question; one that answers no send has no link back. A `/claude validate …` you type gets no link in the
1158
1197
  conversation (command bubbles aren't kept), its answer still names it.
1159
1198
  - **The session bar** has one chip for the pairing, `Claude · …`, first among
1160
- the context chips, fed by chi web's `GET …/peers` (the mailbox): `paired`;
1199
+ the context chips, fed by chi web's `GET …/peers` (the mailbox): `ended` first, once the paired Claude is gone
1200
+ (its inbox socket missing, which chi web checks on each read; its status card, from the popover's Status card,
1201
+ has Start one in kitty and Unpair); `paired`;
1161
1202
  `waiting 2m` (a validate or question has no answer yet, its age the send's);
1162
1203
  `answered 3m` with the unread dot (a message no turn has read yet: held or
1163
1204
  noted);
1164
1205
  `can't send` (the last send didn't go through: the Claude session ended or
1165
- restarted, pair again from Claude, which ends it; chi web can't probe the
1166
- socket, so a dead inbox shows only after a send hits it); `answers only`,
1206
+ restarted, pair again from Claude, which ends it: a socket that is there but
1207
+ refuses shows only after a send hits it); `answers only`,
1167
1208
  dashed (a pairing with no address: through a remote). Its popover (a bottom
1168
1209
  sheet on a phone) says where chi sends and how it answers, lists the last
1169
1210
  exchanges (time, kind · title or a message's `#N · summary`, `waiting 2m` /
@@ -1217,7 +1258,10 @@ Claude pairs; without one the bundle costs one tool declaration.
1217
1258
  chi fixes what Claude flagged or disagrees and sends again, up to
1218
1259
  `peer.turns` (3) wake turns in a row, and a `VERDICT OK` answer wakes chi
1219
1260
  once to close the round (carry on, or tell you what was agreed). Only a
1220
- message you type in the web or a TUI starts the count again.
1261
+ message you type in the web or a TUI starts the count again. A message
1262
+ Claude starts while chi's cache is cold waits for your next message
1263
+ ([peers.md](peers.md#a-cold-cache)), and a send the model starts after
1264
+ 30 quiet minutes asks you first ([peers.md](peers.md#quiet-pairings)).
1221
1265
  - **The skill.** `skill_claude_peer` (system scope) tells the model to send
1222
1266
  only when you ask or to reply in a peer turn, to pick the part rather than
1223
1267
  the session, not to wait or poll, and how to read Claude's answer in its
@@ -1270,24 +1314,14 @@ Claude pairs; without one the bundle costs one tool declaration.
1270
1314
  session (sshd makes it the user's, mode 0600 by default): fine on your own
1271
1315
  machine or pod, not a shared host. Codex has no socket: codex-peer has no
1272
1316
  `pair-remote`.
1273
- - **A continue.** The pairing and the mailbox stay with the old session when
1274
- you continue it ([peers.md](peers.md#continuing-a-session)). The new
1275
- session's worker posts Claude one message, from a quiet init task, to the
1276
- socket the old session's pairing names:
1277
-
1278
- ```
1279
- chi <old> · moved · continued as <new id>
1280
- This chi session was continued as <new id>. Pair with <new id> the way you paired with <old>, then answer there (chi peer say claude <new id> …).
1281
- ```
1282
-
1283
- Claude's skill pairs again with the new id the same way it paired before
1284
- (the same `CHI_REMOTE`; over SSH, `pair-remote` with the new id). It is
1285
- posted once (a marker under the bundle's `sessions/<id>/`, so a worker
1286
- restart doesn't post it again); a post that fails (that Claude session
1287
- ended) is logged and dropped. An answers-only pairing has no address to
1288
- post to: Claude's next say to the old id is refused with the new one
1289
- (`this session was continued as <id>`), and the skill pairs again and says
1290
- the answer there. What Claude said that the old session hadn't read
1317
+ - **A continue.** The pairing follows the chain
1318
+ ([peers.md](peers.md#continuing-a-session)): the continue copies it to the
1319
+ new session, Claude is told nothing, and chi's next send names the new id
1320
+ in its header. A say to the old id goes to the new session, its line ending
1321
+ `session continued as <id8>: answer there`. Over SSH the forwarded socket
1322
+ keeps the old id's name and still works. A chain an older chi continued has
1323
+ no copy: the say is refused (`this session was continued as <id>`), and the
1324
+ skill pairs again there. What Claude said that the old session hadn't read
1291
1325
  reaches the new one as one note.
1292
1326
  - **Asking first.** The tool has no `targets:`, so guardrails match it by name
1293
1327
  only: to be asked before each send, add a rule ([Rules in
@@ -1370,7 +1404,7 @@ skill install card, the web's linked send and answer: "Codex answered") works th
1370
1404
  (absolute: config.toml doesn't expand `~`), `--yes` makes the folder so the
1371
1405
  root exists when Codex restarts, and the pair script names the line when a
1372
1406
  write is refused ("Operation not permitted"). chi never edits Codex's
1373
- config. Reading a payload file needs nothing: the default sandbox reads
1407
+ config.toml. Reading a payload file needs nothing: the default sandbox reads
1374
1408
  anywhere. With chi on this machine no network is needed: a say writes
1375
1409
  files, and chi wakes on them (a stopped worker can't be started from inside
1376
1410
  the sandbox: the say says so, and chi reads the message at its next start). Through a remote it is the other way
@@ -1379,9 +1413,20 @@ skill install card, the web's linked send and answer: "Codex answered") works th
1379
1413
  bundle's `scripts/chi-peer-SKILL.md` to
1380
1414
  `$CODEX_HOME/skills/chi-peer/SKILL.md` (else `~/.codex/…`), with the
1381
1415
  installed `scripts/pair` path, the payload folder and the writable root
1382
- written in; in Codex you say "pair with chi <id or chi web URL>", and
1383
- `sh <bundle>/scripts/pair` runs `chi peer pair codex <id> --address
1384
- <thread id>` (a re-pair refreshes it). Run outside Codex (no
1416
+ written in; in Codex you say "pair with chi" (with an id or chi web URL
1417
+ when several chi sessions run in the project), and `sh <bundle>/scripts/pair`
1418
+ runs `chi peer pair codex [<id>|--here] --address <thread id> --peer-session <thread id>` (a re-pair
1419
+ refreshes it). `/codex pair` makes the chi session wait 10 minutes for
1420
+ that; Codex doesn't list itself, so there is no list and no Show. `/codex start` opens Codex in a background
1421
+ kitty tab (the setting `start_command`, default `codex`) with the first prompt "pair with chi": one Codex turn,
1422
+ with or without the start hook. The card's **Add the start hook…** (`/codex install-hook`) shows the merged
1423
+ `$CODEX_HOME/hooks.json` (else `~/.codex/hooks.json`) as a diff, and that card's **Add the start hook**
1424
+ (`/codex install-hook --yes`, only on your tap: not from a tool call or `chi send`) appends one `SessionStart`
1425
+ group, `<chi> peer announce codex 2>/dev/null || true`, every other hook kept in its place; never `config.toml`.
1426
+ With it, a new interactive Codex in the project pairs with a waiting session at its first message (never a
1427
+ `codex exec` or a resume; a subagent should not, untested), and the skill's "pair with chi" then says paired. Codex asks you to review
1428
+ the hook at its next start (Review hooks, or `/hooks`) and skips it until you trust it; a `/codex start` tab
1429
+ stops on that screen the first time (Show it). See [peers.md](peers.md) (Codex's start hook). Run outside Codex (no
1385
1430
  `CODEX_THREAD_ID`) it refuses. Codex replies with `chi peer say codex <id>
1386
1431
  --wake --re <the ref: line> --summary … --wait 8` and quotes the line to
1387
1432
  you. The note holds the message's text as claude-peer's does, and Codex can
@@ -1417,15 +1462,12 @@ skill install card, the web's linked send and answer: "Codex answered") works th
1417
1462
  guardrails rule with `tool: codex_send` (see the claude-peer section).
1418
1463
  - **The peer loop** works as claude-peer's: Codex is declared a peer
1419
1464
  (`chi.peer codex`), its messages wake chi up to `peer.turns` turns in a
1420
- row, and `VERDICT OK` wakes chi once to close the round; `codex_read`
1421
- reads a long message. Needs the chi that has the mailbox; an older
1465
+ row, and `VERDICT OK` wakes chi once to close the round, with the same
1466
+ cold hold and quiet ask; `codex_read` reads a long message. Needs the chi that has the mailbox; an older
1422
1467
  codex-peer fails to load there with "upgrade this bundle".
1423
- - **A continue** works as claude-peer's: the new session queues Codex the
1424
- `moved` message on the thread the old session's pairing names, once, and
1425
- Codex's skill pairs again with the new id (the same `CHI_REMOTE`, if any).
1426
- An answers-only pairing has no address: Codex pairs again when its next
1427
- say is refused. A closed Codex session still takes the message; it waits
1428
- for `codex resume` there.
1468
+ - **A continue** works as claude-peer's: the pairing is copied to the new
1469
+ session, Codex is told nothing, and its say to the old id goes to the new
1470
+ one.
1429
1471
 
1430
1472
  ## The ruby bundle
1431
1473
 
data/docs/cli.md CHANGED
@@ -22,7 +22,7 @@
22
22
  - `chi note [--source NAME] [-m TEXT] (ID|PREFIX)... | --all` — add a context note (TEXT or stdin) to sessions: background the model sees on its next turn; it starts no turn (see [Sessions: Context notes](sessions.md#context-notes))
23
23
  - `chi broadcast [-m TEXT] [--all] [--dry-run]`, `chi broadcast log [--last N] [--format json]`, `chi broadcast deliver BROADCAST_ID (ID|PREFIX)...` — share one piece of information (TEXT or stdin) with every session it may concern, as a context note from `broadcast` (see [Broadcast](broadcast.md))
24
24
  - `chi context <add|push|ls|show|refresh|rm|mute|unmute> …` — attach live external text to sessions (a command chi runs every so often, or text pushed in); the model gets a short note when it changes and reads it with `context_read`; `chi context add <URL>` attaches a GitHub PR with the github-pr bundle; `chi context push NAME -m TEXT` (the long form is `--message TEXT`) gives a `--push` source its new text, read from stdin when no `-m` is given (see [Attached context](context.md))
25
- - `chi peer pair|unpair|say|ls …` — a peer agent's side of a session (a Claude Code or Codex session paired with it; see [Peers](peers.md)): `pair NAME ID [--address ADDR] [--from TEXT]` pairs (refused for a continued session, naming its next id, and for a live worker older than the mailbox: restart it), `unpair NAME ID` ends the pairing (its messages stay), `say NAME ID (--wake|--nowake) [--summary TEXT] [--re REF] [-m TEXT] [--wait SECONDS]` leaves a message and prints what chi did with it (`#12 received · woke chi`, `held: … · waits for the user's next message`, `noted`, or why it can't say yet), `ls ID [--format json]` the session's peers, their messages and receipts. A refusal exits 1 (nothing written), a usage error 2; `--remote` runs it through that machine's chi web, which waits for the say
25
+ - `chi peer pair|unpair|say|ls …` — a peer agent's side of a session (a Claude Code or Codex session paired with it; see [Peers](peers.md)): `pair NAME ID [--address ADDR] [--from TEXT] [--peer-session ID]` pairs (a continued session's chain's live link, named; refused for a live worker older than the mailbox: restart it; `--peer-session`: the peer's own session id, which a resume refreshes by), `pair NAME --here --address ADDR …` pairs with no id (the session that waits for NAME in this folder's project, else the project's live session paired with this peer already, by its peer session or this address (said paired, nothing written), else the project's one live session, else exit 1 with the candidates; a session paired with another peer already, or one another pairing is taking now, exits 1 too: `--here` never replaces a pairing; this machine only), `announce NAME` is a peer's start hook: `announce claude` Claude Code's (lists this Claude here from the hook's stdin and `CLAUDE_*` env, refreshes its pairings, takes a waiting session), `announce codex` Codex's (from the hook's stdin alone: a fresh interactive Codex, read from its rollout's first line, takes the waiting session; a `codex exec`, a resume or a subagent never does); it prints only lines for the peer's start context, exit 0 always; this machine only, `unpair NAME ID` ends the pairing (its messages stay), `say NAME ID (--wake|--nowake) [--summary TEXT] [--re REF] [-m TEXT] [--wait SECONDS]` leaves a message and prints what chi did with it (`#12 received · woke chi`, `held: … · waits for the user's next message`, `noted`, or why it can't say yet), `ls ID [--format json]` the session's peers, their messages and receipts. A refusal exits 1 (nothing written), a usage error 2; `--remote` runs it through that machine's chi web, which waits for the say
26
26
  - `chi context report [--days N]` — the candidate judge's counts from `context_candidates.jsonl`: candidates proposed, mentioned, attached or declined by you; the judge's asks; what it would attach per threshold, and how that agrees with what you did (this machine only; see [The log and the report](context.md#the-log-and-the-report))
27
27
  - `chi send [-m TEXT] [--image PATH]... [--cut | --queue] [--as NAME] (ID|PREFIX)...` — send a message to sessions as if typed there (from an agent, as that agent: `--as NAME` or its marker, see [An agent's messages](sub-agent.md#an-agents-messages-driver-and-visitor); `--new --driver NAME` names a new session's driver): a turn starts (or a running one takes it at its next step; `--cut` asks it to cut long thinking for it; `--queue` runs it as a turn of its own after the running one, and `--queue --wait` waits for that turn's own answer); piped stdin goes above `-m` as quoted context, and `--image` attaches images (see [Sessions: Sending a message](sessions.md#sending-a-message)); to a session that was continued it goes to its chain's newest link (`3f9a1c2e → 7b2d41aa (continued) sent`; the old link stays archived; one being continued right now waits up to 10 s for its new link, then `refused: session 3f9a1c2e is being continued as 7b2d41aa-…; send again in a moment`), so a chain's first id is a stable address; `--new` starts a session with it instead (`--new --continues ID|last:ID` the next link of that session's chain, see [Session chains](sessions.md#session-chains)), and `--wait` prints the answer (`--wait ID` with no message waits for the next reply without sending — to an idle session whose last turn already ended, that ended turn's reply or end comes back; `--wait --turn T ID` with no message waits for exactly turn T, whether running, queued or last ended; `--format json` includes its `turn_id` when known, for waiting again after exit 3 or 4; exit 3 a question waits, its options on stderr; exit 4 `--timeout` passed with the turn still running; see [Starting a session](sessions.md#starting-a-session))
28
28
  - `chi answer ID --question QID (--option N|LABEL)... [--text T] [--timeout S] [--format json]` (or `--dismiss`) — answer the question a session waits on (the one `chi send --wait` exited 3 with), then wait and print what comes next as `chi send --wait` does: the reply (0), the next question (3), still running after `--timeout` (4). `--option` is 1-based or the label, repeated on a multi-select question; `--text` is free text, or a Deny's reason; `--dismiss` leaves it unanswered and the model finishes its reply. A question no longer open (the web answered first) isn't answered again: it waits for that turn's reply. An option the question doesn't offer exits 2; a worker that is gone exits 1 (`send the task again: chi send --wait -m "…" ID`). What a parent may pick follows `guardrails.parent_answers`, or the session's own `parent_answers` when stricter (`soft`, the default: a deny, a plain answer, Continue and "Allow once"; `standard`: no allow; `hard`: no Continue either), never a wider scope or an allow on chi's own config; a refused pick exits 1 with what to answer instead (a convention, not a security boundary; see [Guardrails](guardrails.md#answers-from-a-parent-agent))
@@ -213,10 +213,15 @@ $ chi models
213
213
  gemma-4 # the default (default.model), first
214
214
  splash:incoai/Qwen3.8-27B-Splash # another host's id: host:id
215
215
  openrouter:qwen/qwen3.8-27b
216
+ main:served → Qwen3.8-27B-Splash # a host listing one model: what it serves now
216
217
  small -> box:gemma-small # an alias and the ref it resolves to
217
218
  $ chi models qwen # only the names containing "qwen" (any case)
218
219
  ```
219
220
 
221
+ - A host whose own `/v1/models` lists exactly one id also offers `host:served` (printed `host:served → <id>`, its
222
+ host's first name), which follows whatever that host serves; `--model main:served` takes it (see
223
+ [configuration](configuration.md#the-model-a-host-serves-now-served)). A host listing several or none offers none.
224
+
220
225
  - A host's ids declared under `hosts.<name>.models` (see
221
226
  [configuration](configuration.md#models-a-host-serves-but-doesnt-list)) come first under that host, listed or not,
222
227
  as plain names like any other. They stay when the host fails, and its stderr warning says so
@@ -226,7 +231,8 @@ $ chi models qwen # only the names containing "qwen" (any case)
226
231
  - Each run lists anew (no cache); `--timeout S` caps the wait for the hosts (default 4 s). A host that fails or doesn't
227
232
  answer in time is noted on stderr (`chi models: box: no answer in 4 s`).
228
233
  - `--format json` prints one object: `default` (and `default_typed` when it was set as an alias), `default_host`,
229
- `models` (`name`, `host`, `id`, and `configured: true` on an id declared under `hosts.<name>.models`,
234
+ `models` (`name`, `host`, `id`, `served: true` on a `host:served` row (its `id` the one the host lists),
235
+ `configured: true` on an id declared under `hosts.<name>.models`,
230
236
  `unavailable: true` too when that host failed to list its models), `aliases` (`name`, `ref`, `host`) and `warnings`. The desktop helper's model
231
237
  chooser reads it.
232
238
  - Exit 0 when any host listed its models, 1 when none did (the default and declared names still print), 2 on a
@@ -531,8 +537,9 @@ fire twice.
531
537
 
532
538
  The model can register its own schedules with `schedule_task` (defaulting to the
533
539
  session it is in), list them with `list_schedules` and stop them with
534
- `cancel_schedule`; like `register_reminder`, these are owner-voiced tools, refused
535
- in a participant's turn.
540
+ `cancel_schedule`. A participant's turn is refused all three: like
541
+ `register_reminder`, `schedule_task` and `cancel_schedule` are owner-voiced, and
542
+ `list_schedules` reads the owner's schedules.
536
543
 
537
544
  ## Flags
538
545
 
@@ -549,7 +556,7 @@ invalid option (exit 1).
549
556
  | `--attach SESSION_ID` | Attach to a session's worker, waking one if it has exited. |
550
557
  | `--remote NAME` | Before a session command (`chi --remote studio send …`) or the run flags (`chi --remote studio --attach ID`, `--resume ID`, `--dir DIR -p TEXT`): run it against that remote's sessions, through its chi web; beats `CHI_REMOTE`. Commands and flags that run on this machine only exit 2. See [Remote sessions](#remote-sessions). |
551
558
  | `--dir DIR` | With `--remote`: a new session's folder on that machine, its absolute path (required for a new session there). Without `--remote` it exits 2: cd there instead. |
552
- | `--model NAME` | Use this model for the run (overrides the configured default and a resumed session's model). |
559
+ | `--model NAME` | Use this model for the run (overrides the configured default and a resumed session's model). `host:served` (`main:served`) is whatever that host serves now, checked at each turn's start (configuration.md, "The model a host serves now"); `/model main:served` moves a session onto it. |
553
560
  | `--thinking LEVEL` | This session's own thinking level: `off`, `low`, `medium` or `high`, saved in the session and first in the order (`default` unsets it). On `--resume` or `--attach` it is set at once, through a `/thinking` on an attached worker. With `chi web` it is instead the default for the sessions its workers run, below a session's own (as env `SAMAGOTCHI_THINKING_LEVEL` is). See "Thinking" in configuration.md. |
554
561
  | `--toolkit NAME`, `--tool NAME`, `--no-tool NAME` | A new session's toolkit, the tools its prompts declare: `full` (every built-in and plugin tool), `lean`, `child`, one of config's `toolkit.kits` or a bundle's (without `--toolkit`: config's `toolkit.default`), with tools declared on top of it (`--tool`) or left out (`--no-tool`); both repeatable, a comma list too. Saved in the session as given; a respawned worker, a fork and a continue keep it. Ignored with `--attach`/`--resume` (one line, as `--memory`); `/toolkit` changes it. Not on `chi web` (config's `toolkit.default` covers its sessions). See [Toolkits](configuration.md#toolkits). |
555
562
  | `--parent-answers LEVEL` | A new session's own `guardrails.parent_answers` (`hard`, `standard` or `soft`): what a parent agent may answer on its questions. It may only tighten config.yml's: the stricter of the two applies, and a looser one is saved as given with a warning (`--parent-answers soft is looser than config.yml's guardrails.parent_answers: standard; standard applies`). Saved in the session; a respawned worker, a fork and a continue keep it, a `delegate` child takes its parent's. Ignored with `--attach`/`--resume` (one line, as `--toolkit`); refused with `chi web`. Only you loosen it: `/parent-answers` in the terminal or the web. See [Guardrails](guardrails.md#answers-from-a-parent-agent). |
@@ -790,12 +797,21 @@ approval, queued prompt, or running background task; otherwise it says to run
790
797
  `chi sessions stop ID`, then send any prompt. That fallback drops reminders,
791
798
  and may lose a running `/btw` and other in-memory state. A session with no running worker needs no restart (its next
792
799
  prompt starts one on the newest chi), and an older worker without restart
793
- support needs `chi sessions stop ID`. A stopped session, or one being stopped
794
- (`chi sessions stop`), is refused at once without asking its worker: "can't
795
- restart: the session is stopped; only its owner's message starts it again (on
796
- the newest chi)". The Web UI's
797
- `POST /api/sessions/:id/restart` does the same (409 with `reason` and `detail`
798
- when it can't). An attached
800
+ support needs `chi sessions stop ID`. A stopped session (`chi sessions stop`)
801
+ is started again, as `chi --resume ID` does without a terminal: "Started session
802
+ ID again on chi X." (or "Starting session ID again; its worker is still
803
+ starting."); one being stopped starts once its worker has left, or, if it is
804
+ still leaving after 10 s, "is still stopping; restart it again in a moment".
805
+ Its delegates the stop stopped stay stopped. Run by an agent (the markers `chi
806
+ send` reads: CLAUDECODE, CODEX_THREAD_ID, AI_AGENT, a chi session's shell) the
807
+ restart of a stopped session is refused at once: "can't restart: the session is
808
+ stopped; only its owner's message starts it again (on the newest chi); ask your
809
+ user to start it: `chi --resume ID`, or a message from a terminal or the web"
810
+ (`chi --remote NAME --resume ID` with `--remote`), since only its owner starts a
811
+ stopped session. chi web's restart after an update leaves stopped sessions
812
+ stopped. The Web UI's `POST /api/sessions/:id/restart` does the same (a body
813
+ `{"start_stopped": false}` is an agent's; 409 with `reason` and `detail` when it
814
+ can't; `was_stopped: true` in the 200 when it started a stopped session). An attached
799
815
  terminal says at the join, in one `chi>` line, when the worker or the terminal
800
816
  runs an older chi than the newest installed (the worker moves with `chi
801
817
  sessions restart ID`, the terminal with `/detach` and `chi --attach ID`), and
@@ -1349,7 +1365,8 @@ first line of what a hook presented in its place, else its first heading,
1349
1365
  else its first line); click again to unfold. A delegate report's reply
1350
1366
  folds the same way, and so does a long prompt you sent (over the same
1351
1367
  threshold; its folded row shows its first line as typed). A delegate
1352
- report itself starts folded. Folding is this browser's choice, kept per session in
1368
+ report itself starts folded, a short one too, and so does a peer's answer
1369
+ (one row: the peer, its verdict, its summary and its length). Folding is this browser's choice, kept per session in
1353
1370
  localStorage (`chi_answer_fold:<session id>`, the last 200 folded answers and prompts;
1354
1371
  the keys of sessions gone from the list are dropped when the list loads);
1355
1372
  other viewers (a participant's browser too) are not affected. A jump into a
@@ -1361,10 +1378,22 @@ nothing, an objectives line and a plugin's nudge fold into one closed row where
1361
1378
  the first of them sits, "▸ 3 notes · claude-inbox, source-links, skills". A tap
1362
1379
  (or a click, Enter, Space) opens it and the items show under it as they are;
1363
1380
  another closes it. A warning among them marks the row with a yellow edge and
1364
- "⚠ 1", and it stays closed. Your prompt, the answer, a peer's answer and a note
1365
- that starts a turn stay as they are, and a time divider or a peer's answer
1366
- between two items gives each side a row of its own. The row isn't remembered:
1367
- a reload or another session shows it closed again.
1381
+ "⚠ 1", and it stays closed. Your prompt, the answer and a note that starts a
1382
+ turn stay as they are, and a time divider between two items gives each side a
1383
+ row of its own. The row isn't remembered: a reload or another session shows it
1384
+ closed again.
1385
+
1386
+ Delegate reports and peers' answers next to each other and to those notes are
1387
+ one line too, a segment per kind: "1 report · Claude: changes · 3 notes ⚠ 1"
1388
+ ("Claude ×2" for two of one peer's answers, "Claude answered" without a
1389
+ verdict). A tap on a segment shows that kind's rows under the line, one compact
1390
+ row each ("check-in 50 tool calls, no answer yet", "child ab12cd The guard is in. 17 lines"), one segment at a
1391
+ time; a tap on a row opens its text. A report
1392
+ or a peer's answer alone keeps its own row, notes alone their notes row. What
1393
+ ends a line: your prompt, chi's answer, a card, a time divider. On a phone it
1394
+ stays one line, the notes segment cut short first. The line isn't remembered
1395
+ either: a report or an answer you opened shows open again once you tap its
1396
+ segment.
1368
1397
 
1369
1398
  **Revise** rewrites an answer and stacks the versions. A finished turn's
1370
1399
  final answer has a Revise button on its bottom edge (on hover; always shown
@@ -2007,6 +2036,7 @@ In interactive assist mode, you can switch the request model without restarting:
2007
2036
  - `/model --default <name>`: set session model and persist as new default (`default.model`) in `config.yml` for future sessions (supports `host:model` full ref). It writes only the file: an exported `SAMAGOTCHI_DEFAULT_MODEL` (or `--model`) still wins over it.
2008
2037
  - `/model <name> --alias <alias>`: create alias for current effective model (alias value may be bare or `host:model`).
2009
2038
  - `/model`: show the effective model (and default when diverged: `runtime model: <effective> (default: <default>, profile=<name>, <source>)`, e.g. `profile=qwen36, server (chat_template)`). When the session's prompt carries model notes the line ends with `; notes: model_notes_deepseek (system, 612 chars)`; a switch's `runtime model set to …` names the new model's ([Memory](memory.md#model-notes)).
2039
+ - `/model main:served`: follow whatever host `main` serves now (configuration.md, "The model a host serves now"); a bare `/model` then shows `runtime model: main:served → <id>`, the id it runs on now.
2010
2040
  - `/model clear` (or `default`/`none`/`off`): clear the session override, reverting to the configured default.
2011
2041
  - Once the session has a model reply, a switch to another model asks first from a web tab or a TUI (the new model
2012
2042
  has no cache of the conversation): the reply names the line with `--yes` that applies it, flags and all
@@ -2015,7 +2045,7 @@ In interactive assist mode, you can switch the request model without restarting:
2015
2045
  - `/guardrails`: the guardrail rules (by source), what failed to load, your stored approvals, and System 1's
2016
2046
  recent auto-allows; `/guardrails revoke N` removes approval N and `/guardrails wrong [N]` flags an auto-allow
2017
2047
  this session should have been asked about (see [Guardrails](guardrails.md)).
2018
- - `/models`: list model ids aggregated across all `hosts:` (an alias shows next to its id: a bare alias on every host listing the id, a `host:model` one only under its host; grouped `host (host:port):` with per-host `unreachable` warnings, e.g. an unset `api_key_env`; lists cached 60s, 10 minutes for a remote host; lazy — no startup prefill). Ids the host declares under `hosts.<name>.models` come first, as `rr/x (config)`, and don't count toward the cap; an unreachable host keeps them, under its warning, as `rr/x (config, host down)`. At most 20 ids per host, then `… and N more`; `/models <text>` lists every id containing `<text>` (any case), e.g. `/models qwen` on OpenRouter.
2048
+ - `/models`: list model ids aggregated across all `hosts:` (an alias shows next to its id: a bare alias on every host listing the id, a `host:model` one only under its host; grouped `host (host:port):` with per-host `unreachable` warnings, e.g. an unset `api_key_env`; lists cached 60s, 10 minutes for a remote host; lazy — no startup prefill). Ids the host declares under `hosts.<name>.models` come first, as `rr/x (config)`, and don't count toward the cap; an unreachable host keeps them, under its warning, as `rr/x (config, host down)`. At most 20 ids per host, then `… and N more`; `/models <text>` lists every id containing `<text>` (any case), e.g. `/models qwen` on OpenRouter. A host whose own listing names exactly one id starts with `served → <id>` (with its aliases, e.g. `(alias: splash)` for `splash: main:served`), the name `host:served` takes; an alias of `host:served` is never listed as an orphan.
2019
2049
 
2020
2050
  Notes:
2021
2051