Skip to main content

Module global_memory

Module global_memory 

Source
Expand description

Global Memory MuxAPI bodies, moved out of app_api/mod.rs unchanged (SPEC_LARGE_FILE_MODULE_ANALYSIS_2026_09_30.md item 9).

Structs§

GlobalMemoryWriteProvenance 🔒
Caller-supplied provenance for a globalmemory.write call — same shape as MemoryWriteProvenance above; kept as a distinct type since callers are conceptually different (an agent writing to a workspace-wide list every other agent inherits, not its own private memory) even though the wire shape is identical.

Functions§

append_to_global_order 🔒
append_to_order on a store, for the window-side restore too.
append_to_order 🔒
Puts bundle_id last in the Global Memory order, as Memory → Global’s own “+ New section” does for a new entry and a restored one. A failed reorder is logged, not fatal: the entry is saved either way.
bundle_version_diff 🔒
The diff text global_memory_diff_impl returns — a - name:/+ name: pair when the name changed (see that function’s doc comment for why), then line_diff over the instructions. Shared with Memory → Global’s globalmemory:diff WebSocket command (agent_handlers/bundle.rs) so the MCP tool and the UI can never render the same pair of versions two ways.
check_reach 🔒
reach as a Global Memory write or the reach action takes it, or why not.
global_memory_diff_impl 🔒
A line-based diff between two recorded versions of one Global Memory entry (mirrors memory_diff_impl). Both versions must belong to id — reagent P1 in memory_diff_impl fixed the identical “diff across two unrelated owners” gap for native memory; the same check applies here since a version_id alone does not otherwise prove which bundle (and therefore whether a system-tier one) it came from. A name change is surfaced as its own two-line entry ahead of the instructions diff, since content_hash is computed over name + instructions together (bundle_versions.rs’s own content_hash doc comment) — a rename with unchanged body would otherwise produce a “no differences” instructions diff that silently hid the one thing that actually changed. Backs the GlobalMemoryDiff MCP tool.
global_memory_history_impl 🔒
Version history for one Global Memory entry, newest first — metadata only, no name/instructions (mirrors memory_history_impl’s summary shape and global_memory_list_impl’s “no content” posture). Refuses a system-tier, blank, or non-global id via load_ordinary_global_bundle — structurally the same exclusion list/read/remove already apply, so there is no path here that can ever surface a system-tier row’s history. Backs the GlobalMemoryHistory MCP tool.
global_memory_list_impl 🔒
Every Global Memory entry Memory → Global shows — id/name/updated_at/system, no content (mirrors memory_list_impl’s summary shape), system rows first as bundle_list_global orders them. System-tier rows are listed so an empty result means “nothing” and not “nothing you may touch” (the pane lists them too, and their content is already injected into every agent’s context); what stays structural is that read, write and remove refuse a system id. removed lists the entries taken out of Global Memory and not restored, most recent first, with when and by whom: each one’s id works with history, diff and revert. Backs the GlobalMemoryList MCP tool. docs/specs/SPEC_GLOBAL_MEMORY_LIST_SYSTEM_ROWS_2026_10_02.md
global_memory_reach_impl 🔒
Sets where an existing ordinary Global Memory entry goes, without touching its text: fleet (pushed to every proven machine, last write wins) or machine (stays here; a copy another machine pushes is skipped). Same ownership guards as write and remove. Backs the reach action of the Memory tool.
global_memory_reaches 🔒
Every Global Memory entry’s reach, for the Memory pane. Backs globalmemory:reach_list.
global_memory_read_impl 🔒
Full content of one ordinary Global Memory entry by id. Refuses a system-tier id, same reasoning as write. Backs the GlobalMemoryRead MCP tool.
global_memory_remove_impl 🔒
Demotes a Global Memory entry (clears is_global) — matches Memory → Global’s own “Remove” semantics: the bundle row itself survives (still available in Memory → Bundles), only its Global Memory membership is cleared. Refuses a system-tier id, the blank singleton, or any id that wasn’t ALREADY a Global Memory entry before this call — same ownership guards as global_memory_write_impl, for the identical reason: bundle ids are enumerable via PresetList regardless of is_global.
global_memory_revert_impl 🔒
Restores a Global Memory entry’s live name/instructions to a prior recorded version — same “revert never rewrites history, it records a new version” semantics as memory_revert_impl (source: "revert", chained onto whatever the current latest version is). Reuses Store::bundle_upsert_with_version — the SAME primitive global_memory_write_impl already uses — so the live row and its new version are written atomically, in one transaction, exactly as that method’s own doc comment requires (codex P2, PR #3237). agent_id is the TRUSTED caller identity (an agent’s real AGENTMUX_AGENT_ID, resolved by agentmux-mcp from its own env, never caller-suppliable) recorded as written_by — never inferred from anything in the request body. written_by_uid is recorded beside it: the request’s Caller UID (identity M4c-1), "" when Unattributed. Backs the GlobalMemoryRevert MCP tool.
global_memory_write_impl 🔒
Creates a new ordinary Global Memory entry, or updates an existing one by id. Backs the GlobalMemoryWrite MCP tool.
global_memory_write_inner 🔒
global_memory_write_impl, running before_write with the entry’s id (the existing one, or the new one) just before the entry is saved. If it fails, nothing is saved.
global_memory_write_with_reach_impl 🔒
global_memory_write_impl, with the entry’s reach set when the caller gave one. The reach is checked first, so a bad one writes nothing, and it is set before the entry is saved: an entry with no reach row counts as fleet, so setting it afterwards would leave a machine entry visible to the fleet in between, and for good if setting it then failed.
load_ordinary_global_bundle 🔒
Loads id’s bundle and refuses it unless it is (a) not the blank singleton, (b) not a system-tier entry, and (c) a Global Memory entry (is_global) or one removed from Global Memory and not restored since (its newest version is a remove one, which only a removal writes) — the guard global_memory_write_impl/global_memory_remove_impl apply, plus the removed case so a removal can be inspected and undone. Bundle ids for EVERY bundle in the system (not just global ones) are enumerable via PresetList (reagent P0/P1, PR #3237) — without this, an agent could point any of these three new routes at another agent’s private preset, or at AgentMux’s own system-tier entries, and read/restore content that was never meant to be reachable through this API.
reach_of 🔒
Where an entry goes: fleet (every proven machine, last write wins) or machine (this one only). AgentMux’s own system entries never leave the machine.
recorded_provenance 🔒
What a write through the agent route records as its source and detail. srv names the source: the labels it uses itself for who wrote (human, armory-ui, revert, jekt, agent) are never taken from the caller, so a caller cannot have its write read as the person’s or as a revert. The caller’s own label stays what it is for a note (agent_inferred when it gives none), and one of those reserved words moves into the detail as claimed_source.
removed_global_entries 🔒
The entries taken out of Global Memory and not restored, most recently removed first, each with the remove version that records it: who removed it and when. Shared by list’s removed and the window’s globalmemory:removed.
version_meta_json 🔒
A version’s metadata as JSON: GlobalMemoryVersionMeta, the same shape globalmemory:history sends the pane, with no name/instructions.
with_peers_not_in_step 🔒
A write’s answer, with the machines the last sync did not bring up to date (one that could not be reached, one that kept an entry back and why): this write may not reach them either. Said here, not only in list. Nothing is added when every machine is in step.

Type Aliases§

BeforeWrite 🔒
What a write does with the entry’s id once it is known and before the entry is saved.