SuperAPI AI Directory

memoryguard

Local-first governed shared memory for coding agents with CLI and desktop console: classify, dedupe, supersede, quarantine and roll back memories.

Open website

About this tool

MemoryGuard is a local-first MCP memory governance tool for coding agents, officially positioned as "Governed shared memory for coding agents." It supports coding hosts such as Codex, Claude Code, Cursor, Grok, and Trae, aiming to allow agents to continuously write without letting shared memory become an unreviewed accumulation. Its core idea is: persistent memory solves the storage problem, not the governance problem; when multiple coding agents write to the same context, records can become duplicated, outdated, contradictory, overly broad in scope, or unsafely reused, and MemoryGuard sits between agents and shared memory to keep context usable.

[Purpose and Positioning] MemoryGuard organizes every write, preserves the evidence behind changes, and keeps governance decisions reversible. It has no account system, no remote servers, and no remote telemetry; optional local usage telemetry stores only bounded, privacy-protected local aggregate data. All governed data remains local by default unless the user explicitly authorizes remote model or embedding operations.

[Main Capabilities]

  1. Memory governance: automatic organization, classification, deduplication, supersede, quarantine, and rollback of writes. Quarantined records do not enter active shared memory.
  2. Rules and lifecycle: rule lifecycle and RuleMerge, forced rule replacement and recovery; during replacement, it verifies whether the final forced rule bundle satisfies audience matching, canonical rules, deduplication, sensitivity checks, and release budget, retires equivalent and unlocked predecessors in the same transaction, and rolls back entirely if verification fails.
  3. Evidence and audit: preserves change evidence, supports Reference Audit, per-domain SQLite health checks, controlled maintenance, rollback evidence, and safe unbound diagnostics.
  4. Conflict resolution: the conflict view preserves readable peer information, and resolution keeps peer groups intact and atomically applies the selected changes; ambiguous conflicts remain unresolved.
  5. Token evidence and savings view: distinguishes measured_cached_input from measured_cache_write_input; measured_cache_coverage.cache_read and cache_write report complete, partial, or unavailable; missing provider data remains None/unavailable, while character-based estimates are always explicitly labeled as estimated mg_deterministic_unit and are never treated as provider tokens.
  6. Desktop governance console (memoryguard-gui): includes eight visible navigation entries—seven governance pages plus a separate Token Usage & Savings view. The seven governance pages include Governance Overview, Data Sources & Agents, Conversation History, Risk Signals & Governance Console, etc.; the Agent list uses readable program/provider names, underlying IDs are retained in the detail view, and empty data is explicitly shown as an empty state.
  7. Knowledge Library: can turn a selected folder or set of files into a governed local knowledge base; source files remain in place, and MemoryGuard stores a searchable index in the user data home directory instead of copying a runtime database into each source project. Remote embedding or model indexing is optional and requires explicit authorization; local full-text search does not need to send source text to a remote provider.
  8. CodeGraph: as of v0.7.15, trusted bootstrap starts the project's first build in a background process; supports switching between file overview and symbols, filtering by file, viewing adjacency relationships, and zoom controls. The first CodeGraph build requires explicit confirmation; after a scoped build is complete, each successful trusted file write can trigger an incremental refresh, unchanged content hashes result in a no-op, and deleted files are retired.

