samagotchi 0.191.0 → 0.193.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 (141) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +91 -1
  3. data/docs/architecture.md +8 -7
  4. data/docs/bundles.md +46 -29
  5. data/docs/cli.md +37 -15
  6. data/docs/configuration.md +10 -4
  7. data/docs/context.md +8 -5
  8. data/docs/guardrails.md +9 -4
  9. data/docs/internals/bridge.md +3 -1
  10. data/docs/internals/bundles.md +2 -2
  11. data/docs/internals/inline-widgets.md +2 -1
  12. data/docs/internals/pages.md +4 -4
  13. data/docs/internals/participants.md +6 -8
  14. data/docs/internals/peers.md +75 -22
  15. data/docs/internals/prompt-caching.md +2 -1
  16. data/docs/internals/remote-sessions.md +9 -0
  17. data/docs/internals/session-lifecycle.md +36 -21
  18. data/docs/internals/web-frontend.md +195 -25
  19. data/docs/internals/working-set.md +5 -1
  20. data/docs/peers.md +71 -22
  21. data/docs/plugins.md +7 -4
  22. data/docs/releasing.md +30 -2
  23. data/docs/scheduling.md +10 -3
  24. data/docs/sessions.md +3 -3
  25. data/docs/testing.md +36 -5
  26. data/docs/thin-clients.md +114 -12
  27. data/lib/samagotchi/bridge.rb +2 -3
  28. data/lib/samagotchi/bundles/claude-peer/manifest.yml +2 -2
  29. data/lib/samagotchi/bundles/claude-peer/scripts/chi-peer-SKILL.md +33 -17
  30. data/lib/samagotchi/bundles/codex-peer/manifest.yml +2 -2
  31. data/lib/samagotchi/bundles/codex-peer/scripts/chi-peer-SKILL.md +34 -17
  32. data/lib/samagotchi/bundles/coordinator/manifest.yml +2 -2
  33. data/lib/samagotchi/bundles/coordinator/skill_coordinator.md +31 -0
  34. data/lib/samagotchi/bundles/mcp/manifest.yml +4 -2
  35. data/lib/samagotchi/bundles/mcp/plugin.rb +7 -405
  36. data/lib/samagotchi/bundles/mcp/server_config.rb +158 -0
  37. data/lib/samagotchi/bundles/mcp/sign_in.rb +261 -0
  38. data/lib/samagotchi/bundles/system/manifest.yml +1 -1
  39. data/lib/samagotchi/client_id.rb +2 -19
  40. data/lib/samagotchi/compat.rb +6 -5
  41. data/lib/samagotchi/config.rb +7 -0
  42. data/lib/samagotchi/continue_offer.rb +13 -1
  43. data/lib/samagotchi/delivery.rb +3 -7
  44. data/lib/samagotchi/engine/models.rb +17 -0
  45. data/lib/samagotchi/engine/plugins.rb +2 -0
  46. data/lib/samagotchi/guardrails/pair_boundary.rb +49 -18
  47. data/lib/samagotchi/jsonl_store.rb +13 -2
  48. data/lib/samagotchi/llm/anthropic_messages.rb +11 -0
  49. data/lib/samagotchi/llm/openai_chat.rb +5 -0
  50. data/lib/samagotchi/llm/prompt_cache.rb +5 -0
  51. data/lib/samagotchi/pages/launch.rb +1 -1
  52. data/lib/samagotchi/peer_cold.rb +92 -0
  53. data/lib/samagotchi/peer_command.rb +24 -9
  54. data/lib/samagotchi/peer_continue.rb +32 -16
  55. data/lib/samagotchi/peer_exchanges.rb +7 -0
  56. data/lib/samagotchi/peer_mailbox.rb +21 -4
  57. data/lib/samagotchi/peer_receipts.rb +33 -6
  58. data/lib/samagotchi/peer_say.rb +34 -16
  59. data/lib/samagotchi/plugin/api.rb +2 -1
  60. data/lib/samagotchi/plugin/context.rb +13 -1
  61. data/lib/samagotchi/plugin/peer.rb +118 -53
  62. data/lib/samagotchi/plugin/peers.rb +13 -6
  63. data/lib/samagotchi/schedule_command.rb +1 -0
  64. data/lib/samagotchi/schedules/prune_part.rb +32 -0
  65. data/lib/samagotchi/schedules.rb +14 -9
  66. data/lib/samagotchi/session.rb +7 -0
  67. data/lib/samagotchi/session_access/local.rb +98 -37
  68. data/lib/samagotchi/session_access/remote.rb +1 -1
  69. data/lib/samagotchi/session_access/remote_peers.rb +3 -3
  70. data/lib/samagotchi/session_chain/links.rb +8 -3
  71. data/lib/samagotchi/session_continue.rb +15 -7
  72. data/lib/samagotchi/session_lifecycle.rb +4 -0
  73. data/lib/samagotchi/session_manager/delivery.rb +0 -6
  74. data/lib/samagotchi/session_manager/lifecycle.rb +30 -17
  75. data/lib/samagotchi/session_manager/listing.rb +2 -1
  76. data/lib/samagotchi/session_manager/removal.rb +7 -5
  77. data/lib/samagotchi/session_manager/spawn.rb +8 -4
  78. data/lib/samagotchi/session_manager.rb +4 -0
  79. data/lib/samagotchi/session_row.rb +2 -0
  80. data/lib/samagotchi/session_stores.rb +16 -11
  81. data/lib/samagotchi/session_transition.rb +61 -15
  82. data/lib/samagotchi/system_one/runs.rb +5 -2
  83. data/lib/samagotchi/testing/boundary.rb +0 -1
  84. data/lib/samagotchi/testing/host.rb +1 -0
  85. data/lib/samagotchi/testing/recorder.rb +3 -0
  86. data/lib/samagotchi/tools/cancel_schedule.rb +10 -6
  87. data/lib/samagotchi/version.rb +1 -1
  88. data/lib/samagotchi/web/app.rb +3 -1
  89. data/lib/samagotchi/web/ask_create.rb +138 -0
  90. data/lib/samagotchi/web/ask_routes.rb +56 -9
  91. data/lib/samagotchi/web/last_ask.rb +78 -0
  92. data/lib/samagotchi/web/peer_routes.rb +10 -5
  93. data/lib/samagotchi/web/public/agent_rows.js +206 -0
  94. data/lib/samagotchi/web/public/agent_runs.js +595 -0
  95. data/lib/samagotchi/web/public/answer_fold.js +41 -44
  96. data/lib/samagotchi/web/public/answer_refs.js +3 -9
  97. data/lib/samagotchi/web/public/answer_write.js +28 -0
  98. data/lib/samagotchi/web/public/app.js +75 -99
  99. data/lib/samagotchi/web/public/block_fix.js +30 -12
  100. data/lib/samagotchi/web/public/cards_place.js +6 -4
  101. data/lib/samagotchi/web/public/chains.js +3 -1
  102. data/lib/samagotchi/web/public/command_list.js +5 -3
  103. data/lib/samagotchi/web/public/composer.js +9 -6
  104. data/lib/samagotchi/web/public/composer_mount.js +18 -11
  105. data/lib/samagotchi/web/public/draft_keys.js +10 -0
  106. data/lib/samagotchi/web/public/drafts.js +278 -0
  107. data/lib/samagotchi/web/public/history_reveal.js +5 -2
  108. data/lib/samagotchi/web/public/index.html +38 -2
  109. data/lib/samagotchi/web/public/owner_claim.js +7 -12
  110. data/lib/samagotchi/web/public/page_view.js +1 -1
  111. data/lib/samagotchi/web/public/pages.css +1 -7
  112. data/lib/samagotchi/web/public/peer_mailbox_api.js +2 -1
  113. data/lib/samagotchi/web/public/peer_note.js +4 -2
  114. data/lib/samagotchi/web/public/peer_row.js +37 -0
  115. data/lib/samagotchi/web/public/prompt_history.js +6 -0
  116. data/lib/samagotchi/web/public/quiet_notes.js +12 -1
  117. data/lib/samagotchi/web/public/revise_stack.js +5 -2
  118. data/lib/samagotchi/web/public/send_turn.js +62 -23
  119. data/lib/samagotchi/web/public/session_actions.js +80 -16
  120. data/lib/samagotchi/web/public/session_prefs.js +9 -3
  121. data/lib/samagotchi/web/public/session_view.js +7 -2
  122. data/lib/samagotchi/web/public/turn_block.js +4 -0
  123. data/lib/samagotchi/web/public/turn_events.js +0 -2
  124. data/lib/samagotchi/web/public/unqueue.js +22 -9
  125. data/lib/samagotchi/web/public/viewer_self.js +1 -6
  126. data/lib/samagotchi/web/public/views.js +12 -1
  127. data/lib/samagotchi/web/session_access_routes.rb +6 -3
  128. data/lib/samagotchi/web/session_control.rb +4 -2
  129. data/lib/samagotchi/web/session_create.rb +50 -33
  130. data/lib/samagotchi/web/session_hub.rb +52 -36
  131. data/lib/samagotchi/web/session_summary.rb +45 -7
  132. data/lib/samagotchi/web/start_dir.rb +6 -4
  133. data/lib/samagotchi/worker/mail.rb +11 -1
  134. data/lib/samagotchi/worker.rb +7 -5
  135. data/lib/samagotchi/worker_inbound/mail.rb +34 -6
  136. data/lib/samagotchi/worker_inbound.rb +11 -3
  137. data/lib/samagotchi/worker_link.rb +13 -1
  138. data/lib/samagotchi/worker_presence.rb +22 -6
  139. data/lib/samagotchi/worker_wakes.rb +33 -5
  140. metadata +12 -2
  141. 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: a2e3f365d9e072d6e62259794b8b820eadfbad98191b52950bd500c3a719cdc6
