@dreamforgestudiollc/emet 0.3.5 → 0.3.7

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.
Files changed (103) hide show
  1. package/.env.example +29 -0
  2. package/CHANGELOG.md +49 -11
  3. package/CHARTER.md +1 -1
  4. package/CONTRIBUTING.md +21 -0
  5. package/README.md +25 -10
  6. package/RELEASE_NOTES-0.2.6.md +43 -0
  7. package/RELEASE_NOTES-0.3.6.md +29 -0
  8. package/RELEASE_NOTES-0.3.7.md +19 -0
  9. package/SECURITY.md +13 -0
  10. package/docs/BOTS.md +4 -4
  11. package/docs/DEPLOY.md +23 -4
  12. package/docs/ERROR-CODES-SPEC.md +4 -0
  13. package/docs/ERROR-CODES.md +7 -0
  14. package/docs/GUIDED-SETUP.md +1 -1
  15. package/docs/ROADMAP.md +62 -49
  16. package/docs/SETUP.md +11 -1
  17. package/docs/SUBKEYS.md +3 -1
  18. package/docs/continuity-currency-statechart.md +34 -0
  19. package/docs/features/README.md +21 -0
  20. package/docs/features/access.md +28 -0
  21. package/docs/features/documents.md +35 -0
  22. package/docs/features/errors.md +32 -0
  23. package/docs/features/gems.md +31 -0
  24. package/docs/features/memory.md +29 -0
  25. package/docs/features/pages.md +28 -0
  26. package/docs/features/record.md +27 -0
  27. package/docs/features/search.md +27 -0
  28. package/docs/features/startup.md +29 -0
  29. package/docs/features/subkeys.md +30 -0
  30. package/docs/features/transcripts.md +33 -0
  31. package/docs/per-tag-handoff-statechart.md +147 -0
  32. package/docs/subkey-session-statechart.md +57 -0
  33. package/package.json +6 -2
  34. package/server.json +27 -2
  35. package/src/annotations.js +5 -3
  36. package/src/attribution.js +2 -2
  37. package/src/carry-forward-close.js +1 -1
  38. package/src/chooser.js +74 -3
  39. package/src/conformance.js +2 -0
  40. package/src/continuity-currency-statechart.js +139 -0
  41. package/src/continuity-currency.js +869 -0
  42. package/src/database.js +1 -1
  43. package/src/dispatch.js +1 -1
  44. package/src/error-codes.js +7 -0
  45. package/src/gem-check.js +4 -1
  46. package/src/grants.js +28 -5
  47. package/src/host-reach.js +1 -1
  48. package/src/http-remote.js +29 -5
  49. package/src/index.js +3 -2
  50. package/src/invites.js +2 -2
  51. package/src/owl.js +12 -11
  52. package/src/pages.js +15 -0
  53. package/src/per-tag-handoff-statechart.js +264 -0
  54. package/src/per-tag-handoff.js +988 -0
  55. package/src/persons.js +16 -0
  56. package/src/session-graph.js +123 -12
  57. package/src/session.js +56 -12
  58. package/src/setup.js +32 -11
  59. package/src/startup-pages.js +13 -2
  60. package/src/subkey-lifecycle.js +105 -0
  61. package/src/subkey-session-statechart.js +253 -0
  62. package/src/subkeys.js +648 -89
  63. package/src/tools.js +171 -51
  64. package/src/transcript-session.js +2 -2
  65. package/src/version.js +1 -1
  66. package/templates/INDEX.md +1 -0
  67. package/templates/SESSIONDISPOSITION.md +2 -2
  68. package/templates/TAGHANDOFF.md +45 -0
  69. package/verification/continuity-currency/ContinuityCurrency.cfg +12 -0
  70. package/verification/continuity-currency/ContinuityCurrency.tla +239 -0
  71. package/verification/continuity-currency/tlc-output.txt +32 -0
  72. package/verification/continuity-currency/view.mjs +54 -0
  73. package/verification/load-gate/load-gate.mjs +1 -1
  74. package/verification/per-tag-handoff/PerTagHandoff.cfg +10 -0
  75. package/verification/per-tag-handoff/PerTagHandoff.tla +191 -0
  76. package/verification/per-tag-handoff/StampCounter.cfg +10 -0
  77. package/verification/per-tag-handoff/out/report.md +6 -0
  78. package/verification/per-tag-handoff/out-counter/chart.mmd +30 -0
  79. package/verification/per-tag-handoff/out-counter/report.md +15 -0
  80. package/verification/per-tag-handoff/out-counter/tlc.out +130 -0
  81. package/verification/per-tag-handoff/split/PerTagConflict.cfg +6 -0
  82. package/verification/per-tag-handoff/split/PerTagConflict.tla +104 -0
  83. package/verification/per-tag-handoff/split/PerTagTime.cfg +8 -0
  84. package/verification/per-tag-handoff/split/PerTagTime.tla +100 -0
  85. package/verification/per-tag-handoff/split/conflict-chart.mmd +47 -0
  86. package/verification/per-tag-handoff/split/conflict-report.md +8 -0
  87. package/verification/per-tag-handoff/split/conflict-tlc.txt +19 -0
  88. package/verification/per-tag-handoff/split/conflict-view.mjs +34 -0
  89. package/verification/per-tag-handoff/split/time-chart.mmd +44 -0
  90. package/verification/per-tag-handoff/split/time-report.md +8 -0
  91. package/verification/per-tag-handoff/split/time-tlc.txt +19 -0
  92. package/verification/per-tag-handoff/split/time-view.mjs +33 -0
  93. package/verification/per-tag-handoff/tlc-output.txt +19 -0
  94. package/verification/per-tag-handoff/v1-draft/PerTagHandoff.cfg +5 -0
  95. package/verification/per-tag-handoff/v1-draft/PerTagHandoff.tla +94 -0
  96. package/verification/per-tag-handoff/v1-draft/out/chart.mmd +37 -0
  97. package/verification/per-tag-handoff/v1-draft/out/report.md +7 -0
  98. package/verification/per-tag-handoff/v1-draft/out/tlc.out +19 -0
  99. package/verification/per-tag-handoff/v1-draft/view.mjs +20 -0
  100. package/verification/per-tag-handoff/view.mjs +31 -0
  101. package/verification/subkey-session/SubkeySession.cfg +11 -0
  102. package/verification/subkey-session/SubkeySession.tla +254 -0
  103. package/verification/subkey-session/tlc-output.txt +13 -0
