@dreamforgestudiollc/emet 0.3.6 → 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 (88) hide show
  1. package/.env.example +29 -0
  2. package/CHANGELOG.md +25 -1
  3. package/README.md +9 -3
  4. package/RELEASE_NOTES-0.2.6.md +1 -1
  5. package/RELEASE_NOTES-0.3.7.md +19 -0
  6. package/docs/BOTS.md +1 -1
  7. package/docs/DEPLOY.md +14 -1
  8. package/docs/ERROR-CODES-SPEC.md +4 -0
  9. package/docs/ERROR-CODES.md +7 -0
  10. package/docs/ROADMAP.md +3 -3
  11. package/docs/SETUP.md +4 -0
  12. package/docs/SUBKEYS.md +3 -1
  13. package/docs/continuity-currency-statechart.md +34 -0
  14. package/docs/features/README.md +21 -0
  15. package/docs/features/access.md +28 -0
  16. package/docs/features/documents.md +35 -0
  17. package/docs/features/errors.md +32 -0
  18. package/docs/features/gems.md +31 -0
  19. package/docs/features/memory.md +29 -0
  20. package/docs/features/pages.md +28 -0
  21. package/docs/features/record.md +27 -0
  22. package/docs/features/search.md +27 -0
  23. package/docs/features/startup.md +29 -0
  24. package/docs/features/subkeys.md +30 -0
  25. package/docs/features/transcripts.md +33 -0
  26. package/docs/per-tag-handoff-statechart.md +147 -0
  27. package/docs/subkey-session-statechart.md +57 -0
  28. package/package.json +3 -2
  29. package/server.json +27 -2
  30. package/src/annotations.js +4 -3
  31. package/src/attribution.js +1 -1
  32. package/src/chooser.js +74 -3
  33. package/src/conformance.js +2 -0
  34. package/src/continuity-currency-statechart.js +139 -0
  35. package/src/continuity-currency.js +869 -0
  36. package/src/dispatch.js +1 -1
  37. package/src/error-codes.js +7 -0
  38. package/src/http-remote.js +27 -4
  39. package/src/index.js +1 -0
  40. package/src/pages.js +15 -0
  41. package/src/per-tag-handoff-statechart.js +264 -0
  42. package/src/per-tag-handoff.js +988 -0
  43. package/src/persons.js +16 -0
  44. package/src/session-graph.js +118 -7
  45. package/src/session.js +54 -10
  46. package/src/setup.js +22 -1
  47. package/src/startup-pages.js +13 -2
  48. package/src/subkey-lifecycle.js +105 -0
  49. package/src/subkey-session-statechart.js +253 -0
  50. package/src/subkeys.js +648 -89
  51. package/src/tools.js +157 -32
  52. package/src/version.js +1 -1
  53. package/templates/INDEX.md +1 -0
  54. package/templates/TAGHANDOFF.md +45 -0
  55. package/verification/continuity-currency/ContinuityCurrency.cfg +12 -0
  56. package/verification/continuity-currency/ContinuityCurrency.tla +239 -0
  57. package/verification/continuity-currency/tlc-output.txt +32 -0
  58. package/verification/continuity-currency/view.mjs +54 -0
  59. package/verification/per-tag-handoff/PerTagHandoff.cfg +10 -0
  60. package/verification/per-tag-handoff/PerTagHandoff.tla +191 -0
  61. package/verification/per-tag-handoff/StampCounter.cfg +10 -0
  62. package/verification/per-tag-handoff/out/report.md +6 -0
  63. package/verification/per-tag-handoff/out-counter/chart.mmd +30 -0
  64. package/verification/per-tag-handoff/out-counter/report.md +15 -0
  65. package/verification/per-tag-handoff/out-counter/tlc.out +130 -0
  66. package/verification/per-tag-handoff/split/PerTagConflict.cfg +6 -0
  67. package/verification/per-tag-handoff/split/PerTagConflict.tla +104 -0
  68. package/verification/per-tag-handoff/split/PerTagTime.cfg +8 -0
  69. package/verification/per-tag-handoff/split/PerTagTime.tla +100 -0
  70. package/verification/per-tag-handoff/split/conflict-chart.mmd +47 -0
  71. package/verification/per-tag-handoff/split/conflict-report.md +8 -0
  72. package/verification/per-tag-handoff/split/conflict-tlc.txt +19 -0
  73. package/verification/per-tag-handoff/split/conflict-view.mjs +34 -0
  74. package/verification/per-tag-handoff/split/time-chart.mmd +44 -0
  75. package/verification/per-tag-handoff/split/time-report.md +8 -0
  76. package/verification/per-tag-handoff/split/time-tlc.txt +19 -0
  77. package/verification/per-tag-handoff/split/time-view.mjs +33 -0
  78. package/verification/per-tag-handoff/tlc-output.txt +19 -0
  79. package/verification/per-tag-handoff/v1-draft/PerTagHandoff.cfg +5 -0
  80. package/verification/per-tag-handoff/v1-draft/PerTagHandoff.tla +94 -0
  81. package/verification/per-tag-handoff/v1-draft/out/chart.mmd +37 -0
  82. package/verification/per-tag-handoff/v1-draft/out/report.md +7 -0
  83. package/verification/per-tag-handoff/v1-draft/out/tlc.out +19 -0
  84. package/verification/per-tag-handoff/v1-draft/view.mjs +20 -0
  85. package/verification/per-tag-handoff/view.mjs +31 -0
  86. package/verification/subkey-session/SubkeySession.cfg +11 -0
  87. package/verification/subkey-session/SubkeySession.tla +254 -0
  88. package/verification/subkey-session/tlc-output.txt +13 -0
package/.env.example CHANGED
@@ -81,6 +81,14 @@ EMET_SOURCE_TAGS=laptop,phone,cli
81
81
  # How long a failed presentation counts, in milliseconds. Default 15 minutes.
82
82
  # Values below 1000 are ignored.
83
83
  # EMET_SUBKEY_FAIL_WINDOW_MS=900000
84
+ # A session handle lasts 12 hours. The last EMET_SUBKEY_RENEWAL_MINUTES
85
+ # (default 60) ask the caller to open again with the sub-key and the handle.
86
+ # After expiry, EMET_SUBKEY_HANDLE_GRACE_MINUTES (default 60) is the window
87
+ # in which that pair still renews. Past it, a periodic sweep closes the
88
+ # session. The row stays. EMET_SUBKEY_SWEEP_MINUTES (default 15) is the period.
89
+ # EMET_SUBKEY_RENEWAL_MINUTES=60
90
+ # EMET_SUBKEY_HANDLE_GRACE_MINUTES=60
91
+ # EMET_SUBKEY_SWEEP_MINUTES=15
84
92
 
85
93
  # The monorail, the server-side check on the order of a session's writes
86
94
  # (docs/GUARDRAILS-AND-MONORAILS.md), runs in enforce only and has no setting:
@@ -147,6 +155,27 @@ EMET_SOURCE_TAGS=laptop,phone,cli
147
155
  # The session handoff and the board.
148
156
  # EMET_HANDOFF_DOC=HANDOFF.md
149
157
  # EMET_STATE_DOC=STATE.md
158
+ # Continuity-currency gate. Off unless the value is 1. The owner sets the value.
159
+ # When 1, emet_initialize and emet_session_open compare the served HANDOFF to
160
+ # the material episodic tip and add continuity_currency. A lag warns and does
161
+ # not block. The server does not rewrite HANDOFF or STATE.
162
+ # EMET_CONTINUITY_CURRENCY_BLOCK is reserved and is not applied.
163
+ # EMET_CONTINUITY_CURRENCY=
164
+ # Per-tag handoffs. Off unless the value is warn or enforce. Off is the default.
165
+ # warn refuses the new HANDOFF/ prefix at once. The board-row warning and the
166
+ # gap on HANDOFF.md and another tag's bots/ folder are kept. enforce refuses
167
+ # those too. Turning the flag on with EMET_HUB_TAG unset refuses every write (EMET-CFG-015).
168
+ # A bot on the shared owner login needs its own sub-key before
169
+ # the flag leaves off. With the flag at warn or enforce, a declared session tag
170
+ # that is not the credential is refused (EMET-DOC-088). A call that declares no
171
+ # tag is kept. With the flag off that check does not run.
172
+ # EMET_HUB_TAG is the only tag that writes HANDOFF.md. Set it before the flag
173
+ # leaves off. EMET_HANDOFF_AGING_DAYS defaults to 7. EMET_STALE_OPEN_HOURS
174
+ # defaults to 24. The continuity-currency gate stays warn-only.
175
+ # EMET_TAG_HANDOFFS=off
176
+ # EMET_HUB_TAG=
177
+ # EMET_HANDOFF_AGING_DAYS=7
178
+ # EMET_STALE_OPEN_HOURS=24
150
179
  # The user's host-and-machine notes.