4
- data.tar.gz: 8f464ea54361dd666264cd430fe51d7f9af6cad6fac31612a1c3fe2f80aacbd1
3
+ metadata.gz: c8b387ef3705f02f31f8b543fc8d85e763a9553ceb2740b4d45df6783fbc7d16
4
+ data.tar.gz: 149c444f36be679f218eab0f31552129675cac92d0af19f874a6398e2d3e71fb
5
5
  SHA512:
6
- metadata.gz: c0ff226bcf7c80d9a2c7d1838da6c456fb971c9f681c4480837908c95abe5e7c82411342f4738864eb8a31411eb6c6ba93f96e2078d72cb48e0aa3ffeebdf60c
7
- data.tar.gz: 1192fbb01bd6a56d59269430db8a3aa0da8523a6ac566c687ad37b0a14c7243dfb60935d134dcc4d9b0bee4b4613efb551ffca238667f71138d26c24d127cc30
6
+ metadata.gz: d4cb3bcfa83d458e9123a25dfe3ea96d10714e7553f397a8198459340b75a01ef754df95dad13d942f0ef14b1306bfee89574b6a80a63ae96cf3f0eecb018dae
7
+ data.tar.gz: f52b92219301a36ff951369ccad3acdb966351fc03094f911549dbf94917a32ecfd231e140617463e4b7972ef88ed4260519db0e1d99405cef44e28c6757659f
data/CHANGELOG.md CHANGED
@@ -8,6 +8,94 @@ and commands may change between minor versions. How releases are made:
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [0.193.0] - 2026-11-29
12
+
13
+ ### Added
14
+
15
+ - coordinator 0.10.0: the coordinator attaches what can change an epic's scope (another team's PR, a pipeline, a
16
+ planning page) as context, a PR by its URL and the rest through a small script of its own, instead of polling it;
17
+ each script source asks you first.
18
+
19
+ ### Changed
20
+
21
+ - Peers: a message Claude or Codex starts on its own (or a `VERDICT OK` closer) while chi's prompt cache has gone cold
22
+ no longer wakes chi to re-read the whole conversation at the write price: it waits as a note for your next message,
23
+ the say's line says `held: chi's cache is cold`, the chip `held · cold`. An answer chi asked for still wakes it. Only
24
+ where chi's requests carry cache breakpoints (Claude models remotely), past `cache.ttl` since the last turn, and on
25
+ a conversation over 20,000 tokens.
26
+ - Peers: when chi's model sends to a peer it hasn't exchanged anything with for 30 minutes (`peer.quiet_minutes`, 0
27
+ turns it off), you are asked first ("Claude last heard from chi 2 h ago: its session may be cold. Send?") in a turn
28
+ 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
29
+ model told you decide. A `/claude …` you type never asks, and the pairing stays.
30
+ - 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
31
+ previous session as its box) instead of pointing at `chi peer ls`, which never printed it.
32
+ - Peers: `peer.turns` counts across a worker restart, so a peer that speaks every 40 minutes is held after its wakes
33
+ as one that speaks every minute is.
34
+ - Peers: a continue takes the Claude or Codex pairing along, and the peer does nothing: no `moved` message, no pair
35
+ 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
36
+ the old id runs on the new session, and the say's line ends `session continued as <id8>: answer there`. A chain an
37
+ older chi continued still refuses the say, naming the new id. Run `chi update`: claude-peer 0.8.0 and codex-peer
38
+ 0.7.0 (then `/claude install-skill` or `/codex install-skill`, Replace): the chi-peer skill says its answer from a
39
+ file, so a say refused with "try again" is run again without writing the answer twice.
40
+ - The thin-client docs' iOS Shortcut recipe is checked on an iPhone: a JSON request body, Pick's steps spelled out
41
+ and the accepted `request_id` key formats.
42
+ - A participant's turn can no longer list the owner's sessions or reminders or read the session's attached context
43
+ (`list_sessions`, `list_reminders`, `context_read`); every built-in tool is classified for a participant's turn, so
44
+ a new one can't slip through unexamined.
45
+ - chi web: a peer's answer starts closed, one row with the peer, its verdict, its summary and its length (a tap opens
46
+ it), and every delegate report starts closed, a short one too.
47
+ - chi web: delegate reports, peers' answers and background notes side by side show as one closed line, "1 report ·
48
+ Claude: changes · 3 notes"; a tap on a segment shows those rows under it.
49
+ - 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 ·
50
+ Claude: changes · 2 calls"); a tap shows the steps row as before, the working set's footprint in it. A typed turn's
51
+ steps, also next to its notes, and cancelled or failed steps look as before. At a narrow width the line cuts the
52
+ notes first, then the calls, then the reports, then the peers, one at a time.
53
+
54
+ ### Fixed
55
+
56
+ - A send answered `not_found` while another session is open now keeps the line in the new-session draft and names
57
+ the gone session in a toast instead of losing it to the draft sweep; the toast stays until you dismiss it.
58
+
59
+ Update with `chi update` (claude-peer 0.8.0, codex-peer 0.7.0, coordinator 0.10.0, mcp 0.9.4).
60
+
61
+ ## [0.192.0] - 2026-11-28
62
+
63
+ ### Added
64
+
65
+ - Phone Shortcuts get three flows: a new session answered in one call (`POST /api/sessions` with `reply_for`,
66
+ `timeout` or `request_id`; set `web.ask_dir` and the Shortcut can leave out the folder), `POST
67
+ /api/sessions/last/ask` for the session you last asked from your phone (following continues), and a recent-sessions
68
+ list without delegates (`GET /api/sessions/summaries?delegates=0`). docs/thin-clients.md has an iOS Shortcut recipe
69
+ with a New / Last / Pick menu.
70
+
71
+ ### Changed
72
+
73
+ - Each session keeps its own draft in the web composer: text typed in one session no longer shows in another, a pick or
74
+ quote goes into the open session's draft, and + new has its own. The draft's text survives a reload in this browser;
75
+ attached images don't.
76
+ - Continuing a session moves its draft to the new link, even if you are in another session when it finishes; the new
77
+ link gets the opener only when there was no draft. The "Restore draft" button is gone.
78
+ - Stopping a session that is being continued, deleted or archived is refused right away and says what to do
79
+ ("session ab12cd34 is being continued as 7b2d41aa-…: stop that one") instead of waiting 10 seconds; in the web the
80
+ toast offers Open on the new link. A refused stop no longer ends the running turn.
81
+ - A participant's client id from chi 0.171 and before (`review:<id>`) is no longer read as a participant's; such turns in
82
+ old sessions show as automatic.
83
+
84
+ ### Fixed
85
+
86
+ - `chi send --new --continues last:<id>` (or a chain schedule's firing) racing another continue of the same chain no
87
+ longer fails with "was continued as …"; it follows to the new link.
88
+ - chi web no longer shows a session as stopped while a one-turn `chi -p` run or a delete holds it, and a worker being
89
+ stopped no longer shows as connected (its worker badge, open card and question go as the stop lands).
90
+ - `chi schedule cancel` (and the `cancel_schedule` tool) says when the schedule it removes was what kept a pruned chain
91
+ reachable from its first session, and names the newest link to send to; before, later sends to the first session
92
+ landed there silently.
93
+ - A block fixed in an answer that a hook's display replaced is redrawn right away, not on the next reload; a live
94
+ answer's bubble shows its time on hover like a reloaded one.
95
+ - A failed block whose fix couldn't be shown no longer stays at "asking for a fix…": it offers Ask in chat.
96
+
97
+ Update with `chi update` (mcp 0.9.3).
98
+
11
99
  ## [0.191.0] - 2026-11-27
12
100
 
13
101
  ### Changed
@@ -6986,7 +7074,9 @@ and long-lived sessions.
6986
7074
  - A macOS desktop helper (`chi desktop install`): a "Send to chi" Service and a
6987
7075
  hotkey panel that send selected text or the clipboard to your sessions.
6988
7076
 
6989
- [Unreleased]: https://github.com/dm1try/samagotchi/compare/v0.191.0...HEAD
7077
+ [Unreleased]: https://github.com/dm1try/samagotchi/compare/v0.193.0...HEAD
7078
+ [0.193.0]: https://github.com/dm1try/samagotchi/compare/v0.192.0...v0.193.0
7079
+ [0.192.0]: https://github.com/dm1try/samagotchi/compare/v0.191.0...v0.192.0
6990
7080
  [0.191.0]: https://github.com/dm1try/samagotchi/compare/v0.190.1...v0.191.0
6991
7081
  [0.190.1]: https://github.com/dm1try/samagotchi/compare/v0.190.0...v0.190.1
6992
7082
  [0.190.0]: https://github.com/dm1try/samagotchi/compare/v0.189.0...v0.190.0
data/docs/architecture.md CHANGED
@@ -247,7 +247,7 @@ agent logic and can be used without any terminal rendering; the UI is a thin lay
247
247
  | UI | `Samagotchi::TerminalUI`, `TerminalUI::AttachLauncher` / `AttachedLoop` | The attached TUI: rendering (ANSI, spinner, status line) and the terminal's own commands over the worker's Bridge. `TerminalUI`: the `--non-interactive` one-shot host, which delegates all core work to its `Engine`. |
248
248
  | Model loops and adapters | `KernelLoop`, `LLM::ChatLoop`, `Samagotchi::Client`, `LLM::OpenAIChat`, `LLM::AnthropicMessages`, `LLM::HTTP` | The model↔tool loops and the HTTP adapters they talk through (see "Model loops and adapters"). |
249
249
  | Bridge (SSE/HTTP) ([internals/bridge.md](internals/bridge.md)) | `Samagotchi::Bridge`, `SessionManager` | The **single live client transport**: an SSE read stream + HTTP POST turn/cancel/answer surface that attaches to a worker's existing `Engine` through its event log, turn state, question desk and steer cut (`Engine#event_log`, `#turn_state`, `#question_desk`, `#steer_cut`, which the Worker hands it). Every session worker starts it (bound `127.0.0.1`, localhost-only), and it answers only a request that names its secret (`X-Chi-Bridge`, from the worker's 0600 `bridge.json`). |
