samagotchi 0.192.0 → 0.193.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 +52 -1
- data/docs/architecture.md +3 -3
- data/docs/bundles.md +45 -28
- data/docs/cli.md +22 -8
- data/docs/configuration.md +4 -3
- data/docs/context.md +8 -5
- data/docs/guardrails.md +9 -4
- data/docs/internals/bridge.md +3 -1
- data/docs/internals/bundles.md +2 -2
- data/docs/internals/pages.md +4 -4
- data/docs/internals/participants.md +5 -3
- data/docs/internals/peers.md +75 -22
- data/docs/internals/prompt-caching.md +2 -1
- data/docs/internals/remote-sessions.md +6 -0
- data/docs/internals/session-lifecycle.md +3 -2
- data/docs/internals/web-frontend.md +91 -19
- data/docs/internals/working-set.md +5 -1
- data/docs/peers.md +71 -22
- data/docs/plugins.md +7 -4
- data/docs/releasing.md +30 -2
- data/docs/scheduling.md +3 -2
- data/docs/sessions.md +1 -1
- data/docs/testing.md +35 -3
- data/docs/thin-clients.md +27 -11
- data/lib/samagotchi/bundles/claude-peer/manifest.yml +2 -2
- data/lib/samagotchi/bundles/claude-peer/scripts/chi-peer-SKILL.md +33 -17
- data/lib/samagotchi/bundles/codex-peer/manifest.yml +2 -2
- data/lib/samagotchi/bundles/codex-peer/scripts/chi-peer-SKILL.md +34 -17
- data/lib/samagotchi/bundles/coordinator/manifest.yml +2 -2
- data/lib/samagotchi/bundles/coordinator/skill_coordinator.md +31 -0
- data/lib/samagotchi/bundles/mcp/manifest.yml +2 -2
- data/lib/samagotchi/bundles/mcp/plugin.rb +0 -7
- data/lib/samagotchi/bundles/system/manifest.yml +1 -1
- data/lib/samagotchi/compat.rb +8 -1
- data/lib/samagotchi/config.rb +4 -0
- data/lib/samagotchi/continue_offer.rb +13 -1
- data/lib/samagotchi/delivery.rb +2 -2
- data/lib/samagotchi/engine/models.rb +17 -0
- data/lib/samagotchi/engine/plugins.rb +2 -0
- data/lib/samagotchi/guardrails/pair_boundary.rb +49 -18
- data/lib/samagotchi/jsonl_store.rb +13 -2
- data/lib/samagotchi/llm/anthropic_messages.rb +11 -0
- data/lib/samagotchi/llm/openai_chat.rb +5 -0
- data/lib/samagotchi/llm/prompt_cache.rb +5 -0
- data/lib/samagotchi/pages/launch.rb +1 -1
- data/lib/samagotchi/peer_cold.rb +92 -0
- data/lib/samagotchi/peer_command.rb +24 -9
- data/lib/samagotchi/peer_continue.rb +32 -16
- data/lib/samagotchi/peer_exchanges.rb +7 -0
- data/lib/samagotchi/peer_mailbox.rb +21 -4
- data/lib/samagotchi/peer_receipts.rb +33 -6
- data/lib/samagotchi/peer_say.rb +34 -16
- data/lib/samagotchi/plugin/api.rb +2 -1
- data/lib/samagotchi/plugin/context.rb +13 -1
- data/lib/samagotchi/plugin/peer.rb +118 -53
- data/lib/samagotchi/plugin/peers.rb +13 -6
- data/lib/samagotchi/session_access/local.rb +98 -37
- data/lib/samagotchi/session_access/remote_peers.rb +3 -3
- data/lib/samagotchi/session_chain/links.rb +8 -3
- data/lib/samagotchi/session_continue.rb +7 -6
- data/lib/samagotchi/session_manager/spawn.rb +6 -1
- data/lib/samagotchi/session_stores.rb +16 -11
- data/lib/samagotchi/system_one/runs.rb +5 -2
- data/lib/samagotchi/testing/boundary.rb +0 -1
- data/lib/samagotchi/testing/host.rb +1 -0
- data/lib/samagotchi/testing/recorder.rb +3 -0
- data/lib/samagotchi/version.rb +1 -1
- data/lib/samagotchi/web/peer_routes.rb +10 -5
- data/lib/samagotchi/web/public/agent_rows.js +206 -0
- data/lib/samagotchi/web/public/agent_runs.js +595 -0
- data/lib/samagotchi/web/public/answer_fold.js +41 -44
- data/lib/samagotchi/web/public/app.js +3 -3
- data/lib/samagotchi/web/public/block_fix.js +1 -1
- data/lib/samagotchi/web/public/cards_place.js +6 -4
- data/lib/samagotchi/web/public/history_reveal.js +5 -2
- data/lib/samagotchi/web/public/index.html +38 -2
- data/lib/samagotchi/web/public/page_view.js +1 -1
- data/lib/samagotchi/web/public/pages.css +1 -7
- data/lib/samagotchi/web/public/peer_mailbox_api.js +2 -1
- data/lib/samagotchi/web/public/peer_note.js +4 -2
- data/lib/samagotchi/web/public/peer_row.js +37 -0
- data/lib/samagotchi/web/public/quiet_notes.js +12 -1
- data/lib/samagotchi/web/public/revise_stack.js +5 -2
- data/lib/samagotchi/web/public/send_turn.js +11 -3
- data/lib/samagotchi/web/public/turn_block.js +4 -0
- data/lib/samagotchi/worker/mail.rb +11 -1
- data/lib/samagotchi/worker.rb +7 -5
- data/lib/samagotchi/worker_inbound/mail.rb +34 -6
- data/lib/samagotchi/worker_inbound.rb +11 -3
- data/lib/samagotchi/worker_link.rb +13 -1
- data/lib/samagotchi/worker_wakes.rb +33 -5
- metadata +5 -2
- data/lib/samagotchi/web/public/pages_group.js +0 -67
data/docs/peers.md
CHANGED
|
@@ -20,8 +20,10 @@ chi peer pair claude <session id> --address <where chi sends> --from "<who paire
|
|
|
20
20
|
- Pairing again only replaces the address (a Claude Code restart gives it a new socket).
|
|
21
21
|
- `chi peer unpair claude <id>` ends the pairing. Its messages stay, and chi still reads those it hasn't. The
|
|
22
22
|
peer chip's **Unpair** does the same.
|
|
23
|
-
- `chi peer pair` refuses a session whose live worker is older than the mailbox ("restart the session")
|
|
24
|
-
session that was continued
|
|
23
|
+
- `chi peer pair` refuses a session whose live worker is older than the mailbox ("restart the session"). Pairing a
|
|
24
|
+
session that was continued pairs its chain's live link and names it (`3f2a9c1e paired with Claude (session
|
|
25
|
+
1a2b3c4d continued as 3f2a9c1e)`); `unpair` of one ends the old link's pairing and the live link's, and `ls` lists
|
|
26
|
+
the live link's peers, naming it.
|
|
25
27
|
|
|
26
28
|
Which agents are peers is the bundles' to say (`chi.peer NAME` in plugin code), never a file's. A message from
|
|
27
29
|
a name no loaded bundle declared is refused with "no bundle in that session declares peer NAME".
|
|
@@ -29,11 +31,13 @@ a name no loaded bundle declared is refused with "no bundle in that session decl
|
|
|
29
31
|
## Saying something: `chi peer say`
|
|
30
32
|
|
|
31
33
|
```sh
|
|
32
|
-
chi peer say claude <id> --wake --re s-ab12cd --summary "validate step 2: VERDICT CHANGES, 2 issues" --wait 8
|
|
33
|
-
<the full answer>
|
|
34
|
-
EOF
|
|
34
|
+
chi peer say claude <id> --wake --re s-ab12cd --summary "validate step 2: VERDICT CHANGES, 2 issues" --wait 8 < answer.md
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
+
The skills write the answer to a file first (`$TMPDIR/chi-peer/answer-<ref>.md`) and say it from there, so a say
|
|
38
|
+
refused with "try again in a moment" is run again as it is, without writing the answer twice. They never run it
|
|
39
|
+
again after a `#N received` line or a failure with no line: nothing stops a second write of the same message.
|
|
40
|
+
|
|
37
41
|
- `--wake` or `--nowake` is required: `--wake` asks chi to run a turn for it (a validate's answer, a question's,
|
|
38
42
|
a message chi should act on now); `--nowake` leaves it as a note for chi's next turn.
|
|
39
43
|
- `--re` names the send it answers (the `ref:` line of chi's message); leave it out for a message the peer starts.
|
|
@@ -45,19 +49,21 @@ It prints one line, which the skills tell the agent to quote to its user:
|
|
|
45
49
|
| What chi did | The line |
|
|
46
50
|
|---|---|
|
|
47
51
|
| started a turn | `#12 received · woke chi` |
|
|
48
|
-
| held it | `#12 received · held: 3 peer turns in a row (peer.turns) · waits for the user's next message` |
|
|
52
|
+
| held it | `#12 received · held: 3 peer turns in a row (peer.turns) · waits for the user's next message`, `held: chi's cache is cold · waits for the user's next message` |
|
|
49
53
|
| took it as background | `#12 received · noted` |
|
|
50
54
|
| can't say yet | `#12 received · chi is in a turn: it reads this when the turn ends`, `chi is stopped: …`, `this session is archived: …`, `chi's worker isn't running and couldn't be started from here: …` |
|
|
51
55
|
| nothing within the wait | `#12 received · no answer from chi yet` |
|
|
52
56
|
| refused | `refused: no bundle in that session declares peer claude` (exit 1) |
|
|
53
57
|
|
|
54
|
-
Other messages of the same peer held and unread follow: `· also held: #10, #11 (paused)`. A
|
|
58
|
+
Other messages of the same peer held and unread follow: `· also held: #10, #11 (paused)`. A say to a session that was
|
|
59
|
+
continued goes to its chain's live link (below), and its line ends `· session continued as 3f2a9c1e: answer there`. A held message is not
|
|
55
60
|
lost: it is a note, and the user's next message lets chi read it. The skills say not to send it again, and not to
|
|
56
61
|
`chi send` past it.
|
|
57
62
|
|
|
58
|
-
A say is refused, with nothing written, for: no such session; a session being deleted; a continued one
|
|
59
|
-
session was continued as <id>: say it there
|
|
60
|
-
|
|
63
|
+
A say is refused, with nothing written, for: no such session; a session being deleted; a continued one whose live
|
|
64
|
+
link isn't paired (a chain an older chi continued: `this session was continued as <id>: say it there`, naming that
|
|
65
|
+
link); one being continued right now (`this session is being continued as
|
|
66
|
+
<id>: say it again in a moment`: its new link is not saved yet); one busy with another change (`this session is busy
|
|
61
67
|
with another change; try again in a moment`); not paired (`not paired: run the pair script`); an older worker
|
|
62
68
|
(`restart the session`); 200 messages chi hasn't read yet.
|
|
63
69
|
|
|
@@ -71,8 +77,8 @@ The worker takes the peer's messages in order, between turns, and writes one rec
|
|
|
71
77
|
- then `read` once a turn starts with it in the conversation, and `completed`, `failed` or `stopped` when that
|
|
72
78
|
turn ends.
|
|
73
79
|
|
|
74
|
-
Held reasons: `off` (`peer.turns` is 0), `
|
|
75
|
-
`max_wakes`, `peer turns`, `queued`, `exit`, `leaving`, `before a turn`.
|
|
80
|
+
Held reasons: `off` (`peer.turns` is 0), `cold` (chi's cache is cold: below), `paused` (after a failed wake turn),
|
|
81
|
+
`continue` (a continue offer waits), `max_wakes`, `peer turns`, `queued`, `exit`, `leaving`, `before a turn`.
|
|
76
82
|
|
|
77
83
|
`chi peer ls <id>` lists each peer, its pairing and its newest messages with their receipts; the peer chip's list
|
|
78
84
|
shows the same words (`held · peer turns`, `read`, `completed`).
|
|
@@ -83,7 +89,42 @@ A peer's messages may wake chi `peer.turns` times in a row (default 3) with noth
|
|
|
83
89
|
`session.max_wakes`. Past it they wait as notes, the say's line says so, and the TUI and the web say it once. A
|
|
84
90
|
message whose summary ends its round with `VERDICT OK` wakes chi once more to close it, held only by
|
|
85
91
|
`session.max_wakes`. Only input typed in the web or a TUI resets the count: `chi send` does not, since a peer can
|
|
86
|
-
run it.
|
|
92
|
+
run it. The count outlives the worker (an idle exit, a restart), so a peer that speaks every 40 minutes is held after
|
|
93
|
+
`peer.turns` wakes as one that speaks every minute is. `peer.turns: 0` means a peer's message never wakes chi.
|
|
94
|
+
`context.wake` is attached context's only.
|
|
95
|
+
|
|
96
|
+
## A cold cache
|
|
97
|
+
|
|
98
|
+
A turn on a cold prompt cache reads the whole conversation again at the write price, where a warm one pays a tenth of
|
|
99
|
+
it. So a message the peer starts on its own (no `--re` naming one of chi's sends) and a `VERDICT OK` closer don't wake
|
|
100
|
+
chi while its cache is cold: they wait as notes for the user's next message (`held: chi's cache is cold`, the chip's
|
|
101
|
+
`held · cold`, and the TUI and the web say it once). "Cold" is all of:
|
|
102
|
+
|
|
103
|
+
- chi's model is a Claude model on a remote host, whose requests carry cache breakpoints, so the host keeps a cache
|
|
104
|
+
with a TTL (through an OpenAI-style host such as OpenRouter, or a remote `api: anthropic` host whose dialect sends
|
|
105
|
+
them); a local model has no remote TTL and is never held, whatever its API;
|
|
106
|
+
- the last turn ended longer ago than `cache.ttl` (5 minutes, or an hour with `1h`);
|
|
107
|
+
- the conversation is over 20,000 tokens (the size the last turn saved); a smaller one is cheap to read again.
|
|
108
|
+
|
|
109
|
+
An answer chi asked for (its `--re` names a send chi made to that peer, in this session or the one it continues,
|
|
110
|
+
that no earlier message answered) wakes chi cold or warm, and so does a batch holding one. Anything chi can't tell (no turn yet, no saved size) counts
|
|
111
|
+
as warm.
|
|
112
|
+
|
|
113
|
+
## Quiet pairings
|
|
114
|
+
|
|
115
|
+
When chi's model sends to a peer it hasn't exchanged anything with for `peer.quiet_minutes` (30 by default; 0 turns
|
|
116
|
+
this off), the peer's own session may have gone cold too, so you decide. "Exchanged" is the pairing, a send to it, or
|
|
117
|
+
a message from it, also in the session this one continues. Then:
|
|
118
|
+
|
|
119
|
+
- in a turn you started from the web or a TUI, you get a question: "Claude last heard from chi 2 h ago: its session
|
|
120
|
+
may be cold. Send?" (Send / Don't send; a parent agent can't answer Send). Don't send holds for the rest of that
|
|
121
|
+
turn, so the model trying again doesn't ask again;
|
|
122
|
+
- in any other turn (a schedule's, a delegate's, a wake turn, `chi send`'s) nobody is there to answer: the send is
|
|
123
|
+
refused at once and the model is told you decide;
|
|
124
|
+
- a `/claude …` or `/codex …` you type never asks.
|
|
125
|
+
|
|
126
|
+
The pairing stays paired; `/claude` (or `/codex`) shows `quiet 2 h: a send from the model asks first`. The timer
|
|
127
|
+
also asks when the peer was busy with its own work and is warm: it can't see the peer's cache.
|
|
87
128
|
|
|
88
129
|
`peer.turns` replaced `context.peer_turns` (no alias): rename it in config.yml.
|
|
89
130
|
|
|
@@ -95,19 +136,27 @@ run it. `peer.turns: 0` means a peer's message never wakes chi. `context.wake` i
|
|
|
95
136
|
(`serial`, `offset`, `limit`), which pages it.
|
|
96
137
|
- 200 messages chi hasn't read: further says are refused until it reads them.
|
|
97
138
|
- The mailbox keeps every message chi hasn't taken, and the newest 50 it has.
|
|
98
|
-
- A continued message is cut at 4 KiB in the new link;
|
|
99
|
-
|
|
100
|
-
|
|
139
|
+
- A continued message is cut at 4 KiB in the new link; the rest stays in the previous session's mailbox, and the
|
|
140
|
+
cut says how chi reads it whole: `claude_read(serial: N, box: "<previous id8>")` (`codex_read` for Codex), which
|
|
141
|
+
reads from the session this one continues.
|
|
142
|
+
- A `chi peer say` at the moment of a continue is refused (`being continued as <id>: say it again in a moment`, or
|
|
143
|
+
busy), nothing written, rather than landing in a mailbox the carry already read (the say holds the session's
|
|
144
|
+
transition lock shared); the peer runs it again.
|
|
101
145
|
|
|
102
146
|
## Continuing a session
|
|
103
147
|
|
|
104
|
-
|
|
148
|
+
The pairing follows the chain, and the peer does nothing:
|
|
149
|
+
|
|
150
|
+
- a continue copies each pairing to the new link as it is (the address, who paired, when), so chi's next send goes
|
|
151
|
+
to the same Claude or Codex session, with the new id in its header;
|
|
152
|
+
- a say, pair, unpair or `ls` to the old id runs on the chain's live link, and the say's line says so
|
|
153
|
+
(`session continued as <id8>: answer there`); a pairing the continue couldn't copy (a chain an older chi
|
|
154
|
+
continued) is refused as before, naming the live link, and the skill pairs again there;
|
|
155
|
+
- the messages stay with the previous link, and those it hadn't read (never taken, or held or noted and not yet
|
|
156
|
+
read by a turn) reach the new link as **one** note, each text in its peer block.
|
|
105
157
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
- a say to the old id is refused, naming the new id;
|
|
109
|
-
- the messages the previous link hadn't read (never taken, or held or noted and not yet read by a turn) reach the
|
|
110
|
-
new link as **one** note, each text in its peer block.
|
|
158
|
+
An answer chi asked for that reaches a new link before its first turn waits as a note, held `before a turn`, as it
|
|
159
|
+
does for any link with no turn yet (a Continue with no prompt): the user's first message lets chi read it.
|
|
111
160
|
|
|
112
161
|
## Codex's sandbox
|
|
113
162
|
|
data/docs/plugins.md
CHANGED
|
@@ -937,6 +937,7 @@ full label, `plugin.rb (bundle my-bundle)`.
|
|
|
937
937
|
| `ctx.cost` | the session's spend so far, read now, as a frozen value: `total` (USD, reported + estimated, side requests included; 0.0 before any), `reported` (by providers, `usage.cost`), `estimated` (from `hosts.<name>.models` prices; a generation is one or the other, never both), `side` (recap, `/btw`, `ask_model`: their share of `total`) and `known?` (false while generations or side requests ran but none was reported or priced, so a limit on it can't be enforced; a session with some priced generations reads known, the unpriced ones counting 0). It includes the running turn's finished generations and what earlier workers of the session spent. Use its methods, not its class. Needs chi 0.83.0 |
|
|
938
938
|
| `ctx.usage` | the session's work so far, read now, as a frozen value: `turns` (finished ones and the running one), `tool_calls` and `tool_calls_by_tool` (every call, running ones included; canonical names: an alias counts under its tool, a `call_tool` call under the inner tool), `steps` (the loop rounds that dispatched tools, `/stats`' iterations) and `active_ms` (`active_minutes` too): work time, the generations' time plus the finished tool calls' time, never the waits between them (a question, an approval, the user's answer to `ask_user_question`), with `tool_ms_by_tool` its tool part by tool, so a waiting tool's time (`task_wait`) can be left out. Its counts are the ones `/stats` and `chi sessions stats` show, earlier workers' included. Use its methods, not its class. Needs chi 0.100.0 (guard it with `ctx.respond_to?(:usage)`) |
|
|
939
939
|
| `ctx.turn_author` | who wrote the running turn when it isn't the session's owner: a participant's `"p:<id>"` (`chi share`); nil for the owner's turns and between turns. Every hook event of such a turn carries the same as `author:`. The handler runs with the owner's power whatever the author ([hooks](hooks.md#participants-turns)): `ctx.secrets` works there, so don't start a sign-in on such a turn. Needs chi 0.105.0 (guard it with `ctx.respond_to?(:turn_author)`) |
|
|
940
|
+
| `ctx.turn_interactive?` | whether the running turn was sent from a screen that shows a question and can answer it now: the owner's web tab or TUI (their first prompt, and a Continue tap on such a turn, too), and a thin client's `POST …/ask` (`web:unnamed`), which can answer a question through `…/answer`. False between turns and for every other turn (`chi send`'s, a schedule's, a delegate's, a wake turn, a participant's, a one-shot run), where a `ctx.ask_user` would wait with nobody to answer it: decide without asking there. The peer bundles' dormant send asks only when it is true. Needs the next chi (guard it with `ctx.respond_to?(:turn_interactive?)`) |
|
|
940
941
|
| `ctx.tool_id` | inside a tool's block, the run's own id (chi's tool id, `"t41"`), the one a two-arg `refs:` lambda got for its row ([Refs on a tool's row](#refs-on-a-tools-row)); nil anywhere else (a hook, a command, a thread the block started) and for a run with none. Needs chi 0.181.0 (guard it with `ctx.respond_to?(:tool_id)`) |
|
|
941
942
|
| `ctx.settings` | the bundle's settings, frozen: config.yml's `bundles: <bundle>:` with the session's own `--set` values laid over it ([Per-session settings](#per-session-settings)); the config alone until the session is bound (in `register` and `chi.ctx`) |
|
|
942
943
|
| `ctx.data_dir` | `$XDG_STATE_HOME/samagotchi/plugins/<bundle>/`, created on first use: what the bundle keeps across sessions |
|
|
@@ -1644,16 +1645,17 @@ a quiet `chi.init` task.
|
|
|
1644
1645
|
ctx.peers.link("claude") # => #<data PeerLink peer="claude", address="/tmp/…sock", paired_at="…", from="…"> or nil
|
|
1645
1646
|
ctx.peers.left_behind("claude") # the previous link's pairing, in a continue's new link; else nil
|
|
1646
1647
|
ctx.peers.message("claude", 12) # => #<data PeerMessage serial=12, text="…", summary="…", wake=true, re="s-ab12cd", at="…"> or nil
|
|
1648
|
+
ctx.peers.message("claude", 3, box: "1a2b3c4d") # box: the note's box, or the continued session's id8 (its mailbox)
|
|
1647
1649
|
ctx.peers.last_message("claude") # the newest message still in the mailbox, or nil
|
|
1648
1650
|
```
|
|
1649
1651
|
|
|
1650
1652
|
What a peer bundle reads of its peer's side of the session (the mailbox,
|
|
1651
1653
|
[peers.md](peers.md)): the pairing (`address` nil: the peer answers only) and
|
|
1652
1654
|
the peer's messages. Read only: the peer pairs and says through `chi peer`,
|
|
1653
|
-
and the worker takes the messages. A continue
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1655
|
+
and the worker takes the messages. A continue copies the pairing to the new
|
|
1656
|
+
link, so its `link` is the previous link's pairing as it was; `left_behind`
|
|
1657
|
+
is the one the previous link keeps (the copy's source; an older chi left the
|
|
1658
|
+
new link unpaired). Needs the next chi.
|
|
1657
1659
|
|
|
1658
1660
|
### Context providers in the manifest
|
|
1659
1661
|
|
|
@@ -1883,6 +1885,7 @@ bundle.set(declared_tools: %w[read]) # ctx.declared_tools (d
|
|
|
1883
1885
|
bundle.set(cost: 2.5) # ctx.cost: reported USD, or { reported:, estimated:, side:, known: }
|
|
1884
1886
|
bundle.set(usage: { tool_calls: 40, active_ms: 600_000 }) # ctx.usage: { turns:, tool_calls:, tool_calls_by_tool:, steps:, active_ms:, tool_ms_by_tool: }
|
|
1885
1887
|
bundle.set(turn_author: "p:p_0123abcd") # a participant's turn: ctx.turn_author, and author: on every event
|
|
1888
|
+
bundle.set(turn_interactive: false) # ctx.turn_interactive? (default true: the owner's turn from a screen)
|
|
1886
1889
|
bundle.set(session_settings: { "cap" => 1 }) # the session's --set values (Bundle.load takes session_settings: too)
|
|
1887
1890
|
bundle.tool_loads.last.names # ctx.load_tools calls; set(load_tools_staged: [...]) limits what they stage
|
|
1888
1891
|
bundle.pair_peer("claude", address: "/tmp/c.sock") # a peer's side, as chi peer pair writes it (ctx.peers.link); address: nil answers only
|
data/docs/releasing.md
CHANGED
|
@@ -76,7 +76,7 @@ as the GitHub release body.
|
|
|
76
76
|
| `rake lint` / `rake lint:fix` | RuboCop over the repo (must report no offenses; CI runs it) / its safe autocorrect (`rubocop -a`). |
|
|
77
77
|
| `rake gem:validate`, `gem:build`, `gem:install`, `gem:clean` | Check the gemspec; build the gem into `pkg/`; build and install it locally; remove the built gems. |
|
|
78
78
|
| `rake release:draft_changelog` | A draft Unreleased section from the commit subjects since the last tag, grouped. Stdout only. |
|
|
79
|
-
| `rake release:bump[X.Y.Z]` | VERSION, the system manifest, Gemfile.lock, CHANGELOG, a compatibility corpus at `spec/compat/X.Y.Z/` written through the current state writers (with `wire/`: a real Engine and Bridge's replies, recorded twice and refused if the two differ), refreshed `spec/shared/compat_wire/*.json` fixtures, `spec/web/public/exports_baseline.json` rebuilt from the public modules, and `requires_chi: ">= X.Y.Z"` for each bundle marked `requires_chi_next` (the marker dropped), then a profile left below a member's `requires_chi` raised to it, with a patch bump of its version (none when it moved since the last tag) and named in the CHANGELOG's "Update with `chi update`" line, and each entry an `# Unreleased` comment in `Plugin::Api::SINCE` or `BundleManifest::SINCE` names moved into the table at X.Y.Z (the comment dropped). No commit; commit the corpus, fixtures and baseline with the release. |
|
|
79
|
+
| `rake release:bump[X.Y.Z]` | VERSION, the system manifest, Gemfile.lock, CHANGELOG, a compatibility corpus at `spec/compat/X.Y.Z/` written through the current state writers (with `wire/`: a real Engine and Bridge's replies and, in `wire/remote/`, chi web's answers to `chi --remote`, recorded twice and refused if the two differ), refreshed `spec/shared/compat_wire/*.json` fixtures, `spec/web/public/exports_baseline.json` rebuilt from the public modules, and `requires_chi: ">= X.Y.Z"` for each bundle marked `requires_chi_next` (the marker dropped), then a profile left below a member's `requires_chi` raised to it, with a patch bump of its version (none when it moved since the last tag) and named in the CHANGELOG's "Update with `chi update`" line, and each entry an `# Unreleased` comment in `Plugin::Api::SINCE` or `BundleManifest::SINCE` names moved into the table at X.Y.Z (the comment dropped). No commit; commit the corpus, fixtures and baseline with the release. |
|
|
80
80
|
| `rake release:check` | Clean tracked tree, VERSION == system bundle, a CHANGELOG section, no `requires_chi_next` left, no `# Unreleased` comment left in `Plugin::Api::SINCE` or `BundleManifest::SINCE`, `bundles:check`, `rake lint` (RuboCop) + `npm run lint` (the web frontend's ESLint), rspec (both roots: `spec` and the bundles' own `spec/`) + `rake bundles:specs` + npm test, `gem build`, then a clean install into a temp GEM_HOME that runs `chi --version`, `chi self` and `chi bundle list` with a temp HOME. Needs the network (gem dependencies). |
|
|
81
81
|
| `rake release:notes[X.Y.Z]` | Prints the CHANGELOG section (default: the current VERSION). |
|
|
82
82
|
|
|
@@ -113,7 +113,18 @@ The agent does each step and stops where the user has to say yes.
|
|
|
113
113
|
(a new time, a random id, a measured number). Pin it in
|
|
114
114
|
`CompatWire.normalise` (`*_ms`, `*_ms_sum` and `age` are pinned already, as is `last_turn.seconds`;
|
|
115
115
|
an id the script chooses is better pinned at its source), check `spec/release/compat_wire_spec.rb`,
|
|
116
|
-
and run the bump again (nothing is written when it stops).
|
|
116
|
+
and run the bump again (nothing is written when it stops). `wire/remote/`
|
|
117
|
+
holds what chi web answers `chi --remote` (`script/release/compat_remote.rb`,
|
|
118
|
+
`CompatRemote`: a real `Web::App` over a fixed state folder, no worker), one
|
|
119
|
+
`{method, path, query, request, status, reply}` file per call; it is
|
|
120
|
+
recorded twice too (a remote file's difference is pinned in
|
|
121
|
+
`CompatRemote.pin`). A bump also stops when any wire file names the
|
|
122
|
+
recording's machine ("names the recording's machine (/private/)": a /private
|
|
123
|
+
realpath, a chi-compat- temp folder or the home folder the normaliser
|
|
124
|
+
missed; the temp folder is `/compat-fixture` and the chi checkout
|
|
125
|
+
`/compat-project` already), or when chi web would start a worker. Corpora
|
|
126
|
+
recorded before 0.193.0 still hold the checkout's path in their AGENTS.md
|
|
127
|
+
prompt part; they are left as released. The new
|
|
117
128
|
VERSION may pass a compat shim's `remove_after` (`Compat::SHIMS`): once the
|
|
118
129
|
shim is also at least 14 days old (`added_on`, `Compat::MIN_AGE_DAYS`),
|
|
119
130
|
`spec/compat_spec.rb` names it, and the shim goes (or its date moves)
|
|
@@ -122,6 +133,9 @@ The agent does each step and stops where the user has to say yes.
|
|
|
122
133
|
rebuilds `spec/web/public/exports_baseline.json` from every public module
|
|
123
134
|
except `vendor/`; commit both with the release. If either refresh fails, the
|
|
124
135
|
bump is already written; follow its rerun command before reviewing or committing.
|
|
136
|
+
The corpus also holds System 1's judgments log (`guardrails/judgments.jsonl`), its saved runs
|
|
137
|
+
(`system_one/runs/`) and the context candidates' record (`context_candidates.jsonl`), written by
|
|
138
|
+
`CompatMachineStores`; the bump stops when one names this machine.
|
|
125
139
|
5. **Check.** Add all release files, including the new compatibility corpus, then run it:
|
|
126
140
|
`git add -A && git commit -m "Release X.Y.Z"` and `bundle exec rake release:check`.
|
|
127
141
|
Fix anything it finds in new commits and run it again.
|
|
@@ -154,6 +168,20 @@ If the run fails before `gem push`, fix it on main, delete the tag
|
|
|
154
168
|
version that reached rubygems.org can never be pushed again: fix forward with
|
|
155
169
|
the next patch version.
|
|
156
170
|
|
|
171
|
+
## Bumping WorkerLink::PROTOCOL
|
|
172
|
+
|
|
173
|
+
`WorkerLink::PROTOCOL` (the `protocol` in a worker's `bridge.json`) is what an older chi web, terminal or schedule
|
|
174
|
+
tick refuses a newer worker on (`Skew`: 502 `worker_newer`, "Lost the session's worker", a skipped session), so a bump
|
|
175
|
+
makes every un-restarted older reader refuse every worker of the release. An additive link change (a new sidecar key,
|
|
176
|
+
Bridge route or `Bridge::FEATURES` name) is no bump: clients check a feature name, not a version. Bump only when an
|
|
177
|
+
older client would do damage driving a newer worker: a sidecar key, route or feature name removed, renamed or given a
|
|
178
|
+
new meaning, or the secret rule changed. Every bump needs the owner's OK and a CHANGELOG line ("older chi web and
|
|
179
|
+
terminals refuse workers of this release until restarted"). A worker on an older protocol is never refused (a restart
|
|
180
|
+
is suggested, never gated). `spec/worker_link_contract_spec.rb` holds each protocol's list (sidecar keys with their
|
|
181
|
+
JSON type, routes, features): it fails when an entry of the current protocol's list is missing. The fix is a bump with
|
|
182
|
+
a new list under the new number, the old list kept as history; removing the entry is not. The policy's one place in
|
|
183
|
+
code is the `PROTOCOL` comment in `lib/samagotchi/worker_link.rb`.
|
|
184
|
+
|
|
157
185
|
## One-time setup
|
|
158
186
|
|
|
159
187
|
Done once, before the first release, in one sitting (the pending publisher
|
data/docs/scheduling.md
CHANGED
|
@@ -47,8 +47,9 @@ text, and one that starts with `!` is refused by `chi schedule add` and `schedul
|
|
|
47
47
|
An entry stored with one before that fails when it fires (toward its `max_failures`),
|
|
48
48
|
before anything is started or delivered. A chi web
|
|
49
49
|
(or cron tick) still running an older chi starts chain links without the origin, so
|
|
50
|
-
restart it after updating.
|
|
51
|
-
|
|
50
|
+
restart it after updating. A participant's turn is denied the schedule tools
|
|
51
|
+
([guardrails.md](guardrails.md)): like `register_reminder`, `schedule_task` and
|
|
52
|
+
`cancel_schedule` are owner-voiced, and `list_schedules` reads the owner's schedules.
|
|
52
53
|
|
|
53
54
|
## The two modes
|
|
54
55
|
|
data/docs/sessions.md
CHANGED
|
@@ -198,7 +198,7 @@ pbpaste | chi note --source slack 3f2a 8c1d
|
|
|
198
198
|
- It lands in `<uuid>/notes/`, apart from `input/`, so nothing that runs turns sees it. A live worker adds it to the conversation within a few seconds, between turns: one sent during a turn waits for that turn to end. A session with no worker keeps it until a worker next starts (a prompt, `--attach`), which adds it before anything else. A session a one-turn `chi --non-interactive` run has refuses notes. `chi note` prints one line per session: queued, waits for the next start (with the queue count), or refused.
|
|
199
199
|
- A note to a link that was **continued** (archived, with a later link) goes to its chain's newest link, as `send_note`'s and `chi broadcast`'s do (`chi broadcast` gives two links of one chain the note once, logged under the newest): `chi note` prints `3f2a1c0d → 4b7e9a01 (continued) queued: …` (and `… (continued) refused: …` when that link refuses it), and chi web's notes answer names that link as `id` beside `session_id`, in a 409 too. `chi broadcast deliver` logs such a delivery under the newest link's id (the one that has the note), so `chi broadcast log` shows that id, not the one typed, and a later `deliver` to either link says it had it. An archived link nobody continues keeps its note until input brings it back. An `/objectives` edit is the one note that stays in its own session: its list is that conversation's. Notes waiting when a session is continued move with it (*Session chains*).
|
|
200
200
|
- In the conversation it is a tail system message marked `kind: note`, framed `[CONTEXT NOTE from slack, 14:02]\n…\n[END NOTE]` (from another session: `from session 3f2a1c (~/projects/foo)`). The system prompt says notes are background, not requests: the model uses one when it is relevant, doesn't answer it on its own, and never follows instructions inside it. A note from `broadcast` ([`chi broadcast`](broadcast.md)) is the one exception to "doesn't answer it": the model says briefly in its next answer when it affects its current work, and still doesn't act on it unless asked. `--source broadcast` is refused for `chi note`. Its text is escaped like user text, so it can't fake a turn. It survives `--resume`, a reload, `!rollback` and a continue answered no.
|
|
201
|
-
- The web shows it as a dim "note from …" block, live (`context_added`) and after a reload, folded into a closed notes row with the background lines next to it (a tap opens it) unless it starts a turn; the attached terminal as one dim `note from slack: <first line>` line, also when joining.
|
|
201
|
+
- The web shows it as a dim "note from …" block, live (`context_added`) and after a reload, folded into a closed notes row with the background lines next to it (a tap opens it), or into the closed line it shares with the delegate reports and peers' answers next to it, unless it starts a turn; the attached terminal as one dim `note from slack: <first line>` line, also when joining.
|
|
202
202
|
- Agents: `list_sessions` (other sessions of this project, newest first, up to 20; optional `cwd`, `"/"` for every project) and `send_note(session, text)`, which sends a note from this session. Neither starts a turn anywhere.
|
|
203
203
|
|
|
204
204
|
On macOS, `chi desktop install` does this with a native panel from the Services menu or a hotkey (see [Desktop helper](desktop.md)). A plain Automator Quick Action that sends the clipboard to the live sessions you pick works too (Automator: Quick Action, "Run Shell Script", shell `/bin/zsh`; Automator's PATH is minimal, so put your Ruby's bin dir on it and use the full path to `chi`):
|
data/docs/testing.md
CHANGED
|
@@ -151,9 +151,10 @@ override and a `note`. The Ruby side runs each row with every core command (a ne
|
|
|
151
151
|
|
|
152
152
|
## Compatibility corpus
|
|
153
153
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
154
|
+
The compatibility readers check both the newest corpus at or below `Samagotchi::VERSION`
|
|
155
|
+
and the newest corpus below it, distinct and newest first, so pull requests exercise
|
|
156
|
+
the release users run today as well as the previous corpus. `spec/compat/readers_spec.rb`
|
|
157
|
+
reads those corpora through today's session, Bridge, CardStore, schedules and bundle-record readers, and the files
|
|
157
158
|
other chi versions write into a live session's folder: a queued input file, a
|
|
158
159
|
context note, a continue's intent (`continue.json`) and the stop marker (the
|
|
159
160
|
starting marker isn't recorded: a recorded one is always stale), a bundle's
|
|
@@ -169,6 +170,9 @@ A corpus after 0.168.0 also records every registered cross-version session store
|
|
|
169
170
|
(`SessionStores`): objective checks, tracks and proposal cards, delegates,
|
|
170
171
|
pending cards, reminders and parent overrides. The starting marker is the
|
|
171
172
|
documented stale-file exception.
|
|
173
|
+
A corpus after 0.192.0 also holds System 1's record (`guardrails/judgments.jsonl`: a rule whose one deny keeps it from
|
|
174
|
+
auto-allowing), its saved runs (`system_one/runs/`) and the context candidates' record (`context_candidates.jsonl`),
|
|
175
|
+
written by `CompatMachineStores` with fixture values only: a machine path in them stops the bump.
|
|
172
176
|
A corpus recorded after 0.165.0 also holds `wire/`: a worker's replies to `GET state`, `snapshot` (after a turn, and
|
|
173
177
|
mid-turn with a prompt queued behind it) and `tail`, each `{route, status, body}`, and the session file it saved,
|
|
174
178
|
plus `events.json`, the page's parsed `{type, data}` SSE replay from sequence 0, recorded from a real Engine and Bridge
|
|
@@ -184,6 +188,20 @@ show. `spec/compat/wire_readers_spec.rb` serves the recorded replies to today's
|
|
|
184
188
|
with events); `UPDATE_COMPAT_WIRE=1` rewrites them. `release:bump` runs that spec to refresh the fixtures; commit
|
|
185
189
|
`spec/shared/compat_wire/*.json` with the release. `spec/release/compat_wire_spec.rb` checks the recorder (what
|
|
186
190
|
`normalise` pins, and the two-recordings guard).
|
|
191
|
+
A corpus recorded after 0.192.0 also holds `wire/remote/`: what chi web answers `chi --remote` (`SessionAccess::Remote`),
|
|
192
|
+
one `{method, path, query, request, status, reply}` file per call (`/api/info`, resolve and its 400 `ambiguous_id`
|
|
193
|
+
and `head=1`, the brief show and its 404, summaries, wait prepare, wait and the 409 `busy`, `delete_plan`, peers,
|
|
194
|
+
a delete's 409 `tasks_running`), recorded by `script/release/compat_remote.rb` (`CompatRemote`: a real `Web::App`
|
|
195
|
+
in LAN mode over a fixed state folder `CompatRemote.with_state` writes, no worker; a worker start raises).
|
|
196
|
+
`spec/compat/remote_readers_spec.rb` checks both directions: today's `Remote` driven through the same calls
|
|
197
|
+
(`CompatRemote.drive`) on an older chi web's replies, served by request (method, path, sorted query and body; an
|
|
198
|
+
unrecorded one is the older chi web's 404), every value asserted so a parser's fallback fails; and each recorded
|
|
199
|
+
request sent to today's `Web::App`, which must answer the same status and keep every key path of the old reply with
|
|
200
|
+
its JSON type. Both skip while the newest previous corpus has none (0.192.0 and before); a third example runs both on a
|
|
201
|
+
recording made now. No golden fixture: a new answer field changes nothing. The JSON-type check sees only what the fixed state fills
|
|
202
|
+
in: a value that is null or an empty array there (`delete_plan`'s delegates and tasks lists, a show's or a summary
|
|
203
|
+
row's null fields) is not type-checked, so a field read from such a place needs a state that fills it. `CompatRemote`'s ids, times and state
|
|
204
|
+
are what both sides read, so change them only with a new release's corpus in mind.
|
|
187
205
|
A second example reads a corpus the writer records now, so a writer change that
|
|
188
206
|
today's readers can't read goes red before the release. `rake
|
|
189
207
|
release:bump[X.Y.Z]` writes `spec/compat/X.Y.Z/` using the current writers
|
|
@@ -197,6 +215,20 @@ each Ruby one naming it in a comment (`compat shim <id>`). `spec/compat_spec.rb`
|
|
|
197
215
|
fails once `Samagotchi::VERSION` passes a shim's `remove_after`, naming it:
|
|
198
216
|
remove the shim, or move its date with the owner's OK. A new shim gets a row
|
|
199
217
|
when compatibility code is needed for a previous release.
|
|
218
|
+
Every `compat shim <id>` comment in `lib/`, `script/`, `bin/` and `spec/` (Ruby files and scripts; a comment wrapped
|
|
219
|
+
onto its next `#` line counts) must name a `SHIMS` row: `spec/compat_spec.rb` lists the unregistered ids with their
|
|
220
|
+
files.
|
|
221
|
+
|
|
222
|
+
A release that changes a file format holds both directions, or it doesn't merge: N reads what N-1 writes (a reader
|
|
223
|
+
kept as a `Compat::SHIMS` row, at least 14 days), and N-1 reads what N writes (an additive shape only, or a new file
|
|
224
|
+
name). There is no unshimmed format change. No spec checks the second direction (an N-1 worker reading the new shape
|
|
225
|
+
N's chi web or CLI wrote); review does.
|
|
226
|
+
|
|
227
|
+
`spec/worker_link_contract_spec.rb` pins what an older client drives a newer worker on, per `WorkerLink::PROTOCOL`: a
|
|
228
|
+
checked-in list of the sidecar keys a real Bridge writes (with their JSON type), its `Bridge::ROUTES` and its
|
|
229
|
+
`Bridge::FEATURES`. It is removal-only: extras pass, and a missing or retyped entry fails naming it. That is a protocol
|
|
230
|
+
bump with the owner's OK, never a deleted entry (docs/releasing.md, "Bumping WorkerLink::PROTOCOL"). It runs on every
|
|
231
|
+
PR, from constants and a Bridge started in process, with no corpus.
|
|
200
232
|
|
|
201
233
|
## Levels
|
|
202
234
|
|
data/docs/thin-clients.md
CHANGED
|
@@ -282,23 +282,35 @@ One Shortcut with a menu: a new session, your last one, or one picked from
|
|
|
282
282
|
your recent ones. `<chi>` is your chi web's address (`https://…` through
|
|
283
283
|
[Tailscale Serve](configuration.md#tailscale-serve-your-tailnet)), and every
|
|
284
284
|
**Get Contents of URL** has method POST (GET for the list), the header
|
|
285
|
-
`Authorization: Bearer <token>` and
|
|
285
|
+
`Authorization: Bearer <token>` and **Request Body: JSON** (Shortcuts' default
|
|
286
|
+
is Form, which chi answers with 400 `invalid_json`). Set
|
|
286
287
|
[`web.ask_dir`](configuration.md#all-settings) so New needs no folder (or add
|
|
287
288
|
`dir` to its body).
|
|
288
289
|
|
|
289
290
|
1. **Choose from Menu** with New, Last and Pick.
|
|
290
291
|
2. In each: **Dictate Text**, then **Format Date** (Current Date, custom
|
|
291
|
-
format `yyyyMMddHHmmssSSS`) and **Set Variable** `key` to it.
|
|
292
|
+
format `yyyyMMddHHmmssSSS`) and **Set Variable** `key` to it. ISO 8601 with
|
|
293
|
+
Include Time also works (no spaces) but has second precision: two asks in
|
|
294
|
+
the same second share a key, and the second gets the first's answer. The
|
|
295
|
+
built-in Short, Medium and Long formats contain spaces: refused (400
|
|
296
|
+
`invalid_ask`).
|
|
292
297
|
- New: **Get Contents of URL** `<chi>/api/sessions` with `prompt` = the
|
|
293
298
|
dictated text, `reply_for` = `voice`, `request_id` = `key`.
|
|
294
299
|
- Last: the same body to `<chi>/api/sessions/last/ask`.
|
|
295
|
-
- Pick:
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
**
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
300
|
+
- Pick:
|
|
301
|
+
1. **Get Contents of URL** (GET)
|
|
302
|
+
`<chi>/api/sessions/summaries?limit=30&tests=0&delegates=0`.
|
|
303
|
+
2. **Repeat with Each** item in Contents of URL; inside it one **Text**:
|
|
304
|
+
Repeat Item → **Get Value for Key** `desc`, then ` · `, then Repeat
|
|
305
|
+
Item → `short_id`.
|
|
306
|
+
3. After **End Repeat** (not inside the loop): **Choose from List** over
|
|
307
|
+
**Repeat Results**.
|
|
308
|
+
4. **Split Text** the choice by Custom ` · ` (a space on both sides) and
|
|
309
|
+
**Get Item from List** Last Item (`desc` has a ` · ` of its own).
|
|
310
|
+
5. **Text** with that item, then **Replace Text** `\s+` (Regular
|
|
311
|
+
Expression on) with nothing: the split item can carry a trailing
|
|
312
|
+
space or line break, which breaks the URL silently.
|
|
313
|
+
6. The same body to `<chi>/api/sessions/<Updated Text>/ask`.
|
|
302
314
|
**Set Variable** `answer` to the result.
|
|
303
315
|
3. After the menu: **If** `answer`'s `error` is `worker_timeout` or
|
|
304
316
|
`server_stopping`, send the same request once more with the same `key` (it
|
|
@@ -314,8 +326,12 @@ Judge success by `text` (and `created` for New), not by `status`: an older chi
|
|
|
314
326
|
web's create answers a `status` of its own. Shortcuts can't catch a **Get
|
|
315
327
|
Contents of URL** that fails outright (no connection): the shortcut stops
|
|
316
328
|
there, so the `request_id` retry covers only an answer with an `error`; run
|
|
317
|
-
the shortcut again with a new message.
|
|
318
|
-
|
|
329
|
+
the shortcut again with a new message. Shortcuts doesn't stop on an HTTP error
|
|
330
|
+
answer either: chi's `{"error", "detail"}` comes back as the result, so a
|
|
331
|
+
missing **Set Variable** `answer` or an error nobody speaks looks like
|
|
332
|
+
"nothing happened". Add a **Quick Look** of Contents of URL after **Get
|
|
333
|
+
Contents of URL** to see it. This recipe was checked on an iPhone (2026-11-28,
|
|
334
|
+
chi 0.192.0).
|
|
319
335
|
|
|
320
336
|
For running chi from another agent instead (`chi send --wait`, `chi answer`),
|
|
321
337
|
see [chi as a sub-agent](sub-agent.md). The routes in full are in
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: claude-peer
|
|
3
|
-
version: 0.
|
|
3
|
+
version: 0.8.0
|
|
4
4
|
scope: system
|
|
5
5
|
description: "Pair this session with a Claude Code session you work with: the claude_send tool and /claude send it a part of the work (a plan step, a diff, a finding) to validate or as context, and Claude's answer comes back as a message with its text (chi peer say); /claude install-skill installs Claude's chi-peer skill, which pairs"
|
|
6
6
|
trust_level: reviewed
|
|
@@ -14,7 +14,7 @@ plugin:
|
|
|
14
14
|
scripts:
|
|
15
15
|
pair-remote: sha256:d7681f87a194e540b629564f84cad9f2d0a763197502c74614276ef88a8920cc
|
|
16
16
|
pair: sha256:98cddde54801f49b123cd0269f9ddc834b2566fde4ad241c07a50f3b794fedd0
|
|
17
|
-
chi-peer-SKILL.md: sha256:
|
|
17
|
+
chi-peer-SKILL.md: sha256:c5e33144978b950651d71ce872b5a6916d7314954b7b01bc79936fd1948f304d
|
|
18
18
|
# The plugin needs Samagotchi::Plugin::Peer on the mailbox: chi.peer and
|
|
19
19
|
# ctx.peers, and the skill's chi peer pair|say, are the next chi's (an older
|
|
20
20
|
# chi has no chi.peer: the plugin fails to load there).
|
|
@@ -67,20 +67,34 @@ permissions.
|
|
|
67
67
|
- **context**: take it in for your own work. No reply, unless something in it
|
|
68
68
|
contradicts what you know: then reply with that.
|
|
69
69
|
- **question**: answer it briefly.
|
|
70
|
-
- **moved**: chi continued the session (below).
|
|
71
70
|
|
|
72
71
|
Tell the user in one line what came in and what you answered.
|
|
73
72
|
|
|
74
73
|
## Reply into chi
|
|
75
74
|
|
|
76
|
-
Say the answer with `chi peer say`, one message per answer
|
|
75
|
+
Say the answer with `chi peer say`, one message per answer. Write the
|
|
76
|
+
answer to a file first, then say it from the file:
|
|
77
77
|
|
|
78
78
|
```sh
|
|
79
|
-
chi
|
|
79
|
+
mkdir -p "${TMPDIR:-/tmp}/chi-peer" && cat > "${TMPDIR:-/tmp}/chi-peer/answer-s-ab12cd.md" <<'EOF'
|
|
80
80
|
<the full answer>
|
|
81
81
|
EOF
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
+
```sh
|
|
85
|
+
chi peer say claude <id> --wake --re s-ab12cd --summary "validate <title>: VERDICT CHANGES, 2 issues" --wait 8 < "${TMPDIR:-/tmp}/chi-peer/answer-s-ab12cd.md"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Name the file by the `ref:` you answer (`answer-<what>.md` for a message you
|
|
89
|
+
start). When the say is refused with words that say to try again (`try again
|
|
90
|
+
in a moment`, `say it again in a moment`), run the same say command again a
|
|
91
|
+
moment later, from the same file: don't write the answer again. When the
|
|
92
|
+
shell says the file isn't there (`No such file or directory`: chi never ran),
|
|
93
|
+
write the file again, then run the say. Otherwise run it again only then:
|
|
94
|
+
after a line that starts `#N received`, or another failure with no line (a
|
|
95
|
+
timeout), the message may be in chi already, so don't say it again. After a
|
|
96
|
+
`#N received` line, remove the file.
|
|
97
|
+
|
|
84
98
|
- Always give `--wake` or `--nowake`: `--wake` for a validate or a question
|
|
85
99
|
(chi asked and is waiting), and for a message you start yourself that chi
|
|
86
100
|
should act on or know now (below); `--nowake` for a reply to context and for
|
|
@@ -101,8 +115,8 @@ EOF
|
|
|
101
115
|
this when the turn ends`). If it says **held**, don't send again, and don't
|
|
102
116
|
use `chi send` to get past it: the user decides when chi goes on.
|
|
103
117
|
- A say that is **refused** (exit 1) says why: not paired (pair again), the
|
|
104
|
-
session was continued (below),
|
|
105
|
-
session).
|
|
118
|
+
session was continued (below), busy (`try again in a moment`: the same
|
|
119
|
+
command again), chi's worker is older (the user restarts the session).
|
|
106
120
|
- Never answer a chi message with `chi send`: it goes in as an agent's
|
|
107
121
|
message (yours, not the user's) and counts toward the session's wake
|
|
108
122
|
budget (`session.max_wakes`), outside the round's limit. Use it only when
|
|
@@ -122,18 +136,20 @@ note, and the line says so. Don't send one only to acknowledge.
|
|
|
122
136
|
|
|
123
137
|
## chi continued the session
|
|
124
138
|
|
|
125
|
-
chi can continue its session as a new one, with a new id
|
|
126
|
-
with
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
139
|
+
chi can continue its session as a new one, with a new id; your pairing goes
|
|
140
|
+
with it, so there is nothing to do. The id in a chi message's header is the
|
|
141
|
+
session to answer. A line that says `continued as <id>` names the new one
|
|
142
|
+
(the say's line ends `session continued as <id>: answer there`): answer that
|
|
143
|
+
id from then on. An older chi doesn't take the pairing along: it sends a
|
|
144
|
+
`chi <old> · moved · continued as <new id>` message instead. Don't reply to
|
|
145
|
+
it: pair again with the new id, as before (below), and answer that id.
|
|
146
|
+
|
|
147
|
+
- **A say refused** with `this session was continued as <new id>` (an older
|
|
148
|
+
chi, or a continue that couldn't take your pairing along): pair again with
|
|
149
|
+
the new id, the same way you paired before (the same `CHI_REMOTE`; over
|
|
150
|
+
SSH, `pair-remote` with the new id: the new id gets its own socket and
|
|
151
|
+
forward), then run the say again to the new id, from the same file.
|
|
152
|
+
Messages chi hadn't read yet reach the new session as one note: don't
|
|
137
153
|
send them again.
|
|
138
154
|
|
|
139
155
|
## chi on another machine over SSH
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: codex-peer
|
|
3
|
-
version: 0.
|
|
3
|
+
version: 0.7.0
|
|
4
4
|
scope: system
|
|
5
5
|
description: "Pair this session with an OpenAI Codex CLI session you work with: the codex_send tool and /codex send it a part of the work (a plan step, a diff, a finding) to validate or as context, with codex queue, and Codex's answer comes back as a message with its text (chi peer say); /codex install-skill installs Codex's chi-peer skill, which pairs"
|
|
6
6
|
trust_level: reviewed
|
|
@@ -13,7 +13,7 @@ plugin:
|
|
|
13
13
|
sha256: sha256:2a1998dac902d5eb5987ef0d90121688a08acc74d640292fe0893ac95e69ca37
|
|
14
14
|
scripts:
|
|
15
15
|
pair: sha256:ce80efa7ce0b8c1cd2ae430ea9a9a7a44119905f598e985dcefb325df4f2ed84
|
|
16
|
-
chi-peer-SKILL.md: sha256:
|
|
16
|
+
chi-peer-SKILL.md: sha256:b24ec6ee3b5b3de6a69fa4b347dbc3593bba03a7f3602f9120c00d2b2e9b1024
|
|
17
17
|
# The plugin needs Samagotchi::Plugin::Peer on the mailbox: chi.peer and
|
|
18
18
|
# ctx.peers, and the skill's chi peer pair|say, are the next chi's (an older
|
|
19
19
|
# chi has no chi.peer: the plugin fails to load there).
|