@@ -2,7 +2,7 @@
2
2
 
3
3
  **Template control:** id `templates/SESSIONDISPOSITION.md` · revision: the store's version governs · status: IN FORCE · approved: user · 2026-10-28 · session-disposition brief · owner: EMET (base) · built to `templates/STANDARD.md` · supersedes: none
4
4
  **Fills:** `records/<name>.md` — one session, or a batch of sessions, noted under document control. **Every `records/*` document is validated against this template by its id** (`templates/STANDARD.md` §9 map). Leaving out the control block does not exempt it (§9a L4).
5
- **Failure it prevents:** `emet_session_close` compares receipts with the store as it stands that day, so a close attempted days later blocks, and a third blocked close escalates. A fabricated receipt is not a close. Reference case, 2026-10-28: an early `save_transcript` for `2026-10-28_mb-main-chat-backfill-2026-10-26`, inserted_id `6ae1df09c4da08b2cadc1fb4`, eight exchanges, first assistant line opening `grok-bot-vm-453484571 Wed Oct 28 07:38:40 EDT 2026`. That row is a duplicate of `2026-10-28_mb-main-chat-backfill-2026-10-26_verbatim_part1`, written by `emet_transcript_append`, machine line `no local shell MCP`. The duplicate is marked SUPERSEDED and retained. It is not deleted, and it is not a close.
5
+ **Failure it prevents:** `emet_session_close` compares receipts with the store as it stands that day, so a close attempted days later blocks, and a third blocked close escalates. A fabricated receipt is not a close. Reference case, 2026-10-28: an early `save_transcript` for `2026-10-28_mb-main-chat-backfill-2026-10-26`, inserted_id `6ae1df09c4da08b2cadc1fb4`, eight exchanges, first assistant line opening `example-host Wed Oct 28 07:38:40 EDT 2026`. That row is a duplicate of `2026-10-28_mb-main-chat-backfill-2026-10-26_verbatim_part1`, written by `emet_transcript_append`, machine line `no local shell MCP`. The duplicate is marked SUPERSEDED and retained. It is not deleted, and it is not a close.
6
6
  **Completion rules:** `templates/STANDARD.md` §5, unmodified.
7
7
 
8
8
  ---
@@ -27,7 +27,7 @@ The early `save_transcript` stays SUPERSEDED. It is a duplicate of the Oct 26 ve
27
27
 
28
28
  | session_id | opened_at | last_saved_at | disposition | reason | evidence | carried_forward_to | inserted_id |
29
29
  |---|---|---|---|---|---|---|---|
30
- | 2026-10-28_mb-main-chat-backfill-2026-10-26 | None — this row dispositions the early save_transcript, not the session open. | None — the live Oct 26 backfill is the verbatim part, not this inserted id. | SUPERSEDED_BY_LATER_SESSION | Early save_transcript is a SUPERSEDED duplicate of the verbatim_part1 append path. The transcript row is retained and is not deleted. | inserted_id 6ae1df09c4da08b2cadc1fb4 has 8 exchanges. The first assistant message opens with grok-bot-vm-453484571 Wed Oct 28 07:38:40 EDT 2026. The correct Oct 26 backfill is 2026-10-28_mb-main-chat-backfill-2026-10-26_verbatim_part1 via emet_transcript_append, machine line no local shell MCP. | 2026-10-28_mb-main-chat-backfill-2026-10-26_verbatim_part1 | 6ae1df09c4da08b2cadc1fb4 |
30
+ | 2026-10-28_mb-main-chat-backfill-2026-10-26 | None — this row dispositions the early save_transcript, not the session open. | None — the live Oct 26 backfill is the verbatim part, not this inserted id. | SUPERSEDED_BY_LATER_SESSION | Early save_transcript is a SUPERSEDED duplicate of the verbatim_part1 append path. The transcript row is retained and is not deleted. | inserted_id 6ae1df09c4da08b2cadc1fb4 has 8 exchanges. The first assistant message opens with example-host Wed Oct 28 07:38:40 EDT 2026. The correct Oct 26 backfill is 2026-10-28_mb-main-chat-backfill-2026-10-26_verbatim_part1 via emet_transcript_append, machine line no local shell MCP. | 2026-10-28_mb-main-chat-backfill-2026-10-26_verbatim_part1 | 6ae1df09c4da08b2cadc1fb4 |
31
31
  | 2026-10-28_mb-main-chat-backfill-2026-10-26_verbatim_part1 | None — not an overdue-inventory timestamp. This row records the open append path. | None — this row does not invent a save time. The append path holds the substance. | RETAINED_OPEN_CRITICAL | This open backfill still needs a formal emet_session_close. The filtered 31-exchange append path is the complete substance for Oct 25 through Oct 27. Do not invent a close or a receipt. | Coverage note 2026-10-28. Late Oct 25 PM and Oct 27 after about 8:40 had no owner main-chat turns (hidden wakes only). | None — formal close is still owed on this session. | None — this row dispositions the session, not one transcript document. |
32
32
 
33
33
  ---