[Usage and Installation] MemoryGuard runs as a local stdio MCP server, is exposed in the MCP Registry, identified as io.github.MerakOsiris/memoryguard, and its registration metadata is stored in server.json. Installation process (overview from the official documentation):

  1. Install via the Python package manager and configure the desktop governance console;
  2. Authorize the current project;
  3. Connect or repair the coding agent (installation guidance is provided for providers such as Claude Code, Codex, and Cursor). Global provider configuration is rebuilt from the real bindings in the canonical user data home directory, the command is idempotent, and after a successful global takeover, the superseded project-level MemoryGuard overrides are removed. After installation, restart the host and verify the setYes. Desktop console launch: memoryguard-gui; the bare command memoryguard gui always opens the canonical user-level control directory (on Windows, by default %LOCALAPPDATA%\MemoryGuard), so running it from a project directory or from C:\Windows\System32 will not silently switch databases. MEMORYGUARD_WORKSPACE is an explicit operator override; the explicit memoryguard gui <project-path> or memoryguard gui --workspace <project-path> selects a specific workspace. On Windows, memoryguard gui detaches the native window from the terminal, so closing PowerShell will not close the GUI. Upgrades: upgrade via the Python package manager, and preserve the GUI extra (if installed); there is no package self-update command, and the package manager is the authoritative package upgrade path; memoryguard upgrade is an explicit workspace migration process, not a package updater. V1 data home upgrade: first upgrade the package, then run the verified migration; a normal user-level data home requires no workspace, data-home, apply, or confirmation parameters; this command prepares V2, validates the frozen source and active source evidence, migrates Agent/Group control, activates only after all gates pass, and deletes only the backup batches belonging to that successful migration; repeated runs on V2_ACTIVE are idempotent, and a zero-write report can be obtained with the corresponding parameter. Explicit V2 switch for an existing pre-V2 workspace: v0.6.0 never automatically activates an existing workspace; you must first upgrade the package and then use the bundled operator CLI; the prepare step uses a consistent SQLite online backup, preserves V1 and migration-backups, and rechecks active source drift before READY; perform another drift check before activation; do not delete old V1 data or migration backups during the upgrade.

[Data architecture and privacy] V2 uses mutually independent authoritative SQLite domains rather than a single shared memory database: Memory, Rules, Evidence, Content, Runtime, Projection, Assets, CodeGraph, Skills, System Separated from each other; History, Source, Binding, and Group control are V2 native surfaces. At runtime, V2 is read and written only after the manifest reaches V2_ACTIVE; V2_BUILDING and V2_READY never silently fall back or dual-write. The switch flow V1_ACTIVE → V2_BUILDING → V2_READY → V2_ACTIVE is fail-closed. Migration is lossless migration, retaining V1 data and migration backups for rollback; old V1 artifacts are retained after the switch as local rollback/audit evidence, are no longer on the active V2 runtime write path, and can only be read by memoryguard.migration. Source scanning is read-only by default; change-type governance paths use validation, explicit scope, provenance, and reversible state; shared group history access follows current active member identity and does not grant permission to delete other Agents' sources; raw conversation history is not automatically injected into the bootstrap flow. Token savings are estimates based on MemoryGuard deterministic units, not provider billing claims; hosts that do not report tokens remain unsupported in the measured column.

[Supported Hosts and Status] Provider status is reported truthfully as redirected, observed, operational, or unsupported. MemoryGuard does not claim to be able to disable every host's native memory (when a host has no reliable integration point). Codex/Router binds MemoryGuard to a stable local Codex program and control installation; account profiles are endpoints/aliases, not new memory owners, and switching profiles automatically discovers or repairs that profile and reuses the verified Agent binding and active group; request identity remains fail-closed and does not share records across machines or with arbitrary accounts.

[Command Line and Compatibility] The installed memoryguard command exposes top-level operations; the old V1 plan, apply, verify, undo, import, and gc workflows may still be parsed as explicitly retired compatibility surfaces, but they are not the V1 runtime path and under V2_ACTIVE return stable retirement results rather than writing through old storage; old data input is accepted only by the explicit memoryguard.migration upgrade flow. Run memoryguard --help or memoryguard <command> --help to view specific instructions.

[Limitations] The synthetic graphic works in the repository used to illustrate governance projections are not live product screenshots and do not constitute evidence of usage or savings; benchmarks should be run only against authorized local workspaces. Other features, charges, prices, platforms, or specific command details not explicitly provided in the materials are not yet available.