@securecoms/agent-bridge 0.28.2 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -705,99 +705,196 @@ including its key). Each proxied call is metered server-side
705
705
 
706
706
  ---
707
707
 
708
- ## Markdown notes (0.27.0)
709
-
710
- SecureComs-runtime agents keep short notes of what the owner asks them to
711
- remember, in the owner's private chat only. The runtime saves a note with the
712
- `memory_note` tool, and the bridge stores only a quote of the owner's own
713
- current message. Each note is sealed per row in `bridge-state.db` (schema
714
- v10) and is delivered only to the runtime's `/v1/ws` socket, never to a
715
- harness, HTTP, SSE, a room, another chat or the voice fast path.
708
+ ## Unified memory (0.29.0)
709
+
710
+ <!-- [COPY, NEW] Approved by Eric 2026-10-11 (plan Task 37). -->
711
+
712
+ Bridge 0.29.0 replaces the Markdown notes of 0.27 and the semantic memory of
713
+ 0.28 with one memory. In this release it works in the owner's private chat
714
+ only. Rooms and other people's private chats are not remembered.
715
+
716
+ **What the agent remembers.**
717
+
718
+ - Each message the owner types in their private chat. A message that looks
719
+ like a password or a key is not saved at all.
720
+ - What the owner says on a call in their private chat, when the bridge gets
721
+ the turn as transcribed speech from a relay that the server verified as the
722
+ owner. A spoken turn that arrives before the bridge has its runtime config
723
+ after a restart is not saved. Spoken words cannot be pinned, and a call
724
+ cannot forget.
725
+ - The agent's own replies in that chat, as reference material. A message the
726
+ agent sends that does not reply to a message is not saved.
727
+ - Pinned facts. The owner asks the agent to pin a fact, and the bridge posts
728
+ `Pinned: "<fact>" Say "forget that" to remove it.` in the chat. Each word
729
+ that carries meaning must be a word the owner typed. Words spoken on a call
730
+ do not count. At most 200 pinned facts, each at most 400 characters.
731
+ - "Forget that". The owner types it in their private chat. The agent removes
732
+ one memory shown with that message, and the bridge posts
733
+ `Forgot: "<text>"`. The agent makes one change (a pin or a forget) per
734
+ owner message.
735
+
736
+ **Where it is kept.** Each memory is sealed per row in `bridge-state.db`
737
+ (schema v12) on the agent's machine. The bridge delivers memories only to the
738
+ `/v1/ws` socket of a runtime that declares `memory_unified` in its hello. A
739
+ harness socket never receives them. The model provider sees the memories
740
+ delivered with each turn. Beside the pinned facts, a typed turn gets at most
741
+ 10 memories and a voice turn at most 3. The bridge waits up to 600 ms for a
742
+ typed turn's memory search and up to 250 ms for a voice turn's.
743
+
744
+ **Limits.** The limit is 2 GB or 100,000 memories, whichever comes first.
745
+ When it is full, the oldest automatic memories are removed first. Pinned facts
746
+ are never removed. At 80%, the app shows: "{name}'s memory is 80% full
747
+ ({used} of {limit}). The limit is 2 GB or 100,000 memories, whichever comes
748
+ first. When it is full, the oldest automatic memories are removed first.
749
+ Pinned facts are never removed." The app also says: "The more {name}
750
+ remembers, the harder it is to find older details; pinned facts are always in
751
+ front of it."
752
+
753
+ **RAM.** Plan for about 102 to 104 MiB more memory per agent at 100,000
754
+ memories (measured 2026-10-11 in a standalone process on an x86_64 laptop). A
755
+ small store uses less.
756
+
757
+ **The search model.** The bridge downloads its search model from
758
+ downloads.securecoms.ai the first time the owner messages the agent in their
759
+ private chat with memory on, if the model files are not already on the
760
+ machine. On a machine that must make no such connection, set
761
+ `memory.model_source` to `import_only` in the credential file and copy the
762
+ model bundle in with `agent-bridge models import <dir>`. Without the model,
763
+ the agent finds memories by keyword only. On Windows it finds memories by
764
+ keyword only in this release.
765
+
766
+ If you embed the bridge as a library (`new BridgeAgent(cfg, deps)`), pass
767
+ `hostMachine: true`. Without it, no model is downloaded or loaded, no call
768
+ heartbeat is written, and the agent finds memories by keyword only. The
769
+ `agent-bridge` command passes it for you.
716
770
 
717
771
  **Compatibility.**
718
772
 
