samagotchi 0.187.0 → 0.189.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +96 -1
- data/bin/chi +2 -0
- data/docs/architecture.md +13 -7
- data/docs/bundle-authoring.md +1 -1
- data/docs/bundles.md +139 -120
- data/docs/cli.md +46 -8
- data/docs/configuration.md +4 -4
- data/docs/context.md +18 -162
- data/docs/guardrails.md +6 -3
- data/docs/hooks.md +2 -1
- data/docs/internals/attached-context.md +19 -37
- data/docs/internals/bridge.md +1 -0
- data/docs/internals/bundles.md +3 -3
- data/docs/internals/engine.md +2 -2
- data/docs/internals/llm-context-forget.md +5 -6
- data/docs/internals/objectives.md +1 -0
- data/docs/internals/pages.md +71 -21
- data/docs/internals/peers.md +149 -0
- data/docs/internals/remote-sessions.md +7 -4
- data/docs/internals/session-lifecycle.md +19 -6
- data/docs/internals/web-frontend.md +63 -39
- data/docs/internals/web-push.md +12 -6
- data/docs/memory.md +1 -1
- data/docs/pages.md +70 -16
- data/docs/peers.md +144 -0
- data/docs/plugins.md +77 -28
- data/docs/releasing.md +1 -1
- data/docs/scheduling.md +71 -8
- data/docs/sessions.md +12 -8
- data/docs/sub-agent.md +5 -5
- data/docs/testing.md +1 -1
- data/lib/samagotchi/bridge.rb +3 -3
- data/lib/samagotchi/bundle_command/api_calls.rb +2 -1
- data/lib/samagotchi/bundle_command/check.rb +1 -1
- data/lib/samagotchi/bundle_manifest.rb +34 -5
- data/lib/samagotchi/bundles/claude-peer/manifest.yml +11 -18
- data/lib/samagotchi/bundles/claude-peer/plugin.rb +22 -16
- data/lib/samagotchi/bundles/claude-peer/scripts/chi-peer-SKILL.md +48 -39
- data/lib/samagotchi/bundles/claude-peer/scripts/pair +15 -73
- data/lib/samagotchi/bundles/claude-peer/skill_claude_peer.md +16 -16
- data/lib/samagotchi/bundles/codex-peer/manifest.yml +11 -15
- data/lib/samagotchi/bundles/codex-peer/plugin.rb +35 -24
- data/lib/samagotchi/bundles/codex-peer/scripts/chi-peer-SKILL.md +51 -40
- data/lib/samagotchi/bundles/codex-peer/scripts/pair +18 -54
- data/lib/samagotchi/bundles/codex-peer/skill_codex_peer.md +16 -16
- data/lib/samagotchi/bundles/dev/manifest.yml +2 -2
- data/lib/samagotchi/bundles/schedules/manifest.yml +11 -0
- data/lib/samagotchi/bundles/schedules/scripts/schedules.rb +159 -0
- data/lib/samagotchi/bundles/skills/manifest.yml +2 -2
- data/lib/samagotchi/bundles/skills/plugin.rb +14 -8
- data/lib/samagotchi/bundles/system/manifest.yml +3 -3
- data/lib/samagotchi/bundles/system/self_map.md +2 -2
- data/lib/samagotchi/bundles/system/skill_pages.md +9 -4
- data/lib/samagotchi/client_id.rb +15 -1
- data/lib/samagotchi/config.rb +8 -7
- data/lib/samagotchi/context_absorber.rb +23 -277
- data/lib/samagotchi/context_sources.rb +17 -69
- data/lib/samagotchi/engine/messages.rb +12 -1
- data/lib/samagotchi/engine/plugins.rb +1 -1
- data/lib/samagotchi/engine.rb +7 -6
- data/lib/samagotchi/engine_peers.rb +0 -3
- data/lib/samagotchi/guardrail_wiring.rb +2 -0
- data/lib/samagotchi/guardrails/chi_dirs.rb +4 -3
- data/lib/samagotchi/guardrails/parent_approvals.rb +6 -5
- data/lib/samagotchi/guardrails/protected_paths.rb +6 -3
- data/lib/samagotchi/inline_widgets.rb +11 -3
- data/lib/samagotchi/installed_bundles/manifest.rb +8 -1
- data/lib/samagotchi/log_line.rb +1 -1
- data/lib/samagotchi/memory_bundle/asset_installer.rb +3 -2
- data/lib/samagotchi/memory_bundle/builder.rb +1 -0
- data/lib/samagotchi/memory_bundle/installed_copy.rb +1 -1
- data/lib/samagotchi/note_move.rb +3 -1
- data/lib/samagotchi/page_command.rb +25 -13
- data/lib/samagotchi/pages/builder.rb +7 -8
- data/lib/samagotchi/pages/bundled.rb +83 -0
- data/lib/samagotchi/pages/launch.rb +22 -4
- data/lib/samagotchi/pages/runner.rb +7 -2
- data/lib/samagotchi/pages/runtime.rb +83 -0
- data/lib/samagotchi/pages/store.rb +29 -7
- data/lib/samagotchi/pages.rb +47 -3
- data/lib/samagotchi/peer_command.rb +192 -0
- data/lib/samagotchi/peer_continue.rb +105 -0
- data/lib/samagotchi/peer_exchanges.rb +3 -3
- data/lib/samagotchi/peer_mailbox.rb +360 -0
- data/lib/samagotchi/peer_note.rb +208 -0
- data/lib/samagotchi/peer_receipts.rb +247 -0
- data/lib/samagotchi/peer_registry.rb +44 -0
- data/lib/samagotchi/peer_roster.rb +79 -0
- data/lib/samagotchi/peer_say.rb +168 -0
- data/lib/samagotchi/plugin/api.rb +29 -21
- data/lib/samagotchi/plugin/context.rb +7 -0
- data/lib/samagotchi/plugin/loader.rb +3 -3
- data/lib/samagotchi/plugin/peer.rb +175 -64
- data/lib/samagotchi/plugin/peers.rb +70 -0
- data/lib/samagotchi/run_options.rb +3 -2
- data/lib/samagotchi/schedule_command.rb +88 -39
- data/lib/samagotchi/schedule_display.rb +101 -0
- data/lib/samagotchi/schedules/busy_part.rb +146 -0
- data/lib/samagotchi/schedules/edit_part.rb +120 -0
- data/lib/samagotchi/schedules/history_part.rb +51 -0
- data/lib/samagotchi/schedules/listing_part.rb +52 -0
- data/lib/samagotchi/schedules/notices_part.rb +116 -0
- data/lib/samagotchi/schedules/protection_part.rb +103 -0
- data/lib/samagotchi/schedules/recurrence.rb +103 -0
- data/lib/samagotchi/schedules.rb +134 -330
- data/lib/samagotchi/session_access/contract.rb +18 -1
- data/lib/samagotchi/session_access/local.rb +140 -14
- data/lib/samagotchi/session_access/remote.rb +6 -3
- data/lib/samagotchi/session_access/remote_peers.rb +75 -0
- data/lib/samagotchi/session_chain/delete.rb +7 -5
- data/lib/samagotchi/session_continue.rb +12 -0
- data/lib/samagotchi/session_inbox_delivery.rb +5 -2
- data/lib/samagotchi/session_lifecycle/allowed.rb +2 -1
- data/lib/samagotchi/session_lifecycle.rb +3 -2
- data/lib/samagotchi/session_manager/delivery.rb +5 -3
- data/lib/samagotchi/session_manager/removal.rb +18 -9
- data/lib/samagotchi/session_manager/spawn.rb +2 -1
- data/lib/samagotchi/session_manager.rb +1 -0
- data/lib/samagotchi/session_protection.rb +99 -0
- data/lib/samagotchi/session_retention.rb +21 -6
- data/lib/samagotchi/session_stores.rb +17 -0
- data/lib/samagotchi/sessions_command.rb +4 -0
- data/lib/samagotchi/steer.rb +1 -1
- data/lib/samagotchi/system_prompt.rb +1 -1
- data/lib/samagotchi/terminal_ui/attached_loop.rb +1 -1
- data/lib/samagotchi/terminal_ui/formatting.rb +4 -1
- data/lib/samagotchi/testing/boundary.rb +17 -13
- data/lib/samagotchi/testing/bundle.rb +40 -5
- data/lib/samagotchi/testing/install.rb +4 -4
- data/lib/samagotchi/testing/recording_api.rb +2 -1
- data/lib/samagotchi/tools/cancel_schedule.rb +5 -2
- data/lib/samagotchi/tools/context_read.rb +0 -14
- data/lib/samagotchi/tools/list_schedules.rb +8 -3
- data/lib/samagotchi/turn_outcome.rb +41 -0
- data/lib/samagotchi/version.rb +1 -1
- data/lib/samagotchi/web/app.rb +2 -13
- data/lib/samagotchi/web/message_display.rb +4 -2
- data/lib/samagotchi/web/page_routes.rb +13 -8
- data/lib/samagotchi/web/peer_routes.rb +133 -0
- data/lib/samagotchi/web/public/app.js +23 -29
- data/lib/samagotchi/web/public/bubbles.js +2 -2
- data/lib/samagotchi/web/public/cards_place.js +20 -1
- data/lib/samagotchi/web/public/context_chips.js +45 -46
- data/lib/samagotchi/web/public/history_reveal.js +4 -1
- data/lib/samagotchi/web/public/history_shape.js +3 -2
- data/lib/samagotchi/web/public/index.html +24 -2
- data/lib/samagotchi/web/public/notify.js +1 -1
- data/lib/samagotchi/web/public/owner_claim.js +7 -5
- data/lib/samagotchi/web/public/page_links.js +1 -1
- data/lib/samagotchi/web/public/page_view.js +10 -6
- data/lib/samagotchi/web/public/pages.css +9 -2
- data/lib/samagotchi/web/public/pages_group.js +21 -19
- data/lib/samagotchi/web/public/pages_list.js +73 -0
- data/lib/samagotchi/web/public/pages_model.js +54 -0
- data/lib/samagotchi/web/public/pages_wiring.js +66 -0
- data/lib/samagotchi/web/public/peer_chip.js +60 -74
- data/lib/samagotchi/web/public/peer_data.js +13 -11
- data/lib/samagotchi/web/public/peer_links.js +12 -7
- data/lib/samagotchi/web/public/peer_mailbox_api.js +20 -0
- data/lib/samagotchi/web/public/peer_note.js +7 -3
- data/lib/samagotchi/web/public/peer_text.js +4 -4
- data/lib/samagotchi/web/public/quiet_notes.js +199 -0
- data/lib/samagotchi/web/public/revise_stack.js +4 -3
- data/lib/samagotchi/web/public/session_view.js +2 -2
- data/lib/samagotchi/web/public/stream_handlers.js +3 -2
- data/lib/samagotchi/web/public/turn_block.js +7 -3
- data/lib/samagotchi/web/public/turn_events.js +6 -0
- data/lib/samagotchi/web/public/views.js +77 -23
- data/lib/samagotchi/web/push/attention.rb +3 -2
- data/lib/samagotchi/web/push/notifier.rb +4 -3
- data/lib/samagotchi/web/server.rb +3 -1
- data/lib/samagotchi/web/session_access_routes.rb +3 -20
- data/lib/samagotchi/web/session_hub.rb +64 -19
- data/lib/samagotchi/worker/leave.rb +3 -0
- data/lib/samagotchi/worker/mail.rb +73 -0
- data/lib/samagotchi/worker/startup.rb +3 -0
- data/lib/samagotchi/worker/wake_turns.rb +20 -5
- data/lib/samagotchi/worker.rb +12 -6
- data/lib/samagotchi/worker_inbound/mail.rb +214 -0
- data/lib/samagotchi/worker_inbound.rb +43 -46
- data/lib/samagotchi/worker_wakes.rb +26 -21
- metadata +35 -2
- data/lib/samagotchi/peer_sources.rb +0 -58
data/docs/bundles.md
CHANGED
|
@@ -411,6 +411,21 @@ The port is bound to loopback, not the LAN. Under colima, run it from a folder i
|
|
|
411
411
|
shares only that with its VM by default, and elsewhere SearXNG starts on its own default settings (JSON off).
|
|
412
412
|
`curl 'http://127.0.0.1:8888/search?q=ruby&format=json'` should answer JSON.
|
|
413
413
|
|
|
414
|
+
## The schedules bundle
|
|
415
|
+
|
|
416
|
+
`chi bundle install schedules` installs a **Schedules** page (`lib/samagotchi/bundles/schedules/scripts/schedules.rb`):
|
|
417
|
+
in chi web it is under the `pages` pill (`#/p/schedules`), and `chi page run schedules` runs it from a terminal. No
|
|
418
|
+
profile includes it, so `chi update` lists it as not installed until you install it. What it shows is in
|
|
419
|
+
[scheduling.md](scheduling.md#the-schedules-page). It has no plugin, tools or settings: the manifest's `pages:` names
|
|
420
|
+
its one script ([plugins.md](plugins.md#pages)), and the script reads the schedules with `runtime.schedules`
|
|
421
|
+
([pages.md](pages.md#reading-chis-data-runtime)).
|
|
422
|
+
|
|
423
|
+
- **Read-only.** It changes nothing; for each schedule that is off it prints the `chi schedule enable ID` that turns it
|
|
424
|
+
on (a spent one-off gets a new moment first: `chi schedule edit ID --date …`).
|
|
425
|
+
- **Your own version.** Copy the script (`chi page list --format json` gives its path as `script`) to
|
|
426
|
+
`~/.config/samagotchi/pages/schedules.rb` and change it: yours runs instead. Remove your copy to get the bundle's back.
|
|
427
|
+
- **Removing it.** `chi page rm schedules` refuses (the page comes with the bundle); uninstall the bundle instead.
|
|
428
|
+
|
|
414
429
|
## The loop-guard bundle
|
|
415
430
|
|
|
416
431
|
`chi bundle install loop-guard` installs the bundle shipped with chi (`chi
|
|
@@ -933,8 +948,9 @@ seen as a version (so `/skill diff` has it) and counts as the skill updated.
|
|
|
933
948
|
A plain read keeps no version.
|
|
934
949
|
|
|
935
950
|
**The nudge** (`nudge: true`). Some models, finding a skill's step broken,
|
|
936
|
-
skip it and go on without fixing the skill. In a turn that read a skill
|
|
937
|
-
(`memory_read` of a `skill_*` name, or `read` of its file
|
|
951
|
+
skip it and go on without fixing the skill. In a turn that read a skill you
|
|
952
|
+
saved yourself (`memory_read` of a `skill_*` name, or `read` of its file;
|
|
953
|
+
memories shipped by a bundle are skipped), the first failing
|
|
938
954
|
tool call after it (an `execute` that exited non-zero, except a grep-family
|
|
939
955
|
search that found nothing, a tool error) steers
|
|
940
956
|
the model once (a call a guardrail or the user denied doesn't count as a
|
|
@@ -942,8 +958,9 @@ failed step): *"A step of skill release failed. Find out why before skipping
|
|
|
942
958
|
it; if the skill is out of date, fix it now: edit the step that changed in
|
|
943
959
|
its file (or memory_write the whole skill) and add a Changelog line."* No
|
|
944
960
|
steer once a skill read this turn has changed, by any tool. If the turn ends
|
|
945
|
-
with a failed step and no skill read changed, one line says so: `skill
|
|
946
|
-
release was followed, a step failed, the skill wasn't updated
|
|
961
|
+
with a failed step and no skill read changed, one warning line says so: `skill
|
|
962
|
+
release was followed, a step failed, the skill wasn't updated` (yellow in chi
|
|
963
|
+
web, `warning:` in the terminal). A failure
|
|
947
964
|
unrelated to the skill (a test
|
|
948
965
|
meant to fail) can set it off too: once per turn, and only after a skill was
|
|
949
966
|
read.
|
|
@@ -1090,11 +1107,11 @@ validate or as context, and Claude's answer comes back into chi. This is
|
|
|
1090
1107
|
Claude with the context it has, not a fresh review run. Nothing runs until a
|
|
1091
1108
|
Claude pairs; without one the bundle costs one tool declaration.
|
|
1092
1109
|
|
|
1093
|
-
- **Pairing is Claude's.** chi can't see Claude's inbox, so Claude
|
|
1094
|
-
|
|
1110
|
+
- **Pairing is Claude's.** chi can't see Claude's inbox, so Claude pairs:
|
|
1111
|
+
`chi peer pair claude <id> --address <socket>`, the address being its
|
|
1095
1112
|
per-session inbox socket (`CLAUDE_CODE_MESSAGING_SOCKET`, Claude Code
|
|
1096
|
-
2.1.224 or later)
|
|
1097
|
-
run that yourself:
|
|
1113
|
+
2.1.224 or later); its answers come back as messages in the session's
|
|
1114
|
+
mailbox (`chi peer say`, [peers.md](peers.md)). You never run that yourself:
|
|
1098
1115
|
1. `/claude install-skill` (once) shows a card with the target,
|
|
1099
1116
|
`$CLAUDE_CONFIG_DIR/skills/chi-peer/SKILL.md` (else `~/.claude/…`),
|
|
1100
1117
|
whether one is there and, when it differs, a short diff; its Install (or
|
|
@@ -1106,27 +1123,21 @@ Claude pairs; without one the bundle costs one tool declaration.
|
|
|
1106
1123
|
(your state folder), so Claude isn't asked before reading a long part's
|
|
1107
1124
|
file; chi never writes Claude's settings.
|
|
1108
1125
|
2. In Claude Code you say "pair with chi <id or chi web URL>". The skill runs
|
|
1109
|
-
`sh <bundle>/scripts/pair <id or URL>`,
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
re
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
(
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
claude-outbox`), so each answer stays in the conversation with its text
|
|
1120
|
-
([Peer sources](context.md#peer-sources-the-peer-loop)). In chi's own
|
|
1121
|
-
records the answer's note names the send (`re`); an older skill's answer
|
|
1122
|
-
has none and reads as a message Claude started. The session's peer
|
|
1123
|
-
exchange log keeps sends and answer summaries, not answer texts; a new
|
|
1124
|
-
pairing starts a new log.
|
|
1126
|
+
`sh <bundle>/scripts/pair <id or URL>`, one `chi peer pair`. A re-pair
|
|
1127
|
+
after a Claude restart only refreshes the socket; Claude's messages stay.
|
|
1128
|
+
3. Claude answers a validate or a question with `chi peer say claude <id>
|
|
1129
|
+
--wake --re <the ref: line> --summary … --wait 8`, which wakes chi, and
|
|
1130
|
+
quotes to you the line it prints (`#12 received · woke chi`, or why chi
|
|
1131
|
+
holds it). Each message is its own note, holding its text up to the tool
|
|
1132
|
+
output cap (10,000 characters by default; a longer one the model reads
|
|
1133
|
+
with `claude_read(serial: N)`). In chi's own records the answer's note
|
|
1134
|
+
names the send (`re`). The session's peer exchange log keeps sends; the
|
|
1135
|
+
answers are the mailbox's messages.
|
|
1125
1136
|
4. Claude can also tell chi something unasked (it changed something chi's
|
|
1126
|
-
work depends on, you took a decision with it): the same
|
|
1127
|
-
|
|
1128
|
-
chi picks up at its next turn). It wakes under the same count
|
|
1129
|
-
answers, and chi takes it into account within your task and tells you
|
|
1137
|
+
work depends on, you took a decision with it): the same say with no
|
|
1138
|
+
`--re`, and `--wake` when chi should react now (`--nowake` is for
|
|
1139
|
+
background chi picks up at its next turn). It wakes under the same count
|
|
1140
|
+
as answers, and chi takes it into account within your task and tells you
|
|
1130
1141
|
what it brings.
|
|
1131
1142
|
- **In the web** (the owner's page), a send and its answer link to each
|
|
1132
1143
|
other. The send's row ("sent to Claude · validate: title") says where the
|
|
@@ -1139,28 +1150,30 @@ Claude pairs; without one the bundle costs one tool declaration.
|
|
|
1139
1150
|
verdict (`VERDICT OK` with "round closed" when Claude agreed), its summary,
|
|
1140
1151
|
the answer's text under it (rendered as markdown), and chi's instruction to
|
|
1141
1152
|
the model folded under "what chi told the agent" (the text isn't repeated
|
|
1142
|
-
there).
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
has no link back. A `/claude validate …` you type gets no link in the
|
|
1153
|
+
there). A message too long for its note shows its summary only, with "Read
|
|
1154
|
+
the full answer", which opens the Claude chip on that message's text (an
|
|
1155
|
+
older pairing's answer, from its outbox source, has it on the newest
|
|
1156
|
+
only). An answer from an older skill (no `re`) links to the last waiting
|
|
1157
|
+
validate or question; one that answers no send has no link back. A `/claude validate …` you type gets no link in the
|
|
1147
1158
|
conversation (command bubbles aren't kept), its answer still names it.
|
|
1148
1159
|
- **The session bar** has one chip for the pairing, `Claude · …`, first among
|
|
1149
|
-
the context chips,
|
|
1160
|
+
the context chips, fed by chi web's `GET …/peers` (the mailbox): `paired`;
|
|
1150
1161
|
`waiting 2m` (a validate or question has no answer yet, its age the send's);
|
|
1151
|
-
`answered 3m` with the unread dot (
|
|
1152
|
-
|
|
1162
|
+
`answered 3m` with the unread dot (a message no turn has read yet: held or
|
|
1163
|
+
noted);
|
|
1153
1164
|
`can't send` (the last send didn't go through: the Claude session ended or
|
|
1154
1165
|
restarted, pair again from Claude, which ends it; chi web can't probe the
|
|
1155
|
-
socket, so a dead inbox shows only after a send hits it); `answers only`,
|
|
1156
|
-
pairing through a remote). Its popover (a bottom
|
|
1157
|
-
chi sends and
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1166
|
+
socket, so a dead inbox shows only after a send hits it); `answers only`,
|
|
1167
|
+
dashed (a pairing with no address: through a remote). Its popover (a bottom
|
|
1168
|
+
sheet on a phone) says where chi sends and how it answers, lists the last
|
|
1169
|
+
exchanges (time, kind · title or a message's `#N · summary`, `waiting 2m` /
|
|
1170
|
+
`changes · 11m` / `ok · 4m` / `answered · 4m` / `no answer expected` / `not
|
|
1171
|
+
sent`, then what chi did with the answer: `held · peer turns`, `read`,
|
|
1172
|
+
`completed`; a tap jumps to that send's row when it is in the conversation),
|
|
1173
|
+
and has View latest answer, Status card (runs `/claude`) and Unpair (one
|
|
1174
|
+
confirm; the pairing ends, its messages stay, and the chip goes). A source
|
|
1175
|
+
named `claude-outbox` (an older pairing's) is an ordinary chip.
|
|
1176
|
+
codex-peer's is the same, `Codex · …`.
|
|
1164
1177
|
- **The tool `claude_send(kind, title, text)`**, `kind` being `validate`,
|
|
1165
1178
|
`context` or `question`, writes one JSON line to that socket. The message
|
|
1166
1179
|
starts with a header, `chi <id> · <kind> · <title>`, and a second line,
|
|
@@ -1172,14 +1185,19 @@ Claude pairs; without one the bundle costs one tool declaration.
|
|
|
1172
1185
|
`$XDG_STATE_HOME/samagotchi/plugins/claude-peer/sessions/<id>/<HHMMSS>-<slug>.md`
|
|
1173
1186
|
(removed with the session), and the message names it (`payload: <path>`).
|
|
1174
1187
|
The tool is declared whether or not a Claude is paired, so pairing doesn't
|
|
1175
|
-
change the prompt. Its errors say what to do:
|
|
1176
|
-
Claude), the socket gone or refusing (that Claude
|
|
1177
|
-
restarted: pair again), a text over 200,000 characters.
|
|
1188
|
+
change the prompt. Its errors say what to do: not paired (pair from
|
|
1189
|
+
Claude), paired for answers only, the socket gone or refusing (that Claude
|
|
1190
|
+
session ended or restarted: pair again), a text over 200,000 characters.
|
|
1191
|
+
- **The tool `claude_read(serial, offset, limit)`** reads a message from
|
|
1192
|
+
Claude by its number, when its note says it is long: its text in the peer
|
|
1193
|
+
block, paged by lines to the tool output cap.
|
|
1178
1194
|
- **`/claude`** (an anytime command, so it works mid-turn) sends without
|
|
1179
1195
|
the model:
|
|
1180
1196
|
- `/claude` alone shows a card: paired or not, the socket and whether its
|
|
1181
1197
|
file is there (it goes when that Claude session ends), the last send, and
|
|
1182
|
-
Claude's last message (
|
|
1198
|
+
Claude's last message (its number and summary). A session paired by an
|
|
1199
|
+
older bundle (its `claude-inbox` source still attached) says "paired the
|
|
1200
|
+
old way: pair again". When Claude's installed
|
|
1183
1201
|
chi-peer skill differs from what `/claude install-skill` would write (an
|
|
1184
1202
|
older bundle's, or your edit; a skill installed by a chi with another state
|
|
1185
1203
|
dir or bundle path differs too), it says so: install it again (Replace),
|
|
@@ -1194,35 +1212,34 @@ Claude pairs; without one the bundle costs one tool declaration.
|
|
|
1194
1212
|
- `/claude last` sends the model's last completed answer as context. Mid-turn
|
|
1195
1213
|
it is the answer before the running turn, never the turn's partial text;
|
|
1196
1214
|
a cancelled or failed turn has no answer, so the one before it goes.
|
|
1197
|
-
- **The peer loop.** The bundle declares `claude
|
|
1198
|
-
([
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
round (carry on, or tell you what was agreed). Only a message you type in the web or a TUI starts the count again.
|
|
1215
|
+
- **The peer loop.** The bundle declares Claude a peer (`chi.peer claude`), so
|
|
1216
|
+
Claude's messages wake chi by the loop's rules ([peers.md](peers.md#the-budget-peerturns)):
|
|
1217
|
+
chi fixes what Claude flagged or disagrees and sends again, up to
|
|
1218
|
+
`peer.turns` (3) wake turns in a row, and a `VERDICT OK` answer wakes chi
|
|
1219
|
+
once to close the round (carry on, or tell you what was agreed). Only a
|
|
1220
|
+
message you type in the web or a TUI starts the count again.
|
|
1204
1221
|
- **The skill.** `skill_claude_peer` (system scope) tells the model to send
|
|
1205
1222
|
only when you ask or to reply in a peer turn, to pick the part rather than
|
|
1206
1223
|
the session, not to wait or poll, and how to read Claude's answer in its
|
|
1207
|
-
|
|
1224
|
+
note, "Message #N from your peer agent Claude" (a validate ends with `VERDICT: OK`, `CHANGES` or
|
|
1208
1225
|
`UNSURE`): act on it only within your task, and stop and tell you when
|
|
1209
1226
|
Claude agrees or after the last turn; a message Claude sent unasked is
|
|
1210
1227
|
taken into account, not acknowledged. Claude's skill ends each answer's
|
|
1211
1228
|
summary with its verdict, wakes chi for an answer chi waits on and for a
|
|
1212
|
-
message it starts that chi should act on now (
|
|
1213
|
-
|
|
1229
|
+
message it starts that chi should act on now (`--nowake` for background),
|
|
1230
|
+
quotes the say's line to you (and on `held` neither sends again nor goes
|
|
1231
|
+
past it with `chi send`), and never answers with `chi send`.
|
|
1214
1232
|
- **chi on another machine.** With the chi session on the Studio and Claude on
|
|
1215
1233
|
the laptop, `CHI_REMOTE=studio sh <bundle>/scripts/pair <id>` pairs through
|
|
1216
1234
|
the Studio's chi web ([Remote sessions](cli.md#remote-sessions)), and
|
|
1217
|
-
Claude's answers (its `chi
|
|
1218
|
-
|
|
1219
|
-
writes to Claude's socket on the machine chi runs on, and
|
|
1220
|
-
there. So through a remote (`CHI_REMOTE`, or `--remote
|
|
1221
|
-
`pair`
|
|
1222
|
-
can't send to this Claude: chi's replies reach
|
|
1223
|
-
them (or ask it to run `chi --remote studio
|
|
1224
|
-
|
|
1225
|
-
`chi --remote studio context rm claude-inbox <id>`.
|
|
1235
|
+
Claude's answers (its `chi peer say claude`, with `CHI_REMOTE` set; chi
|
|
1236
|
+
web there waits and prints the line) reach chi. chi's sends don't:
|
|
1237
|
+
`claude_send` writes to Claude's socket on the machine chi runs on, and
|
|
1238
|
+
the laptop's isn't there. So through a remote (`CHI_REMOTE`, or `--remote
|
|
1239
|
+
NAME` in `CHI`) `pair` pairs for answers only (no address) and prints one
|
|
1240
|
+
line saying chi there can't send to this Claude: chi's replies reach
|
|
1241
|
+
Claude only when you relay them (or ask it to run `chi --remote studio
|
|
1242
|
+
send --wait <id>`).
|
|
1226
1243
|
**Two-way over SSH.** SSH can forward a Unix socket, so the inbox leg
|
|
1227
1244
|
works too. Claude's skill runs, on the laptop:
|
|
1228
1245
|
|
|
@@ -1244,7 +1261,7 @@ Claude pairs; without one the bundle costs one tool declaration.
|
|
|
1244
1261
|
2FA, can't reach the host, or the server refuses the forward
|
|
1245
1262
|
(`AllowStreamLocalForwarding no`), it prints the two ssh lines for you to run
|
|
1246
1263
|
in a terminal and the pair line, and pairs nothing. A re-pair this way
|
|
1247
|
-
|
|
1264
|
+
gives an answers-only pairing its address. Claude's
|
|
1248
1265
|
socket changes when that Claude session restarts: run `pair-remote` again.
|
|
1249
1266
|
If the host and the remote name point at different machines the pairing
|
|
1250
1267
|
succeeds and `/claude` shows the socket missing. A path chi quotes (a
|
|
@@ -1253,27 +1270,25 @@ Claude pairs; without one the bundle costs one tool declaration.
|
|
|
1253
1270
|
session (sshd makes it the user's, mode 0600 by default): fine on your own
|
|
1254
1271
|
machine or pod, not a shared host. Codex has no socket: codex-peer has no
|
|
1255
1272
|
`pair-remote`.
|
|
1256
|
-
- **A continue.** The pairing
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
`claude-inbox` last had:
|
|
1273
|
+
- **A continue.** The pairing and the mailbox stay with the old session when
|
|
1274
|
+
you continue it ([peers.md](peers.md#continuing-a-session)). The new
|
|
1275
|
+
session's worker posts Claude one message, from a quiet init task, to the
|
|
1276
|
+
socket the old session's pairing names:
|
|
1261
1277
|
|
|
1262
1278
|
```
|
|
1263
1279
|
chi <old> · moved · continued as <new id>
|
|
1264
|
-
This chi session was continued as <new id>. Pair with <new id> the way you paired with <old>, then answer there (chi
|
|
1280
|
+
This chi session was continued as <new id>. Pair with <new id> the way you paired with <old>, then answer there (chi peer say claude <new id> …).
|
|
1265
1281
|
```
|
|
1266
1282
|
|
|
1267
1283
|
Claude's skill pairs again with the new id the same way it paired before
|
|
1268
|
-
(the same `CHI_REMOTE`; over SSH, `pair-remote` with the new id). It is
|
|
1269
|
-
under the bundle's `sessions/<id>/`, so a worker
|
|
1270
|
-
again); a post that fails (that Claude session
|
|
1271
|
-
dropped. An
|
|
1272
|
-
|
|
1273
|
-
<id>`), and the skill pairs again and
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
`(Claude pairs again when it next answers)`.
|
|
1284
|
+
(the same `CHI_REMOTE`; over SSH, `pair-remote` with the new id). It is
|
|
1285
|
+
posted once (a marker under the bundle's `sessions/<id>/`, so a worker
|
|
1286
|
+
restart doesn't post it again); a post that fails (that Claude session
|
|
1287
|
+
ended) is logged and dropped. An answers-only pairing has no address to
|
|
1288
|
+
post to: Claude's next say to the old id is refused with the new one
|
|
1289
|
+
(`this session was continued as <id>`), and the skill pairs again and says
|
|
1290
|
+
the answer there. What Claude said that the old session hadn't read
|
|
1291
|
+
reaches the new one as one note.
|
|
1277
1292
|
- **Asking first.** The tool has no `targets:`, so guardrails match it by name
|
|
1278
1293
|
only: to be asked before each send, add a rule ([Rules in
|
|
1279
1294
|
config.yml](guardrails.md#rules-in-configyml)):
|
|
@@ -1297,10 +1312,13 @@ Claude pairs; without one the bundle costs one tool declaration.
|
|
|
1297
1312
|
bypasses permissions holds it for approval (in `-p` it expires after 5
|
|
1298
1313
|
minutes). It is local only (a Unix socket), but it does hand session
|
|
1299
1314
|
content to another agent: only what the model or you picked.
|
|
1300
|
-
- **Needs chi
|
|
1301
|
-
`Samagotchi::Plugin::Peer`
|
|
1302
|
-
peer
|
|
1303
|
-
bundle sets its strings
|
|
1315
|
+
- **Needs the chi that has the mailbox** (`chi.peer`, `ctx.peers`, `chi
|
|
1316
|
+
peer`; `chi update`): the plugin is built on `Samagotchi::Plugin::Peer`
|
|
1317
|
+
(lib/samagotchi/plugin/peer.rb), the base both peer bundles share (the
|
|
1318
|
+
tools, `/claude`, the cards, payloads), and each bundle sets its strings
|
|
1319
|
+
and transport. An older claude-peer (it declared `chi.peer_source`) fails
|
|
1320
|
+
to load on this chi with "upgrade this bundle", and chi starts without it:
|
|
1321
|
+
[peers.md](peers.md#upgrading-from-an-older-peer-bundle).
|
|
1304
1322
|
|
|
1305
1323
|
## The codex-peer bundle
|
|
1306
1324
|
|
|
@@ -1320,14 +1338,14 @@ skill install card, the web's linked send and answer: "Codex answered") works th
|
|
|
1320
1338
|
`codex queue --thread <uuid> --message <text>` (an argv, no shell), which
|
|
1321
1339
|
wakes an idle Codex TUI: the message runs there as a new user turn (checked
|
|
1322
1340
|
on Codex 0.162.1; a message queued mid-turn runs after the turn). The
|
|
1323
|
-
thread is the
|
|
1341
|
+
thread is the pairing's address, Codex's `CODEX_THREAD_ID`, which
|
|
1324
1342
|
must look like a UUID. `codex` is `$CODEX`, else `codex` on the PATH: a
|
|
1325
1343
|
worker started by `chi web` or launchd may have another PATH than your
|
|
1326
1344
|
shell, so set `CODEX=` where chi runs if the error says there's no codex.
|
|
1327
1345
|
The tool and the anytime `/codex` wait for `codex queue` up to 10 s; a
|
|
1328
1346
|
queue that takes longer is killed (its process group) and the send fails
|
|
1329
|
-
with a timeout error, never a hang. Other errors say what to do:
|
|
1330
|
-
|
|
1347
|
+
with a timeout error, never a hang. Other errors say what to do: not
|
|
1348
|
+
paired (pair from Codex), a thread Codex has no record of (that
|
|
1331
1349
|
Codex session is gone: pair again), an ephemeral thread
|
|
1332
1350
|
(`codex exec --ephemeral` can't take queued messages), or `codex queue`'s
|
|
1333
1351
|
first error line. A Codex session that was closed (`/quit`) is not gone:
|
|
@@ -1336,38 +1354,38 @@ skill install card, the web's linked send and answer: "Codex answered") works th
|
|
|
1336
1354
|
pair again from a new one). The status card shows the thread id and says
|
|
1337
1355
|
so; there is no cheap check that the session is open.
|
|
1338
1356
|
- **Codex's sandbox.** Pairing and every reply write chi's state
|
|
1339
|
-
(`chi
|
|
1357
|
+
(`chi peer pair`/`say` write the session's mailbox files directly),
|
|
1340
1358
|
which Codex's default sandbox (workspace-write) refuses. The user adds, to
|
|
1341
1359
|
`$CODEX_HOME/config.toml` (else `~/.codex/config.toml`):
|
|
1342
1360
|
|
|
1343
1361
|
```toml
|
|
1344
1362
|
[sandbox_workspace_write]
|
|
1345
|
-
writable_roots = ["/Users/you/.local/state/samagotchi/
|
|
1363
|
+
writable_roots = ["/Users/you/.local/state/samagotchi/mailbox"]
|
|
1346
1364
|
```
|
|
1347
1365
|
|
|
1348
|
-
and restarts Codex. Only chi's `
|
|
1349
|
-
also holds guardrails, session files, plugins and the web token.
|
|
1366
|
+
and restarts Codex. Only chi's `mailbox/` folder: the state folder above it
|
|
1367
|
+
also holds guardrails, session files, plugins and the web token. A config
|
|
1368
|
+
from an older skill names `…/samagotchi/context`: change it.
|
|
1350
1369
|
`/codex install-skill`'s card shows the line with your state folder
|
|
1351
|
-
(absolute: config.toml doesn't expand `~`),
|
|
1352
|
-
when
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1370
|
+
(absolute: config.toml doesn't expand `~`), `--yes` makes the folder so the
|
|
1371
|
+
root exists when Codex restarts, and the pair script names the line when a
|
|
1372
|
+
write is refused ("Operation not permitted"). chi never edits Codex's
|
|
1373
|
+
config. Reading a payload file needs nothing: the default sandbox reads
|
|
1374
|
+
anywhere. With chi on this machine no network is needed: a say writes
|
|
1375
|
+
files, and chi wakes on them (a stopped worker can't be started from inside
|
|
1376
|
+
the sandbox: the say says so, and chi reads the message at its next start). Through a remote it is the other way
|
|
1356
1377
|
round (HTTP, not files): see **chi on another machine** below.
|
|
1357
1378
|
- **Pairing** is Codex's, as with Claude: `/codex install-skill` copies the
|
|
1358
1379
|
bundle's `scripts/chi-peer-SKILL.md` to
|
|
1359
1380
|
`$CODEX_HOME/skills/chi-peer/SKILL.md` (else `~/.codex/…`), with the
|
|
1360
1381
|
installed `scripts/pair` path, the payload folder and the writable root
|
|
1361
1382
|
written in; in Codex you say "pair with chi <id or chi web URL>", and
|
|
1362
|
-
`sh <bundle>/scripts/pair`
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
claude-peer's does, and Codex can send a message unasked (no `re`) the same
|
|
1369
|
-
way. The session's peer exchange log keeps sends and answer summaries, not
|
|
1370
|
-
answer texts.
|
|
1383
|
+
`sh <bundle>/scripts/pair` runs `chi peer pair codex <id> --address
|
|
1384
|
+
<thread id>` (a re-pair refreshes it). Run outside Codex (no
|
|
1385
|
+
`CODEX_THREAD_ID`) it refuses. Codex replies with `chi peer say codex <id>
|
|
1386
|
+
--wake --re <the ref: line> --summary … --wait 8` and quotes the line to
|
|
1387
|
+
you. The note holds the message's text as claude-peer's does, and Codex can
|
|
1388
|
+
send a message unasked (no `--re`) the same way.
|
|
1371
1389
|
- **Peer messages are user turns in Codex.** Claude Code marks an inbox
|
|
1372
1390
|
message as from another session; `codex queue` lands as a plain user
|
|
1373
1391
|
message. So Codex's skill starts with the rule: a message whose first line
|
|
@@ -1380,11 +1398,11 @@ skill install card, the web's linked send and answer: "Codex answered") works th
|
|
|
1380
1398
|
more.
|
|
1381
1399
|
- **chi on another machine.** As with Claude, `CHI_REMOTE=studio sh
|
|
1382
1400
|
<bundle>/scripts/pair <id>` (or `--remote NAME` in `CHI`) pairs through
|
|
1383
|
-
the Studio's chi web, and only
|
|
1401
|
+
the Studio's chi web, and only Codex's answers reach chi: `codex_send` runs
|
|
1384
1402
|
`codex queue` on the machine chi runs on, where this Codex's thread isn't.
|
|
1385
|
-
Claude's `--inbox-socket` trick doesn't apply here:
|
|
1386
|
-
|
|
1387
|
-
|
|
1403
|
+
Claude's `--inbox-socket` trick doesn't apply here: the address is a thread
|
|
1404
|
+
id, not a socket, so there is nothing to forward through SSH. So `pair`
|
|
1405
|
+
pairs for answers only (no address) and prints one line saying chi there
|
|
1388
1406
|
can't send to this Codex. Through a remote chi talks HTTP, not files, so
|
|
1389
1407
|
`writable_roots` doesn't matter; Codex's sandbox may block the network
|
|
1390
1408
|
instead, which pairing and every reply then need (workspace-write has none
|
|
@@ -1397,15 +1415,16 @@ skill install card, the web's linked send and answer: "Codex answered") works th
|
|
|
1397
1415
|
Codex's names, and on a missing answer points to Codex being mid-turn or
|
|
1398
1416
|
its sandbox (the `writable_roots` line). To be asked before each send, a
|
|
1399
1417
|
guardrails rule with `tool: codex_send` (see the claude-peer section).
|
|
1400
|
-
- **The peer loop** works as claude-peer's:
|
|
1401
|
-
peer
|
|
1402
|
-
and `VERDICT OK` wakes chi once to close the round
|
|
1403
|
-
|
|
1418
|
+
- **The peer loop** works as claude-peer's: Codex is declared a peer
|
|
1419
|
+
(`chi.peer codex`), its messages wake chi up to `peer.turns` turns in a
|
|
1420
|
+
row, and `VERDICT OK` wakes chi once to close the round; `codex_read`
|
|
1421
|
+
reads a long message. Needs the chi that has the mailbox; an older
|
|
1422
|
+
codex-peer fails to load there with "upgrade this bundle".
|
|
1404
1423
|
- **A continue** works as claude-peer's: the new session queues Codex the
|
|
1405
|
-
`moved` message on the thread the old
|
|
1424
|
+
`moved` message on the thread the old session's pairing names, once, and
|
|
1406
1425
|
Codex's skill pairs again with the new id (the same `CHI_REMOTE`, if any).
|
|
1407
|
-
|
|
1408
|
-
|
|
1426
|
+
An answers-only pairing has no address: Codex pairs again when its next
|
|
1427
|
+
say is refused. A closed Codex session still takes the message; it waits
|
|
1409
1428
|
for `codex resume` there.
|
|
1410
1429
|
|
|
1411
1430
|
## The ruby bundle
|
data/docs/cli.md
CHANGED
|
@@ -22,14 +22,15 @@
|
|
|
22
22
|
- `chi note [--source NAME] [-m TEXT] (ID|PREFIX)... | --all` — add a context note (TEXT or stdin) to sessions: background the model sees on its next turn; it starts no turn (see [Sessions: Context notes](sessions.md#context-notes))
|
|
23
23
|
- `chi broadcast [-m TEXT] [--all] [--dry-run]`, `chi broadcast log [--last N] [--format json]`, `chi broadcast deliver BROADCAST_ID (ID|PREFIX)...` — share one piece of information (TEXT or stdin) with every session it may concern, as a context note from `broadcast` (see [Broadcast](broadcast.md))
|
|
24
24
|
- `chi context <add|push|ls|show|refresh|rm|mute|unmute> …` — attach live external text to sessions (a command chi runs every so often, or text pushed in); the model gets a short note when it changes and reads it with `context_read`; `chi context add <URL>` attaches a GitHub PR with the github-pr bundle; `chi context push NAME -m TEXT` (the long form is `--message TEXT`) gives a `--push` source its new text, read from stdin when no `-m` is given (see [Attached context](context.md))
|
|
25
|
+
- `chi peer pair|unpair|say|ls …` — a peer agent's side of a session (a Claude Code or Codex session paired with it; see [Peers](peers.md)): `pair NAME ID [--address ADDR] [--from TEXT]` pairs (refused for a continued session, naming its next id, and for a live worker older than the mailbox: restart it), `unpair NAME ID` ends the pairing (its messages stay), `say NAME ID (--wake|--nowake) [--summary TEXT] [--re REF] [-m TEXT] [--wait SECONDS]` leaves a message and prints what chi did with it (`#12 received · woke chi`, `held: … · waits for the user's next message`, `noted`, or why it can't say yet), `ls ID [--format json]` the session's peers, their messages and receipts. A refusal exits 1 (nothing written), a usage error 2; `--remote` runs it through that machine's chi web, which waits for the say
|
|
25
26
|
- `chi context report [--days N]` — the candidate judge's counts from `context_candidates.jsonl`: candidates proposed, mentioned, attached or declined by you; the judge's asks; what it would attach per threshold, and how that agrees with what you did (this machine only; see [The log and the report](context.md#the-log-and-the-report))
|
|
26
27
|
- `chi send [-m TEXT] [--image PATH]... [--cut | --queue] [--as NAME] (ID|PREFIX)...` — send a message to sessions as if typed there (from an agent, as that agent: `--as NAME` or its marker, see [An agent's messages](sub-agent.md#an-agents-messages-driver-and-visitor); `--new --driver NAME` names a new session's driver): a turn starts (or a running one takes it at its next step; `--cut` asks it to cut long thinking for it; `--queue` runs it as a turn of its own after the running one, and `--queue --wait` waits for that turn's own answer); piped stdin goes above `-m` as quoted context, and `--image` attaches images (see [Sessions: Sending a message](sessions.md#sending-a-message)); to a session that was continued it goes to its chain's newest link (`3f9a1c2e → 7b2d41aa (continued) sent`; the old link stays archived; one being continued right now waits up to 10 s for its new link, then `refused: being continued as 7b2d41aa; send again in a moment`), so a chain's first id is a stable address; `--new` starts a session with it instead (`--new --continues ID|last:ID` the next link of that session's chain, see [Session chains](sessions.md#session-chains)), and `--wait` prints the answer (`--wait ID` with no message waits for the next reply without sending — to an idle session whose last turn already ended, that ended turn's reply or end comes back; `--wait --turn T ID` with no message waits for exactly turn T, whether running, queued or last ended; `--format json` includes its `turn_id` when known, for waiting again after exit 3 or 4; exit 3 a question waits, its options on stderr; exit 4 `--timeout` passed with the turn still running; see [Starting a session](sessions.md#starting-a-session))
|
|
27
28
|
- `chi answer ID --question QID (--option N|LABEL)... [--text T] [--timeout S] [--format json]` (or `--dismiss`) — answer the question a session waits on (the one `chi send --wait` exited 3 with), then wait and print what comes next as `chi send --wait` does: the reply (0), the next question (3), still running after `--timeout` (4). `--option` is 1-based or the label, repeated on a multi-select question; `--text` is free text, or a Deny's reason; `--dismiss` leaves it unanswered and the model finishes its reply. A question no longer open (the web answered first) isn't answered again: it waits for that turn's reply. An option the question doesn't offer exits 2; a worker that is gone exits 1 (`send the task again: chi send --wait -m "…" ID`). What a parent may pick follows `guardrails.parent_answers`, or the session's own `parent_answers` when stricter (`soft`, the default: a deny, a plain answer, Continue and "Allow once"; `standard`: no allow; `hard`: no Continue either), never a wider scope or an allow on chi's own config; a refused pick exits 1 with what to answer instead (a convention, not a security boundary; see [Guardrails](guardrails.md#answers-from-a-parent-agent))
|
|
28
|
-
- `chi schedule <add|list|show|tick|run-now|enable|disable|cancel>` — durable schedules on this machine: a prompt with a clock that fires out of no worker (cron, systemd, or chi web's hub with `schedule.auto_tick`), as the next link of a session's chain or as a turn in the session itself (see [Scheduling](scheduling.md) and [Durable schedules](#durable-schedules-chi-schedule)). A usage error exits 2, an unknown session or schedule 1; `chi --remote X schedule list` exits 2
|
|
29
|
+
- `chi schedule <add|edit|list|show|tick|run-now|enable|disable|cancel>` — durable schedules on this machine: a prompt with a clock that fires out of no worker (cron, systemd, or chi web's hub with `schedule.auto_tick`), as the next link of a session's chain or as a turn in the session itself (see [Scheduling](scheduling.md) and [Durable schedules](#durable-schedules-chi-schedule)). A usage error exits 2, an unknown session or schedule 1; `chi --remote X schedule list` exits 2
|
|
29
30
|
- `chi remote add NAME URL [--token-file F | --token-stdin]`, `chi remote ls`, `chi remote rm NAME` — the other machines whose chi web the session commands reach with `--remote NAME` (see [Remote sessions](#remote-sessions))
|
|
30
31
|
- `chi share ID --name NAME [--identity EMAIL] [--expires 3d] [--cap 2]`, `chi share ls [ID]`, `chi share cap ID P DOLLARS`, `chi share revoke ID [P] | --all` — invite a participant into a session through chi web on the LAN, whose turns act under your guardrails (a link of their own, 7 days, a $2 spending cap), list them, change one's cap, revoke them (see [Participants](#participants))
|
|
31
32
|
- `chi mcp serve` — chi as an MCP server on stdio: an MCP host (Claude Code, Codex) drives the sessions with four tools (`chi_sessions`, `chi_ask`, `chi_wait`, `chi_answer`); `claude mcp add chi -- chi mcp serve`. chi web serves the same at `POST /api/mcp` (see [chi as an MCP server](mcp-server.md))
|
|
32
|
-
- `chi --remote NAME send|answer|note|context|sessions|share|mcp …` (or `CHI_REMOTE=NAME`) — those commands on that machine's sessions, through its chi web (see [Remote sessions](#remote-sessions))
|
|
33
|
+
- `chi --remote NAME send|answer|note|context|peer|sessions|share|mcp …` (or `CHI_REMOTE=NAME`) — those commands on that machine's sessions, through its chi web (see [Remote sessions](#remote-sessions))
|
|
33
34
|
- `chi --remote NAME --attach ID` (`--resume ID`, `--dir DIR [-p TEXT]`) — the attached TUI on a session of that machine (see [Remote sessions](#remote-sessions))
|
|
34
35
|
- `chi memory ls [--scope project|system] [--format text|json]` — the memories of both scopes (this folder's project first), one row each: scope, name, size, date, `from <bundle>`, the index description and its model overlays; `chi memory rm NAME [--scope project|system]` removes one as `memory_write` with `remove: true` does: its file and model overlays go to the bundle trash (the line names the dir; `chi bundle trash` lists and empties it) and its index line is dropped. NAME in both scopes without `--scope` exits 2 naming both; a missing NAME or a bundle's memory (`chi bundle uninstall` removes it) exits 1. `chi memory usage [--scope project|system] [--top N] [--format text|json]` reports what the memories cost over the saved sessions: each scope's index tokens and how many of its lines name a memory nobody read, the memories read most by tokens, and the user's own memories no saved session read (`--top` caps the rows per section, 10; no sessions says so and exits 0) — see [Memory: What the memories cost](memory.md#what-the-memories-cost)
|
|
35
36
|
- `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))
|
|
@@ -40,7 +41,7 @@
|
|
|
40
41
|
- `chi project`, `chi project init [--new-id | --merge-subfolders] [DIR]` — this folder's project, and making a folder in no git repository one. `chi project` prints how its project was found (`kind` `git`, `marker` or `none`), its `root`, its `top` (where the AGENTS.md chain starts), a marked project's `id` (what its memories and project context are keyed on; else the root's path is) and its project `memories` folder, with a `note` for a marker a repository makes ignored, or a `$HOME` that is a git repository. `init` writes `DIR/.chi/project.yml` with a new `id:` (DIR defaults to this folder and is created when missing), so DIR and every subfolder share one memories folder (kept when DIR moves or is renamed), group their sessions and take `chi context --project`; it writes nothing in a git repository (the repository already is the project, exit 0), says so (with the id) for a folder already marked, refuses `$HOME`, a folder above it and `/` (exit 1), and marks a folder inside another marked project as its own, nested one. On a folder marked without an id (an older chi's marker) it adopts one: the folders keyed by its path move to the id, each leaving a link by its old name, and it says what moved and names memories an earlier path left (refused, exit 1, while a session of the project runs). `--new-id` gives a marked folder a fresh id with a copy of its memories and project context (a copied folder going its own way; refused elsewhere, exit 1). Memories a session on this machine saved in a subfolder before init (keyed by that subfolder's path) are named by `init` and by `chi project` (a `note`); `--merge-subfolders` moves them into the project's memories folder (marking DIR first when it isn't yet): a memory the project has by that name, or a bundle's, stays and is named, an emptied folder is removed; refused, exit 1, while a session in DIR runs; not with `--new-id` (exit 2). It prints the root, the id and the memories folder (with the memories already there: a folder chi ran in at its top keeps them, moved to the id), the running sessions in DIR to restart (`chi sessions restart ID`: their prompt keeps the old project) and, when DIR has saved sessions, that a running chi web groups them after its restart. This machine only. See [Projects without git](memory.md#projects-without-git)
|
|
41
42
|
- `chi bundle install|upgrade|uninstall|status|diff|list|build|trash|new|test|check` — manage memory bundles (see [Plugins](plugins.md) and [Bundle hooks](hooks.md#bundle-hooks)); `list` shows the installed ones and the ones shipped with chi, which `install <name>` installs; `upgrade <name>` upgrades an installed bundle by name from the source it came from (its folder, archive or git URL), `upgrade <source>` from a new one; `core` and `dev` are profiles that install a set of them (see [Bundle profiles](memory.md#bundle-profiles-core-and-dev), [Guardrails](guardrails.md), [Bundles](bundles.md#the-btw-bundle), [the mcp bundle](bundles.md#the-mcp-bundle) [the loop-guard bundle](bundles.md#the-loop-guard-bundle), [the check-in bundle](bundles.md#the-check-in-bundle) and [the skills bundle](bundles.md#the-skills-bundle)). `trash` lists and empties the bundle trash (moved files from uninstalls/upgrades). `install`/`upgrade` `--force` overwrites existing entries and also installs a bundle whose `requires_chi` this chi doesn't meet and a memory, plugin or script whose bytes disagree with its manifest `sha256`; without it such a bundle or file is refused (exit 1), nothing written. `install` and `upgrade` (`--dry-run` too) start with the bundle and its version: `NAME OLD → NEW` when it changes, `NAME VERSION` when it doesn't (or for a new install), and `NAME VERSION (already current)` when the run writes nothing, in place of the `Up to date: …` line. A plain `install` of a bundle that is already installed from the same source rewrites its rules, plugin, scripts and record: the summary lists a file that already holds the bundle's bytes as `Up to date: …`, one you wrote as `Skipped: …`, and ends with `NAME was already installed from SOURCE: its rules, plugin and scripts now match it and its record was rewritten` (plus, when a memory was kept, `your own copies of its memories were kept (chi bundle upgrade NAME merges the bundle's changes into them)`). A source with class-file hooks (`hooks/*.rb` or a manifest `hooks:` entry) is refused, `--dry-run` too; an older install's hooks are removed by the next install or upgrade (`Removed (chi no longer loads class-file bundle hooks): …`, an edited one copied to the trash first; see [Class-file hooks are retired](hooks.md#class-file-hooks-are-retired)). `status NAME` lists the bundle's guardrail rules and scripts beside its plugin, each `[ok]`, `[missing]` or `[modified]` (edited: the next install replaces it, its copy kept in the trash; an edited rule doesn't load, so it counts in `issues=`), and `diff NAME` names an edited rule or script with its recorded and current sha256 (chi keeps no base text for them). 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. `new`, `test` and `check` are for writing one: see [Writing a bundle](#writing-a-bundle-new-test-check)
|
|
42
43
|
|
|
43
|
-
- `chi page run NAME [--format text|json]` — run the page script `~/.config/samagotchi/pages/NAME.rb` in a Ruby process of its own (in the pages folder, cut at 30 s with what it started) and store what it built; it prints a summary per block (a text's first lines, a table's labels, first rows and total, a walk's steps), or `error: line N: …` with the script's stderr and "the result of … is kept". `--format json` prints the stored page. `chi page list [--format text|json]` — each page's title and `ran … ago`, `failed … ago (line N)` or `(never ran)`, `changed` when the script changed since. `chi page rm NAME` removes the script and its result. Exit 1 when the script raised, was stopped or broke a limit, when there is no such page or it is already running; 2 for the command line (an unknown flag, a name that isn't lowercase letters, digits and hyphens) — see [Pages](pages.md)
|
|
44
|
+
- `chi page run NAME [--format text|json]` — run the page script `~/.config/samagotchi/pages/NAME.rb` (else an installed bundle's page NAME: [Pages from a bundle](pages.md#pages-from-a-bundle)) in a Ruby process of its own (in the pages folder, cut at 30 s with what it started) and store what it built; it prints a summary per block (a text's first lines, a table's labels, first rows and total, a walk's steps), or `error: line N: …` with the script's stderr and "the result of … is kept". `--format json` prints the stored page. `chi page list [--format text|json]` — each page's title and `ran … ago`, `failed … ago (line N)` or `(never ran)`, `changed` when the script changed since, and the bundle a page comes with (`--format json`: `bundle`, and `script`, the path of the script it runs). `chi page rm NAME` removes the script and its result; a bundle's page is refused, exit 1 ("page NAME comes with the X bundle: uninstall the bundle or write your own …/NAME.rb"). Exit 1 when the script raised, was stopped or broke a limit, when there is no such page or it is already running; 2 for the command line (an unknown flag, a name that isn't lowercase letters, digits and hyphens) — see [Pages](pages.md)
|
|
44
45
|
- `chi guardrails replay [--dry-run] [--threshold T] [--model M]` — seed System 1's record from the approvals this machine's sessions already answered: each ask is judged by the configured model and written to `guardrails/judgments.jsonl` with the answer the user gave, then a per-rule table prints (asks, allowed, denied, would-be auto-allows, false allows, asks with no judgment). A parent agent's answer is not the user's: only its deny is replayed, and only where the parent could have allowed. `--dry-run` judges without writing, `--threshold` overrides `guardrails.system_one.threshold` for the table, `--model` the configured model for this run. Exit 2 when `guardrails.system_one.mode` is off or no `host` is set; a usage error exits 2 (see [System 1](guardrails.md#system-1-experimental))
|
|
45
46
|
- `chi guardrails rule <id>` — print exactly `asks` when that rule is loaded, not disabled and votes `ask` in this `guardrails.mode` for every model; any other line says why not (no such rule, disabled, another mode, it denies, for some models only, rules that failed to load, `guardrails.enabled: false`). Exit 0 either way, 2 for a usage error. It reads config.yml and the installed bundles as a worker does (`GuardrailWiring#rules`) and takes the rule's id, never a command; the [coordinator skill](bundles.md#the-coordinator-bundle) reads it before it merges without asking
|
|
46
47
|
- `chi judgments ls` / `chi judgments report NAME [--days N]` — what [System 1's saved runs](system-one.md) hold: each judgment's digests, runs, labels, failures, models and size; one judgment's counts, p histogram and labels by value. Reads only; local only; `--days` must be a positive whole number.
|
|
@@ -163,7 +164,7 @@ The loop for a bundle you're writing (the whole path: [bundle-authoring.md](bund
|
|
|
163
164
|
bundle chi doesn't ship), `clash` (warn: a name chi ships, or one installed from elsewhere; the sandboxed install
|
|
164
165
|
then forces), `install` (each Installer warning, a `needs` one as warn, and each plugin load failure at
|
|
165
166
|
the source `file:line`; skipped while a placeholder sha is unfilled), `registered` (info: each command, tool,
|
|
166
|
-
hook with its priority, init, toolkit, tool source, peer
|
|
167
|
+
hook with its priority, init, toolkit, tool source, peer and prompt section), `hook-event` (warn: a `chi.on` event chi
|
|
167
168
|
never fires), `fail-closed` (warn: a `chi.on(..., on_error: :fail_closed)` in a plugin whose manifest `plugin:` lacks `required: true`, so a load failure would not deny tool calls; not on an installed bundle's re-check), `settings` (warn: a `--set` the manifest's `settings:` rules out, as config.yml's `bundles:` is told), `api` (warn: a `ctx.*` / `chi.*` call or a keyword this chi's API lacks, read from the source with
|
|
168
169
|
Prism against the API's own classes, on a path that never runs too; written on a local `ctx` / `chi` itself, so a
|
|
169
170
|
`s = ctx.sessions` variable isn't followed; a name the plugin guards with `respond_to?` is left), `boundary` (warn: a `Samagotchi::` name outside "Stable for bundles"; a shipped bundle's listed
|
|
@@ -454,17 +455,28 @@ chi schedule add --session 3f9a1c2e --weekday 1 --time 09:00 -m "Audit the open
|
|
|
454
455
|
# every 30 minutes, as a turn in the session itself
|
|
455
456
|
chi schedule add --continues 3f9a1c2e --every 30m --mode same -m "Check the build"
|
|
456
457
|
|
|
457
|
-
chi schedule list # id mode recurrence next due target [skips 3 of 12 (≈1 h at a 5 min tick)]
|
|
458
|
+
chi schedule list # id name mode recurrence next due target [skips 3 of 12 (≈1 h at a 5 min tick)]
|
|
458
459
|
chi schedule list --all --format json # the disabled ones and the fired one-offs too
|
|
459
|
-
chi schedule show 4b7e9a # the entry in full: anchor, head, prompt, counters
|
|
460
|
+
chi schedule show 4b7e9a # the entry in full: anchor, head, prompt, counters, its last 20 outcomes
|
|
460
461
|
chi schedule tick # fire everything due; quiet when nothing is
|
|
461
462
|
chi schedule tick --dry-run # print what would fire, change nothing
|
|
462
463
|
chi schedule run-now 4b7e9a # fire it now, whatever its next_due says
|
|
463
464
|
chi schedule disable 4b7e9a # stop it, keep it in the file
|
|
464
465
|
chi schedule enable 4b7e9a
|
|
465
466
|
chi schedule cancel 4b7e9a # delete it (by id, a unique prefix, or its title)
|
|
467
|
+
chi schedule edit 4b7e9a --weekday 2 --time 08:30 # change it in place: only the flags given
|
|
468
|
+
chi schedule edit "Monday audit" -m "Audit the open PRs and the queue" --max-skips 24
|
|
466
469
|
```
|
|
467
470
|
|
|
471
|
+
Every `list` row names its schedule: the `--title` it was given, or, when it has
|
|
472
|
+
none, the first 30 characters of its prompt in quotes with `…` where it is cut
|
|
473
|
+
(newlines and runs of spaces become one space). The name column is padded to the
|
|
474
|
+
widest name among the rows printed, so the columns after it line up. `--format json`
|
|
475
|
+
carries `title` as it is stored (`null` with no title) and the whole `prompt`, and the
|
|
476
|
+
quoted stand-in only as `name`; with it `state` (`on`, `firing`, `off`) and `off_reason`
|
|
477
|
+
([scheduling.md](scheduling.md#skip-not-failure)). The `list_schedules` tool names a
|
|
478
|
+
schedule the same way.
|
|
479
|
+
|
|
468
480
|
`add` needs a target (`--session ID`, or `--continues ID` for the same session)
|
|
469
481
|
and exactly one recurrence kind — `--every 45m|2h|1d`, `--weekday 1..7` with
|
|
470
482
|
`--time HH:MM` (local wall clock), or `--date 2026-11-20T09:00` — plus `-m|--message|--prompt TEXT`.
|
|
@@ -475,12 +487,27 @@ how many consecutive failures or busy targets disable it. A blank or over-16-KiB
|
|
|
475
487
|
prompt, two recurrence kinds, a `scratch` target and a `--weekday` without
|
|
476
488
|
`--time` are all refused with exit 2.
|
|
477
489
|
|
|
490
|
+
`edit ID` changes a schedule in place and prints its updated `list` row: `--title`,
|
|
491
|
+
`-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
|
|
493
|
+
change, and the skip and failure counters, `enabled` and the history stay (it adds one
|
|
494
|
+
`edited` row naming the fields). The session and the mode don't change: `--session`,
|
|
495
|
+
`--continues` and `--mode` are refused ("cancel it and add a new one"). A new
|
|
496
|
+
recurrence starts its clock now, as `add`'s does, and is refused while a firing is in
|
|
497
|
+
flight ("a run is in progress; edit the time after it settles", exit 1); a prompt,
|
|
498
|
+
title or budget edit then applies to the next firing. A spent `--date` one-off stays
|
|
499
|
+
disabled after an edit: `chi schedule enable` it. No flag to change, or only values the
|
|
500
|
+
schedule already has, exits 2 ("nothing to change"), as does an edit that would make it
|
|
501
|
+
say what another schedule of the chain says (its new title, or its new prompt and
|
|
502
|
+
recurrence); a missing id exits 1.
|
|
503
|
+
|
|
478
504
|
`tick` prints one line per entry it touched (`fired`, `skipped`, `missed`,
|
|
479
505
|
`failed`, or `would fire` under `--dry-run`), with the reason; nothing due prints
|
|
480
506
|
`no schedules due`, and a tick that finds the lock held by another prints `no
|
|
481
507
|
schedules due (another tick holds the lock)` — both exit 0, so a crontab line
|
|
482
508
|
that runs every five minutes is quiet. `run-now`, `enable`, `disable` and `cancel`
|
|
483
|
-
take the id, a unique prefix of it, or the title
|
|
509
|
+
take the id, a unique prefix of it, or the title (`chi schedule enable coordinator-heartbeat`);
|
|
510
|
+
a missing one exits 1, an ambiguous one 2 naming the matches.
|
|
484
511
|
|
|
485
512
|
Point cron at it (see [Scheduling](scheduling.md#running-the-tick) for systemd
|
|
486
513
|
and launchd), or turn on `schedule.auto_tick` and let chi web's hub tick every
|
|
@@ -1306,6 +1333,17 @@ the keys of sessions gone from the list are dropped when the list loads);
|
|
|
1306
1333
|
other viewers (a participant's browser too) are not affected. A jump into a
|
|
1307
1334
|
folded answer (a claim link, say) unfolds it for that page load.
|
|
1308
1335
|
|
|
1336
|
+
What nobody says in the conversation folds too: a plugin's or chi's own line
|
|
1337
|
+
shown on its own (source-links, skills, cost-cap…), a context note that starts
|
|
1338
|
+
nothing, an objectives line and a plugin's nudge fold into one closed row where
|
|
1339
|
+
the first of them sits, "▸ 3 notes · claude-inbox, source-links, skills". A tap
|
|
1340
|
+
(or a click, Enter, Space) opens it and the items show under it as they are;
|
|
1341
|
+
another closes it. A warning among them marks the row with a yellow edge and
|
|
1342
|
+
"⚠ 1", and it stays closed. Your prompt, the answer, a peer's answer and a note
|
|
1343
|
+
that starts a turn stay as they are, and a time divider or a peer's answer
|
|
1344
|
+
between two items gives each side a row of its own. The row isn't remembered:
|
|
1345
|
+
a reload or another session shows it closed again.
|
|
1346
|
+
|
|
1309
1347
|
**Revise** rewrites an answer and stacks the versions. A finished turn's
|
|
1310
1348
|
final answer has a Revise button on its bottom edge (on hover; always shown
|
|
1311
1349
|
on a touch screen), unless it's a Verify turn's answer, a canceled or failed
|
|
@@ -1682,7 +1720,7 @@ chi remote add studio http://192.168.1.29:4567 --token-file studio-token
|
|
|
1682
1720
|
# studio http://192.168.1.29:4567 chi 0.103.0, LAN 192.168.1.29
|
|
1683
1721
|
chi --remote studio send --new --dir /Users/me/projects/app --wait -m "fix the flaky spec"
|
|
1684
1722
|
chi --remote studio answer ab12 --question q1 --option 1
|
|
1685
|
-
CHI_REMOTE=studio chi
|
|
1723
|
+
CHI_REMOTE=studio chi peer say claude ab12 --wake --summary "validate x: VERDICT OK" --wait 8 < answer.txt
|
|
1686
1724
|
```
|
|
1687
1725
|
|
|
1688
1726
|
- `chi remote add NAME URL` checks the address and token first (`GET
|