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§
- Global
Memory 🔒Write Provenance - Caller-supplied provenance for a
globalmemory.writecall — same shape asMemoryWriteProvenanceabove; 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§
- bundle_
version_ 🔒diff - The diff text
global_memory_diff_implreturns — a- name:/+ name:pair when the name changed (see that function’s doc comment for why), thenline_diffover the instructions. Shared with Memory → Global’sglobalmemory:diffWebSocket command (agent_handlers/bundle.rs) so the MCP tool and the UI can never render the same pair of versions two ways. - bundle_
version_ 🔒meta_ json - A version’s metadata as JSON —
id/content_hash/parent_version_id/source/source_detail/written_by/created_at, noname/instructions. Takes the five common-field accessors as plain values rather than borrowing a concrete struct so bothBundleVersionSummary(thehistorylist shape) andBundleVersion(the full-content shaperevert’s freshly-inserted row comes back as) can share this one formatter without either type needing to convert into the other. - 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 toid— reagent P1 inmemory_diff_implfixed the identical “diff across two unrelated owners” gap for native memory; the same check applies here since aversion_idalone 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, sincecontent_hashis computed overname+instructionstogether (bundle_versions.rs’s owncontent_hashdoc comment) — a rename with unchanged body would otherwise produce a “no differences” instructions diff that silently hid the one thing that actually changed. Backs theGlobalMemoryDiffMCP tool. - global_
memory_ 🔒history_ impl - Version history for one Global Memory entry, newest first — metadata
only, no
name/instructions(mirrorsmemory_history_impl’s summary shape andglobal_memory_list_impl’s “no content” posture). Refuses a system-tier, blank, or non-global id viaload_ordinary_global_bundle— structurally the same exclusionlist/read/removealready apply, so there is no path here that can ever surface a system-tier row’s history. Backs theGlobalMemoryHistoryMCP 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 asbundle_list_globalorders 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. Backs theGlobalMemoryListMCP tool. docs/specs/SPEC_GLOBAL_MEMORY_LIST_SYSTEM_ROWS_2026_10_02.md - 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
GlobalMemoryReadMCP 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 asglobal_memory_write_impl, for the identical reason: bundle ids are enumerable viaPresetListregardless ofis_global. Backs theGlobalMemoryRemoveMCP tool. - global_
memory_ 🔒revert_ impl - Restores a Global Memory entry’s live
name/instructionsto a prior recorded version — same “revert never rewrites history, it records a new version” semantics asmemory_revert_impl(source: "revert", chained onto whatever the current latest version is). ReusesStore::bundle_upsert_with_version— the SAME primitiveglobal_memory_write_implalready 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_idis the TRUSTED caller identity (an agent’s realAGENTMUX_AGENT_ID, resolved byagentmux-mcpfrom its own env, never caller-suppliable) recorded aswritten_by— never inferred from anything in the request body.written_by_uidis recorded beside it: the request’sCallerUID (identity M4c-1),""when Unattributed. Backs theGlobalMemoryRevertMCP tool. - global_
memory_ 🔒write_ impl - Creates a new ordinary Global Memory entry, or updates an existing one
by
id. Backs theGlobalMemoryWriteMCP tool. - 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) currently a Global Memory entry (is_global) — the exact guardglobal_memory_write_impl/global_memory_remove_implalready apply, reused here rather than re-derived sohistory/diff/revertcan never diverge from it. Bundle ids for EVERY bundle in the system (not just global ones) are enumerable viaPresetList(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.