@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
@@ -0,0 +1,15 @@
1
+ # PerTagHandoff
2
+
3
+ TLC reached more states than the chart budget of 500, so the chart draws only the bug paths: 3 states and 4 arrows.
4
+
5
+ ## StampVersionsOnly breaks
6
+ The shortest path has 4 steps:
7
+ 0. No handoffs yet
8
+ 1. an AI starts, reads the merged view, and stamps it: In session, merged view read
9
+ 2. a write AI writes its own handoff last: Handoffs at rest
10
+ 3. an AI starts, reads the merged view, and stamps it: In session, merged view read
11
+ 4. time passes (24 hours open, 7 days aging): In session, merged view read
12
+
13
+ ## Rules not checked
14
+ TypeOK, OwnHandoffOnly, RowPatchedOnlyByOpener, NoLostBoardUpdate, ReadOnlyWritesNothing, IdsCarryPerson, OpenWorkOnlyInProgress, StaleMarkOnlyWhileOpen, NoDeadlock
15
+ After the first break, each TLC run stops at 100,000 distinct states. A run reached that bound before it checked these rules in every state.
@@ -0,0 +1,130 @@
1
+ TLC2 Version 2.19 of 08 August 2024
2
+ Running breadth-first search Model-Checking with fp 48 and seed 8161273907364944113 with 1 worker on 4 cores with 3330MB heap and 64MB offheap memory [pid: 11329] (Linux 6.12.113+ amd64, Ubuntu 21.0.12.1 x86_64, MSBDiskFPSet, DiskStateQueue).
3
+ Parsing file PerTagHandoff.tla
4
+ Parsing file Naturals.tla
5
+ Semantic processing of module Naturals
6
+ Semantic processing of module PerTagHandoff
7
+ Starting... (2026-11-10 15:55:20)
8
+ Computing initial states...
9
+ Finished computing initial states: 1 distinct state generated at 2026-11-10 15:55:20.
10
+ Error: Invariant StampVersionsOnly is violated.
11
+ Error: The behavior up to this point is:
12
+ State 1: <Initial predicate>
13
+ /\ seen = [hub |-> 0, writer |-> 0, guest |-> 0]
14
+ /\ refused = FALSE
15
+ /\ viewSeen = [ hub |-> [hub |-> <<0, "none">>, writer |-> <<0, "none">>],
16
+ writer |-> [hub |-> <<0, "none">>, writer |-> <<0, "none">>],
17
+ guest |-> [hub |-> <<0, "none">>, writer |-> <<0, "none">>] ]
18
+ /\ patches = 0
19
+ /\ hv = [hub |-> 0, writer |-> 0]
20
+ /\ hage = [hub |-> 0, writer |-> 0]
21
+ /\ opener = "none"
22
+ /\ phase = [hub |-> "out", writer |-> "out", guest |-> "out"]
23
+ /\ board = 0
24
+ /\ author = [hub |-> "none", writer |-> "none"]
25
+ /\ resolvedBy = {}
26
+ /\ conflict = FALSE
27
+ /\ epiOpen = [hub |-> FALSE, writer |-> FALSE, guest |-> FALSE]
28
+ /\ openAge = [hub |-> 0, writer |-> 0, guest |-> 0]
29
+ /\ patchedBy = {}
30
+ /\ ptr = [hub |-> 0, writer |-> 0]
31
+ /\ stamp = [ hub |-> [a |-> [hub |-> 0, writer |-> 0], v |-> [hub |-> 0, writer |-> 0]],
32
+ writer |-> [a |-> [hub |-> 0, writer |-> 0], v |-> [hub |-> 0, writer |-> 0]],
33
+ guest |-> [a |-> [hub |-> 0, writer |-> 0], v |-> [hub |-> 0, writer |-> 0]] ]
34
+
35
+ State 2: <Start line 48, col 3 to line 55, col 106 of module PerTagHandoff>
36
+ /\ seen = [hub |-> 0, writer |-> 0, guest |-> 0]
37
+ /\ refused = FALSE
38
+ /\ viewSeen = [ hub |-> [hub |-> <<0, "none">>, writer |-> <<0, "none">>],
39
+ writer |-> [hub |-> <<0, "none">>, writer |-> <<0, "none">>],
40
+ guest |-> [hub |-> <<0, "none">>, writer |-> <<0, "none">>] ]
41
+ /\ patches = 0
42
+ /\ hv = [hub |-> 0, writer |-> 0]
43
+ /\ hage = [hub |-> 0, writer |-> 0]
44
+ /\ opener = "none"
45
+ /\ phase = [hub |-> "in", writer |-> "out", guest |-> "out"]
46
+ /\ board = 0
47
+ /\ author = [hub |-> "none", writer |-> "none"]
48
+ /\ resolvedBy = {}
49
+ /\ conflict = FALSE
50
+ /\ epiOpen = [hub |-> FALSE, writer |-> FALSE, guest |-> FALSE]
51
+ /\ openAge = [hub |-> 0, writer |-> 0, guest |-> 0]
52
+ /\ patchedBy = {}
53
+ /\ ptr = [hub |-> 0, writer |-> 0]
54
+ /\ stamp = [ hub |-> [a |-> [hub |-> 0, writer |-> 0], v |-> [hub |-> 0, writer |-> 0]],
55
+ writer |-> [a |-> [hub |-> 0, writer |-> 0], v |-> [hub |-> 0, writer |-> 0]],
56
+ guest |-> [a |-> [hub |-> 0, writer |-> 0], v |-> [hub |-> 0, writer |-> 0]] ]
57
+
58
+ State 3: <WrapOwn line 119, col 3 to line 130, col 87 of module PerTagHandoff>
59
+ /\ seen = [hub |-> 0, writer |-> 0, guest |-> 0]
60
+ /\ refused = FALSE
61
+ /\ viewSeen = [ hub |-> [hub |-> <<0, "none">>, writer |-> <<0, "none">>],
62
+ writer |-> [hub |-> <<0, "none">>, writer |-> <<0, "none">>],
63
+ guest |-> [hub |-> <<0, "none">>, writer |-> <<0, "none">>] ]
64
+ /\ patches = 0
65
+ /\ hv = [hub |-> 1, writer |-> 0]
66
+ /\ hage = [hub |-> 0, writer |-> 0]
67
+ /\ opener = "none"
68
+ /\ phase = [hub |-> "out", writer |-> "out", guest |-> "out"]
69
+ /\ board = 0
70
+ /\ author = [hub |-> "hub", writer |-> "none"]
71
+ /\ resolvedBy = {}
72
+ /\ conflict = FALSE
73
+ /\ epiOpen = [hub |-> FALSE, writer |-> FALSE, guest |-> FALSE]
74
+ /\ openAge = [hub |-> 0, writer |-> 0, guest |-> 0]
75
+ /\ patchedBy = {}
76
+ /\ ptr = [hub |-> 0, writer |-> 0]
77
+ /\ stamp = [ hub |-> [a |-> [hub |-> 0, writer |-> 0], v |-> [hub |-> 0, writer |-> 0]],
78
+ writer |-> [a |-> [hub |-> 0, writer |-> 0], v |-> [hub |-> 0, writer |-> 0]],
79
+ guest |-> [a |-> [hub |-> 0, writer |-> 0], v |-> [hub |-> 0, writer |-> 0]] ]
80
+
81
+ State 4: <Start line 48, col 3 to line 55, col 106 of module PerTagHandoff>
82
+ /\ seen = [hub |-> 0, writer |-> 0, guest |-> 0]
83
+ /\ refused = FALSE
84
+ /\ viewSeen = [ hub |-> [hub |-> <<1, "current">>, writer |-> <<0, "none">>],
85
+ writer |-> [hub |-> <<0, "none">>, writer |-> <<0, "none">>],
86
+ guest |-> [hub |-> <<0, "none">>, writer |-> <<0, "none">>] ]
87
+ /\ patches = 0
88
+ /\ hv = [hub |-> 1, writer |-> 0]
89
+ /\ hage = [hub |-> 0, writer |-> 0]
90
+ /\ opener = "none"
91
+ /\ phase = [hub |-> "in", writer |-> "out", guest |-> "out"]
92
+ /\ board = 0
93
+ /\ author = [hub |-> "hub", writer |-> "none"]
94
+ /\ resolvedBy = {}
95
+ /\ conflict = FALSE
96
+ /\ epiOpen = [hub |-> FALSE, writer |-> FALSE, guest |-> FALSE]
97
+ /\ openAge = [hub |-> 0, writer |-> 0, guest |-> 0]
98
+ /\ patchedBy = {}
99
+ /\ ptr = [hub |-> 0, writer |-> 0]
100
+ /\ stamp = [ hub |-> [a |-> [hub |-> 0, writer |-> 0], v |-> [hub |-> 1, writer |-> 0]],
101
+ writer |-> [a |-> [hub |-> 0, writer |-> 0], v |-> [hub |-> 0, writer |-> 0]],
102
+ guest |-> [a |-> [hub |-> 0, writer |-> 0], v |-> [hub |-> 0, writer |-> 0]] ]
103
+
104
+ State 5: <Tick line 108, col 3 to line 113, col 130 of module PerTagHandoff>
105
+ /\ seen = [hub |-> 0, writer |-> 0, guest |-> 0]
106
+ /\ refused = FALSE
107
+ /\ viewSeen = [ hub |-> [hub |-> <<1, "current">>, writer |-> <<0, "none">>],
108
+ writer |-> [hub |-> <<0, "none">>, writer |-> <<0, "none">>],
109
+ guest |-> [hub |-> <<0, "none">>, writer |-> <<0, "none">>] ]
110
+ /\ patches = 0
111
+ /\ hv = [hub |-> 1, writer |-> 0]
112
+ /\ hage = [hub |-> 1, writer |-> 0]
113
+ /\ opener = "none"
114
+ /\ phase = [hub |-> "in", writer |-> "out", guest |-> "out"]
115
+ /\ board = 0
116
+ /\ author = [hub |-> "hub", writer |-> "none"]
117
+ /\ resolvedBy = {}
118
+ /\ conflict = FALSE
119
+ /\ epiOpen = [hub |-> FALSE, writer |-> FALSE, guest |-> FALSE]
120
+ /\ openAge = [hub |-> 1, writer |-> 0, guest |-> 0]
121
+ /\ patchedBy = {}
122
+ /\ ptr = [hub |-> 0, writer |-> 0]
123
+ /\ stamp = [ hub |-> [a |-> [hub |-> 0, writer |-> 0], v |-> [hub |-> 1, writer |-> 0]],
124
+ writer |-> [a |-> [hub |-> 0, writer |-> 0], v |-> [hub |-> 0, writer |-> 0]],
125
+ guest |-> [a |-> [hub |-> 0, writer |-> 0], v |-> [hub |-> 0, writer |-> 0]] ]
126
+
127
+ 408 states generated, 189 distinct states found, 141 states left on queue.
128
+ The depth of the complete state graph search is 5.
129
+ The average outdegree of the complete state graph is 4 (minimum is 0, the maximum 10 and the 95th percentile is 9).
130
+ Finished in 00s at (2026-11-10 15:55:20)
@@ -0,0 +1,6 @@
1
+ SPECIFICATION Spec
2
+ INVARIANT TypeOK
3
+ INVARIANT OwnHandoffOnly
4
+ INVARIANT RowPatchedOnlyByOpener
5
+ INVARIANT NoLostBoardUpdate
6
+ INVARIANT ReadOnlyWritesNothing
@@ -0,0 +1,104 @@
1
+ ---- MODULE PerTagConflict ----
2
+ \* Conflict half of the reference model. No clock. One board step. No reader.
3
+ \* The hub changes a foreign row only while a conflict is marked.
4
+ EXTENDS Naturals
5
+ Writers == {"hub", "writer"}
6
+ MaxV == 1
7
+ MaxB == 1
8
+
9
+ VARIABLES phase, hv, author, board, seen, patches, refused, opener, patchedBy, resolvedBy, conflict
10
+ vars == <<phase, hv, author, board, seen, patches, refused, opener, patchedBy, resolvedBy, conflict>>
11
+
12
+ Init ==
13
+ /\ phase = [w \in Writers |-> "out"]
14
+ /\ hv = [w \in Writers |-> 0]
15
+ /\ author = [w \in Writers |-> "none"]
16
+ /\ board = 0 /\ patches = 0
17
+ /\ seen = [w \in Writers |-> 0]
18
+ /\ refused = FALSE
19
+ /\ opener = "none" /\ patchedBy = {} /\ resolvedBy = {} /\ conflict = FALSE
20
+
21
+ Start(t) ==
22
+ /\ phase[t] = "out"
23
+ /\ phase' = [phase EXCEPT ![t] = "in"]
24
+ /\ seen' = [seen EXCEPT ![t] = board]
25
+ /\ refused' = FALSE
26
+ /\ UNCHANGED <<hv, author, board, patches, opener, patchedBy, resolvedBy, conflict>>
27
+
28
+ BoardWrite(t) ==
29
+ /\ seen[t] = board /\ board < MaxB
30
+ /\ board' = board + 1 /\ patches' = patches + 1
31
+ /\ seen' = [seen EXCEPT ![t] = board + 1]
32
+ /\ refused' = FALSE
33
+
34
+ OpenRow(t) ==
35
+ /\ phase[t] = "in" /\ opener = "none"
36
+ /\ BoardWrite(t)
37
+ /\ opener' = t
38
+ /\ UNCHANGED <<phase, hv, author, patchedBy, resolvedBy, conflict>>
39
+
40
+ PatchOwnRow(t) ==
41
+ /\ phase[t] = "in" /\ opener = t
42
+ /\ BoardWrite(t)
43
+ /\ patchedBy' = patchedBy \cup {t}
44
+ /\ UNCHANGED <<phase, hv, author, opener, resolvedBy, conflict>>
45
+
46
+ ForeignRowPatch(t) ==
47
+ /\ phase[t] = "in" /\ opener \notin {t, "none"}
48
+ /\ ~(t = "hub" /\ conflict)
49
+ /\ refused' = TRUE
50
+ /\ UNCHANGED <<phase, hv, author, board, seen, patches, opener, patchedBy, resolvedBy, conflict>>
51
+
52
+ ResolveConflict ==
53
+ /\ phase["hub"] = "in" /\ conflict /\ opener = "writer"
54
+ /\ BoardWrite("hub")
55
+ /\ resolvedBy' = resolvedBy \cup {"hub"}
56
+ /\ conflict' = FALSE
57
+ /\ UNCHANGED <<phase, hv, author, opener, patchedBy>>
58
+
59
+ StalePatch(t) ==
60
+ /\ phase[t] = "in" /\ seen[t] # board
61
+ /\ seen' = [seen EXCEPT ![t] = board]
62
+ /\ refused' = TRUE
63
+ /\ UNCHANGED <<phase, hv, author, board, patches, opener, patchedBy, resolvedBy, conflict>>
64
+
65
+ WrapOwn(t, disagree) ==
66
+ /\ phase[t] = "in" /\ hv[t] < MaxV
67
+ /\ hv' = [hv EXCEPT ![t] = hv[t] + 1]
68
+ /\ author' = [author EXCEPT ![t] = t]
69
+ /\ phase' = [phase EXCEPT ![t] = "out"]
70
+ /\ conflict' = (conflict \/ (disagree /\ opener \notin {t, "none"}))
71
+ /\ refused' = FALSE
72
+ /\ UNCHANGED <<board, seen, patches, opener, patchedBy, resolvedBy>>
73
+
74
+ ForeignWrite(t, u) ==
75
+ /\ phase[t] = "in" /\ u # t
76
+ /\ refused' = TRUE
77
+ /\ UNCHANGED <<phase, hv, author, board, seen, patches, opener, patchedBy, resolvedBy, conflict>>
78
+
79
+ Done == /\ \A w \in Writers : hv[w] = MaxV
80
+ /\ UNCHANGED vars
81
+
82
+ Next ==
83
+ \/ \E t \in Writers : Start(t)
84
+ \/ \E t \in Writers : OpenRow(t) \/ PatchOwnRow(t) \/ StalePatch(t)
85
+ \/ \E t \in Writers : ForeignRowPatch(t)
86
+ \/ ResolveConflict
87
+ \/ \E t \in Writers, d \in BOOLEAN : WrapOwn(t, d)
88
+ \/ \E t \in Writers, u \in Writers : ForeignWrite(t, u)
89
+ \/ Done
90
+
91
+ Spec == Init /\ [][Next]_vars
92
+
93
+ TypeOK ==
94
+ /\ phase \in [Writers -> {"out", "in"}]
95
+ /\ hv \in [Writers -> 0..MaxV]
96
+ /\ board \in 0..MaxB
97
+ /\ opener \in Writers \cup {"none"}
98
+
99
+ OwnHandoffOnly == \A w \in Writers : author[w] \in {w, "none"}
100
+ RowPatchedOnlyByOpener == patchedBy \subseteq {opener} /\ resolvedBy \subseteq {"hub"}
101
+ NoLostBoardUpdate == board = patches
102
+ ReadOnlyWritesNothing == TRUE
103
+
104
+ ====
@@ -0,0 +1,8 @@
1
+ SPECIFICATION Spec
2
+ INVARIANT TypeOK
3
+ INVARIANT OwnHandoffOnly
4
+ INVARIANT ReadOnlyWritesNothing
5
+ INVARIANT OpenWorkOnlyInProgress
6
+ INVARIANT StaleMarkOnlyWhileOpen
7
+ INVARIANT StampReproducible
8
+ INVARIANT IdsCarryPerson
@@ -0,0 +1,100 @@
1
+ ---- MODULE PerTagTime ----
2
+ \* Time half of the reference model. No board. One writer and the reader.
3
+ \* Open work is in progress, then stale-open. A stamp of versions alone misses aging.
4
+ EXTENDS Naturals
5
+ Writers == {"hub"}
6
+ Readers == {"guest"}
7
+ Tags == Writers \cup Readers
8
+ MaxV == 1
9
+
10
+ DocId(w) == w
11
+ Cred(t) == t
12
+
13
+ VARIABLES phase, hv, author, refused, hage, openAge, epiOpen, ptr, stampV, stampA, viewClass
14
+ vars == <<phase, hv, author, refused, hage, openAge, epiOpen, ptr, stampV, stampA, viewClass>>
15
+
16
+ LineClass(a) == IF a = 1 THEN "aging" ELSE "current"
17
+ ViewOf(v, a) == IF v = 0 THEN "none" ELSE LineClass(a)
18
+
19
+ Init ==
20
+ /\ phase = [t \in Tags |-> "out"]
21
+ /\ hv = 0 /\ author = "none"
22
+ /\ refused = FALSE
23
+ /\ hage = 0
24
+ /\ openAge = [t \in Tags |-> 0]
25
+ /\ epiOpen = [t \in Tags |-> FALSE]
26
+ /\ ptr = 0
27
+ /\ stampV = [t \in Tags |-> 0]
28
+ /\ stampA = [t \in Tags |-> 0]
29
+ /\ viewClass = [t \in Tags |-> "none"]
30
+
31
+ Start(t) ==
32
+ /\ phase[t] = "out"
33
+ /\ phase' = [phase EXCEPT ![t] = "in"]
34
+ /\ openAge' = [openAge EXCEPT ![t] = 0]
35
+ /\ stampV' = [stampV EXCEPT ![t] = hv]
36
+ /\ stampA' = [stampA EXCEPT ![t] = hage]
37
+ /\ viewClass' = [viewClass EXCEPT ![t] = ViewOf(hv, hage)]
38
+ /\ refused' = FALSE
39
+ /\ UNCHANGED <<hv, author, hage, epiOpen, ptr>>
40
+
41
+ SaveMaterial ==
42
+ /\ phase["hub"] = "in" /\ ~epiOpen["hub"]
43
+ /\ epiOpen' = [epiOpen EXCEPT !["hub"] = TRUE]
44
+ /\ refused' = FALSE
45
+ /\ UNCHANGED <<phase, hv, author, hage, openAge, ptr, stampV, stampA, viewClass>>
46
+
47
+ Tick ==
48
+ /\ \/ \E t \in Tags : phase[t] = "in" /\ openAge[t] = 0
49
+ \/ hv > 0 /\ hage = 0
50
+ /\ openAge' = [t \in Tags |-> IF phase[t] = "in" THEN 1 ELSE openAge[t]]
51
+ /\ hage' = IF hv > 0 THEN 1 ELSE hage
52
+ /\ refused' = FALSE
53
+ /\ UNCHANGED <<phase, hv, author, epiOpen, ptr, stampV, stampA, viewClass>>
54
+
55
+ WrapOwn ==
56
+ /\ phase["hub"] = "in" /\ hv < MaxV
57
+ /\ Cred("hub") = DocId("hub")
58
+ /\ hv' = hv + 1
59
+ /\ author' = "hub"
60
+ /\ hage' = 0
61
+ /\ phase' = [phase EXCEPT !["hub"] = "out"]
62
+ /\ ptr' = IF epiOpen["hub"] THEN ptr + 1 ELSE ptr
63
+ /\ epiOpen' = [epiOpen EXCEPT !["hub"] = FALSE]
64
+ /\ openAge' = [openAge EXCEPT !["hub"] = 0]
65
+ /\ refused' = FALSE
66
+ /\ UNCHANGED <<stampV, stampA, viewClass>>
67
+
68
+ LeaveReadOnly ==
69
+ /\ phase["guest"] = "in"
70
+ /\ phase' = [phase EXCEPT !["guest"] = "out"]
71
+ /\ openAge' = [openAge EXCEPT !["guest"] = 0]
72
+ /\ refused' = FALSE
73
+ /\ UNCHANGED <<hv, author, hage, epiOpen, ptr, stampV, stampA, viewClass>>
74
+
75
+ Done == hv = MaxV /\ UNCHANGED vars
76
+
77
+ Next ==
78
+ \/ \E t \in Tags : Start(t)
79
+ \/ SaveMaterial
80
+ \/ Tick
81
+ \/ WrapOwn
82
+ \/ LeaveReadOnly
83
+ \/ Done
84
+
85
+ Spec == Init /\ [][Next]_vars
86
+
87
+ TypeOK ==
88
+ /\ phase \in [Tags -> {"out", "in"}]
89
+ /\ hv \in 0..MaxV
90
+ /\ hage \in 0..1
91
+ /\ openAge \in [Tags -> 0..1]
92
+
93
+ OwnHandoffOnly == author \in {"hub", "none"}
94
+ ReadOnlyWritesNothing == author # "guest"
95
+ OpenWorkOnlyInProgress == epiOpen["hub"] => phase["hub"] = "in"
96
+ StaleMarkOnlyWhileOpen == \A t \in Tags : openAge[t] = 1 => phase[t] = "in"
97
+ StampReproducible == \A t \in Tags : phase[t] = "in" => viewClass[t] = ViewOf(stampV[t], stampA[t])
98
+ IdsCarryPerson == TRUE
99
+
100
+ ====
@@ -0,0 +1,47 @@
1
+ ---
2
+ title: "Who may patch a board row"
3
+ ---
4
+ stateDiagram-v2
5
+ state "Legend" as legend {
6
+ lg0: refused
7
+ lg1: session
8
+ lg2: rest
9
+ }
10
+ class lg0 pink
11
+ class lg1 blue
12
+ class lg2 teal
13
+ s0: No handoffs yet
14
+ s1: In session, merged view read
15
+ s2: Write refused, nothing written
16
+ s3: Handoffs at rest
17
+ s4: In session, board moved since read
18
+ s5: In session, row conflict waiting for the hub
19
+ s6: At rest, row conflict waiting for the hub
20
+ [*] --> s0
21
+ s0 --> s1: an AI starts and reads the view
22
+ s1 --> s2: an AI tries to write another AI's handoff or an AI tries to patch a row it did not open
23
+ s1 --> s3: a write AI writes its own handoff last
24
+ s1 --> s4: a write AI opens a board row
25
+ s2 --> s1: an AI starts and reads the view or a write AI opens a board row or a write AI writes its own handoff last
26
+ s2 --> s3: a write AI writes its own handoff last
27
+ s3 --> s1: an AI starts and reads the view
28
+ s2 --> s4: a write AI opens a board row or a write AI writes its own handoff last or an AI starts and reads the view
29
+ s4 --> s2: an AI tries to patch a row it did not open or an AI tries to write another AI's handoff or a write on a moved board is refused
30
+ s4 --> s1: a write AI writes its own handoff last
31
+ s4 --> s5: a write AI writes its own handoff last
32
+ s1 --> s5: a write AI writes its own handoff last
33
+ s2 --> s5: a write AI writes its own handoff last or an AI starts and reads the view
34
+ s4 --> s3: a write AI writes its own handoff last
35
+ s4 --> s6: a write AI writes its own handoff last
36
+ s1 --> s6: a write AI writes its own handoff last
37
+ s5 --> s2: an AI tries to write another AI's handoff or an AI tries to patch a row it did not open
38
+ s5 --> s6: a write AI writes its own handoff last
39
+ s2 --> s6: a write AI writes its own handoff last
40
+ s6 --> s5: an AI starts and reads the view
41
+ class s0 teal
42
+ class s1 blue
43
+ class s2 pink
44
+ class s3 teal
45
+ class s4 blue
46
+ class s5 blue
47
+ class s6 teal
@@ -0,0 +1,8 @@
1
+ # PerTagConflict
2
+
3
+ TLC reached 138 states and 497 steps. The chart draws 7 states and 20 arrows.
4
+ The chart does not draw 165 steps that stay in one chart state.
5
+ The view hides 55 steps, so the chart does not draw them.
6
+
7
+ ## Rules that hold
8
+ TypeOK, OwnHandoffOnly, RowPatchedOnlyByOpener, NoLostBoardUpdate, ReadOnlyWritesNothing, NoDeadlock
@@ -0,0 +1,19 @@
1
+ TLC2 Version 2.19 of 08 August 2024
2
+ Warning: Please run the Java VM which executes TLC with a throughput optimized garbage collector by passing the "-XX:+UseParallelGC" property.
3
+ (Use the -nowarning option to disable this warning.)
4
+ Running breadth-first search Model-Checking with fp 0 and seed -8850353877689253474 with 1 worker on 4 cores with 3746MB heap and 64MB offheap memory [pid: 10886] (Linux 6.12.113+ amd64, Ubuntu 21.0.12.1 x86_64, MSBDiskFPSet, DiskStateQueue).
5
+ Parsing file PerTagConflict.tla
6
+ Parsing file Naturals.tla
7
+ Semantic processing of module Naturals
8
+ Semantic processing of module PerTagConflict
9
+ Starting... (2026-11-10 15:54:33)
10
+ Computing initial states...
11
+ Finished computing initial states: 1 distinct state generated at 2026-11-10 15:54:33.
12
+ Model checking completed. No error has been found.
13
+ Estimates of the probability that TLC did not check all reachable states
14
+ because two distinct states had the same fingerprint:
15
+ calculated (optimistic): val = 3.5E-15
16
+ 602 states generated, 138 distinct states found, 0 states left on queue.
17
+ The depth of the complete state graph search is 9.
18
+ The average outdegree of the complete state graph is 1 (minimum is 0, the maximum 5 and the 95th percentile is 4).
19
+ Finished in 00s at (2026-11-10 15:54:33)
@@ -0,0 +1,34 @@
1
+ /** Reader labels for the conflict half. No clock. */
2
+
3
+ export const title = "Who may patch a board row";
4
+
5
+ export const state = (v) => {
6
+ if (v.refused) return "Write refused, nothing written";
7
+ const inside = Object.entries(v.phase).filter(([, p]) => p === "in").map(([t]) => t);
8
+ if (inside.length === 0) {
9
+ if (v.hv.hub + v.hv.writer === 0) return "No handoffs yet";
10
+ return v.conflict ? "At rest, row conflict waiting for the hub" : "Handoffs at rest";
11
+ }
12
+ if (v.conflict) return "In session, row conflict waiting for the hub";
13
+ if (inside.some((t) => v.seen[t] !== v.board)) return "In session, board moved since read";
14
+ return "In session, merged view read";
15
+ };
16
+
17
+ export const step = (action) => {
18
+ const labels = {
19
+ Start: "an AI starts and reads the view",
20
+ OpenRow: "a write AI opens a board row",
21
+ PatchOwnRow: "the opener patches its row",
22
+ ForeignRowPatch: "an AI tries to patch a row it did not open",
23
+ ResolveConflict: "the hub resolves a marked conflict",
24
+ StalePatch: "a write on a moved board is refused",
25
+ WrapOwn: "a write AI writes its own handoff last",
26
+ ForeignWrite: "an AI tries to write another AI's handoff",
27
+ Done: null
28
+ };
29
+ return Object.prototype.hasOwnProperty.call(labels, action) ? labels[action] : null;
30
+ };
31
+
32
+ export const group = (v) => (v.refused ? "refused" : Object.values(v.phase).some((p) => p === "in") ? "session" : "rest");
33
+
34
+ export const colors = { refused: "pink", session: "blue", rest: "teal" };
@@ -0,0 +1,44 @@
1
+ ---
2
+ title: "Open work, stale-open, and aging"
3
+ ---
4
+ stateDiagram-v2
5
+ state "Legend" as legend {
6
+ lg0: session
7
+ lg1: rest
8
+ }
9
+ class lg0 blue
10
+ class lg1 teal
11
+ s0: No handoff yet
12
+ s1: In session, merged view read
13
+ s2: In session, work shown in progress
14
+ s3: Handoff at rest
15
+ s4: In session, open work marked stale
16
+ s5: Handoff at rest, line aging
17
+ s6: In session, reading an aging line
18
+ [*] --> s0
19
+ s0 --> s1: an AI starts, reads the view, and stamps it
20
+ s1 --> s2: a write AI saves work in an open session
21
+ s1 --> s3: a write AI writes its own handoff last or a read-only AI leaves, writing nothing
22
+ s1 --> s0: a read-only AI leaves, writing nothing
23
+ s1 --> s4: a write AI saves work in an open session
24
+ s2 --> s4: time passes (24 hours open, 7 days aging)
25
+ s2 --> s3: a write AI writes its own handoff last
26
+ s3 --> s1: an AI starts, reads the view, and stamps it
27
+ s3 --> s5: time passes (24 hours open, 7 days aging)
28
+ s2 --> s1: a write AI writes its own handoff last
29
+ s4 --> s3: a write AI writes its own handoff last
30
+ s5 --> s6: an AI starts, reads the view, and stamps it
31
+ s4 --> s1: a write AI writes its own handoff last
32
+ s6 --> s2: a write AI saves work in an open session
33
+ s1 --> s6: an AI starts, reads the view, and stamps it
34
+ s6 --> s5: a read-only AI leaves, writing nothing
35
+ s1 --> s5: a read-only AI leaves, writing nothing
36
+ s6 --> s4: a write AI saves work in an open session
37
+ s6 --> s1: a read-only AI leaves, writing nothing
38
+ class s0 teal
39
+ class s1 blue
40
+ class s2 blue
41
+ class s3 teal
42
+ class s4 blue
43
+ class s5 teal
44
+ class s6 blue
@@ -0,0 +1,8 @@
1
+ # PerTagTime
2
+
3
+ TLC reached 143 states and 445 steps. The chart draws 7 states and 19 arrows.
4
+ The chart does not draw 168 steps that stay in one chart state.
5
+ The view hides 128 steps, so the chart does not draw them.
6
+
7
+ ## Rules that hold
8
+ TypeOK, OwnHandoffOnly, ReadOnlyWritesNothing, OpenWorkOnlyInProgress, StaleMarkOnlyWhileOpen, StampReproducible, IdsCarryPerson, NoDeadlock
@@ -0,0 +1,19 @@
1
+ TLC2 Version 2.19 of 08 August 2024
2
+ Warning: Please run the Java VM which executes TLC with a throughput optimized garbage collector by passing the "-XX:+UseParallelGC" property.
3
+ (Use the -nowarning option to disable this warning.)
4
+ Running breadth-first search Model-Checking with fp 0 and seed 1376641984984430444 with 1 worker on 4 cores with 3746MB heap and 64MB offheap memory [pid: 11241] (Linux 6.12.113+ amd64, Ubuntu 21.0.12.1 x86_64, MSBDiskFPSet, DiskStateQueue).
5
+ Parsing file PerTagTime.tla
6
+ Parsing file Naturals.tla
7
+ Semantic processing of module Naturals
8
+ Semantic processing of module PerTagTime
9
+ Starting... (2026-11-10 15:55:06)
10
+ Computing initial states...
11
+ Finished computing initial states: 1 distinct state generated at 2026-11-10 15:55:06.
12
+ Model checking completed. No error has been found.
13
+ Estimates of the probability that TLC did not check all reachable states
14
+ because two distinct states had the same fingerprint:
15
+ calculated (optimistic): val = 2.6E-15
16
+ 484 states generated, 143 distinct states found, 0 states left on queue.
17
+ The depth of the complete state graph search is 10.
18
+ The average outdegree of the complete state graph is 1 (minimum is 0, the maximum 4 and the 95th percentile is 3).
19
+ Finished in 00s at (2026-11-10 15:55:06)
@@ -0,0 +1,33 @@
1
+ /** Reader labels for the time half. No board. */
2
+
3
+ export const title = "Open work, stale-open, and aging";
4
+
5
+ export const state = (v) => {
6
+ if (v.refused) return "Write refused, nothing written";
7
+ const inside = Object.entries(v.phase).filter(([, p]) => p === "in").map(([t]) => t);
8
+ if (inside.length === 0) {
9
+ if (v.hv === 0) return "No handoff yet";
10
+ return v.hage === 1 ? "Handoff at rest, line aging" : "Handoff at rest";
11
+ }
12
+ if (inside.some((t) => v.epiOpen[t] && v.openAge[t] === 1)) return "In session, open work marked stale";
13
+ if (inside.some((t) => v.epiOpen[t])) return "In session, work shown in progress";
14
+ if (inside.some((t) => v.viewClass[t] === "aging")) return "In session, reading an aging line";
15
+ return "In session, merged view read";
16
+ };
17
+
18
+ export const step = (action) => {
19
+ const labels = {
20
+ Start: "an AI starts, reads the view, and stamps it",
21
+ SaveMaterial: "a write AI saves work in an open session",
22
+ Tick: "time passes (24 hours open, 7 days aging)",
23
+ WrapOwn: "a write AI writes its own handoff last",
24
+ ForeignWrite: null,
25
+ LeaveReadOnly: "a read-only AI leaves, writing nothing",
26
+ Done: null
27
+ };
28
+ return Object.prototype.hasOwnProperty.call(labels, action) ? labels[action] : null;
29
+ };
30
+
31
+ export const group = (v) => (v.refused ? "refused" : Object.values(v.phase).some((p) => p === "in") ? "session" : "rest");
32
+
33
+ export const colors = { refused: "pink", session: "blue", rest: "teal" };
@@ -0,0 +1,19 @@
1
+ TLC2 Version 2.19 of 08 August 2024
2
+ Running breadth-first search Model-Checking with fp 14 and seed -1840179314328056683 with 1 worker on 4 cores with 3330MB heap and 64MB offheap memory [pid: 10730] (Linux 6.12.113+ amd64, Ubuntu 21.0.12.1 x86_64, MSBDiskFPSet, DiskStateQueue).
3
+ Parsing file PerTagHandoff.tla
4
+ Parsing file Naturals.tla
5
+ Semantic processing of module Naturals
6
+ Semantic processing of module PerTagHandoff
7
+ Starting... (2026-11-10 15:53:12)
8
+ Computing initial states...
9
+ Finished computing initial states: 1 distinct state generated at 2026-11-10 15:53:12.
10
+ Progress(11) at 2026-11-10 15:53:15: 621,832 states generated (621,832 s/min), 136,405 distinct states found (136,405 ds/min), 75,166 states left on queue.
11
+ Model checking completed. No error has been found.
12
+ Estimates of the probability that TLC did not check all reachable states
13
+ because two distinct states had the same fingerprint:
14
+ calculated (optimistic): val = 3.9E-7
15
+ based on the actual fingerprints: val = 1.2E-8
16
+ 8532898 states generated, 958557 distinct states found, 0 states left on queue.
17
+ The depth of the complete state graph search is 20.
18
+ The average outdegree of the complete state graph is 1 (minimum is 0, the maximum 10 and the 95th percentile is 4).
19
+ Finished in 31s at (2026-11-10 15:53:43)
@@ -0,0 +1,5 @@
1
+ SPECIFICATION Spec
2
+ INVARIANT TypeOK
3
+ INVARIANT OwnHandoffOnly
4
+ INVARIANT NoLostBoardUpdate
5
+ INVARIANT ReadOnlyWritesNothing