@@ -0,0 +1,45 @@
1
+ # TEMPLATE — TAG HANDOFF
2
+
3
+ **Template control:** id `templates/TAGHANDOFF.md` · revision: the store's version governs · status: IN FORCE with the flag · owner: EMET (base) · built to `templates/STANDARD.md` · supersedes: none
4
+ **Fills:** `HANDOFF/<tag>.md` — one write tag's own session narrative, written last at that tag's close. It is a record when `EMET_TAG_HANDOFFS` is `warn` or `enforce`: revision 1 is written plain, every later revision is written whole with `supersedes` and a reason, and `patch_doc` is refused. The hub's `HANDOFF.md` is not filled from this template.
5
+ **Failure it prevents:** several write tags sharing one handoff, so the next session opens on whichever tag closed last, and a board row changed by a tag that did not open it.
6
+ **Completion rules:** `templates/STANDARD.md` §5, unmodified.
7
+
8
+ The flag is off by default. While it is off this template is not applied. The view that reads §1 is computed on read and is not a record.
9
+
10
+ ---
11
+
12
+ ## HOW TO FILL — rules specific to this template
13
+
14
+ 1. **This is this tag's record.** It holds what this tag did. Another tag's handoff is not this file.
15
+ 2. **Write this last,** after the working documents, the episodic record, any board patch of rows this tag opened, and the transcript.
16
+ 3. **§1 is the only section the shared view reads, plus the close-verification line.** At most 10 lines. Each line names a board row id, the state as this tag sees it, and the next step.
17
+ 4. **The view does not pick a winner.** If two tags disagree, both lines stay, under a conflict mark. Only the hub resolves a marked conflict, and the board write names the stamp.
18
+
19
+ ---
20
+
21
+ ## §0 RECORD CONTROL
22
+
23
+ - Template: `templates/TAGHANDOFF.md` rev __ · Handoff revision: v__ · Supersedes: v__ (or "none — first revision")
24
+ - Session id: __ · Source tag: __ · Person: the owner · Machine: __ · Written (local): __
25
+
26
+ ## §1 OVERALL PICTURE
27
+
28
+ At most 10 rows. The view reads this table and the close-verification line.
29
+
30
+ | Row | State | Next step |
31
+ | --- | --- | --- |
32
+ | B-___ | __ | __ |
33
+
34
+ ## §2 DONE THIS SESSION
35
+
36
+ | What | Evidence |
37
+ | --- | --- |
38
+
39
+ Or: *"Nothing completed this session."*
40
+
41
+ ## §3 CLOSE VERIFICATION
42
+
43
+ Close verification: episodic __
44
+
45
+ The episodic id counts as a pointer only when that session is closed. An open session is an in-progress line on the view, not a pointer.
@@ -0,0 +1,12 @@
1
+ SPECIFICATION Spec
2
+ INVARIANT TypeOK
3
+ INVARIANT NeverRewrites
4
+ INVARIANT NeverBlocks
5
+ INVARIANT WarnOnlyOnMaterialLag
6
+ INVARIANT FlagOffShowsNothing
7
+ INVARIANT NoOpIsNotAWarning
8
+ INVARIANT NoHandoffIsQuiet
9
+ INVARIANT UnreadableIsQuiet
10
+ INVARIANT FallbackOnlyIsNotBlockEligible
11
+ INVARIANT ScratchIsNotAWarning
12
+ INVARIANT VersionAloneDoesNotWarn
@@ -0,0 +1,239 @@
1
+ ---- MODULE ContinuityCurrency ----
2
+ \* Continuity-currency (tip-lag) gate.
3
+ \* Warn, current, documented no-op, no handoff, unreadable, or fallback-only.
4
+ \* The gate does not rewrite HANDOFF or STATE and does not block.
5
+ \* This is not wiki page currency. Episodic ids are not states in this model.
6
+ \* `newer` and `claim` are the classes the comparison can see.
7
+ \* `fallback` is a logged tip. It warns and it is not block-eligible.
8
+
9
+ EXTENDS Integers
10
+
11
+ VARIABLES phase, flag, newer, claim, handoffMutated, blocked, warning, blockEligible
12
+ vars == <<phase, flag, newer, claim, handoffMutated, blocked, warning, blockEligible>>
13
+
14
+ Phase == {
15
+ "GateOff", "Comparing", "Current", "DocumentedNoOp", "Warning", "BlockHeld",
16
+ "NoHandoff", "Unreadable", "FallbackOnly", "FallbackHeld"
17
+ }
18
+ Flag == {"off", "warn"}
19
+ Newer == {"none", "scratch", "material", "fallback"}
20
+ Claim == {"at_tip", "behind", "version_only"}
21
+
22
+ TypeOK ==
23
+ /\ phase \in Phase
24
+ /\ flag \in Flag
25
+ /\ newer \in Newer
26
+ /\ claim \in Claim
27
+ /\ handoffMutated \in BOOLEAN
28
+ /\ blocked \in BOOLEAN
29
+ /\ warning \in BOOLEAN
30
+ /\ blockEligible \in BOOLEAN
31
+
32
+ Init ==
33
+ /\ phase = "GateOff"
34
+ /\ flag = "off"
35
+ /\ newer = "none"
36
+ /\ claim = "at_tip"
37
+ /\ handoffMutated = FALSE
38
+ /\ blocked = FALSE
39
+ /\ warning = FALSE
40
+ /\ blockEligible = FALSE
41
+
42
+ \* The warn flag stays off. No warning is shown.
43
+ FlagStaysOff ==
44
+ /\ phase = "GateOff"
45
+ /\ flag = "off"
46
+ /\ phase' = "GateOff"
47
+ /\ warning' = FALSE
48
+ /\ UNCHANGED <<flag, newer, claim, handoffMutated, blocked, blockEligible>>
49
+
50
+ \* The warn flag is turned on. The next initialize compares.
51
+ EnableWarn ==
52
+ /\ phase = "GateOff"
53
+ /\ flag = "off"
54
+ /\ flag' = "warn"
55
+ /\ phase' = "Comparing"
56
+ /\ warning' = FALSE
57
+ /\ blockEligible' = FALSE
58
+ /\ UNCHANGED <<newer, claim, handoffMutated, blocked>>
59
+
60
+ \* The handoff cites the live material tip.
61
+ SeeCurrent ==
62
+ /\ phase = "Comparing"
63
+ /\ flag = "warn"
64
+ /\ claim' = "at_tip"
65
+ /\ newer' = "none"
66
+ /\ phase' = "Current"
67
+ /\ warning' = FALSE
68
+ /\ blockEligible' = FALSE
69
+ /\ UNCHANGED <<flag, handoffMutated, blocked>>
70
+
71
+ \* A documented no-op has no newer material tip.
72
+ SeeNoOp ==
73
+ /\ phase = "Comparing"
74
+ /\ flag = "warn"
75
+ /\ claim' = "at_tip"
76
+ /\ newer' = "none"
77
+ /\ phase' = "DocumentedNoOp"
78
+ /\ warning' = FALSE
79
+ /\ blockEligible' = FALSE
80
+ /\ UNCHANGED <<flag, handoffMutated, blocked>>
81
+
82
+ \* A newer episodic is scratch or diagnosis only. The material tip did not move.
83
+ SeeScratch ==
84
+ /\ phase = "Comparing"
85
+ /\ flag = "warn"
86
+ /\ claim' = "at_tip"
87
+ /\ newer' = "scratch"
88
+ /\ phase' = "Current"
89
+ /\ warning' = FALSE
90
+ /\ blockEligible' = FALSE
91
+ /\ UNCHANGED <<flag, handoffMutated, blocked>>
92
+
93
+ \* A version number alone cannot see a material tip that the handoff does not cite.
94
+ SeeVersionOnly ==
95
+ /\ phase = "Comparing"
96
+ /\ flag = "warn"
97
+ /\ claim' = "version_only"
98
+ /\ newer' = "material"
99
+ /\ phase' = "Current"
100
+ /\ warning' = FALSE
101
+ /\ blockEligible' = FALSE
102
+ /\ UNCHANGED <<flag, handoffMutated, blocked>>
103
+
104
+ \* The material tip is newer than the handoff claim.
105
+ SeeLag ==
106
+ /\ phase = "Comparing"
107
+ /\ flag = "warn"
108
+ /\ claim' = "behind"
109
+ /\ newer' = "material"
110
+ /\ phase' = "Warning"
111
+ /\ warning' = TRUE
112
+ /\ blockEligible' = TRUE
113
+ /\ handoffMutated' = FALSE
114
+ /\ blocked' = FALSE
115
+ /\ UNCHANGED <<flag>>
116
+
117
+ \* Only a fallback tip is newer. The warning is logged. It is not block-eligible.
118
+ SeeFallback ==
119
+ /\ phase = "Comparing"
120
+ /\ flag = "warn"
121
+ /\ claim' = "behind"
122
+ /\ newer' = "fallback"
123
+ /\ phase' = "FallbackOnly"
124
+ /\ warning' = TRUE
125
+ /\ blockEligible' = FALSE
126
+ /\ handoffMutated' = FALSE
127
+ /\ blocked' = FALSE
128
+ /\ UNCHANGED <<flag>>
129
+
130
+ \* The store has no handoff to compare. That is not a warning.
131
+ SeeNoHandoff ==
132
+ /\ phase = "Comparing"
133
+ /\ flag = "warn"
134
+ /\ claim' = "at_tip"
135
+ /\ newer' = "none"
136
+ /\ phase' = "NoHandoff"
137
+ /\ warning' = FALSE
138
+ /\ blockEligible' = FALSE
139
+ /\ handoffMutated' = FALSE
140
+ /\ blocked' = FALSE
141
+ /\ UNCHANGED <<flag>>
142
+
143
+ \* The comparison could not be read. That is not a warning.
144
+ SeeUnreadable ==
145
+ /\ phase = "Comparing"
146
+ /\ flag = "warn"
147
+ /\ claim' = "at_tip"
148
+ /\ newer' = "none"
149
+ /\ phase' = "Unreadable"
150
+ /\ warning' = FALSE
151
+ /\ blockEligible' = FALSE
152
+ /\ handoffMutated' = FALSE
153
+ /\ blocked' = FALSE
154
+ /\ UNCHANGED <<flag>>
155
+
156
+ \* Phase 2 was asked for. Only a block-eligible lag moves to BlockHeld.
157
+ \* `blockEligible` is the guard: FallbackOnly is in the phase set and is refused.
158
+ AskBlock ==
159
+ /\ phase \in {"Warning", "FallbackOnly"}
160
+ /\ blockEligible = TRUE
161
+ /\ phase' = "BlockHeld"
162
+ /\ warning' = TRUE
163
+ /\ blocked' = FALSE
164
+ /\ handoffMutated' = FALSE
165
+ /\ UNCHANGED <<flag, newer, claim, blockEligible>>
166
+
167
+ \* Phase 2 was asked for on a lag that is not block-eligible.
168
+ AskBlockOnFallback ==
169
+ /\ phase \in {"Warning", "FallbackOnly"}
170
+ /\ blockEligible = FALSE
171
+ /\ phase' = "FallbackHeld"
172
+ /\ warning' = TRUE
173
+ /\ blocked' = FALSE
174
+ /\ handoffMutated' = FALSE
175
+ /\ UNCHANGED <<flag, newer, claim, blockEligible>>
176
+
177
+ \* The next initialize compares again. Documents stay as they were.
178
+ CompareAgain ==
179
+ /\ phase \in {"Current", "DocumentedNoOp", "Warning", "BlockHeld", "NoHandoff", "Unreadable", "FallbackOnly", "FallbackHeld"}
180
+ /\ flag = "warn"
181
+ /\ phase' = "Comparing"
182
+ /\ warning' = FALSE
183
+ /\ blockEligible' = FALSE
184
+ /\ UNCHANGED <<flag, newer, claim, handoffMutated, blocked>>
185
+
186
+ Next ==
187
+ \/ FlagStaysOff
188
+ \/ EnableWarn
189
+ \/ SeeCurrent
190
+ \/ SeeNoOp
191
+ \/ SeeScratch
192
+ \/ SeeVersionOnly
193
+ \/ SeeLag
194
+ \/ SeeFallback
195
+ \/ SeeNoHandoff
196
+ \/ SeeUnreadable
197
+ \/ AskBlock
198
+ \/ AskBlockOnFallback
199
+ \/ CompareAgain
200
+
201
+ Spec == Init /\ [][Next]_vars
202
+
203
+ \* No action rewrites a continuity record.
204
+ NeverRewrites == handoffMutated = FALSE
205
+
206
+ \* Phase 1 does not block, including after a block is asked for.
207
+ NeverBlocks == blocked = FALSE
208
+
209
+ \* A warning is a material lag, or a fallback-only lag. Scratch, a no-op, and a version number are not.
210
+ WarnOnlyOnMaterialLag ==
211
+ warning = TRUE =>
212
+ /\ blocked = FALSE
213
+ /\ handoffMutated = FALSE
214
+ /\ \/ (phase \in {"Warning", "BlockHeld"} /\ newer = "material" /\ claim = "behind" /\ blockEligible = TRUE)
215
+ \/ (phase \in {"FallbackOnly", "FallbackHeld"} /\ newer = "fallback" /\ claim = "behind" /\ blockEligible = FALSE)
216
+
217
+ \* The flag-off surface shows nothing.
218
+ FlagOffShowsNothing == flag = "off" => phase = "GateOff" /\ warning = FALSE
219
+
220
+ \* A documented no-op is not a warning.
221
+ NoOpIsNotAWarning == phase = "DocumentedNoOp" => warning = FALSE
222
+
223
+ \* No handoff is not a warning, and nothing is written.
224
+ NoHandoffIsQuiet == phase = "NoHandoff" => warning = FALSE /\ blocked = FALSE /\ handoffMutated = FALSE
225
+
226
+ \* An unreadable comparison is not a warning, and nothing is written.
227
+ UnreadableIsQuiet == phase = "Unreadable" => warning = FALSE /\ blocked = FALSE /\ handoffMutated = FALSE
228
+
229
+ \* Fallback-only warns and is not block-eligible.
230
+ FallbackOnlyIsNotBlockEligible ==
231
+ newer = "fallback" => blocked = FALSE /\ blockEligible = FALSE
232
+
233
+ \* Scratch or diagnosis-only does not warn.
234
+ ScratchIsNotAWarning == newer = "scratch" => warning = FALSE
235
+
236
+ \* Version alone cannot see the lag class.
237
+ VersionAloneDoesNotWarn == claim = "version_only" => warning = FALSE
238
+
239
+ ====
@@ -0,0 +1,32 @@
1
+ # ContinuityCurrency
2
+
3
+ TLC reached 16 distinct states. The depth of the complete state graph is 4.
4
+ Deadlock checking was on. The invariants are the ones in ContinuityCurrency.cfg.
5
+ Episodic ids are not states. `newer` and `claim` are classes.
6
+ `fallback` is a logged tip. No handoff and unreadable are phases.
7
+
8
+ ## Rules that hold
9
+ TypeOK, NeverRewrites, NeverBlocks, WarnOnlyOnMaterialLag, FlagOffShowsNothing, NoOpIsNotAWarning, NoHandoffIsQuiet, UnreadableIsQuiet, FallbackOnlyIsNotBlockEligible, ScratchIsNotAWarning, VersionAloneDoesNotWarn, NoDeadlock
10
+
11
+ TLC stdout for verification/continuity-currency/ContinuityCurrency.tla
12
+ TLC2 Version 2.19 of 08 August 2024
13
+ Warning: Please run the Java VM which executes TLC with a throughput optimized garbage collector by passing the "-XX:+UseParallelGC" property.
14
+ (Use the -nowarning option to disable this warning.)
15
+ Running breadth-first search Model-Checking with fp 0 and seed 6051156359700788678 with 1 worker on 4 cores with 3746MB heap and 64MB offheap memory [pid: 6689] (Linux 6.12.113+ amd64, Ubuntu 21.0.12.1 x86_64, MSBDiskFPSet, DiskStateQueue).
16
+ Parsing file ContinuityCurrency.tla
17
+ Parsing file Integers.tla
18
+ Parsing file Naturals.tla
19
+ Semantic processing of module Naturals
20
+ Semantic processing of module Integers
21
+ Semantic processing of module ContinuityCurrency
22
+ Starting... (2026-11-10 02:09:10)
23
+ Computing initial states...
24
+ Finished computing initial states: 1 distinct state generated at 2026-11-10 02:09:10.
25
+ Model checking completed. No error has been found.
26
+ Estimates of the probability that TLC did not check all reachable states
27
+ because two distinct states had the same fingerprint:
28
+ calculated (optimistic): val = 3.4E-17
29
+ 55 states generated, 16 distinct states found, 0 states left on queue.
30
+ The depth of the complete state graph search is 4.
31
+ The average outdegree of the complete state graph is 1 (minimum is 0, the maximum 8 and the 95th percentile is 8).
32
+ Finished in 00s at (2026-11-10 02:09:10)
@@ -0,0 +1,54 @@
1
+ /** Reader labels for the continuity-currency tip-lag chart. Episodic ids are not drawn. */
2
+
3
+ export const title = "Continuity currency";
4
+
5
+ export const state = (v) => {
6
+ if (v.phase === "GateOff") return "Gate off";
7
+ if (v.phase === "Comparing") return "Comparing";
8
+ if (v.phase === "Current") return "Current";
9
+ if (v.phase === "DocumentedNoOp") return "Documented no-op";
10
+ if (v.phase === "Warning") return "Warning, does not block";
11
+ if (v.phase === "BlockHeld") return "Block asked, still open";
12
+ if (v.phase === "NoHandoff") return "No handoff";
13
+ if (v.phase === "Unreadable") return "Unreadable";
14
+ if (v.phase === "FallbackOnly") return "Fallback only, does not block";
15
+ if (v.phase === "FallbackHeld") return "Block asked of a fallback, still open";
16
+ return v.phase;
17
+ };
18
+
19
+ export const step = (action) => {
20
+ const labels = {
21
+ FlagStaysOff: "warn flag stays off",
22
+ EnableWarn: "warn flag on",
23
+ SeeCurrent: "handoff cites the live material tip",
24
+ SeeNoOp: "documented no-op, no newer material tip",
25
+ SeeScratch: "newer episodic is scratch or diagnosis only",
26
+ SeeVersionOnly: "version number alone",
27
+ SeeLag: "material tip is newer",
28
+ SeeFallback: "only a fallback tip is newer",
29
+ SeeNoHandoff: "no handoff to compare",
30
+ SeeUnreadable: "the comparison could not be read",
31
+ AskBlock: "block asked, still does not block",
32
+ AskBlockOnFallback: "block asked, still does not block",
33
+ CompareAgain: "the next initialize compares again"
34
+ };
35
+ return labels[action] ?? null;
36
+ };
37
+
38
+ export const group = (v) => {
39
+ if (v.phase === "Warning" || v.phase === "BlockHeld") return "warn";
40
+ if (v.phase === "FallbackOnly" || v.phase === "FallbackHeld") return "fallback";
41
+ if (v.phase === "NoHandoff" || v.phase === "Unreadable") return "missing";
42
+ if (v.phase === "GateOff") return "off";
43
+ if (v.phase === "Comparing") return "compare";
44
+ return "clear";
45
+ };
46
+
47
+ export const colors = {
48
+ off: "tan",
49
+ compare: "blue",
50
+ clear: "teal",
51
+ warn: "orange",
52
+ fallback: "yellow",
53
+ missing: "purple"
54
+ };
@@ -5,7 +5,7 @@
5
5
  * Licensed under the MIT License - see LICENSE