250
- | Web (Rack) | `Samagotchi::Web::App`, `SessionManager` | Single-port `127.0.0.1:4567` control plane via `rack`+`webrick` (serve `index.html` + `/api/*`). With `web.host: lan` (or one of this machine's IPv4 addresses) the server also listens on that address, where every request needs the access token, this machine's on loopback too (`App#token_gate`: the `chi_token` cookie, on loopback a value derived from the token (`Token.loopback_cookie`), or `Authorization: Bearer`; chi web prints a `Local:` link with a one-time code; [CLI](cli.md#chi-web-on-your-phone)). Experimental: behind an auth proxy (`web.public_url`, `Web::ProxyGate`) every request needs the token, this machine's too, and one that came through the proxy also the configured identity header for the owner ([configuration.md](configuration.md#behind-an-auth-proxy)). A request goes through, in order: the Host check (`local_host_header?`: loopback names, the LAN address, the public host), the cross-site check (`cross_site?`: Origin this server's or the public origin, no `Sec-Fetch-Site` cross-site/same-site on a POST or `/api`), the frame check (`framed?`: a frame/embed/object load from another origin, 403 `framed`; every HTML answer carries `X-Frame-Options: DENY` and `frame-ancestors 'none'; frame-src 'none'`, so a page's own frames can't navigate either), the token gate (`token_gate` → `principal_for`, `proxied_principal` for a proxied request; the `?token=` / `POST /api/token` trade sets the cookie, `__Host-chi_token` through the proxy; with `web.public_url` a direct request takes Bearer only, and with it or LAN mode chi's token-less `/api/info` probe gets `probe_info`), then the route's permission (`Principal#permits?`). It talks to each worker's Bridge (`App#relay`, `bridge_get`; `/stream` proxies it) and reads the session files; no `Engine` of its own. Markdown (`web.markdown`) is rendered here only (`Web::MarkdownRenderer`): the answers it serves, card bodies, and `POST /api/render` for a text the page already shows. `App` keeps the gate, `ROUTES` and the helpers the handlers share; its handlers live in mixins it includes, each a `Web::` module with private methods: `SessionAccessRoutes` (`web/session_access_routes.rb`), `ParticipantAccess` (`web/participant_access.rb`), `ParticipantsAdmin` (`web/participants_admin.rb`), `ParticipantReview` (`web/participant_review.rb`), `MessageDisplay` (`web/message_display.rb`), `SessionShow` (`web/session_show.rb`), `SessionCreate` (`web/session_create.rb`), `SessionControl` (`web/session_control.rb`), `PushRoutes` (`web/push_routes.rb`) and `ProxyGate` (`web/proxy_gate.rb`). Exact paths in `GATE_FREE_PATHS` are served before the token gate (the fragment trade's script, and the Home Screen app's manifest, service worker and icons). `bin/chi web` entrypoint. |
250
+ | Web (Rack) | `Samagotchi::Web::App`, `SessionManager` | Single-port `127.0.0.1:4567` control plane via `rack`+`webrick` (serve `index.html` + `/api/*`). With `web.host: lan` (or one of this machine's IPv4 addresses) the server also listens on that address, where every request needs the access token, this machine's on loopback too (`App#token_gate`: the `chi_token` cookie, on loopback a value derived from the token (`Token.loopback_cookie`), or `Authorization: Bearer`; chi web prints a `Local:` link with a one-time code; [CLI](cli.md#chi-web-on-your-phone)). Experimental: behind an auth proxy (`web.public_url`, `Web::ProxyGate`) every request needs the token, this machine's too, and one that came through the proxy also the configured identity header for the owner ([configuration.md](configuration.md#behind-an-auth-proxy)). A request goes through, in order: the Host check (`local_host_header?`: loopback names, the LAN address, the public host), the cross-site check (`cross_site?`: Origin this server's or the public origin, no `Sec-Fetch-Site` cross-site/same-site on a POST or `/api`), the frame check (`framed?`: a frame/embed/object load from another origin, 403 `framed`; every HTML answer carries `X-Frame-Options: DENY` and `frame-ancestors 'none'; frame-src 'none'`, so a page's own frames can't navigate either), the token gate (`token_gate` → `principal_for`, `proxied_principal` for a proxied request; the `?token=` / `POST /api/token` trade sets the cookie, `__Host-chi_token` through the proxy; with `web.public_url` a direct request takes Bearer only, and with it or LAN mode chi's token-less `/api/info` probe gets `probe_info`), then the route's permission (`Principal#permits?`). It talks to each worker's Bridge (`App#relay`, `bridge_get`; `/stream` proxies it) and reads the session files; no `Engine` of its own. Markdown (`web.markdown`) is rendered here only (`Web::MarkdownRenderer`): the answers it serves, card bodies, and `POST /api/render` for a text the page already shows. `App` keeps the gate, `ROUTES` and the helpers the handlers share; its handlers live in mixins it includes, each a `Web::` module with private methods: `SessionAccessRoutes` (`web/session_access_routes.rb`), `ParticipantAccess` (`web/participant_access.rb`), `ParticipantsAdmin` (`web/participants_admin.rb`), `ParticipantReview` (`web/participant_review.rb`), `MessageDisplay` (`web/message_display.rb`), `SessionShow` (`web/session_show.rb`), `SessionCreate` (`web/session_create.rb`), `AskCreate` (`web/ask_create.rb`: a create that answers its first turn), `SessionControl` (`web/session_control.rb`), `PushRoutes` (`web/push_routes.rb`) and `ProxyGate` (`web/proxy_gate.rb`). Exact paths in `GATE_FREE_PATHS` are served before the token gate (the fragment trade's script, and the Home Screen app's manifest, service worker and icons). `bin/chi web` entrypoint. |
251
251
  | Sessions | `Samagotchi::Session`, `SessionManager` | File-based `~/.local/state/samagotchi/sessions/<uuid>.json` + sidecar `input/`/`output/`; retention (14d/500) + ordering (`updated_at desc`). |
252
252
 
253
253
  - `bin/chi` in one-shot mode (`--non-interactive`, see `LaunchMode` above) builds `TerminalUI`.
@@ -504,14 +504,15 @@ model: [internals/remote-sessions.md](internals/remote-sessions.md).
504
504
  | Route | Permission | Body / params | Answer | Refusals |
505
505
  |---|---|---|---|---|
506
506
  | `GET /api/sessions/resolve?id=` | owner | an id or a unique prefix | 200 `{id}` | 404 `not_found`; 400 `ambiguous_id` with `ids` |
507
- | `GET /api/sessions/summaries` | owner | `dir` (a folder: its project; none: every project), `cwd`, `live=1`, `archived=1`, `tests=0`, `sort`, `order`, `limit` | 200: the rows `chi sessions list` prints (`SessionRow#to_summary_h`, 28 keys in a fixed order: `status`, `live`, `busy`, `owner`, `recap`, `ctx_pct`, `waiting`, `waiting_id`, `title`, `preview`, …) | 400 `invalid_dir`, `invalid_cwd` |
507
+ | `GET /api/sessions/summaries` | owner | `dir` (a folder: its project; none: every project), `cwd`, `live=1`, `archived=1`, `tests=0`, `delegates=0` (no delegates or `chi scratch` sessions, counted before `limit`), `sort`, `order`, `limit` | 200: the rows `chi sessions list` prints (`SessionRow#to_summary_h`, 28 keys in a fixed order: `status`, `live`, `busy`, `owner`, `recap`, `ctx_pct`, `waiting`, `waiting_id`, `title`, `preview`, …) | 400 `invalid_dir`, `invalid_cwd` |
508
508
  | `GET /api/projects?dir=` | owner | optional page-scope folder | 200: project rows (`Web::ProjectList`: the hub's projects plus the start project and current project, even without sessions) with counts, roots, default/current marks; no `dir`: no current project | 400 `invalid_dir`; 503 `no_hub` |
509
509
  | `POST /api/projects` | owner | `{dir}` (absolute folder; `~` and `~/` expand against the server's home) | 200 `{outcome, root, dir}` (`created`, `already_marked`, or `git`) | 400 `invalid_json`, `invalid_dir`; 422 `above_home`, `write_failed` |
510
510
  | `POST /api/sessions` (more fields) | owner | `toolkit`, `tools`, `no_tools`, `parent_answers`; `driver` (`agent:<name>`, the new session's driver); `client_id` (`cli:send`/`cli:answer`/`agent:<name>`: the first line is checked as chi send checks it); `check_vision: true` (images follow) | 201 adds `model_warning`, `parent_answers_warning` (a level looser than config.yml's, capped) and `first_turn_id` (the id the prompt it starts with gets for its turn; null for an `idle` create); with a `first_turn_id`, a wait `token` for that turn (none for an `idle` create) | 400 `invalid_toolkit`, `invalid_parent_answers`, `invalid_continues` (beside `continues`); 403 `parent_answers_refused`, `parent_continue_refused`; 422 `no_vision` |
511
+ | `POST /api/sessions` (answered: any of `reply_for`, `timeout`, `request_id`) | owner | the ask's fields (`prompt`, `timeout`, `client_id`, `request_id`, `reply_for`) and the create's; `dir` optional: else `web.ask_dir` (`Config.get` per create, `StartDir.resolve(from: :ask_config)`), else the start folder. A `request_id` names the session (`SessionInbox.enqueued_id_for("create:" + key)`, `AskCreate::LOCKS` per id): a retry spawns nothing | 201: the ask's answer (as `POST …/ask`'s 200) + `session_id`, `created` (false: a retry's), `model_warning`, `parent_answers_warning`; the session spawns idle with the prompt as its preview, then `AskRoutes#run_ask`; records `last` (`Web::LastAsk`) unless a parent's line ([thin-clients.md](thin-clients.md#a-new-session-in-one-call)) | 400 `invalid_ask` (also beside `idle` or `continues`), `invalid_dir` (`web.ask_dir` not a folder), the ask's and the create's 400s, nothing spawned; after the spawn the ask's refusals keep their code and carry `session_id`, `created` |
511
512
  | `POST /api/sessions/:id/turn` (more fields) | owner | `client_id` as above; `check_vision: true` with `images` | as before | 403 `parent_answers_refused`, `parent_continue_refused`; 422 `no_vision`; 409 `link_continued` (`successor_id`) or `transition_busy` while a transition holds the session's lock (every sender: `SessionInbox::Hold`, internals/session-lifecycle.md) |
512
513
  | `POST /api/sessions/:id/wait/prepare` | owner | `question_id` (absent: the pending one; `null`: none), `turn`, `created`, `busy` (+ `queue`) | 200 `{session_id, cursor, baseline: {messages, question_id, last_turn}, own_turn, known_turn, running, live, settled, last_turn_id}` (`WaitStart`) | 409 `busy`, `waiting` (`SendCommand::Busy`'s words, and its fields: `question`, `parent_strategy`) |
513
514
  | `POST /api/sessions/:id/wait` | owner | `cursor`, `baseline`, `turn`, `queued`, `ended_before`, `owner_grace`, `timeout` (capped at 30 s); or `{token, timeout}` (a wait token, `SessionAccess::Exchange::Token`: the answer adds `session_id`, and `token` again while the status is `timeout`; a token beside the other fields, another session's, one that isn't one or a participant's: 400 `invalid_wait`) | 200: `ReplyWait::Result`'s fields (`status`: `done`, `waiting_for_answer`, `no_reply`, `error`, `stopped`, `worker_gone`, or `timeout`: ask again; `text`, `file`, `question` as `PendingQuestion#to_file`, `outcome`, `limit`, `error_kind`, `retryable`, `cancel_reason`, `stopped_by`, `kept_steps`, `turn_id`, `origin`; never the session) and `parent_strategy` `{name, allowed, origin}` (`ParentReport.strategy_for`, this server's config.yml) | 400 `invalid_wait`; 503 `server_stopping` |
514
- | `POST /api/sessions/:id/ask` | owner | `prompt` (16 KiB), `timeout` (default and most 30 s), `queue` (default `true`: a running session queues it as its own turn; `false` refuses it), `client_id` (absent: `web:unnamed`; `cli:send`'s `/continue yes` goes in as `cli:answer` and is parent-gated as on `…/turn`), `request_id` (optional, 1-128 printable ASCII, messages only: a retry with it answers the first ask's turn, `SessionInbox.enqueued_id_for`) | 200: the wait's fields + `session_id` (where it ran), `asked` (the id given, when another link ran it), `token` when the status is `timeout`, `request_id` echoed when given; 200 `{status: command, session_id}` for a session command (`/continue yes` with an offer standing answers the continued turn's fields instead). The whole call answers within `AskRoutes::ASK_MAX_SECONDS` (35) (`Web::AskRoutes`, `SessionAccess::Ask`, [thin-clients.md](thin-clients.md)) | 404 `not_found`; 400 `ambiguous_id`, `missing_fields`, `invalid_prompt`, `local_command`, `invalid_ask` (also a `request_id` on a session command); 403 `parent_continue_refused`, `parent_answers_refused`; 409 `busy`, `waiting` (neutral words, Busy's fields), `continuing`, `owned_by_tui`, `enqueued_id_conflict` (the same `request_id`, another prompt, a turn the session no longer names but the worker remembers), the turn route's delivery refusals (`queue_unavailable`, …); 504 `worker_timeout`; 503 `server_stopping` |
515
+ | `POST /api/sessions/:id/ask` | owner | `:id` may be `last` (`Web::LastAsk.target`: the session the owner's last answered ask or answered create went to, kept in `last_ask.json` beside the sessions folder, following continues; gone or archived with no successor: the newest not scratch, delegate, `driver`, test run or archived; none: 404 `not_found`; a participant's: 404 at the gate; no `…/last/wait`); `prompt` (16 KiB), `timeout` (default and most 30 s), `queue` (default `true`: a running session queues it as its own turn; `false` refuses it), `client_id` (absent: `web:unnamed`; `cli:send`'s `/continue yes` goes in as `cli:answer` and is parent-gated as on `…/turn`), `request_id` (optional, 1-128 printable ASCII, messages only: a retry with it answers the first ask's turn, `SessionInbox.enqueued_id_for`) | 200: the wait's fields + `session_id` (where it ran), `asked` (the id given, when another link ran it), `token` when the status is `timeout`, `request_id` echoed when given; 200 `{status: command, session_id}` for a session command (`/continue yes` with an offer standing answers the continued turn's fields instead). The whole call answers within `AskRoutes::ASK_MAX_SECONDS` (35) (`Web::AskRoutes`, `SessionAccess::Ask`, [thin-clients.md](thin-clients.md)) | 404 `not_found`; 400 `ambiguous_id`, `missing_fields`, `invalid_prompt`, `local_command`, `invalid_ask` (also a `request_id` on a session command); 403 `parent_continue_refused`, `parent_answers_refused`; 409 `busy`, `waiting` (neutral words, Busy's fields), `continuing`, `owned_by_tui`, `enqueued_id_conflict` (the same `request_id`, another prompt, a turn the session no longer names but the worker remembers), the turn route's delivery refusals (`queue_unavailable`, …); 504 `worker_timeout`; 503 `server_stopping` |
515
516
  | `POST /api/mcp` (`GET`, `DELETE`) | owner | one JSON-RPC message of MCP (112 KiB: a 16 KiB prompt JSON-escaped), either revision: the current one with `MCP-Protocol-Version`, `Mcp-Method` and `Mcp-Name` headers matching the body, the earlier one with the `Mcp-Session-Id` its `initialize` handed out (and an `MCP-Protocol-Version`, if any, that chi serves) | 200 the JSON-RPC answer (a tool's refusal is a result with `isError`), 202 for a notification; `GET` 405 (`Allow: POST, DELETE`, no stream), `DELETE` 200. Each call within `McpServer::Tools::SLICE` (25 s) (`Web::McpRoute`, `McpServer::Http`, [mcp-server.md](mcp-server.md)) | 400 `-32020` (headers unlike the body), `-32022` (an unsupported revision), `-32700` (not JSON or not UTF-8; with the request's id when one can be read)/`-32600` (not an object: a batch is one), `Missing session ID`, an unsupported legacy `MCP-Protocol-Version`; 404 `-32601`; the gate's 401 adds `WWW-Authenticate: Bearer` here |
516
517
  | `POST /api/sessions/:id/answer` (`wait`) | owner | `wait: N` (seconds, at most 30) beside `id`, `selected`, `freeform` | 200 `{status: answered, session_id, id, reply: {the wait's fields, token while it is timeout}}`; a question answered elsewhere first: 200 `{status: not_pending, answered_here: false, …, reply}` (as `chi answer` still waits); a wait that fails after the answer went in: 200 with that `status` and `wait_error` `{error: server_stopping \| not_found \| wait_failed, detail}` in place of `reply`; without `wait` every answer is as before | 400 `invalid_wait`; 404 |
517
518
  | `POST /api/sessions/:id/notes` | owner | `text`, `source` (default `cli`, never `broadcast`) | 200 `{status: queued \| waits, session_id, queued}` (`NoteDelivery`) | 409 `owned_by_tui` (`status: refused`); 400 `note_rejected`, `missing_fields`, `invalid_source` |
@@ -519,8 +520,8 @@ model: [internals/remote-sessions.md](internals/remote-sessions.md).
519
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` |
520
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` |
521
522
  | `GET /api/sessions/:id/peers/:name/messages/:serial` | owner | | 200 the message (its text) and its receipt | 404 `no_message`; 400 `invalid_peer` |
522
- | `DELETE /api/sessions/:id/peers/:name` | owner | | 200 `{unpaired}`: the pairing ends, its messages stay | 400 `invalid_peer` |
523
- | `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 |
524
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 |
525
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` |
526
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 |
@@ -681,7 +682,7 @@ A map of the parts the overview above doesn't name (paths under `lib/samagotchi/
681
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). |
682
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). |
683
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)). |
684
- | 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)). |
685
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)). |
686
687
  | Shipped bundles | `bundles/` (`mcp`, `github-pr`, `loop-guard`, `skills`, `source-links`, …) | Bundles that ship with chi. |
687
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)). |
@@ -696,7 +697,7 @@ A map of the parts the overview above doesn't name (paths under `lib/samagotchi/
696
697
  | LLM context strategies | `llm_context_strategy.rb`, `llm_context_view.rb`, `llm_context_stale.rb`, `llm_context_forget.rb` | What a request sends of the history (none, stale, forget) ([internals/llm-context-forget.md](internals/llm-context-forget.md)). |
697
698
  | Session chains | `session_continue.rb` (`SessionContinue`), `session_chain.rb` (`SessionChain`), `session_chain/links.rb` (`SessionChain::Links`), `session_chain/delete.rb` (`SessionChain::Delete`), `session_chain/delete_preview.rb` (`SessionChain::Delete::Preview`), `continued_from.rb` (`ContinuedFrom`) | A session that continues an earlier one. `SessionChain::Links` is the one chain walker (one listing; `latest`, `first_live`, `root`, `next_of`): `SessionChain.latest`/`.next_of`, `SessionInbox::Head` and the schedule tick all ask it. `SessionChain.opener_for` gives the text web `continue →` prefills in the new link: the previous link's own first typed message when that link continues one itself, else nil (the 201's `opener`; not saved). `SessionChain::Delete` plans and deletes a link or its chain; `Delete::Preview` supplies the web delete sheet, and `ContinuedFrom` records what a continue must undo ([sessions.md](sessions.md)). |
698
699
  | MCP server | `mcp_server/protocol.rb` (`McpServer::Protocol`: JSON-RPC in both revisions, no transport, no chi), `mcp_server/tools.rb` (`McpServer::Tools`: `chi_sessions`, `chi_ask`, `chi_wait`, `chi_answer` over a SessionAccess backend through `SessionAccess::Ask` and `Exchange`), `mcp_server/text.rb` (`McpServer::Text`: the results' words), `mcp_server/stdio.rb` (`McpServer::Stdio`), `mcp_server/http.rb` (`McpServer::Http`), `mcp_command.rb` (`chi mcp serve`), `web/mcp_route.rb` (`Web::McpRoute`: `POST /api/mcp`, included through SessionAccessRoutes) | chi as an MCP server ([mcp-server.md](mcp-server.md)); not the `mcp` bundle (chi as a client). Only `tools.rb` names `SessionAccess`: another front builds `Protocol.new(tools: Tools.new(access))`. The caller is a parent agent (`cli:send` / `cli:answer`, `SessionAccess::Ask#agent_line`). |
699
- | chi web's routes | `web/app.rb` (`Web::App`: the gate, `ROUTES`, the shared helpers), `web/request_body.rb` (`Web::RequestBody`: bounded body reads), `web/message_display.rb` (`Web::MessageDisplay`: saved messages and cards as display items, the owner show's stamped with their turns' drawings and carrying no parts (a step's ✂ marks only), the participant show's with their parts, `POST /api/render`), `web/session_show.rb` (`Web::SessionShow`: `GET /api/sessions/:id` with its `cards`, `tail` and `timing` re-reads, `GET …/output`, the timing payload), `web/session_create.rb` (`Web::SessionCreate`: `POST /api/sessions`, a continue), `web/session_control.rb` (`Web::SessionControl`: answer, command, turn and images, cancel, stop, restart, archive, delete), `web/session_access_routes.rb` (`Web::SessionAccessRoutes`: the session-command routes), `web/ask_routes.rb` (`Web::AskRoutes`: ask, wait tokens, the answer's wait, included through SessionAccessRoutes), `web/verify_fresh_routes.rb` (`Web::VerifyFreshRoutes`: Verify fresh children), `web/working_set_routes.rb` (`Web::WorkingSetRoutes`: the working set routes), `web/viewer.rb` (`Web::Viewer`: page capabilities), `web/push_routes.rb` (`Web::PushRoutes`: `/api/push`, its subscriptions, prefs, test and presence), `web/block_renderer_routes.rb` (`Web::BlockRendererRoutes`: `GET /api/block_renderers` and one renderer's file, [internals/block-renderers.md](internals/block-renderers.md)), `web/reload_check_route.rb` (`Web::ReloadCheckRoute`: `POST /api/sessions/:id/reload_check`, the opt-in `web.reload_check`'s counts from the page's `reload_check.js`, 204 and one `reload_checked` log line, with `reload_mismatch`, its `kinds`, `excused` (ACCEPTED ids) and `explained` when the turn read otherwise after a reload; the worker's version is chi web's own view, its sidecar) | The handlers `App`'s `ROUTES` name, in the file that holds their kind; each mixin is included in `App` and reads its helpers and ivars, so `app.send(:handle_show, …)` and the specs that stub `App` methods work as before. The shared body reader caps incoming requests. |
700
+ | chi web's routes | `web/app.rb` (`Web::App`: the gate, `ROUTES`, the shared helpers), `web/request_body.rb` (`Web::RequestBody`: bounded body reads), `web/message_display.rb` (`Web::MessageDisplay`: saved messages and cards as display items, the owner show's stamped with their turns' drawings and carrying no parts (a step's ✂ marks only), the participant show's with their parts, `POST /api/render`), `web/session_show.rb` (`Web::SessionShow`: `GET /api/sessions/:id` with its `cards`, `tail` and `timing` re-reads, `GET …/output`, the timing payload), `web/session_create.rb` (`Web::SessionCreate`: `POST /api/sessions`, a continue), `web/session_control.rb` (`Web::SessionControl`: answer, command, turn and images, cancel, stop, restart, archive, delete), `web/session_access_routes.rb` (`Web::SessionAccessRoutes`: the session-command routes), `web/ask_routes.rb` (`Web::AskRoutes`: ask, wait tokens, the answer's wait, included through SessionAccessRoutes), `web/ask_create.rb` (`Web::AskCreate`: a create that answers its first turn), `web/last_ask.rb` (`Web::LastAsk`: the owner's `last`, `last_ask.json`), `web/verify_fresh_routes.rb` (`Web::VerifyFreshRoutes`: Verify fresh children), `web/working_set_routes.rb` (`Web::WorkingSetRoutes`: the working set routes), `web/viewer.rb` (`Web::Viewer`: page capabilities), `web/push_routes.rb` (`Web::PushRoutes`: `/api/push`, its subscriptions, prefs, test and presence), `web/block_renderer_routes.rb` (`Web::BlockRendererRoutes`: `GET /api/block_renderers` and one renderer's file, [internals/block-renderers.md](internals/block-renderers.md)), `web/reload_check_route.rb` (`Web::ReloadCheckRoute`: `POST /api/sessions/:id/reload_check`, the opt-in `web.reload_check`'s counts from the page's `reload_check.js`, 204 and one `reload_checked` log line, with `reload_mismatch`, its `kinds`, `excused` (ACCEPTED ids) and `explained` when the turn read otherwise after a reload; the worker's version is chi web's own view, its sidecar) | The handlers `App`'s `ROUTES` name, in the file that holds their kind; each mixin is included in `App` and reads its helpers and ivars, so `app.send(:handle_show, …)` and the specs that stub `App` methods work as before. The shared body reader caps incoming requests. |
700
701
  | Web Push | `web/push.rb` (`Web::Push`: `Runtime`, `preflight!`, the `web.push.*` settings), `web/push/crypto.rb` (`Push::Crypto`: RFC 8291 aes128gcm, RFC 8292 VAPID), `web/push/store.rb` (`Push::Store`, `Store::Sub`: `web-push/vapid.pem`, `subscriptions.json`), `web/push/client.rb` (`Push::Client`, `Client::Result`), `web/push/attention.rb` (`Push::Attention`: notify.js's rules in Ruby, shared cases in `spec/fixtures/attention_cases.json`), `web/push/presence.rb` (`Push::Presence`: the pages' "in front" reports), `web/push/notifier.rb` (`Push::Notifier`, a hub subscriber with a sender thread), `web/push_routes.rb` (`Web::PushRoutes`), `private_files.rb` (`PrivateFiles`, shared with the grants), `public/sw.js`, `public/push.js`, `public/manifest.webmanifest` | chi web pushes what the tab notifies for (approvals, questions, step-limit questions, cards, failed turns; done turns to a device that asks) to the owner's Home Screen app over an https public URL: the Notifier turns the hub's new attentions into show pushes after a hold, unless a chi web page is in front, at most 30 an hour, with one retry and a restart catch-up (`sent.json`) (each carries the keys still open, and the badge; no close push: every push shows a notification); the bell (`notifications.js`) subscribes the device, and the service worker and the page close the answered ones. See [internals/web-push.md](internals/web-push.md). |