719
- - Install `@securecoms/agent-runtime` 0.10.0 together with the bridge and
720
- restart both (`launchctl bootout` then `bootstrap`, never `kickstart`). The
721
- bridge moves legacy owner-DM facts into notes, and reports
722
- `memory_notes: true`, only after a runtime whose hello declares
723
- `memory_notes` has connected in that bridge process. A 0.9.x runtime's
724
- hello does not, so a 0.27 bridge with a 0.9.x runtime keeps today's facts
725
- and recall, but it is not a supported pairing.
773
+ - Install `@securecoms/agent-runtime` 0.12.0 together with the bridge and
774
+ restart both (`launchctl bootout` then `bootstrap`, never `kickstart`). A
775
+ runtime whose hello does not declare `memory_unified` (0.11.0 or older) gets
776
+ no memories. That is not a supported pairing.
726
777
  - Harness daemons (Hermes, OpenClaw) must name `memory.provider` in their
727
- credential file. A daemon whose file omits it is treated as `securecoms`;
728
- its harness socket still never receives notes and never turns on the import
729
- or the report, so naming the provider is defence in depth. A global
730
- `npm install -g --prefix ~/.local` reaches every daemon whose plist points
731
- at the global `dist/bin.js`, at its next restart; check each credential file
732
- (`jq .memory.provider <credential-file>`) before installing.
733
- - A `/v1/ws` consumer that sends no hello waits about 2 seconds for its first
734
- delivery.
735
- - Notes are off in a freshly started bridge until a runtime-config refetch
736
- succeeds. A bridge restarted while the backend is unreachable serves no
737
- notes and accepts no writes until the backend answers.
778
+ credential file. A daemon whose file omits it is treated as `securecoms`:
779
+ its bridge saves owner private-chat memories on disk, although its harness
780
+ socket never receives them. A global `npm install -g --prefix ~/.local`
781
+ reaches every daemon whose plist points at the global `dist/bin.js`, at its
782
+ next restart. Check each credential file
783
+ (`jq .memory.provider <credential-file>`) before you install.
784
+ - Memory is off in a freshly started bridge until a runtime-config refetch
785
+ succeeds. A bridge restarted while the backend is unreachable saves and
786
+ recalls nothing until the backend answers.
787
+
788
+ **Old notes and semantic memory.** The bridge copies a private chat's old
789
+ memory into unified memory in the background, after the owner's first typed
790
+ message in that chat on 0.29.0:
791
+
792
+ - 0.27 notes become pinned facts. The 200-fact limit does not apply to them.
793
+ - 0.28 semantic memory rows become automatic memories. Their search vectors
794
+ are kept.
795
+ - The chat's stored history becomes reference memories.
796
+ - A message forgotten in 0.28 is not copied. Text that looks like a password
797
+ or a key is not copied. Old facts, and the history of rooms and of other
798
+ people's private chats, are not copied.
799
+
800
+ The old tables stay in this release, so a rollback works. Clear all and
801
+ "forget that" also delete the matching old rows.
802
+
803
+ **Off switches.** There are four. Use the narrowest that fits.
804
+
805
+ - Agent memory off in the agent settings. The agent saves nothing new and
806
+ recalls nothing. It still sees the recent messages of the chat. Turning
807
+ memory off does not delete memories. Use Clear all for that.
808
+ - `memory.enabled: false` in the credential file, then a daemon restart. The
809
+ same effect, and the backend cannot turn it back on. Any value other than
810
+ `true` turns memory off.
811
+ - `memory.provider: "none"` in the credential file, then a daemon restart.
812
+ This turns memory off, and it also drops the recent history.
813
+ - `SECURECOMS_OWNER_DM_DEFAULT_GRANTS=off` in the bridge service environment.
814
+ This turns memory off, and it also drops the owner private-chat tools.
815
+
816
+ `SECURECOMS_TOOL_DENY=memory_note` (runtime environment) removes only the pin
817
+ and forget tool. The agent still saves and recalls memories.
738
818
 
739
819
  **Known limitations.**
740
820
 
741
- - Text the owner pastes counts as the owner's own words, up to the
742
- 600-unit short-message bound.
743
- - A quote can drop a condition or a negation ("Never cc X" can be saved as
744
- "cc X"). Ask the agent what it saved.
745
- - Short notes in CJK or Thai (fewer than 2 space-separated tokens) are
746
- refused.
747
- - UUIDs and long letter-and-digit tokens are refused as possible secrets.
821
+ - A pin can reorder the owner's words or leave one out, including a negation
822
+ ("don't pay Bob, pay Alice" can be pinned as "pay Bob"). Read the
823
+ `Pinned:` line, and say "forget that" if it is wrong.
824
+ - Clear all deletes memories. It does not delete chat history.
748
825
  - Forget and clear are logical deletes: sealed bytes can stay in free
