@junghanacs/entwurf 0.17.2 → 0.18.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.
- package/AGENTS.md +2 -1
- package/CHANGELOG.md +127 -0
- package/mcp/entwurf-bridge/dist/mcp/entwurf-bridge/src/index.js +14 -9
- package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-deliverability.js +76 -0
- package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-fact-provider.js +9 -6
- package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-facts.js +11 -3
- package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-peer-observe.js +66 -0
- package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-peers-render.js +10 -1
- package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-v2-decider.js +8 -2
- package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-v2-production.js +25 -13
- package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-v2-surface.js +6 -0
- package/mcp/entwurf-bridge/dist/pi-extensions/lib/meta-session.js +38 -0
- package/mcp/entwurf-bridge/dist/pi-extensions/meta-bridge-hook.js +64 -4
- package/mcp/entwurf-bridge/src/index.ts +16 -8
- package/package.json +3 -2
- package/pi-extensions/lib/entwurf-deliverability.ts +104 -0
- package/pi-extensions/lib/entwurf-fact-provider.ts +20 -6
- package/pi-extensions/lib/entwurf-facts.ts +52 -3
- package/pi-extensions/lib/entwurf-peer-observe.ts +77 -0
- package/pi-extensions/lib/entwurf-peers-render.ts +12 -1
- package/pi-extensions/lib/entwurf-v2-decider.ts +26 -8
- package/pi-extensions/lib/entwurf-v2-production.ts +32 -12
- package/pi-extensions/lib/entwurf-v2-surface.ts +6 -0
- package/pi-extensions/lib/meta-session.ts +44 -0
- package/pi-extensions/meta-bridge-hook.ts +72 -3
- package/run.sh +21 -0
- package/scripts/check-bridge-delivery.ts +42 -1
- package/scripts/check-entwurf-fact-provider.ts +22 -1
- package/scripts/check-entwurf-facts.ts +17 -2
- package/scripts/check-entwurf-peers-surface.ts +20 -2
- package/scripts/check-entwurf-self-address.ts +20 -2
- package/scripts/check-entwurf-v2-decider.ts +6 -3
- package/scripts/check-entwurf-v2-matrix.ts +10 -5
- package/scripts/check-entwurf-v2-production.ts +72 -1
- package/scripts/check-gate-qualification.ts +1 -0
- package/scripts/check-meta-hook-session-switch.ts +560 -0
- package/scripts/meta-bridge-doctor.sh +29 -4
- package/scripts/mutants/meta-hook-session-switch.json +223 -0
- package/scripts/raw-claude-session-switch/README.md +170 -0
- package/scripts/smoke-acp-cortex-live.ts +22 -2
- package/scripts/smoke-acp-v2-send-live.ts +23 -2
- package/scripts/smoke-entwurf-chain-live.ts +85 -13
- package/scripts/smoke-entwurf-v2-matrix-live.ts +23 -1
- package/scripts/smoke-mux-fresh-call-live.ts +13 -3
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"lane": "meta-hook-session-switch",
|
|
4
|
+
"mutants": [
|
|
5
|
+
{
|
|
6
|
+
"claim": "MHSS-RETIRE-PREV-GARDEN",
|
|
7
|
+
"title": "a hook that never retires the garden its pid stopped serving leaves the abandoned startup session advertising a doorbell nobody holds — the abandoned-session registration measured on oracle, where a real message sat unread in its mailbox for an hour",
|
|
8
|
+
"subject": "pi-extensions/meta-bridge-hook.ts",
|
|
9
|
+
"find": ["\t\tif (previous && previous.gardenId !== gardenId) {"],
|
|
10
|
+
"replace": ["\t\tif (false && previous && previous.gardenId !== gardenId) {"],
|
|
11
|
+
"gate": ["bash", "run.sh", "check-meta-hook-session-switch"],
|
|
12
|
+
"timeoutSeconds": 300,
|
|
13
|
+
"signature": "[QK:MHSS-RETIRE-PREV-GARDEN]",
|
|
14
|
+
"signatureSource": "scripts/check-meta-hook-session-switch.ts"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"claim": "MHSS-RETIRE-KEEPS-CURRENT",
|
|
18
|
+
"title": "retiring on ANY previous sender marker instead of a CHANGED one disarms the live session's own inbox on its next keystroke — the repair eating the citizen it exists to protect, which is worse than the defect",
|
|
19
|
+
"subject": "pi-extensions/meta-bridge-hook.ts",
|
|
20
|
+
"find": ["\t\tif (previous && previous.gardenId !== gardenId) {"],
|
|
21
|
+
"replace": ["\t\tif (previous) {"],
|
|
22
|
+
"gate": ["bash", "run.sh", "check-meta-hook-session-switch"],
|
|
23
|
+
"timeoutSeconds": 300,
|
|
24
|
+
"signature": "[QK:MHSS-RETIRE-KEEPS-CURRENT]",
|
|
25
|
+
"signatureSource": "scripts/check-meta-hook-session-switch.ts"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"claim": "MHSS-RETIRE-ONLY-OWN-OWNER",
|
|
29
|
+
"title": "dropping the owner-pid guard lets one session's SessionStart delete a marker another LIVE process holds — a silent cross-session disarm, not a stale-marker cleanup",
|
|
30
|
+
"subject": "pi-extensions/lib/meta-session.ts",
|
|
31
|
+
"find": ["\t\tif (!marker || marker.ownerPid !== opts.ownerPid) return false;"],
|
|
32
|
+
"replace": ["\t\tif (!marker) return false;"],
|
|
33
|
+
"gate": ["bash", "run.sh", "check-meta-hook-session-switch"],
|
|
34
|
+
"timeoutSeconds": 300,
|
|
35
|
+
"signature": "[QK:MHSS-RETIRE-ONLY-OWN-OWNER]",
|
|
36
|
+
"signatureSource": "scripts/check-meta-hook-session-switch.ts"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"claim": "MHSS-SOURCE-LOGGED",
|
|
40
|
+
"title": "dropping the vendor's `source` from the log leaves this host with no receipt for WHY a SessionStart fired — the exact evidence the #101 diagnosis had to inherit from vendor docs because nothing here recorded it",
|
|
41
|
+
"subject": "pi-extensions/meta-bridge-hook.ts",
|
|
42
|
+
"find": [
|
|
43
|
+
"\tconst source = typeof env.source === \"string\" && env.source.length > 0 ? env.source : \"(unset)\";"
|
|
44
|
+
],
|
|
45
|
+
"replace": ["\tconst source = \"(unset)\";"],
|
|
46
|
+
"gate": ["bash", "run.sh", "check-meta-hook-session-switch"],
|
|
47
|
+
"timeoutSeconds": 300,
|
|
48
|
+
"signature": "[QK:MHSS-SOURCE-LOGGED]",
|
|
49
|
+
"signatureSource": "scripts/check-meta-hook-session-switch.ts"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"claim": "MHSS-SENDER-JOIN-MEASURED",
|
|
53
|
+
"title": "a join that always answers yes turns the receiver marker back into proof of something it never proved — that the process holding it is still serving THIS garden",
|
|
54
|
+
"subject": "pi-extensions/lib/entwurf-deliverability.ts",
|
|
55
|
+
"find": [
|
|
56
|
+
"\treturn !!senderMarker && senderMarker.gardenId === marker.gardenId && senderMarker.backend === marker.backend;"
|
|
57
|
+
],
|
|
58
|
+
"replace": ["\treturn true;"],
|
|
59
|
+
"gate": ["bash", "run.sh", "check-meta-hook-session-switch"],
|
|
60
|
+
"timeoutSeconds": 300,
|
|
61
|
+
"signature": "[QK:MHSS-SENDER-JOIN-MEASURED]",
|
|
62
|
+
"signatureSource": "scripts/check-meta-hook-session-switch.ts"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"claim": "MHSS-SEAM-USES-JOIN",
|
|
66
|
+
"title": "restoring `watchArmed` as a copy of the identity match at the production seam re-ships the false deliverable even with the join intact — the shipped line that let a message be enqueued into a void",
|
|
67
|
+
"subject": "pi-extensions/lib/entwurf-v2-production.ts",
|
|
68
|
+
"find": [
|
|
69
|
+
"\t\tconst { ownerAlive, watchArmed } = resolveMailboxReceiverFacts(identity, {\n\t\t\treadReceiverMarker: io.readReceiverMarker,\n\t\t\treadSenderMarker: io.readSenderMarker,\n\t\t});"
|
|
70
|
+
],
|
|
71
|
+
"replace": [
|
|
72
|
+
"\t\tconst { ownerAlive } = resolveMailboxReceiverFacts(identity, {\n\t\t\treadReceiverMarker: io.readReceiverMarker,\n\t\t\treadSenderMarker: io.readSenderMarker,\n\t\t});\n\t\tconst watchArmed = ownerAlive;"
|
|
73
|
+
],
|
|
74
|
+
"gate": ["bash", "run.sh", "check-meta-hook-session-switch"],
|
|
75
|
+
"timeoutSeconds": 300,
|
|
76
|
+
"signature": "[QK:MHSS-SEAM-USES-JOIN]",
|
|
77
|
+
"signatureSource": "scripts/check-meta-hook-session-switch.ts"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"claim": "MHSS-REJECT-CARRIES-REASON",
|
|
81
|
+
"title": "dropping the deliverability reason at the decider boundary hands the caller a verdict with no cause — the bare `mailbox-undeliverable` that sent a sibling looking for a dead session when the session was alive and had moved",
|
|
82
|
+
"subject": "pi-extensions/lib/entwurf-v2-decider.ts",
|
|
83
|
+
"find": [
|
|
84
|
+
"\t\t\treturn deliverability.deliverable\n\t\t\t\t? reject(receipt)\n\t\t\t\t: reject(receipt, { kind: \"mailbox-undeliverable\", reason: deliverability.reason });"
|
|
85
|
+
],
|
|
86
|
+
"replace": ["\t\t\treturn reject(receipt);"],
|
|
87
|
+
"gate": ["bash", "run.sh", "check-meta-hook-session-switch"],
|
|
88
|
+
"timeoutSeconds": 300,
|
|
89
|
+
"signature": "[QK:MHSS-REJECT-CARRIES-REASON]",
|
|
90
|
+
"signatureSource": "scripts/check-meta-hook-session-switch.ts"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"claim": "MHSS-REASON-RENDERED",
|
|
94
|
+
"title": "a surface that carries the diagnostic and prints nothing is the same silence one layer up — the operator still reads only `mailbox-undeliverable`",
|
|
95
|
+
"subject": "pi-extensions/lib/entwurf-v2-surface.ts",
|
|
96
|
+
"find": ["\t\t\t\ttext += `\\n mailbox-undeliverable: ${result.diagnostic.reason}`;"],
|
|
97
|
+
"replace": ["\t\t\t\ttext += \"\";"],
|
|
98
|
+
"gate": ["bash", "run.sh", "check-meta-hook-session-switch"],
|
|
99
|
+
"timeoutSeconds": 300,
|
|
100
|
+
"signature": "[QK:MHSS-REASON-RENDERED]",
|
|
101
|
+
"signatureSource": "scripts/check-meta-hook-session-switch.ts"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"claim": "MHSS-PEERS-RECEIVER-OBSERVED",
|
|
105
|
+
"title": "collapsing `inactive` into `none` erases the distinction a reader needs — a watch that was armed and is no longer valid looks exactly like one that was never armed, which is the listing telling a caller nothing again",
|
|
106
|
+
"subject": "pi-extensions/lib/entwurf-peer-observe.ts",
|
|
107
|
+
"find": ["\treturn fs.existsSync(metaReceiverMarkerPath(identity.gardenId)) ? \"inactive\" : \"none\";"],
|
|
108
|
+
"replace": ["\treturn \"none\";"],
|
|
109
|
+
"gate": ["bash", "run.sh", "check-meta-hook-session-switch"],
|
|
110
|
+
"timeoutSeconds": 300,
|
|
111
|
+
"signature": "[QK:MHSS-PEERS-RECEIVER-OBSERVED]",
|
|
112
|
+
"signatureSource": "scripts/check-meta-hook-session-switch.ts"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"claim": "MHSS-PEERS-TRANSCRIPT-OBSERVED",
|
|
116
|
+
"title": "reporting every transcript as present hides exactly the phantom this column exists to show: a registration minted at SessionStart with no conversation ever written behind it",
|
|
117
|
+
"subject": "pi-extensions/lib/entwurf-peer-observe.ts",
|
|
118
|
+
"find": [
|
|
119
|
+
"\t\treturn identity.transcriptPath && fs.existsSync(identity.transcriptPath) ? \"exists\" : \"absent\";"
|
|
120
|
+
],
|
|
121
|
+
"replace": ["\t\treturn \"exists\";"],
|
|
122
|
+
"gate": ["bash", "run.sh", "check-meta-hook-session-switch"],
|
|
123
|
+
"timeoutSeconds": 300,
|
|
124
|
+
"signature": "[QK:MHSS-PEERS-TRANSCRIPT-OBSERVED]",
|
|
125
|
+
"signatureSource": "scripts/check-meta-hook-session-switch.ts"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"claim": "MHSS-PEERS-COLUMNS-RENDERED",
|
|
129
|
+
"title": "measuring both axes and printing neither returns the listing to two identical rows for a live citizen and a phantom — the surface gap that made a sibling dispatch into a void",
|
|
130
|
+
"subject": "pi-extensions/lib/entwurf-peers-render.ts",
|
|
131
|
+
"find": [
|
|
132
|
+
"\t\t`- ${p.gardenId} backend=${p.backend} liveness=${p.liveness} receiver=${p.receiver} ` +\n\t\t`transcript=${p.transcript} cwd=${p.cwd} model=${model}`"
|
|
133
|
+
],
|
|
134
|
+
"replace": [
|
|
135
|
+
"\t\t`- ${p.gardenId} backend=${p.backend} liveness=${p.liveness} ` + `cwd=${p.cwd} model=${model}`"
|
|
136
|
+
],
|
|
137
|
+
"gate": ["bash", "run.sh", "check-meta-hook-session-switch"],
|
|
138
|
+
"timeoutSeconds": 300,
|
|
139
|
+
"signature": "[QK:MHSS-PEERS-COLUMNS-RENDERED]",
|
|
140
|
+
"signatureSource": "scripts/check-meta-hook-session-switch.ts"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"claim": "MHSS-RETIRE-ARM-CAPABLE-ONLY",
|
|
144
|
+
"title": "retiring from an event that cannot arm subtracts a doorbell with nothing in the same run able to restore one — UserPromptSubmit cannot emit watchPaths, so a retirement reached from there is a one-way disarm",
|
|
145
|
+
"subject": "pi-extensions/meta-bridge-hook.ts",
|
|
146
|
+
"find": [
|
|
147
|
+
"\t\tconst previous =\n\t\t\tarmProvenanceFor(eventName) !== null\n\t\t\t\t? readMetaSenderMarker({ backend: \"claude-code\", ownerPid, verifyOwner: false })\n\t\t\t\t: null;"
|
|
148
|
+
],
|
|
149
|
+
"replace": [
|
|
150
|
+
"\t\tconst previous = readMetaSenderMarker({ backend: \"claude-code\", ownerPid, verifyOwner: false });"
|
|
151
|
+
],
|
|
152
|
+
"gate": ["bash", "run.sh", "check-meta-hook-session-switch"],
|
|
153
|
+
"timeoutSeconds": 300,
|
|
154
|
+
"signature": "[QK:MHSS-RETIRE-ARM-CAPABLE-ONLY]",
|
|
155
|
+
"signatureSource": "scripts/check-meta-hook-session-switch.ts"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"claim": "MHSS-RECORDS-SURVIVE",
|
|
159
|
+
"title": "a retirement that takes the RECORD with the marker deletes identity to clean up presence — the store-certification and fresh-cut rules exist because a record is the only address a citizen has",
|
|
160
|
+
"subject": "pi-extensions/meta-bridge-hook.ts",
|
|
161
|
+
"find": ["\t\t\tconst retired = removeMetaReceiverMarker({ gardenId: previous.gardenId, ownerPid });"],
|
|
162
|
+
"replace": [
|
|
163
|
+
"\t\t\tconst retired = removeMetaReceiverMarker({ gardenId: previous.gardenId, ownerPid });\n\t\t\tfs.rmSync(path.join(defaultMetaSessionsDir(), `${previous.gardenId}.meta.json`), { force: true });"
|
|
164
|
+
],
|
|
165
|
+
"gate": ["bash", "run.sh", "check-meta-hook-session-switch"],
|
|
166
|
+
"timeoutSeconds": 300,
|
|
167
|
+
"signature": "[QK:MHSS-RECORDS-SURVIVE]",
|
|
168
|
+
"signatureSource": "scripts/check-meta-hook-session-switch.ts"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"claim": "MHSS-EXACTLY-ONE-DELIVERABLE",
|
|
172
|
+
"title": "forcing the watch fact closed refuses the citizen the operator is actually in — fail-closed is not free when it closes on every live session too",
|
|
173
|
+
"subject": "pi-extensions/lib/entwurf-v2-production.ts",
|
|
174
|
+
"find": ["\t\t\townerAlive,\n\t\t\twatchArmed,\n\t\t});"],
|
|
175
|
+
"replace": ["\t\t\townerAlive,\n\t\t\twatchArmed: false,\n\t\t});"],
|
|
176
|
+
"gate": ["bash", "run.sh", "check-meta-hook-session-switch"],
|
|
177
|
+
"timeoutSeconds": 300,
|
|
178
|
+
"signature": "[QK:MHSS-EXACTLY-ONE-DELIVERABLE]",
|
|
179
|
+
"signatureSource": "scripts/check-meta-hook-session-switch.ts"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"claim": "MHSS-JOIN-SCOPE-OWNERKIND",
|
|
183
|
+
"title": "admitting copilot-extension into the sender-marker join makes every Copilot citizen permanently mailbox-undeliverable: its watch owner is a forked child whose pid never carries a sender marker, so the join can only ever answer no",
|
|
184
|
+
"subject": "pi-extensions/lib/entwurf-deliverability.ts",
|
|
185
|
+
"find": ["export const SENDER_JOINED_RECEIVER_OWNER_KINDS: readonly string[] = [\"claude-code-cli\"];"],
|
|
186
|
+
"replace": [
|
|
187
|
+
"export const SENDER_JOINED_RECEIVER_OWNER_KINDS: readonly string[] = [\"claude-code-cli\", \"copilot-extension\"];"
|
|
188
|
+
],
|
|
189
|
+
"gate": ["bash", "run.sh", "check-meta-hook-session-switch"],
|
|
190
|
+
"timeoutSeconds": 300,
|
|
191
|
+
"signature": "[QK:MHSS-JOIN-SCOPE-OWNERKIND]",
|
|
192
|
+
"signatureSource": "scripts/check-meta-hook-session-switch.ts"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"claim": "MHSS-SENDER-START-KEY-VERIFIED",
|
|
196
|
+
"title": "reading the sender marker without the pid-reuse guard lets a dead session's leftover file answer \"which garden does this pid serve now?\" — the join then vouches for a watch nobody holds",
|
|
197
|
+
"subject": "pi-extensions/lib/entwurf-v2-production.ts",
|
|
198
|
+
"find": [
|
|
199
|
+
"\t\t\t((backend: string, ownerPid: number) => readMetaSenderMarker({ backend: requireBackend(backend), ownerPid })),"
|
|
200
|
+
],
|
|
201
|
+
"replace": [
|
|
202
|
+
"\t\t\t((backend: string, ownerPid: number) =>\n\t\t\t\treadMetaSenderMarker({ backend: requireBackend(backend), ownerPid, verifyOwner: false })),"
|
|
203
|
+
],
|
|
204
|
+
"gate": ["bash", "run.sh", "check-meta-hook-session-switch"],
|
|
205
|
+
"timeoutSeconds": 300,
|
|
206
|
+
"signature": "[QK:MHSS-SENDER-START-KEY-VERIFIED]",
|
|
207
|
+
"signatureSource": "scripts/check-meta-hook-session-switch.ts"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"claim": "MHSS-JOIN-BACKEND-EQUALITY",
|
|
211
|
+
"title": "comparing only the garden id lets a marker written by another backend under the same pid vouch for this receiver — two harnesses can key markers under one process",
|
|
212
|
+
"subject": "pi-extensions/lib/entwurf-deliverability.ts",
|
|
213
|
+
"find": [
|
|
214
|
+
"\treturn !!senderMarker && senderMarker.gardenId === marker.gardenId && senderMarker.backend === marker.backend;"
|
|
215
|
+
],
|
|
216
|
+
"replace": ["\treturn !!senderMarker && senderMarker.gardenId === marker.gardenId;"],
|
|
217
|
+
"gate": ["bash", "run.sh", "check-meta-hook-session-switch"],
|
|
218
|
+
"timeoutSeconds": 300,
|
|
219
|
+
"signature": "[QK:MHSS-JOIN-BACKEND-EQUALITY]",
|
|
220
|
+
"signatureSource": "scripts/check-meta-hook-session-switch.ts"
|
|
221
|
+
}
|
|
222
|
+
]
|
|
223
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# Raw measurement — what Claude Code's SessionStart actually says on a session switch (#101)
|
|
2
|
+
|
|
3
|
+
**Status: RUN on oracle, 2026-09-04, Claude Code 2.1.260, `--model haiku`.** GLG approved the
|
|
4
|
+
LIVE cells (S1–S5 first, S6 added after). Six cells, one host, one vendor version — that is the
|
|
5
|
+
whole claim. Everything below is verbatim from `~/.pi/agent/meta-bridge-hook.log`, produced by
|
|
6
|
+
the repaired hook, which now logs the envelope's `source` on every line it writes.
|
|
7
|
+
|
|
8
|
+
The #101 repair does **not** depend on any of it: the retirement rule reads the sender marker on
|
|
9
|
+
disk and branches on no vendor field. What this lab adds is the envelope order the diagnosis had
|
|
10
|
+
to inherit from vendor documentation — and it **refuted one inherited sentence** (see S2/S3).
|
|
11
|
+
|
|
12
|
+
## What the lab changed in the story
|
|
13
|
+
|
|
14
|
+
The diagnosis said the two SessionStarts come from the TUI resume picker firing once for a
|
|
15
|
+
placeholder id and again for the picked id. **Measured, that is not what happens.**
|
|
16
|
+
`claude --resume`, with or without the picker, fires exactly ONE SessionStart carrying the real
|
|
17
|
+
id (S2, S3). The two-SessionStart shape comes from a bare `claude` — which mints a real, empty
|
|
18
|
+
new session — followed by an in-session `/resume` or `/clear` (S4, S5). The field case fits: `ps`
|
|
19
|
+
showed pid 143742 started bare `claude` at 09:31:32, and the second SessionStart landed 4s later.
|
|
20
|
+
|
|
21
|
+
The consequence for the repair is nil (either way one pid stops serving one garden and starts
|
|
22
|
+
serving another, and the sender marker is what says so), but the prose was wrong and is now
|
|
23
|
+
corrected in `meta-bridge-hook.ts`, `entwurf-deliverability.ts`, `meta-session.ts` and
|
|
24
|
+
`check-meta-hook-session-switch.ts`.
|
|
25
|
+
|
|
26
|
+
## The three falsification conditions, judged
|
|
27
|
+
|
|
28
|
+
The pre-run README named three findings that would have changed the repair. All three are
|
|
29
|
+
answered:
|
|
30
|
+
|
|
31
|
+
1. **"A switch leaves the sender marker pointing at the OLD garden when the receiver marker has
|
|
32
|
+
already moved"** — the repair's one real assumption. **Not observed.** In S4 and S5 the
|
|
33
|
+
retirement line is written BEFORE the sender marker is rewritten, and both precede the new
|
|
34
|
+
garden's arm (log order below, same millisecond). The hook reads the pre-switch value it needs.
|
|
35
|
+
2. **"Compaction re-fires SessionStart under a NEW native id, so a compacted session is a garden
|
|
36
|
+
switch"** — **refuted.** Compaction (manual S6a and automatic S6b) re-fires SessionStart for
|
|
37
|
+
the SAME native id, attaches the SAME garden, and retires nothing. The same-garden rule covers
|
|
38
|
+
it; nothing had to change.
|
|
39
|
+
3. **"Three SessionStarts in one process"** — **not observed** in any cell. Every switch was
|
|
40
|
+
exactly one additional SessionStart, and the two-drive gate fixture stays adequate.
|
|
41
|
+
|
|
42
|
+
## The cells
|
|
43
|
+
|
|
44
|
+
| cell | how it was reached | SessionStarts | `source` | native id | retirement |
|
|
45
|
+
|---|---|---|---|---|---|
|
|
46
|
+
| S1 | bare `claude` | 1 | `startup` | new | — (nothing prior) |
|
|
47
|
+
| S2 | `claude --resume` → picker → Enter | **1** | `resume` | the picked one | — (no prior garden in this pid) |
|
|
48
|
+
| S3 | `claude --resume <id>` (argv) | **1** | `resume` | the given one | — |
|
|
49
|
+
| S4 | bare `claude`, then in-session `/resume` | **2** | `startup` → `resume` | new → picked | **yes** — the startup garden retired |
|
|
50
|
+
| S5 | in-session `/clear` | 1 more | `clear` | new | **yes** — the previous garden retired |
|
|
51
|
+
| S6a | in-session `/compact` | 1 more | `compact` | **same** | no (same garden) |
|
|
52
|
+
| S6b | automatic compaction at ~98% context | 1 more | `compact` | **same** | no (same garden) |
|
|
53
|
+
|
|
54
|
+
`UserPromptSubmit` carries **no** `source` at all (`source=(unset)`) — worth knowing, since it is
|
|
55
|
+
the event that rewrites the sender marker on every keystroke and must retire nothing.
|
|
56
|
+
|
|
57
|
+
It also always names the session it belongs to. Across the four lab pids, **8 of 8**
|
|
58
|
+
`UserPromptSubmit` events carried the native id their own pid's preceding `SessionStart` had
|
|
59
|
+
established, and none carried any other. The hook runs synchronously inside the session's own
|
|
60
|
+
process, so a keystroke envelope is that session speaking — which is why the pointer it moves is
|
|
61
|
+
treated as authoritative rather than as something to defend against.
|
|
62
|
+
|
|
63
|
+
## Verbatim receipts
|
|
64
|
+
|
|
65
|
+
**S1 — bare `claude`.** One SessionStart, a fresh garden, `source=startup`. Then one turn, whose
|
|
66
|
+
`UserPromptSubmit` carries no source and retires nothing (same garden):
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
2026-09-04T04:10:22.678Z INFO create record 20260904T131022-ac38b6.meta.json (event=SessionStart, source=startup, native=bbba9cbe-f11c-4b67-a0bd-991c3f678238)
|
|
70
|
+
2026-09-04T04:10:22.681Z INFO sender marker 564537 -> 20260904T131022-ac38b6 (event=SessionStart, source=startup)
|
|
71
|
+
2026-09-04T04:10:22.681Z INFO armed watch /home/junghan/.pi/agent/meta-mailbox/20260904T131022-ac38b6/inbox.signal
|
|
72
|
+
2026-09-04T04:10:22.682Z INFO receiver marker 20260904T131022-ac38b6 owner=564537 arm=SessionStart source=startup
|
|
73
|
+
2026-09-04T04:11:00.196Z INFO attach record 20260904T131022-ac38b6.meta.json (event=UserPromptSubmit, source=(unset), native=bbba9cbe-f11c-4b67-a0bd-991c3f678238)
|
|
74
|
+
2026-09-04T04:11:00.198Z INFO sender marker 564537 -> 20260904T131022-ac38b6 (event=UserPromptSubmit, source=(unset))
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**S2 — `claude --resume`, picker, Enter.** Nothing at all is logged while the picker is open; the
|
|
78
|
+
single SessionStart lands on selection, already carrying the real native id. **No placeholder.**
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
2026-09-04T04:12:24.853Z INFO attach record 20260904T131022-ac38b6.meta.json (event=SessionStart, source=resume, native=bbba9cbe-f11c-4b67-a0bd-991c3f678238)
|
|
82
|
+
2026-09-04T04:12:24.855Z INFO sender marker 565726 -> 20260904T131022-ac38b6 (event=SessionStart, source=resume)
|
|
83
|
+
2026-09-04T04:12:24.855Z INFO armed watch /home/junghan/.pi/agent/meta-mailbox/20260904T131022-ac38b6/inbox.signal
|
|
84
|
+
2026-09-04T04:12:24.855Z INFO receiver marker 20260904T131022-ac38b6 owner=565726 arm=SessionStart source=resume
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**S3 — `claude --resume <id>` (argv).** Same shape as S2:
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
2026-09-04T04:14:53.710Z INFO attach record 20260904T131022-ac38b6.meta.json (event=SessionStart, source=resume, native=bbba9cbe-f11c-4b67-a0bd-991c3f678238)
|
|
91
|
+
2026-09-04T04:14:53.711Z INFO sender marker 568726 -> 20260904T131022-ac38b6 (event=SessionStart, source=resume)
|
|
92
|
+
2026-09-04T04:14:53.711Z INFO armed watch /home/junghan/.pi/agent/meta-mailbox/20260904T131022-ac38b6/inbox.signal
|
|
93
|
+
2026-09-04T04:14:53.712Z INFO receiver marker 20260904T131022-ac38b6 owner=568726 arm=SessionStart source=resume
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**S4 — THE cell: bare `claude`, then `/resume`.** This is #101 reproduced deliberately, and the
|
|
97
|
+
repair firing on it. One pid (566479), two gardens, 33 seconds apart:
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
2026-09-04T04:13:04.371Z INFO create record 20260904T131304-f85f0e.meta.json (event=SessionStart, source=startup, native=aa49d155-8416-41a5-9d59-52d747b428d7)
|
|
101
|
+
2026-09-04T04:13:04.372Z INFO sender marker 566479 -> 20260904T131304-f85f0e (event=SessionStart, source=startup)
|
|
102
|
+
2026-09-04T04:13:04.373Z INFO armed watch /home/junghan/.pi/agent/meta-mailbox/20260904T131304-f85f0e/inbox.signal
|
|
103
|
+
2026-09-04T04:13:04.373Z INFO receiver marker 20260904T131304-f85f0e owner=566479 arm=SessionStart source=startup
|
|
104
|
+
2026-09-04T04:13:37.966Z INFO attach record 20260904T131022-ac38b6.meta.json (event=SessionStart, source=resume, native=bbba9cbe-f11c-4b67-a0bd-991c3f678238)
|
|
105
|
+
2026-09-04T04:13:37.967Z INFO retired receiver marker 20260904T131304-f85f0e — owner pid 566479 switched to 20260904T131022-ac38b6 (event=SessionStart, source=resume)
|
|
106
|
+
2026-09-04T04:13:37.968Z INFO sender marker 566479 -> 20260904T131022-ac38b6 (event=SessionStart, source=resume)
|
|
107
|
+
2026-09-04T04:13:37.969Z INFO armed watch /home/junghan/.pi/agent/meta-mailbox/20260904T131022-ac38b6/inbox.signal
|
|
108
|
+
2026-09-04T04:13:37.970Z INFO receiver marker 20260904T131022-ac38b6 owner=566479 arm=SessionStart source=resume
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
State immediately after, read from the real store (read-only):
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
- 20260904T131022-ac38b6 backend=claude-code liveness=unsupported receiver=active transcript=exists cwd=…/scratchpad/lab
|
|
115
|
+
- 20260904T131304-f85f0e backend=claude-code liveness=unsupported receiver=none transcript=absent cwd=…/scratchpad/lab
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Both records survive. `meta-receivers/` holds only `20260904T131022-ac38b6.json`, and
|
|
119
|
+
`meta-senders/claude-code/566479.json` names `20260904T131022-ac38b6`. Before the repair the
|
|
120
|
+
abandoned garden would have read `receiver=active` and accepted mail — that is the #101 defect,
|
|
121
|
+
and this is the same shape as the field case (`ac7a1a`, still on this host as evidence).
|
|
122
|
+
|
|
123
|
+
**S5 — `/clear`.** Same switch shape, `source=clear`, and the retirement fires again:
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
2026-09-04T04:14:18.703Z INFO create record 20260904T131418-31129e.meta.json (event=SessionStart, source=clear, native=eac3c9ae-2873-454b-90ca-11b7ee24b508)
|
|
127
|
+
2026-09-04T04:14:18.705Z INFO retired receiver marker 20260904T131022-ac38b6 — owner pid 566479 switched to 20260904T131418-31129e (event=SessionStart, source=clear)
|
|
128
|
+
2026-09-04T04:14:18.706Z INFO sender marker 566479 -> 20260904T131418-31129e (event=SessionStart, source=clear)
|
|
129
|
+
2026-09-04T04:14:18.706Z INFO armed watch /home/junghan/.pi/agent/meta-mailbox/20260904T131418-31129e/inbox.signal
|
|
130
|
+
2026-09-04T04:14:18.706Z INFO receiver marker 20260904T131418-31129e owner=566479 arm=SessionStart source=clear
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**S6a — manual `/compact`.** SAME native id, SAME garden, no retirement:
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
2026-09-04T04:15:29.240Z INFO attach record 20260904T131022-ac38b6.meta.json (event=SessionStart, source=compact, native=bbba9cbe-f11c-4b67-a0bd-991c3f678238)
|
|
137
|
+
2026-09-04T04:15:29.242Z INFO sender marker 568726 -> 20260904T131022-ac38b6 (event=SessionStart, source=compact)
|
|
138
|
+
2026-09-04T04:15:29.242Z INFO armed watch /home/junghan/.pi/agent/meta-mailbox/20260904T131022-ac38b6/inbox.signal
|
|
139
|
+
2026-09-04T04:15:29.243Z INFO receiver marker 20260904T131022-ac38b6 owner=568726 arm=SessionStart source=compact
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
**S6b — automatic compaction.** Reached by having the session read large repo files until the
|
|
143
|
+
context filled: 60% → 80% → 91% → 98% (196.5K/200K of a 200K window), then one more large read
|
|
144
|
+
tipped it. Byte-identical shape to S6a; context fell to 72.1K afterwards:
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
2026-09-04T04:29:06.583Z INFO attach record 20260904T131022-ac38b6.meta.json (event=SessionStart, source=compact, native=bbba9cbe-f11c-4b67-a0bd-991c3f678238)
|
|
148
|
+
2026-09-04T04:29:06.585Z INFO sender marker 568726 -> 20260904T131022-ac38b6 (event=SessionStart, source=compact)
|
|
149
|
+
2026-09-04T04:29:06.586Z INFO armed watch /home/junghan/.pi/agent/meta-mailbox/20260904T131022-ac38b6/inbox.signal
|
|
150
|
+
2026-09-04T04:29:06.587Z INFO receiver marker 20260904T131022-ac38b6 owner=568726 arm=SessionStart source=compact
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Manual and automatic compaction are the same event to this hook. Note it needs ~98% of the window
|
|
154
|
+
before it fires, and that a session under a smaller model or a shorter window will reach it sooner
|
|
155
|
+
— the threshold is the vendor's, not ours.
|
|
156
|
+
|
|
157
|
+
## How to re-run
|
|
158
|
+
|
|
159
|
+
`tmux new-session -d -s lab -c <scratch> 'claude --model haiku'`, drive it with `send-keys` (send
|
|
160
|
+
the text and the `Enter` as SEPARATE calls — a combined one leaves the prompt typed but
|
|
161
|
+
unsubmitted), and read the delta of `~/.pi/agent/meta-bridge-hook.log` between cells. Nothing else
|
|
162
|
+
is needed: the hook log is the instrument. A cell costs a few seconds of a cheap model, except
|
|
163
|
+
S6b, which costs one full context window.
|
|
164
|
+
|
|
165
|
+
## Boundary
|
|
166
|
+
|
|
167
|
+
One host (oracle), one vendor version (2.1.260), one model (Haiku 4.5), one operator's config.
|
|
168
|
+
The cells say what this Claude does here; they do not certify another host, an older Claude, or
|
|
169
|
+
a different terminal. The repair does not rest on them — it rests on the sender marker — which is
|
|
170
|
+
why a refutation here (S2/S3) corrected the prose and left the code alone.
|
|
@@ -51,7 +51,11 @@ import * as os from "node:os";
|
|
|
51
51
|
import * as path from "node:path";
|
|
52
52
|
import * as readline from "node:readline";
|
|
53
53
|
import { fileURLToPath } from "node:url";
|
|
54
|
-
import {
|
|
54
|
+
import {
|
|
55
|
+
upsertMetaSession,
|
|
56
|
+
writeMetaReceiverMarker,
|
|
57
|
+
writeMetaSenderMarker,
|
|
58
|
+
} from "../pi-extensions/lib/meta-session.ts";
|
|
55
59
|
import { terminateChild } from "./lib/acp-child-cleanup.ts";
|
|
56
60
|
import { skipLive } from "./lib/live-skip.ts";
|
|
57
61
|
import { PI_BOOT_TIMEOUT_MS, waitForPiRecord } from "./lib/pi-record-discovery.ts";
|
|
@@ -210,7 +214,8 @@ async function main(): Promise<void> {
|
|
|
210
214
|
const sessionsDir = path.join(world, "sessions");
|
|
211
215
|
const mailboxDir = path.join(world, "mailbox");
|
|
212
216
|
const receiversDir = path.join(world, "receivers");
|
|
213
|
-
|
|
217
|
+
const sendersDir = path.join(world, "senders");
|
|
218
|
+
for (const d of [sessionsDir, mailboxDir, receiversDir, sendersDir]) await fsp.mkdir(d, { recursive: true });
|
|
214
219
|
|
|
215
220
|
const nonce = `CORTEXV2-${crypto.randomBytes(5).toString("hex").toUpperCase()}`;
|
|
216
221
|
|
|
@@ -224,6 +229,12 @@ async function main(): Promise<void> {
|
|
|
224
229
|
dir: sessionsDir,
|
|
225
230
|
});
|
|
226
231
|
const receiverGid = receiver.record.gardenId;
|
|
232
|
+
// The receiver marker alone is no longer the whole fixture (#101): a `claude-code-cli` watch
|
|
233
|
+
// owner is deliverable only while ITS OWN sender marker still names the garden it is armed
|
|
234
|
+
// for — that join is what refuses a session which switched away in place. A receiver marker
|
|
235
|
+
// with no sender marker beside it models a state the product now treats as retired, so this
|
|
236
|
+
// smoke would fail on its own fixture instead of on the rail it exists to prove. Same shape
|
|
237
|
+
// as smoke-mux-lifecycle-live / smoke-omp-fresh-live, which already seeded both.
|
|
227
238
|
writeMetaReceiverMarker({
|
|
228
239
|
gardenId: receiverGid,
|
|
229
240
|
backend: "claude-code",
|
|
@@ -232,6 +243,14 @@ async function main(): Promise<void> {
|
|
|
232
243
|
armProvenance: "session-start",
|
|
233
244
|
receiversDir,
|
|
234
245
|
});
|
|
246
|
+
writeMetaSenderMarker({
|
|
247
|
+
backend: "claude-code",
|
|
248
|
+
gardenId: receiverGid,
|
|
249
|
+
nativeSessionId: receiver.record.nativeSessionId,
|
|
250
|
+
cwd: world,
|
|
251
|
+
ownerPid: process.pid,
|
|
252
|
+
sendersDir,
|
|
253
|
+
});
|
|
235
254
|
console.error(`[smoke-acp-cortex-live] peer: ${receiverGid} (armed mailbox receiver)`);
|
|
236
255
|
|
|
237
256
|
let senderGid = "";
|
|
@@ -252,6 +271,7 @@ async function main(): Promise<void> {
|
|
|
252
271
|
ENTWURF_META_SESSIONS_DIR: sessionsDir,
|
|
253
272
|
ENTWURF_META_MAILBOX_DIR: mailboxDir,
|
|
254
273
|
ENTWURF_META_RECEIVERS_DIR: receiversDir,
|
|
274
|
+
ENTWURF_META_SENDERS_DIR: sendersDir,
|
|
255
275
|
},
|
|
256
276
|
},
|
|
257
277
|
);
|
|
@@ -79,7 +79,11 @@ import * as os from "node:os";
|
|
|
79
79
|
import * as path from "node:path";
|
|
80
80
|
import * as readline from "node:readline";
|
|
81
81
|
import { fileURLToPath } from "node:url";
|
|
82
|
-
import {
|
|
82
|
+
import {
|
|
83
|
+
upsertMetaSession,
|
|
84
|
+
writeMetaReceiverMarker,
|
|
85
|
+
writeMetaSenderMarker,
|
|
86
|
+
} from "../pi-extensions/lib/meta-session.ts";
|
|
83
87
|
import { terminateChild } from "./lib/acp-child-cleanup.ts";
|
|
84
88
|
import { skipLive } from "./lib/live-skip.ts";
|
|
85
89
|
import { PI_BOOT_TIMEOUT_MS, waitForPiRecord } from "./lib/pi-record-discovery.ts";
|
|
@@ -210,7 +214,8 @@ async function main(): Promise<void> {
|
|
|
210
214
|
const sessionsDir = path.join(world, "sessions");
|
|
211
215
|
const mailboxDir = path.join(world, "mailbox");
|
|
212
216
|
const receiversDir = path.join(world, "receivers");
|
|
213
|
-
|
|
217
|
+
const sendersDir = path.join(world, "senders");
|
|
218
|
+
for (const d of [sessionsDir, mailboxDir, receiversDir, sendersDir]) await fsp.mkdir(d, { recursive: true });
|
|
214
219
|
|
|
215
220
|
const nonce = `ACPV2-${crypto.randomBytes(5).toString("hex").toUpperCase()}`;
|
|
216
221
|
|
|
@@ -225,6 +230,13 @@ async function main(): Promise<void> {
|
|
|
225
230
|
});
|
|
226
231
|
const receiverGid = receiver.record.gardenId;
|
|
227
232
|
// armed = a presence marker owned by THIS (live) process → deliverable.
|
|
233
|
+
//
|
|
234
|
+
// The receiver marker alone is no longer the whole fixture (#101): a `claude-code-cli` watch
|
|
235
|
+
// owner is deliverable only while ITS OWN sender marker still names the garden it is armed
|
|
236
|
+
// for — that join is what refuses a session which switched away in place. A receiver marker
|
|
237
|
+
// with no sender marker beside it models a state the product now treats as retired, so this
|
|
238
|
+
// smoke would fail on its own fixture instead of on the rail it exists to prove. Same shape
|
|
239
|
+
// as smoke-mux-lifecycle-live / smoke-omp-fresh-live, which already seeded both.
|
|
228
240
|
writeMetaReceiverMarker({
|
|
229
241
|
gardenId: receiverGid,
|
|
230
242
|
backend: "claude-code",
|
|
@@ -233,6 +245,14 @@ async function main(): Promise<void> {
|
|
|
233
245
|
armProvenance: "session-start",
|
|
234
246
|
receiversDir,
|
|
235
247
|
});
|
|
248
|
+
writeMetaSenderMarker({
|
|
249
|
+
backend: "claude-code",
|
|
250
|
+
gardenId: receiverGid,
|
|
251
|
+
nativeSessionId: receiver.record.nativeSessionId,
|
|
252
|
+
cwd: world,
|
|
253
|
+
ownerPid: process.pid,
|
|
254
|
+
sendersDir,
|
|
255
|
+
});
|
|
236
256
|
console.error(`[smoke-acp-v2-send-live] peer: ${receiverGid} (armed mailbox receiver)`);
|
|
237
257
|
|
|
238
258
|
let senderGid = "";
|
|
@@ -252,6 +272,7 @@ async function main(): Promise<void> {
|
|
|
252
272
|
ENTWURF_META_SESSIONS_DIR: sessionsDir,
|
|
253
273
|
ENTWURF_META_MAILBOX_DIR: mailboxDir,
|
|
254
274
|
ENTWURF_META_RECEIVERS_DIR: receiversDir,
|
|
275
|
+
ENTWURF_META_SENDERS_DIR: sendersDir,
|
|
255
276
|
},
|
|
256
277
|
},
|
|
257
278
|
);
|