701
702
  | chi web's updates | `web/update_check.rb` (`Web::UpdateCheck`), `web/update_ops.rb` (`Web::UpdateOps`), `web/auto_update.rb` (`Web::AutoUpdate`) | The RubyGems checker and its `update_check.json`; the install, worker-restart and chi-web-restart operations (one at a time) the owner's routes and AutoUpdate share; `update.auto: install`'s thread (install when no turn runs, then idle workers and chi web). See [configuration](configuration.md#unattended-updates-updateauto). |
702
703
  | Behind an auth proxy | `web/public_url.rb` (`Web::PublicUrl`: `web.public_url`, `web.proxy.identity_header`, `web.proxy.owner`), `web/proxy_gate.rb` (`Web::ProxyGate`, mixed into App; `RawHeaderNames`, prepended to WEBrick's request by `Web::Server`), `web/link_codes.rb` (`Web::LinkCodes`: the links' one-time codes), `proxy_trace.rb` (`ProxyTrace`), `web/public/token_fragment.js`, `web/public/auth_lost.js`, `web/tunnel.rb` + `web/tunnel/tailscale.rb` (`Web::Tunnel`, `Web::Tunnel::Tailscale`: `chi web --tunnel tailscale`, Tailscale Serve set for one run and the PublicUrl it makes) | Experimental: chi web behind an auth proxy. Every request needs the token; a proxied one's owner also needs the identity header (one clean value under one name); the `__Host-` cookie, an absolute `Location` from the public URL, https links with a one-time code in the fragment; the page's lost-sign-in banner. Bridges refuse proxy traces ([configuration.md](configuration.md#behind-an-auth-proxy)). |
data/docs/bundles.md CHANGED
@@ -41,7 +41,7 @@ only against this API (`lib/samagotchi/bundles/btw/plugin.rb`).
41
41
  server](mcp-server.md).)
