samagotchi 0.153.0 → 0.154.1

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 (226) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +42 -1
  3. data/README.md +2 -3
  4. data/bin/chi +23 -24
  5. data/docs/architecture.md +30 -33
  6. data/docs/broadcast.md +5 -5
  7. data/docs/bundles.md +9 -12
  8. data/docs/cli.md +82 -96
  9. data/docs/configuration.md +27 -26
  10. data/docs/context.md +3 -3
  11. data/docs/desktop.md +1 -1
  12. data/docs/guardrails.md +8 -10
  13. data/docs/hooks.md +9 -9
  14. data/docs/internals/attached-context.md +2 -2
  15. data/docs/internals/background-tasks.md +3 -4
  16. data/docs/internals/block-renderers.md +4 -0
  17. data/docs/internals/bridge.md +21 -8
  18. data/docs/internals/context-telemetry.md +1 -1
  19. data/docs/internals/engine.md +33 -7
  20. data/docs/internals/objectives.md +6 -5
  21. data/docs/internals/participants.md +7 -7
  22. data/docs/internals/prompt-caching.md +4 -2
  23. data/docs/internals/remote-sessions.md +7 -7
  24. data/docs/internals/web-frontend.md +2 -2
  25. data/docs/internals/web-push.md +1 -1
  26. data/docs/memory.md +2 -2
  27. data/docs/plugins.md +23 -28
  28. data/docs/sessions.md +24 -24
  29. data/docs/sub-agent.md +2 -2
  30. data/docs/system-one.md +1 -1
  31. data/docs/testing.md +31 -6
  32. data/lib/samagotchi/answer_text.rb +33 -0
  33. data/lib/samagotchi/bridge/card_places.rb +56 -7
  34. data/lib/samagotchi/bridge/card_store.rb +24 -9
  35. data/lib/samagotchi/bridge.rb +52 -32
  36. data/lib/samagotchi/bridge_client.rb +19 -14
  37. data/lib/samagotchi/broadcast/recipients.rb +2 -2
  38. data/lib/samagotchi/broadcast/triage.rb +1 -1
  39. data/lib/samagotchi/broadcast_command.rb +5 -5
  40. data/lib/samagotchi/bundle_command/try/command.rb +1 -1
  41. data/lib/samagotchi/bundle_command/try/run.rb +1 -1
  42. data/lib/samagotchi/bundle_command/try/trace.rb +1 -1
  43. data/lib/samagotchi/bundle_command.rb +2 -2
  44. data/lib/samagotchi/bundles/btw/manifest.yml +2 -2
  45. data/lib/samagotchi/bundles/btw/plugin.rb +1 -1
  46. data/lib/samagotchi/bundles/coordinator/manifest.yml +2 -2
  47. data/lib/samagotchi/bundles/coordinator/plugin.rb +3 -2
  48. data/lib/samagotchi/bundles/decision-card/manifest.yml +4 -4
  49. data/lib/samagotchi/bundles/decision-card/plugin.rb +1 -9
  50. data/lib/samagotchi/bundles/dev/manifest.yml +2 -2
  51. data/lib/samagotchi/bundles/github-pr/manifest.yml +2 -2
  52. data/lib/samagotchi/bundles/github-pr/plugin.rb +3 -3
  53. data/lib/samagotchi/bundles/skills/manifest.yml +2 -2
  54. data/lib/samagotchi/bundles/skills/plugin.rb +3 -2
  55. data/lib/samagotchi/bundles/system/config_modification_protocol.md +3 -4
  56. data/lib/samagotchi/bundles/system/manifest.yml +3 -3
  57. data/lib/samagotchi/bundles/system/self_map.md +1 -1
  58. data/lib/samagotchi/child_move.rb +3 -3
  59. data/lib/samagotchi/commands/registry.rb +6 -6
  60. data/lib/samagotchi/composer_route.rb +4 -5
  61. data/lib/samagotchi/config.rb +14 -12
  62. data/lib/samagotchi/context_candidate_choice.rb +1 -1
  63. data/lib/samagotchi/context_candidates.rb +4 -3
  64. data/lib/samagotchi/continue_offer.rb +1 -1
  65. data/lib/samagotchi/debug_log.rb +1 -1
  66. data/lib/samagotchi/degrade.rb +75 -0
  67. data/lib/samagotchi/desktop/macos/ChiRunner.swift +3 -3
  68. data/lib/samagotchi/engine/cards.rb +87 -0
  69. data/lib/samagotchi/engine/context_judge.rb +138 -0
  70. data/lib/samagotchi/engine/events.rb +131 -0
  71. data/lib/samagotchi/engine/guardrails.rb +87 -0
  72. data/lib/samagotchi/engine/hooks.rb +119 -0
  73. data/lib/samagotchi/engine/messages.rb +124 -0
  74. data/lib/samagotchi/engine/model_settings.rb +127 -0
  75. data/lib/samagotchi/engine/models.rb +261 -0
  76. data/lib/samagotchi/engine/objectives.rb +116 -0
  77. data/lib/samagotchi/engine/participants.rb +86 -0
  78. data/lib/samagotchi/engine/plugins.rb +208 -0
  79. data/lib/samagotchi/engine/questions.rb +98 -0
  80. data/lib/samagotchi/engine/recap.rb +130 -0
  81. data/lib/samagotchi/engine/session.rb +131 -0
  82. data/lib/samagotchi/engine/side_requests.rb +135 -0
  83. data/lib/samagotchi/engine/steering.rb +134 -0
  84. data/lib/samagotchi/engine/toolkit.rb +269 -0
  85. data/lib/samagotchi/engine/turn_end.rb +180 -0
  86. data/lib/samagotchi/engine/turn_helpers.rb +160 -0
  87. data/lib/samagotchi/engine/verify.rb +153 -0
  88. data/lib/samagotchi/engine.rb +62 -2646
  89. data/lib/samagotchi/engine_snapshots.rb +9 -8
  90. data/lib/samagotchi/grants.rb +575 -0
  91. data/lib/samagotchi/guardrail_wiring.rb +2 -2
  92. data/lib/samagotchi/guardrails/context.rb +2 -3
  93. data/lib/samagotchi/guardrails/parent_approvals.rb +2 -2
  94. data/lib/samagotchi/guardrails/parent_policy.rb +2 -2
  95. data/lib/samagotchi/hook_routes.rb +3 -3
  96. data/lib/samagotchi/idle_recap.rb +7 -6
  97. data/lib/samagotchi/idle_reminders.rb +3 -4
  98. data/lib/samagotchi/iteration_limit.rb +2 -2
  99. data/lib/samagotchi/kernel_loop.rb +13 -13
  100. data/lib/samagotchi/launch_mode.rb +13 -32
  101. data/lib/samagotchi/level_setting_command.rb +3 -2
  102. data/lib/samagotchi/llm/chat_loop.rb +3 -1
  103. data/lib/samagotchi/llm_context_command.rb +3 -2
  104. data/lib/samagotchi/log.rb +7 -7
  105. data/lib/samagotchi/log_line.rb +1 -1
  106. data/lib/samagotchi/log_path.rb +1 -1
  107. data/lib/samagotchi/note_command.rb +1 -1
  108. data/lib/samagotchi/note_delivery.rb +18 -8
  109. data/lib/samagotchi/objectives.rb +24 -3
  110. data/lib/samagotchi/objectives_check.rb +8 -27
  111. data/lib/samagotchi/objectives_command.rb +4 -69
  112. data/lib/samagotchi/objectives_edit.rb +87 -0
  113. data/lib/samagotchi/output_formatter.rb +7 -1
  114. data/lib/samagotchi/owner_lock.rb +7 -1
  115. data/lib/samagotchi/parent_answers_command.rb +5 -4
  116. data/lib/samagotchi/participant_exposure.rb +42 -0
  117. data/lib/samagotchi/participant_mode.rb +1 -1
  118. data/lib/samagotchi/participant_name.rb +1 -1
  119. data/lib/samagotchi/participants.rb +17 -17
  120. data/lib/samagotchi/participants_watch.rb +1 -1
  121. data/lib/samagotchi/plugin/api.rb +3 -2
  122. data/lib/samagotchi/plugin/context.rb +21 -7
  123. data/lib/samagotchi/plugin/peer.rb +2 -1
  124. data/lib/samagotchi/plugin/sessions.rb +6 -4
  125. data/lib/samagotchi/plugin_tasks.rb +1 -2
  126. data/lib/samagotchi/private_files.rb +29 -0
  127. data/lib/samagotchi/project_env.rb +2 -2
  128. data/lib/samagotchi/question_desk.rb +8 -7
  129. data/lib/samagotchi/recap_command.rb +2 -1
  130. data/lib/samagotchi/recap_setup.rb +1 -1
  131. data/lib/samagotchi/recap_store.rb +1 -1
  132. data/lib/samagotchi/redact.rb +86 -0
  133. data/lib/samagotchi/reminder_queue.rb +2 -2
  134. data/lib/samagotchi/remote_attach_command.rb +1 -1
  135. data/lib/samagotchi/reply_wait/poll.rb +2 -2
  136. data/lib/samagotchi/review_start.rb +1 -1
  137. data/lib/samagotchi/run_options.rb +6 -6
  138. data/lib/samagotchi/self_report.rb +42 -39
  139. data/lib/samagotchi/send_command/busy.rb +1 -1
  140. data/lib/samagotchi/send_command.rb +4 -1
  141. data/lib/samagotchi/session.rb +11 -2
  142. data/lib/samagotchi/session_access/contract.rb +3 -3
  143. data/lib/samagotchi/session_access/local.rb +9 -9
  144. data/lib/samagotchi/session_access/remote.rb +17 -7
  145. data/lib/samagotchi/session_access.rb +4 -4
  146. data/lib/samagotchi/session_archive_command.rb +2 -2
  147. data/lib/samagotchi/session_chain.rb +8 -6
  148. data/lib/samagotchi/session_commands.rb +45 -48
  149. data/lib/samagotchi/session_continue.rb +1 -1
  150. data/lib/samagotchi/session_delete_command.rb +4 -4
  151. data/lib/samagotchi/session_manager.rb +67 -49
  152. data/lib/samagotchi/session_metrics.rb +2 -2
  153. data/lib/samagotchi/session_model_settings.rb +3 -2
  154. data/lib/samagotchi/session_participants.rb +1 -1
  155. data/lib/samagotchi/session_retention.rb +27 -7
  156. data/lib/samagotchi/sessions_command.rb +4 -4
  157. data/lib/samagotchi/share_command.rb +10 -10
  158. data/lib/samagotchi/steer.rb +13 -2
  159. data/lib/samagotchi/stream_event.rb +22 -0
  160. data/lib/samagotchi/system_prompt.rb +154 -145
  161. data/lib/samagotchi/task_watch.rb +1 -1
  162. data/lib/samagotchi/terminal_ui/attach_launcher.rb +72 -10
  163. data/lib/samagotchi/terminal_ui/attached_loop/composer.rb +12 -9
  164. data/lib/samagotchi/terminal_ui/attached_loop/exit_commands.rb +16 -0
  165. data/lib/samagotchi/terminal_ui/attached_loop/questions.rb +2 -3
  166. data/lib/samagotchi/terminal_ui/attached_loop.rb +17 -8
  167. data/lib/samagotchi/terminal_ui/attached_view.rb +1 -11
  168. data/lib/samagotchi/terminal_ui/event_renderer.rb +3 -5
  169. data/lib/samagotchi/terminal_ui/formatting.rb +7 -7
  170. data/lib/samagotchi/terminal_ui/input_support.rb +17 -22
  171. data/lib/samagotchi/terminal_ui/join_replay.rb +16 -12
  172. data/lib/samagotchi/terminal_ui/line_reader.rb +2 -2
  173. data/lib/samagotchi/terminal_ui/live_region.rb +2 -2
  174. data/lib/samagotchi/terminal_ui/log_tail.rb +135 -0
  175. data/lib/samagotchi/terminal_ui/one_shot_sink.rb +2 -2
  176. data/lib/samagotchi/terminal_ui/plain_surface.rb +1 -1
  177. data/lib/samagotchi/terminal_ui/question_prompt.rb +4 -5
  178. data/lib/samagotchi/terminal_ui/reline_seam.rb +2 -12
  179. data/lib/samagotchi/terminal_ui/status_row.rb +6 -14
  180. data/lib/samagotchi/terminal_ui.rb +142 -1387
  181. data/lib/samagotchi/title_command.rb +2 -2
  182. data/lib/samagotchi/tool_runner.rb +15 -16
  183. data/lib/samagotchi/toolkit_command.rb +2 -1
  184. data/lib/samagotchi/tools/delegate.rb +3 -1
  185. data/lib/samagotchi/tools/delegate_cursor.rb +3 -3
  186. data/lib/samagotchi/tools/delegate_wait.rb +1 -1
  187. data/lib/samagotchi/tools/objectives_tool.rb +2 -2
  188. data/lib/samagotchi/tools/send_note.rb +2 -1
  189. data/lib/samagotchi/turn_endings.rb +2 -2
  190. data/lib/samagotchi/turn_flow.rb +11 -7
  191. data/lib/samagotchi/update_hint.rb +2 -2
  192. data/lib/samagotchi/version.rb +1 -1
  193. data/lib/samagotchi/web/app.rb +42 -51
  194. data/lib/samagotchi/web/message_display.rb +7 -0
  195. data/lib/samagotchi/web/participant_access.rb +2 -2
  196. data/lib/samagotchi/web/participant_review.rb +5 -5
  197. data/lib/samagotchi/web/participant_stream_filter.rb +8 -8
  198. data/lib/samagotchi/web/participant_view.rb +2 -82
  199. data/lib/samagotchi/web/participants_admin.rb +1 -1
  200. data/lib/samagotchi/web/public/block_host.js +35 -8
  201. data/lib/samagotchi/web/public/block_renderers.css +9 -5
  202. data/lib/samagotchi/web/public/card_stamps.js +27 -0
  203. data/lib/samagotchi/web/public/cards_place.js +5 -3
  204. data/lib/samagotchi/web/public/chains.js +2 -2
  205. data/lib/samagotchi/web/public/claim_link.js +4 -4
  206. data/lib/samagotchi/web/public/composer_mode.js +1 -1
  207. data/lib/samagotchi/web/public/format.js +4 -3
  208. data/lib/samagotchi/web/public/turn_html.js +8 -4
  209. data/lib/samagotchi/web/push/store.rb +1 -1
  210. data/lib/samagotchi/web/session_access_routes.rb +13 -4
  211. data/lib/samagotchi/web/session_control.rb +12 -8
  212. data/lib/samagotchi/web/session_create.rb +1 -1
  213. data/lib/samagotchi/web/session_hub.rb +2 -2
  214. data/lib/samagotchi/web/session_show.rb +6 -2
  215. data/lib/samagotchi/web/session_summary.rb +1 -1
  216. data/lib/samagotchi/worker.rb +103 -9
  217. data/lib/samagotchi/worker_link.rb +3 -3
  218. data/lib/samagotchi/working_set_command.rb +3 -2
  219. data/lib/samagotchi.rb +0 -1
  220. metadata +31 -7
  221. data/lib/samagotchi/pending_input_queue.rb +0 -55
  222. data/lib/samagotchi/terminal_ui/between_turns.rb +0 -138
  223. data/lib/samagotchi/terminal_ui/repl_input.rb +0 -152
  224. data/lib/samagotchi/web/grants.rb +0 -575
  225. data/lib/samagotchi/web/participant_exposure.rb +0 -44
  226. data/lib/samagotchi/web/private_files.rb +0 -31
