mustflow 2.116.0 → 2.116.2
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/dist/core/source-anchors.js +11 -0
- package/package.json +1 -1
- package/templates/default/i18n.toml +72 -6
- package/templates/default/locales/en/.mustflow/skills/INDEX.md +37 -11
- package/templates/default/locales/en/.mustflow/skills/compiler-engineering-review/SKILL.md +477 -0
- package/templates/default/locales/en/.mustflow/skills/compiler-engineering-review/references/compiler-diagnostics-abi-linker-checklist.md +778 -0
- package/templates/default/locales/en/.mustflow/skills/compiler-engineering-review/references/compiler-generators-properties-checklist.md +501 -0
- package/templates/default/locales/en/.mustflow/skills/compiler-engineering-review/references/compiler-test-strategy-differential-checklist.md +498 -0
- package/templates/default/locales/en/.mustflow/skills/compiler-engineering-review/references/debug-symbol-symbolication-checklist.md +412 -0
- package/templates/default/locales/en/.mustflow/skills/compiler-engineering-review/references/ir-design-ssa-pass-pipeline-checklist.md +759 -0
- package/templates/default/locales/en/.mustflow/skills/compiler-engineering-review/references/miscompile-reduction-ir-checklist.md +434 -0
- package/templates/default/locales/en/.mustflow/skills/cross-platform-filesystem-safety/SKILL.md +55 -36
- package/templates/default/locales/en/.mustflow/skills/cross-platform-filesystem-safety/references/path-containment-handle-checklist.md +251 -0
- package/templates/default/locales/en/.mustflow/skills/file-upload-security-review/SKILL.md +133 -32
- package/templates/default/locales/en/.mustflow/skills/file-upload-security-review/references/file-upload-parser-ssrf-resource-checklist.md +306 -0
- package/templates/default/locales/en/.mustflow/skills/formal-verification-review/SKILL.md +310 -0
- package/templates/default/locales/en/.mustflow/skills/formal-verification-review/references/formal-concurrency-model-checking-smt-checklist.md +457 -0
- package/templates/default/locales/en/.mustflow/skills/formal-verification-review/references/formal-contracts-modeling-checklist.md +434 -0
- package/templates/default/locales/en/.mustflow/skills/formal-verification-review/references/formal-memory-bounds-ci-checklist.md +509 -0
- package/templates/default/locales/en/.mustflow/skills/fuzz-harness-review/SKILL.md +439 -0
- package/templates/default/locales/en/.mustflow/skills/fuzz-harness-review/references/fuzz-harness-campaign-checklist.md +379 -0
- package/templates/default/locales/en/.mustflow/skills/fuzz-harness-review/references/fuzz-oracle-triage-ci-checklist.md +307 -0
- package/templates/default/locales/en/.mustflow/skills/idempotency-integrity-review/SKILL.md +48 -28
- package/templates/default/locales/en/.mustflow/skills/idempotency-integrity-review/references/operation-ordering-stale-write-checklist.md +259 -0
- package/templates/default/locales/en/.mustflow/skills/input-boundary-validation-review/SKILL.md +329 -0
- package/templates/default/locales/en/.mustflow/skills/input-boundary-validation-review/references/input-boundary-security-checklist.md +319 -0
- package/templates/default/locales/en/.mustflow/skills/input-event-synchronization-review/SKILL.md +306 -0
- package/templates/default/locales/en/.mustflow/skills/input-event-synchronization-review/references/input-session-state-checklist.md +298 -0
- package/templates/default/locales/en/.mustflow/skills/input-event-synchronization-review/references/remote-input-transport-interaction-checklist.md +328 -0
- package/templates/default/locales/en/.mustflow/skills/interpreter-engineering-review/SKILL.md +353 -0
- package/templates/default/locales/en/.mustflow/skills/interpreter-engineering-review/references/interpreter-diagnostics-recovery-checklist.md +267 -0
- package/templates/default/locales/en/.mustflow/skills/interpreter-engineering-review/references/interpreter-execution-closure-performance-checklist.md +428 -0
- package/templates/default/locales/en/.mustflow/skills/interpreter-engineering-review/references/interpreter-gc-verification-checklist.md +457 -0
- package/templates/default/locales/en/.mustflow/skills/interpreter-engineering-review/references/interpreter-semantics-runtime-checklist.md +391 -0
- package/templates/default/locales/en/.mustflow/skills/modal-loop-reentrancy-review/SKILL.md +294 -0
- package/templates/default/locales/en/.mustflow/skills/modal-loop-reentrancy-review/references/modal-loop-reentrancy-checklist.md +290 -0
- package/templates/default/locales/en/.mustflow/skills/modal-loop-reentrancy-review/references/nested-modal-state-lifetime-checklist.md +297 -0
- package/templates/default/locales/en/.mustflow/skills/name-resolution-integrity-review/SKILL.md +252 -0
- package/templates/default/locales/en/.mustflow/skills/name-resolution-integrity-review/references/dns-network-resolution-checklist.md +394 -0
- package/templates/default/locales/en/.mustflow/skills/name-resolution-integrity-review/references/language-symbol-resolution-checklist.md +282 -0
- package/templates/default/locales/en/.mustflow/skills/name-resolution-integrity-review/references/module-package-loader-resolution-checklist.md +352 -0
- package/templates/default/locales/en/.mustflow/skills/parser-engineering-review/SKILL.md +103 -17
- package/templates/default/locales/en/.mustflow/skills/parser-engineering-review/references/cst-ast-lowering-checklist.md +260 -0
- package/templates/default/locales/en/.mustflow/skills/parser-engineering-review/references/lexer-tokenization-checklist.md +397 -0
- package/templates/default/locales/en/.mustflow/skills/parser-engineering-review/references/tree-serialization-compatibility-checklist.md +164 -0
- package/templates/default/locales/en/.mustflow/skills/parser-engineering-review/references/tree-traversal-rewrite-checklist.md +209 -0
- package/templates/default/locales/en/.mustflow/skills/race-condition-review/SKILL.md +68 -11
- package/templates/default/locales/en/.mustflow/skills/race-condition-review/references/race-reproduction-memory-model-checklist.md +268 -0
- package/templates/default/locales/en/.mustflow/skills/routes.toml +151 -0
- package/templates/default/locales/en/.mustflow/skills/session-handoff-integrity-review/SKILL.md +343 -0
- package/templates/default/locales/en/.mustflow/skills/session-handoff-integrity-review/references/session-auth-stream-resume-checklist.md +413 -0
- package/templates/default/locales/en/.mustflow/skills/session-handoff-integrity-review/references/session-handoff-protocol-checklist.md +485 -0
- package/templates/default/locales/en/.mustflow/skills/two-phase-transition-integrity-review/SKILL.md +267 -0
- package/templates/default/locales/en/.mustflow/skills/two-phase-transition-integrity-review/references/admission-decision-recovery-checklist.md +308 -0
- package/templates/default/locales/en/.mustflow/skills/two-phase-transition-integrity-review/references/two-phase-transition-checklist.md +229 -0
- package/templates/default/locales/en/.mustflow/skills/ui-dispatch-lifecycle-review/SKILL.md +300 -0
- package/templates/default/locales/en/.mustflow/skills/ui-dispatch-lifecycle-review/references/ui-affinity-event-loop-checklist.md +277 -0
- package/templates/default/locales/en/.mustflow/skills/ui-dispatch-lifecycle-review/references/ui-dispatch-lifecycle-checklist.md +292 -0
- package/templates/default/manifest.toml +115 -1
|
@@ -0,0 +1,485 @@
|
|
|
1
|
+
# Session Handoff Protocol Checklist
|
|
2
|
+
|
|
3
|
+
Use this checklist when a live session changes runtime owner while commands, state changes, tool
|
|
4
|
+
effects, output, or approvals may still be in flight. Record concrete fields, transition guards,
|
|
5
|
+
and evidence. Do not treat a copied snapshot or a healthy target process as proof of safe takeover.
|
|
6
|
+
|
|
7
|
+
## Contents
|
|
8
|
+
|
|
9
|
+
1. [Protocol invariants](#protocol-invariants)
|
|
10
|
+
2. [Identity and authority](#identity-and-authority)
|
|
11
|
+
3. [Durable state machine](#durable-state-machine)
|
|
12
|
+
4. [Transfer-class inventory](#transfer-class-inventory)
|
|
13
|
+
5. [Snapshot, delta, and manifest](#snapshot-delta-and-manifest)
|
|
14
|
+
6. [Live commands and quiescence](#live-commands-and-quiescence)
|
|
15
|
+
7. [Target acceptance](#target-acceptance)
|
|
16
|
+
8. [Commit and fencing](#commit-and-fencing)
|
|
17
|
+
9. [Timeout, retry, and recovery](#timeout-retry-and-recovery)
|
|
18
|
+
10. [Cache, lock, and drain behavior](#cache-lock-and-drain-behavior)
|
|
19
|
+
11. [AI-agent context envelope](#ai-agent-context-envelope)
|
|
20
|
+
12. [Tools, artifacts, output, and approvals](#tools-artifacts-output-and-approvals)
|
|
21
|
+
13. [Observability and audit](#observability-and-audit)
|
|
22
|
+
14. [Fault matrix](#fault-matrix)
|
|
23
|
+
15. [History properties](#history-properties)
|
|
24
|
+
16. [Operational evidence](#operational-evidence)
|
|
25
|
+
17. [Skill handoffs](#skill-handoffs)
|
|
26
|
+
|
|
27
|
+
## Protocol invariants
|
|
28
|
+
|
|
29
|
+
Write each invariant in the same vocabulary used by code, state-transition events, tests, and
|
|
30
|
+
operational alerts.
|
|
31
|
+
|
|
32
|
+
| Invariant | Required evidence |
|
|
33
|
+
| --- | --- |
|
|
34
|
+
| At most one owner epoch can produce accepted effects. | Owner audit plus sink-level stale-epoch rejection. |
|
|
35
|
+
| Owner epoch and state version never decrease. | Conditional authority writes and full transition history. |
|
|
36
|
+
| Target executes no authoritative command before owner commit. | Target-mode checks and pre-commit negative fixtures. |
|
|
37
|
+
| A successful command is not lost during transfer. | Command ledger, effect receipt, response record, and takeover history. |
|
|
38
|
+
| One command identity produces at most one accepted effect. | Effect dedupe key and final sink evidence. |
|
|
39
|
+
| Every handoff terminates or becomes explicitly quarantined. | Reconciler ownership and nonterminal-age evidence. |
|
|
40
|
+
| Pending approval does not become approval during transfer. | Approval ledger and target resume gate. |
|
|
41
|
+
| Sensitive runtime authority is not copied into model context. | Envelope schema, redaction, and scoped credential evidence. |
|
|
42
|
+
|
|
43
|
+
Reject claims such as "exactly once", "zero loss", or "no downtime" unless the named evidence
|
|
44
|
+
covers every permitted retry, response-loss, crash, stale-owner, and recovery branch.
|
|
45
|
+
|
|
46
|
+
## Identity and authority
|
|
47
|
+
|
|
48
|
+
Record separate identities for:
|
|
49
|
+
|
|
50
|
+
- user or service session;
|
|
51
|
+
- logical handoff;
|
|
52
|
+
- handoff execution attempt;
|
|
53
|
+
- protocol phase;
|
|
54
|
+
- owner epoch or generation;
|
|
55
|
+
- state version or source revision;
|
|
56
|
+
- command and input message;
|
|
57
|
+
- external effect and effect receipt;
|
|
58
|
+
- output stream and committed output sequence;
|
|
59
|
+
- tool call and external resource;
|
|
60
|
+
- artifact and immutable content version;
|
|
61
|
+
- approval request and policy version;
|
|
62
|
+
- trace and causal link.
|
|
63
|
+
|
|
64
|
+
For the authority record, capture:
|
|
65
|
+
|
|
66
|
+
| Field | Question |
|
|
67
|
+
| --- | --- |
|
|
68
|
+
| `session_id` | Which continuity boundary is moving? |
|
|
69
|
+
| `owner` | Which runtime may currently execute? |
|
|
70
|
+
| `epoch` | Which generation must every final sink accept? |
|
|
71
|
+
| `state_version` | Which source state is authoritative? |
|
|
72
|
+
| `handoff_id` | Which logical transfer owns the transition slot? |
|
|
73
|
+
| `protocol_state` | Which legal action can occur next? |
|
|
74
|
+
| `accepted_target` | Which target proved readiness for this exact state? |
|
|
75
|
+
| `protocol_version` | Which recovery rules interpret the record? |
|
|
76
|
+
|
|
77
|
+
The authority record must be read and changed through one linearizable or transactionally
|
|
78
|
+
conditional boundary. Process memory, routing caches, lease ownership, health checks, and target
|
|
79
|
+
acknowledgments are evidence inputs, not independent owner authorities.
|
|
80
|
+
|
|
81
|
+
## Durable state machine
|
|
82
|
+
|
|
83
|
+
Use repository-native names, but cover these semantic stages:
|
|
84
|
+
|
|
85
|
+
1. source owner and transition slot confirmed;
|
|
86
|
+
2. preparation record persisted;
|
|
87
|
+
3. live-input cutoff or durable admission policy active;
|
|
88
|
+
4. snapshot and manifest sealed;
|
|
89
|
+
5. target import and delta catch-up complete;
|
|
90
|
+
6. target validation and explicit acceptance persisted;
|
|
91
|
+
7. owner and epoch committed atomically;
|
|
92
|
+
8. target activation observed;
|
|
93
|
+
9. source redirected or drained without execution authority;
|
|
94
|
+
10. cleanup completed after the observation window;
|
|
95
|
+
11. terminal success, pre-commit abort, or quarantine recorded.
|
|
96
|
+
|
|
97
|
+
For every transition, record:
|
|
98
|
+
|
|
99
|
+
- permitted source states;
|
|
100
|
+
- actor and fencing identity;
|
|
101
|
+
- conditional predicate;
|
|
102
|
+
- durable writes;
|
|
103
|
+
- external effects;
|
|
104
|
+
- idempotency key;
|
|
105
|
+
- retry classification;
|
|
106
|
+
- response-loss interpretation;
|
|
107
|
+
- next recovery owner;
|
|
108
|
+
- terminal or bounded retry path.
|
|
109
|
+
|
|
110
|
+
Do not use one Boolean such as `moving`, `ready`, or `active` to represent authority, transfer
|
|
111
|
+
progress, target acceptance, and observer knowledge.
|
|
112
|
+
|
|
113
|
+
## Transfer-class inventory
|
|
114
|
+
|
|
115
|
+
Classify each item before choosing transfer behavior.
|
|
116
|
+
|
|
117
|
+
| Class | Transfer rule | Failure to avoid |
|
|
118
|
+
| --- | --- | --- |
|
|
119
|
+
| Durable session fact | Copy or reference with source version. | Stale snapshot becoming truth. |
|
|
120
|
+
| Immutable artifact | Transfer by immutable ID, schema, and hash. | Path reuse or partial overwrite. |
|
|
121
|
+
| Derived cache | Rebuild or select through state-version namespace. | Old cache repopulating current state. |
|
|
122
|
+
| Lease or lock | Reacquire under new epoch. | Serialized fake ownership. |
|
|
123
|
+
| Queued command | Preserve stable command ID and admission state. | Loss or duplicate execution. |
|
|
124
|
+
| In-flight effect | Query or resume through effect receipt. | Blind replay after unknown outcome. |
|
|
125
|
+
| Runtime object | Reconstruct locally from configuration or reference. | Connection or client serialization. |
|
|
126
|
+
| Secret or credential | Issue scoped short-lived authority from a reference. | Secret copied into prompt or log. |
|
|
127
|
+
| Model-visible context | Transfer through typed, source-linked envelope. | Summary drift becoming authority. |
|
|
128
|
+
| Approval or guardrail | Preserve explicit pending or terminal state. | Wait state interpreted as approval. |
|
|
129
|
+
|
|
130
|
+
If an item fits more than one class, split its durable identity from its runtime handle rather than
|
|
131
|
+
choosing one transfer rule for the combined object.
|
|
132
|
+
|
|
133
|
+
## Snapshot, delta, and manifest
|
|
134
|
+
|
|
135
|
+
For every snapshot, record:
|
|
136
|
+
|
|
137
|
+
- source owner and epoch;
|
|
138
|
+
- snapshot revision or state version;
|
|
139
|
+
- inclusive or exclusive delta boundary;
|
|
140
|
+
- manifest identity and schema version;
|
|
141
|
+
- immutable chunk identities, sizes, and hashes;
|
|
142
|
+
- encryption and tenant boundary where applicable;
|
|
143
|
+
- creation completion marker;
|
|
144
|
+
- target import position;
|
|
145
|
+
- final caught-up version;
|
|
146
|
+
- source and target canonical state hashes;
|
|
147
|
+
- unsupported-schema rejection behavior.
|
|
148
|
+
|
|
149
|
+
Prove that the target cannot:
|
|
150
|
+
|
|
151
|
+
- accept a partial manifest;
|
|
152
|
+
- silently drop unknown required fields;
|
|
153
|
+
- mix chunks from different session or state versions;
|
|
154
|
+
- mark import complete before hash verification;
|
|
155
|
+
- skip deltas created during snapshot construction;
|
|
156
|
+
- validate against a stale replica and then commit a newer owner epoch.
|
|
157
|
+
|
|
158
|
+
Large state should use immutable chunks and a versioned manifest. Make the authority pointer or
|
|
159
|
+
accepted manifest identity the small atomic decision; do not rewrite a mutable monolithic blob in
|
|
160
|
+
place and infer completeness from object existence.
|
|
161
|
+
|
|
162
|
+
## Live commands and quiescence
|
|
163
|
+
|
|
164
|
+
Choose one explicit admission rule for commands arriving during transfer:
|
|
165
|
+
|
|
166
|
+
- source remains the only writer and durably records commands until cutoff;
|
|
167
|
+
- a durable inbox admits commands while execution pauses;
|
|
168
|
+
- routing rejects or redirects new commands with a retryable contract;
|
|
169
|
+
- another repository-specific single-writer rule with equivalent evidence.
|
|
170
|
+
|
|
171
|
+
For each command, preserve states equivalent to received, started, effect committed, and response
|
|
172
|
+
committed. Include queue offset or event position, owner epoch, input hash, effect identity, and
|
|
173
|
+
terminal receipt.
|
|
174
|
+
|
|
175
|
+
Define:
|
|
176
|
+
|
|
177
|
+
- cutoff sequence and which side owns each side of the boundary;
|
|
178
|
+
- treatment of commands already executing at cutoff;
|
|
179
|
+
- treatment of admitted but not started commands;
|
|
180
|
+
- treatment of effects committed without a recorded response;
|
|
181
|
+
- response replay or status lookup contract;
|
|
182
|
+
- ordering scope across commands;
|
|
183
|
+
- dedupe retention horizon;
|
|
184
|
+
- bounded buffer and backpressure policy;
|
|
185
|
+
- what happens when the source cannot finish drain before the deadline.
|
|
186
|
+
|
|
187
|
+
Dual writing on source and target is not continuity proof. It creates a later conflict-resolution
|
|
188
|
+
problem and allows both sides to perform irreversible effects before the conflict is visible.
|
|
189
|
+
|
|
190
|
+
## Target acceptance
|
|
191
|
+
|
|
192
|
+
Target acceptance must bind to the exact handoff and imported state. Check:
|
|
193
|
+
|
|
194
|
+
- target runtime and protocol version;
|
|
195
|
+
- imported snapshot and final delta position;
|
|
196
|
+
- canonical state hash;
|
|
197
|
+
- schema and migration compatibility;
|
|
198
|
+
- tenant, user, and authorization scope;
|
|
199
|
+
- tool and external dependency availability;
|
|
200
|
+
- artifact presence and hashes;
|
|
201
|
+
- memory, queue, storage, and concurrency capacity;
|
|
202
|
+
- required leases available for reacquisition;
|
|
203
|
+
- policy and guardrail version;
|
|
204
|
+
- pending approval and cancellation state;
|
|
205
|
+
- output-stream boundary;
|
|
206
|
+
- remaining absolute deadline and recovery reserve.
|
|
207
|
+
|
|
208
|
+
The target stays non-authoritative until acceptance is durable and the owner commit succeeds.
|
|
209
|
+
Health, process readiness, warm cache, successful import, or a network acknowledgment alone is not
|
|
210
|
+
acceptance.
|
|
211
|
+
|
|
212
|
+
## Commit and fencing
|
|
213
|
+
|
|
214
|
+
The owner commit predicate should bind at least:
|
|
215
|
+
|
|
216
|
+
- expected current owner;
|
|
217
|
+
- expected source epoch;
|
|
218
|
+
- expected source state version or cutoff;
|
|
219
|
+
- logical handoff identity;
|
|
220
|
+
- accepted target identity;
|
|
221
|
+
- accepted manifest or state hash;
|
|
222
|
+
- target protocol version;
|
|
223
|
+
- transition slot or decision sequence.
|
|
224
|
+
|
|
225
|
+
The commit must atomically select the new owner and monotonic epoch. If it also needs to notify
|
|
226
|
+
routers, consumers, or observers, persist an outbox record in the same authority transaction and
|
|
227
|
+
publish later.
|
|
228
|
+
|
|
229
|
+
Build a fence map for every effect sink:
|
|
230
|
+
|
|
231
|
+
| Sink | Fence field | Rejection evidence |
|
|
232
|
+
| --- | --- | --- |
|
|
233
|
+
| Session database writes | Session epoch or conditional owner version. | Stale update rejected. |
|
|
234
|
+
| Queue publication or acknowledgment | Producer or consumer generation. | Lower generation ignored. |
|
|
235
|
+
| File or artifact mutation | Manifest generation or conditional pointer. | Old pointer update rejected. |
|
|
236
|
+
| Tool execution | Session epoch plus stable tool-call identity. | Stale or duplicate call blocked. |
|
|
237
|
+
| External provider effect | Idempotency key and stored effect receipt. | Query or dedupe proves outcome. |
|
|
238
|
+
|
|
239
|
+
If a final sink cannot enforce the epoch, document the durable backstop that prevents stale effects.
|
|
240
|
+
Lease expiry, cancellation, disconnect, and source notification are not fences against a paused
|
|
241
|
+
process that later resumes.
|
|
242
|
+
|
|
243
|
+
## Timeout, retry, and recovery
|
|
244
|
+
|
|
245
|
+
Separate:
|
|
246
|
+
|
|
247
|
+
- caller wait timeout;
|
|
248
|
+
- total absolute handoff deadline;
|
|
249
|
+
- phase budget;
|
|
250
|
+
- lease or transition-slot expiry;
|
|
251
|
+
- status-query reserve;
|
|
252
|
+
- recovery reserve;
|
|
253
|
+
- reconciler escalation age;
|
|
254
|
+
- operator quarantine age.
|
|
255
|
+
|
|
256
|
+
Classify each phase result:
|
|
257
|
+
|
|
258
|
+
| Class | Required action |
|
|
259
|
+
| --- | --- |
|
|
260
|
+
| Safe to retry | Retry the same logical operation under the same stable identity. |
|
|
261
|
+
| Query required | Read authority, state, and effect receipts before acting. |
|
|
262
|
+
| Compensation required | Record a new inverse effect with its own identity and recovery. |
|
|
263
|
+
| Terminal | Persist terminal evidence and stop retrying. |
|
|
264
|
+
|
|
265
|
+
Assign retry ownership to one layer. Lower layers may absorb only explicitly bounded transport setup
|
|
266
|
+
failures that cannot duplicate the logical operation. Use jitter, retry budgets, and admission
|
|
267
|
+
backpressure; a retry count alone does not prevent a recovery storm.
|
|
268
|
+
|
|
269
|
+
Before owner commit, abort may release reversible preparation while the source remains authoritative.
|
|
270
|
+
After owner commit, recover forward under the target epoch. Never call restoration of the old owner
|
|
271
|
+
"rollback" after the target may have accepted commands or effects.
|
|
272
|
+
|
|
273
|
+
The reconciler must use its own lease or fence, examine authority and receipts, and choose one of:
|
|
274
|
+
resume, pre-commit abort, forward recovery, compensation, or quarantine. Missing evidence is a
|
|
275
|
+
reason to quarantine, not permission to guess.
|
|
276
|
+
|
|
277
|
+
## Cache, lock, and drain behavior
|
|
278
|
+
|
|
279
|
+
- Namespace or select caches by authoritative state version.
|
|
280
|
+
- Treat invalidation notifications as hints; do not make their delivery the correctness boundary.
|
|
281
|
+
- Reacquire locks in a deterministic order under the new epoch.
|
|
282
|
+
- Release partially acquired target locks in reverse order before acceptance fails.
|
|
283
|
+
- Use the coordination service's lease authority; do not let application wall clocks independently
|
|
284
|
+
decide ownership.
|
|
285
|
+
- Keep the source as a bounded non-executing redirector when stale clients or routers are expected.
|
|
286
|
+
- Preserve the original command identity when forwarding is allowed.
|
|
287
|
+
- Reject or observe stale-epoch traffic after the redirect grace window.
|
|
288
|
+
- Delay destructive cleanup until stale-route, audit, recovery, and rollback observation windows
|
|
289
|
+
no longer require the old immutable data.
|
|
290
|
+
|
|
291
|
+
## AI-agent context envelope
|
|
292
|
+
|
|
293
|
+
Keep runtime context and model-visible context separate.
|
|
294
|
+
|
|
295
|
+
A model-visible envelope should explicitly represent:
|
|
296
|
+
|
|
297
|
+
- goal and current task boundary;
|
|
298
|
+
- direct user constraints;
|
|
299
|
+
- inferred preferences with confidence;
|
|
300
|
+
- accepted decisions and rejected options;
|
|
301
|
+
- current plan, completed work, pending work, and blocker;
|
|
302
|
+
- conversation, user, agent, tool-result, and output cursors;
|
|
303
|
+
- evidence and original event references;
|
|
304
|
+
- artifact references and hashes;
|
|
305
|
+
- tool and effect ledger summary;
|
|
306
|
+
- open questions;
|
|
307
|
+
- approval and guardrail state;
|
|
308
|
+
- policy and schema versions;
|
|
309
|
+
- owner epoch and state version;
|
|
310
|
+
- deadline and cancellation state;
|
|
311
|
+
- fields intentionally omitted for privacy or capability reasons.
|
|
312
|
+
|
|
313
|
+
Original user, tool, approval, and state-transition events remain authoritative. Summaries are
|
|
314
|
+
derived indexes and must point back to source events for material decisions. Use a short execution
|
|
315
|
+
brief plus pinned facts and searchable references instead of either dumping all history or keeping
|
|
316
|
+
an arbitrary recent-message window.
|
|
317
|
+
|
|
318
|
+
Negotiate target support before acceptance:
|
|
319
|
+
|
|
320
|
+
- model and tool capabilities;
|
|
321
|
+
- schema and media types;
|
|
322
|
+
- file and artifact access;
|
|
323
|
+
- permission and tenant scope;
|
|
324
|
+
- context and output limits;
|
|
325
|
+
- policy and safety features;
|
|
326
|
+
- ability to query ambiguous effects;
|
|
327
|
+
- ability to preserve pending approvals without executing them.
|
|
328
|
+
|
|
329
|
+
## Tools, artifacts, output, and approvals
|
|
330
|
+
|
|
331
|
+
For every tool call, record:
|
|
332
|
+
|
|
333
|
+
- call identity and stable idempotency key;
|
|
334
|
+
- requested and started positions;
|
|
335
|
+
- parameters hash or bounded canonical request identity;
|
|
336
|
+
- status including unknown outcome;
|
|
337
|
+
- external resource or effect identity;
|
|
338
|
+
- effect hash or receipt;
|
|
339
|
+
- retry and query policy;
|
|
340
|
+
- approval identity and policy version when gated;
|
|
341
|
+
- owner epoch that initiated the call.
|
|
342
|
+
|
|
343
|
+
Do not infer tool failure from a missing response. Query by external resource identity or
|
|
344
|
+
idempotency key before replaying an irreversible action.
|
|
345
|
+
|
|
346
|
+
For every artifact, preserve immutable identity, content hash, media type, schema version, producing
|
|
347
|
+
event or tool call, authorization boundary, and storage reference. A mutable path or prose claim
|
|
348
|
+
that a file exists is not an artifact contract.
|
|
349
|
+
|
|
350
|
+
For streamed output, persist the last committed sequence and owning response identity. On handoff,
|
|
351
|
+
finish, terminate, or restart at an explicit protocol boundary. Do not concatenate output from two
|
|
352
|
+
owners into one stream unless the consumer protocol can validate owner and sequence changes.
|
|
353
|
+
|
|
354
|
+
For approvals and guardrails, preserve requested action, request identity, approver scope, current
|
|
355
|
+
state, expiry, policy version, and evidence. Target resumption must re-check current authority and
|
|
356
|
+
must not translate missing, pending, expired, or mismatched approval into permission.
|
|
357
|
+
|
|
358
|
+
Secrets move by reference and scoped reissuance. Keep credentials, cookies, raw tokens, private
|
|
359
|
+
prompts, and sensitive baggage out of handoff envelopes, logs, traces, and model-visible context.
|
|
360
|
+
|
|
361
|
+
## Observability and audit
|
|
362
|
+
|
|
363
|
+
Emit one structured event schema for protocol transitions, tests, and operations. Include bounded
|
|
364
|
+
fields such as:
|
|
365
|
+
|
|
366
|
+
- session, handoff, attempt, phase, command, and epoch identities;
|
|
367
|
+
- previous and next protocol states;
|
|
368
|
+
- owner and epoch before and after;
|
|
369
|
+
- source and target state versions and hashes;
|
|
370
|
+
- target acceptance identity;
|
|
371
|
+
- decision and retry classification;
|
|
372
|
+
- remaining deadline and recovery reserve;
|
|
373
|
+
- effect and receipt class without sensitive payloads;
|
|
374
|
+
- error class and terminal or recovery owner.
|
|
375
|
+
|
|
376
|
+
Keep owner and epoch changes in an append-only audit that survives source and target process loss.
|
|
377
|
+
The audit must reconstruct which conditional decision changed ownership and which handoff, accepted
|
|
378
|
+
state, actor, and protocol version justified it.
|
|
379
|
+
|
|
380
|
+
Trace the logical handoff end to end. Represent state-machine phases as spans where useful, and use
|
|
381
|
+
causal links for queued work, retries, fan-out, or independent recovery attempts. Do not force false
|
|
382
|
+
parent-child timing or place prompts, credentials, personal data, or large artifacts in propagated
|
|
383
|
+
context.
|
|
384
|
+
|
|
385
|
+
Prioritize invariant metrics over averages:
|
|
386
|
+
|
|
387
|
+
- simultaneous valid writer count;
|
|
388
|
+
- stale-epoch effects rejected;
|
|
389
|
+
- target execution before commit;
|
|
390
|
+
- committed handoff without target activation;
|
|
391
|
+
- duplicate effect detected;
|
|
392
|
+
- nonterminal handoff age;
|
|
393
|
+
- state or artifact hash mismatch;
|
|
394
|
+
- command success without durable terminal record;
|
|
395
|
+
- pending approval resumed without current authorization;
|
|
396
|
+
- manual recovery and quarantine rates.
|
|
397
|
+
|
|
398
|
+
## Fault matrix
|
|
399
|
+
|
|
400
|
+
Add deterministic failpoints on both sides of every durable boundary:
|
|
401
|
+
|
|
402
|
+
| Boundary | Faults to inject | Required observation |
|
|
403
|
+
| --- | --- | --- |
|
|
404
|
+
| Transition creation | Crash before and after persistence. | Zero or one recoverable handoff record. |
|
|
405
|
+
| Snapshot sealing | Partial write, stale read, hash mismatch. | No target acceptance from incomplete state. |
|
|
406
|
+
| Delta catch-up | Gap, duplicate, reorder, truncation. | Explicit repair or rejection. |
|
|
407
|
+
| Command cutoff | Arrival before, at, and after cutoff. | Every command has one owner and durable disposition. |
|
|
408
|
+
| Target acceptance | Crash before and after acceptance write. | Source remains owner until commit. |
|
|
409
|
+
| Owner commit | Request loss, response loss, crash around CAS. | Status query reveals one durable decision. |
|
|
410
|
+
| Commit publication | Outbox delay, duplicate delivery, reorder. | Authority remains correct and consumers converge. |
|
|
411
|
+
| Target activation | Accepted target pause or crash. | Forward recovery under committed epoch. |
|
|
412
|
+
| Source drain | Stale route, resumed paused source. | Redirect or stale-epoch rejection, never execution. |
|
|
413
|
+
| Tool effect | Provider succeeds, response or receipt write lost. | Query-required path prevents blind replay. |
|
|
414
|
+
| Approval resume | Expiry, policy change, duplicate event. | No execution without current matching approval. |
|
|
415
|
+
| Reconciler | Concurrent reconcilers and stale lease. | One fenced recovery decision. |
|
|
416
|
+
|
|
417
|
+
Combine faults rather than testing only one at a time:
|
|
418
|
+
|
|
419
|
+
- asymmetric partition where request arrives but response does not;
|
|
420
|
+
- process pause, lease expiry, target commit, then source resume;
|
|
421
|
+
- stale routing plus stale cache plus duplicate command delivery;
|
|
422
|
+
- target schema mismatch during source deadline pressure;
|
|
423
|
+
- owner commit plus delayed publication plus replica stale read;
|
|
424
|
+
- output interruption plus tool unknown outcome plus retry;
|
|
425
|
+
- policy change while approval and session are transferring;
|
|
426
|
+
- clock anomaly plus retry budget exhaustion and reconciler takeover.
|
|
427
|
+
|
|
428
|
+
Preserve the random seed and the actual fault decision sequence. Replaying only the seed is
|
|
429
|
+
insufficient when scheduler, environment, or generated decision counts can differ.
|
|
430
|
+
|
|
431
|
+
## History properties
|
|
432
|
+
|
|
433
|
+
Collect invocation, response, owner, epoch, state version, command, effect, receipt, and approval
|
|
434
|
+
events for the complete run. Check at least:
|
|
435
|
+
|
|
436
|
+
- no overlapping accepted writer intervals;
|
|
437
|
+
- no accepted effect from an epoch lower than the committed owner epoch;
|
|
438
|
+
- no target authoritative execution before owner commit;
|
|
439
|
+
- no successful command disappears from durable history;
|
|
440
|
+
- no command identity has more than one accepted external effect;
|
|
441
|
+
- snapshot plus applied deltas forms one continuous source-version range;
|
|
442
|
+
- every accepted target matches the committed state hash and protocol version;
|
|
443
|
+
- every nonterminal handoff is owned by a live bounded recovery path or quarantined;
|
|
444
|
+
- every pending or expired approval remains non-executable;
|
|
445
|
+
- every emitted output segment belongs to one response identity, owner epoch, and monotonic sequence;
|
|
446
|
+
- every cache read used for an authoritative decision matches the current state version;
|
|
447
|
+
- every old owner becomes redirect-only or fenced before target effects are accepted.
|
|
448
|
+
|
|
449
|
+
Final owner equality alone cannot reveal a temporary split brain, duplicate charge, lost response,
|
|
450
|
+
or approval bypass. Inspect the complete history and the final state.
|
|
451
|
+
|
|
452
|
+
## Operational evidence
|
|
453
|
+
|
|
454
|
+
Track bounded operating objectives for:
|
|
455
|
+
|
|
456
|
+
- handoff completion and nonterminal age;
|
|
457
|
+
- target acceptance failure;
|
|
458
|
+
- owner commit ambiguity;
|
|
459
|
+
- forward recovery and quarantine;
|
|
460
|
+
- stale-route and stale-epoch rejection;
|
|
461
|
+
- command replay and duplicate-effect prevention;
|
|
462
|
+
- state and artifact mismatch;
|
|
463
|
+
- approval-resume rejection;
|
|
464
|
+
- manual intervention;
|
|
465
|
+
- retry and recovery budget use.
|
|
466
|
+
|
|
467
|
+
Exercise low-risk handoffs regularly enough to detect drift in routing, schemas, permissions,
|
|
468
|
+
artifact access, tools, coordination, and recovery. Keep target validation non-authoritative and
|
|
469
|
+
abort before commit when shadow evidence disagrees.
|
|
470
|
+
|
|
471
|
+
## Skill handoffs
|
|
472
|
+
|
|
473
|
+
- Use `two-phase-transition-integrity-review` for the generic prepare, durable decision, epoch,
|
|
474
|
+
fencing, and forward-recovery proof around the owner cutover.
|
|
475
|
+
- Use `idempotency-integrity-review` for command, tool, and effect identity retention and replay.
|
|
476
|
+
- Use `dual-write-consistency` for authority-record and event-publication convergence.
|
|
477
|
+
- Use `execution-ledger-integrity-review` for append-only command, effect, approval, and recovery
|
|
478
|
+
truth.
|
|
479
|
+
- Use `race-condition-review` for concrete source-target-reconciler interleavings.
|
|
480
|
+
- Use `async-timing-boundary-review` for deadline, cancellation, wait, and lost-response behavior.
|
|
481
|
+
- Use `security-flow-review` for credential scope, authorization, artifact access, and sensitive
|
|
482
|
+
context propagation.
|
|
483
|
+
- Use `cross-agent-session-reference` only when reading prior Codex or Hermes session artifacts.
|
|
484
|
+
- Use `restricted-handoff-resume` only when producing a bounded task restart report.
|
|
485
|
+
- Use `design-implementation-handoff` only for design-to-implementation workflow ownership.
|