749
- database pages until they are overwritten, and they still open under the
750
- device key.
751
- - "Clear all notes" does not delete chat history or legacy facts. Legacy facts
752
- that did not fit before can become notes after a clear.
753
- - The voice fast path still sends the last 10 DM messages through the
754
- backend proxy.
755
-
756
- **Off switches.** There are three. Use the narrowest that fits.
757
-
758
- - `memory.provider: "none"` in the credential file, then a daemon restart.
759
- This turns notes off, and it also drops the recent history.
760
- - `SECURECOMS_OWNER_DM_DEFAULT_GRANTS=off` in the bridge service environment.
761
- This also drops the owner-DM tools, not only `memory_note`.
762
- - `SECURECOMS_TOOL_DENY=memory_note` removes only the note tool.
763
-
764
- **Log events.** All are content-free: counts and classes only, never note text.
765
- `memory.note_written` (`op`, `notes_count`, `doc_chars`),
766
- `memory.note_refused` (`reason_class`), `memory.notes_cache_miss`,
767
- `memory.note_open_failed`, `memory.import_partial` (`remaining`),
768
- `memory.config_unrecognized`, `memory.clear_generation_regressed`,
769
- `memory.clear_failed`, `memory.applied_generation_out_of_range`,
770
- `memory.notes_fill_failed`, `memory.import_failed`,
771
- `memory.note_write_failed` (error class only), and `ws.hello_timeout` (no
772
- fields: a `/v1/ws` socket sent no hello and delivery opened after the wait).
826
+ database pages or the WAL until they are overwritten, and they still open
827
+ under the device key.
828
+ - The model provider sees the memories that the bridge delivers.
829
+
830
+ **Log events.** All are content-free: counts and classes only, never memory
831
+ text. `memory.item_written` (`source`, `chunks`), `memory.item_skipped`
832
+ (`reason_class`), `memory.pin_written`, `memory.item_forgotten`,
833
+ `memory.note_refused` (`reason_class`), `memory.migration_ran` (`notes`,
834
+ `recall`, `history`, `skipped`, `excluded`, `aborted`, `unreadable`),
835
+ `memory.owner_scope_purged` (`count`), `memory.unified_off`
836
+ (`reason_class`: `off`, `unrecognized`, `local` or `clear_pending`),
837
+ `memory.ranking_worker_exited` (`inFlight`), and these failure events with the
838
+ error class only: `memory.unified_clear_failed`,
839
+ `memory.unified_switch_failed`, `memory.unified_report_failed`,
840
+ `memory.unified_prepare_failed`, `memory.unified_reply_failed`,
841
+ `memory.unified_boot_reconcile_failed`, `memory.migration_failed`,
842
+ `memory.owner_scope_sweep_failed`, `memory.note_write_failed`,
843
+ `memory.pinned_line_failed`, `memory.forgot_line_failed`,
844
+ `memory.evict_failed`, `memory.reembed_failed`, `memory.model_upkeep_failed`,
845
+ `memory.ranking_notify_failed` and `memory.ranking_worker_spawn_failed`.
846
+
847
+ **`/healthz` and the machine report.** `/healthz` adds `memory_hot_bytes`,
848
+ `memory_deadline_misses`, `memory_reads`, `memory_reads_discarded` and `pid`.
849
+ The machine report adds `memory_unified_enabled`, `memory_size_bytes`,
850
+ `memory_item_count`, `memory_db_bytes` and `memory_near_full`. All are
851
+ numbers or booleans.
773
852
 
774
853
  **Upgrade order.** Upgrade and restart the bridge and the runtime together.
775
854
  First check `memory.provider` in the credential file of every daemon that a
776
855
  global install reaches (`jq .memory.provider <credential-file>`).
777
856
 