151
180
  # EMET_INSTALL_DOC=bootstrap/INSTALL.md
152
181
  # The character document (character and voice). When unset, the usual
package/CHANGELOG.md CHANGED
@@ -7,7 +7,31 @@ change before 1.0.
7
7
 
8
8
  ## Unreleased
9
9
 
10
- Nothing is waiting above 0.3.6.
10
+ Nothing is waiting above 0.3.7.
11
+
12
+ ## 0.3.7 - 2026-11-21
13
+
14
+ Per-tag handoffs and sub-key session renewal. Stored data shapes are unchanged. Stored rows are not rewritten. The declared version is 0.3.7. This revision is not published from this change. ISO 9001 7.5.3 / ISO 13485 4.2.5 document-control wording is unchanged.
15
+
16
+ ### Added
17
+ - Per-tag handoffs ship off by default. `EMET_TAG_HANDOFFS` stays off unless the owner sets `warn` or `enforce`. Each write tag's handoff is `HANDOFF/<tag>.md`. The hub tag keeps `HANDOFF.md`. The shared view is computed on read and is not a record. `EMET-DOC-088` runs only while `EMET_TAG_HANDOFFS` is `warn` or `enforce`. A call that declares no tag is kept. A bot on the shared owner login needs its own sub-key before the flag leaves off.
18
+ - When per-tag handoffs are on, material episodic rows written before `2026-09-27T00:00:00.000Z` with no registered source are listed as legacy (`legacy_pre_attribution`, cutoff basis `after_last_unsourced_episodic`). Those rows do not make the overall check warn. A row at or after the cutoff with no registered source still warns.
19
+ - Continuity currency (`EMET_CONTINUITY_CURRENCY`) compares the served handoff with the live material episodic tip on `emet_initialize` and `emet_session_open`. It defaults off. Set it to `1` to turn it on. A lag warns and does not block. The server does not rewrite HANDOFF or STATE. `EMET_CONTINUITY_CURRENCY_BLOCK` is reserved and is not applied.
20
+ - Sub-key sessions renew in the handle's last hour (`EMET_SUBKEY_RENEWAL_MINUTES`, default 60) and for up to one hour after expiry (`EMET_SUBKEY_HANDLE_GRACE_MINUTES`, default 60). An open that presents the key and the current handle closes the old session into the new one. The old row stays. The default handle length stays 12 hours.
21
+ - A server sweep (`EMET_SUBKEY_SWEEP_MINUTES`, default 15) marks a stranded session `auto_closed` after the grace window. Nothing is deleted. The row and the transcript stay.
22
+ - `emet_subkey_set_kind` sets `client_kind` to `bot` or `chat` on an approved key. A key with no kind stored is a bot. A chat key whose previous turn left no wrap-up is reported unwrapped on the next open.
23
+ - The npm package includes `docs/features/`.
24
+ - [RELEASE_NOTES-0.3.7.md](RELEASE_NOTES-0.3.7.md).
25
+
26
+ ### Changed
27
+ - `emet_status` does not write. A status read of a stranded session is not refused and does not record `handle_expired`.
28
+ - Listings gain `emet_subkey_set_kind`. With `EMET_SUBKEYS=1` the server registers 43 tools. With sub-keys off the list stays 38.
29
+
30
+ ### Fixed
31
+ - `docs/features/` is part of the published package. A relative link from the README to that directory is in the tarball.
32
+
33
+ ### Upgrade
34
+ - No stored-data migration. No new required setting. Deploy over 0.3.6 as is. Optional settings keep their defaults. Listings gain `emet_subkey_set_kind`. ISO 9001 7.5.3 / ISO 13485 4.2.5 document-control wording is unchanged.
11
35
 
12
36
  ## 0.3.6 - 2026-11-11
13
37
 