6
6
  *
7
7
  * Load gate for a client RUNE. The server never runs the file. This module
8
- * is the scanner EMET-GEMs vendors: keep it byte-identical, including the
8
+ * is the scanner a library checkout vendors: keep it byte-identical, including the
9
9
  * corpus under verification/load-gate/. acorn 8.19.0 only. A parse error
10
10
  * fails closed. There is no second scan and no child process.
11
11
  *
@@ -0,0 +1,10 @@
1
+ SPECIFICATION Spec
2
+ INVARIANT TypeOK
3
+ INVARIANT OwnHandoffOnly
4
+ INVARIANT RowPatchedOnlyByOpener
5
+ INVARIANT NoLostBoardUpdate
6
+ INVARIANT ReadOnlyWritesNothing
7
+ INVARIANT IdsCarryPerson
8
+ INVARIANT OpenWorkOnlyInProgress
9
+ INVARIANT StaleMarkOnlyWhileOpen
10
+ INVARIANT StampReproducible
@@ -0,0 +1,191 @@
1
+ ---- MODULE PerTagHandoff ----
2
+ EXTENDS Naturals
3
+ \* Build model for per-tag handoffs, with the locked decisions.
4
+ \* Two write tags (hub keeps HANDOFF.md; writer is a bot), one read-only tag.
5
+ \* Handoff ids carry a person segment (reserved now; one person until the multi-user phase).
6
+ \* One board row is enough to show the opener rule: one tag opens it, the other is foreign.
7
+ Writers == {"hub", "writer"}
8
+ Readers == {"guest"}
9
+ Tags == Writers \cup Readers
10
+ Person == "owner"
11
+ MaxV == 1
12
+ MaxB == 2
13
+
14
+ \* A write is allowed only when the credential's (person, tag) equals the document's.
15
+ DocId(w) == <<Person, w>>
16
+ Cred(t) == <<Person, t>>
17
+
18
+ VARIABLES phase, hv, author, board, seen, patches, refused,
19
+ opener, patchedBy, resolvedBy, conflict,
20
+ hage, openAge, epiOpen, ptr, stamp, viewSeen
21
+ vars == <<phase, hv, author, board, seen, patches, refused,
22
+ opener, patchedBy, resolvedBy, conflict,
23
+ hage, openAge, epiOpen, ptr, stamp, viewSeen>>
24
+
25
+ \* The merged view, computed on read. Each line: (handoff version, currency class).
26
+ \* Age 1 means older than 7 days, shown "aging".
27
+ LineClass(a) == IF a = 1 THEN "aging" ELSE "current"
28
+ ViewAt(v, a) == [w \in Writers |-> IF v[w] = 0 THEN <<0, "none">> ELSE <<v[w], LineClass(a[w])>>]
29
+ EmptyView == ViewAt([w \in Writers |-> 0], [w \in Writers |-> 0])
30
+
31
+ Init ==
32
+ /\ phase = [t \in Tags |-> "out"]
33
+ /\ hv = [w \in Writers |-> 0]
34
+ /\ author = [w \in Writers |-> "none"]
35
+ /\ board = 0 /\ patches = 0
36
+ /\ seen = [t \in Tags |-> 0]
37
+ /\ refused = FALSE
38
+ /\ opener = "none" /\ patchedBy = {} /\ resolvedBy = {} /\ conflict = FALSE
39
+ /\ hage = [w \in Writers |-> 0]
40
+ /\ openAge = [t \in Tags |-> 0]
41
+ /\ epiOpen = [t \in Tags |-> FALSE]
42
+ /\ ptr = [w \in Writers |-> 0]
43
+ /\ stamp = [t \in Tags |-> [v |-> [w \in Writers |-> 0], a |-> [w \in Writers |-> 0]]]
44
+ /\ viewSeen = [t \in Tags |-> EmptyView]
45
+
46
+ \* Any tag starts: reads the merged view and records a stamp (versions AND the as-of age).
47
+ Start(t) ==
48
+ /\ phase[t] = "out"
49
+ /\ phase' = [phase EXCEPT ![t] = "in"]
50
+ /\ seen' = [seen EXCEPT ![t] = board]
51
+ /\ stamp' = [stamp EXCEPT ![t] = [v |-> hv, a |-> hage]]
52
+ /\ viewSeen' = [viewSeen EXCEPT ![t] = ViewAt(hv, hage)]
53
+ /\ openAge' = [openAge EXCEPT ![t] = 0]
54
+ /\ refused' = FALSE
55
+ /\ UNCHANGED <<hv, author, board, patches, opener, patchedBy, resolvedBy, conflict, hage, epiOpen, ptr>>
56
+
57
+ BoardWrite(t) ==
58
+ /\ seen[t] = board /\ board < MaxB
59
+ /\ board' = board + 1 /\ patches' = patches + 1
60
+ /\ seen' = [seen EXCEPT ![t] = board + 1]
61
+ /\ refused' = FALSE
62
+
63
+ \* A write tag opens the row; it becomes the row's opener.
64
+ OpenRow(t) ==
65
+ /\ t \in Writers /\ phase[t] = "in" /\ opener = "none"
66
+ /\ BoardWrite(t)
67
+ /\ opener' = t
68
+ /\ UNCHANGED <<phase, hv, author, patchedBy, resolvedBy, conflict, hage, openAge, epiOpen, ptr, stamp, viewSeen>>
69
+
70
+ \* Only the opener may patch its row.
71
+ PatchOwnRow(t) ==
72
+ /\ t \in Writers /\ phase[t] = "in" /\ opener = t
73
+ /\ BoardWrite(t)
74
+ /\ patchedBy' = patchedBy \cup {t}
75
+ /\ UNCHANGED <<phase, hv, author, opener, resolvedBy, conflict, hage, openAge, epiOpen, ptr, stamp, viewSeen>>
76
+
77
+ \* Any other tag patching the row is refused (the hub too, unless it is resolving a marked conflict).
78
+ ForeignRowPatch(t) ==
79
+ /\ phase[t] = "in" /\ opener \notin {t, "none"}
80
+ /\ ~(t = "hub" /\ conflict)
81
+ /\ refused' = TRUE
82
+ /\ UNCHANGED <<phase, hv, author, board, seen, patches, opener, patchedBy, resolvedBy, conflict, hage, openAge, epiOpen, ptr, stamp, viewSeen>>
83
+
84
+ \* The hub resolves a marked conflict on a row it did not open; the mark clears.
85
+ ResolveConflict ==
86
+ /\ phase["hub"] = "in" /\ conflict /\ opener \notin {"hub", "none"}
87
+ /\ BoardWrite("hub")
88
+ /\ resolvedBy' = resolvedBy \cup {"hub"}
89
+ /\ conflict' = FALSE
90
+ /\ UNCHANGED <<phase, hv, author, opener, patchedBy, hage, openAge, epiOpen, ptr, stamp, viewSeen>>
91
+
92
+ \* A board write on a version that moved since this tag read it is refused; the tag re-reads.
93
+ StalePatch(t) ==
94
+ /\ t \in Writers /\ phase[t] = "in" /\ seen[t] # board
95
+ /\ seen' = [seen EXCEPT ![t] = board]
96
+ /\ refused' = TRUE
97
+ /\ UNCHANGED <<phase, hv, author, board, patches, opener, patchedBy, resolvedBy, conflict, hage, openAge, epiOpen, ptr, stamp, viewSeen>>
98
+
99
+ \* A write tag saves material work in an open session (B-137 shows it as "in progress").
100
+ SaveMaterial(t) ==
101
+ /\ t \in Writers /\ phase[t] = "in" /\ ~epiOpen[t]
102
+ /\ epiOpen' = [epiOpen EXCEPT ![t] = TRUE]
103
+ /\ refused' = FALSE
104
+ /\ UNCHANGED <<phase, hv, author, board, seen, patches, opener, patchedBy, resolvedBy, conflict, hage, openAge, ptr, stamp, viewSeen>>
105
+
106
+ \* Time passes: open sessions pass 24 hours, written handoff lines pass 7 days.
107
+ Tick ==
108
+ /\ \/ \E t \in Tags : phase[t] = "in" /\ openAge[t] = 0
109
+ \/ \E w \in Writers : hv[w] > 0 /\ hage[w] = 0
110
+ /\ openAge' = [t \in Tags |-> IF phase[t] = "in" THEN 1 ELSE openAge[t]]
111
+ /\ hage' = [w \in Writers |-> IF hv[w] > 0 THEN 1 ELSE hage[w]]
112
+ /\ refused' = FALSE
113
+ /\ UNCHANGED <<phase, hv, author, board, seen, patches, opener, patchedBy, resolvedBy, conflict, epiOpen, ptr, stamp, viewSeen>>
114
+
115
+ \* Wrap-up: a write tag supersedes only its own handoff, last. Its line may disagree
116
+ \* with the opener's on the row, which marks a conflict for the hub. Only now does the
117
+ \* session's material work count as a B-137 pointer (closed sessions only).
118
+ WrapOwn(t, disagree) ==
119
+ /\ t \in Writers /\ phase[t] = "in" /\ hv[t] < MaxV
120
+ /\ Cred(t) = DocId(t)
121
+ /\ hv' = [hv EXCEPT ![t] = hv[t] + 1]
122
+ /\ author' = [author EXCEPT ![t] = t]
123
+ /\ hage' = [hage EXCEPT ![t] = 0]
124
+ /\ phase' = [phase EXCEPT ![t] = "out"]
125
+ /\ ptr' = [ptr EXCEPT ![t] = IF epiOpen[t] THEN ptr[t] + 1 ELSE ptr[t]]
126
+ /\ epiOpen' = [epiOpen EXCEPT ![t] = FALSE]
127
+ /\ openAge' = [openAge EXCEPT ![t] = 0]
128
+ /\ conflict' = (conflict \/ (disagree /\ opener \notin {t, "none"}))
129
+ /\ refused' = FALSE
130
+ /\ UNCHANGED <<board, seen, patches, opener, patchedBy, resolvedBy, stamp, viewSeen>>
131
+
132
+ \* Any tag (bot, non-bot, or read-only) writing another tag's handoff is refused,
133
+ \* including a non-hub tag writing HANDOFF.md: the non-bot write gap is closed.
134
+ ForeignWrite(t, u) ==
135
+ /\ phase[t] = "in" /\ u \in Writers /\ u # t
136
+ /\ Cred(t) # DocId(u)
137
+ /\ refused' = TRUE
138
+ /\ UNCHANGED <<phase, hv, author, board, seen, patches, opener, patchedBy, resolvedBy, conflict, hage, openAge, epiOpen, ptr, stamp, viewSeen>>
139
+
140
+ \* A read-only tag leaves without writing anything.
141
+ LeaveReadOnly(t) ==
142
+ /\ t \in Readers /\ phase[t] = "in"
143
+ /\ phase' = [phase EXCEPT ![t] = "out"]
144
+ /\ openAge' = [openAge EXCEPT ![t] = 0]
145
+ /\ refused' = FALSE
146
+ /\ UNCHANGED <<hv, author, board, seen, patches, opener, patchedBy, resolvedBy, conflict, hage, epiOpen, ptr, stamp, viewSeen>>
147
+
148
+ Done == /\ \A w \in Writers : hv[w] = MaxV
149
+ /\ UNCHANGED vars
150
+
151
+ Next ==
152
+ \/ \E t \in Tags : Start(t)
153
+ \/ \E t \in Writers : OpenRow(t) \/ PatchOwnRow(t) \/ StalePatch(t) \/ SaveMaterial(t)
154
+ \/ \E t \in Tags : ForeignRowPatch(t)
155
+ \/ ResolveConflict
156
+ \/ Tick
157
+ \/ \E t \in Writers, d \in BOOLEAN : WrapOwn(t, d)
158
+ \/ \E t \in Tags, u \in Writers : ForeignWrite(t, u)
159
+ \/ \E t \in Readers : LeaveReadOnly(t)
160
+ \/ Done
161
+
162
+ Spec == Init /\ [][Next]_vars
163
+
164
+ TypeOK ==
165
+ /\ phase \in [Tags -> {"out", "in"}]
166
+ /\ hv \in [Writers -> 0..MaxV]
167
+ /\ board \in 0..MaxB
168
+ /\ opener \in Writers \cup {"none"}
169
+ /\ hage \in [Writers -> 0..1] /\ openAge \in [Tags -> 0..1]
170
+
171
+ \* Decision 4 and the closed gap: each handoff (HANDOFF.md for the hub) is written only by its own tag.
172
+ OwnHandoffOnly == \A w \in Writers : author[w] \in {w, "none"}
173
+ \* Decision 3: only the opener patches a row; the hub's only exception is resolving a marked conflict.
174
+ RowPatchedOnlyByOpener == patchedBy \subseteq {opener} /\ resolvedBy \subseteq {"hub"}
175
+ \* No board write is lost: every applied write is one board version.
176
+ NoLostBoardUpdate == board = patches
177
+ \* A read-only tag writes nothing anywhere.
178
+ ReadOnlyWritesNothing ==
179
+ /\ \A w \in Writers : author[w] \notin Readers
180
+ /\ opener \notin Readers /\ patchedBy \cap Readers = {}
181
+ \* Decision 8: every handoff id carries the person segment.
182
+ IdsCarryPerson == \A w \in Writers : DocId(w)[1] = Person
183
+ \* Decision 5: open-session work is never a pointer; it shows as in progress until close,
184
+ \* and a stale-open mark exists only on a session that is still open.
185
+ OpenWorkOnlyInProgress == \A t \in Tags : epiOpen[t] => phase[t] = "in"
186
+ StaleMarkOnlyWhileOpen == \A t \in Tags : openAge[t] = 1 => phase[t] = "in"
187
+ \* Decision 6: the view an AI read can be rebuilt from its stamp alone (versions plus as-of age).
188
+ StampReproducible == \A t \in Tags : phase[t] = "in" => viewSeen[t] = ViewAt(stamp[t].v, stamp[t].a)
189
+ \* Counter-check (expected to FAIL): a stamp of versions only is not enough, because aging moves.
190
+ StampVersionsOnly == \A t \in Tags : phase[t] = "in" => viewSeen[t] = ViewAt(stamp[t].v, hage)
191
+ ====
@@ -0,0 +1,10 @@
1
+ SPECIFICATION Spec
2
+ INVARIANT TypeOK
3
+ INVARIANT OwnHandoffOnly
4
+ INVARIANT RowPatchedOnlyByOpener
5
+ INVARIANT NoLostBoardUpdate
6
+ INVARIANT ReadOnlyWritesNothing
7
+ INVARIANT IdsCarryPerson
8
+ INVARIANT OpenWorkOnlyInProgress
9
+ INVARIANT StaleMarkOnlyWhileOpen
10
+ INVARIANT StampVersionsOnly
@@ -0,0 +1,6 @@
1
+ # PerTagHandoff
2
+
3
+ TLC reached 958,557 states, more than the chart budget of 500, so the command wrote no chart.mmd.
4
+
5
+ ## Rules that hold
6
+ TypeOK, OwnHandoffOnly, RowPatchedOnlyByOpener, NoLostBoardUpdate, ReadOnlyWritesNothing, IdsCarryPerson, OpenWorkOnlyInProgress, StaleMarkOnlyWhileOpen, StampReproducible, NoDeadlock
@@ -0,0 +1,30 @@
1
+ ---
2
+ title: "Per-tag handoffs: own handoff, opener-only rows, merged view on read"
3
+ ---
4
+ stateDiagram-v2
5
+ state "Legend" as legend {
6
+ lg0: session
7
+ lg1: rest
8
+ lg2: Breaks StampVersionsOnly in some cases
9
+ lg3: Path to the StampVersionsOnly bug
10
+ }
11
+ class lg0 blue
12
+ class lg1 teal
13
+ class lg2 mayBreak
14
+ class lg3 bugPath
15
+ s0: No handoffs yet
16
+ s1: In session, merged view read
17
+ s2: Handoffs at rest
18
+ [*] --> s0
19
+ s0 --> s1: an AI starts, reads the merged view, and stamps it
20
+ s1 --> s2: a write AI writes its own handoff last
21
+ s2 --> s1: an AI starts, reads the merged view, and stamps it
22
+ s1 --> s1: time passes (24 hours open, 7 days aging)
23
+ classDef mayBreak fill:#fff3e6,stroke:#e8730c,stroke-width:2.5px,color:#b85a06
24
+ class s0 teal
25
+ class s0 bugPath
26
+ class s1 blue
27
+ class s1 mayBreak
28
+ class s1 bugPath
29
+ class s2 teal
30
+ class s2 bugPath