samagotchi 0.12.0 → 0.13.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 (64) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +62 -1
  3. data/README.md +20 -7
  4. data/bin/chi +5 -2
  5. data/docs/architecture.md +4 -2
  6. data/docs/cli.md +34 -10
  7. data/docs/configuration.md +29 -8
  8. data/docs/desktop.md +10 -6
  9. data/docs/guardrails.md +73 -7
  10. data/docs/hooks.md +13 -9
  11. data/docs/memory.md +5 -3
  12. data/docs/plugins.md +4 -4
  13. data/docs/sessions.md +9 -6
  14. data/docs/sub-agent.md +128 -0
  15. data/lib/samagotchi/answer_command.rb +220 -0
  16. data/lib/samagotchi/bridge.rb +11 -1
  17. data/lib/samagotchi/bridge_client.rb +8 -3
  18. data/lib/samagotchi/bundle_command.rb +18 -10
  19. data/lib/samagotchi/bundles/guardrails/guardrails/rules.yml +19 -0
  20. data/lib/samagotchi/bundles/guardrails/manifest.yml +2 -2
  21. data/lib/samagotchi/bundles/system/config_modification_protocol.md +5 -5
  22. data/lib/samagotchi/bundles/system/manifest.yml +2 -2
  23. data/lib/samagotchi/cli/command.rb +3 -2
  24. data/lib/samagotchi/cli/exit.rb +23 -0
  25. data/lib/samagotchi/cli/parent_wait.rb +82 -0
  26. data/lib/samagotchi/config.rb +50 -18
  27. data/lib/samagotchi/desktop_command.rb +5 -3
  28. data/lib/samagotchi/engine.rb +40 -14
  29. data/lib/samagotchi/guardrails/parent_approvals.rb +155 -0
  30. data/lib/samagotchi/hooks/bundle_loader.rb +10 -3
  31. data/lib/samagotchi/host_registry.rb +0 -1
  32. data/lib/samagotchi/llm/openai_chat.rb +9 -1
  33. data/lib/samagotchi/memory_bundle/installer.rb +12 -0
  34. data/lib/samagotchi/memory_bundle/status.rb +9 -1
  35. data/lib/samagotchi/memory_paths.rb +8 -0
  36. data/lib/samagotchi/model_profile.rb +30 -16
  37. data/lib/samagotchi/parent_report.rb +213 -0
  38. data/lib/samagotchi/plugin/api.rb +15 -2
  39. data/lib/samagotchi/prompt_literal_guard.rb +4 -2
  40. data/lib/samagotchi/question_desk.rb +29 -2
  41. data/lib/samagotchi/recap_setup.rb +15 -5
  42. data/lib/samagotchi/reply_wait.rb +5 -1
  43. data/lib/samagotchi/send_command.rb +50 -75
  44. data/lib/samagotchi/session.rb +15 -0
  45. data/lib/samagotchi/session_manager.rb +34 -7
  46. data/lib/samagotchi/sessions_command.rb +13 -3
  47. data/lib/samagotchi/system_prompt.rb +10 -2
  48. data/lib/samagotchi/terminal_ui/attach_launcher.rb +33 -5
  49. data/lib/samagotchi/terminal_ui/attached_loop.rb +17 -5
  50. data/lib/samagotchi/terminal_ui.rb +15 -1
  51. data/lib/samagotchi/thought_stream_splitter.rb +4 -4
  52. data/lib/samagotchi/tool_call_parser.rb +5 -6
  53. data/lib/samagotchi/tools/builtin_calls.rb +14 -3
  54. data/lib/samagotchi/tools/builtins.rb +14 -2
  55. data/lib/samagotchi/tools/delegate_wait.rb +16 -4
  56. data/lib/samagotchi/tools/execute.rb +8 -8
  57. data/lib/samagotchi/tools/task_create.rb +3 -2
  58. data/lib/samagotchi/tools/task_runtime.rb +7 -2
  59. data/lib/samagotchi/version.rb +1 -1
  60. data/lib/samagotchi/web/app.rb +4 -3
  61. data/lib/samagotchi/web/message_parts.rb +2 -1
  62. data/lib/samagotchi/web/server.rb +2 -1
  63. data/lib/samagotchi/web/session_summary.rb +3 -11
  64. metadata +7 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9668c1088aa3739aa60890e07c7d04cf41fb87debf9683b6cd42b6e6e61ee265
4
- data.tar.gz: ecfd58cc93c0dee8d867936c75754f854da34cf436dce28fcbc442e7f61c6ec2
3
+ metadata.gz: 2e7f8dcd85ecceeec6695f9ee969633b68c9f4900c597af6ffc87e9b8ee15168
4
+ data.tar.gz: d26fd005c3e98b1177de659b41e94ae09a22d19159d74215475db6b5e1777ff3
5
5
  SHA512:
6
- metadata.gz: cd2b82ad80038fb47d35a7b76177312521548a61764963697bebe2cb3b5389fd2d604debba118a87bca43077f2f350b7a0c5f63878df73c5ad75382951246ca0
7
- data.tar.gz: ef64847c760b05f8b6ee084fcd39b0ffc2595de21538c388ee7dc8c37f59a952bf4f55b2cf8db8df8187cf4600dd890e996bb94473a9af4e3e99a8cef8ed48af
6
+ metadata.gz: aeb8f2f124a5c21f0f5a58ea99c8f473bbde98716ee9abb47478697971a079c32dfd7c36097de58702ec2104ecb8f6846f403019eb9ac66a772c6a14c7b89c0c
7
+ data.tar.gz: 1ae7b930ce05499c42e1d2cea7a140261d6d0240291ecbdd58394fe8da5649452f969ecccc219317b77baaa686dddf77107313d2c469aa4c4c3277aa997873fd
data/CHANGELOG.md CHANGED
@@ -8,6 +8,66 @@ and commands may change between minor versions. How releases are made:
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [0.13.0] - 2026-10-02
12
+
13
+ ### Added
14
+
15
+ - `chi send --wait --format json` prints one JSON object on stdout however the wait ends: the reply, a question with its
16
+ options and the `chi answer` command for it, or the status and a detail line, for scripts and parent agents.
17
+ - `chi answer ID --question QID --option N` (or `--text`, `--dismiss`) answers the question a session waits on and
18
+ waits for what comes next, as `chi send --wait` does, so an agent running chi as a sub-agent can answer chi's
19
+ questions itself. `chi send --wait -m` to a session waiting for an answer is refused with the `chi answer` command
20
+ for it.
21
+ - An approval answered with `chi answer` can be denied, not allowed: allowing is the user's (the web, `chi --attach`).
22
+ `guardrails.parent_approvals: once` in config.yml (no environment variable) lets "Allow
23
+ once" through, never a wider scope, and never on a call that changes chi's own config, hooks or guardrail rules; an approval whose offered scopes are missing lets only Deny through. The worker
24
+ checks it again with its own config (`chi answer` marks its answers); the web and `chi --attach` keep every scope.
25
+ - `chi sessions list` shows a session waiting for an answer as `waiting`; `--format json` has `waiting` (`question`,
26
+ `approval` or `hook`) and `waiting_id`, the question's id for `chi answer --question`.
27
+ - docs/sub-agent.md: running chi as another agent's sub-agent, with instructions to paste into its `CLAUDE.md` /
28
+ `AGENTS.md`.
29
+
30
+ ### Changed
31
+
32
+ - The `guardrails` bundle (0.3.0) asks before answering chi's questions around `chi answer`: `chi --attach` / `chi -p`
33
+ with stdin from a pipe, a here-string or a file, and `curl`/`wget` to a session's `/answer` route.
34
+ - An answer typed into `chi --attach` or the REPL counts as a parent agent's, held to `guardrails.parent_approvals`,
35
+ when stdin isn't a terminal or `CLAUDECODE`, `AI_AGENT` or `SAMAGOTCHI_PARENT_SESSION` is set: a piped `y` no
36
+ longer allows an approval at any scope. chi's `execute` and `task_create` export `SAMAGOTCHI_PARENT_SESSION` (the
37
+ session's id) into the commands they run, and the model's `task_create` env can't set it.
38
+ - `guardrails.enabled` and `guardrails.small_models` are config.yml only: `SAMAGOTCHI_GUARDRAILS_ENABLED=false` no
39
+ longer switches guardrails off, and a worker unsets every `SAMAGOTCHI_GUARDRAILS_*` it inherits, so a parent agent
40
+ starting or waking a session can't switch its guardrails off. `XDG_CONFIG_HOME` still picks the config dir.
41
+ - `chi send --wait` exits 4 (not 1) when `--timeout` passes with the turn still running.
42
+ - Attached `chi -p` from a script exits 3 (not 1) when it leaves a question or an approval waiting for an answer,
43
+ and prints the whole question on stderr with the `chi answer` command for it, as `chi send --wait` does.
44
+ - For an approval, the question block, `answer_with` and the refusal tell a parent agent to deny it and tell its
45
+ user (`--option Deny --text WHY`), not `--option N` or `chi --attach`; other questions keep their wording.
46
+ - `chi send --wait`'s exit 3 prints the whole question on stderr: its text, numbered options and how to answer it.
47
+ - `delegate` / `delegate_result` on a child waiting for an answer give the whole question: its text, numbered options
48
+ and the `chi answer` command for it.
49
+ - `chi send --image` with a missing file or one that isn't an image exits 1 (not 2, which is for usage errors), and
50
+ with `--wait --format json` prints the JSON error line.
51
+
52
+ ### Fixed
53
+
54
+ - The web no longer notifies about, or draws, a question a chi REPL is asking: the web can't answer it there.
55
+ - `delegate_result` on a child whose worker died says `worker_gone` instead of waiting for, or reporting, a question
56
+ nobody can answer; `chi send --wait` and `chi answer` no longer report such a question as waiting either.
57
+ - Answers from Splash no longer start with two blank lines (a workaround until Splash drops them itself).
58
+ - An error in chi's work after a turn's answer no longer also reports the answered turn as failed.
59
+ - A Stop while a turn is still starting (chi asking the model server about the model) now ends the turn there: no before-turn hooks run and a due reminder stays due.
60
+ - `recap.model` set to a model id without a host no longer turns the recap off: it asks the host a bare `--model` goes to.
61
+ - AGENT.md is found at the top of the git work tree when chi runs in a subdirectory (one in the current directory still wins).
62
+ - `execute.timeout_sec` in config.yml (or `--execute-timeout-sec`) sets how long an `execute` command may run, like `SAMAGOTCHI_EXECUTE_TIMEOUT_SEC`; it no longer warns as an unknown key.
63
+ - A bundle's `requires_chi` now applies to its hooks too, not only its plugin: on a too-old chi they don't load, with a notice.
64
+ - `chi bundle install` and `chi bundle status` say when a bundle's hooks won't load because chi is older than its `requires_chi`, also for a bundle without a plugin.
65
+ - A model named with a disabled host's prefix (`box:model` where `hosts.box` has `enabled: false`) is refused with "host 'box' is disabled" instead of going to the default host as a model id.
66
+ - A Stop while a turn is still starting no longer uses up the warning about guardrails or plugins that failed to load: the next turn shows it.
67
+ - A plugin or MCP tool call reads the same in logs, rows and hooks' `content` whatever the model format or Ruby version: its arguments as JSON (Qwen calls showed Ruby's Hash#inspect, which changed in Ruby 3.4). A plugin tool returning a Hash or Array gives the model JSON too.
68
+
69
+ Update with `chi update` (bundles: guardrails 0.3.0).
70
+
11
71
  ## [0.12.0] - 2026-10-02
12
72
 
13
73
  ### Added
@@ -669,7 +729,8 @@ and long-lived sessions.
669
729
  - A macOS desktop helper (`chi desktop install`): a "Send to chi" Service and a
670
730
  hotkey panel that send selected text or the clipboard to your sessions.
671
731
 
672
- [Unreleased]: https://github.com/dm1try/samagotchi/compare/v0.12.0...HEAD
732
+ [Unreleased]: https://github.com/dm1try/samagotchi/compare/v0.13.0...HEAD
733
+ [0.13.0]: https://github.com/dm1try/samagotchi/compare/v0.12.0...v0.13.0
673
734
  [0.12.0]: https://github.com/dm1try/samagotchi/compare/v0.11.0...v0.12.0
674
735
  [0.11.0]: https://github.com/dm1try/samagotchi/compare/v0.10.1...v0.11.0
675
736
  [0.10.1]: https://github.com/dm1try/samagotchi/compare/v0.10.0...v0.10.1
data/README.md CHANGED
@@ -14,9 +14,16 @@ command.
14
14
  ## Requirements
15
15
 
16
16
  - Ruby 3.3+
