samagotchi 0.189.0 → 0.190.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 (64) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +51 -1
  3. data/docs/architecture.md +4 -1
  4. data/docs/cli.md +17 -6
  5. data/docs/configuration.md +1 -0
  6. data/docs/context.md +1 -1
  7. data/docs/guardrails.md +25 -9
  8. data/docs/internals/attached-context.md +4 -1
  9. data/docs/internals/engine.md +18 -2
  10. data/docs/pages.md +3 -2
  11. data/docs/scheduling.md +106 -6
  12. data/docs/sessions.md +3 -3
  13. data/docs/sub-agent.md +1 -1
  14. data/lib/samagotchi/bundles/guardrails/guardrails/rules.yml +15 -0
  15. data/lib/samagotchi/bundles/guardrails/manifest.yml +2 -2
  16. data/lib/samagotchi/bundles/known-names/manifest.yml +2 -2
  17. data/lib/samagotchi/bundles/known-names/plugin.rb +17 -1
  18. data/lib/samagotchi/bundles/schedules/manifest.yml +4 -4
  19. data/lib/samagotchi/bundles/schedules/scripts/schedules.rb +13 -3
  20. data/lib/samagotchi/bundles/system/manifest.yml +1 -1
  21. data/lib/samagotchi/config.rb +2 -0
  22. data/lib/samagotchi/context_fetch.rb +9 -3
  23. data/lib/samagotchi/engine/models.rb +6 -4
  24. data/lib/samagotchi/engine/turn_end.rb +20 -2
  25. data/lib/samagotchi/engine.rb +5 -1
  26. data/lib/samagotchi/failure_line.rb +43 -0
  27. data/lib/samagotchi/guardrail_wiring.rb +3 -1
  28. data/lib/samagotchi/guardrails/chi_dirs.rb +20 -5
  29. data/lib/samagotchi/guardrails/parent_approvals.rb +1 -1
  30. data/lib/samagotchi/guardrails/protected_paths.rb +8 -4
  31. data/lib/samagotchi/guardrails/shell_paths.rb +16 -2
  32. data/lib/samagotchi/guardrails/targets.rb +1 -1
  33. data/lib/samagotchi/guardrails/verdict.rb +5 -3
  34. data/lib/samagotchi/image_store.rb +4 -0
  35. data/lib/samagotchi/last_turn.rb +2 -1
  36. data/lib/samagotchi/llm/utf8_scrub.rb +26 -0
  37. data/lib/samagotchi/llm_context_view.rb +6 -0
  38. data/lib/samagotchi/model_profile.rb +4 -1
  39. data/lib/samagotchi/pages/runtime.rb +4 -3
  40. data/lib/samagotchi/reply_wait.rb +1 -1
  41. data/lib/samagotchi/schedule_command.rb +99 -5
  42. data/lib/samagotchi/schedule_display.rb +21 -5
  43. data/lib/samagotchi/schedules/condition_part.rb +312 -0
  44. data/lib/samagotchi/schedules/edit_part.rb +27 -3
  45. data/lib/samagotchi/schedules/notices_part.rb +8 -2
  46. data/lib/samagotchi/schedules/protection_part.rb +10 -0
  47. data/lib/samagotchi/schedules/prune_part.rb +90 -0
  48. data/lib/samagotchi/schedules.rb +68 -82
  49. data/lib/samagotchi/session_access/local.rb +6 -4
  50. data/lib/samagotchi/session_chain/links.rb +68 -9
  51. data/lib/samagotchi/session_continue.rb +7 -2
  52. data/lib/samagotchi/session_inbox_delivery.rb +2 -1
  53. data/lib/samagotchi/system_one/self_protect.rb +4 -2
  54. data/lib/samagotchi/tools/cancel_schedule.rb +27 -2
  55. data/lib/samagotchi/tools/execute.rb +5 -1
  56. data/lib/samagotchi/tools/list_schedules.rb +1 -0
  57. data/lib/samagotchi/tools/task_runtime.rb +6 -0
  58. data/lib/samagotchi/turn_endings.rb +14 -2
  59. data/lib/samagotchi/turn_flow.rb +2 -1
  60. data/lib/samagotchi/version.rb +1 -1
  61. data/lib/samagotchi/web/public/stream_handlers.js +8 -0
  62. data/lib/samagotchi/web/session_hub.rb +16 -5
  63. data/lib/samagotchi/worker.rb +6 -4
  64. metadata +4 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c8e7fa5a6ecf59f94f137ab4b95a76d129a6e2edab94204aab625747a7ffc3d4
4
- data.tar.gz: 61480eb9e2af49ec87cd51eafaf1a4bd4b3fe0202ff464c126fb971203bd68bf
3
+ metadata.gz: 77aeed37eaf5c2f38aa322093568ec409ed14b7da71edd1f07ed84f1b0a5895b
4
+ data.tar.gz: 0c393097b0e2a9a070bec87976e6e1ab34d81e3bb94c93dbf23e415cff348a5e
5
5
  SHA512:
6
- metadata.gz: ddd533fc0c541fe9be37a437180bfbdaa62322b9de85b028da971dc2d7a69b6440cf8548110705eb9d91ce9d176544e348fb5d559fe538343eb907c3f7dbd47f
7
- data.tar.gz: df7ea7ed667b4e5784fc0def947532666374ccf1f8d502a5eaf7d3975f76d4bda79f6b6a4f7b9267436b8dea6096cb44335062bdba285def2623f675f82acb79
6
+ metadata.gz: 26f9472dbc97b6cdda56c4fcac3446275b8f97d8677b2bc6f753f621d590f0ec56057a01dff03ae5472110868369fcb0dd33c285e871b3216424285fa32a8da2
7
+ data.tar.gz: d86525428d4e6a6fcc78cbb08ce6f695766d4b849b7f01fc9b3e9bf33526f29d40a1766bcc2a417ddb7b6622a80255fe234c359f2f2ac189a6f68f9c472d9bd4
data/CHANGELOG.md CHANGED
@@ -8,6 +8,54 @@ and commands may change between minor versions. How releases are made:
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [0.190.1] - 2026-11-26
12
+
13
+ ### Fixed
14
+
15
+ - known-names no longer blocks a folder or ticket id that differs from a protected name only in its digits
16
+ (`~/projects/ISSUE-8932` while in a repo named `ISSUE-8926`); a letter typo next to the digits is still caught
17
+ (known-names 0.2.2).
18
+ - A pruned schedule's first session keeps working as the chain's address: once `keep_links` pruning had deleted
19
+ the session after it, `chi send <its id>` from another agent was refused as archived, a person's send brought
20
+ that old session back beside the chain, and `last:<its id>` named it instead of the newest link. These now reach
21
+ the schedule's newest link, and continuing that first session directly is refused, naming the newest link.
22
+ - Schedule pruning no longer stops for good after its first deletion; a chain stays at its `keep_links` length.
23
+
24
+ Update with `chi update` (known-names 0.2.2).
25
+
26
+ ## [0.190.0] - 2026-11-26
27
+
28
+ ### Added
29
+
30
+ - `chi schedule add|edit --if CMD` (and `edit --no-if`): the tick runs CMD in the session's folder before a firing;
31
+ exit 0 fires as before, any other exit is a quiet "not needed" that uses no budget; a condition that can't run or
32
+ times out counts as a failure (`schedule.condition_timeout_seconds`, default 30). Only from your own terminal:
33
+ chi's tools can't set it, and every chi that ticks must be this one or newer (an older one leaves such a schedule
34
+ alone) ([docs/scheduling.md](docs/scheduling.md#conditions---if)).
35
+
36
+ ### Changed
37
+
38
+ - `schedules.json` is a protected path for chi's file tools, and a shell command naming it asks (shell-touches-chi).
39
+ With the guardrails bundle (0.9.4), `chi schedule add|edit … --if` from chi's shell asks you every time
40
+ (`chi-schedule-if`: no parent agent or System 1 may allow it). Run `chi update`.
41
+ - The schedules bundle (0.1.1): the Schedules page has an If column (a schedule's `--if` command).
42
+
43
+ ### Fixed
44
+
45
+ - A finished background task whose output had non-ASCII text (accents, dashes, ✓) no longer fails its wake turn;
46
+ `task_wait` and a handed-over `execute` show such output as is.
47
+ - A turn that fails because of chi itself (not the model's host) says so on the web, in the terminal and on
48
+ `-p --non-interactive`'s stderr: "turn failed: chi error: <message> (<Class>); details in samagotchi.log", where
49
+ the log has where it failed. Its `error_kind` (`chi send --wait --format json`, a schedule's last result) is
50
+ `chi_error`. A turn that fails before it begins (its session can't be saved) now shows that line too, instead of
51
+ nothing.
52
+ - Raw bytes in a conversation (a tool's output that isn't valid UTF-8) no longer fail the next turn on any model
53
+ host; such text goes to the model with the bad bytes replaced. `execute` returns a command's output as valid UTF-8.
54
+ - `chi schedule list` says how many entries of `schedules.json` can't be read and how to remove one, instead of
55
+ hiding them; chi's `cancel_schedule` tool can remove such an entry by its exact id.
56
+
57
+ Update with `chi update` (guardrails 0.9.4, schedules 0.1.1).
58
+
11
59
  ## [0.189.0] - 2026-11-25
12
60
 
13
61
  ### Added
@@ -6918,7 +6966,9 @@ and long-lived sessions.
6918
6966
  - A macOS desktop helper (`chi desktop install`): a "Send to chi" Service and a
6919
6967
  hotkey panel that send selected text or the clipboard to your sessions.
6920
6968
 
6921
- [Unreleased]: https://github.com/dm1try/samagotchi/compare/v0.189.0...HEAD
6969
+ [Unreleased]: https://github.com/dm1try/samagotchi/compare/v0.190.1...HEAD
6970
+ [0.190.1]: https://github.com/dm1try/samagotchi/compare/v0.190.0...v0.190.1
6971
+ [0.190.0]: https://github.com/dm1try/samagotchi/compare/v0.189.0...v0.190.0
6922
6972
  [0.189.0]: https://github.com/dm1try/samagotchi/compare/v0.188.0...v0.189.0
6923
6973
  [0.188.0]: https://github.com/dm1try/samagotchi/compare/v0.187.0...v0.188.0
6924
6974
  [0.187.0]: https://github.com/dm1try/samagotchi/compare/v0.186.0...v0.187.0
data/docs/architecture.md CHANGED
@@ -649,7 +649,10 @@ credit held by in-flight requests, retried after 20 s), `OutOfCredits` (any othe
649
649
  402), `ServerError`, `AuthError`, `BadRequest` (`context_overflow?`) or `ProtocolError`. Engine keeps the turn's
650
650
  conversation (the prompt plus completed tool iterations) and emits
651
651
  `:turn_failed` with `error_kind:`, `retryable:`, `host:` and a one-line
652
- `summary:`, which the attached TUI, a one-shot's stderr and the web show.
652
+ `summary:`, which the attached TUI, a one-shot's stderr and the web show. Any other error
653
+ is chi's own (`TurnEndings.chi_error?`): `error_kind: chi_error` and the summary "chi error:
654
+ <message> (<Class>); details in samagotchi.log", unless it tells the user what to change
655
+ (`UserError`: an image the turn can't use, no model), whose message is the line.
653
656
 
654
657
  **Usage and models.** A turn's token counts are `SessionMetrics`', read from the
655
658
  stream events (server counts, else a chars/4 estimate). Model lists are `LLM::ModelInfo`
data/docs/cli.md CHANGED
@@ -466,6 +466,8 @@ chi schedule enable 4b7e9a
466
466
  chi schedule cancel 4b7e9a # delete it (by id, a unique prefix, or its title)
467
467
  chi schedule edit 4b7e9a --weekday 2 --time 08:30 # change it in place: only the flags given
468
468
  chi schedule edit "Monday audit" -m "Audit the open PRs and the queue" --max-skips 24
469
+ chi schedule add --session 3f9a1c2e --every 5m -m "Check in" --if "$HOME/.local/bin/anything-to-do"
470
+ chi schedule edit 4b7e9a --no-if # fire at every occurrence again
469
471
  ```
470
472
 
471
473
  Every `list` row names its schedule: the `--title` it was given, or, when it has
@@ -475,7 +477,10 @@ widest name among the rows printed, so the columns after it line up. `--format j
475
477
  carries `title` as it is stored (`null` with no title) and the whole `prompt`, and the
476
478
  quoted stand-in only as `name`; with it `state` (`on`, `firing`, `off`) and `off_reason`
477
479
  ([scheduling.md](scheduling.md#skip-not-failure)). The `list_schedules` tool names a
478
- schedule the same way.
480
+ schedule the same way. An entry of `schedules.json` that doesn't read isn't a row: one line
481
+ after the rows counts them and names the first five ids, "2 schedules can't be read (e1f2a3b4,
482
+ …): chi schedule cancel ID removes one" (one with no id: "fix or remove it in schedules.json");
483
+ under `--format json` that line goes to stderr and stdout stays the JSON list.
479
484
 
480
485
  `add` needs a target (`--session ID`, or `--continues ID` for the same session)
481
486
  and exactly one recurrence kind — `--every 45m|2h|1d`, `--weekday 1..7` with
@@ -483,13 +488,19 @@ and exactly one recurrence kind — `--every 45m|2h|1d`, `--weekday 1..7` with
483
488
  `--title` names it, `--mode chain|same` picks the mode (chain by default),
484
489
  `--catch-up once|none` what an overdue entry does, `--keep-links N` how many chain
485
490
  links stay behind the head (`0` keeps all), and `--max-failures` / `--max-skips`
486
- how many consecutive failures or busy targets disable it. A blank or over-16-KiB
487
- prompt, two recurrence kinds, a `scratch` target and a `--weekday` without
488
- `--time` are all refused with exit 2.
491
+ how many consecutive failures or busy targets disable it. `--if CMD` gates each
492
+ firing on a shell command run in the session's folder first: exit 0 fires, 1 to 125 is
493
+ a quiet "not needed" (the next occurrence, nothing counted), anything else a failure
494
+ ([Conditions](scheduling.md#conditions---if)); it is yours alone: inside a chi session
495
+ `--if` and `--no-if` exit 2, and the line after `add`'s says every ticker must be newer
496
+ than 0.189.0. A blank or over-16-KiB
497
+ prompt, two recurrence kinds, a `scratch` target, a `--weekday` without
498
+ `--time`, and `--if` on a `--date` one-off (or a blank, multi-line or over-1-KiB
499
+ CMD) are all refused with exit 2.
489
500
 
490
501
  `edit ID` changes a schedule in place and prints its updated `list` row: `--title`,
491
502
  `-m|--prompt`, one whole recurrence (as `add`'s: `--time` alone is refused),
492
- `--catch-up` and the three budgets, checked as `add` checks them; only the flags given
503
+ `--catch-up`, the three budgets and `--if CMD` / `--no-if` (not both), checked as `add` checks them; only the flags given
493
504
  change, and the skip and failure counters, `enabled` and the history stay (it adds one
494
505
  `edited` row naming the fields). The session and the mode don't change: `--session`,
495
506
  `--continues` and `--mode` are refused ("cancel it and add a new one"). A new
@@ -502,7 +513,7 @@ say what another schedule of the chain says (its new title, or its new prompt an
502
513
  recurrence); a missing id exits 1.
503
514
 
504
515
  `tick` prints one line per entry it touched (`fired`, `skipped`, `missed`,
505
- `failed`, or `would fire` under `--dry-run`), with the reason; nothing due prints
516
+ `failed`, `not-needed` for a condition that said no, or `would fire` under `--dry-run`), with the reason; nothing due prints
506
517
  `no schedules due`, and a tick that finds the lock held by another prints `no
507
518
  schedules due (another tick holds the lock)` — both exit 0, so a crontab line
508
519
  that runs every five minutes is quiet. `run-now`, `enable`, `disable` and `cancel`
@@ -2323,6 +2323,7 @@ column says so, a `--kebab-name` flag. The maps (`hosts:`, `models:`,
2323
2323
  | `schedule.default_catch_up` | `once` | | An overdue schedule fires once at the next tick (`once`) or moves to its next occurrence (`none`). |
2324
2324
  | `schedule.max_per_session` | `10` | | Enabled schedules one chain may hold. `schedule_task` (and `chi schedule add`) refuse past it, so a routine that re-schedules itself cannot pile up entries. |
2325
2325
  | `schedule.max_total` | `50` | | Enabled schedules this machine may hold, across every chain. |
2326
+ | `schedule.condition_timeout_seconds` | `30` | | How long a schedule's condition (`chi schedule add --if CMD`) may run, 1 to 300 seconds; one that runs longer is killed and counts as a failure. See [Conditions](scheduling.md#conditions---if). |
2326
2327
  | `image.max_side` | `1568` | | See "Images". |
2327
2328
  | `image.max_bytes` | `3750000` | | See "Images". |
2328
2329
  | `image.max_per_request` | `20` | | See "Images". |
data/docs/context.md CHANGED
@@ -334,7 +334,7 @@ link's id (`chi context push` exits 1; chi web answers 410
334
334
  chi context push: 3f2a9c1e was continued as 7b1d…: notes stays with the session it was attached to; attach it to 7b1d… (or pair again with 7b1d…) and push there
335
335
  ```
336
336
 
337
- An archived session that nobody continued takes pushes as before.
337
+ An archived session that nobody continued takes pushes as before; a schedule's anchor whose successor a prune deleted counts as continued by the schedule's head ([sessions.md](sessions.md), *Session chains* → Which link).
338
338
 
339
339
  ### Peers and a continue
340
340
 
data/docs/guardrails.md CHANGED
@@ -6,7 +6,7 @@ loops (native and chat hosts). The verdict is **allow**, **ask** or
6
6
  voter. Of two asks the first one names the rule, except a rule only the
7
7
  user may allow (`chi-config`, `chi-home`, `chi-shim`, `chi-hooks`, `shell-touches-chi`,
8
8
  `chi-context-cmd`, `chi-broadcast`, `prompt-memory-write`, `model-overlay-write`,
9
- `chi-answer-piped`, `chi-answer-http`, `bundle-secrets-shell`): it takes over, and only the
9
+ `chi-answer-piped`, `chi-answer-http`, `bundle-secrets-shell`, `chi-schedule-if`): it takes over, and only the
10
10
  scopes both asks offer are offered. When a second YAML rule with another id asks about the same call (`git merge y && git push`), no
11
11
  [rule grant](#approvals) answers it and none is offered.
12
12
 
@@ -253,7 +253,8 @@ the user's alone (`user_only`): `chi answer` and the worker refuse the allow
253
253
  with `only the user can allow it`. The same holds for the guardrails bundle's
254
254
  other user-only rules (`chi-context-cmd`, `chi-broadcast`,
255
255
  `prompt-memory-write`, `model-overlay-write`, and `chi-answer-piped` /
256
- `chi-answer-http`, which answer a grandchild's question as the user), and core's
256
+ `chi-answer-http`, which answer a grandchild's question as the user,
257
+ `chi-schedule-if`, a schedule's condition the tick runs unattended), and core's
257
258
  `bundle-secrets-shell` (a command naming a bundle's secrets).
258
259
 
259
260
  `child-boundary` isn't one of them: an ask before a delegate child acts outside
@@ -354,8 +355,11 @@ with `writes: true` (symlinks resolved; see
354
355
  [attached context](context.md) sources (`<state dir>/context/`: a
355
356
  source's command runs later, outside the gate; `chi context` changes them),
356
357
  a peer's [mailbox](peers.md) (`<state dir>/mailbox/`: chi's own tools never
357
- write a peer's messages or pairing, `chi-mailbox`; `chi peer` does)
358
- and [System 1's saved runs](system-one.md) (`<state dir>/system_one/`);
358
+ write a peer's messages or pairing, `chi-mailbox`; `chi peer` does),
359
+ [System 1's saved runs](system-one.md) (`<state dir>/system_one/`)
360
+ and the [schedules](scheduling.md) file (`<state dir>/schedules.json`,
361
+ `chi-schedules`: a schedule's prompt and its [condition](scheduling.md#conditions---if)
362
+ run unattended, the condition outside the guardrails; `chi schedule` changes it);
359
363
  - ask (once or for the session): `config.yml`, `home.json` (the [chi home](configuration.md#the-chi-home): the Ruby every chi launch boots), the chi shim (`$XDG_STATE_HOME/samagotchi/bin/chi`, the `chi` every tool runs: `chi-shim`) and the plain hooks dir.
360
364
 
361
365
  `execute` can still reach them; the guardrails bundle asks about shell
@@ -1231,8 +1235,9 @@ ask](#approvals) on the call, is judged and logged but always goes to the user):
1231
1235
  or a YAML list, read like `guardrails.small_models`. Nothing is auto-allowed
1232
1236
  by default: the user names the rules they want;
1233
1237
  3. the rule is not one of the three that let an agent answer chi's own
1234
- questions — `chi-answer-piped`, `chi-answer-http`, `chi-broadcast` — which
1235
- are never auto-allowed, even when listed
1238
+ questions — `chi-answer-piped`, `chi-answer-http`, `chi-broadcast` — nor
1239
+ `chi-schedule-if` (a schedule's condition, which the tick runs unattended,
1240
+ is the owner's): these are never auto-allowed, even when listed
1236
1241
  (`SystemOne::SelfProtect::NEVER_AUTO`);
1237
1242
  4. the call does not change chi itself (`SystemOne::SelfProtect.refuse?`), by
1238
1243
  its own set of chi's dirs (`Guardrails::ChiDirs.self_protect`: the dirs whose
@@ -1371,9 +1376,16 @@ route around a deny. In both modes it asks before `git push`, `reset --hard`,
1371
1376
  `clean -f`, `branch -D`, `filter-branch`/`filter-repo`; `rm -rf` on `/`, `~`,
1372
1377
  `$HOME` or `..` paths, unless every target is inside a tmp folder; `curl … |
1373
1378
  sh` and `base64 -d … | sh`; shell commands that name a path in chi's config,
1374
- hooks, approvals, bundles or attached context sources, or a `.git/hooks`
1379
+ hooks, approvals, bundles, attached context sources, the peer mailbox,
1380
+ System 1's saved runs or `schedules.json`, or chi's state dir itself (a
1381
+ `cp`/`mv`/`rsync` naming only the dir lands a file there), or a `.git/hooks`
1375
1382
  (`shell-touches-chi`, `touches: chi_dirs`), unless they only read
1376
- (`skip_read_only`); `chi context add … --cmd` (`chi-context-cmd`, once at a
1383
+ (`skip_read_only`); `chi schedule add|edit … --if CMD` and `--no-if`
1384
+ (`chi-schedule-if`, once at a time and only by the user, never System 1: the
1385
+ tick runs CMD later, unattended and outside the guardrails, and `chi schedule`
1386
+ refuses the flag inside a session; the rule also sees `chi --remote NAME
1387
+ schedule`, quoted words, continuations and `xargs chi schedule add|edit`; see
1388
+ [Conditions](scheduling.md#conditions---if)); `chi context add … --cmd` (`chi-context-cmd`, once at a
1377
1389
  time: a command chi will run every few minutes outside the guardrails; see
1378
1390
  [Attached context](context.md#safety); the rule also sees `chi --remote NAME context add`, and a remote's `context push`
1379
1391
  reaches its session with the trust of its chi web token, as your own `chi context push` does there); `chi broadcast` (`chi-broadcast`,
@@ -1435,7 +1447,11 @@ edit of a known name shorter than 10 characters, or two edits of a longer
1435
1447
  one, is a near miss. Tokens and names shorter than `min_length` (6) are
1436
1448
  skipped, as is a token that equals another known name. A token with a shell
1437
1449
  glob (`*?[]{}`, as in `ls -d samagotchi*`) is not checked. In `~name` (that
1438
- user's home folder) the name after `~` is what is checked.
1450
+ user's home folder) the name after `~` is what is checked. For a name with a
1451
+ digit, a token that differs from it only in digits (`ISSUE-8932` next to a
1452
+ repo named `ISSUE-8926`, `run-3` for `run-2`) is a numbered sibling, not a
1453
+ near miss. A name without digits still catches a digit typo (`j0hndoe` or
1454
+ `johndoe2` for `johndoe`).
1439
1455
 
1440
1456
  By default (`mode: reject`) the call is denied with advice in place of the
1441
1457
  usual tail, so the model retries it corrected:
@@ -87,7 +87,10 @@ cancel kills the group), cwd the session's folder (a project source: the project
87
87
  the arbiter between workers and the CLI: the loser gets `:busy`, and `fresh_within` is checked again under the lock,
88
88
  so a project source shared by several workers is fetched once per interval. The `Outcome` status says what happened
89
89
  (`:new :same :error :busy :fresh :cancelled :gone`); a cancelled fetch records nothing (a leaving worker isn't the
90
- source failing). `chi context refresh` and the candidates' first fetch use the same entry.
90
+ source failing). `chi context refresh` and the candidates' first fetch use the same entry. `ContextFetch.run_command`
91
+ is also a schedule condition's runner (`Schedules::ConditionPart`, [scheduling.md](../scheduling.md#conditions---if)):
92
+ its `Run#status` is the command's `Process::Status` only when it ended on its own within the cap (nil after a
93
+ timeout, the cap or a cancel), so a TERM trap's exit 0 is never read as a pass.
91
94
 
92
95
  A pushed source has no poller. `chi context push` writes the snapshot from its own process; the worker finds it
93
96
  through `ContextAbsorber#store_signature` (names and mtimes of the files in the two folders, `subscriptions.json`
@@ -115,7 +115,19 @@ StandardError in run_turn:
115
115
  → else end_turn(turn, "failed", save: true) (a failing save logged, turn_end_save_failed): failed_messages keeps
116
116
  the loop's partial conversation (both loops LLM::FailedTurn.attach it), else turn.messages, with
117
117
  TurnNote.failed at the tail; :turn_failed {error_class, message, duration_ms, + error_kind, retryable, host,
118
- summary for a provider error}; re-raised
118
+ summary for a provider error; + error_kind: :chi_error, summary for chi's own}; re-raised
119
+ The line (FailureLine.for, via TurnEndings.failure_line: one builder for the event's summary, the note, the reload's line and the
120
+ one-shot's stderr): a provider error's summary; a UserError's message (ImageStore::Error,
121
+ ModelProfile::MissingModel: the user's to change, no error_kind); else chi's own (TurnEndings.chi_error?):
122
+ "chi error: <message's first line> (<Class>); details in samagotchi.log", logged ERROR turn chi_error with its
123
+ backtrace (Log.exception). retryable stays unset for it; a parent's wait, ParentReport and a schedule's last
124
+ result read error_kind "chi_error" as any other kind.
125
+
126
+ Before the Engine's turn (Worker#run_engine_turn: begin_turn, the checkpoint, the running save):
127
+ → session still running, no :turn_failed sent: Engine#fail_turn_not_begun sets it idle, records last_turn and
128
+ emits :turn_failed from TurnEndings#failed_event (the same line), with no :turn_started before it; logged
129
+ ERROR worker turn_not_begun with its backtrace. The web draws its line only when no turn runs
130
+ (stream_handlers.js turn_failed); the Bridge's TurnAccumulator, with no turn, keeps nothing of it
119
131
 
120
132
  Interrupt (Ctrl-C; a one-shot only, a worker traps INT):
121
133
  → turn.ended: re-raised only
@@ -221,6 +233,10 @@ loop:
221
233
  one is logged `tool_direct_deferred`.
222
234
  - The conversation goes out in the OpenAI wire format (`wire_messages`); `AnthropicMessages` translates it again
223
235
  (`LLM::AnthropicWire`). Each call's result is its own tool message, paired by `tool_call_id`.
236
+ - Raw bytes in the history (a BINARY or invalid UTF-8 String) never fail a request: every loop's request starts at
237
+ `LLMContextView#messages` (`wire_messages`, the native prompt and its warm-up), which reads such an entry as UTF-8
238
+ and scrubs it first (`LLM::Utf8Scrub.messages`; a copy, the saved entry stays; the same Array when none needs it),
239
+ before any regex pass (`Steer.wire_text`'s forged-frame quoting). The body's own scrub (`Utf8Scrub.call`) stays.
224
240
  - The first system message carries `cache_split:` (`SystemPrompt#stable_length`); where the adapters put cache
225
241
  breakpoints is prompt-caching.md's and anthropic.md's.
226
242
  - **Reasoning sent back** (`reasoning_content`) follows `TurnSettings#reasoning_history` (`ReasoningHistory.resolve`,
@@ -531,7 +547,7 @@ Turn events (the main ones; `events.rb` keeps the shared sets):
531
547
  | `:guardrail_warning` | a guardrails line | `{message}` |
532
548
  | `:turn_completed` | normal end | `{turn_id, result, turn_summary, display_pending}`, plus `verify`, `verdict`, `revises` when there are; the SSE frame omits `result` |
533
549
  | `:turn_canceled` | Stop, hook stop, Ctrl-C, signal | `{turn_id, cancellation_reason, cancelled_by?, duration_ms}` |
534
- | `:turn_failed` | an error | `{turn_id, error_class, message, duration_ms, error_kind?, retryable?, host?, summary?}` |
550
+ | `:turn_failed` | an error (also before a turn began: `Engine#fail_turn_not_begun`, no `:turn_started`) | `{turn_id, error_class, message, duration_ms, error_kind?, retryable?, host?, summary?}` |
535
551
  | `:answer_display` | after the after_turn hooks (observers only) | `{display, refs?}` |
536
552
 
537
553
  ### Origins and authors
data/docs/pages.md CHANGED
@@ -88,8 +88,9 @@ it. On an older chi `runtime` is a `NameError`, and the run fails with it (the l
88
88
  of its prompt in quotes), `title`, `mode`, `prompt`, `recurrence_words`, `next_due`, `last_fired`, `last_result`,
89
89
  `enabled`, `state` (`on`, `firing` or `off`), `off_reason` (`owner`, `skips`, `failures`, `done`, `missed` or
90
90
  `off`; nil unless off), `skips`, `max_skips`, `failures`, `max_failures`, `skip_window`, `anchor`, `head`,
91
- `created_at`, and `history`: its runs, oldest first, each with `at`, `status`, `detail` and `session_id`. Times are
92
- ISO 8601 UTC strings, nil when there is none.
91
+ `created_at`, `history`: its runs, oldest first, each with `at`, `status`, `detail` and `session_id`, and
92
+ `condition`: its `--if CMD` as `{"cmd", "by", "set_at"}`, nil for none ([Conditions](scheduling.md#conditions---if)).
93
+ Times are ISO 8601 UTC strings, nil when there is none.
93
94
  - `runtime.schedules.rows`: every schedule as a table row (all but `history`): `ui.table runtime.schedules.rows,
94
95
  columns: { "name" => "Name", "state" => "State" }`.
95
96
  - `.warning`: `chi schedule list`'s warning when nothing ticks the schedules, else nil; `.unreadable_ids`: the id of
data/docs/scheduling.md CHANGED
@@ -19,8 +19,9 @@ against, never rewritten: the chain's root and the id you remember), `head` (the
19
19
  chain's current link, re-anchored after every firing: the link a chain continue
20
20
  made, or the session a `same` turn was queued into), `mode`,
21
21
  `prompt`, `recurrence`, `catch_up`, `keep_links`, `max_failures`, `max_skips`,
22
- `next_due` (UTC ISO), `last_fired`, `last_result`, `failures`, `skips` and
23
- `enabled`.
22
+ `next_due` (UTC ISO), `last_fired`, `last_result`, `failures`, `skips`,
23
+ `enabled` and `condition` (your `--if CMD`, [Conditions](#conditions---if); `null` for
24
+ none).
24
25
 
25
26
  <a id="reminder-vs-schedule"></a>## Reminder or schedule?
26
27
 
@@ -239,7 +240,8 @@ disabled: Heartbeat", "skipped 12 times: <the last reason>" and the `chi schedul
239
240
  enable <id>` that turns it back on; a tap opens its session. The tick leaves a notice
240
241
  on the entry in `schedules.json` (`disabled_notice`) and a running chi web pushes it:
241
242
  right after its own tick, and within `schedule.tick_interval_minutes` for another
242
- ticker's, with `schedule.auto_tick` off too. Only chi web pushes, so with no chi web
243
+ ticker's, with `schedule.auto_tick` off too (a look that finds a tick holding the lock
244
+ tries again at the next scan, not an interval later). Only chi web pushes, so with no chi web
243
245
  running the notice waits for one; a notice more than a day old, or one whose schedule
244
246
  you enabled again, is dropped unpushed, and `chi schedule enable` clears it. It shows
245
247
  even with a chi web page in front and waits a day for a phone that is offline. Two chi
@@ -266,7 +268,10 @@ and recurrence, or the same title — is refused too, naming its id, so a routin
266
268
  tells each of its links to "make sure the Monday audit is scheduled" cannot multiply
267
269
  itself. `schedule_task`, `list_schedules` and `cancel_schedule` see only schedules of
268
270
  the calling session's chain (`all: true` steps outside it); `chi schedule list` is
269
- always the machine-wide view. An id, prefix or title that matches more than one entry
271
+ always the machine-wide view. An entry that doesn't read (`list` counts it, "chi schedule
272
+ cancel ID removes one") is cancelled by its exact id with `chi schedule cancel ID`, and by
273
+ `cancel_schedule` when its stored `anchor` or `head` is a link of the chain; one with
274
+ neither (its chain can't be told) only with `all: true`. An id, prefix or title that matches more than one entry
270
275
  is refused with exit 2, naming the matches.
271
276
 
272
277
  The tick's lock covers the file only, never the action: the clock advances before
@@ -283,6 +288,95 @@ And a `chi schedule add` from a terminal never waits on an archive or a recap wa
283
288
  own retry loop follows a continue a human made between our resolve and its lock
284
289
  instead of racing it.
285
290
 
291
+ ## Conditions (`--if`)
292
+
293
+ `chi schedule add … --if CMD` (and `chi schedule edit ID --if CMD`, `--no-if` to drop
294
+ it) gates a schedule on a shell command: at each due tick chi runs CMD first, and the
295
+ firing happens only when CMD says it is needed. A heartbeat, say, a chain firing every
296
+ few minutes, can ask "is there anything to do?" first, so that most ticks cost no model
297
+ turn.
298
+
299
+ ```
300
+ chi schedule add --session ab12 --every 5m -m "Check in" --if "$HOME/.local/bin/anything-to-do"
301
+ ```
302
+
303
+ What the exit status means:
304
+
305
+ | CMD | the tick |
306
+ |---|---|
307
+ | exits 0 | goes on as without a condition: the busy check, then the firing |
308
+ | exits 1 to 125 | **not needed**: `next_due` moves to the next occurrence, `last_result` is `not needed: exit N: <its first line of stdout, else its last of stderr>`, the tick prints `not-needed`; nothing else changes (no skip or failure counted, no history row, the chain's one firing per tick left to its other schedules) |
309
+ | exits 126 or 127 (not executable, not found), dies by a signal, runs past `schedule.condition_timeout_seconds` (default 30, at most 300), prints more than 1 MiB, or can't start (the session's folder is gone) | a **failure** (`condition: <why>`), counted toward `max_failures` like any other, the occurrence kept for the next tick: a broken condition turns the schedule off after 3 ticks (about 15 minutes at a 5 minute tick), with the phone notification. Failures reset only when the schedule fires (or you enable it): a gate that seldom says yes adds up errors that come days apart, and three of them turn it off |
310
+
311
+ The order, per due schedule with a condition: its target resolves (a gone or archived
312
+ one fails as without a condition), then `catch_up: none` a whole cycle late is
313
+ `missed`, then the condition's answer, then the busy check. So a busy target spends no
314
+ skip on an occurrence that wasn't needed.
315
+
316
+ How it runs: `sh -c CMD` in the target session's folder, in its own process group
317
+ (a timeout kills the whole group), stdin closed, with the ticker's environment
318
+ scrubbed of Ruby's and Bundler's variables (`SpawnEnv`), plus
319
+ `SAMAGOTCHI_SCHEDULE_ID`, `SAMAGOTCHI_SCHEDULE_TITLE` and `SAMAGOTCHI_SCHEDULE_SESSION`
320
+ (the session it acts on) and never `SAMAGOTCHI_PARENT_SESSION`. Treat the title (and the
321
+ session id) as untrusted input in a gate script: the model may change a schedule's title
322
+ (`chi schedule edit --title` isn't owner-only), so quote it and never `eval` it. It gets the ticker's
323
+ environment: cron's PATH is thin, so name commands by absolute path, and the project's
324
+ mise tools aren't set up (wrap CMD in `mise exec --` when it needs them). It inherits
325
+ what the ticker's environment holds, secrets included. Each due condition runs once, in
326
+ turn, before the tick takes the schedule lock (a slow CMD never holds `chi schedule
327
+ add` or a firing's record up), and the tick's clock moves on by the time they took.
328
+ When the lock is taken, an answer counts only for the condition, the `next_due` and the
329
+ failure count it ran for (so two tickers count one occurrence's error once): an edit, a run-now or another ticker in between leaves the schedule as it is
330
+ and the next tick asks again. So CMD should be cheap, read-only and safe to run twice
331
+ (cron and chi web ticking at once may both run it). A schedule whose target is busy
332
+ runs CMD at every tick until it fires.
333
+
334
+ `chi schedule run-now` fires without asking CMD; `tick --dry-run` doesn't run it
335
+ (`would fire every 5m · if CMD (not run)`). `chi schedule show` has it as `if: CMD
336
+ (set from the CLI <time>; timeout 30 s; run-now skips it)`, `list` adds ` if: CMD`, and
337
+ `list --format json` gives `condition` as `{cmd, by, set_at}`. A `--date` one-off takes
338
+ none (it fires once; edit it to `--every` or `--weekday` first); one that has one anyway
339
+ (an older chi's `edit --date`) fails each tick, "conditions don't apply to a one-off",
340
+ without running CMD, until its budget turns it off.
341
+
342
+ **Only you set one.** CMD runs unattended and outside the
343
+ [guardrails](guardrails.md), so a condition is the owner's alone:
344
+ - `chi schedule … --if` / `--no-if` inside a chi session (any agent's shell:
345
+ `SAMAGOTCHI_PARENT_SESSION` is set) exits 2: "a schedule's condition is set only
346
+ from your own terminal";
347
+ - the `schedule_task` tool has no condition (and `list_schedules` only shows it);
348
+ - with the guardrails bundle, a shell command that runs `chi schedule add|edit … --if`
349
+ asks you every time (`chi-schedule-if`: no parent agent and no System 1 may allow
350
+ it), and `schedules.json` is a protected path: chi's file tools can't write it
351
+ (`chi-schedules`), and a shell command naming it asks (`shell-touches-chi`).
352
+ These are an accident guard, not a sandbox (chi's guardrails are for a model you trust
353
+ not to try): the in-session refusal and the user-only rule stop an accidental or casual
354
+ set, not a determined evasion. A command that unsets the session marker (`env -u
355
+ SAMAGOTCHI_PARENT_SESSION`) and spells the flag so the rule's text doesn't see it (quoting
356
+ or a backslash inside `--if`, a variable) gets through, as it does for `chi context add
357
+ --cmd`; so does a script that edits the file without naming it. A page script runs
358
+ without the session markers too ([pages.md](pages.md): a page is code you trust), so a
359
+ model-written page that runs `chi schedule … --if` sets one when you open it. Keep CMD itself out of the model's reach too: a gate script
360
+ inside a project the model edits is one it can change, and the tick then runs what the
361
+ model wrote. `add` and `edit --if` warn when CMD's first word is a relative path (it
362
+ resolves in the session's folder) or a script inside the session's folder or any git
363
+ work tree: "warning: the model can edit this script; keep a gate outside your projects
364
+ (an absolute path, e.g. under ~/.local/bin)". It is a warning, not a refusal; a command
365
+ on PATH (`test -f …`, `gh …`) gets none.
366
+
367
+ **Every ticker must be new enough.** A chi of 0.189.0 or older (0.189.0 shipped without them) doesn't know
368
+ conditions and would fire such a schedule unasked, so chi stores a schedule with a
369
+ condition with `next_due: null` and the real time under `condition_next_due`: an older
370
+ chi never finds it due (it reads it, lists it with no next time, keeps its sessions
371
+ from retention, and enables, disables and cancels it), and a newer one reads the real
372
+ time back. `add` and `edit --if` say so: "every chi that ticks (chi web, cron) must be
373
+ newer than 0.189.0; an older one leaves this schedule alone". After updating chi,
374
+ restart chi web and point cron at the new chi, or the schedule waits. One leak remains:
375
+ an older chi's `run-now`, or its `edit` of the recurrence, writes a real `next_due`,
376
+ and an older ticker then fires the schedule unconditionally until a newer chi writes
377
+ the file again (one tick in a mixed setup). A condition set by anything but the CLI
378
+ (`by` other than `cli`, a later chi's) fails closed: counted as a failure, never run.
379
+
286
380
  ## Keeping the chain short
287
381
 
288
382
  `keep_links` (default `schedule.default_keep_links`, `0` keeps all) is how many
@@ -300,7 +394,13 @@ delegates archived forever with a dangling `parent_id`: archiving a session arch
300
394
  its descendants, and archived sessions are outside the retention sweep
301
395
  ([sessions.md](sessions.md)), so the delegate pile is the bulk of the archived
302
396
  count. The `anchor` is never pruned: it is the chain's root, the id the user and
303
- the coordinator remember, and `last:<anchor>` must keep resolving.
397
+ the coordinator remember, and `last:<anchor>` must keep resolving. Once the
398
+ anchor's successor is gone, nothing continues the anchor; the chain walks for
399
+ `last:`, `chi send` and notes cross that gap to the entry's `head`
400
+ (`SessionChain::Links#anchor_forward`, [sessions.md](sessions.md), *Session chains*
401
+ → Which link), so the anchor stays the chain's address. A link a previous prune
402
+ already deleted is skipped, so each later firing prunes the next link behind the
403
+ window.
304
404
 
305
405
  What a schedule protects (its anchor, its head and its resolved target, while it is
306
406
  enabled) the retention sweep keeps and a delete refuses: schedules are
@@ -384,7 +484,7 @@ schedule that is off and why ("turned off by you", "skipped 12 times (≈1 h at
384
484
  tick): busy", "failed 3 times: …", "one-off, done") with the `chi schedule enable ID`
385
485
  that turns it back on (for a spent one-off, which has no next time, a `chi schedule
386
486
  edit ID --date …` first); each entry of `schedules.json` that can't be read with the
387
- `chi schedule cancel ID` that removes it; a table of every schedule (on and firing
487
+ `chi schedule cancel ID` that removes it; a table of every schedule (its If column the `--if` command; on and firing
388
488
  first by next due, those with none last, then off; times in this machine's zone) and the recent runs, newest
389
489
  first. It is read-only: ask chi, or use `chi schedule`, to change one. What it shows is
390
490
  as of its last run: Refresh to update. A `schedules.json` that isn't JSON fails the
data/docs/sessions.md CHANGED
@@ -346,7 +346,7 @@ pbpaste | chi send 3fa2 # the clipboard is the messa
346
346
  - Fire and forget: it returns once the message is queued and never prints the answer; that shows in whatever is attached. A guardrail "ask" waits for a UI to answer it, so with nothing attached the turn stalls there until one attaches (`chi --attach ID`).
347
347
  - `--image PATH` (repeatable, up to 20) sends images with the message, as the web composer's chips do. Each file is read once before anything is sent (bmp, tiff and heic converted to png, large ones downscaled, as for `@path`); a missing file or one that isn't an image stops the send (exit 1; with `--wait --format json`, an `error` line) and nothing is sent; more than 20 is a usage error (exit 2). Each session gets its own copy in `<session>/images/`. Text is still required (`-m` or stdin; context alone counts), also with `--wait`. The session's model must see images: one known not to (the host's model list says text-only, `vision: false` in `models:` or `hosts:`, a native llama.cpp without a vision model) is refused before anything is sent, with the reason (`<id> refused: gemma can't take images (…); send text only or switch the model (/model)`); the other sessions of the same send still get it, and the exit is 1. With `--new` nothing is started. When chi can't tell (a native host whose `/props` doesn't answer, a list that doesn't say), the message is sent as before and a text-only model fails the turn in the session. A running turn doesn't take images mid-turn: the message runs as the next turn, and the line says `(runs after the current turn)`. With `--new` the session starts idle with the message as its preview, then the message goes in as its first turn once its worker is up (`<id> started with 1 image`); if the worker doesn't come up in 5 s the session is kept, with its id on the `failed:` line.
348
348
  - A session command runs as the command, as typed in a terminal: `chi send -m "/model qwen" 3fa2` switches the model (`sent as a session command`), and the model never sees the line. What counts is what the session's worker knows (the built-ins, `!cmd`, its bundles' commands); an unknown `/word` (`/usr/bin/env is missing`) goes in as a message. A UI-only command (`/stats`, `/exit`, `/recap`, …) is refused instead: the worker doesn't run it, so the line would reach the model as a prompt (`<id> refused: /stats is a terminal and web command; use chi sessions stats <id8>`; exit 1, and nothing is sent). With `--new` a line starting with `/` or `!` starts the session idle and goes to its worker once it is up, which decides. With `--wait` a command has no reply to wait for: exit 0 at once, `<id> sent as a session command: no reply to wait for …` on stderr (`{"status":"command",…,"detail":…}` with `--format json`); its output shows where the session is open.
349
- - A session that was **continued** (archived, with a later link): the message goes to its chain's newest link, as a note does (*Context notes*), and the old link stays archived. The line names both, in `chi note`'s wording: `3f9a1c2e → 7b2d41aa (continued) sent`. Every id is resolved once, before anything is sent (`SessionAccess#head`, `SessionInbox::Head`'s walk for the `send` row), so the parent-answers check, images, a session command, the UI-only refusal and `--wait` all act on that newest link, and `chi send OLD NEW` sends once. `--wait` waits there: its `--format json` `session_id` is the newest link's, and `asked` the id given (only when they differ). `--wait` without a message follows too, but `--wait --turn T` of the old link (a turn from before the continue) waits on the old one. A link archived and never continued is still brought back by a send. A link being continued right now (its intent written, its new link not saved yet: `SessionContinue`) is asked again for up to 10 s; still not there, it is refused and nothing is written: `3f9a1c2e refused: being continued as 7b2d41aa; send again in a moment`. A continue that ends or starts after that resolve still never gets the old link: chi send's delivery says it follows (`deliver_turn`'s `follow:`, `follow: true` on chi web's turn route for `chi --remote`), and an archived link with a saved successor, or one a continue holds the lock of, refuses it (409 `link_continued`, nothing written; the check and the input go in under a shared hold of that lock, so no continue starts between them); chi send resolves again and sends to the new link (taking back the `--image` copies it made in the old one, on this machine; `chi send OLD NEW` still sends once), for up to 10 s, then `refused: being continued; send again in a moment` (an older chi web ignores the field and sends as before). A chain's first link's id is a stable address for the whole chain. What stays on the id it names: the web composer (typing on an archived link's page brings that link back), a participant's turn (a grant is for one session), `delegate(session:)`, a plugin's turn and a schedule (its own rule, *Schedules*).
349
+ - A session that was **continued** (archived, with a later link): the message goes to its chain's newest link, as a note does (*Context notes*), and the old link stays archived. The line names both, in `chi note`'s wording: `3f9a1c2e → 7b2d41aa (continued) sent`. Every id is resolved once, before anything is sent (`SessionAccess#head`, `SessionInbox::Head`'s walk for the `send` row), so the parent-answers check, images, a session command, the UI-only refusal and `--wait` all act on that newest link, and `chi send OLD NEW` sends once. `--wait` waits there: its `--format json` `session_id` is the newest link's, and `asked` the id given (only when they differ). `--wait` without a message follows too, but `--wait --turn T` of the old link (a turn from before the continue) waits on the old one. A link archived and never continued is still brought back by a send (a schedule's anchor whose successor a prune deleted counts as continued: the send goes to the schedule's head, *Session chains* → Which link). A link being continued right now (its intent written, its new link not saved yet: `SessionContinue`) is asked again for up to 10 s; still not there, it is refused and nothing is written: `3f9a1c2e refused: being continued as 7b2d41aa; send again in a moment`. A continue that ends or starts after that resolve still never gets the old link: chi send's delivery says it follows (`deliver_turn`'s `follow:`, `follow: true` on chi web's turn route for `chi --remote`), and an archived link with a saved successor, or one a continue holds the lock of, refuses it (409 `link_continued`, nothing written; the check and the input go in under a shared hold of that lock, so no continue starts between them); chi send resolves again and sends to the new link (taking back the `--image` copies it made in the old one, on this machine; `chi send OLD NEW` still sends once), for up to 10 s, then `refused: being continued; send again in a moment` (an older chi web ignores the field and sends as before). A chain's first link's id is a stable address for the whole chain. What stays on the id it names: the web composer (typing on an archived link's page brings that link back), a participant's turn (a grant is for one session), `delegate(session:)`, a plugin's turn and a schedule (its own rule, *Schedules*).
350
350
  - One line per session: `sent`, `sent as a session command`, `sent with 2 images`, `sent (goes in at the running turn's next step)`, with `--cut` `sent (cut in now)`, `sent (cuts in once the thinking passes 20 s)` or `sent (cutting is off; goes in at the next step)`, with `--queue` `sent (queued: runs after the current turn)`, `sent (the running turn had ended: it runs now)` or `sent (nothing running: it runs now)`, `sent (started its worker)`, `refused: …` or `failed: …`. Exit 0 when all were sent, 1 when any was refused, failed or not found, 2 for a usage error. There is no `--all`.
351
351
 
352
352
  The Automator action above works for messages too: swap its last line for `pbpaste | "$chi" send -m "what do you make of this?" $(print -r -- "$picked" | cut -f1)`.
@@ -403,11 +403,11 @@ A session can **continue** an earlier one: "the next run of the same routine" (a
403
403
  - **Its open delegates move to the new link** instead: each direct delegate that is running, waiting for an answer, has a live worker or a reply its parent wasn't given, or has such a delegate below it (checked again after the recap wait, so one delegated meanwhile moves too). It moves with its own delegates, stays unarchived, and from then on is the new link's: its card folds under the new link, its reports ring the new link (an idle one runs a wake turn for them, as for its own delegates), `delegate_result` and the `⑂` chip count it there, and what its parent was already told (`delegates.json`) and any report still waiting come along, so nothing is reported twice. A moved delegate gets a context note from `session chain`, `Your parent session is now 4b7e9a01 (…), the next link of its session chain: …`, as its system prompt keeps naming the parent it started with. The move writes `<child>/parent.json` (`{parent_id, from, at}`) beside the child's session file, never the file itself, so a live child worker saving its own copy changes nothing; every reader applies it (a later move overwrites it; it is never removed). A continue is **refused for an open delegate that can't move** (`SessionContinue::Refused`, naming it): one whose live worker runs an older chi (`older chi worker 0.46.1; restart it`: `chi sessions restart <id>`, or stop it) or that a one-turn `chi --non-interactive` run has (`in use by a one-turn chi --non-interactive run or an older chi's terminal; let it finish`). An older `chi web` or CLI still running shows a moved delegate under the archived link until it is restarted.
404
404
  - **What it records:** `<new link>/continued_from.json` (`ContinuedFrom`: `{previous_id, archived_ids, moved_ids}`), written first in the new link's `before_spawn`: the ids its archive hid (the previous link and the delegates archived with it, not ones archived before) and the delegates it moved. Deleting the link reads it to undo the continue. A link from an older chi has none.
405
405
  - **If the continue fails part-way:** what a continue carries (its delegates, attached context, objectives and notes, in that order) and how each is given back is one list, `SessionContinue::CARRY` (the per-session stores it leaves behind, and why, are `SessionContinue::NOT_CARRIED`). A new link that fails to start gives its moved delegates back before it is deleted (each gets a note saying so; its worker is stopped first, if one started, and a worker that won't stop is reported, the link left), with any report one of them rang it with meanwhile, and the notes it moved with any sent to it meanwhile (never the continue's own: the carry note, the attached-context note, the objectives' list): its session file goes first, so a note sent to the previous link from then on stays there, then the notes go back, then its folder goes, and a note an older chi writes into it after that is given back too (a note for a session with no file and no folder is refused, never a stray folder); the previous link, back in the lists, is woken for reports waiting. A continue that dies in the middle leaves a `move.json` in the new link's folder: the new link's next worker finishes that move (only the delegates it names, and without a second note to one already told) as it starts. Its `continue.json` intent remains in the previous link's folder too, so a later list can restore it if the successor was never saved. Until the new link's own worker holds it, a ring from a moved delegate doesn't start another (a `starting` marker in its folder, which that worker removes; a stale one, over 60 s old or from a process that is gone, is ignored). An open delegate below an archived delegate refuses the continue (`under archived …`): unarchive that one, or archive this one.
406
- - **Refused too:** a link that is continued already (naming the link that continues it; continue that one, or `last:<id>`), a previous link whose folder is gone, and one whose model's host can't run it when no default model is configured to fall back to. A refusal starts nothing and archives nothing; a new link that fails to start puts back what was archived. Every refusal that can be known up front (the archive's ones included) comes before the recap wait. One continue of a session runs at a time (a lock in its folder; other chains don't wait), so a double click finds the first one's link and is refused, while a `last:<id>` continue that waited follows the chain to its new end.
406
+ - **Refused too:** a link that is continued already (naming the link that continues it; continue that one, or `last:<id>`; a schedule's anchor whose successor a prune deleted counts as continued by the schedule's head, so no second line starts beside the chain), a previous link whose folder is gone, and one whose model's host can't run it when no default model is configured to fall back to. A refusal starts nothing and archives nothing; a new link that fails to start puts back what was archived. Every refusal that can be known up front (the archive's ones included) comes before the recap wait. One continue of a session runs at a time (a lock in its folder; other chains don't wait), so a double click finds the first one's link and is refused, while a `last:<id>` continue that waited follows the chain to its new end.
407
407
  - **Web:** `POST /api/sessions` takes `continues: "<id, prefix or last:id>"`, with `idle: true` (a new link waiting for its first message, previewed by the previous link's, or `preview`) or a `prompt`, and `model` (or `model_name`) for the new link's model, but not `dir`, `llm_context`, `thinking`, `settings`, `toolkit`, `tools`, `no_tools` or `parent_answers` (400 `invalid_continues`: the previous link's are taken). 201 is the new session's summary, `continues` set, with `moved`: the ids of the delegates that moved to it (`[]` for none), and `model_warning`: the default-model fallback's warning, then any about the model id, joined by `; ` (`null` for none), and `opener`: the previous link's first typed message, in full, when that link continues one itself (`null` otherwise: a chain's first link's first message is its task), and `moved_context`: `{moved: [names], stayed: [{name, why}]}`, the attached context it took (`why` `pushed` or `not movable`); 404 `not_found`; 400 `ambiguous_id` for a prefix of several sessions, `invalid_model` for a given model whose host config.yml doesn't have (or a fallback with no default model); 409 `continued` with `next_id` (the link that continues it already, which the page opens instead), `open_children` with `ids` (open delegates that can't move), `folder_gone`, `busy`, `scratch` or `owned_by_tui`. Every session summary carries `continues`.
408
408
  - **The page:** the info bar's `continue →` continues the open session (`continues: <id>, idle: true`; it reads `continuing…` through the recap wait) and opens the new link with an opener in the composer, not sent (a draft written in this session stays instead; one carried over from another session or the start page gives way to the opener, and the toast's **Restore draft** brings it back): the previous link's own first typed message when that link continues one (the 201's `opener`; a `!shell` line isn't taken), else `Continue where we left off.`. So whatever you sent on the last link comes back on the next one, and editing it once changes it for every later link; the previous link is archived, a toast says so (`Continued 3fa2c1d0 in 4b7e9a01; 3fa2c1d0 is archived; 1 open delegate moved`), and a moved delegate's card folds under the new link. When the previous link's model's host is gone the link starts on the default model and the toast carries the server's `model_warning` too, and then stays until closed. A fresh link (one with no turn yet, however it was made: `continue →`, `chi send --new --continues`, a reload) shows the model picker in its composer with the link's model, until its first turn starts (a failed or canceled first turn ends it too); a pick runs `/model <name>` in the link (a command bubble; the info bar follows) and changes neither the start page's remembered model nor its Recent list, and a Send right after it waits for the `/model` to be taken. A link a one-turn `chi --non-interactive` run has, or one continued already, shows none. A link continued already has no `continue →`: its `→` link goes to the next link (a stale page's continue answered 409 `continued` opens `next_id`). A continue refused for open delegates that can't move shows a toast that names each one (its preview and what the server says to do: `older chi worker 0.46.1; restart it`, `in use by a one-turn chi --non-interactive run or an older chi's terminal; let it finish`), each a link to its page; any other refusal shows the server's words. The info bar of a link carries `← 2026-10-08` (the previous link's day) and, on an earlier link, `2026-10-10 →`, each a link with its id, its full start (`2026-10-10 14:32`) and its preview in the tooltip; a neighbour that started on the open link's own day shows its time instead (`← 09:12`, `14:32 →`). A link made by `continue →` inherits the previous link's preview (and its title, if it has one) when it is created, so its card keeps its chain's title whatever opener it is sent, and its top bar and browser tab show its card's title. A link with a recap of its own reads its auto title, else its recap's first sentence, instead (a link without one reads its chain's name, and a first link's recap names its chain). A link whose title is the opener and nothing else (a `chi send --new --continues` link whose first message is `Continue where we left off.`) shows its chain's first link's title instead, on its card, in the popover and in its info bar's title line, display only (its messages and data keep the opener; its own title when the first link is gone). The lists fold a chain into the card of its latest listed link, whatever the earlier links' archived state (typing in an archived link brings it back, folded there still), their delegates with them: the card's `↩ #N` chip (`#N of M` when later links aren't listed; its tooltip `Session chain: link N of M`) opens a popover of the other links, newest first (`#N`, its date, with its time (`2026-10-17 14:32`) when another link of the chain started the same day, its own title when it differs from the card's (a link inherits its chain's, so mostly it doesn't), else its recap's first sentence, else its preview, `archived`), a click opens one; the chip shows a live dot or `waiting` for a link that has a worker or waits on the user, and a waiting link puts its chain's card first. All sessions folds nothing while a search is typed or the `archived` toggle is on: every link is a card of its own then, its chip `#N of M`, with its own delegates folded in, so a search finds an earlier link and its delegates.
409
409
  - **CLI:** `chi send --new --continues (ID|PREFIX|last:ID) [--model M] [-m TEXT]` (see *Starting a session*).
410
- - **Which link:** an id, a unique prefix, or `last:<id or prefix>`, the latest link of the chain that session is in. It walks the links that still exist: a deleted link in the middle (`chi sessions delete`, the retention sweep of an unarchived one) ends the walk before it, so `last:` of an earlier link then names that earlier link, and continuing it starts a second line beside the links after the gap; name a link after the gap instead. A trigger names the chain this way: a person's message to an archived link that nobody continued brings it back (a human's input), it doesn't continue the chain; an unattended sender's is refused (*Who may wake a session*). That is the rule: `chi send` and a note go to the chain's newest link (*Sending a message*, *Context notes*); the web composer, a participant's turn and `delegate(session:)` go to the link they name. One walker answers every one of these (`SessionChain::Links`: one session listing, archive flags read once; the earliest created successor wins a fork a hand edit made, a loop ends where it would repeat), with two rules on it, not unified on purpose: `last:` and a schedule take the chain's **end** (`Links#latest`: a continue refuses a link continued already, and a schedule never un-archives a chain you retired), `chi send` and a note the **first link not archived** (`Links#first_live`: a person's input goes where the chain is live, and brings back an archived end). A chain pruned by a schedule keeps its `anchor`: the kept window's oldest link still names a link that is gone, so the walk simply stops there; the page's chip counts from the surviving root (pruning renumbers the links) and its popover says `earlier links pruned` where the walk stops, rather than linking to a deleted session.
410
+ - **Which link:** an id, a unique prefix, or `last:<id or prefix>`, the latest link of the chain that session is in. It walks the links that still exist: a deleted link in the middle (`chi sessions delete`, the retention sweep of an unarchived one) ends the walk before it, so `last:` of an earlier link then names that earlier link, and continuing it starts a second line beside the links after the gap; name a link after the gap instead. The one exception is a schedule's anchor (below). A trigger names the chain this way: a person's message to an archived link that nobody continued brings it back (a human's input), it doesn't continue the chain; an unattended sender's is refused (*Who may wake a session*). That is the rule: `chi send` and a note go to the chain's newest link (*Sending a message*, *Context notes*); the web composer, a participant's turn and `delegate(session:)` go to the link they name. One walker answers every one of these (`SessionChain::Links`: one session listing, archive flags read once; the earliest created successor wins a fork a hand edit made, a loop ends where it would repeat), with two rules on it, not unified on purpose: `last:` and a schedule take the chain's **end** (`Links#latest`: a continue refuses a link continued already, and a schedule never un-archives a chain you retired), `chi send` and a note the **first link not archived** (`Links#first_live`: a person's input goes where the chain is live, and brings back an archived end). A chain pruned by a schedule keeps its `anchor`, and the prune deletes the links behind its window, the anchor's successor among them, so nobody continues the anchor any more. The addressing walks bridge that gap: at an archived link nobody continues, `last:`, `chi send`, a note and the peer/context refusals' `next_id` go on at the head of a schedule anchored there (`Links#anchor_forward`; the first entry in `schedules.json` whose head still exists and isn't the anchor, disabled ones too), so `last:<anchor>` names the chain's end and a send to the anchor reaches the live link (`3f9a1c2e → 7b2d41aa (continued)`), as for any continued link; a continue of the anchor itself (without `last:`) is refused as continued already, naming the head. The graph stays raw: `next_of`, the chain's links (`Links#chain`: the anchor alone), the deletes and a delegate's ring never cross the gap. With the head gone (no forward) the walk stops at the anchor, as before; an anchor a person's send brought back before this (no longer archived) isn't bridged either. Backward, the kept window's oldest link still names a link that is gone, so the walk back stops there; the page's chip counts from the surviving root (pruning renumbers the links) and its popover says `earlier links pruned` where the walk stops, rather than linking to a deleted session.
411
411
  - **Deleting a link** (`SessionChain::Delete`; the CLI, the web and `/exit --delete`): a link of a chain is deleted alone by default, and what follows depends on where it is. **The newest link** (nobody continues it, it isn't archived itself, the link before it is archived) undoes its continue: the delegates the continue moved go back to the previous link, finished ones too (`continued_from.json`'s `moved_ids`, still under the link; without the record, its children whose `parent.json` says they came from the previous link), each with a note saying the link was deleted; every note waiting in the link but the continue's own goes back too (`NoteMove.give_back`); then the previous link and what the continue archived with it come back to the lists (without the record, the previous link alone). The previous link is **not started**: reports a moved-back delegate left wait for its next start. What dies with the link: its turns, context sources, objectives edits, session approvals and participant grants (the previous link kept its own copies). Every refusal comes before anything goes: the link's delegates that would go are checked too (a schedule on one through `SessionProtection.hold`, a one-turn run), and they and the link are removed (and the undo runs) only under their `owner.lock`s (kind deleting, taken without waiting, so a worker that took one refuses it); a moved delegate that can't go back (`ChildMove.unmovable`: an older chi's worker, a one-turn run) refuses it (`delegate_unmovable`, naming it), as does a worker that took the link after the stop. Deleting the links one after another undoes each continue by its own record. **A middle link** splits the chain (the earlier links stay archived, the later ones go on as their own chain); nothing is undone or re-linked. A link whose chain is all archived stays archived around the gap. **The link's own delegates** (any position) follow one rule, `SessionManager::DELEGATES` (`SessionManager::DelegateRule`; one shared preview row snapshot): a running one (a worker owns it or is starting for it, a one-turn run; a saved `running` with no worker is a crashed run, and goes) is left running with its whole subtree, its file untouched (its parent's id names a deleted session; its reports are refused as for any gone parent); every other node under the link goes, deepest first, before the link. A session in no chain (a link alone past a gap too) is a link with nothing to undo: its delegates follow the same rule (*Deleting a session*). **The web asks first**: chi web's delete sheet reads `GET /api/sessions/:id/delete_plan` (`:owner`; no query or body; no-store) for any session, `SessionChain::Delete::Preview` over the same `LinkPlan`/`ChainPlan` and checks the delete runs (`check_link!`, `check_chain!`): the link's place in the chain, what comes back and goes for each choice, and each choice's refusal now (a schedule on the chain, the link or a delegate that would go, a continue under way, a one-turn run, a moved delegate that can't go back and whether the page can stop it). A session in no chain answers `{chained: false, session_id, link}`, the same `link` a chained one gets (`previous_id` null, `earlier`/`later` 0, `next_id` null); an older page reads only `chained`. Each choice (`link`, `chain`) also carries `delegates` (`{delete: [ids], leave: [{id, running}]}`; `running` false for a stopped session left under a running delegate, beside the counts `deletes` and `left_running`), `tasks` (`{running, unverified, unreadable}`: `RunningTasks.of` the ids the choice deletes) and `worker` (a link's: `"turn"` when a worker owns it and a turn runs, `"idle"` when a worker owns it or is starting, null; a chain's `{idle, turn}` counts over its links). No titles: the page names each id from its own list. One shared session-row snapshot serves the link and chain choices; Links lists on its own, and a folder whose session file is gone answers too (the delete still takes it). Each call read-only checks each link's continue lock (a session in no chain too), and writes nothing else but the listing's own repair of an interrupted continue; an unknown id is the usual 404. chi web lists `delete_plan_all` in `/api/info`'s features (`Web::App::DELETE_PLAN_FEATURE`). **The tap stops only what the sheet named**: whenever the choice lists any task, the page sends `stop_tasks=true&tasks=<id,id>`, the choice's running ids (`tasks=` when it has only unverified or unreadable records, which a stop never signals, so such a session can still be deleted); archive's sheet sends `{"stop_tasks": true, "tasks": [ids]}` in its body. `tasks` works only with `stop_tasks`; without it, it is ignored, and `stop_tasks` without `tasks` (the CLI's `--stop-tasks`, an older page) takes every running task the operation can stop. A running task not named refuses (`tasks_running`), and the sheet reads the plan again and shows it with "changed; check again". A chain stops link by link: a link refused that way leaves it and the earlier links whole. The moved count is each moved delegate with its subtree (they come back with it), and a `delegate_unmovable` 409 says `stoppable` itself. Each choice carries a `digest` (`SessionChain::Delete.digest`: the sorted ids it deletes, leaves, revives and moves back); the sheet's DELETE sends it as `expect=`, and the delete compares it with the plan it runs (a link's under its holds, as `delete_link` starts; the chain's before its checks) and refuses `plan_changed` (409) before anything changes; a session in no chain is compared the same way (a sheet shown for a link whose chain is gone since deletes when its ids still match). Without `expect` (the CLI, an older page) it deletes as it plans then.
412
412
  **The whole chain** (`chi sessions delete --chain`, `DELETE /api/sessions/:id/chain`, `SessionManager.delete_chain`): every link reachable from this one on its branch, newest first, each with its delegates by the same rule. Refused before anything goes when a schedule is on the chain (`chain_scheduled`, `SessionProtection.chain_hold`) or on a delegate that would go (`scheduled`), a link or such a delegate is in a one-turn run, a continue of a link is under way (`continuing`), without `force` a link has a worker, or a link's worker outlives the stop's wait: every link is checked and stopped before the first is deleted, and each then goes under the owner locks of it and its delegates. A chain with a gap before this link reaches only the part after the gap: the earlier links stay archived (`cut_off: true`). A link refused part-way (a worker that took it after its stop) leaves it, its delegates and the earlier part of the chain whole, its new end back in the lists, and the result lists what was left.
413
413
 
data/docs/sub-agent.md CHANGED
@@ -126,7 +126,7 @@ Exit codes, both commands:
126
126
  | 3 | `waiting_for_owner` | (a participant's wait, `chi --remote NAME send --wait` with their link's token) their turn waits on the session's owner: a question or an approval it raised, or the owner's step-limit Continue; wait again |
127
127
  | 4 | `running` | `--timeout` passed; the turn goes on, wait again |
128
128
  | 1 | `refused` | the queued turn was refused before it ran, no turn ran for it: `cancel_reason` `max_wakes` (an agent's message as a visitor, past `session.max_wakes`: [driver and visitor](#an-agents-messages-driver-and-visitor)), or for a participant's wait `revoked` (their link was revoked or expired), `outdated` (their link is an older chi's read-only one) or `cap_reached` (they spent their cap) |
129
- | 1 | `failed`, `canceled`, `limit`, `removed`, `no_answer`, `error`, `worker_gone`, `stopped` | `detail` says what happened (`limit`: the turn ran out of steps and nobody can be asked, e.g. an older worker; `chi send ID -m '/continue yes'` continues it, except under `guardrails.parent_answers: hard`, where a parent's `/continue yes` is refused as its `chi answer --option Continue` is; `removed`: the `--queue` message waited for was taken back before it ran, no turn ran for it). `failed` adds `error_kind` (the provider error's kind: `credits`, `credits_held`, `rate_limited`, `server`, `auth`, `connection`, …) and `retryable` when known; `canceled` adds `cancel_reason` (`user`: a Stop in the web; `session_stopped`: a session stop, `chi sessions stop` or the web's; `worker_stopped`: the turn waited for (a `--queue` message's, a message's to an idle session, the running turn a message merged into or a plain `--wait` saw running) died with its worker (detail "its worker exited mid-turn"), settled by the next one; `hook`; `ctrl_c`; `manual`) and `stopped_by` (the hook that stopped it, e.g. `loop-guard`) when known |
129
+ | 1 | `failed`, `canceled`, `limit`, `removed`, `no_answer`, `error`, `worker_gone`, `stopped` | `detail` says what happened (`limit`: the turn ran out of steps and nobody can be asked, e.g. an older worker; `chi send ID -m '/continue yes'` continues it, except under `guardrails.parent_answers: hard`, where a parent's `/continue yes` is refused as its `chi answer --option Continue` is; `removed`: the `--queue` message waited for was taken back before it ran, no turn ran for it). `failed` adds `error_kind` (the provider error's kind: `credits`, `credits_held`, `rate_limited`, `server`, `auth`, `connection`, …; `chi_error` when chi itself failed, see samagotchi.log) and `retryable` when known; `canceled` adds `cancel_reason` (`user`: a Stop in the web; `session_stopped`: a session stop, `chi sessions stop` or the web's; `worker_stopped`: the turn waited for (a `--queue` message's, a message's to an idle session, the running turn a message merged into or a plain `--wait` saw running) died with its worker (detail "its worker exited mid-turn"), settled by the next one; `hook`; `ctrl_c`; `manual`) and `stopped_by` (the hook that stopped it, e.g. `loop-guard`) when known |
130
130
  | 2 | (no JSON) | usage error, or an option the question doesn't offer |
131
131
  | 130 | `running` | Ctrl-C; the turn goes on |
132
132
 
@@ -164,6 +164,21 @@ rules:
164
164
  scopes: [once]
165
165
  reason: attaches a command chi will run every few minutes, outside the guardrails
166
166
 
167
+ # ── a schedule's condition: a shell command the tick runs unattended ──
168
+ # chi schedule add|edit --if CMD (and --no-if) is the owner's: the tick
169
+ # runs CMD later, outside the guardrails, and chi schedule refuses the
170
+ # flag inside a session (SAMAGOTCHI_PARENT_SESSION), which an agent can
171
+ # unset. This asks every time, and only the user may allow it (core's
172
+ # PROTECTED_RULES; System 1 never: NEVER_AUTO). The same shapes as
173
+ # chi-context-cmd: quoted words, continuations, --if=…, --remote NAME
174
+ # before the word, and xargs chi schedule add|edit whatever it is fed.
175
+ - id: chi-schedule-if
176
+ tool: shell
177
+ command: '\bchi["'']?(?:[\s\\]+["'']?--remote(?:=|["'']?[\s\\]+["'']?)[^\s"''\\;&|]+["'']?)*[\s\\]+["'']?schedule["'']?[\s\\]+["'']?(?:add|edit)\b(?:[^\n]|\\\n)*[\s"''\\]--(?:no-)?if(?:[\s="''\\]|$)|\bxargs\b[^;&|\n]*\bchi["'']?(?:[\s\\]+["'']?--remote(?:=|["'']?[\s\\]+["'']?)[^\s"''\\;&|]+["'']?)*[\s\\]+["'']?schedule["'']?[\s\\]+["'']?(?:add|edit)\b'
178
+ verdict: ask
179
+ scopes: [once]
180
+ reason: sets a shell command chi's schedule tick runs unattended, outside the guardrails
181
+
167
182
  # ── chi broadcast: for the user, not an agent ─────────────────────────
168
183
  # chi broadcast refuses to run inside a session (SAMAGOTCHI_PARENT_SESSION
169
184
  # is set there), but an agent can unset that; this asks every time, and
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  name: guardrails
3
- version: 0.9.3
3
+ version: 0.9.4
4
4
  scope: system
5
- description: Optional default guardrail rules (git push/rewrites, rm -rf wide, curl | sh, git hooks, chi's own config and attached context from the shell, chi context add --cmd, chi broadcast, answering chi around chi answer, removing a memory, writing a memory that reaches the system prompt (identity, model notes) or a model overlay; in strict mode also git rebase and writes and git in another checkout outside the session's repo), asks only small models get (git checkout --/restore, git stash drop), and a note for the model
5
+ description: Optional default guardrail rules (git push/rewrites, rm -rf wide, curl | sh, git hooks, chi's own config and attached context from the shell, chi context add --cmd, chi schedule --if, chi broadcast, answering chi around chi answer, removing a memory, writing a memory that reaches the system prompt (identity, model notes) or a model overlay; in strict mode also git rebase and writes and git in another checkout outside the session's repo), asks only small models get (git checkout --/restore, git stash drop), and a note for the model
6
6
  trust_level: reviewed
7
7
  # models: in small-models.yml (guardrails.small_models) needs 0.8.1; git: in rules.yml needs 0.17.0;
8
8
  # a rule's memory: key (memory-remove) needs 0.36.0, and its overlay and prompt values (model-overlay-write,