42
42
 
43
43
  `chi bundle install mcp` (or the `dev` profile) installs the bundle shipped with chi. It is written
44
- only against this API (`lib/samagotchi/bundles/mcp/`: `plugin.rb` and its parts `client.rb`, `http_client.rb`, `oauth.rb`, `tools.rb`, `content.rb`), and gives
44
+ only against this API (`lib/samagotchi/bundles/mcp/`: `plugin.rb` and its parts `client.rb`, `http_client.rb`, `oauth.rb`, `sign_in.rb`, `server_config.rb`, `tools.rb`, `content.rb`), and gives
45
45
  the model the tools of [MCP](https://modelcontextprotocol.io) servers. It
46
46
  has no memory file, and the servers' tools aren't declared to the model one
47
47
  by one: the bundle publishes them into chi's tool index
@@ -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
@@ -1145,7 +1158,21 @@ Claude pairs; without one the bundle costs one tool declaration.
1145
1158
  word: `ok`, `changes`, `unsure`), `answered after 6m`, or `not sent` (the
1146
1159
  send didn't go out); a tap on an answered one jumps down to the answer. The
1147
1160
  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
1161
+ where it arrived, closed to one row, `Claude changes <its summary> 21
1162
+ lines` (the verdict's word, the summary without its `VERDICT` mark, else
1163
+ the first line of its text, and the length of Claude's text; on a phone the
1164
+ summary is cut short, the length stays). A tap opens it, a second closes
1165
+ it; this browser remembers which you opened, per session, and a jump to it
1166
+ (the send's pill, a claim link) opens it. Open, the row stays its top
1167
+ line and Claude's text and "what chi told the agent" are under it. Where
1168
+ An answer next to other agent-to-agent text (a delegate report, another
1169
+ peer's answer, a background note) joins their one line, `1 report ·
1170
+ Claude: changes · 3 notes` (`Claude ×2` for two of its answers, `Claude
1171
+ answered` without a verdict): a tap on `Claude: changes` shows its row under
1172
+ the line, a tap on the row opens its text; a reload shows the line closed
1173
+ again. Where
1174
+ it has no row (in the running turn, before it ends) it is a bubble from
1175
+ Claude: "Claude answered", the send it
1149
1176
  answers (a tap jumps back up to that row, opening a folded turn), its
1150
1177
  verdict (`VERDICT OK` with "round closed" when Claude agreed), its summary,
1151
1178
  the answer's text under it (rendered as markdown), and chi's instruction to
@@ -1217,7 +1244,10 @@ Claude pairs; without one the bundle costs one tool declaration.
1217
1244
  chi fixes what Claude flagged or disagrees and sends again, up to
1218
1245
  `peer.turns` (3) wake turns in a row, and a `VERDICT OK` answer wakes chi
1219
1246
  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.
1247
+ message you type in the web or a TUI starts the count again. A message
1248
+ Claude starts while chi's cache is cold waits for your next message
1249
+ ([peers.md](peers.md#a-cold-cache)), and a send the model starts after
1250
+ 30 quiet minutes asks you first ([peers.md](peers.md#quiet-pairings)).
1221
1251
  - **The skill.** `skill_claude_peer` (system scope) tells the model to send
1222
1252
  only when you ask or to reply in a peer turn, to pick the part rather than
1223
1253
  the session, not to wait or poll, and how to read Claude's answer in its
@@ -1270,24 +1300,14 @@ Claude pairs; without one the bundle costs one tool declaration.
1270
1300
  session (sshd makes it the user's, mode 0600 by default): fine on your own
1271
1301
  machine or pod, not a shared host. Codex has no socket: codex-peer has no
1272
1302
  `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
1303
+ - **A continue.** The pairing follows the chain
1304
+ ([peers.md](peers.md#continuing-a-session)): the continue copies it to the
1305
+ new session, Claude is told nothing, and chi's next send names the new id
1306
+ in its header. A say to the old id goes to the new session, its line ending
1307
+ `session continued as <id8>: answer there`. Over SSH the forwarded socket
1308
+ keeps the old id's name and still works. A chain an older chi continued has
1309
+ no copy: the say is refused (`this session was continued as <id>`), and the
1310
+ skill pairs again there. What Claude said that the old session hadn't read
1291
1311
  reaches the new one as one note.
1292
1312
  - **Asking first.** The tool has no `targets:`, so guardrails match it by name
1293
1313
  only: to be asked before each send, add a rule ([Rules in
@@ -1417,15 +1437,12 @@ skill install card, the web's linked send and answer: "Codex answered") works th
1417
1437
  guardrails rule with `tool: codex_send` (see the claude-peer section).
1418
1438
  - **The peer loop** works as claude-peer's: Codex is declared a peer
1419
1439
  (`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
1440
+ row, and `VERDICT OK` wakes chi once to close the round, with the same
1441
+ cold hold and quiet ask; `codex_read` reads a long message. Needs the chi that has the mailbox; an older
1422
1442
  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.
1443
+ - **A continue** works as claude-peer's: the pairing is copied to the new
1444
+ session, Codex is told nothing, and its say to the old id goes to the new
1445
+ one.
1429
1446
 
1430
1447
  ## The ruby bundle
1431
1448
 
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]` pairs (a continued session's chain's live link, named; refused 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
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))
@@ -470,6 +470,10 @@ chi schedule add --session 3f9a1c2e --every 5m -m "Check in" --if "$HOME/.local/
470
470
  chi schedule edit 4b7e9a --no-if # fire at every occurrence again
471
471
  ```
472
472
 
473
+ When the schedule a cancel removes was what kept a pruned chain reachable from its first
474
+ session, `cancel` prints one more line on stdout naming the chain's newest link to send to
475
+ from then on, and still exits 0 ([scheduling.md](scheduling.md#keeping-the-chain-short)).
476
+
473
477
  Every `list` row names its schedule: the `--title` it was given, or, when it has
474
478
  none, the first 30 characters of its prompt in quotes with `…` where it is cut
475
479
  (newlines and runs of spaces become one space). The name column is padded to the
@@ -527,8 +531,9 @@ fire twice.
527
531
 
528
532
  The model can register its own schedules with `schedule_task` (defaulting to the
529
533
  session it is in), list them with `list_schedules` and stop them with
530
- `cancel_schedule`; like `register_reminder`, these are owner-voiced tools, refused
531
- in a participant's turn.
534
+ `cancel_schedule`. A participant's turn is refused all three: like
535
+ `register_reminder`, `schedule_task` and `cancel_schedule` are owner-voiced, and
536
+ `list_schedules` reads the owner's schedules.
532
537
 
533
538
  ## Flags
534
539
 
@@ -764,10 +769,11 @@ note or image) is deleted as its worker exits, and `/exit` says so; set
764
769
  [Sessions](sessions.md).
765
770
 
766
771
  `chi sessions stop ID...` stops each session's worker and waits for it to exit, so
767
- a `chi --resume ID` after it starts a fresh one. While another change holds the
768
- session (a continue, a delete, an archive) for longer than 10 s, the stop is
769
- refused in its words ("session ab12cd34 is being deleted; try again in a
770
- moment") and that id exits 1. A worker still running an
772
+ a `chi --resume ID` after it starts a fresh one. A session being continued,
773
+ deleted or archived refuses the stop at once, saying so ("session ab12cd34 is
774
+ being deleted", "session ab12cd34 is being continued as 7b2d41aa-…: stop that
775
+ one"); a short hold (a send) is waited for up to 10 s, then refused ("…; try
776
+ again in a moment"). Either way the running turn goes on and that id exits 1. A worker still running an
771
777
  older chi (from before an upgrade) takes turns, but not commands, or not the
772
778
  ones newer than it (`/llm-context`, `--llm-context` on `--attach`); the attached
773
779
  terminal and the Web UI say so, with that restart line.
@@ -1185,9 +1191,12 @@ The prompt stays open while a turn runs in an attached terminal:
1185
1191
  running turn's card with the commands queued for its end, until its turn
1186
1192
  starts; its **×** (`Remove from queue`, once the worker acked it) takes it
1187
1193
  back before it runs, in every tab (a toast says why when it can't: it
1188
- already started, it is gone, no live worker), and puts its text back into an
1189
- empty composer to change and send again (a draft stays: the text is then in
1190
- the toast; images don't come back); `cut in now` cuts, like `/cut TEXT` (by click only: it throws the
1194
+ already started, it is gone, no live worker), and puts its text back into
1195
+ the session's draft when that is empty, to change and send again (a draft
1196
+ stays: the text is then in the toast; after a switch to another session
1197
+ meanwhile it goes into the left session's empty draft, a toast says
1198
+ `Removed: back in <id>'s draft`, else a sticky toast with Copy; images don't
1199
+ come back); `cut in now` cuts, like `/cut TEXT` (by click only: it throws the
1191
1200
  thinking away). Cut is enabled only while the step has streamed nothing but
1192
1201
  thinking and cutting is on for the model (the line says `cuts at about 0:25
1193
1202
  if you choose cut in now` until the thinking passes `steer_cut_after`, and
@@ -1341,7 +1350,8 @@ first line of what a hook presented in its place, else its first heading,
1341
1350
  else its first line); click again to unfold. A delegate report's reply
1342
1351
  folds the same way, and so does a long prompt you sent (over the same
1343
1352
  threshold; its folded row shows its first line as typed). A delegate
1344
- report itself starts folded. Folding is this browser's choice, kept per session in
1353
+ report itself starts folded, a short one too, and so does a peer's answer
1354
+ (one row: the peer, its verdict, its summary and its length). Folding is this browser's choice, kept per session in
1345
1355
  localStorage (`chi_answer_fold:<session id>`, the last 200 folded answers and prompts;
1346
1356
  the keys of sessions gone from the list are dropped when the list loads);
1347
1357
  other viewers (a participant's browser too) are not affected. A jump into a
@@ -1353,10 +1363,22 @@ nothing, an objectives line and a plugin's nudge fold into one closed row where
1353
1363
  the first of them sits, "▸ 3 notes · claude-inbox, source-links, skills". A tap
1354
1364
  (or a click, Enter, Space) opens it and the items show under it as they are;
1355
1365
  another closes it. A warning among them marks the row with a yellow edge and
1356
- "⚠ 1", and it stays closed. Your prompt, the answer, a peer's answer and a note
1357
- that starts a turn stay as they are, and a time divider or a peer's answer
1358
- between two items gives each side a row of its own. The row isn't remembered:
1359
- a reload or another session shows it closed again.
1366
+ "⚠ 1", and it stays closed. Your prompt, the answer and a note that starts a
1367
+ turn stay as they are, and a time divider between two items gives each side a
1368
+ row of its own. The row isn't remembered: a reload or another session shows it
1369
+ closed again.
1370
+
1371
+ Delegate reports and peers' answers next to each other and to those notes are
1372
+ one line too, a segment per kind: "1 report · Claude: changes · 3 notes ⚠ 1"
1373
+ ("Claude ×2" for two of one peer's answers, "Claude answered" without a
1374
+ verdict). A tap on a segment shows that kind's rows under the line, one compact
1375
+ row each ("check-in 50 tool calls, no answer yet", "child ab12cd The guard is in. 17 lines"), one segment at a
1376
+ time; a tap on a row opens its text. A report
1377
+ or a peer's answer alone keeps its own row, notes alone their notes row. What
1378
+ ends a line: your prompt, chi's answer, a card, a time divider. On a phone it
1379
+ stays one line, the notes segment cut short first. The line isn't remembered
1380
+ either: a report or an answer you opened shows open again once you tap its
1381
+ segment.
1360
1382
 
1361
1383
  **Revise** rewrites an answer and stacks the versions. A finished turn's
1362
1384
  final answer has a Revise button on its bottom edge (on hover; always shown
@@ -163,10 +163,11 @@ or `chi web` restart.
163
163
  | `memories` | Worker start | The running engine holds its preload list. The config list is not saved in the session file, so a respawn reads the current list. |
164
164
  | `append_system_prompt` | Worker start for the file list | The config list is not saved in the session file. File text is read when the prompt is built; `/model` rebuilds it, while an already-built prompt is cached. CLI `--append-system-prompt` files are saved in the session. |
165
165
  | `toolkit.default`, `toolkit.child` | Session creation | The chosen toolkit is saved; changing the defaults does not move existing sessions. |
166
+ | `web.ask_dir` | Session creation | Read at each thin-client create that names no folder; existing sessions keep their folder. |
166
167
  | `toolkit.kits`, `execute.description`, `llm_context.policy` | Worker start | These are held by the engine's toolkit or tool registry. |
167
168
  | `toolkit.suggest.mode`, `toolkit.suggest.threshold`, `toolkit.suggest.defer_turns`, `toolkit.suggest.defer_tokens` | Worker start | Suggestion settings are config-only and are resolved when the worker runs its audit or on-mode ask. |
168
169
  | `skip_agents_md` | Prompt rebuild | A running engine caches its built prompt; a new worker or `/model` rebuild uses the changed value. |
169
- | `context.*` except `context.every_seconds`, `peer.turns`, `objectives.*`, `llm_context.*` except `llm_context.policy`, `steer.cut_after`, `memory.index_warn_tokens`, `memory.entry_warn_tokens`, `status.line`, `web.participants.*` | Next matching turn, display, poll or write | Readers resolve these settings when they perform that operation. Session-specific LLM context and thinking values remain saved in the session. A participant's grant keeps the expiry and cap it was issued with; `web.participants.*` is what the next invite gets, and the cap and queue of a grant from before caps. |
170
+ | `context.*` except `context.every_seconds`, `peer.turns`, `peer.quiet_minutes`, `objectives.*`, `llm_context.*` except `llm_context.policy`, `steer.cut_after`, `memory.index_warn_tokens`, `memory.entry_warn_tokens`, `status.line`, `web.participants.*` | Next matching turn, display, poll or write | Readers resolve these settings when they perform that operation. Session-specific LLM context and thinking values remain saved in the session. A participant's grant keeps the expiry and cap it was issued with; `web.participants.*` is what the next invite gets, and the cap and queue of a grant from before caps. |
170
171
  | `context.every_seconds` | Next context poll | The poller checks it for each source that has no explicit interval. |
171
172
  | `guardrails.*` | Next tool call or approval | Guardrail rules and disable lists are reloaded when the config file changes; rule settings take effect on that evaluation. `guardrails.parent_answers` is checked when a parent answers a question. |
172
173
  | `system_one.host`, `system_one.model`, `system_one.timeout_ms`, `system_one.runs`, `system_one.judgments` | Next tool call or approval | Each ask reads them. |
@@ -175,7 +176,7 @@ or `chi web` restart.
175
176
  | `session.idle_exit_minutes`, `session.project_env`, `session.carry_last_answer`, `session.keep_empty`, `session.max_children`, `session.delegate_reports`, `session.task_wakes`, `session.max_wakes` | Worker start or next matching lifecycle decision | Existing workers keep their idle-exit timer and project env; the other values are read for the next corresponding decision. |
176
177
  | `session.retention_*`, `session.max_count`, `session.keep_status`, `session.sweep_interval_hours` | Next retention sweep | `chi web` sweeps on its configured schedule and on `GET /api/sessions`; `chi sessions prune` uses the values for that invocation. The sweep interval is checked on the next hub tick. |
177
178
  | `schedule.*` | Next CLI run | `chi schedule add` and `chi schedule tick` read them for that run; with `schedule.auto_tick` on, `chi web`'s hub ticks on `schedule.tick_interval_minutes`. |
178
- | `web.*` except `web.participants.*` | `chi web` start | Restart `chi web` to change its bind address, port or page settings. |
179
+ | `web.*` except `web.participants.*` and except `web.ask_dir` | `chi web` start | Restart `chi web` to change its bind address, port or page settings. |
179
180
  | `log.*` | Process start | Each process holds its configured log sink and level after first use; restart that process. |
180
181
  | `history.file` | Next history access | The TUI and web composer resolve its path when they read or append history. |
181
182
  | `broadcast.*` | Next `chi broadcast` | Each broadcast invocation reads its targeting and triage settings. |
@@ -2063,6 +2064,9 @@ name doesn't load. By hand, on the Mac that runs chi web (or steps 1–2, then
2063
2064
  AirDrop or type it). The code works once, within 10 minutes (`chi web` again prints a new one); the phone then
2064
2065
  keeps the `__Host-chi_token` cookie.
2065
2066
 
2067
+ A phone Shortcut talks to the same address with the token ([thin clients](thin-clients.md)); set `web.ask_dir` so its
2068
+ new sessions need no folder ([A new session in one call](thin-clients.md#a-new-session-in-one-call)).
2069
+
2066
2070
  #### `chi web --tunnel tailscale`
2067
2071
 
2068
2072
  Steps 3–5 in one command, after steps 1–2 (Tailscale signed in, HTTPS certificates on):
@@ -2361,7 +2365,8 @@ column says so, a `--kebab-name` flag. The maps (`hosts:`, `models:`,
2361
2365
  | `context.status_thresholds` | `20,40,60,80` | yes | Percentages that put the estimate into a bucket; the rise into a guidance bucket (from the second up) leaves the model its own `[CONTEXT: …]` line, and the bucket decides the guidance. |
2362
2366
  | `context.every_seconds` | `300` | | How often an attached context source's command runs when it has no `--every` (seconds, at least 30). See [Attached context](context.md). |
2363
2367
  | `context.wake` | `true` | yes | A source whose update says `wake: true` may start a turn in a live, idle session (one per source per 10 minutes, within `session.max_wakes`); so may a session's pushed source's first push. `false`: updates wait as notes for the next turn. Attached context's only: a peer's messages have `peer.turns`. See [Waking](context.md#waking). |
2364
- | `peer.turns` | `3` | yes | Wake turns in a row a peer agent's messages may start (`chi peer say --wake`, a peer a loaded bundle declares), with no message typed in the web or a TUI in between (`chi send` doesn't count); within `session.max_wakes`. Then messages wait as notes, the say's line says so (`held: … (peer.turns)`), and the UIs hear it once. A message whose summary ends its verdicts with `VERDICT OK` wakes once to close the round, counted toward `session.max_wakes` only. `0`: a peer's message never wakes chi. Replaces `context.peer_turns` (no alias: an old key is ignored). See [peers.md](peers.md). |
2368
+ | `peer.turns` | `3` | yes | Wake turns in a row a peer agent's messages may start (`chi peer say --wake`, a peer a loaded bundle declares), with no message typed in the web or a TUI in between (`chi send` doesn't count; the count survives a worker restart); within `session.max_wakes`. Then messages wait as notes, the say's line says so (`held: … (peer.turns)`), and the UIs hear it once. A message whose summary ends its verdicts with `VERDICT OK` wakes once to close the round, counted toward `session.max_wakes` only. `0`: a peer's message never wakes chi. Replaces `context.peer_turns` (no alias: an old key is ignored). See [peers.md](peers.md). |
2369
+ | `peer.quiet_minutes` | `30` | yes | Minutes with no exchange between chi and a peer (no send to it, no message from it, no pairing; the link a continue came from counts too) after which the pairing is dormant: the peer's session may be cold. A send the model starts then asks you first (Send / Don't send) in a turn you started from the web or a TUI, and is refused at once in any other turn (a schedule's, a delegate's, a wake turn, `chi send`'s), the model told that you decide; "Don't send" holds for the rest of the turn. A `/claude …` or `/codex …` you type never asks. The status card says `quiet 2 h: a send from the model asks first`. The pairing stays. `0`: never asks. See [peers.md](peers.md#quiet-pairings). |
2365
2370
  | `context.candidates.mode` | `off` | | The candidate judge: `off` (the default: no conversation text goes to a System 1 host), `audit` (asks System 1 whether the session's work is about each proposed candidate and logs it in `context_candidates.jsonl`; attaches nothing), `on` (the same asks, acted on: attached at `threshold`, a card from `offer_threshold`; see [On mode](context.md#on-mode)). Its host and model are `system_one.host` / `.model`. config.yml only. See [The judge](context.md#the-judge). |
2366
2371
  | `context.candidates.threshold` | `0.8` | | The probability at which the judge attaches a candidate in on mode (a judged line's `would: attach`). config.yml only. |
2367
2372
  | `context.candidates.offer_threshold` | `0.6` | | The probability from which on mode shows the candidate's card, once (`would: offer`, below `threshold`). config.yml only. |
@@ -2386,7 +2391,7 @@ column says so, a `--kebab-name` flag. The maps (`hosts:`, `models:`,
2386
2391
  | `memory.read_max_chars` | `0` | yes | The most characters one `memory_read` result holds. `0`: no fixed cap, a memory is read whole (`max_tool_output_chars` does not apply to `memory_read`, in any form: one name, a comma list, a blank name). A positive value cuts a longer result and ends it with `[cut: N of M chars; the rest is in the memory's .md file in <dir>: read it with start_line]`. `memory:` is its own section. See [Memory](memory.md). |
2387
2392
  | `max_tool_output_chars` | `10000` | yes | Characters of each tool output kept in the conversation (both loops). A longer one is cut: an `execute` result keeps its first and last lines with a gap line between them and is saved whole in the session's folder (`sessions/<id>/tool_output/`; the gap line names the file, and the model reads it there instead of running the command again); any other tool's keeps its head and ends with `[cut: N of M chars; read it in parts]`. `memory_read` is the exception: `memory.read_max_chars` caps it. See [Tool output guardrails](internals/tool-output-limits.md#the-runners-cut-max_tool_output_chars). A top-level key (see below). |
2388
2393
  | `cache.warmup` | `auto` | | `auto`: after a turn, send the next turn's prompt (up to the next message) to a local llama.cpp host on the native loop, so the next turn prefills only its message; never a remote or `api: openai` host. `off`: never. See [prompt caching](internals/prompt-caching.md#the-turn-end-warm-up). |
2389
- | `cache.ttl` | `5m` | | How long Anthropic keeps the prompt-cache breakpoints of a Claude model on a remote host: `5m` (Anthropic's default) or `1h`. A 1h cache write costs 2× the input price (5m: 1.25×), a read the same 0.1×. See "Remote or local". |
2394
+ | `cache.ttl` | `5m` | | How long Anthropic keeps the prompt-cache breakpoints of a Claude model on a remote host: `5m` (Anthropic's default) or `1h`. A 1h cache write costs 2× the input price (5m: 1.25×), a read the same 0.1×. It is also how long after a turn a peer's own message counts as finding the cache cold ([peers.md](peers.md#a-cold-cache)). See "Remote or local". |
2390
2395
  | `cache.key` | `off` | | `session`: send the session id as `prompt_cache_key` to OpenAI's API and OpenRouter, which route and cache by it; no other host gets it. `off`: none. |
2391
2396
  | `retry.max` | `5` | yes | See "Llama Network Retry Behavior". |
2392
2397
  | `retry.base_delay` | `0.5` | yes | |
@@ -2430,6 +2435,7 @@ column says so, a `--kebab-name` flag. The maps (`hosts:`, `models:`,
2430
2435
  | `web.annotate_presets` | `Agreed\|Could you please elaborate?` | yes | Quick replies next to Annotate in `chi web`, `\|`-separated (a YAML list works too); `""` in the file or on the CLI leaves only Annotate (an empty env value means the default). See [CLI](cli.md#web-annotate-presets). |
2431
2436
  | `web.editor` | `vscode` | yes | What a file ref in `chi web` (a file tool row's title, a diff line) opens, for a viewer on this machine: a preset (`vscode`, `vscode-insiders`, `cursor`, `zed`) or a URL template with `{path}` and an optional `{line}`; `none` turns refs off. See [Opening files from chi web](#opening-files-from-chi-web). |
2432
2437
  | `web.start_dir` | the folder `chi web` runs in | | The folder `chi web` starts in (`chi web --start-dir DIR` for one run): its page (the printed link, a bare `/`, the LAN link and QR code, the Home Screen app) opens on that folder's project, outside a project (no repository or marked folder) on every session, and a new session from the all view starts there; the header's project picker switches projects. `~` and a relative path (resolved from your home folder) work; one that isn't a folder stops `chi web` from starting. `chi web` never changes its own folder. See [CLI](cli.md). |
2438
+ | `web.ask_dir` | the `web.start_dir` folder | | The folder a thin client's one-call create (`POST /api/sessions` with `reply_for`, `timeout` or `request_id`, such as a phone Shortcut's) starts in when it names no `dir`, so the Shortcut can leave the folder out. `~` and a relative path (resolved from your home folder) work; one that isn't a folder refuses that create (400 `invalid_dir`), nothing started. Read at each create; a plain create without those fields never uses it. Only the owner's token creates sessions. See [A new session in one call](thin-clients.md#a-new-session-in-one-call). |
2433
2439
  | `web.participants.expires` | `7d` | | How long a participant's link lasts unless `chi share --expires` says otherwise: `Nh` or `Nd`, 1h to 30d. See [participants](internals/participants.md). |
2434
2440
  | `web.participants.cap` | `2.0` | | What a participant's turns, and the side calls they cause, may cost you in dollars unless `chi share --cap` says otherwise ($0 to $1000); at the cap their next comment is refused (429 `cap_reached`) and you get a notice. `chi share cap ID P DOLLARS` changes one grant's. |
2435
2441
  | `web.participants.queue` | `3` | | How many of a participant's turns may wait behind their running one (0 to 20); one more is refused (429 `too_many_turns`). |
data/docs/context.md CHANGED
@@ -234,8 +234,9 @@ summary, the hint's link, the text and detach (or mute here, for a project
234
234
  source). The web attaches nothing itself: `chi context add <URL>` does.
235
235
  A paired peer has a chip of its own there, drawn first, and its messages are
236
236
  bubbles from the peer ([peers.md](peers.md), [bundles.md](bundles.md#the-claude-peer-bundle)). A context note sits in
237
- chi web's closed notes row ([cli.md](cli.md#web-markdown-rendering)) unless it starts a turn: a wake's note is that turn's
238
- opening and stays a bubble.
237
+ chi web's closed notes row ([cli.md](cli.md#web-markdown-rendering)), or in the closed line it shares with the
238
+ delegate reports and peers' answers next to it, unless it starts a turn: a wake's note is that turn's opening and
239
+ stays a bubble.
239
240
 
240
241
  ## Waking
241
242
 
@@ -345,8 +346,8 @@ An archived session that nobody continued takes pushes as before; a schedule's a
345
346
 
346
347
  ### Peers and a continue
347
348
 
348
- A peer's pairing and mailbox stay with the old session; the peer is told the
349
- new id and pairs again, and what it said that the old session hadn't read
349
+ A peer's pairing follows the chain (the continue copies it) and its messages
350
+ stay with the old session; what it said that the old session hadn't read
350
351
  reaches the new one as one note: [peers.md](peers.md#continuing-a-session).
351
352
 
352
353
  ## Candidates
@@ -615,7 +616,9 @@ that way for simplicity). Whoever can define a source can run code later, so:
615
616
  in every mode, once at a time (the guardrails bundle's `chi-context-cmd`
616
617
  rule); a parent agent can't approve it for a child. A URL resolved by an
617
618
  installed bundle and `push` aren't asked about: their command is the
618
- bundle's, or there is none.
619
+ bundle's, or there is none. The [coordinator skill](bundles.md#the-coordinator-bundle)
620
+ is a shipped text that has the agent attach sources itself (a script of its own under
621
+ `~/.local/share/chi-watch/`), so its watches ask here.
619
622
  - The file tools can't write the store: `<state dir>/context/` is a protected
620
623
  path (denied), and a shell command that names it asks (`shell-touches-chi`).
621
624
  - The web adds URLs only.