samagotchi 0.186.0 → 0.188.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 +68 -1
- data/bin/chi +4 -0
- data/docs/architecture.md +8 -4
- data/docs/bundles.md +124 -120
- data/docs/cli.md +26 -5
- data/docs/configuration.md +4 -4
- data/docs/context.md +18 -162
- data/docs/guardrails.md +3 -1
- data/docs/hooks.md +2 -1
- data/docs/internals/attached-context.md +19 -37
- data/docs/internals/bridge.md +1 -0
- data/docs/internals/engine.md +2 -2
- data/docs/internals/inline-widgets.md +18 -0
- data/docs/internals/llm-context-forget.md +5 -6
- data/docs/internals/objectives.md +1 -0
- data/docs/internals/pages.md +175 -0
- data/docs/internals/peers.md +149 -0
- data/docs/internals/remote-sessions.md +7 -4
- data/docs/internals/web-frontend.md +65 -40
- data/docs/internals/web-push.md +1 -1
- data/docs/memory.md +8 -1
- data/docs/pages.md +151 -0
- data/docs/peers.md +141 -0
- data/docs/plugins.md +52 -27
- data/docs/sessions.md +8 -4
- data/docs/sub-agent.md +5 -5
- 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/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/skills/manifest.yml +2 -2
- data/lib/samagotchi/bundles/skills/plugin.rb +14 -8
- data/lib/samagotchi/bundles/system/manifest.yml +5 -2
- data/lib/samagotchi/bundles/system/self_map.md +5 -1
- data/lib/samagotchi/bundles/system/skill_pages.md +93 -0
- 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 +73 -0
- data/lib/samagotchi/log_line.rb +1 -1
- data/lib/samagotchi/note_move.rb +3 -1
- data/lib/samagotchi/page_command.rb +243 -0
- data/lib/samagotchi/pages/builder.rb +186 -0
- data/lib/samagotchi/pages/launch.rb +193 -0
- data/lib/samagotchi/pages/runner.rb +154 -0
- data/lib/samagotchi/pages/store.rb +152 -0
- data/lib/samagotchi/pages.rb +119 -0
- data/lib/samagotchi/peer_command.rb +192 -0
- data/lib/samagotchi/peer_continue.rb +99 -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 -1
- data/lib/samagotchi/schedule_command.rb +10 -3
- data/lib/samagotchi/schedule_display.rb +32 -0
- data/lib/samagotchi/session_access/contract.rb +19 -2
- data/lib/samagotchi/session_access/local.rb +132 -14
- data/lib/samagotchi/session_access/remote.rb +4 -2
- data/lib/samagotchi/session_access/remote_peers.rb +75 -0
- data/lib/samagotchi/session_continue.rb +12 -0
- data/lib/samagotchi/session_inbox_delivery.rb +5 -2
- data/lib/samagotchi/session_manager/delivery.rb +5 -3
- data/lib/samagotchi/session_manager/removal.rb +2 -0
- data/lib/samagotchi/session_manager/spawn.rb +2 -1
- data/lib/samagotchi/session_manager.rb +1 -0
- data/lib/samagotchi/session_stores.rb +17 -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 +4 -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/context_read.rb +0 -14
- data/lib/samagotchi/tools/list_schedules.rb +8 -3
- data/lib/samagotchi/version.rb +1 -1
- data/lib/samagotchi/web/app.rb +7 -18
- data/lib/samagotchi/web/message_display.rb +4 -2
- data/lib/samagotchi/web/page_routes.rb +116 -0
- data/lib/samagotchi/web/peer_routes.rb +133 -0
- data/lib/samagotchi/web/public/app.js +35 -95
- 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 +16 -0
- data/lib/samagotchi/web/public/notify.js +1 -1
- data/lib/samagotchi/web/public/page_blocks.js +58 -0
- data/lib/samagotchi/web/public/page_links.js +33 -0
- data/lib/samagotchi/web/public/page_model.js +68 -0
- data/lib/samagotchi/web/public/page_route.js +24 -0
- data/lib/samagotchi/web/public/page_table.js +74 -0
- data/lib/samagotchi/web/public/page_table_model.js +76 -0
- data/lib/samagotchi/web/public/page_view.js +219 -0
- data/lib/samagotchi/web/public/pages.css +77 -0
- data/lib/samagotchi/web/public/pages_group.js +65 -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 +161 -0
- data/lib/samagotchi/web/push/attention.rb +3 -2
- data/lib/samagotchi/web/session_access_routes.rb +3 -20
- data/lib/samagotchi/web/viewer.rb +1 -1
- 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 +39 -2
- data/lib/samagotchi/peer_sources.rb +0 -58
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3b9e5ec4891e42a2a7c38c7f3adb595d8738e2a7cabc471bcf6b440298d98164
|
|
4
|
+
data.tar.gz: e5a2a8d96a359921935b05fb9952e892c8611b14837193b79750f3a88bdcd880
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d4af9fec473330c198f0aa57991eb7447cedf18a37cc3bb45b66980490f527bcf1bcac96bf329e38996540b5e8315ac9ab40262580523a607a964e747a1b7895
|
|
7
|
+
data.tar.gz: 58a8c06f5d6e8093c07c5f53c5268d3566bb8a3c4afa06fd2868ef06670be4e3da07cc8489981347a891f64589e20375a0b9c0fc58161c3374e025a3abcc3243
|
data/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,71 @@ and commands may change between minor versions. How releases are made:
|
|
|
8
8
|
|
|
9
9
|
## [Unreleased]
|
|
10
10
|
|
|
11
|
+
## [0.188.0] - 2026-11-24
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- `chi peer pair|unpair|say|ls` (also through `--remote`), `claude_read` / `codex_read` for a long message, and chi
|
|
16
|
+
web's `…/peers` routes (a message's text, Unpair, a remote's pair and say).
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- **Breaking:** peers (claude-peer, codex-peer) talk to chi through a mailbox, not attached context
|
|
21
|
+
([docs/peers.md](docs/peers.md)). Each message from Claude or Codex is its own note, in order, with its text;
|
|
22
|
+
`chi peer say` prints what chi did with it (`#12 received · woke chi`, or `held: 3 peer turns in a row (peer.turns)
|
|
23
|
+
· waits for the user's next message`), and the peer chip's list says it too. The `claude-inbox` / `claude-outbox`
|
|
24
|
+
(`codex-…`) context sources are gone, with no compatibility. To upgrade:
|
|
25
|
+
1. `chi update` (claude-peer and codex-peer need this chi; an older peer bundle fails to load with "upgrade this
|
|
26
|
+
bundle", and chi starts without it).
|
|
27
|
+
2. In Claude Code: `/claude install-skill`, Replace. In Codex: `/codex install-skill`, and change its
|
|
28
|
+
`writable_roots` line in `config.toml` from `…/samagotchi/context` to `…/samagotchi/mailbox`.
|
|
29
|
+
3. Pair again (`pair with chi <id>`). Until then `/claude` says "paired the old way: pair again".
|
|
30
|
+
- **Breaking:** `context.peer_turns` is renamed `peer.turns` (no alias: an old key in config.yml or the environment is ignored, so
|
|
31
|
+
rename it). `peer.turns: 0` means a peer's message never wakes chi; `context.wake` no longer applies to peers.
|
|
32
|
+
- A continue leaves a peer's pairing with the previous session, as before: the peer is told the new id and pairs
|
|
33
|
+
again; what it said that the old session hadn't read reaches the new one as one note.
|
|
34
|
+
- **Breaking:** plugins: `chi.peer_source` is gone (it raises how to upgrade); a peer bundle declares `chi.peer NAME` and reads
|
|
35
|
+
its pairing with `ctx.peers`.
|
|
36
|
+
- `chi schedule list`: each row names its schedule (its title, or the start of its prompt in quotes), so a
|
|
37
|
+
disabled one is easy to tell apart; the name column is padded to the widest name of the rows printed.
|
|
38
|
+
`list_schedules` names them the same way.
|
|
39
|
+
- chi web: plugin lines and context notes under a turn's answer fold into one closed row, "▸ 3 notes · source-links,
|
|
40
|
+
skills, objectives"; tap it to read them. A warning marks the row. Your prompt, the answer, a peer's answer and a
|
|
41
|
+
note that starts a turn stay as they are.
|
|
42
|
+
- skills (0.1.11): "a step failed, the skill wasn't updated" is a warning now (yellow in the web, `warning:` in the
|
|
43
|
+
terminal).
|
|
44
|
+
- skills (0.1.12): a skill a bundle ships (the pages skill, say) no longer gets the "a step failed, update the skill"
|
|
45
|
+
nudge or warning.
|
|
46
|
+
|
|
47
|
+
### Fixed
|
|
48
|
+
|
|
49
|
+
- The system prompt names the real system memories folder when the config lives outside ~/.config.
|
|
50
|
+
- chi web: a message an agent or visitor sent keeps its "agent NAME" label after a reload.
|
|
51
|
+
- chi send / ask_session: a session whose worker is too old for the message reads "refused: ... restart it", not
|
|
52
|
+
"failed: ...".
|
|
53
|
+
- chi web: after a reload, a plugin's line after a turn stays right under that turn instead of moving below the next
|
|
54
|
+
time divider and notes.
|
|
55
|
+
- chi page: a run that finishes just before its 30 s cut keeps its result instead of "stopped after 30 s", and the
|
|
56
|
+
runner's own "stopped" record is no longer overwritten by "ended without a result"; text in another encoding (a
|
|
57
|
+
Latin-1 file) reads right instead of turning into `�`; a cut run leaves no `output.json.*.tmp` behind; a failed run
|
|
58
|
+
keeps fields a newer chi wrote in the page's output.
|
|
59
|
+
- `chi page`: help names the pages folder it reads, including when `XDG_CONFIG_HOME` is set.
|
|
60
|
+
- chi web: a live wake note opens its turn, as it does after a reload.
|
|
61
|
+
|
|
62
|
+
Update with `chi update` (claude-peer 0.7.0, codex-peer 0.6.0, skills 0.1.12, the dev profile 0.7.11).
|
|
63
|
+
|
|
64
|
+
## [0.187.0] - 2026-11-23
|
|
65
|
+
|
|
66
|
+
### Added
|
|
67
|
+
|
|
68
|
+
- Pages: ask chi for "a page of …" and it writes a small Ruby script under the config's `pages/` folder that builds
|
|
69
|
+
text, a table and a walk (the shipped pages skill teaches it how). `chi page run | list | rm` runs, lists and
|
|
70
|
+
removes them; a run gets 30 s, one at a time per page, and a failed run keeps the last result under its failure
|
|
71
|
+
line. In chi web a page opens at `#/p/NAME` (All sessions → Pages, or a `#/p/` link in an answer, in place): Refresh
|
|
72
|
+
runs it again, a table sorts on a desktop and opens its rows on a phone, and ⋯ deletes it. Owner only.
|
|
73
|
+
|
|
74
|
+
Update with `chi update`.
|
|
75
|
+
|
|
11
76
|
## [0.186.0] - 2026-11-23
|
|
12
77
|
|
|
13
78
|
### Added
|
|
@@ -6813,7 +6878,9 @@ and long-lived sessions.
|
|
|
6813
6878
|
- A macOS desktop helper (`chi desktop install`): a "Send to chi" Service and a
|
|
6814
6879
|
hotkey panel that send selected text or the clipboard to your sessions.
|
|
6815
6880
|
|
|
6816
|
-
[Unreleased]: https://github.com/dm1try/samagotchi/compare/v0.
|
|
6881
|
+
[Unreleased]: https://github.com/dm1try/samagotchi/compare/v0.188.0...HEAD
|
|
6882
|
+
[0.188.0]: https://github.com/dm1try/samagotchi/compare/v0.187.0...v0.188.0
|
|
6883
|
+
[0.187.0]: https://github.com/dm1try/samagotchi/compare/v0.186.0...v0.187.0
|
|
6817
6884
|
[0.186.0]: https://github.com/dm1try/samagotchi/compare/v0.185.0...v0.186.0
|
|
6818
6885
|
[0.185.0]: https://github.com/dm1try/samagotchi/compare/v0.184.0...v0.185.0
|
|
6819
6886
|
[0.184.0]: https://github.com/dm1try/samagotchi/compare/v0.183.0...v0.184.0
|
data/bin/chi
CHANGED
|
@@ -75,6 +75,8 @@ SUBCOMMANDS = {
|
|
|
75
75
|
"broadcast" => ["samagotchi/broadcast_command", "BroadcastCommand"],
|
|
76
76
|
# live external text attached to sessions (add, push, ls, show, rm, mute)
|
|
77
77
|
"context" => ["samagotchi/context_command", "ContextCommand"],
|
|
78
|
+
# a peer agent's side of a session: pair, unpair, say (what chi did with it), ls
|
|
79
|
+
"peer" => ["samagotchi/peer_command", "PeerCommand"],
|
|
78
80
|
# a message into sessions as the user's (-m)
|
|
79
81
|
"send" => ["samagotchi/send_command", "SendCommand"],
|
|
80
82
|
# answer the question a session waits on, then wait (--question, --option)
|
|
@@ -91,6 +93,8 @@ SUBCOMMANDS = {
|
|
|
91
93
|
"desktop" => ["samagotchi/desktop_command", "DesktopCommand"],
|
|
92
94
|
# list and remove memories (ls, rm; --scope, --format)
|
|
93
95
|
"memory" => ["samagotchi/memory_command", "MemoryCommand"],
|
|
96
|
+
# pages: scripts that say what to show (run, list, rm)
|
|
97
|
+
"page" => ["samagotchi/page_command", "PageCommand"],
|
|
94
98
|
# install, upgrade, uninstall, status, diff, list, build (--scope, --force, …)
|
|
95
99
|
"bundle" => ["samagotchi/bundle_command", "BundleCommand"],
|
|
96
100
|
# the System 1 record: replay the asks this machine's sessions already answered
|
data/docs/architecture.md
CHANGED
|
@@ -514,8 +514,11 @@ model: [internals/remote-sessions.md](internals/remote-sessions.md).
|
|
|
514
514
|
| `POST /api/sessions/:id/answer` (`wait`) | owner | `wait: N` (seconds, at most 30) beside `id`, `selected`, `freeform` | 200 `{status: answered, session_id, id, reply: {the wait's fields, token while it is timeout}}`; a question answered elsewhere first: 200 `{status: not_pending, answered_here: false, …, reply}` (as `chi answer` still waits); a wait that fails after the answer went in: 200 with that `status` and `wait_error` `{error: server_stopping \| not_found \| wait_failed, detail}` in place of `reply`; without `wait` every answer is as before | 400 `invalid_wait`; 404 |
|
|
515
515
|
| `POST /api/sessions/:id/notes` | owner | `text`, `source` (default `cli`, never `broadcast`) | 200 `{status: queued \| waits, session_id, queued}` (`NoteDelivery`) | 409 `owned_by_tui` (`status: refused`); 400 `note_rejected`, `missing_fields`, `invalid_source` |
|
|
516
516
|
| `POST /api/sessions/:id/context` (more bodies) | owner | `{name, push: true, why, hint}` or `{name, cmd, every, why, hint}` beside the page's `{url, why, hint}`; `added_by` `cli`/`agent` (else `web`); `movable` (any body) | 201 `{status: attached, name, movable}` | 400 `invalid_source`; 409 `exists` |
|
|
517
|
-
| `POST /api/sessions/:id/context/:name/push` | owner | `text`, `summary`, `wake`, `hint
|
|
518
|
-
| `GET /api/sessions/:id/peers` | owner | | 200 `{peers: [{name, label,
|
|
517
|
+
| `POST /api/sessions/:id/context/:name/push` | owner | `text`, `summary`, `wake`, `hint` (a source's JSON output, checked the same way) | 200 `{status: pushed, name, before, revision, changed}` | 404 `not_found`; 409 `not_push`; 410 `context_continued` (`next_id`); 400 `invalid_text` |
|
|
518
|
+
| `GET /api/sessions/:id/peers` | owner | | 200 `{peers: [{name, label, paired_at, from, address, can_send, messages, exchanges}]}`: one row per mailbox folder, its newest 20 messages with their receipts and `words`, last 20 joined exchanges, newest first; no text; files only ([internals/peers.md](internals/peers.md)) | 404 `not_found` |
|
|
519
|
+
| `GET /api/sessions/:id/peers/:name/messages/:serial` | owner | | 200 the message (its text) and its receipt | 404 `no_message`; 400 `invalid_peer` |
|
|
520
|
+
| `DELETE /api/sessions/:id/peers/:name` | owner | | 200 `{unpaired}`: the pairing ends, its messages stay | 400 `invalid_peer` |
|
|
521
|
+
| `POST /api/sessions/:id/peers/:name/pair`, `…/say` | owner | pair: `address`, `from`; say: `text`, `summary`, `wake`, `re`, `wait` (≤ 30: the server waits for the receipt) | pair 200 `{status: paired, link}`; say 200 `PeerSay` and its `line` | 409 refused (`continued` + `next_id`, `old_worker`, …, the same shape); 400 bad name, text or wait |
|
|
519
522
|
| `DELETE /api/sessions/:id/context/:name?own=1` | owner | | 200 `{status: detached}`: the session's own only | 409 `project_source` (chi context rm's words); 404 |
|
|
520
523
|
| `POST /api/sessions/:id/stop` | owner | `wait?` (seconds, capped at `SessionManager::STOP_WAIT`, 10: `chi --remote NAME sessions stop` sends it) | 200 `{status: stopped, session_id, released}`: `released`, whether the worker let go within the wait (without one `STOP_WAIT_SECONDS`, 2 s: the page's Stop) | 409 `owned_by_tui` |
|
|
521
524
|
| `DELETE /api/sessions/:id?force=` | owner | `force=true` stops a live worker first (the page sends it) | as before | 409 `worker_running` without it |
|
|
@@ -672,7 +675,8 @@ A map of the parts the overview above doesn't name (paths under `lib/samagotchi/
|
|
|
672
675
|
| Session file | `session.rb` (`Session`, `Session::FIELDS`), `session_field.rb` (`SessionField`), `session_paths.rb` (`SessionPaths`), `session_setup.rb` (`SessionSetup`) | A session's `<uuid>.json`: one `SessionField` row per key (default, cast, what the file gets; the codec on its type), from which `Session.new`, `.from_h` and `#to_h` are built; `SessionPaths` is where the file and the session's dir are and the id rule, a leaf `Session` extends (so `ArchiveStore` and `ContextSources` name no `Session` constant; both still require session.rb at load); `SessionSetup` the settings a fork and a continue carry (`.of`), applied by member name; every new-session request (chi's run flags, the one-shot, `chi send --new`, chi web's create) builds its setup with `SessionSetup.from_request`, and `spec/session_setup_entrypoints_spec.rb` holds each entrypoint's cell for each member. See [sessions.md](sessions.md#session-file). |
|
|
673
676
|
| Session config (`--set`) | `session_config.rb` (`SessionConfig`, `SessionConfig::Settings`) | A session's own settings as one value (`Session#settings`, `SessionSetup#settings`): `core`, the `--set KEY=VALUE` values of the core keys marked `session: true` (`Config::Entry`), typed by `Config.coerce!` and read first through `Config.get(key, session:)` (`RecapSetup`; `Engine#session=` rebuilds the recap job, `IdleScheduler#replace_job`), file key `config_settings`; `bundles`, the `--set BUNDLE.KEY=VALUE` values, checked against the manifest's `session_settings:`, laid over `bundles: <name>:` in `ctx.settings` ([plugins.md](plugins.md)), file key `bundle_settings`. `SessionConfig.clash` refuses a bundle setting named like a core one (install, `chi bundle check`). See [configuration.md](configuration.md#per-session-settings). |
|
|
674
677
|
| Plugin API | `plugin/api.rb` (`Plugin::Api`), `plugin/tool_spec.rb` (`Plugin::ToolSpec`: a checked tool declaration, how it is registered), `plugin/loader.rb`, `plugin/context.rb` (`ctx`), `plugin/http.rb` + `plugin/http_transport.rb` (`ctx.http`), `plugin/http_stream.rb` (`ctx.http.stream`) + `plugin/sse_reader.rb`, `plugin/http_errors.rb`, `plugin/secrets.rb` (`Plugin::Secrets`, `ctx.secrets`) + `plugin/sign_in.rb` (`Plugin::SignIn`, `ctx.sign_in`), `plugin/card.rb` (`Plugin::Card`) | What a bundle's plugin registers: tools, commands, annotation actions, hooks, services, toolkits, peer sources; what its handlers get as `ctx` ([plugins.md](plugins.md)). |
|
|
675
|
-
| Peer bundles' base | `plugin/peer.rb` (`Plugin::Peer`) | What claude-peer and codex-peer share (the send
|
|
678
|
+
| Peer bundles' base | `plugin/peer.rb` (`Plugin::Peer`), `plugin/peers.rb` (`ctx.peers`) | What claude-peer and codex-peer share (the send and read tools, the command, the cards, payloads, telling the peer a continue's new id); each bundle's subclass sets its strings and transport ([bundles.md](bundles.md#the-claude-peer-bundle)). |
|
|
679
|
+
| Peers | `peer_mailbox.rb` (`PeerMailbox`: the peer's side, `mailbox/<id>/<peer>/`), `peer_receipts.rb` (`PeerReceipts`: chi's side), `peer_registry.rb` (`chi.peer`), `peer_note.rb`, `peer_say.rb`, `peer_command.rb` (`chi peer`), `peer_roster.rb`, `peer_continue.rb`, `worker_inbound/mail.rb` (`absorb_mail`), `web/peer_routes.rb` | A peer agent's messages: one file each, taken by the worker in order as its notes, a receipt each, the say's line ([internals/peers.md](internals/peers.md)). |
|
|
676
680
|
| Shipped bundles | `bundles/` (`mcp`, `github-pr`, `loop-guard`, `skills`, `source-links`, …) | Bundles that ship with chi. |
|
|
677
681
|
| Hooks | `hooks/registry.rb` (`Hooks::Registry`), `hooks/loader.rb`, `hook_routes.rb` (`HookRoutes`), `event_routes.rb` (`EventRoutes`) | Hook registration and dispatch; what a hook or plugin does beyond reading its event (notice, question, stop, steer) routed to the UIs (cards and notices through one set of routes) ([hooks.md](hooks.md)). |
|
|
678
682
|
| Guardrails | `guardrails.rb`, `guardrails/shell_lex.rb`, `guardrails/data_readers.rb`, `guardrails/rules.rb`, `guardrails/protected_paths.rb`, `guardrails/parent_policy.rb` + `guardrails/parent_approvals.rb`, `guardrail_wiring.rb` | The gate before every tool call: shell lexing (and the commands that only read a heredoc as data), YAML rules, the core checks on chi's own files, approvals, what a parent agent may answer (`guardrails.parent_answers`) ([guardrails.md](guardrails.md)). |
|
|
@@ -682,7 +686,7 @@ A map of the parts the overview above doesn't name (paths under `lib/samagotchi/
|
|
|
682
686
|
| Worker link | `worker_link.rb` (`WorkerLink`: `Live`, `Starting`, `Leaving`, `Skew`, `Stale`, `None`), `worker_sidecar.rb` (`WorkerSidecar`) | Whether a session's worker can be reached and the client for it: every Bridge client asks `WorkerLink.resolve` / `.client` / `.await` (*Worker link* above); `WorkerSidecar` is the `bridge.json` it reads. |
|
|
683
687
|
| Session access | `session_access.rb` (`SessionAccess`: `NewSession`, `SetupWords`, `WaitStart`, `SessionView`, `Created`, `ContextEntry`, `ContextPush`, the errors `RemoteFailed`, `RemoteTooOld`, `Refused`, `BadRequest`), `session_access/local.rb` (`SessionAccess::Local`), `session_access/remote.rb` (`SessionAccess::Remote`), `session_access/http_transport.rb`, `session_access/web_bridge_client.rb` (`SessionAccess::WebBridgeClient`, a remote attach's worker through chi web), `session_access/dispatch.rb` (`SessionAccess::Dispatch`), `session_access/contract.rb` (`SessionAccess::Contract`), `remotes.rb` (`Remotes`), `remote_command.rb` (`chi remote`), `web/session_access_routes.rb` (`Web::SessionAccessRoutes`), `session_access/exchange.rb` (`SessionAccess::Exchange`: the stateless pieces of a send and its wait, for chi send, chi answer and the ask), `session_access/exchange/token.rb` (`Exchange::Token`: a wait as one string), `session_access/ask.rb` (`SessionAccess::Ask`: one message in, its answer out), `web/ask_routes.rb` (`Web::AskRoutes`: the thin-client routes) | The seam between the session commands and where the sessions live: `Local` is this machine's (the `SessionManager`, `ReplyWait`, `NoteDelivery`, `ContextSources` and Bridge calls the commands made); `Remote` is another machine's, the same methods as requests to its chi web's routes of the same name (Bearer token, `HTTPTransport`), results as Local's value objects and refusals as the classes Local's callees raise, built from the fields chi web sends; waits and prefixes run on the server, a wait asked again per 30 s slice. `Dispatch` is bin/chi's front for `--remote NAME` / `CHI_REMOTE` (taken off before the subcommand lookup): it refuses what the contract table lists `local_only` (exit 2, one message) and runs the command with a `Remote` on the `Remotes` entry (`$XDG_CONFIG_HOME/samagotchi/remotes.yml`, 0600). chi web's routes answer from `Local` (*chi web's routes for the session commands* above). Checks that read this machine's config or files (vision, parent answers, the cwd's project, `SAMAGOTCHI_PARENT_SESSION`) stay in the commands and are skipped under a `Remote`, where chi web's create, turn and wait routes run the vision, parent-answers and busy checks with the server's config and the worker checks a parent's answer. See [internals/remote-sessions.md](internals/remote-sessions.md). |
|
|
684
688
|
| Idle work | `idle_scheduler.rb` (`IdleScheduler`), `idle_recap.rb` (`IdleRecap`), `idle_reminders.rb` | One poller for an idle session's recap and reminders. |
|
|
685
|
-
| Attached context | `context_sources.rb` (`ContextSources`), `context_poller.rb`, `context_absorber.rb`, `context_candidates.rb` (`ContextCandidates`: proposed sources, attached on the owner's mention at a turn's start, before the worker's absorb, or in a one-shot's turn; `owner_prompt.rb` decides whose words count)
|
|
689
|
+
| Attached context | `context_sources.rb` (`ContextSources`), `context_poller.rb`, `context_absorber.rb`, `context_candidates.rb` (`ContextCandidates`: proposed sources, attached on the owner's mention at a turn's start, before the worker's absorb, or in a one-shot's turn; `owner_prompt.rb` decides whose words count) | External sources a session keeps fresh ([context.md](context.md)). |
|
|
686
690
|
| LLM context strategies | `llm_context_strategy.rb`, `llm_context_view.rb`, `llm_context_stale.rb`, `llm_context_forget.rb` | What a request sends of the history (none, stale, forget) ([internals/llm-context-forget.md](internals/llm-context-forget.md)). |
|
|
687
691
|
| Session chains | `session_continue.rb` (`SessionContinue`), `session_chain.rb` (`SessionChain`), `session_chain/links.rb` (`SessionChain::Links`), `session_chain/delete.rb` (`SessionChain::Delete`), `session_chain/delete_preview.rb` (`SessionChain::Delete::Preview`), `continued_from.rb` (`ContinuedFrom`) | A session that continues an earlier one. `SessionChain::Links` is the one chain walker (one listing; `latest`, `first_live`, `root`, `next_of`): `SessionChain.latest`/`.next_of`, `SessionInbox::Head` and the schedule tick all ask it. `SessionChain.opener_for` gives the text web `continue →` prefills in the new link: the previous link's own first typed message when that link continues one itself, else nil (the 201's `opener`; not saved). `SessionChain::Delete` plans and deletes a link or its chain; `Delete::Preview` supplies the web delete sheet, and `ContinuedFrom` records what a continue must undo ([sessions.md](sessions.md)). |
|
|
688
692
|
| MCP server | `mcp_server/protocol.rb` (`McpServer::Protocol`: JSON-RPC in both revisions, no transport, no chi), `mcp_server/tools.rb` (`McpServer::Tools`: `chi_sessions`, `chi_ask`, `chi_wait`, `chi_answer` over a SessionAccess backend through `SessionAccess::Ask` and `Exchange`), `mcp_server/text.rb` (`McpServer::Text`: the results' words), `mcp_server/stdio.rb` (`McpServer::Stdio`), `mcp_server/http.rb` (`McpServer::Http`), `mcp_command.rb` (`chi mcp serve`), `web/mcp_route.rb` (`Web::McpRoute`: `POST /api/mcp`, included through SessionAccessRoutes) | chi as an MCP server ([mcp-server.md](mcp-server.md)); not the `mcp` bundle (chi as a client). Only `tools.rb` names `SessionAccess`: another front builds `Protocol.new(tools: Tools.new(access))`. The caller is a parent agent (`cli:send` / `cli:answer`, `SessionAccess::Ask#agent_line`). |
|
data/docs/bundles.md
CHANGED
|
@@ -933,8 +933,9 @@ seen as a version (so `/skill diff` has it) and counts as the skill updated.
|
|
|
933
933
|
A plain read keeps no version.
|
|
934
934
|
|
|
935
935
|
**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
|
|
936
|
+
skip it and go on without fixing the skill. In a turn that read a skill you
|
|
937
|
+
saved yourself (`memory_read` of a `skill_*` name, or `read` of its file;
|
|
938
|
+
memories shipped by a bundle are skipped), the first failing
|
|
938
939
|
tool call after it (an `execute` that exited non-zero, except a grep-family
|
|
939
940
|
search that found nothing, a tool error) steers
|
|
940
941
|
the model once (a call a guardrail or the user denied doesn't count as a
|
|
@@ -942,8 +943,9 @@ failed step): *"A step of skill release failed. Find out why before skipping
|
|
|
942
943
|
it; if the skill is out of date, fix it now: edit the step that changed in
|
|
943
944
|
its file (or memory_write the whole skill) and add a Changelog line."* No
|
|
944
945
|
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
|
|
946
|
+
with a failed step and no skill read changed, one warning line says so: `skill
|
|
947
|
+
release was followed, a step failed, the skill wasn't updated` (yellow in chi
|
|
948
|
+
web, `warning:` in the terminal). A failure
|
|
947
949
|
unrelated to the skill (a test
|
|
948
950
|
meant to fail) can set it off too: once per turn, and only after a skill was
|
|
949
951
|
read.
|
|
@@ -1090,11 +1092,11 @@ validate or as context, and Claude's answer comes back into chi. This is
|
|
|
1090
1092
|
Claude with the context it has, not a fresh review run. Nothing runs until a
|
|
1091
1093
|
Claude pairs; without one the bundle costs one tool declaration.
|
|
1092
1094
|
|
|
1093
|
-
- **Pairing is Claude's.** chi can't see Claude's inbox, so Claude
|
|
1094
|
-
|
|
1095
|
+
- **Pairing is Claude's.** chi can't see Claude's inbox, so Claude pairs:
|
|
1096
|
+
`chi peer pair claude <id> --address <socket>`, the address being its
|
|
1095
1097
|
per-session inbox socket (`CLAUDE_CODE_MESSAGING_SOCKET`, Claude Code
|
|
1096
|
-
2.1.224 or later)
|
|
1097
|
-
run that yourself:
|
|
1098
|
+
2.1.224 or later); its answers come back as messages in the session's
|
|
1099
|
+
mailbox (`chi peer say`, [peers.md](peers.md)). You never run that yourself:
|
|
1098
1100
|
1. `/claude install-skill` (once) shows a card with the target,
|
|
1099
1101
|
`$CLAUDE_CONFIG_DIR/skills/chi-peer/SKILL.md` (else `~/.claude/…`),
|
|
1100
1102
|
whether one is there and, when it differs, a short diff; its Install (or
|
|
@@ -1106,27 +1108,21 @@ Claude pairs; without one the bundle costs one tool declaration.
|
|
|
1106
1108
|
(your state folder), so Claude isn't asked before reading a long part's
|
|
1107
1109
|
file; chi never writes Claude's settings.
|
|
1108
1110
|
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.
|
|
1111
|
+
`sh <bundle>/scripts/pair <id or URL>`, one `chi peer pair`. A re-pair
|
|
1112
|
+
after a Claude restart only refreshes the socket; Claude's messages stay.
|
|
1113
|
+
3. Claude answers a validate or a question with `chi peer say claude <id>
|
|
1114
|
+
--wake --re <the ref: line> --summary … --wait 8`, which wakes chi, and
|
|
1115
|
+
quotes to you the line it prints (`#12 received · woke chi`, or why chi
|
|
1116
|
+
holds it). Each message is its own note, holding its text up to the tool
|
|
1117
|
+
output cap (10,000 characters by default; a longer one the model reads
|
|
1118
|
+
with `claude_read(serial: N)`). In chi's own records the answer's note
|
|
1119
|
+
names the send (`re`). The session's peer exchange log keeps sends; the
|
|
1120
|
+
answers are the mailbox's messages.
|
|
1125
1121
|
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
|
|
1122
|
+
work depends on, you took a decision with it): the same say with no
|
|
1123
|
+
`--re`, and `--wake` when chi should react now (`--nowake` is for
|
|
1124
|
+
background chi picks up at its next turn). It wakes under the same count
|
|
1125
|
+
as answers, and chi takes it into account within your task and tells you
|
|
1130
1126
|
what it brings.
|
|
1131
1127
|
- **In the web** (the owner's page), a send and its answer link to each
|
|
1132
1128
|
other. The send's row ("sent to Claude · validate: title") says where the
|
|
@@ -1139,28 +1135,30 @@ Claude pairs; without one the bundle costs one tool declaration.
|
|
|
1139
1135
|
verdict (`VERDICT OK` with "round closed" when Claude agreed), its summary,
|
|
1140
1136
|
the answer's text under it (rendered as markdown), and chi's instruction to
|
|
1141
1137
|
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
|
|
1138
|
+
there). A message too long for its note shows its summary only, with "Read
|
|
1139
|
+
the full answer", which opens the Claude chip on that message's text (an
|
|
1140
|
+
older pairing's answer, from its outbox source, has it on the newest
|
|
1141
|
+
only). An answer from an older skill (no `re`) links to the last waiting
|
|
1142
|
+
validate or question; one that answers no send has no link back. A `/claude validate …` you type gets no link in the
|
|
1147
1143
|
conversation (command bubbles aren't kept), its answer still names it.
|
|
1148
1144
|
- **The session bar** has one chip for the pairing, `Claude · …`, first among
|
|
1149
|
-
the context chips,
|
|
1145
|
+
the context chips, fed by chi web's `GET …/peers` (the mailbox): `paired`;
|
|
1150
1146
|
`waiting 2m` (a validate or question has no answer yet, its age the send's);
|
|
1151
|
-
`answered 3m` with the unread dot (
|
|
1152
|
-
|
|
1147
|
+
`answered 3m` with the unread dot (a message no turn has read yet: held or
|
|
1148
|
+
noted);
|
|
1153
1149
|
`can't send` (the last send didn't go through: the Claude session ended or
|
|
1154
1150
|
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
|
-
|
|
1151
|
+
socket, so a dead inbox shows only after a send hits it); `answers only`,
|
|
1152
|
+
dashed (a pairing with no address: through a remote). Its popover (a bottom
|
|
1153
|
+
sheet on a phone) says where chi sends and how it answers, lists the last
|
|
1154
|
+
exchanges (time, kind · title or a message's `#N · summary`, `waiting 2m` /
|
|
1155
|
+
`changes · 11m` / `ok · 4m` / `answered · 4m` / `no answer expected` / `not
|
|
1156
|
+
sent`, then what chi did with the answer: `held · peer turns`, `read`,
|
|
1157
|
+
`completed`; a tap jumps to that send's row when it is in the conversation),
|
|
1158
|
+
and has View latest answer, Status card (runs `/claude`) and Unpair (one
|
|
1159
|
+
confirm; the pairing ends, its messages stay, and the chip goes). A source
|
|
1160
|
+
named `claude-outbox` (an older pairing's) is an ordinary chip.
|
|
1161
|
+
codex-peer's is the same, `Codex · …`.
|
|
1164
1162
|
- **The tool `claude_send(kind, title, text)`**, `kind` being `validate`,
|
|
1165
1163
|
`context` or `question`, writes one JSON line to that socket. The message
|
|
1166
1164
|
starts with a header, `chi <id> · <kind> · <title>`, and a second line,
|
|
@@ -1172,14 +1170,19 @@ Claude pairs; without one the bundle costs one tool declaration.
|
|
|
1172
1170
|
`$XDG_STATE_HOME/samagotchi/plugins/claude-peer/sessions/<id>/<HHMMSS>-<slug>.md`
|
|
1173
1171
|
(removed with the session), and the message names it (`payload: <path>`).
|
|
1174
1172
|
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.
|
|
1173
|
+
change the prompt. Its errors say what to do: not paired (pair from
|
|
1174
|
+
Claude), paired for answers only, the socket gone or refusing (that Claude
|
|
1175
|
+
session ended or restarted: pair again), a text over 200,000 characters.
|
|
1176
|
+
- **The tool `claude_read(serial, offset, limit)`** reads a message from
|
|
1177
|
+
Claude by its number, when its note says it is long: its text in the peer
|
|
1178
|
+
block, paged by lines to the tool output cap.
|
|
1178
1179
|
- **`/claude`** (an anytime command, so it works mid-turn) sends without
|
|
1179
1180
|
the model:
|
|
1180
1181
|
- `/claude` alone shows a card: paired or not, the socket and whether its
|
|
1181
1182
|
file is there (it goes when that Claude session ends), the last send, and
|
|
1182
|
-
Claude's last message (
|
|
1183
|
+
Claude's last message (its number and summary). A session paired by an
|
|
1184
|
+
older bundle (its `claude-inbox` source still attached) says "paired the
|
|
1185
|
+
old way: pair again". When Claude's installed
|
|
1183
1186
|
chi-peer skill differs from what `/claude install-skill` would write (an
|
|
1184
1187
|
older bundle's, or your edit; a skill installed by a chi with another state
|
|
1185
1188
|
dir or bundle path differs too), it says so: install it again (Replace),
|
|
@@ -1194,35 +1197,34 @@ Claude pairs; without one the bundle costs one tool declaration.
|
|
|
1194
1197
|
- `/claude last` sends the model's last completed answer as context. Mid-turn
|
|
1195
1198
|
it is the answer before the running turn, never the turn's partial text;
|
|
1196
1199
|
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.
|
|
1200
|
+
- **The peer loop.** The bundle declares Claude a peer (`chi.peer claude`), so
|
|
1201
|
+
Claude's messages wake chi by the loop's rules ([peers.md](peers.md#the-budget-peerturns)):
|
|
1202
|
+
chi fixes what Claude flagged or disagrees and sends again, up to
|
|
1203
|
+
`peer.turns` (3) wake turns in a row, and a `VERDICT OK` answer wakes chi
|
|
1204
|
+
once to close the round (carry on, or tell you what was agreed). Only a
|
|
1205
|
+
message you type in the web or a TUI starts the count again.
|
|
1204
1206
|
- **The skill.** `skill_claude_peer` (system scope) tells the model to send
|
|
1205
1207
|
only when you ask or to reply in a peer turn, to pick the part rather than
|
|
1206
1208
|
the session, not to wait or poll, and how to read Claude's answer in its
|
|
1207
|
-
|
|
1209
|
+
note, "Message #N from your peer agent Claude" (a validate ends with `VERDICT: OK`, `CHANGES` or
|
|
1208
1210
|
`UNSURE`): act on it only within your task, and stop and tell you when
|
|
1209
1211
|
Claude agrees or after the last turn; a message Claude sent unasked is
|
|
1210
1212
|
taken into account, not acknowledged. Claude's skill ends each answer's
|
|
1211
1213
|
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
|
-
|
|
1214
|
+
message it starts that chi should act on now (`--nowake` for background),
|
|
1215
|
+
quotes the say's line to you (and on `held` neither sends again nor goes
|
|
1216
|
+
past it with `chi send`), and never answers with `chi send`.
|
|
1214
1217
|
- **chi on another machine.** With the chi session on the Studio and Claude on
|
|
1215
1218
|
the laptop, `CHI_REMOTE=studio sh <bundle>/scripts/pair <id>` pairs through
|
|
1216
1219
|
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>`.
|
|
1220
|
+
Claude's answers (its `chi peer say claude`, with `CHI_REMOTE` set; chi
|
|
1221
|
+
web there waits and prints the line) reach chi. chi's sends don't:
|
|
1222
|
+
`claude_send` writes to Claude's socket on the machine chi runs on, and
|
|
1223
|
+
the laptop's isn't there. So through a remote (`CHI_REMOTE`, or `--remote
|
|
1224
|
+
NAME` in `CHI`) `pair` pairs for answers only (no address) and prints one
|
|
1225
|
+
line saying chi there can't send to this Claude: chi's replies reach
|
|
1226
|
+
Claude only when you relay them (or ask it to run `chi --remote studio
|
|
1227
|
+
send --wait <id>`).
|
|
1226
1228
|
**Two-way over SSH.** SSH can forward a Unix socket, so the inbox leg
|
|
1227
1229
|
works too. Claude's skill runs, on the laptop:
|
|
1228
1230
|
|
|
@@ -1244,7 +1246,7 @@ Claude pairs; without one the bundle costs one tool declaration.
|
|
|
1244
1246
|
2FA, can't reach the host, or the server refuses the forward
|
|
1245
1247
|
(`AllowStreamLocalForwarding no`), it prints the two ssh lines for you to run
|
|
1246
1248
|
in a terminal and the pair line, and pairs nothing. A re-pair this way
|
|
1247
|
-
|
|
1249
|
+
gives an answers-only pairing its address. Claude's
|
|
1248
1250
|
socket changes when that Claude session restarts: run `pair-remote` again.
|
|
1249
1251
|
If the host and the remote name point at different machines the pairing
|
|
1250
1252
|
succeeds and `/claude` shows the socket missing. A path chi quotes (a
|
|
@@ -1253,27 +1255,25 @@ Claude pairs; without one the bundle costs one tool declaration.
|
|
|
1253
1255
|
session (sshd makes it the user's, mode 0600 by default): fine on your own
|
|
1254
1256
|
machine or pod, not a shared host. Codex has no socket: codex-peer has no
|
|
1255
1257
|
`pair-remote`.
|
|
1256
|
-
- **A continue.** The pairing
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
`claude-inbox` last had:
|
|
1258
|
+
- **A continue.** The pairing and the mailbox stay with the old session when
|
|
1259
|
+
you continue it ([peers.md](peers.md#continuing-a-session)). The new
|
|
1260
|
+
session's worker posts Claude one message, from a quiet init task, to the
|
|
1261
|
+
socket the old session's pairing names:
|
|
1261
1262
|
|
|
1262
1263
|
```
|
|
1263
1264
|
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
|
|
1265
|
+
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
1266
|
```
|
|
1266
1267
|
|
|
1267
1268
|
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)`.
|
|
1269
|
+
(the same `CHI_REMOTE`; over SSH, `pair-remote` with the new id). It is
|
|
1270
|
+
posted once (a marker under the bundle's `sessions/<id>/`, so a worker
|
|
1271
|
+
restart doesn't post it again); a post that fails (that Claude session
|
|
1272
|
+
ended) is logged and dropped. An answers-only pairing has no address to
|
|
1273
|
+
post to: Claude's next say to the old id is refused with the new one
|
|
1274
|
+
(`this session was continued as <id>`), and the skill pairs again and says
|
|
1275
|
+
the answer there. What Claude said that the old session hadn't read
|
|
1276
|
+
reaches the new one as one note.
|
|
1277
1277
|
- **Asking first.** The tool has no `targets:`, so guardrails match it by name
|
|
1278
1278
|
only: to be asked before each send, add a rule ([Rules in
|
|
1279
1279
|
config.yml](guardrails.md#rules-in-configyml)):
|
|
@@ -1297,10 +1297,13 @@ Claude pairs; without one the bundle costs one tool declaration.
|
|
|
1297
1297
|
bypasses permissions holds it for approval (in `-p` it expires after 5
|
|
1298
1298
|
minutes). It is local only (a Unix socket), but it does hand session
|
|
1299
1299
|
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
|
|
1300
|
+
- **Needs the chi that has the mailbox** (`chi.peer`, `ctx.peers`, `chi
|
|
1301
|
+
peer`; `chi update`): the plugin is built on `Samagotchi::Plugin::Peer`
|
|
1302
|
+
(lib/samagotchi/plugin/peer.rb), the base both peer bundles share (the
|
|
1303
|
+
tools, `/claude`, the cards, payloads), and each bundle sets its strings
|
|
1304
|
+
and transport. An older claude-peer (it declared `chi.peer_source`) fails
|
|
1305
|
+
to load on this chi with "upgrade this bundle", and chi starts without it:
|
|
1306
|
+
[peers.md](peers.md#upgrading-from-an-older-peer-bundle).
|
|
1304
1307
|
|
|
1305
1308
|
## The codex-peer bundle
|
|
1306
1309
|
|
|
@@ -1320,14 +1323,14 @@ skill install card, the web's linked send and answer: "Codex answered") works th
|
|
|
1320
1323
|
`codex queue --thread <uuid> --message <text>` (an argv, no shell), which
|
|
1321
1324
|
wakes an idle Codex TUI: the message runs there as a new user turn (checked
|
|
1322
1325
|
on Codex 0.162.1; a message queued mid-turn runs after the turn). The
|
|
1323
|
-
thread is the
|
|
1326
|
+
thread is the pairing's address, Codex's `CODEX_THREAD_ID`, which
|
|
1324
1327
|
must look like a UUID. `codex` is `$CODEX`, else `codex` on the PATH: a
|
|
1325
1328
|
worker started by `chi web` or launchd may have another PATH than your
|
|
1326
1329
|
shell, so set `CODEX=` where chi runs if the error says there's no codex.
|
|
1327
1330
|
The tool and the anytime `/codex` wait for `codex queue` up to 10 s; a
|
|
1328
1331
|
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
|
-
|
|
1332
|
+
with a timeout error, never a hang. Other errors say what to do: not
|
|
1333
|
+
paired (pair from Codex), a thread Codex has no record of (that
|
|
1331
1334
|
Codex session is gone: pair again), an ephemeral thread
|
|
1332
1335
|
(`codex exec --ephemeral` can't take queued messages), or `codex queue`'s
|
|
1333
1336
|
first error line. A Codex session that was closed (`/quit`) is not gone:
|
|
@@ -1336,38 +1339,38 @@ skill install card, the web's linked send and answer: "Codex answered") works th
|
|
|
1336
1339
|
pair again from a new one). The status card shows the thread id and says
|
|
1337
1340
|
so; there is no cheap check that the session is open.
|
|
1338
1341
|
- **Codex's sandbox.** Pairing and every reply write chi's state
|
|
1339
|
-
(`chi
|
|
1342
|
+
(`chi peer pair`/`say` write the session's mailbox files directly),
|
|
1340
1343
|
which Codex's default sandbox (workspace-write) refuses. The user adds, to
|
|
1341
1344
|
`$CODEX_HOME/config.toml` (else `~/.codex/config.toml`):
|
|
1342
1345
|
|
|
1343
1346
|
```toml
|
|
1344
1347
|
[sandbox_workspace_write]
|
|
1345
|
-
writable_roots = ["/Users/you/.local/state/samagotchi/
|
|
1348
|
+
writable_roots = ["/Users/you/.local/state/samagotchi/mailbox"]
|
|
1346
1349
|
```
|
|
1347
1350
|
|
|
1348
|
-
and restarts Codex. Only chi's `
|
|
1349
|
-
also holds guardrails, session files, plugins and the web token.
|
|
1351
|
+
and restarts Codex. Only chi's `mailbox/` folder: the state folder above it
|
|
1352
|
+
also holds guardrails, session files, plugins and the web token. A config
|
|
1353
|
+
from an older skill names `…/samagotchi/context`: change it.
|
|
1350
1354
|
`/codex install-skill`'s card shows the line with your state folder
|
|
1351
|
-
(absolute: config.toml doesn't expand `~`),
|
|
1352
|
-
when
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1355
|
+
(absolute: config.toml doesn't expand `~`), `--yes` makes the folder so the
|
|
1356
|
+
root exists when Codex restarts, and the pair script names the line when a
|
|
1357
|
+
write is refused ("Operation not permitted"). chi never edits Codex's
|
|
1358
|
+
config. Reading a payload file needs nothing: the default sandbox reads
|
|
1359
|
+
anywhere. With chi on this machine no network is needed: a say writes
|
|
1360
|
+
files, and chi wakes on them (a stopped worker can't be started from inside
|
|
1361
|
+
the sandbox: the say says so, and chi reads the message at its next start). Through a remote it is the other way
|
|
1356
1362
|
round (HTTP, not files): see **chi on another machine** below.
|
|
1357
1363
|
- **Pairing** is Codex's, as with Claude: `/codex install-skill` copies the
|
|
1358
1364
|
bundle's `scripts/chi-peer-SKILL.md` to
|
|
1359
1365
|
`$CODEX_HOME/skills/chi-peer/SKILL.md` (else `~/.codex/…`), with the
|
|
1360
1366
|
installed `scripts/pair` path, the payload folder and the writable root
|
|
1361
1367
|
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.
|
|
1368
|
+
`sh <bundle>/scripts/pair` runs `chi peer pair codex <id> --address
|
|
1369
|
+
<thread id>` (a re-pair refreshes it). Run outside Codex (no
|
|
1370
|
+
`CODEX_THREAD_ID`) it refuses. Codex replies with `chi peer say codex <id>
|
|
1371
|
+
--wake --re <the ref: line> --summary … --wait 8` and quotes the line to
|
|
1372
|
+
you. The note holds the message's text as claude-peer's does, and Codex can
|
|
1373
|
+
send a message unasked (no `--re`) the same way.
|
|
1371
1374
|
- **Peer messages are user turns in Codex.** Claude Code marks an inbox
|
|
1372
1375
|
message as from another session; `codex queue` lands as a plain user
|
|
1373
1376
|
message. So Codex's skill starts with the rule: a message whose first line
|
|
@@ -1380,11 +1383,11 @@ skill install card, the web's linked send and answer: "Codex answered") works th
|
|
|
1380
1383
|
more.
|
|
1381
1384
|
- **chi on another machine.** As with Claude, `CHI_REMOTE=studio sh
|
|
1382
1385
|
<bundle>/scripts/pair <id>` (or `--remote NAME` in `CHI`) pairs through
|
|
1383
|
-
the Studio's chi web, and only
|
|
1386
|
+
the Studio's chi web, and only Codex's answers reach chi: `codex_send` runs
|
|
1384
1387
|
`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
|
-
|
|
1388
|
+
Claude's `--inbox-socket` trick doesn't apply here: the address is a thread
|
|
1389
|
+
id, not a socket, so there is nothing to forward through SSH. So `pair`
|
|
1390
|
+
pairs for answers only (no address) and prints one line saying chi there
|
|
1388
1391
|
can't send to this Codex. Through a remote chi talks HTTP, not files, so
|
|
1389
1392
|
`writable_roots` doesn't matter; Codex's sandbox may block the network
|
|
1390
1393
|
instead, which pairing and every reply then need (workspace-write has none
|
|
@@ -1397,15 +1400,16 @@ skill install card, the web's linked send and answer: "Codex answered") works th
|
|
|
1397
1400
|
Codex's names, and on a missing answer points to Codex being mid-turn or
|
|
1398
1401
|
its sandbox (the `writable_roots` line). To be asked before each send, a
|
|
1399
1402
|
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
|
-
|
|
1403
|
+
- **The peer loop** works as claude-peer's: Codex is declared a peer
|
|
1404
|
+
(`chi.peer codex`), its messages wake chi up to `peer.turns` turns in a
|
|
1405
|
+
row, and `VERDICT OK` wakes chi once to close the round; `codex_read`
|
|
1406
|
+
reads a long message. Needs the chi that has the mailbox; an older
|
|
1407
|
+
codex-peer fails to load there with "upgrade this bundle".
|
|
1404
1408
|
- **A continue** works as claude-peer's: the new session queues Codex the
|
|
1405
|
-
`moved` message on the thread the old
|
|
1409
|
+
`moved` message on the thread the old session's pairing names, once, and
|
|
1406
1410
|
Codex's skill pairs again with the new id (the same `CHI_REMOTE`, if any).
|
|
1407
|
-
|
|
1408
|
-
|
|
1411
|
+
An answers-only pairing has no address: Codex pairs again when its next
|
|
1412
|
+
say is refused. A closed Codex session still takes the message; it waits
|
|
1409
1413
|
for `codex resume` there.
|
|
1410
1414
|
|
|
1411
1415
|
## The ruby bundle
|