data/docs/cli.md CHANGED
@@ -1,4 +1,4 @@
1
- # CLI and REPL
1
+ # CLI and terminal
2
2
 
3
3
  ## Commands
4
4
 
@@ -7,8 +7,7 @@
7
7
  - `chi -p "your prompt"` — run a prompt, then stay attached
8
8
  - `chi -p "your prompt" --non-interactive` — run a prompt, print the answer, exit
9
9
  - `chi --resume <session-id>` — resume a prior session (in its worker)
10
- - `chi --no-shared [--resume <session-id>]` — the plain in-process REPL instead, for this run
11
- - `chi scratch [options]` — a one-time session in the plain in-process REPL, in this folder, that leaves nothing behind (see [Scratch sessions](#scratch-sessions))
10
+ - `chi scratch [options]` — a one-time session in this folder, attached like plain `chi`, that leaves nothing behind (see [Scratch sessions](#scratch-sessions))
12
11
  - `chi --attach <session-id>` — attach the terminal to a session's worker (e.g. one started from the Web UI), waking one if it has exited
13
12
  - A session id can be shortened to any unique prefix (like git): `chi --attach 2ea8`. `--resume`, `--attach`, `sessions stop`, `sessions archive` and `sessions delete` take one; an ambiguous prefix lists the sessions it matches.
14
13
  - `chi web [--port 4567] [--open] [--scope=all] [--start-dir DIR]` — start the Web UI (single localhost port session control plane) on this git project's sessions (`--scope=all`, or a folder in no repo: `/?scope=all`, every session); if a chi web already runs on the port, print (with `--open`, open) its page for this folder and exit. Something else on the port (an older chi web too) exits 1 with "port N is in use"
@@ -441,11 +440,9 @@ invalid option (exit 1).
441
440
 
442
441
  | Flag | Purpose |
443
442
  |------|---------|
444
- | `-p`, `--prompt TEXT` | Feed `TEXT` as the first turn (also prefill-equivalent; `-p` feeds **and** runs). |
445
- | `--non-interactive` | Run a single turn then exit the REPL (sets a high iteration cap; implies `--no-interrupt`). Harmless no-op when given without `-p`. |
443
+ | `-p`, `--prompt TEXT` | Run `TEXT` as the first turn, then stay attached to the session (`-p` feeds **and** runs); with `--non-interactive`, one turn and exit. |
444
+ | `--non-interactive` | Run the `-p` prompt as one turn in this process, then exit: no worker, no TUI (sets a high iteration cap; implies `--no-interrupt`). Harmless no-op when given without `-p`. |
446
445
  | `--resume SESSION_ID` | Load a prior session's history instead of creating a fresh one. |
447
- | `--shared` | Run the session (new, or `--resume`'s) in a background worker and attach to it: the default, and the way to get it when `session.shared` is off. See [Sharing a session](#sharing-a-session). |
448
- | `--no-shared` | Run the plain in-process REPL for this run. |
449
446
  | `--attach SESSION_ID` | Attach to a session's worker, waking one if it has exited. |
450
447
  | `--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). |
451
448
  | `--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. |
@@ -462,8 +459,8 @@ invalid option (exit 1).
462
459
  | `--llm-context-apply RULE` | This session's own apply rule: `payoff`, `next_request` or `turn_end`. |
463
460
  | `--llm-context-budget TOKENS` | This session's own context budget: `64000`, `64k` (4k to 10M), or `off` (wins over the model's budget). |
464
461
  | `--no-interrupt` | Raise the tool-call limit to 1000 iterations for long tasks. |
465
- | `--no-default-input` | Skip prefilling the first REPL line from `SAMAGOTCHI_DEFAULT_INPUT`. |
466
- | `-v`, `--verbose` | Log at debug level (raw LLM responses, tool call/result payloads) and print every log record to stderr too. |
462
+ | `--no-default-input` | Skip the default input (`SAMAGOTCHI_DEFAULT_INPUT`) typed into a new session's first prompt. |
463
+ | `-v`, `--verbose` | Log at debug level (raw LLM responses, tool call/result payloads). Attached, the terminal shows this session's debug records above the prompt as they come, and a worker this chi starts logs at debug too; a worker that was already running keeps its own level (a one-line note says so). `chi web -v` logs at debug too (its `/api/` requests among them) and so does every worker it starts from then on (a new session, a wake, a restart: they all take `SAMAGOTCHI_LOG_LEVEL=debug`, `Config.cli_env`), into the same log; a worker already running keeps its level. With `--non-interactive`, every log record goes to stderr too. This machine only (exit 2 with `--remote`). |
467
464
  | `--version` | Print `chi <version>` and exit (`chi self` shows it with the paths). |
468
465
 
469
466
  Every setting in the config registry (`lib/samagotchi/config.rb`) that exposes a CLI
@@ -486,13 +483,12 @@ as an unknown key).
486
483
  |---------|----------|
487
484
  | `chi` | Start a fresh session in a worker and attach to it. |
488
485
  | `chi -p "refactor this"` | Start a session in a worker, send the prompt, **stay attached**. |
489
- | `chi -p "refactor this" --non-interactive` | Run one turn in this process, save, **exit** (no REPL, no worker). |
486
+ | `chi -p "refactor this" --non-interactive` | Run one turn in this process, save, **exit** (no TUI, no worker). |
490
487
  | `chi --non-interactive` | Harmless no-op exit; no session created, no error. |
491
488
  | `chi --resume ID` | Resume session `ID` in a worker (or join the worker already running it) and attach. |
492
489
  | `chi --resume ID -p "next step" --non-interactive` | Resume `ID`, run the prompt, save, exit. |
493
490
  | `chi --resume ID -p "next step"` | Resume `ID`, send the prompt, **stay attached** to that session. |
494
- | `chi --no-shared [...]` | The same, in the plain in-process REPL. |
495
- | `chi scratch [-p ...] [--non-interactive]` | A new session in the plain REPL, deleted when it ends. |
491
+ | `chi scratch [-p ...] [--non-interactive]` | A new session, attached (or one turn with `--non-interactive`), deleted when it ends. |
496
492
 
497
493
  Notes:
498
494
 
@@ -507,14 +503,14 @@ Notes:
507
503
  script, `chi send --new --wait` is the better entry point: stdout holds the
508
504
  answer alone (see [Starting a session](sessions.md#starting-a-session)).
509
505
  - `-p` always feeds **and** runs the prompt; there is no feed-and-edit variant. To
510
- prefill (edit, not execute) the first REPL line, use the
506
+ prefill (edit, not execute) a new session's first prompt, use the
511
507
  `SAMAGOTCHI_DEFAULT_INPUT` environment variable instead.
512
508
  - Prompt history (↑) is one file shared by every session (see [Persistent Prompt
513
509
  History](#persistent-prompt-history)); `--resume` preserves the session's prior
514
510
  messages as turn context (a `-p` run on a resumed session never clobbers its
515
511
  conversation).
516
512
  - Non-interactive runs (`-p` with `--non-interactive`, or bare `--non-interactive`)
517
- print only the final result output on stdout — no spinner, status line, or REPL.
513
+ print only the final result output on stdout — no spinner, status line, or prompt.
518
514
  Everything else goes to stderr: the `Session: ID` line first, before the turn;
519
515
  retry lines and hooks' notices as they come, the after_turn hooks' ones
520
516
  (source-links' `sources:`) after the answer; and the error of a failed turn,
@@ -531,19 +527,30 @@ Notes:
531
527
 
532
528
  ### Scratch sessions
533
529
 
534
- `chi scratch` is `chi --no-shared` for a session you won't keep: a quick
535
- question, a try-out. It takes the run options (`-p`, `--non-interactive`,
536
- `--model`, `--profile`, `--memory`, `--mute`, `-v`, …); `--resume`, `--attach`
537
- and `--shared` are refused. Its first line says it is a scratch session.
538
-
539
- - The session is deleted however it ends: `/exit`, Ctrl-D, Ctrl-C at the
540
- prompt, an error, SIGTERM or SIGHUP. There is no recap, and the lines typed
541
- are not added to the prompt history.
542
- - It never shows in `chi web`. A process killed with `kill -9` leaves its
543
- session behind, marked `"scratch": true` in its session.json: `chi sessions
544
- list` shows it as `[scratch]`, and the next sweep or `chi sessions clean`
545
- deletes it. `chi --resume` and `--attach` refuse it (exit 1), so it never
546
- turns into a kept session.
530
+ `chi scratch` is plain `chi` for a session you won't keep: a quick question, a
531
+ try-out. It takes the run options (`-p`, `--non-interactive`, `--model`,
532
+ `--profile`, `--memory`, `--mute`, `-v`, …); `--resume` and `--attach` are
533
+ refused. Its first line says it is a scratch session.
534
+
535
+ - It runs attached, on a worker of its own. Ctrl-D, `/detach`, `/exit` and a
536
+ second Ctrl-C all end it: the terminal stops the worker and deletes the
537
+ session (`Scratch session deleted.`). `/archive` is refused. The lines typed
538
+ are not added to the prompt history. With `-p … --non-interactive` it is one
539
+ turn in this process, and the session is deleted as the run ends.
540
+ - The worker deletes the session too once its terminal is gone (no terminal
541
+ stream left for about 28 s, twice the terminal's reconnect retries, so a
542
+ dropped stream that reconnects keeps it; or none came within 30 s), so a
543
+ closed terminal window or a `kill -9` of the terminal leaves nothing: a turn
544
+ still running then is cancelled first. Another client's stream never keeps
545
+ it. It refuses `chi sessions restart`.
546
+ - It never shows in `chi web`, and only its terminal uses it: `chi send`, the
547
+ web's routes (a tab opened at its id too: its page and stream answer 409
548
+ `scratch`), `chi --resume` and `--attach` refuse it (exit 1), in one
549
+ wording: "that's a chi scratch session: only the terminal that started it
550
+ uses it (a leftover one is deleted at the next sweep: chi sessions clean)".
551
+ A session left behind when both died is marked `"scratch": true` in its
552
+ session.json: `chi sessions list` shows it as `[scratch]`, and the next
553
+ sweep or `chi sessions clean` deletes it.
547
554
  - Memories are read and preloaded as usual, but nothing is saved: `memory_write`
548
555
  answers "scratch session: nothing is saved", and `write`/`edit` into the
549
556
  memories folder are denied (a guardrail, rule `scratch-session`). `execute`
@@ -557,13 +564,13 @@ and `--shared` are refused. Its first line says it is a scratch session.
557
564
 
558
565
  ### Sharing a session
559
566
 
560
- Two different things share a session: `session.shared` is about UIs — several
561
- terminals and the Web UI attached to one worker — while `chi share` invites
562
- other people, participants with a link of their own (see
563
- [Participants](#participants)).
567
+ Two different things share a session: several terminals and the Web UI
568
+ attached to one worker, and `chi share`, which invites other people,
569
+ participants with a link of their own (see [Participants](#participants)).
570
+ This section is about the first.
564
571
 
565
572
  Plain `chi` runs the session in a background worker and attaches the terminal
566
- to it (`session.shared`, default `true`). A worker's session can have any number
573
+ to it; every interactive `chi` does (plain, `-p`, `--resume`, `--attach`). A worker's session can have any number
567
574
  of UIs at once: the Web UI and attached terminals (`chi`, `--resume`,
568
575
  `--attach`). They all see the same turns as they happen, and any of them can send
569
576
  a prompt, also while a turn runs (it merges into that turn as steering: the model
@@ -639,7 +646,7 @@ In an attached terminal:
639
646
  was started), whichever terminal you attach from.
640
647
  - `-p` sends its prompt once attached, `--model` switches the worker's model
641
648
  first, and `--no-interrupt` applies to each prompt this terminal sends.
642
- - History, completion and the idle status line work as in the REPL.
649
+ - Prompt history (↑), Tab completion and the idle status line work there.
643
650
  - The attached view needs reline 0.6.x to draw around the open prompt; with
644
651
  another version it prints plainly.
645
652
 
@@ -686,7 +693,7 @@ sessions restart ID`, the terminal with `/detach` and `chi --attach ID`), and
686
693
  the web's, `list_sessions`) and keeps them for good: the retention sweep never
687
694
  deletes an archived session, nor counts it. Its delegates go with it. A live
688
695
  worker is stopped first; a session running a turn (or with a delegate running
689
- one), open in a plain REPL, or a `chi scratch` one is refused. `chi sessions
696
+ one), one a `--non-interactive` run has, or a `chi scratch` one is refused. `chi sessions
690
697
  list --archived` shows them too, marked `[archived]` (`archived: true` in
691
698
  `--format json`); `chi sessions unarchive ID...` brings them back, and so does
692
699
  a message you send to one (the web, an attached terminal, `chi send`), but not
@@ -701,7 +708,8 @@ it). See
701
708
  session file and its whole directory (notes, images, queued input). Each id
702
709
  (or unique prefix) gets one line: `deleted`, or `refused` with the reason. A
703
710
  session whose worker runs is refused unless `--force` stops the worker first;
704
- one open in a plain REPL is always refused ("close it there first"). Exit
711
+ one a `--non-interactive` run has is always refused ("in use by a one-turn chi
712
+ --non-interactive run or an older chi's terminal; let it finish first"). Exit
705
713
  status: 0 when all are gone, 1 when any was refused or unknown, 2 on a usage
706
714
  error. The Web UI deletes too: `delete` in the info bar, or the ✕ on a card in
707
715
  All sessions; it asks first and stops a live worker.
@@ -718,18 +726,12 @@ object `{session_id, status, live, metrics, settings}` (`settings`: the session'
718
726
  exits 0. An unknown or ambiguous id exits 1 with `chi sessions stop`'s
719
727
  wording. See [Sessions](sessions.md#cli).
720
728
 
721
- **The plain REPL.** Some launches run the session in this process instead, with
722
- no worker:
723
-
724
- - `--no-shared`, for one run, or `session.shared: false` in the config
725
- (`SAMAGOTCHI_SESSION_SHARED=0`), for every run.
726
- - `--non-interactive`, a one-shot with no REPL.
727
- - `--verbose`, which attached mode can't honor (the worker prints nothing). It
728
- prints a one-line note, `(session.shared: --verbose runs in a plain REPL)`.
729
-
730
- A session the REPL has open can't be shared: `--resume` and `--attach` on it say
731
- "close it there first", and the Web UI shows it read-only. `--attach`/`--shared`
732
- can't be combined with `--non-interactive` or `--verbose`.
729
+ **One-turn runs.** `chi -p TEXT --non-interactive` (also with `--resume ID`)
730
+ runs its turn in this process, with no worker, and holds the session until it
731
+ ends. Meanwhile the session is "in use by a one-turn chi --non-interactive
732
+ run or an older chi's terminal": `--resume`, `--attach`, `chi send`, `chi note` and the Web UI's sends
733
+ refuse it, and the Web UI shows it read-only. `--attach` can't be combined with
734
+ `--non-interactive`.
733
735
 
734
736
  ### Muting a memory
735
737
 
@@ -741,8 +743,8 @@ file and index line stay as they are; only this session doesn't see it.
741
743
  - `--memory` and `--mute` are session fields (`preloaded_memory_names`,
742
744
  `muted_memory_names` in the session's JSON), written before the worker
743
745
  starts. A worker respawned by `--resume`, `--attach` or `chi send` builds
744
- the same prompt, and a REPL `--resume` of that session keeps the lists too
745
- (merged with the flags it is given).
746
+ the same prompt, and a `--resume ID --non-interactive` one-shot keeps the
747
+ lists too (merged with the flags it is given).
746
748
  - A mute wins: `--mute user_preferences` drops that config baseline entry for
747
749
  one session, and `--memory x --mute x` is a mute (one warning line).
748
750
  - Names are checked before the launch, warnings only: `Warning: --memory 'x'
@@ -908,7 +910,7 @@ guardrails.parent_answers: soft)`). `/parent-answers hard|standard|soft` sets th
908
910
  session's own, `/parent-answers default` drops it; it is saved at once and
909
911
  holds from the next answer. It never goes looser than config.yml's (the reply
910
912
  says when config.yml's applies instead). Anyone may tighten it; only you loosen
911
- it, at the REPL, an attached terminal or the web: `chi send`, a piped or marked
913
+ it, at an attached terminal or the web: `chi send`, a piped or marked
912
914
  attach and `chi -p --non-interactive` are refused. `/parent-answers` alone answers
913
915
  mid-turn too; a change waits for the turn's end. No chip: its reply is where the
914
916
  web shows it. See [Guardrails](guardrails.md#answers-from-a-parent-agent).
@@ -937,21 +939,19 @@ the model's `objectives` tool); [Objectives](sessions.md#objectives) has what th
937
939
  `check: …` under the move. Information only: it edits nothing, and it is refused for an objective with no move or a dropped one, and during a participant's turn. See [Objectives](sessions.md#objectives).
938
940
 
939
941
  All of them run mid-turn too. An edit answers with the new list at once and goes into the conversation between turns.
940
- Refused in a chi REPL's session (`--no-shared`), as `chi note` is; `/objectives` alone still answers there.
942
+ Refused while a `--non-interactive` run has the session, as `chi note` is.
941
943
 
942
944
  A `/model`, `/llm-context`, `/thinking`, `/reasoning-history` or `/toolkit` change that restarts the prompt cache
943
945
  asks first: the reply says what it costs, changes nothing, and names the line
944
946
  that applies it (`/thinking low --yes`, `/model qwen --default --yes`). `--yes` (or `-y`) applies it at once.
945
947
  The terminal puts that line in the next input (Enter applies it); the web's
946
948
  reply has an Apply button. `chi send ID "/thinking low"`,
947
- `chi -p "/thinking low" --non-interactive` and lines piped into the REPL apply
948
- without asking (a plain `chi -p` opens the REPL, which asks). See "Changes that
949
+ and `chi -p "/thinking low" --non-interactive` apply without asking. See "Changes that
949
950
  restart the prompt cache" in [configuration.md](configuration.md).
950
951
 
951
952
  ### Typing during a turn
952
953
 
953
- The prompt stays open while a turn runs, in an attached terminal and in the plain
954
- REPL alike:
954
+ The prompt stays open while a turn runs in an attached terminal:
955
955
 
956
956
  - A line you submit merges into the running turn at its next step (after the
957
957
  current tool call or answer): `(goes in at the next step)` at once, then
@@ -968,7 +968,7 @@ REPL alike:
968
968
  off; goes in at the next step)` (`steer.cut_after` is 0, per host/model:
969
969
  `steer_cut_after`, or no generation to cut).
970
970
  - `/queue TEXT` runs TEXT as a turn of its own after this one, in an attached
971
- terminal, the plain REPL and the web composer alike: `(queued: runs after this
971
+ terminal and the web composer alike: `(queued: runs after this
972
972
  turn)` (the web draws it as a queued bubble until its turn starts). It never
973
973
  merges into the running turn, and a plain line sent after it still does.
974
974
  Several queued lines run one turn each, in the order sent; they still run
@@ -980,7 +980,7 @@ REPL alike:
980
980
  with images works the same way: it waits for the turn's end, and the lines
981
981
  sent after it still go in at the next step.
982
982
  At the open prompt (no turn running) `/cut TEXT` and `/queue TEXT` run TEXT
983
- as a normal prompt, and the terminals say so: `(nothing is running: sent now)`.
983
+ as a normal prompt, and the terminal says so: `(nothing is running: sent now)`.
984
984
  - `/unqueue` (attached terminal) takes back the newest line this terminal
985
985
  queued that hasn't started: `removed: <its first 60 characters>`, and its text
986
986
  goes back into the input to change and send again (not over typed text: then
@@ -991,8 +991,7 @@ REPL alike:
991
991
  `(not removed: it already started)` when its turn won the race, `(not removed:
992
992
  it is already gone)` when another client removed it. Other terminals that
993
993
  showed it say `(a queued message was removed)`; the web drops its bubble. A
994
- worker older than it is not asked: `(/unqueue needs a newer worker: …)`. In
995
- the plain REPL it answers with a note (its own queue is not touched), and the
994
+ worker older than it is not asked: `(/unqueue needs a newer worker: …)`. The
996
995
  web's composer points at the × on the bubble.
997
996
  - **The web composer** has a row above the text field in a session (always
998
997
  there, so the composer never changes height): the keys while idle, and while
@@ -1050,24 +1049,16 @@ REPL alike:
1050
1049
  typed comes back once it closes. The choices then go, and one line stays:
1051
1050
  `? Pick a fruit → Banana`.
1052
1051
  - Ctrl-C cancels the turn and keeps what you typed.
1053
- - In the plain REPL, Ctrl-D on an empty prompt (or `exit`, `/exit`, `/quit`) mid-turn
1054
- exits once the turn ends: `(exits after this turn; Ctrl-C cancels it)`
1055
- (`/exit --delete` deletes the session then too). In an
1056
- attached terminal it detaches at once and the turn goes on in the worker
1057
- (`/exit` then says the worker stays up: a turn is running).
1058
- - `/archive` mid-turn archives once the turn ends:
1059
- `(archives after this turn; Ctrl-C cancels it)` in the plain REPL,
1060
- `(archives after this turn)` in an attached terminal, which also waits for
1061
- the commands queued behind the turn.
1062
-
1063
- With stdin that isn't a terminal (a pipe), the REPL reads a line only between
1064
- turns.
1052
+ - Ctrl-D on an empty prompt mid-turn detaches at once and the turn goes on in
1053
+ the worker (`/exit` then says the worker stays up: a turn is running).
1054
+ - `/archive` mid-turn archives once the turn ends: `(archives after this
1055
+ turn)`; it also waits for the commands queued behind the turn.
1065
1056
 
1066
1057
  ### Images
1067
1058
 
1068
1059
  A model that can see images gets them these ways:
1069
1060
 
1070
- - **`@path` in a prompt** (REPL, attached terminal, `-p`): `what's wrong in
1061
+ - **`@path` in a prompt** (attached terminal, `-p`): `what's wrong in
1071
1062
  @shot.png?`, `@~/Desktop/a.jpg`, `@"my shot.png"`. Each `@` token that names an
1072
1063
  image file (png, jpeg, gif, webp; bmp, tiff and heic are converted) goes with
1073
1064
  the prompt, and a dim line shows it: `[image shot.png 1280×800 · ~1.3k tokens]`.
@@ -1583,7 +1574,7 @@ chi --remote studio --dir /Users/me/app -p "hi" # a new session there (--
1583
1574
  `--attach`/`--resume` they work as here (`--model`, `--thinking`,
1584
1575
  `--llm-context*` change the session; the others are named as ignored).
1585
1576
  `--non-interactive` (use `chi --remote studio send --new --dir D -m TEXT
1586
- --wait`), `--verbose`, `--no-shared`, `--memory`, `--mute` and
1577
+ --wait`), `--verbose`, `--memory`, `--mute` and
1587
1578
  `--append-system-prompt` run on this machine only (exit 2).
1588
1579
  - `@path` images are this machine's files (read and downscaled here, then
1589
1580
  uploaded); Tab completes `/` commands and `@path`, not memory names. The
@@ -1736,8 +1727,7 @@ chi share revoke --all # every link to every session
1736
1727
  `/share NAME [--agent] [--expires 3d] [--cap 2]` (the link and its QR code, once), `/participants` (the list),
1737
1728
  `/participants revoke [P]` (one participant, or everyone) and `/participants cap P DOLLARS`. They are `chi share`'s
1738
1729
  own, so under `chi --remote NAME` they reach that machine's chi web, as `chi --remote NAME share` does; an invite or
1739
- a revoke made with them isn't announced again by the `participants>` line. The REPL
1740
- (`--no-shared`) answers them with a note: a participant's turns run on the session's worker.
1730
+ a revoke made with them isn't announced again by the `participants>` line.
1741
1731
 
1742
1732
  #### Review sessions
1743
1733
 
@@ -1806,8 +1796,7 @@ A short recap of the session, for when you come back to it: what you were
1806
1796
  working on, what came of it and what is still open, not a turn-by-turn log.
1807
1797
 
1808
1798
  - It is written once the session has sat idle for `recap.inactivity` (180 s)
1809
- after at least `recap.min_user_turns` (2) prompts, and as a worker (or the
1810
- REPL) exits, when something new was said since the last one. Each one
1799
+ after at least `recap.min_user_turns` (2) prompts, and as a worker exits, when something new was said since the last one. Each one
1811
1800
  builds on the previous recap, so it only sends what is new.
1812
1801
  - It is saved with the session (`<session>/recap.json`) and shown as a dim
1813
1802
  `recap>` block when you attach or `--resume`, noting how many turns came
@@ -1835,8 +1824,8 @@ working on, what came of it and what is still open, not a turn-by-turn log.
1835
1824
 
1836
1825
  ## Time gaps (terminal)
1837
1826
 
1838
- Both terminals (attached and the REPL) show when things happened without a
1839
- time on every line:
1827
+ The attached terminal shows when things happened without a time on every
1828
+ line:
1840
1829
 
1841
1830
  - A dim divider marks a quiet gap of 10 minutes or more, before what comes
1842
1831
  next: `── 14:32 · 47 min later ──`, the date added when the day changed
@@ -1848,11 +1837,10 @@ time on every line:
1848
1837
  activity.
1849
1838
  - Attaching to a session whose last activity was 10 minutes ago or more
1850
1839
  says when, after the join block: `── last activity 14:32 · 47 min ago ──`
1851
- (from the newest timed message, else the saved recap's time). With
1852
- `--resume` the REPL marks the gap before the first prompt instead.
1840
+ (from the newest timed message, else the saved recap's time).
1853
1841
  - A recap names the local time it was written: `recap 14:32>`, `recap 14:32
1854
1842
  (before the last 2 turns)>`.
1855
- - Only live activity and the join: neither terminal replays the history, so
1843
+ - Only live activity and the join: the terminal doesn't replay the history, so
1856
1844
  older gaps aren't marked. `--non-interactive` prints none.
1857
1845
 
1858
1846
  ## Tool Activity Log
@@ -1872,14 +1860,15 @@ Parameter previews are normalized to one line and truncated to keep output conci
1872
1860
  This is separate from verbose mode:
1873
1861
 
1874
1862
  - Default output shows short activity status lines only.
1875
- - `-v/--verbose` prints the debug log's records (raw LLM responses and full
1876
- tool call/result payloads among them) to stderr as well; see
1863
+ - `-v/--verbose` shows the session's debug records (raw LLM responses and full
1864
+ tool call/result payloads among them): dim, above the prompt, in the
1865
+ attached terminal; on stderr with `--non-interactive`. See
1877
1866
  [Debug Log File](configuration.md#debug-log-file).
1878
1867
 
1879
1868
  ## Persistent Prompt History
1880
1869
 
1881
1870
  Assist mode keeps a persistent prompt history across restarts, one for every
1882
- chi prompt: the REPL, attached mode and the `chi web` composer (↑/↓ there)
1871
+ chi prompt: the attached terminal and the `chi web` composer (↑/↓ there)
1883
1872
  share it.
1884
1873
 
1885
1874
  - Default history file: `$XDG_STATE_HOME/samagotchi/history.json`
@@ -1895,7 +1884,7 @@ share it.
1895
1884
  Behavior details:
1896
1885
 
1897
1886
  - Prompt history is loaded on startup before the first `>` prompt.
1898
- - A running REPL or attached TUI picks up the lines other chi processes (the
1887
+ - A running attached TUI picks up the lines other chi processes (the
1899
1888
  web, another terminal) added: before each `>` prompt and on the first ↑ at
1900
1889
  an open one (Ctrl-P, vi `k` too), when the file changed, its new lines join
1901
1890
  the ↑ list after the ones already there, without a
@@ -1914,7 +1903,7 @@ Behavior details:
1914
1903
 
1915
1904
  ## Status Line
1916
1905
 
1917
- The REPL and attached mode show one status row under the prompt, drawn when what it says
1906
+ The attached terminal shows one status row under the prompt, drawn when what it says
1918
1907
  changes:
1919
1908
 
1920
1909
  ```
@@ -1932,11 +1921,11 @@ status> model=Qwen3.6-35B | ⑂ 2 running · 1 waiting | 2 participants | ctx=8.
1932
1921
  - `⑂ …`: this session's delegate children (forks aren't counted): how many run and how many wait
1933
1922
  for an answer; only the counts there are, nothing when none does (`/children` has the rest:
1934
1923
  done, failed, whether a reply was reported). The terminal reads them from the children's files
1935
- (the delegates in the session's `delegates.json`): an attached one when it joins, when a turn
1936
- ends and when a delegate's report merges into a turn, the REPL whenever it draws the row. A
1924
+ (the delegates in the session's `delegates.json`) when it joins, when a turn
1925
+ ends and when a delegate's report merges into a turn. A
1937
1926
  child that starts waiting on an approval (which doesn't wake the parent) shows at the next of
1938
1927
  those.
1939
- - `N participants`: who is in the session's review now ([Participants](#participants)), attached only.
1928
+ - `N participants`: who is in the session's review now ([Participants](#participants)).
1940
1929
  - `ctx=`: the kernel's context estimate and its bucket, updated during a turn (on hosts that
1941
1930
  report none, `api: openai`, at the turn's end).
1942
1931
  - `mem:`: the memories the session read, with its `--memory` list; `muted:` its `--mute` list.
@@ -1960,7 +1949,7 @@ It lists the top 3 tools by count (ties go to the tool used first), the failed c
1960
1949
  (a call a guardrail or an approval blocked counts as a call, not as failed) and the last
1961
1950
  call with its parameters, cut to the terminal width. It starts over with each turn.
1962
1951
 
1963
- - The REPL and attached mode: the second row of the activity slot, shown while the slot is (the
1952
+ - The terminal: the second row of the activity slot, shown while the slot is (the
1964
1953
  model generating or a tool running). Joining a turn mid-way seeds it from the turn so far.
1965
1954
  - The web: the activity panel's summary reads `activity · 12 tool calls (2 failed) · execute ×7 · …`
1966
1955
  (without `last:`: the rows show it).
@@ -1968,7 +1957,7 @@ call with its parameters, cut to the terminal width. It starts over with each tu
1968
1957
  ## Activity Row
1969
1958
 
1970
1959
  While a turn runs, one row above the prompt says what it is doing, the spinner frame first
1971
- (the REPL and attached mode alike):
1960
+ (in the attached terminal):
1972
1961
 
1973
1962
  - `| thinking…` while the model starts, then `| thinking · <sentence>`: the newest complete
1974
1963
  sentence of its thinking, or of its answer (`writing ·`), like the web's thinking ticker: the
@@ -2003,7 +1992,7 @@ Behavior notes:
2003
1992
  tool steps keeps them, as a cancel does, with the dim `partial progress kept; !rollback restores the pre-turn state`
2004
1993
  (the model reads a note saying how many steps ran and why it stopped; `chi send --wait` and a delegating parent
2005
1994
  read `the turn failed after N tool steps: <why>; its work so far stays`). The
2006
- REPL and attached mode say the same; the web ends a failed turn whose steps stayed with `✕ turn failed: <summary>;
1995
+ attached terminal says the same; the web ends a failed turn whose steps stayed with `✕ turn failed: <summary>;
2007
1996
  partial progress kept (!rollback restores the pre-turn state)`, after a reload too, and says `■ canceled (Ctrl-C)`
2008
1997
  (`stopped` for its Stop button, `by a hook` for a hook's). A turn a bundle's plugin stopped names it: `■ turn stopped by loop-guard` (the web:
2009
1998
  `■ stopped by loop-guard`).
@@ -2030,9 +2019,6 @@ Behavior notes:
2030
2019
  answers it too. If the worker exits (a stop, a crash), the offer goes with it.
2031
2020
  - In the attached terminal (`chi --attach`) the question's prompt reads the continue words: Enter alone, `yes`, `y`
2032
2021
  or `/continue` continue; `no` stops; `no, <reason>` stops and tells the model why; `1` and `2` pick the options.
2033
- - In the plain REPL (`--no-shared`) the CLI asks at the `? ` prompt, with the choices listed under it: `yes` (Enter
2034
- alone, or `/continue`) resumes, `no` stops, and `no, <explanation>` stops while keeping the reason in conversation
2035
- context. Once answered, one line stays: `? The turn ran out of iterations. Continue it? → no, too slow`.
2036
2022
  - Continue goes on with the same turn: the model keeps the reasoning (thinking) of the run it continues, on chat and
2037
2023
  native hosts, so a local server's prompt cache stays warm. Continue's text is a steer: on a chat host the reasoning
2038
2024
  starts again from it. See "Reasoning history" in [configuration.md](configuration.md).
@@ -64,11 +64,9 @@ model_aliases:
64
64
  small: your-small-model-id
65
65
  tiny: small-box:your-small-model-id # alias may be bare or host:model (hybrid)
66
66
 
67
- # Plain chi runs its session in a background worker and attaches to it, so the
68
- # web UI can share it (default true; env SAMAGOTCHI_SESSION_SHARED). false keeps
69
- # the in-process REPL; --no-shared does for one run.
67
+ # A session runs in a background worker; chi attaches to it, and the web UI
68
+ # shares it.
70
69
  session:
71
- shared: true
72
70
  # idle_exit_minutes: 30 # an unused worker exits after this (0 = never)
73
71
  # project_env: mise # a worker's tools get its folder's `mise env` (off: the starter's env)
74
72
  # keep_empty: false # true keeps sessions nothing happened in (default: deleted when left)
@@ -172,7 +170,6 @@ or `chi web` restart.
172
170
  | `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. |
173
171
  | `hooks`, `bundles` | Worker start | Hooks, plugins and their bundle settings load with the engine. |
174
172
  | `recap.*` | Worker start | The engine builds its recap job at start, and again when it binds a session with its own `recap.enabled` or `recap.sentences` (`--set`, see "Per-session settings") and when `/recap on\|off\|default` changes the session's own value. |
175
- | `session.shared` | Next `chi` invocation | It selects attached-worker or in-process mode for that invocation. |
176
173
  | `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. |
177
174
  | `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. |
178
175
  | `web.*` except `web.participants.*` | `chi web` start | Restart `chi web` to change its bind address, port or page settings. |
@@ -355,10 +352,8 @@ For models on that host, chi uses the chat loop (its own OpenAI chat adapter): i
355
352
  takes the OpenAI base (`url:`, else `http://HOST:PORT/v1`) and streams messages plus
356
353
  function schemas from `/v1/chat/completions`; the model's reasoning (`reasoning_content`)
357
354
  shows as thinking. This works with Splash and with llama.cpp servers that
358
- expose the OpenAI-compatible chat endpoint. In verbose mode (`-v`), chi prints the loop the
359
- starting model uses (`[verbose] backend=chat` or `backend=native`); request
360
- bodies are not logged. The interactive REPL, `--prompt`,
361
- workers, and resumed sessions all use the loop of the model's host. Hosts without
355
+ expose the OpenAI-compatible chat endpoint. Workers, `--non-interactive` one-shots and resumed
356
+ sessions all use the loop of the model's host. Hosts without
362
357
  a chat `api:` keep using llama.cpp's native `/completion`.
363
358
 
364
359
  ### API keys from the Keychain
@@ -655,7 +650,7 @@ models:
655
650
  it, a delegate child starts without it (it runs at its model's level). Set it with:
656
651
  - `/thinking LEVEL` in the session (`/thinking default` unsets it, `/thinking` alone shows the level and where it
657
652
  came from);
658
- - `chi --thinking LEVEL` on a run that starts or resumes a session (the REPL, `-p`, `--resume`, an attached one);
653
+ - `chi --thinking LEVEL` on a run that starts or resumes a session (plain `chi`, `-p`, `--resume`, an attached one);
659
654
  - `chi send --new --thinking LEVEL`;
660
655
  - the web's ⚙ panel in the session bar (its Thinking row), and the start page's ⚙ panel (`POST /api/sessions` takes `"thinking": "low"`;
661
656
  anything that isn't a level answers `400 invalid_thinking`).
@@ -849,15 +844,15 @@ first: an unknown host or a bad alias is an error at once, not a question.
849
844
  a full-prefix change also says preserved thinking in replies is dropped from then on.
850
845
  - `Nothing changed yet: send /thinking low --yes to apply.` names the line that applies it.
851
846
  - `--yes` (or `-y`, anywhere after the command) applies it at once.
852
- - The terminal (the REPL and an attached TUI) puts the `--yes` line in the next input: Enter applies it.
847
+ - The attached terminal puts the `--yes` line in the next input: Enter applies it.
853
848
  - The web's reply bubble has an **Apply (restarts the cache)** button. The session bar's ⚙ panel is already an
854
849
  explicit choice: a tap sends the `--yes` line, and its note says what a change costs. Command bubbles are page-only, so
855
850
  the button is gone after a reload.
856
851
  - Only a person at a web tab or a chi TUI is asked. `chi send ID "/thinking low"`,
857
- `chi -p "/thinking low" --non-interactive`, lines piped into the REPL, a delegate, a plugin and a card's action
852
+ `chi -p "/thinking low" --non-interactive`, a delegate, a plugin and a card's action
858
853
  apply directly, since nobody would see the question; so do the start flags (`chi --thinking`, `--model` and
859
854
  `--llm-context` on a resumed or attached session send `/thinking LEVEL --yes`, `/model NAME --yes` and
860
- `/llm-context … --yes`). A plain `chi -p` opens the REPL, which asks.
855
+ `/llm-context … --yes`).
861
856
 
862
857
  ## Llama HTTP Timeouts
863
858
 
@@ -1107,7 +1102,7 @@ retry:
1107
1102
  `retry.empty_answer` is a different thing: the request worked, but the model's answer had no visible text and no
1108
1103
  tool calls (thinking only, or nothing; a thinking loop cut by the provider's output cap looks like this). chi then
1109
1104
  asks again in the same turn with a hidden note ("your last reply had no visible answer…"), at `temperature: 0.6`
1110
- unless `sampling:` sets one; the REPL prints `↻ empty answer, asking again (1/1)` and the web shows it as a row of
1105
+ unless `sampling:` sets one; the terminal prints `↻ empty answer, asking again (1/1)` and the web shows it as a row of
1111
1106
  the step. `retry.empty_answer` (default `1`, at most `3`, env `SAMAGOTCHI_RETRY_EMPTY_ANSWER`, no CLI flag) is how
1112
1107
  many times per turn; `0` ends the turn at the empty answer as before. An answer cut because the context is full
1113
1108
  (90 % or more) is not retried. When the retries run out the turn ends with no answer: every UI shows one muted line,
@@ -1209,8 +1204,8 @@ The turn's prompt and its completed tool calls stay in the session.
1209
1204
 
1210
1205
  ## Debug Log File
1211
1206
 
1212
- Every `chi` process (the REPL, the attached terminal, the background
1213
- workers, `chi web`) appends tagged records to one log file, so you can see
1207
+ Every `chi` process (the attached terminal, a `--non-interactive` one-shot,
1208
+ the background workers, `chi web`) appends tagged records to one log file, so you can see
1214
1209
  what happened in a session, what went over the wire and why something
1215
1210
  failed, without `--verbose`.
1216
1211
 
@@ -1248,9 +1243,10 @@ One record is one line, plus indented payload lines at debug level:
1248
1243
  space, quote or `=` is a JSON string, so a record never spans lines;
1249
1244
  control characters (terminal colours in tool output) are escaped.
1250
1245
  - Tags: `turn` (a session's event trail), `http` (model requests),
1251
- `worker`, `bridge`, `web`, `attached`, `repl`, `idle`, `recap`, `hooks`,
1246
+ `worker`, `bridge`, `web`, `attached`, `idle`, `recap`, `hooks`,
1252
1247
  `plugins`, `guardrails`, `config`, `memory`, `model` (debug dumps), `context` (attached context fetches),
1253
- `broadcast` (chi broadcast's triage).
1248
+ `broadcast` (chi broadcast's triage), `toolkit`, `system_one`, `prompt` (a system prompt section left out
1249
+ after an error).
1254
1250
  - The format is parsed by `Samagotchi::LogLine` (`parse`, `each_record`);
1255
1251
  keep tools that read it on that parser.
1256
1252
 
@@ -1259,7 +1255,9 @@ What each level adds:
1259
1255
  - `error`: crashes (a worker, a bridge connection, the idle scheduler, a
1260
1256
  recap) with the first 20 backtrace frames; failed model requests.
1261
1257
  - `warn`: retries (429, 5xx, network), failed turns, hook and guardrail
1262
- problems, config warnings. Warnings `chi` prints on stderr are logged too,
1258
+ problems, config warnings, and a fallback after an error (a prompt section or a
1259
+ Bridge reply chi left out, `Degrade`): once per process for each kind, later ones
1260
+ at `debug`. Warnings `chi` prints on stderr are logged too,
1263
1261
  with the same text as `msg=`; a worker's (its stderr goes nowhere) now
1264
1262
  only reach the file.
1265
1263
  - `info`: turns, generations and tool calls with sizes and times (never the
@@ -1270,8 +1268,12 @@ What each level adds:
1270
1268
  and results, context status), probes and model lists, every web API and
1271
1269
  bridge request.
1272
1270
 
1273
- `-v`/`--verbose` (the plain REPL only) logs at `debug` and prints every
1274
- record to stderr as well.
1271
+ `-v`/`--verbose` logs at `debug`, in this chi and in a worker it starts
1272
+ (a worker that was already running keeps its own level, and a one-line note
1273
+ says so: one `chi web` started may log to another file). The attached
1274
+ terminal shows the session's records (by `sid`) dim, above the prompt, as
1275
+ they come; a `--non-interactive` one-shot prints every record to stderr
1276
+ as well.
1275
1277
 
1276
1278
  ### Rotation and secrets
1277
1279
 
@@ -1476,8 +1478,8 @@ work tree top when inside it, else with `~`.
1476
1478
  every request`). The files are saved in the session (`appended_prompt_files`),
1477
1479
  so a respawned worker builds the same prompt, and a fork or a continue keeps
1478
1480
  them; a delegate child doesn't. With `--attach` or `--resume` the flag is
1479
- ignored with one line, as `--memory` is; a REPL `--resume` (`--no-shared`)
1480
- adds them for that run only.
1481
+ ignored with one line, as `--memory` is; a `--resume ID --non-interactive`
1482
+ one-shot adds them for that run only.
1481
1483
  - The files' text is read at each prompt build, as AGENTS.md's is: an edit is
1482
1484
  picked up by a new process or a rebuild (`/model`). `/stats` lists the files
1483
1485
  in the prompt on its `prompt files:` line.
@@ -2215,7 +2217,7 @@ column says so, a `--kebab-name` flag. The maps (`hosts:`, `models:`,
2215
2217
  | `recap.timeout` | `30` | yes | Seconds a recap request may take. |
2216
2218
  | `recap.min_user_turns` | `2` | yes | Prompts a session needs before it gets a recap. |
2217
2219
  | `recap.sentences` | `2-4` | yes | Recap length, `N` or `N-M` (1–10). Per session too: `--set recap.sentences=3`. |
2218
- | `broadcast.active_hours` | `8` | | `chi broadcast` reaches a session a worker or a chi REPL runs, or whose last turn ended within this many hours. See [Broadcast](broadcast.md). |
2220
+ | `broadcast.active_hours` | `8` | | `chi broadcast` reaches a session a worker or a one-turn `--non-interactive` run has, or whose last turn ended within this many hours. See [Broadcast](broadcast.md). |
2219
2221
  | `broadcast.ticket_pattern` | `\b[A-Z][A-Z0-9]+-\d+\b` | | A Ruby regex for ticket ids; one in the note and in a session's branch (any case) or prompts delivers the broadcast there. See [Broadcast](broadcast.md). |
2220
2222
  | `broadcast.triage_model` | recap's | | The model that judges a recipient no tag matched (a model ref, as `recap.model`); unset: the recap's model, else `default.model`. A ~9B dense instruct model or larger; 4B-class ones say yes to nearly everything. See [Broadcast](broadcast.md#triage). |
2221
2223
  | `broadcast.triage_host_ref` | none | | A `hosts:` name for the triage model. |
@@ -2223,7 +2225,6 @@ column says so, a `--kebab-name` flag. The maps (`hosts:`, `models:`,
2223
2225
  | `broadcast.triage_parallel` | `4` | | Triage requests at a time. |
2224
2226
  | `broadcast.triage_deadline` | `20` | | Seconds triage may take in all; a recipient not judged by then gets the note unchecked. |
2225
2227
  | `broadcast.threshold` | `0.5` | | The P(yes) a recipient needs, when the triage host gives logprobs; a plain yes or no is 1 or 0. |
2226
- | `session.shared` | `true` | | Plain `chi` runs its session in a worker and attaches; `--no-shared` per run. |
2227
2228
  | `session.idle_exit_minutes` | `30` | yes | An unused worker exits after this; `0` = never. |
2228
2229
  | `session.project_env` | `mise` | | The commands a session's worker runs follow its project: `mise` runs them in the session folder's `mise env`, read once at worker start (`chi sessions restart` picks up a mise.toml edit); `off` doesn't ask mise: the tools keep the env of whoever started the worker (with a chi home, the home's `chi` still goes first on their PATH). See [Project env](sessions.md#project-env). |
2229
2230
  | `session.carry_last_answer` | `true` | | A continue's carry note holds the previous session's last answer after its recap; `false`: the recap only. See [Session chains](sessions.md#session-chains). |
@@ -2255,7 +2256,7 @@ column says so, a `--kebab-name` flag. The maps (`hosts:`, `models:`,
2255
2256
  | `log.file` | state dir | yes | See "Debug Log File". |
2256
2257
  | `log.disable` | `false` | yes | No file logging. |
2257
2258
  | `log.level` | `info` | yes | `debug`, `info`, `warn`, `error`. |
2258
- | `status.line` | `on` | yes | The status row under the prompt (the REPL's and attached mode's), `on` or `off`. |
2259
+ | `status.line` | `on` | yes | The status row under the attached terminal's prompt, `on` or `off`. |
2259
2260
  | `context.status` | `true` | yes | Context-usage telemetry for the model. See [context telemetry](internals/context-telemetry.md). |
2260
2261
  | `context.window_tokens` | server's, else 256000 | yes | Context window when the server doesn't report one. `models.<key>.window_tokens` and `hosts.<name>.window_tokens` come first; see "The context window". |
2261
2262
  | `models.<key>.window_tokens`, `hosts.<name>.window_tokens` | none | | A model's or host's context window when the server and its model list report none. |
data/docs/context.md CHANGED
@@ -617,13 +617,13 @@ show the answer as it is.
617
617
  after a push links may be a few lines off until the next read. Without
618
618
  `gh` or its login, nothing is linked.
619
619
  - **Where it reads**: only in a session worker (the web, an attached chi),
620
- whose answers the web shows while the session runs. The REPL and
621
- `chi -p` read nothing (no `gh api` calls), so their answers have no links,
620
+ whose answers the web shows while the session runs. A
621
+ `chi -p … --non-interactive` run reads nothing (no `gh api` calls), so its answers have no links,
622
622
  in the web too; a scratch session never reads. The PR itself is still
623
623
  attached and its context still reaches the model everywhere.
624
624
 
625
625
  `line_links:` takes `false` (off), `true` (the default: a worker only) or
626
- `always` (the REPL and `chi -p` read too, so their answers are linked when
626
+ `always` (a `chi -p … --non-interactive` run reads too, so its answers are linked when
627
627
  you open the session in the web later):
628
628
 
629
629
  ```yaml
data/docs/desktop.md CHANGED
@@ -80,7 +80,7 @@ models and aliases (from [`chi models`](cli.md#listing-the-models)), at most nin
80
80
  The chooser needs a chi with `chi models`: an older helper works with a newer chi, not the reverse
81
81
  (`chi desktop upgrade` after updating chi).
82
82
 
83
- A session open in a `chi --no-shared` REPL isn't listed: it takes no notes or messages.
83
+ A session a one-turn `chi -p … --non-interactive` run has isn't listed: it takes no notes or messages.
84
84
 
85
85
  ## Images
86
86