package/README.md CHANGED
@@ -26,7 +26,7 @@ See also: [CHANGELOG](CHANGELOG.md) · [CONTRIBUTING](CONTRIBUTING.md) · [SECUR
26
26
  - **Per-client attribution and approvals.** Every write is attributed to the client that made it. A new client is read-limited until it is approved. The approval is recorded.
27
27
  - **Error codes and problem reports.** Every error carries a stable `EMET-<AREA>-<NNN>` code. An operational error log keeps 10,000 entries or 90 days, plus daily summaries. The owner-only `emet_error_report` returns the report and an email draft that you send yourself. See [Reporting a problem](#reporting-a-problem).
28
28
  - **verify-emet and the feature map.** `npm run verify` runs `scripts/verify-emet.mjs` from a checkout. It starts EMET in a temporary directory on the in-memory test database, with no `.env`, and drives every registered tool. A tool that needs a service a plain install does not have is reported as a gap. A run whose only problems are gaps exits 3. A failed tool exits 1. The map is [docs/features/README.md](docs/features/README.md).
29
- - **MIT.** Version 0.3.6. EMET is still 0.x: stored document shapes may change before 1.0. Pin a version if you depend on them.
29
+ - **MIT.** Version 0.3.7. EMET is still 0.x: stored document shapes may change before 1.0. Pin a version if you depend on them.
30
30
  - **Roadmap.** What is proposed, planned, or a later phase is [docs/ROADMAP.md](docs/ROADMAP.md). An item there is not built unless it says so. Upcoming work is labeled Proposed, Planned, or Later phase. Discussion is in [GitHub issues](https://github.com/dreamforgestudiollc/EMET/issues).
31
31
 
32
32
  The store has one owner, and other people can join only through the optional Guest
@@ -108,7 +108,7 @@ Member (read and write) access, both off by default.
108
108
 
109
109
  ## Two ways in
110
110
 
111
- A session that has not initialized can read everything and can write only a new drop (`drops/<date>-<slug>.md`): its items, wrap-up and handoff. A session with a registered source and the full startup has full access. Every initialized session sees unhandled drops first. A board edit is refused only for a drop that was listed at that session's boot. New drops are capped at 20 per New York day, in one bucket: the whole local process on stdio, one shared visitor bucket for HTTP with no signed-in client, the source tag bound at approval when there is one, or that OAuth client otherwise. A source the caller types does not move the bucket. Drops are never deleted.
111
+ A session that has not initialized can read everything and can write only a new drop (`drops/<date>-<slug>.md`): its items, wrap-up and handoff. A session with a registered source and the full startup has full access. With `EMET_TAG_HANDOFFS` off, the default, one hub handoff is what initialize serves. With it `warn` or `enforce`, initialize serves `handoff_view` for every tag. A write tag also receives its own handoff. A read-only tag receives the view only. The write is checked against the credential, not a declared tag. With `EMET_TAG_HANDOFFS` off, an HTTP save may still name `metadata.source`. With the flag at `warn` or `enforce`, the session tag on HTTP is the credential. A declared tag that differs, and a claimed tag naming a session, are refused (`EMET-DOC-088`). A call that declares no tag is kept. A bot on the shared owner login needs its own sub-key before that flag leaves off. On stdio the declared tag stands. Every initialized session sees unhandled drops first. A board edit is refused only for a drop that was listed at that session's boot. New drops are capped at 20 per New York day, in one bucket: the whole local process on stdio, one shared visitor bucket for HTTP with no signed-in client, the source tag bound at approval when there is one, or that OAuth client otherwise. A source the caller types does not move the bucket. Drops are never deleted.
112
112
 
113
113
  ## Editing working state
114
114
 
@@ -267,6 +267,9 @@ same page. The bot presents the key once at `emet_session_open`. See
267
267
  **Pass `session_handle` on every write in a sub-key session.** `emet_session_open` returns
268
268
  `session_handle` once. Later writes in that session pass `session_handle`. A write that names
269
269
  the session and omits the handle, or sends a different one, is refused, and nothing is written.
270
+ The handle lasts 12 hours. In the last hour, and for one hour after it expires, an open that
271
+ presents the sub-key and the handle closes the old session into the new one. The server closes
272
+ a session that is past that grace on its own. A status read of a stranded session is not refused.
270
273
  The handle is not a receipt and is not written into a document. With sub-keys off, the field is
271
274
  absent. See [docs/SUBKEYS.md](docs/SUBKEYS.md) and [docs/PERMISSIONS.md](docs/PERMISSIONS.md).
272
275
 
@@ -703,7 +706,7 @@ are in [`docs/GUARDRAILS-AND-MONORAILS.md`](docs/GUARDRAILS-AND-MONORAILS.md).
703
706
 
704
707
  ## Tools
705
708
 
706
- Thirty-eight tools are registered with sub-keys off. With `EMET_SUBKEYS=1`, four more (`emet_subkey_request`, `emet_subkey_claim`, `emet_subkey_revoke`, `emet_subkey_end_session`) and the `subkey` and `session_handle` arguments. The names below are every tool the registry registers, both sets together.
709
+ Thirty-eight tools are registered with sub-keys off. With `EMET_SUBKEYS=1`, five more (`emet_subkey_request`, `emet_subkey_claim`, `emet_subkey_revoke`, `emet_subkey_end_session`, `emet_subkey_set_kind`) and the `subkey` and `session_handle` arguments. The names below are every tool the registry registers, both sets together.
707
710
 
708
711
  <!-- emet-tools -->
709
712
  ```
@@ -727,6 +730,7 @@ emet_subkey_claim
727
730
  emet_subkey_end_session
728
731
  emet_subkey_request
729
732
  emet_subkey_revoke
733
+ emet_subkey_set_kind
730
734
  emet_transcript_append
731
735
  list_docs
732
736
  patch_doc
@@ -779,6 +783,8 @@ After a complete close a session takes exactly one more append, its closing exch
779
783
  part, and is then locked; a retry of it writes nothing. Corrections with `revise_transcript` stay
780
784
  allowed but must keep exactly the same exchange numbers.
781
785
 
786
+ **Continuity currency** — `EMET_CONTINUITY_CURRENCY` is off unless it is `1`. With it on, initialize and session open add `continuity_currency`. A lag warns and does not block. The server does not rewrite HANDOFF or STATE. When `EMET_TAG_HANDOFFS` is `warn` or `enforce`, that reading also carries `handoff_view`, `own_handoff`, and `stale_open`. An open session with material work is an in-progress line. It is not a lag. `EMET_HANDOFF_AGING_DAYS` defaults to 7. `EMET_STALE_OPEN_HOURS` defaults to 24. Material episodic rows written before `2026-09-27T00:00:00.000Z` with no registered source are `legacy_pre_attribution` and do not make the overall check warn. A newer untagged row still warns. A stamp that is not the view in force says to re-read the handoff view. `EMET-CFG-015` is the per-tag flag on with `EMET_HUB_TAG` unset. Nothing is refused because a handoff is stale.
787
+
782
788
  **During the session** — `emet_transcript_append` after every reply, one exchange at a time.
783
789
  Every write tool also takes `session_id` and `exchange`, and returns `session_graph.next`, the
784
790
  next stop on the monorail ([Guardrails & Monorails](docs/GUARDRAILS-AND-MONORAILS.md)).
@@ -1,6 +1,6 @@
1
1
  # EMET 0.2.6
2
2
 
3
- Historical notes for 0.2.6. The current release in this repository is 0.3.6. See [CHANGELOG.md](CHANGELOG.md). The sentence that used to say the npm package was still 0.2.4 is withdrawn. 0.2.6, and later versions through 0.3.5, were published. 0.3.6 is not published from this revision.
3
+ Historical notes for 0.2.6. The current release in this repository is 0.3.7. See [CHANGELOG.md](CHANGELOG.md). The sentence that used to say the npm package was still 0.2.4 is withdrawn. 0.2.6, and later versions through 0.3.5, were published. 0.3.6 is not published from this revision.
4
4
 
5
5
  EMET is an MCP memory server: persistent shared memory for AI agents, bot teams, and chats. Version 0.2.6. The stored document shapes are not frozen. Pin a version if you depend on them.
6
6
 
@@ -0,0 +1,19 @@
1
+ # EMET 0.3.7
2
+
3
+ EMET is an MCP server for document control (ISO 9001 7.5.3 / ISO 13485 4.2.5): persistent shared memory for AI agents, bot teams, and chats. Version 0.3.7. EMET holds no certification and claims no conformity. The stored document shapes are not frozen. Pin a version if you depend on them. Stored rows are not rewritten. No new setting is required. This revision is not published from this file. See [CHANGELOG.md](CHANGELOG.md).
4
+
5
+ ## What changed
6
+
7
+ Per-tag handoffs ship off unless the owner sets `EMET_TAG_HANDOFFS` to `warn` or `enforce`. Each write tag keeps `HANDOFF/<tag>.md`. The hub tag keeps `HANDOFF.md`. The shared view is computed on read and is not a record. A call that declares no tag is kept. A stale handoff does not refuse a call.
8
+
9
+ When that flag is on, material episodic rows written before `2026-09-27T00:00:00.000Z` with no registered source are listed as legacy pre-attribution. They do not make the overall check warn. A newer untagged row still warns.
10
+
11
+ Continuity currency (`EMET_CONTINUITY_CURRENCY`) compares the served handoff with the live material episodic tip on `emet_initialize` and `emet_session_open`. It defaults off. Set it to `1` to turn it on. A lag warns and does not block. The server does not rewrite HANDOFF or STATE. `EMET_CONTINUITY_CURRENCY_BLOCK` is reserved and is not applied.
12
+
13
+ A sub-key handle still lasts 12 hours. In the last hour, and for one hour after expiry, an open with the key and the current handle renews the session. After that, a sweep marks a stranded session `auto_closed`. Nothing is deleted. The row and the transcript stay. A chat key with no wrap-up is reported unwrapped on the next open. `emet_subkey_set_kind` stores `bot` or `chat`. A key with no kind stored is a bot. `emet_status` does not write.
14
+
15
+ The npm package includes `docs/features/`.
16
+
17
+ ## Upgrade
18
+
19
+ No stored-data migration. No new required setting. Deploy over 0.3.6 as is. Listings gain `emet_subkey_set_kind`. ISO 9001 7.5.3 / ISO 13485 4.2.5 document-control wording is unchanged.
package/docs/BOTS.md CHANGED
@@ -27,7 +27,7 @@ If one agent talks to you on behalf of the others — relays their reports up an
27
27
 
28
28
  Do these in order. Each step names what to read back. Steps 2 and 3 are **one change**: set `EMET_SOURCE_TAGS` and `EMET_RECORD_DOCS` together, in one deployment. A tag registered as a source but not yet listed as a bot is treated as a host in between.
29
29
 
30
- **Standing rule.** Every bot on the roster writes under its own source tag, `<prefix>-<bot>` (e.g. `bot-reviewer`). When a new bot joins the roster, register its tag in `EMET_SOURCE_TAGS` at the same time, before its first write. Append it to the end of the comma-separated list and keep every existing tag in order. Also add `bots/<tag>/HANDOFF.md` to `EMET_RECORD_DOCS` so the server treats it as a bot. Setting either variable redeploys the server; afterwards, check `/health` and `emet_status`.
30
+ **Standing rule.** Every bot on the roster writes under its own source tag, `<prefix>-<bot>` (e.g. `bot-reviewer`). When a new bot joins the roster, register its tag in `EMET_SOURCE_TAGS` at the same time, before its first write. Append it to the end of the comma-separated list and keep every existing tag in order. Also add `bots/<tag>/HANDOFF.md` to `EMET_RECORD_DOCS` so the server treats it as a bot. Setting either variable redeploys the server; afterwards, check `/health` and `emet_status`. A bot that shares the owner login needs its own sub-key before `EMET_TAG_HANDOFFS` leaves off. With that flag at `warn` or `enforce`, an HTTP session tag comes from the credential. A declared tag that differs, and a claimed tag naming a session, are refused (`EMET-DOC-088`). A call that declares no tag is kept. With the flag off, that check does not run. On stdio the declared tag stands. In enforce, nobody writes inside another tag's `bots/<tag>/` folder, the hub included.
31
31
 
32
32
  When `EMET_SUBKEYS=1`, bots that share the owner's login each hold a sub-key as a local secret. First use, in plain language, is [SUBKEYS.md](SUBKEYS.md). The key is never stored in an EMET document. The bot presents it at `emet_session_open` and passes the returned session handle on later writes in that session. The server stamps the key's tag. The owner approves a pending sub-key at `/owner/chooser` on this host (the same host as `/mcp`). `/owner/approvals` was retired by R4: it answers with a pointer to the chooser, and the sub-key records stay listed there. The chooser asks for the existing owner passphrase (`EMET_OAUTH_PASSPHRASE`, the same check as the OAuth consent page). A wrong passphrase counts toward the same per-address lockout as `/oauth/approve`. A correct passphrase opens a session that lasts 15 minutes. The page lists each pending request by tag, key id prefix and requested time. Approve or Deny may include a reason; the decision is recorded as the owner. Break-glass recovery, with no AI client, is `/owner/break-glass`. Revoke stays on the owner's own login. A key expires after 30 days; the owner can reissue it. Sub-key records live in their own collection; `read_doc` cannot return them, and only the owner and the chief of staff can read the list or its history. Turning `EMET_SUBKEYS` off ends every live sub-key session once, in the background at startup, when that collection already exists. The history event is written before the status change, and the row is kept. If the collection does not exist, startup does not create it. The sweep tries once, then a few times with backoff. With the flag off, a write that presents an `emh_` handle is refused without opening the store. A write that names a sub-key session is refused the same way only when that session was live at this process's sweep. That refusal lasts until the next restart, by which time those sessions are already ended. A store that ran the first build, which kept these rows in `emet/CLIENT_APPROVALS.md`, still has them in that document's history. See `docs/proposals/EMET-0001-delegated-client-sub-keys.md`.
33
33
 
package/docs/DEPLOY.md CHANGED
@@ -13,6 +13,10 @@ scoped user, and Atlas Network Access set to `0.0.0.0/0` — a hosted platform's
13
13
  dynamic, so it cannot be allowlisted. Security rests on the scoped user plus the OAuth
14
14
  passphrase; both are required.
15
15
 
16
+ ## Upgrading to 0.3.7
17
+
18
+ 0.3.7 adds per-tag handoffs, off unless the owner sets `EMET_TAG_HANDOFFS` to `warn` or `enforce`, and sub-key session renewal. Stored rows are not rewritten. No new setting is required. A bot on the shared owner login needs its own sub-key before that flag leaves off. With the flag at `warn` or `enforce`, a declared session tag that is not the credential is refused (`EMET-DOC-088`). A call that declares no tag is kept. With the flag off that check does not run. `EMET_SUBKEY_RENEWAL_MINUTES`, `EMET_SUBKEY_HANDLE_GRACE_MINUTES`, and `EMET_SUBKEY_SWEEP_MINUTES` default to 60, 60, and 15. The handle length stays 12 hours. Listings gain `emet_subkey_set_kind`. ISO 9001 7.5.3 / ISO 13485 4.2.5 document-control wording is unchanged.
19
+
16
20
  ## Upgrading to 0.3.6
17
21
 
18
22
  0.3.6 is a docs and wording release. Stored data shapes are unchanged. No new setting. Deploy over 0.3.5 as is. The public roadmap's Upcoming work section is not built unless it says so.
@@ -104,6 +108,15 @@ Atlas UI for the new privilege: Database Access → Custom Roles → edit the ro
104
108
  | `EMET_REPORT_EMAIL` | optional | Address for the error-report draft. Unset uses `dreamforgestudio@mail.grokbot.com`. An empty string returns the report and no email. |
105
109
  | `EMET_HANDOFF_DOC` | optional | Handoff document id. Default `HANDOFF.md`. |
106
110
  | `EMET_STATE_DOC` | optional | Board document id. Default `STATE.md`. |
111
+ | `EMET_SUBKEY_RENEWAL_MINUTES` | optional | Last stretch of a 12-hour sub-key handle, in minutes, during which an open with the key and the current handle renews. Default 60. |
112
+ | `EMET_SUBKEY_HANDLE_GRACE_MINUTES` | optional | Minutes after handle expiry during which the key and the current handle still renew. Default 60. After that, the sweep may mark the session `auto_closed`. The row and the transcript stay. |
113
+ | `EMET_SUBKEY_SWEEP_MINUTES` | optional | How often the server looks for stranded sub-key sessions. Default 15. |
114
+ | `EMET_CONTINUITY_CURRENCY` | optional | `1` adds a warn-only continuity reading on initialize and session open. Unset is off. A lag does not block, and the server does not rewrite HANDOFF or STATE. |
115
+ | `EMET_CONTINUITY_CURRENCY_BLOCK` | optional | Reserved. It is not applied. The reading stays warn-only. |
116
+ | `EMET_TAG_HANDOFFS` | optional | Off unless the value is `warn` or `enforce`. Off is the default. A bot on the shared owner login needs its own sub-key before the flag leaves off. With the flag at `warn` or `enforce`, a declared session tag that is not the credential is refused (`EMET-DOC-088`). A call that declares no tag is kept. With the flag off that check does not run. |
117
+ | `EMET_HUB_TAG` | optional | The only tag that writes `HANDOFF.md` when per-tag handoffs are on. Unset while the flag is `warn` or `enforce` refuses every write (`EMET-CFG-015`). |
118
+ | `EMET_HANDOFF_AGING_DAYS` | optional | Days before a handoff line in the computed view is aging. Default 7. |
119
+ | `EMET_STALE_OPEN_HOURS` | optional | Hours before an open session with material work is marked stale-open. Default 24. |
107
120
  | `EMET_INSTALL_DOC` | optional | Install-notes document id. Default `bootstrap/INSTALL.md`. |
108
121
  | `EMET_CHARACTER_DOC` | optional | Character document. Unset tries `bootstrap/CHARACTER.md`, then `bootstrap/SOUL.md`, then `bootstrap/PERSONALITY.md`. |
109
122
  | `EMET_RECORD_DOCS` | optional | Extra record document ids, comma-separated. |
@@ -242,7 +255,7 @@ variables in one change. **With `EMET_SOURCE_TAGS` unset, both guards are opt-in
242
255
  caller can write the main records and every bot folder, so set the registry on any shared install.
243
256
 
244
257
  **Legacy `CASCADE_` names.** A setting read through `setting()` also accepts the legacy `CASCADE_` name. The `EMET_` name wins when both are set. The complete list is:
245
- `EMET_ACTIVE_GEMS`, `EMET_AUDIT_LOG`, `EMET_CHARACTER_DOC`, `EMET_CIMD`, `EMET_CLAIMED_TAG_KILL_DATE`, `EMET_CLOSE_GRACE_MINUTES`, `EMET_COS_TAG`, `EMET_DEEP_LINK_TTL_MINUTES`, `EMET_GAP_BASELINE`, `EMET_HANDOFF_DOC`, `EMET_INSTALL_DOC`, `EMET_INVITES`, `EMET_MEMBER_ACCESS`, `EMET_OAUTH_PASSPHRASE`, `EMET_READ_DOC_PAGE`, `EMET_RECORD_DOCS`, `EMET_RESTORE_TAGS`, `EMET_SIGNING_KEY`, `EMET_SOURCE_TAG`, `EMET_SOURCE_TAGS`, `EMET_STATE_DOC`, `EMET_STRICT_LOGIN_TAG`, `EMET_SUBKEY_FAIL_MAX`, `EMET_SUBKEY_FAIL_WINDOW_MS`, `EMET_SUBKEY_GRACE_MINUTES`, `EMET_SUBKEY_PEPPER`, `EMET_SUBKEY_PEPPER_PREV`, `EMET_SUBKEY_PEPPER_PREV_VERSION`, `EMET_SUBKEY_PEPPER_VERSION`, `EMET_SUBKEY_TTL_DAYS`, `EMET_SUBKEYS`, `EMET_TEMPLATE_MAP`, `EMET_TIMEZONE`.
258
+ `EMET_ACTIVE_GEMS`, `EMET_AUDIT_LOG`, `EMET_CHARACTER_DOC`, `EMET_CIMD`, `EMET_CLAIMED_TAG_KILL_DATE`, `EMET_CLOSE_GRACE_MINUTES`, `EMET_CONTINUITY_CURRENCY`, `EMET_CONTINUITY_CURRENCY_BLOCK`, `EMET_COS_TAG`, `EMET_DEEP_LINK_TTL_MINUTES`, `EMET_GAP_BASELINE`, `EMET_HANDOFF_AGING_DAYS`, `EMET_HANDOFF_DOC`, `EMET_HUB_TAG`, `EMET_INSTALL_DOC`, `EMET_INVITES`, `EMET_MEMBER_ACCESS`, `EMET_OAUTH_PASSPHRASE`, `EMET_READ_DOC_PAGE`, `EMET_RECORD_DOCS`, `EMET_RESTORE_TAGS`, `EMET_SIGNING_KEY`, `EMET_SOURCE_TAG`, `EMET_SOURCE_TAGS`, `EMET_STALE_OPEN_HOURS`, `EMET_STATE_DOC`, `EMET_STRICT_LOGIN_TAG`, `EMET_SUBKEY_FAIL_MAX`, `EMET_SUBKEY_FAIL_WINDOW_MS`, `EMET_SUBKEY_GRACE_MINUTES`, `EMET_SUBKEY_HANDLE_GRACE_MINUTES`, `EMET_SUBKEY_PEPPER`, `EMET_SUBKEY_PEPPER_PREV`, `EMET_SUBKEY_PEPPER_PREV_VERSION`, `EMET_SUBKEY_PEPPER_VERSION`, `EMET_SUBKEY_RENEWAL_MINUTES`, `EMET_SUBKEY_SWEEP_MINUTES`, `EMET_SUBKEY_TTL_DAYS`, `EMET_SUBKEYS`, `EMET_TAG_HANDOFFS`, `EMET_TEMPLATE_MAP`, `EMET_TIMEZONE`.
246
259
  These read `process.env` directly, so a `CASCADE_` name is ignored. The complete list is:
247
260
  `EMET_COLLECTION_PREFIX`, `EMET_CORPORA`, `EMET_CORPUS_COLLECTION`, `EMET_CORPUS_INDEX`, `EMET_CRASH_LOG`, `EMET_DROP_LIST_TIMEOUT_MS`, `EMET_HTTP_LISTEN`, `EMET_INIT_PAGE_BYTES`, `EMET_REPORT_EMAIL`, `EMET_REQUEST_LOG`, `EMET_VECTOR_INDEX`.
248
261
  (`MONGODB_URI`, `MONGODB_DB`, `PUBLIC_URL`, `PORT`, `HOST`, `LOG_LEVEL`, `LOG_FORMAT` and `DEBUG` have no prefix. `TRUST_PROXY` is not read: the server trusts exactly one proxy hop (Railway's edge).) Use the `EMET_` names.
@@ -41,3 +41,7 @@ EMET itself never sends the report. A person can open the mailto draft. An assis
41
41
  The calling assistant may send this report only after showing the report to its user and getting their OK. That sentence is in the tool description and in the tool output. It is not part of the report body, so the text the recipient reads stays the report.
42
42
 
43
43
  This is an owner decision added after the report was specified as a draft the person sends. The server stays free of SMTP and of any network call on this path.
44
+
45
+ ## Handoff refusals
46
+
47
+ `EMET-DOC-084` is another tag's handoff, or the hub handoff written by a tag that is not the hub, or the draft id `handoffs/<tag>.md`, or an unregistered credential, or a file in another tag's `bots/<tag>/` folder. `EMET-DOC-085` is a board row the credential did not open, including a deleted row, a restore, a row already on the board with no opener, and a hub write that is not resolving a marked conflict. A hub resolve whose stamp is no longer the view in force is the same code: the message says the stamp is not the view in force and to re-read the handoff view. That includes a stamp whose open sessions, aging, stale-open hours, or registry no longer match, so a hub whose own session becomes tagged after initialize re-reads before the resolve. `EMET-DOC-086` is a reserved two-segment handoff id, a tag equal to a person id, a malformed id, or a tag whose characters the id does not allow. `EMET-DOC-087` is a claimed tag writing under `HANDOFF/`. `EMET-DOC-088` is a declared session tag that is not the HTTP credential, including a claimed tag naming a session. It applies only while `EMET_TAG_HANDOFFS` is `warn` or `enforce`, and only when the call declares a tag. A call that declares no tag is kept. With the flag off the check does not run, and the declared tag is kept. `EMET-CFG-015` is the per-tag flag on with `EMET_HUB_TAG` unset. The registry table is [ERROR-CODES.md](ERROR-CODES.md).
@@ -64,6 +64,7 @@ Internal codes are raised inside a check that catches them before a caller sees
64
64
  | EMET-CFG-012 | Backup answer must be yes or no | active |
65
65
  | EMET-CFG-013 | Setup requires the owner | active |
66
66
  | EMET-CFG-014 | Store is already set up | active |
67
+ | EMET-CFG-015 | Per-tag handoffs are on and the hub tag is unset | active |
67
68
  | EMET-DB-001 | MONGODB_URI is not set | active |
68
69
  | EMET-DB-002 | Failed to connect to MongoDB | active |
69
70
  | EMET-DB-003 | Query failed on a memory layer | active |
@@ -178,6 +179,11 @@ Internal codes are raised inside a check that catches them before a caller sees
178
179
  | EMET-DOC-078 | Commit reason does not match the stage | active |
179
180
  | EMET-DOC-079 | This call's source does not match the stage | active |
180
181
  | EMET-DOC-080 | This call's session does not match the stage | active |
182
+ | EMET-DOC-084 | Another tag's handoff, folder, or an unregistered credential | active |
183
+ | EMET-DOC-085 | A credential changed a board row it did not open | active |
184
+ | EMET-DOC-086 | A reserved, malformed, or person-equal handoff id | active |
185
+ | EMET-DOC-087 | A claimed tag cannot write a handoff | active |
186
+ | EMET-DOC-088 | A declared session tag is not the credential | active |
181
187
  | EMET-GEM-001 | Read-back found no document | active |
182
188
  | EMET-GEM-002 | Read-back content digest differs | active |
183
189
  | EMET-GEM-003 | Read-back version differs | active |
@@ -278,6 +284,7 @@ Internal codes are raised inside a check that catches them before a caller sees
278
284
  | EMET-SESS-005 | Session graph is unavailable | active |
279
285
  | EMET-SESS-006 | Session close was blocked | active |
280
286
  | EMET-SESS-007 | Session close escalated | active |
287
+ | EMET-SESS-014 | A stranded sub-key session needs a new open | active |
281
288
  | EMET-TOOL-001 | A tool has no annotation entry | active, internal |
282
289
  | EMET-TOOL-002 | A source tag is required | active |
283
290
  | EMET-TOOL-003 | A source tag is required and none are registered | active |
package/docs/ROADMAP.md CHANGED
@@ -6,7 +6,7 @@ EMET stays **one shared server** with verified per-client attribution. One colla
6
6
 
7
7
  ## Where things stand
8
8
 
9
- - **Live:** the public site and the npm package `@dreamforgestudiollc/emet` are published. Version 0.3.6 is this repository. 38 tools (15 read-only); `EMET_SUBKEYS=1` adds four sub-key tools. Topic pages shipped in 0.3.0: `emet_page`, `emet_pages`, and `emet_page_lint`. Layer writes and reads are native to MongoDB. Server-side checks run on session start and close. Receipts are required at close. The handoff is a record, superseded and never amended.
9
+ - **Live:** the public site and the npm package `@dreamforgestudiollc/emet` are published. Version 0.3.7 is this repository. 38 tools (15 read-only); `EMET_SUBKEYS=1` adds five sub-key tools. Topic pages shipped in 0.3.0: `emet_page`, `emet_pages`, and `emet_page_lint`. Layer writes and reads are native to MongoDB. Server-side checks run on session start and close. Receipts are required at close. The handoff is a record, superseded and never amended.
10
10
  - **The extension socket is built.** It is `src/socket.js`. Its note is [gem/README.md](gem/README.md). The standard in this repository is Draft, in [`gem-library/`](../gem-library/README.md). Neurendipity and the other bundled GEMs stay off unless the install names them. A RUNED GEM stays off unless the install names it. The socket serves each RUNE and does not run it. Client-side execution shipped with the socket. A public repository for outside GEM submissions does not exist yet. Its name is not chosen.
11
11
  - **The aleph** verifies every write by reading it back before any receipt, and every later read by its digests, signature, and place in its layer's hash chain. `emet_gaps` walks the whole chain for any host.
12
12
  - **Guardrails and monorails** ([GUARDRAILS-AND-MONORAILS.md](GUARDRAILS-AND-MONORAILS.md)): the server checks the order of a session's writes. Enforce only since 0.2.1: every skipped step is refused with the way to pass, and every check is stored as a timestamped lab result. There is no report mode and no off switch.
@@ -34,13 +34,13 @@ Nothing in this section is a commitment to a date or a design freeze. A status l
34
34
 
35
35
  ### Attribution, handoffs, and who can write
36
36
 
37
- - **Per-source-tag handoffs (Planned, not in this public release).** A later public release may add per-AI handoffs keyed to credential-backed source tags. Each writing AI writes only its own handoff (`HANDOFF/<tag>`). The hub keeps the shared `HANDOFF.md` and resolves conflicts. A shared view is computed on read, not stored as a second record. Read-only AIs would use the shared view. Today the public server keeps one shared `HANDOFF.md` and, for bots, `bots/<tag>/HANDOFF.md`. A private build has the later handoff shape behind a flag. That flag is not part of public 0.3.6, and this release does not ship the tools, documents, or settings for it.
37
+ - **Per-source-tag handoffs (ships in 0.3.7, off unless the owner sets warn or enforce).** Each writing AI writes only its own handoff (`HANDOFF/<tag>.md`). The hub tag named by `EMET_HUB_TAG` keeps `HANDOFF.md`. A shared view is computed on read and is not stored as a second record. Read-only AIs use the shared view. `EMET_TAG_HANDOFFS` is off unless the owner sets `warn` or `enforce`. Off, the server keeps one shared `HANDOFF.md` and, for bots, `bots/<tag>/HANDOFF.md`. The flag does not block startup, and a stale handoff does not refuse a call.
38
38
  - **Fuller multi-person support on one server (Later phase, not built).** EMET already supports one shared instance with per-client attribution, an owner door, and member and guest access codes bound to source tags. Richer multi-person use of that same server, beyond those doors, is a later phase. The supported model remains one collaborative project, one instance. Many separate EMET instances, or a gateway between them, is a different idea and is not built. See [SECURITY-AT-SCALE.md](SECURITY-AT-SCALE.md).
39
39
  - **Source-tag onboarding and further socket extensions (Planned).** Source tags, the owner door, and the bound-host door already ship. Stronger hardening of source-tag onboarding and client attribution is still to be done. The extension socket is built. Additional per-door extensions on that socket are Planned and are not built. A switch that picks a GEM is one of those later pieces. It is not built.
40
40
 
41
41
  ### Document control
42
42
 
43
- - **Continuity-currency enforcement (Planned, not built).** `emet_initialize` does not yet refuse to run when `HANDOFF.md` or `STATE.md` is stale because a newer record exists. That gate is Planned. Session close can already cite a later continuity record through `carry_forward` (shipped in 0.3.3). That close path is not this initialize gate.
43
+ - **Continuity currency (ships in 0.3.7, off unless the owner sets `EMET_CONTINUITY_CURRENCY=1`).** `emet_initialize` and `emet_session_open` compare the served handoff with the live material episodic tip and return `continuity_currency`. A lag warns. The call is not refused. The server does not rewrite HANDOFF or STATE. `EMET_CONTINUITY_CURRENCY_BLOCK` is reserved and is not applied. Session close can already cite a later continuity record through `carry_forward` (shipped in 0.3.3). That close path is not this reading.
44
44
  - **Topic pages with currency and lock levels (Planned).** Topic pages shipped in 0.3.0 as views computed on each request: `emet_page`, `emet_pages`, and `emet_page_lint`. A page is not a stored record. Area selectors can name a staleness window, and lint can flag a stale line. Wiki-style currency and lock levels for controlled documents are not built. Stored compiled pages are not built. If a compiled-page pilot is ever written, it needs its own page subject. It does not revive the closed hive-memory item.
45
45
  - **Lint sweep of the semantic layer (Proposed).** The scheduled sweep for contradictions, outdated claims, missing links, and subjects with no page is still proposed. Findings would be reported, never applied automatically. Nothing in EMET fades.
46
46
 
package/docs/SETUP.md CHANGED
@@ -251,6 +251,10 @@ it should come back `ready` with your existing identity, not `setup_required`. I
251
251
  `setup_required`, one of the four variables above is wrong; **do not run the setup interview,
252
252
  which would write a new identity over your existing one.**
253
253
 
254
+ ## Upgrading to 0.3.7
255
+
256
+ 0.3.7 adds per-tag handoffs, off unless the owner sets `EMET_TAG_HANDOFFS` to `warn` or `enforce`, and sub-key session renewal. Stored rows are not rewritten. No new setting is required. The handle length stays 12 hours. A stranded session is marked `auto_closed` by the sweep. The row and the transcript stay. ISO 9001 7.5.3 / ISO 13485 4.2.5 document-control wording is unchanged.
257
+
254
258
  ## Upgrading to 0.3.6
255
259
 
256
260
  0.3.6 is a docs and wording release. Stored data shapes are unchanged. No new setting. Deploy over 0.3.5 as is. The public roadmap's Upcoming work section is not built unless it says so.
package/docs/SUBKEYS.md CHANGED
@@ -32,7 +32,9 @@ List each bot's tag in `EMET_SOURCE_TAGS` before it asks for a key. An empty lis
32
32
  3. On the chooser, approve that request. Deny applies only to a pending request.
33
33
  4. The bot claims the key within 24 hours. It keeps the key where the other bots cannot read it. The key is never written into EMET.
34
34
 
35
- A bot opens a session with that key. `emet_session_open` returns `session_handle` once. Every later write in that session passes `session_handle`. A write that names the session and omits the handle, or sends a different one, is refused, and nothing is written. The handle is not a receipt and is not written into a document.
35
+ A bot opens a session with that key. `emet_session_open` returns `session_handle` once. Every later write in that session passes `session_handle`. A write that names the session and omits the handle, or sends a different one, is refused, and nothing is written. The handle lasts 12 hours. In the last hour, and for one hour after it expires, an open that presents the sub-key and the handle closes the old session into the new one. The server closes a session that is past that grace on its own and marks it `auto_closed`. The row and the transcript stay. A status read of a stranded session is not refused and does not write. The handle is not a receipt and is not written into a document.
36
+
37
+ The owner can set the key's kind with `emet_subkey_set_kind`: `bot` or `chat`. A key with no kind stored is a bot. A chat key whose previous turn left no wrap-up is reported unwrapped on the next open. The owner approves the kind on `/owner/chooser` as well.
36
38
 
37
39
  ## A key lasts 30 days
38
40
 
@@ -0,0 +1,34 @@
1
+ # Continuity currency
2
+
3
+ ```mermaid
4
+ stateDiagram-v2
5
+ [*] --> GateOff
6
+ GateOff --> GateOff: warn flag stays off
7
+ GateOff --> Comparing: warn flag on
8
+ Comparing --> Current: handoff cites the live material tip
9
+ Comparing --> DocumentedNoOp: documented no-op, no newer material tip
10
+ Comparing --> Current: newer episodic is scratch or diagnosis only
11
+ Comparing --> Current: version number alone
12
+ Comparing --> Warning: material tip is newer
13
+ Comparing --> FallbackOnly: only a fallback tip is newer
14
+ Comparing --> NoHandoff: no handoff to compare
15
+ Comparing --> Unreadable: the comparison could not be read
16
+ Warning --> BlockHeld: block asked, still does not block
17
+ FallbackOnly --> FallbackHeld: block asked, still does not block
18
+ Warning --> Comparing: the next initialize compares again
19
+ Current --> Comparing: the next initialize compares again
20
+ DocumentedNoOp --> Comparing: the next initialize compares again
21
+ BlockHeld --> Comparing: the next initialize compares again
22
+ FallbackOnly --> Comparing: the next initialize compares again
23
+ FallbackHeld --> Comparing: the next initialize compares again
24
+ NoHandoff --> Comparing: the next initialize compares again
25
+ Unreadable --> Comparing: the next initialize compares again
26
+ ```
27
+
28
+ The warn-only comparison of the served handoff with the material episodic tip. `EMET_CONTINUITY_CURRENCY` is off unless it is `1`. A lag warns. The server does not rewrite HANDOFF or STATE, and it does not block the call. `EMET_CONTINUITY_CURRENCY_BLOCK` is reserved and is not applied.
29
+
30
+ The model is `verification/continuity-currency/ContinuityCurrency.tla`, with `ContinuityCurrency.cfg`. TLC does not enumerate episodic ids. `newer` and `claim` are classes. `fallback` is a logged tip: it warns, and it is not block-eligible. No handoff and an unreadable comparison are phases. The executable check is `continuityCurrencyStep` in `src/continuity-currency-statechart.js`. TLC on this revision found 16 distinct states. The depth of the complete state graph is 4. No error. `TypeOK`, `NeverRewrites`, `NeverBlocks`, `WarnOnlyOnMaterialLag`, `FlagOffShowsNothing`, `NoOpIsNotAWarning`, `NoHandoffIsQuiet`, `UnreadableIsQuiet`, `FallbackOnlyIsNotBlockEligible`, `ScratchIsNotAWarning`, and `VersionAloneDoesNotWarn` hold. The run is `verification/continuity-currency/tlc-output.txt`.
31
+
32
+ The generated chart draws 10 states and 17 arrows. It joins the three Comparing to Current reasons onto one arrow, and it omits the step that stays in Gate off, the warn flag staying off. This diagram draws that step and keeps the three reasons separate. No handoff, unreadable, and fallback-only are on both.
33
+
34
+ When `EMET_TAG_HANDOFFS` is `warn` or `enforce`, the same gate is read per tag. An open session with material work is an in-progress line on the handoff view. It is not a lag. After `EMET_STALE_OPEN_HOURS` (default 24) that line is marked stale-open. The overall status is the worst status among the tags that count. A `no_handoff` tag with no material episodic rows at or after the cutoff stays on the per-tag list and is left out of that overall status. A tag with material rows at or after the cutoff, or with no readable timestamp, and no handoff still counts. While the flag is `warn` or `enforce`, `legacy_pre_attribution` is on every reading. The cutoff is the start of the UTC day 2026-09-27 (`2026-09-27T00:00:00.000Z`). A row at or after that instant with no registered source still warns. `does_not_block` stays true. No setting refuses the call. The picture for that protocol is [per-tag-handoff-statechart.md](per-tag-handoff-statechart.md).
@@ -0,0 +1,21 @@
1
+ # Feature map
2
+
3
+ This is the map of what EMET does today, written from the outside. Each file is one feature. A feature names the tools that belong to it, how a person reaches it, how `verify-emet` drives it, and the traps that waste a run.
4
+
5
+ `npm run verify` is the command. It is `scripts/verify-emet.mjs`. From a checkout it starts EMET in a temporary directory on the in-memory test database, with no `.env` and no settings copied from the machine that launched it. A tool that still needs a service or a setting a plain install does not have is a gap. The command reports the gap and does not pretend the call succeeded. Exit 0 means every driven tool passed and the selection had no gap. Exit 1 means a tool failed, Node is older than 22, or the test database is missing. Exit 2 means the command line was not understood. Exit 3 means the only problems are gaps.
6
+
7
+ | Feature | What it is |
8
+ |---|---|
9
+ | [Startup](startup.md) | First call, the interview, and the store status. |
10
+ | [Memory layers](memory.md) | Save, search, query, and supersede layer entries. |
11
+ | [Search beyond keywords](search.md) | Meaning search and an optional corpus. Both are gaps on a standalone run. |
12
+ | [Transcripts](transcripts.md) | Open a session, append each exchange, and close. |
13
+ | [Documents](documents.md) | Versioned documents, history, and obsolescence. |
14
+ | [Topic pages](pages.md) | Computed views. They are not records. |
15
+ | [Error codes and the error log](errors.md) | Stable codes, the operational log, and `emet_error_report`. |
16
+ | [The record and the floor](record.md) | Gap counts, and the floor that ships in the server. |
17
+ | [Access](access.md) | Approving a client, and the two doors for a second person. |
18
+ | [Client sub-keys](subkeys.md) | Delegated keys. Off unless you turn them on. |
19
+ | [GEMs](gems.md) | Add-on behavior the client runs. EMET checks the record. |
20
+
21
+ A registered tool that is missing from this map fails `tests/feature-map.test.js`. Add the tool to the feature file in the same change that registers it.
@@ -0,0 +1,28 @@
1
+ # Access
2
+
3
+ The store has one owner. `emet_client_approve` approves or denies a client that was flagged on a first write. `emet_invite_create` mints a one-time guest code. `emet_member_access_create` mints a one-time member code. Both doors are off unless you turn them on. A code is shown once and is not stored in the clear.
4
+
5
+ ## Sub-features
6
+
7
+ - access-approve: `emet_client_approve` takes a tag and a decision of `approve` or `deny`. Pending clients are listed by `emet_initialize` and `emet_status`.
8
+ - access-guest: `emet_invite_create` is EMET Guest Access, read-only. It stays off unless `EMET_INVITES=1`.
9
+ - access-member: `emet_member_access_create` is EMET Member Access, read and write, never the owner. It stays off unless `EMET_MEMBER_ACCESS=1`.
10
+
11
+ ## How to get to it (user POV)
12
+
13
+ A new client is read-limited until you approve it. You see the pending tag in startup or status, then call `emet_client_approve`. For a second person, turn on the door you mean, then create the code and show it once. They paste it on the connect screen instead of the passphrase. Guest access is not member access.
14
+
15
+ ## Driving it with verify-emet
16
+
17
+ ```
18
+ npm run verify -- feature access
19
+ npm run verify -- run emet_client_approve emet_invite_create emet_member_access_create
20
+ ```
21
+
22
+ On a plain install the two doors are off. The drive expects those two calls to refuse with `EMET-AUTH-030` and `EMET-AUTH-034`. That refusal is the tool working. The approve call denies a tag that exists only inside the temp database. `--dry-run` skips all three, because each one can change who has access.
23
+
24
+ ## Gotchas
25
+
26
+ - Do not invent a guest or member answer during setup. The doors stay off until the matching variable is `1`.
27
+ - A client does not approve itself.
28
+ - The code is not in the result a second time. Show it when it is created.
@@ -0,0 +1,35 @@
1
+ # Documents
2
+
3
+ Continuity documents are versioned. `write_doc` stores a new revision and archives the previous one. When a host truncates one argument, `write_doc_begin`, `write_doc_append`, and `write_doc_commit` send the same revision in parts. `write_doc_abort` drops an open stage and leaves the current document unchanged. `read_doc` reads the current text, in pages when it is long. `read_doc_history` reads a retained revision. `list_docs` lists metadata. `patch_doc` replaces one exact substring. `rename_doc` reissues a document under a new id and marks the old id obsolete. `restore_doc` writes a retained revision back. `validate_doc` checks form and continuity and writes nothing. `accept_nonconformance` records a written disposition for a marker that will not be corrected. `retire_doc` marks a drop obsolete. The document stays.
4
+
5
+ ## Sub-features
6
+
7
+ - doc-write: `write_doc` and `patch_doc` archive the prior copy and check the digest on the way back.
8
+ - doc-stage: `write_doc_begin`, `write_doc_append`, and `write_doc_commit` assemble one revision. `write_doc_abort` drops the stage.
9
+ - doc-read: `read_doc`, `read_doc_history`, and `list_docs` do not change the store.
10
+ - doc-check: `validate_doc` is the write-path check, borrowed, with no write.
11
+ - doc-reissue: `rename_doc` writes the destination first, then marks the old id obsolete.
12
+ - doc-restore: `restore_doc` copies a retained revision back through the normal write path. The source tag must be listed in `EMET_RESTORE_TAGS`.
13
+ - doc-accept: `accept_nonconformance` keeps the marker and writes the acceptance beside it.
14
+ - doc-retire: `retire_doc` is for drops. A working note is edited, not retired.
15
+
16
+ ## How to get to it (user POV)
17
+
18
+ You already have a session open. `list_docs` shows the ids. `read_doc` with a `doc_id` returns the text. For a small edit, `patch_doc` with the exact old text, the new text, and a reason of at least 10 characters. For a new document, `write_doc` with the whole text. Records such as the handoff are written whole, with `supersedes` set to the version in force. `validate_doc` before you store a draft. If a stored document is nonconforming and you will not correct it, `accept_nonconformance` with a reason. To mark a drop obsolete, `retire_doc`. `read_doc` still returns it, flagged retired.
19
+
20
+ ## Driving it with verify-emet
21
+
22
+ ```
23
+ npm run verify -- feature documents
24
+ npm run verify -- run read_doc read_doc_history write_doc write_doc_begin write_doc_append write_doc_commit write_doc_abort list_docs patch_doc rename_doc restore_doc validate_doc accept_nonconformance retire_doc
25
+ ```
26
+
27
+ The drive writes a note, patches it, restores the retained revision, renames it, writes an area, accepts a nonconforming area, and retires a drop. `--dry-run` skips the calls whose annotations say they replace what is already there.
28
+
29
+ ## Gotchas
30
+
31
+ - `patch_doc` requires the old text to match exactly once. Zero matches or several matches write nothing.
32
+ - `retire_doc` refuses a working document. Write a `drops/` id if you mean a drop.
33
+ - `restore_doc` refuses a tag that is not in `EMET_RESTORE_TAGS`. The standalone drive sets that list to its own source tag inside the temp process. It does not read your environment.
34
+ - `accept_nonconformance` refuses a document that has no nonconformance marker.
35
+ - Prior versions are retained. A correction adds a revision. It does not remove the old one.
@@ -0,0 +1,32 @@
1
+ # Error codes and the error log
2
+
3
+ Every error carries a stable code, such as `EMET-INT-001`, next to the existing error field. A new choice of the previous bound-door spelling is `EMET-AUTH-045`. The refusal sites are a new consent, a sub-key request, a writer request, a member or guest code, a setup source, `/owner/chooser`, and `/owner/break-glass`. The registry is `src/error-codes.js`. The table is `docs/ERROR-CODES.md`. A code's meaning does not change. A removed code stays retired and its number is not reused.
4
+
5
+ Operational errors go to a separate log, `error_log`. It is not a controlled record. It keeps up to 10,000 entries or 90 days, whichever is smaller, and a daily summary of each day is kept in `error_log_summary` with no end date. Rotation removes entries from `error_log` only. The log holds codes, counts, times, and the version. It holds no message text, arguments, document content, names, or secrets.
6
+
7
+ `emet_error_report` is owner-only and read-only. It returns the report and an email draft. You read it, and you press Send yourself. EMET never sends mail.
8
+
9
+ ## Sub-features
10
+
11
+ - errors-codes: each returned error includes `error.emet_code`. An uncoded error that reaches a caller is `EMET-INT-001`.
12
+ - errors-log: `error_log` and `error_log_summary` are operational. They are not superseded documents.
13
+ - errors-report: `emet_error_report` reads the log and builds a `mailto:` draft. The address is `EMET_REPORT_EMAIL` when that variable is set. When it is unset, the address is `dreamforgestudio@mail.grokbot.com`. An empty string returns the report and no email.
14
+
15
+ ## How to get to it (user POV)
16
+
17
+ When a call fails, read `error.emet_code` and look it up in `docs/ERROR-CODES.md`. To send a problem on, run `emet_error_report` as the owner. Read the report, open the link, check the email in your own mail app, then send it. Set `EMET_REPORT_EMAIL` to keep reports at an address you choose.
18
+
19
+ ## Driving it with verify-emet
20
+
21
+ ```
22
+ npm run verify -- feature errors
23
+ npm run verify -- run emet_error_report
24
+ ```
25
+
26
+ The drive calls the tool as a local owner, the way stdio does, and expects a report. It does not send mail. There is no mail sender in this command.
27
+
28
+ ## Gotchas
29
+
30
+ - A remote caller who is not the owner is refused. The local process is the owner.
31
+ - The draft is not a delivery receipt. EMET does not open a network connection for this tool.
32
+ - The log is not a controlled record. Controlled records are still superseded, retired, and retained.
@@ -0,0 +1,31 @@
1
+ # GEMs
2
+
3
+ A GEM is an add-on: knowledge and, when it is runed, tools the client runs. EMET seats a GEM only when its released flag is the boolean true. EMET does not run the GEM's computation. EMET verifies the record, not the computation. What is written back is checked the same way as any other write.
4
+
5
+ This feature has no tool of its own. `emet_floor` can read one GEM's floor without turning it on. `emet_status` reports each seated GEM's byte cost and does not include the floor text.
6
+
7
+ ## Sub-features
8
+
9
+ - gem-seat: a GEM is seated at startup only when `released` is true, and only when you name it in the active list.
10
+ - gem-floor: `emet_floor` with `gem` reads that floor. Reading is not activation.
11
+ - gem-status: `emet_status` includes a `gems` object: installed, active, and any refusal. A socket failure is reported there and does not fail the status call.
12
+ - gem-client: a runed tool runs on the client. The server checks what comes back.
13
+
14
+ ## How to get to it (user POV)
15
+
16
+ Bundled examples stay off until you ask. Set `EMET_ACTIVE_GEMS` to the id you want, restart, and call `emet_status` to see that it seated. Call `emet_floor` with `gem` set to that id to read its floor before you rely on it. The client runs any tool the GEM declares. You still save through the normal write tools.
17
+
18
+ ## Driving it with verify-emet
19
+
20
+ ```
21
+ npm run verify -- feature gems
22
+ npm run verify -- run emet_floor emet_status
23
+ ```
24
+
25
+ `feature gems` does not call a tool, because there is nothing to call that belongs only here. The two commands above are how you see seating and the floor. Neither one turns a GEM on by itself.
26
+
27
+ ## Gotchas
28
+
29
+ - A missing `released` flag is refused, except for a legacy manifest pinned by id, version, and file digests.
30
+ - A GEM ranks below the core floor. It cannot remove a protected floor line.
31
+ - Status stays successful when the socket fails closed. Read the `gems` field. Do not assume an empty active list means the call failed.
@@ -0,0 +1,29 @@
1
+ # Memory layers
2
+
3
+ Six layers hold curated claims: identity, semantic, episodic, procedural, meta, and working. `save_to_layer` writes one entry. `recall` searches by keyword. `query_layer` filters one layer. `revise_memory` supersedes an entry with a new one. The old entry stays readable.
4
+
5
+ ## Sub-features
6
+
7
+ - memory-save: `save_to_layer` writes one entry and reads it back before it reports success.
8
+ - memory-recall: `recall` ranks current entries first. Pass `order` `"latest"` for time order.
9
+ - memory-query: `query_layer` takes a layer and optional filters.
10
+ - memory-revise: `revise_memory` adds a new entry that points at the one it replaces. Episodic entries are not revised.
11
+
12
+ ## How to get to it (user POV)
13
+
14
+ After startup, open a transcript session and pass that `session_id` on the save. Name the layer. Semantic and procedural saves also need a source: the session, or `metadata.derived_from`. Search with `recall` using the words you stored. Use `query_layer` when you know the layer and want a filter. To correct an entry, `revise_memory` with the full new text. Do not edit the old row.
15
+
16
+ ## Driving it with verify-emet
17
+
18
+ ```
19
+ npm run verify -- feature memory
20
+ npm run verify -- run save_to_layer recall query_layer revise_memory
21
+ ```
22
+
23
+ The drive saves a working-layer sentence, recalls it, queries that layer, then supersedes the saved id. Keyword search does not need a vector index. That index is a different feature.
24
+
25
+ ## Gotchas
26
+
27
+ - A semantic or procedural save with no `session_id` and no `derived_from` is refused, and nothing is written.
28
+ - A governed write with no session is refused. Open one with `emet_session_open` and the startup `load_id` first.
29
+ - `revise_memory` does not accept the episodic layer. Events stay as written.
@@ -0,0 +1,28 @@
1
+ # Topic pages
2
+
3
+ A topic page is a view computed when you ask. It is not a record, it is not stored, and `recall` does not return it. `emet_pages` lists the current area documents. `emet_page` builds one page. `emet_page_lint` flags problems and writes nothing. The owner writes the selector as `areas/<slug>.md`.
4
+
5
+ ## Sub-features
6
+
7
+ - pages-list: `emet_pages` returns a line count, a stale count, and the newest source time for each area.
8
+ - pages-read: `emet_page` cites every displayed line. A line with no source is dropped.
9
+ - pages-lint: `emet_page_lint` reports contradictions, broken links, and stale lines. A fix is a person's edit, not this tool.
10
+
11
+ ## How to get to it (user POV)
12
+
13
+ The owner writes `areas/<slug>.md` with `write_doc`, filled from the area template: layers, tags, keywords, document prefixes, source clients, a staleness window, and a cap. Then `emet_pages` to see the areas, and `emet_page` with that slug to read the view. `emet_page_lint` with the same slug, or with no area, to see findings. Only the owner can read a page.
14
+
15
+ ## Driving it with verify-emet
16
+
17
+ ```
18
+ npm run verify -- feature pages
19
+ npm run verify -- run emet_pages emet_page emet_page_lint
20
+ ```
21
+
22
+ The drive writes `areas/verify.md` first, then lists, reads, and lints it. The page body is not written back.
23
+
24
+ ## Gotchas
25
+
26
+ - There is no page until an area document exists. The error tells you to write `areas/<slug>.md`.
27
+ - A local session is the owner. A remote login must be the owner person.
28
+ - Lint does not revise, retire, or accept anything. Those stay separate tools.
@@ -0,0 +1,27 @@
1
+ # The record and the floor
2
+
3
+ `emet_gaps` counts holes in the record and names the ids behind the counts. It does not fill them. `emet_floor` reads the standing description of how the assistant engages. The floor ships in the server, so setup cannot overwrite it.
4
+
5
+ ## Sub-features
6
+
7
+ - record-gaps: `emet_gaps` covers unsourced assertions, attribution, digest mismatches, broken supersession, and the other classes the tool lists. Counts are complete. The id lists are capped.
8
+ - record-floor: `emet_floor` returns the core floor. `compact: true` is the short form. `section` returns one section. `gem` reads one installed GEM's floor and does not turn that GEM on.
9
+
10
+ ## How to get to it (user POV)
11
+
12
+ Call `emet_gaps` when you want to know how trustworthy the record is, before a consolidation pass, or after a migration. Closing a gap is a person's decision. Call `emet_floor` when you need the floor again without running startup. `emet_initialize` already returns the whole floor on a ready store.
13
+
14
+ ## Driving it with verify-emet
15
+
16
+ ```
17
+ npm run verify -- feature record
18
+ npm run verify -- run emet_gaps emet_floor
19
+ ```
20
+
21
+ `emet_floor` does not need the test database. `emet_gaps` does. A floor-only run is the fast check that the command can start.
22
+
23
+ ## Gotchas
24
+
25
+ - A gap count is not a repair. The tool identifies. It does not write.
26
+ - Reading a GEM floor does not seat that GEM.
27
+ - Re-reading the floor is not the same as being bound by it.