17
- - A model server: [llama.cpp](https://github.com/ggml-org/llama.cpp) `llama-server`
18
- by default; mlx-lm, oMLX and OpenAI-compatible servers also work
19
- (see [Configuration](docs/configuration.md#model-server-transport))
17
+ - A model server: any OpenAI-compatible chat completions server, or
18
+ [llama.cpp](https://github.com/ggml-org/llama.cpp)'s `llama-server` through
19
+ its own API (the native path, and the default)
20
+
21
+ Tested: llama.cpp native (Qwen, Gemma 4), [Splash](https://github.com/incoai/splash)
22
+ over the OpenAI API, and [OpenRouter](https://openrouter.ai) (remote, OpenAI API
23
+ with `api_key_env`). vLLM, LM Studio, Ollama, mlx-lm, oMLX and other
24
+ OpenAI-compatible servers should work over the OpenAI API but are not tested;
25
+ mlx-lm and oMLX also have native transports, see
26
+ [Configuration](docs/configuration.md#model-server-transport).
20
27
 
21
28
  ## Install
22
29
 
@@ -59,7 +66,7 @@ Point chi at your model server; it works out the rest and writes
59
66
 
60
67
  ```sh
61
68
  chi bootstrap 192.168.1.29:8081 # llama.cpp on another machine
62
- chi bootstrap localhost:11434 # Ollama (any OpenAI-compatible server)
69
+ chi bootstrap localhost:11434 # any OpenAI-compatible server
63
70
  chi bootstrap https://openrouter.ai/api/v1 --key-env OPENROUTER_API_KEY
64
71
  chi bootstrap # look on this machine's usual ports
65
72
  ```
@@ -86,9 +93,8 @@ server:
86
93
  port: 8080
87
94
  ```
88
95
 
89
- `server:` is a llama.cpp `llama-server`. For any other OpenAI-compatible
90
- server (vLLM, LM Studio, Ollama, a gateway), name it under `hosts:` with
91
- `api: openai` instead:
96
+ `server:` is a llama.cpp `llama-server`. For an OpenAI-compatible server,
97
+ name it under `hosts:` with `api: openai` instead:
92
98
 
93
99
  ```yaml
94
100
  default:
@@ -145,6 +151,12 @@ stdin plus `-m` puts the stdin above the message as a `>` quote. `chi send --new
145
151
  starts a session with the message instead (it shows in the web at once), and
146
152
  `--wait` blocks and prints the answer.
147
153
 
154
+ Another agent (Claude Code, Codex) can run chi as a sub-agent the same way:
155
+ `chi send --new --wait --format json` returns chi's reply, or the question chi
156
+ stopped on, which the agent answers with `chi answer`. See
157
+ [chi as a sub-agent](docs/sub-agent.md) for a snippet to paste into its
158
+ `CLAUDE.md` / `AGENTS.md`.
159
+
148
160
  ### Send to chi (macOS)
149
161
 
150
162
  `chi desktop install` builds a small native helper: select text in any app →
@@ -173,6 +185,7 @@ once, for the session, for the repo, or for the whole rule in the repo.
173
185
  - [Configuration](docs/configuration.md): `config.yml`, hosts, model server transports, timeouts, retries, logs
174
186
  - [Memory](docs/memory.md): scopes and model-specific overlays
175
187
  - [Sessions](docs/sessions.md): storage, retention, `chi sessions`
188
+ - [chi as a sub-agent](docs/sub-agent.md): `chi send --wait --format json`, `chi answer`, instructions for a parent agent
176
189
  - [Desktop helper](docs/desktop.md): `chi desktop`, the macOS "Send to chi" Service and hotkey
177
190
  - [Guardrails](docs/guardrails.md): allow / ask / deny for tool calls, rules, approvals
178
191
  - [Hooks](docs/hooks.md): plugin hooks and bundle hooks
data/bin/chi CHANGED
@@ -45,6 +45,8 @@ SUBCOMMANDS = {
45
45
  "note" => ["samagotchi/note_command", "NoteCommand"],
46
46
  # a message into sessions as the user's (-m)
47
47
  "send" => ["samagotchi/send_command", "SendCommand"],
48
+ # answer the question a session waits on, then wait (--question, --option)
49
+ "answer" => ["samagotchi/answer_command", "AnswerCommand"],
48
50
  # find a model server and write config.yml (--model, --name)
49
51
  "bootstrap" => ["samagotchi/bootstrap_command", "BootstrapCommand"],
50
52
  # bring an installed chi up to date
@@ -94,6 +96,7 @@ parser = OptionParser.new do |opts|
94
96
  chi sessions <list|stop|archive|unarchive|delete|prune|clean>
95
97
  chi note [--source NAME] [-m TEXT] ID...|--all background context for sessions
96
98
  chi send [-m TEXT] ID...|--new a message into sessions, as if typed there
99
+ chi answer ID --question QID --option N answer a question a session waits on
97
100
  chi bundle <install|upgrade|uninstall|status|diff|list|build>
98
101
  chi desktop <install|upgrade|uninstall|status> macOS "Send to chi" helper
99
102
  chi models [--format json] [TEXT] the models --model takes, from every host
@@ -106,7 +109,7 @@ parser = OptionParser.new do |opts|
106
109
  opts.on("--resume SESSION_ID", "Resume a previous session by its ID (or a unique prefix of it)") { |s| options[:resume] = s }
107
110
  opts.on("--attach SESSION_ID", "Attach to a session's worker, waking one if it has exited; ID or a unique prefix") { |s| options[:attach] = s }
108
111
  opts.on("--[no-]shared", "Run the session in a background worker and attach to it, so `chi web` can share it (the default, config session.shared; with --resume: that session); --no-shared runs a plain in-process REPL") { |v| options[:shared] = v }
109
- opts.on("--model NAME", "Model selector (runtime only, overrides --resume) [alias for --default-model]") { |m| options[:model] = m; cli_overrides["default.model"] = m }
112
+ opts.on("--model NAME", "Model for this run, not saved (overrides --resume's; config default.model) [env SAMAGOTCHI_DEFAULT_MODEL]") { |m| options[:model] = m; cli_overrides["default.model"] = m }
110
113
  opts.on("--profile NAME", Samagotchi::ModelProfile::NAMES,
111
114
  "Prompt profile for every model in this run (#{Samagotchi::ModelProfile::NAMES.join('|')}) [alias for --model-profile]") { |p| cli_overrides["model.profile"] = p }
112
115
  opts.on("--thinking LEVEL", Samagotchi::Thinking::LEVELS.map(&:to_s), "How much the model thinks this run: off|low|medium|high|default (outranks config.yml; " \
@@ -311,7 +314,7 @@ if launch == :attached
311
314
  warn "Error: #{e.message}"
312
315
  exit 1
313
316
  end
314
- exit(ended == :detached ? 0 : 1)
317
+ exit Samagotchi::TerminalUI::AttachLauncher.exit_status(ended)
315
318
  end
316
319
 
317
320
  begin
data/docs/architecture.md CHANGED
@@ -156,7 +156,7 @@ agent logic and can be used without any terminal rendering; the UI is a thin lay
156
156
  #### Using the core
157
157
 
158
158
  ```ruby
159
- engine = Samagotchi::Engine.new(mode: :assist, model_name: "gemma4", memories: [])
159
+ engine = Samagotchi::Engine.new(model_name: "gemma4", memories: [])
160
160
  session = Samagotchi::Session.new_session(mode: "assist", model_name: "gemma4", working_directory: Dir.pwd)
161
161
 
162
162
  engine.run_turn(session, "hello", on_event: nil) # => LLM::ModelResult (`.output`)
@@ -223,7 +223,9 @@ process that already owns the `Engine`); every worker starts it, and it exposes:
223
223
  refused connection is `503 not_live`.
224
224
  - `POST /session/:id/cancel` — cancel the running turn; `202`, or `409` when none runs.
225
225
  - `POST /session/:id/answer` — answer the pending question; `200`, `409` when another client
226
- answered first or it is gone, `400` for an invalid selection.
226
+ answered first or it is gone, `400` for an invalid selection. With `client_id: "cli:answer"`
227
+ (`chi answer`, a parent agent) an allow on an approval beyond the worker's
228
+ `guardrails.parent_approvals` is `403 parent_approval_refused`, the question still open.
227
229
  - `POST /session/:id/question/dismiss` — leave the question unanswered (an approval: denied);
228
230
  `200`, or `409` when it is no longer pending.
229
231
  - `POST /session/:id/command` — a session command (`/model`, `/models`, `!rollback`, `!cmd`,
data/docs/cli.md CHANGED
@@ -17,19 +17,20 @@
17
17
  - `chi web --web-view turn` — draw turns with the turn view (each turn as one block of steps, the running one at the bottom of the history) instead of the default stage view (the running turn pinned above the composer); `?view=stage|turn` on the page URL overrides it (see [Web views](#web-views))
18
18
  - `chi sessions list|stop|archive|unarchive|delete|prune|clean` — manage persisted sessions; `list` shows this git project's, `list --scope=all` every one, a delegated session with `↳ <parent>`, `list --archived` the archived ones too (see [Sessions](sessions.md)). A usage error (an unknown subcommand or flag, a flag missing its value, `stop` or `delete` with no ids, a bad `list --format` or `--scope`) exits 2; an unknown or refused session exits 1
19
19
  - `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))
20
- - `chi send [-m TEXT] [--image PATH]... (ID|PREFIX)...` — send a message to sessions as if typed there: a turn starts (or a running one picks it up); piped stdin goes above `-m` as quoted context, and `--image` attaches images (see [Sessions: Sending a message](sessions.md#sending-a-message)); `--new` starts a session with it instead, and `--wait` prints the answer (`--wait ID` with no message waits for the next reply without sending; see [Starting a session](sessions.md#starting-a-session))
21
- - `chi desktop install|upgrade|uninstall|status` — the macOS "Send to chi" helper: a Service and a ⌃⌥⌘N hotkey that send text to live sessions as context notes (see [Desktop helper](desktop.md))
20
+ - `chi send [-m TEXT] [--image PATH]... (ID|PREFIX)...` — send a message to sessions as if typed there: a turn starts (or a running one picks it up); piped stdin goes above `-m` as quoted context, and `--image` attaches images (see [Sessions: Sending a message](sessions.md#sending-a-message)); `--new` starts a session with it instead, and `--wait` prints the answer (`--wait ID` with no message waits for the next reply without sending; `--format json` prints one JSON object instead; 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))
21
+ - `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`). An approval can be denied, not allowed, unless `guardrails.parent_approvals: once` (a convention, not a security boundary; see [Guardrails](guardrails.md#approvals-from-a-parent-agent))
22
+ - `chi desktop install|upgrade|uninstall|status` — the macOS "Send to chi" helper: a Service and a ⌃⌥⌘N hotkey that send text or images to a session (live, stopped or new) as a message (⏎, a turn runs) or a context note (⌘⏎) (see [Desktop helper](desktop.md))
22
23
  - `chi models [--format text|json] [--timeout S] [TEXT]` — list the models every configured host offers, as the names `--model` takes (see [Listing the models](#listing-the-models))
23
24
  - `chi self` — print version, source dir (checkout or installed gem), config/memory/session paths, model/host and bundles; `chi self --model` prints only the model a new session starts on, an alias resolved to its target (the desktop helper's hint)
24
25
  - `chi update [--dry-run] [--no-gem] [--no-bundles] [--no-desktop]` — update an installed chi: the gem, the system bundle, the shipped bundles you installed and the desktop helper, in one table (see [Updating](#updating))
25
- - `chi bundle install|upgrade|uninstall|status|diff|list|build` — manage memory bundles (see [Bundle hooks](hooks.md#bundle-hooks-unified-workflow-bundle)); `list` shows the installed ones and the ones shipped with chi, which `install <name>` installs; `core` and `dev` are profiles that install a set of them (see [Bundle profiles](memory.md#bundle-profiles-core-and-dev), [Guardrails](guardrails.md), [Plugins](plugins.md#the-btw-bundle), [the mcp bundle](plugins.md#the-mcp-bundle) [the loop-guard bundle](plugins.md#the-loop-guard-bundle), [the check-in bundle](plugins.md#the-check-in-bundle) and [the skills bundle](plugins.md#the-skills-bundle)). A usage error (an unknown subcommand or flag, a missing argument, a bad `build --scope`) exits 2, as for every other command
26
+ - `chi bundle install|upgrade|uninstall|status|diff|list|build` — manage memory bundles (see [Bundle hooks](hooks.md#bundle-hooks-unified-workflow-bundle)); `list` shows the installed ones and the ones shipped with chi, which `install <name>` installs; `core` and `dev` are profiles that install a set of them (see [Bundle profiles](memory.md#bundle-profiles-core-and-dev), [Guardrails](guardrails.md), [Plugins](plugins.md#the-btw-bundle), [the mcp bundle](plugins.md#the-mcp-bundle) [the loop-guard bundle](plugins.md#the-loop-guard-bundle), [the check-in bundle](plugins.md#the-check-in-bundle) and [the skills bundle](plugins.md#the-skills-bundle)). A usage error (an unknown subcommand or flag, a missing argument, a bad `build --scope`) exits 2, as for the other subcommands. Plain `chi` and `chi web` exit 1 on an unknown flag, a flag missing its value or a stray argument
26
27
 
27
28
  ### First setup
28
29
 
29
30
  `chi bootstrap TARGET` names the model server and writes the config for it:
30
31
 
31
32
  ```sh
32
- chi bootstrap 192.168.1.29:8081 # host:port (port 8080 when none)
33
+ chi bootstrap 192.168.1.29:8081 # host:port (an IP or localhost: port 8080 when none; a domain: https 443, then http 80)
33
34
  chi bootstrap https://openrouter.ai/api/v1 --key-env OPENROUTER_API_KEY
34
35
  chi bootstrap # try localhost 8080, 11434, 1234, 8000
35
36
  ```
@@ -179,7 +180,8 @@ controls exit behavior (`--non-interactive`); `--resume` composes with both.
179
180
 
180
181
  Every setting in the config registry (`lib/samagotchi/config.rb`) that exposes a CLI
181
182
  flag also works as `--kebab-case VALUE`, e.g. `--server-host`, `--server-port`,
182
- `--read-truncate-at-bytes`. `chi --help` lists them all.
183
+ `--read-truncate-at-bytes`; an on/off setting is `--[no-]kebab-case` with no value
184
+ (`--context-status`, `--no-context-status`). `chi --help` lists them all.
183
185
 
184
186
  **Which loop runs.** There is no backend flag: the model's host decides. A host with
185
187
  `api: openai` in config.yml is driven through the OpenAI chat API (streamed; a remote
@@ -204,11 +206,22 @@ as an unknown key).
204
206
 
205
207
  Notes:
206
208
 
209
+ - Attached `chi -p …` with stdin not a terminal (a script, an agent's shell)
210
+ leaves when its input ends and the turn is done. Exit status: 0 the turn
211
+ ended, 3 a question or an approval waits for an answer (stderr gets the
212
+ whole question as `chi send --wait` prints it, with the
213
+ `chi answer ID --question QID --option N` command; the worker keeps it
214
+ open, and `chi answer` or the web answers it), 1 the turn failed or the
215
+ worker went away. For a
216
+ script, `chi send --new --wait` is the better entry point: stdout holds the
217
+ answer alone (see [Starting a session](sessions.md#starting-a-session)).
207
218
  - `-p` always feeds **and** runs the prompt; there is no feed-and-edit variant. To
208
219
  prefill (edit, not execute) the first REPL line, use the
209
220
  `SAMAGOTCHI_DEFAULT_INPUT` environment variable instead.
210
- - Prompt history is persisted per session; `--resume` preserves prior messages as
211
- turn context (a `-p` run on a resumed session never clobbers existing history).
221
+ - Prompt history (↑) is one file shared by every session (see [Persistent Prompt
222
+ History](#persistent-prompt-history)); `--resume` preserves the session's prior
223
+ messages as turn context (a `-p` run on a resumed session never clobbers its
224
+ conversation).
212
225
  - Non-interactive runs (`-p` with `--non-interactive`, or bare `--non-interactive`)
213
226
  print only the final result output — no spinner, status line, or REPL.
214
227
 
@@ -357,6 +370,16 @@ file and index line stay as they are; only this session doesn't see it.
357
370
  - The `read` tool on `memories/<name>.md` is not refused (a guardrails rule
358
371
  can protect the path if wanted).
359
372
 
373
+ ### Session commands
374
+
375
+ `/help` lists the commands this session takes, the installed bundles' too, each
376
+ with a line on what it does. `/stats` shows the session's numbers: turns, tool
377
+ calls (by tool, with errors), iterations, tokens in/out summed over every
378
+ request, generation latency, cancellations, retries, context used and window,
379
+ the prompt profile and the model the server says it ran. `/recap` is in
380
+ [Session recap](#session-recap), `/model` and `/models` in [Runtime Model
381
+ Switch](#runtime-model-switch-assist-mode).
382
+
360
383
  ### Typing during a turn
361
384
 
362
385
  The prompt stays open while a turn runs, in an attached terminal and in the plain
@@ -368,7 +391,8 @@ REPL alike:
368
391
  A line that comes after the turn's last step runs as the next turn, and so
369
392
  does one sent after Ctrl-C: it doesn't merge into the turn being cancelled.
370
393
  Reminder turns take merged lines too.
371
- - `/stats` and `/recap` answer at once. Other commands (`!cmd`, `/model`,
394
+ - `/stats` and `/recap` answer at once, and in an attached terminal so do `/help`
395
+ and a plugin's anytime command (`/btw`). Other commands (`!cmd`, `/model`, `/models`,
372
396
  `!rollback`, `/continue`, `/guardrails`) say `busy: wait for the turn to end`
373
397
  and go back into the prompt, so Enter runs them once the turn ends.
374
398
  - A question (`ask_user_question`, a guardrails approval) turns the prompt into
@@ -601,7 +625,7 @@ In interactive assist mode, you can switch the request model without restarting:
601
625
 
602
626
  - `/model <name>`: set a session-scoped model override.
603
627
  - `/model host:model` or `/model host:alias`: qualified host routing (only `:` names a host; `openai/gpt-4o` is a model id). `host:alias` applies the alias; an alias whose target names another host is refused (`alias 'tiny' names host 'box', not 'openrouter'`). Aliases apply once: an alias pointing to another alias sends that name as written.
604
- - `/model --default <name>`: set session model and persist as new default in `config.yml` (also updates `SAMAGOTCHI_DEFAULT_MODEL` for future sessions; supports `host:model` full ref).
628
+ - `/model --default <name>`: set session model and persist as new default (`default.model`) in `config.yml` for future sessions (supports `host:model` full ref). It writes only the file: an exported `SAMAGOTCHI_DEFAULT_MODEL` (or `--model`) still wins over it.
605
629
  - `/model <name> --alias <alias>`: create alias for current effective model (alias value may be bare or `host:model`).
606
630
  - `/model`: show the effective model (and default when diverged: `runtime model: <effective> (default: <default>, profile=<name>, <source>)`, e.g. `profile=qwen36, server (chat_template)`).
607
631
  - `/model clear` (or `default`/`none`/`off`): clear the session override, reverting to the configured default.
@@ -724,7 +748,7 @@ A long, tool-heavy turn says what it has been doing. From the turn's 3rd tool ca
724
748
  a dim row under the activity row tallies its calls, with no model call:
725
749
 
726
750
  ```
727
- 12 tool calls (2 failed) · execute ×7 · read_file ×3 · edit_file ×2 · last: execute command=bundle exec rspec
751
+ 12 tool calls (2 failed) · execute ×7 · read ×3 · edit ×2 · last: execute command=bundle exec rspec
728
752
  ```
729
753
 
730
754
  It lists the top 3 tools by count (ties go to the tool used first), the failed calls
@@ -49,8 +49,9 @@ hosts:
49
49
  # url:, else http://host:port/v1) with its api_key_env; base_url is an OpenAI API
50
50
  # base as given (e.g. http://h:8081/v1). model is a model ref like any other: an
51
51
  # alias is applied, and its host:/the alias's host picks the host when host_ref
52
- # is left out (a model naming another host than host_ref turns recap off with a
53
- # warning). recap: false turns it off.
52
+ # is left out; a model naming no host goes where a bare --model goes (the
53
+ # default host). A model naming another host than host_ref turns recap off with
54
+ # a warning. recap: false turns it off.
54
55
  recap:
55
56
  # host_ref: small-box
56
57
  # model: your-small-model-id
@@ -114,8 +115,9 @@ any per-run `--memory` values (config baseline first, deduped). A per-run
114
115
 
115
116
  ### Environment variables
116
117
 
117
- Every setting has an environment variable: `SAMAGOTCHI_` plus its dotted
118
- name in upper case, with `_` for each dot. `default.model` is
118
+ Every setting has an environment variable (except the ones the table marks
119
+ config.yml only): `SAMAGOTCHI_` plus its dotted name in upper case, with `_`
120
+ for each dot. `default.model` is
119
121
  `SAMAGOTCHI_DEFAULT_MODEL`, `server.read_timeout` is
120
122
  `SAMAGOTCHI_SERVER_READ_TIMEOUT`. Use them to override the file for one run or
121
123
  one shell (`SAMAGOTCHI_LOG_LEVEL=debug chi`); keep lasting choices in the file.
@@ -230,6 +232,18 @@ hosts:
230
232
  api_key_env: BOX_LLAMA_KEY
231
233
  ```
232
234
 
235
+ A host without `port:` (and without `url:`) uses port 8080. `enabled: false`
236
+ turns an entry off without deleting it: chi skips it as if it weren't there
237
+ (not in `chi models`, never the default host; `box:model` then counts as an
238
+ unknown host prefix, see [Llama Model Routing](#llama-model-routing)):
239
+
240
+ ```yaml
241
+ hosts:
242
+ box:
243
+ host: 192.0.2.20
244
+ enabled: false
245
+ ```
246
+
233
247
  For models on that host, chi uses the chat loop (its own OpenAI chat adapter): it
234
248
  takes the OpenAI base (`url:`, else `http://HOST:PORT/v1`) and streams messages plus
235
249
  function schemas from `/v1/chat/completions`; the model's reasoning (`reasoning_content`)
@@ -741,6 +755,10 @@ The helper reads these from its launch file: after editing them run
741
755
 
742
756
  If an AGENT.md file is present in the project root, samagotchi injects its
743
757
  contents into the system prompt under a "Project specific description:" section.
758
+ The project root is the top of the git work tree chi runs in (a linked
759
+ worktree's own checkout), or the current directory outside a repository. An
760
+ AGENT.md in the current directory is read instead when there is one; only one
761
+ file is read.
744
762
 
745
763
  To skip loading AGENT.md, set `skip_agent_md: true` at the top level of
746
764
  `config.yml` (env `SAMAGOTCHI_SKIP_AGENT_MD=true`).
@@ -749,7 +767,8 @@ To skip loading AGENT.md, set `skip_agent_md: true` at the top level of
749
767
 
750
768
  Every setting below takes the three forms described in
751
769
  [Environment variables](#environment-variables): a nested key in
752
- `config.yml`, `SAMAGOTCHI_<DOTTED_NAME>` in the environment and, where the CLI
770
+ `config.yml`, `SAMAGOTCHI_<DOTTED_NAME>` in the environment (not for one
771
+ marked config.yml only) and, where the CLI
753
772
  column says so, a `--kebab-name` flag. The maps (`hosts:`, `models:`,
754
773
  `model_aliases:`, `hooks:`, `guardrails:` rules, `bundles:`, `memories:`) are
755
774
  described in their own sections.
@@ -767,7 +786,7 @@ described in their own sections.
767
786
  | `server.read_timeout` | `600` | yes | Read timeout, seconds. |
768
787
  | `server.first_token_timeout` | 120 remote, off local | | Seconds to the first token; `0` = off. `hosts.<name>.first_token_timeout` wins. |
769
788
  | `recap.enabled` | on | | `false` (or `recap: false`) turns the idle recap off. |
770
- | `recap.model` | session's | yes | Model that writes the recap: an id, alias or `host:model` (the host then picks where to ask). |
789
+ | `recap.model` | session's | yes | Model that writes the recap: an id, alias or `host:model` (the host then picks where to ask; a bare id goes where a bare `--model` goes). |
771
790
  | `recap.host_ref` | session's | yes | A `hosts:` name to ask (`host:` is accepted too, also a host name, not a model ref). |
772
791
  | `recap.base_url` | none | yes | An OpenAI API base to ask instead (`http://h:8081/v1`). |
773
792
  | `recap.inactivity` | `180` | yes | Idle seconds before a recap. |
@@ -785,8 +804,9 @@ described in their own sections.
785
804
  | `image.max_side` | `1568` | | See "Images". |
786
805
  | `image.max_bytes` | `3750000` | | See "Images". |
787
806
  | `image.max_per_request` | `20` | | See "Images". |
788
- | `guardrails.enabled` | `true` | | See [Guardrails](guardrails.md). |
789
- | `guardrails.small_models` | `auto` | | Which models get the `models: small` rules: `auto` (32B or less by the size in the name, an MoE's active size), a list of globs, or `[]`. See [Guardrails](guardrails.md#rules-for-some-models). |
807
+ | `guardrails.enabled` | `true` | | `false`: no rules, and hooks' asks are dropped (a deny still applies). config.yml only: a worker unsets any `SAMAGOTCHI_GUARDRAILS_*` it inherits. See [Guardrails](guardrails.md). |
808
+ | `guardrails.small_models` | `auto` | | Which models get the `models: small` rules: `auto` (32B or less by the size in the name, an MoE's active size), a list of globs, or `[]`. config.yml only. See [Guardrails](guardrails.md#rules-for-some-models). |
809
+ | `guardrails.parent_approvals` | `off` | | What `chi answer` lets a parent agent allow on an approval: `off` (deny only) or `once` ("Allow once", never a wider scope). config.yml only: no environment variable (a parent can still pick the config dir with `XDG_CONFIG_HOME`). A convention for an honest parent, not a security boundary. See [Guardrails](guardrails.md#approvals-from-a-parent-agent). |
790
810
  | `log.file` | state dir | yes | See "Debug Log File". |
791
811
  | `log.disable` | `false` | yes | No file logging. |
792
812
  | `log.level` | `info` | yes | `debug`, `info`, `warn`, `error`. |
@@ -817,6 +837,7 @@ described in their own sections.
817
837
  | `execute.truncate_at_bytes` | `65536` | yes | The same for `execute` output. |
818
838
  | `execute.preview_bytes` | `12288` | yes | |
819
839
  | `execute.telemetry_threshold_pct` | `80` | yes | |
840
+ | `execute.timeout_sec` | `30` | yes | Seconds one `execute` command may run before it is stopped. |
820
841
  | `web.port` | `4567` | `--port` | `chi web`'s port. See [CLI](cli.md). |
821
842
  | `web.host` | `127.0.0.1` | yes | `127.0.0.1`, `::1` or `localhost`; `lan` (this machine's private IPv4 address) or one of its IPv4 addresses also opens `chi web` to the network, with an access token (`chi web --new-token` replaces it). Anything else binds `127.0.0.1` with a warning. See [CLI: chi web on your phone](cli.md#chi-web-on-your-phone). |
822
843
  | `web.markdown` | `false` | yes | Render answers as Markdown in `chi web`. |
data/docs/desktop.md CHANGED
@@ -105,8 +105,9 @@ off until you set it up:
105
105
  `kitty.agents` picks the programs listed (default `claude|codex|gemini|aider|opencode|cursor-agent|amp|goose`, a
106
106
  YAML list works too; `"*"` lists every window, shells too), `kitty.binary` the kitty to run (default
107
107
  `/Applications/kitty.app/Contents/MacOS/kitty`). See [Configuration](configuration.md#desktop-helper-agents-in-kitty).
108
- 3. Run `chi desktop upgrade` (or `chi update`): the helper reads these from its launch file, so **after every edit of
109
- `kitty:`** run it again. No rebuild when only the settings changed.
108
+ 3. Run `chi update` (or `chi desktop upgrade`): the helper reads these from its launch file, so **after every edit of
109
+ `kitty:`** run it again. `chi update` only rewrites the launch file when only the settings changed (no rebuild);
110
+ `chi desktop upgrade` always rebuilds.
110
111
 
111
112
  The helper finds the sockets itself: kitty adds `-<pid>` to a `listen_on` path from kitty.conf (and fills in
112
113
  `{kitty_pid}`), `~` and variables the helper knows are expanded, others (`${KITTY_PID}`) stay as written, as kitty
@@ -188,12 +189,15 @@ using it. `status` prints the baked dirs.
188
189
  The helper uses only these commands, so it could ship on its own later:
189
190
 
190
191
  - `chi sessions list --live --scope=all --format json` and `chi sessions list --limit 20 --scope=all --format json` →
191
- `[{id, short_id, desc, cwd, project, updated_at, live, busy, owner, recap}]` (it uses `id`, `desc`, `cwd`, `busy`, `updated_at`;
192
+ `[{id, short_id, desc, cwd, project, updated_at, live, busy, owner, recap, parent_id, archived, scratch, ctx_pct}]` (it uses `id`, `desc`, `cwd`, `busy`, `updated_at`;
192
193
  "recent" = rows of the second call that aren't live and have `owner: null`; only UUID-shaped ids go on to chi).
193
- - `chi send [-m LINE] ID...` with the text on stdin (or none) and `chi note --source NAME ID...` with the text on
194
- stdin → one line per session on stdout; exit 0 means all sent or queued, 1 means some were refused or failed.
194
+ - `chi send [-m LINE] [--image PATH]... ID...` and `chi send --new --dir DIR [--model NAME] [-m LINE] [--image PATH]...`
195
+ with the text on stdin (or none), and `chi note [--source NAME] ID...` with the text on stdin → one line per session
196
+ on stdout; exit 0 means all sent or queued, 1 means some were refused or failed.
197
+ - `chi self --model` → the model a new session starts on (the panel's hint).
198
+ - `chi models --format json` → the models the hosts offer (the new-session model picker).
195
199
 
196
- Each call is stopped after 10 s. A stopped `chi note` says the note may be partly delivered.
200
+ Each call is stopped after 10 s, a send with images after 30 s. A stopped `chi note` says the note may be partly delivered.
197
201
 
198
202
  ## Troubleshooting
199
203
 
data/docs/guardrails.md CHANGED
@@ -51,11 +51,14 @@ sees these diffs.
51
51
 
52
52
  Who answers:
53
53
 
54
- - REPL (`chi --no-shared`, `-p` without `--non-interactive`): at the `? ` prompt.
55
- - A shared session's worker: any attached TUI or web page. With none attached,
54
+ - REPL (`chi --no-shared`, with or without `-p`): at the `? ` prompt.
55
+ - A shared session's worker (plain `chi` and `chi -p …` while `session.shared` is on, the default): any attached TUI or web page. With none attached,
56
56
  the approval waits (in the session file) and shows on attach.
57
57
  - `-p … --non-interactive`: nobody; the call is denied ("No one to approve it
58
58
  (non-interactive run)").
59
+ - A parent agent running chi as a sub-agent (`chi send --wait` exits 3 with
60
+ the approval): `chi answer` may deny it, never allow it by default. See
61
+ [Approvals from a parent agent](#approvals-from-a-parent-agent).
59
62
 
60
63
  The model gets one line on a deny. A rule's or hook's deny reads
61
64
  `[execute] Error: denied by guardrail (rule git-push, bundle guardrails): git push publishes commits. The user was not asked. Do not retry it or reach the same result another way; ask the user how to proceed.`
@@ -79,6 +82,65 @@ with one warning, and chi starts with no stored approvals (more asks, nothing lo
79
82
  `/guardrails` lists the rules and approvals; `/guardrails revoke N` removes one.
80
83
  The file tools can't write the store.
81
84
 
85
+ ### Approvals from a parent agent
86
+
87
+ When another agent (Claude Code, Codex, a script) runs chi with
88
+ `chi send --wait`, an approval comes back to it as exit 3 with `kind:
89
+ approval`, and `chi answer` answers it. A rule with `verdict: ask` means "ask
90
+ me", so by default a parent may only deny: `--option Deny --text "why"`,
91
+ `--text` alone, or `--dismiss`. An Allow is refused (exit 1, `allowing a tool
92
+ call is up to the user: deny it (--option Deny --text WHY), and tell your
93
+ user`). The question block chi prints for an approval says the same: its
94
+ command is a deny, with no `--option N` and no `chi --attach`.
95
+
96
+ ```yaml
97
+ guardrails:
98
+ parent_approvals: once # default off
99
+ ```
100
+
101
+ `once` lets `chi answer --option "Allow once"` through, picked by the
102
+ option's scope, not its label; the wider scopes (this session, this repo or
103
+ directory, the rule) stay with the web and the terminal. An approval that
104
+ doesn't offer "once" can't be allowed from a parent, and neither can one whose
105
+ offered scopes are missing or don't fit its options: then only Deny goes.
106
+
107
+ Whatever the setting, a parent can't allow a call on chi's own files: a
108
+ `write`, `edit` or `execute` on the config dir (config.yml, installed bundles'
109
+ rules), the hooks dir or the approval store, by its rule (`chi-config`,
110
+ `chi-hooks`, `shell-touches-chi`), its paths or its command. "Allow once" on a
111
+ config.yml rewrite would allow everything from then on, so those stay with the
112
+ user: `chi answer` and the worker refuse the allow with `only the user can
113
+ allow it`.
114
+
115
+ The guardrails settings (`enabled`, `small_models`, `parent_approvals`) are
116
+ read from config.yml only: they have no environment variable, and a worker
117
+ chi starts unsets every `SAMAGOTCHI_GUARDRAILS_*` it would inherit. What a
118
+ parent's environment does choose is the config dir: `XDG_CONFIG_HOME` picks
119
+ which config.yml chi reads, and a worker the parent starts or wakes (`chi
120
+ send` to a stopped session) reads the one the parent's `XDG_CONFIG_HOME`
121
+ points at. chi doesn't record the config dir per session.
122
+
123
+ The worker checks it too. `chi answer` marks its answers as a parent's
124
+ (`client_id: "cli:answer"`), and the worker's Bridge refuses such an allow
125
+ beyond what the *worker's* config.yml permits (`403 parent_approval_refused`;
126
+ `chi answer` exits 1 with the reason), checked against the question pending
127
+ at that moment. Answers from the web and an attached terminal keep every
128
+ scope.
129
+
130
+ A parent may also type its answer into chi itself: a piped `chi --attach ID`
131
+ or `printf '2\n' | chi --no-shared -p …`. So chi treats an answer as a
132
+ parent's, held to the same setting, when its input isn't a terminal or an
133
+ agent marker is set: `CLAUDECODE`, `AI_AGENT`, or `SAMAGOTCHI_PARENT_SESSION`,
134
+ which chi's own `execute` and `task_create` export (the session's id) into the
135
+ commands they run. The markers survive a PTY wrapper (`script`, `expect`). A
136
+ person at a terminal with no marker keeps every scope.
137
+
138
+ This guards an honest but eager parent, not a hostile one: it is not a
139
+ security boundary. The worker's Bridge and the web's answer route on localhost
140
+ take an answer from any local process, which can leave the marker out (or
141
+ post through the web) and get every scope. chi's instructions for parents ([chi as a
142
+ sub-agent](sub-agent.md)) tell them to use `chi answer` only.
143
+
82
144
  ## Protected paths
83
145
 
84
146
  Built in, for `write`, `edit` and `memory_write` (symlinks resolved):
@@ -93,7 +155,7 @@ commands that name them.
93
155
 
94
156
  ```yaml
95
157
  guardrails:
96
- enabled: true # false: no rules, and hooks' asks are dropped (a deny still applies)
158
+ enabled: true # false: no rules, and hooks' asks are dropped (a deny still applies); config.yml only
97
159
  rules:
98
160
  - id: git-push
99
161
  tool: shell # execute + task_create; or a tool name, a glob, or a list
@@ -134,7 +196,7 @@ the rest of chi's config folder still count as outside.
134
196
 
135
197
  To switch off single rules (a bundle's, say) without editing its files, list
136
198
  them under `disable:`. A plain id switches off every rule with that id; `bundle:id`
137
- only that bundle's:
199
+ only that bundle's. A single id works without the list (`disable: git-rebase`):
138
200
 
139
201
  ```yaml
140
202
  guardrails:
@@ -178,7 +240,7 @@ vote for the current model `off for this model`.
178
240
  Rules are read again on the next tool call after `config.yml` or an installed
179
241
  bundle's rules change, so a long-running worker follows edits without a
180
242
  restart. A rule that doesn't parse (an unknown key, a bad regex, no
181
- verdict, a `disable:` that isn't a list of ids) makes chi **deny every tool call** and say why, rather than run
243
+ verdict, a `disable:` that isn't an id or a list of ids) makes chi **deny every tool call** and say why, rather than run
182
244
  without it.
183
245
 
184
246
  ## The guardrails bundle
@@ -191,8 +253,12 @@ installs a default rule set plus a short memory telling the model not to
191
253
  route around a deny. It asks before `git push`, `reset --hard`, `clean -f`,
192
254
  `branch -D`, `rebase`, `filter-branch`/`filter-repo`; `rm -rf` on `/`, `~`,
193
255
  `$HOME` or `..` paths; `curl … | sh` and `base64 -d … | sh`; writes outside the
194
- repo; and shell commands that name chi's config, hooks or guardrails or
195
- `.git/hooks`. It denies writes into `.git/hooks`. The rules are in
256
+ repo; shell commands that name chi's config, hooks or guardrails or
257
+ `.git/hooks`; and answering chi's questions around `chi answer`: `chi --attach`
258
+ or `chi -p` with stdin from a pipe, a here-string or a file
259
+ (`chi-answer-piped`), and `curl`/`wget` to a session's `/answer` route
260
+ (`chi-answer-http`), both once or for the session. `chi answer` itself isn't
261
+ asked about. It denies writes into `.git/hooks`. The rules are in
196
262
  `lib/samagotchi/bundles/guardrails/guardrails/rules.yml`.
197
263
 
198
264
  Small models (`models: small`, see above) get two more asks, in