778
- **Rollback.** A 0.26.x bridge leaves the notes sealed on disk and reads
779
- neither the notes nor the legacy facts already moved into them, until it is
780
- upgraded again; the same holds for a 0.9.x runtime. Roll back the runtime and
781
- the bridge together, and restart both: the bridge decides once per process
782
- that a notes-reading runtime is present.
783
-
784
- ## Semantic memory: model download and retention
785
-
786
- <!-- [COPY, NEW] the three paragraphs below, the log-line paragraph included (7b Task 19, spec §19 LOW; first sentence corrected in the 7b-2 final-review fix round). Gate: Eric sign-off before npm publish (release PR). -->
787
-
788
- Semantic memory downloads its model from downloads.securecoms.ai when the owner first messages the agent in their private chat after semantic memory is turned on, not when the setting is saved. On a machine that must make no such connection, set `memory.model_source` to `import_only` in the credential file and copy the model bundle in with `agent-bridge models import <dir>`.
789
-
790
- If you change the memory provider or turn off owner-DM defaults, semantic memory rows stay on the machine until their retention ends, but they are never used.
791
-
792
- The bridge logs `memory.model_download_enabled` (no fields) once per process
793
- when semantic memory is turned on with `model_source` `download`.
794
-
795
- <!-- [COPY, NEW] (7b Task 19 fix round 2). Gate: Eric sign-off before npm publish (release PR). -->
796
-
797
- If you embed the bridge as a library (`new BridgeAgent(cfg, deps)`), semantic recall stays inert unless you pass `hostMachine: true`: no model is downloaded or loaded, and no call heartbeat is written. The `agent-bridge` command passes it for you.
857
+ **Rollback.** Roll back the bridge and the runtime together, to 0.28.2 and
858
+ 0.11.0, and restart both. A 0.28.2 bridge opens the database, ignores the
859
+ unified tables, and works on the old notes, semantic memory rows and history
860
+ that 0.29.0 kept. It does not see what 0.29.0 saved, pinned facts included. It
861
+ never removes or clears the unified tables, so the size limit does not apply
862
+ to them until you upgrade again. When 0.29.0 starts again, before it serves
863
+ anything, it removes copied pins whose old note was deleted during the
864
+ rollback, removes copied memories whose message was forgotten, and applies a
865
+ Clear all done during the rollback. Old rows added during the rollback are
866
+ copied after the owner's next typed message.
798
867
 
799
868
  ---
800
869
 
870
+ ## Release notes: 0.29.0
871
+
872
+ <!-- [COPY, NEW] Approved by Eric 2026-10-11 (plan Task 37). -->
873
+
874
+ 0.29.0 turns on unified memory in the owner's private chat. Install it
875
+ together with `@securecoms/agent-runtime` 0.12.0 and restart both. See
876
+ "Unified memory (0.29.0)" above.
877
+
878
+ - **One memory.** Typed messages, spoken call turns, the agent's replies and
879
+ pinned facts are kept in one sealed memory. Rooms and other people's private
880
+ chats are not remembered in this release.
881
+ - **Old memory moves.** 0.27 notes and 0.28 semantic memory rows are copied in
882
+ after the owner's next typed message. The old tables stay for one release.
883
+ - **Limits.** 2 GB or 100,000 memories, whichever comes first. Pinned facts are
884
+ never removed.
885
+ - **RAM.** About 102 to 104 MiB more per agent at 100,000 memories
886
+ (measured in a standalone process, not yet inside a running bridge).
887
+ - **Off switches.** A new credential key, `memory.enabled: false`, turns memory
888
+ off on the machine. `SECURECOMS_TOOL_DENY=memory_note` now removes only the
889
+ pin and forget tool; automatic memory continues.
890
+ - **Skills in the owner's private chat.** With runtime 0.12.0, the memory
891
+ tool gate refuses every skill on the owner's private-chat turns. Only
892
+ `current_time`, `echo`, `memory_note`, and `web_search`, `fetch_url`,
893
+ `http_request` (GET) and `sql_query` with arguments that pass the gate, run
894
+ there. Skills in rooms are not changed.
895
+ - **`/healthz`.** New `memory_hot_bytes`, `memory_deadline_misses`,
896
+ `memory_reads`, `memory_reads_discarded` and `pid`.
897
+
801
898
  ## Release notes: 0.28.2
802
899
 
803
900
  <!-- [COPY, NEW] this section. Approved by Eric 2026-10-09 ("approve 0.28.2 copy"). -->
@@ -816,7 +913,7 @@ unchanged.
816
913
 
817
914
  ## Release notes: 0.28.1
818
915
 
819
- <!-- [COPY, NEW] this section. Gate: Eric sign-off before npm publish (release PR). -->
916
+ <!-- [COPY, NEW] this section. Approved by Eric 2026-10-09. -->
820
917
 
821
918
  0.28.1 makes semantic memory recall more reliable. Install it in place of
822
919
  0.28.0 and restart the bridge. `@securecoms/agent-runtime` 0.11.0 is unchanged.
@@ -845,7 +942,7 @@ with `@securecoms/agent-runtime` 0.11.0 and restart both.
845
942
  - **`import_only`.** Set `memory.model_source` to `import_only` on a machine
846
943
  that must make no model download.
847
944
  - **`models import`.** `agent-bridge models import <dir>` copies a model bundle
848
- in for `import_only` machines. <!-- [COPY, NEW] the one-line CLI confirmation "imported <names>" printed by `models import` (src/bin.ts). Gate: Eric sign-off before npm publish (release PR). -->
945
+ in for `import_only` machines. <!-- [COPY, NEW] the one-line CLI confirmation "imported <names>" printed by `models import` (src/bin.ts). Approved by Eric 2026-10-09. -->
849
946
 
850
947
  ## Test commands
851
948