Skip to main content

Module mem

Module mem 

Source
Expand description

memstead mem init / memstead mem delete — full-only mem-lifecycle CLI front-ends.

Both subcommands call the engine in-process via memstead_engine::mem_management::create_mem / delete_mem. An earlier design spawned memstead-mcp --operator-mode as a child process and drove the matching MCP tool over JSON-RPC — wire-format parity with the agent path was the intent, but the CLI-as-MCP-consumer relationship cut against the layering posture that CLI, MCP, and UniFFI are sibling surfaces over the engine (AGENTS.md’s parity rule). In-process collapses CLI and MCP onto the same Rust call, with operator_mode: true hardcoded at the call site so the engine bypasses the [[mem_management.create]] / [[mem_management.delete]] allowlists and the MEM_REFERENCED_BY_POLICY safeguard for these two operator-tool surfaces (matching the spirit of the transport-establishes-posture rule).

Outer-repo gitignore: a CLI-only concern. The shared helper in crate::outer_gitignore walks upward from the workspace root looking for an enclosing .git/, then idempotently appends the workspace path (or mem-repo/ inside it) to the outer repo’s .gitignore. Refused for $HOME and disabled by --no-gitignore.

Structs§

DeleteArgs
memstead mem delete <name> arguments — full destruction. The CLI honours the workspace [[mem_management.delete]] allowlist by default; pass --operator-mode or set MEMSTEAD_OPERATOR_MODE=1 to skip the allowlist. The MEM_REFERENCED_BY_POLICY and MEM_HAS_INCOMING_REFS safeguards always fire regardless of operator-mode. The verb uniquely identifies the storage-destroying intent — use memstead mem unregister for router-only removal.
InitArgs
memstead mem init <path> arguments.
ListArgs
memstead mem list — no positional args. The verb itself is the signal; --json (root-level) toggles the output shape.
SetDescriptionArgs
memstead mem set-description <NAME> <DESCRIPTION> arguments.
SetInternalArgs
memstead mem set-internal <NAME> [--off] arguments.
SetSchemaArgs
memstead mem set-schema <NAME> <SCHEMA> arguments.
SetSyncStateArgs
memstead mem set-sync-state <NAME> <KEY> <TOKEN> arguments.
SetVersionArgs
memstead mem set-version <NAME> <VERSION> arguments.
UnregisterArgs
memstead mem unregister <name> arguments — router-only removal, storage preserved. The CLI honours the workspace [[mem_management.delete]] allowlist by default; pass --operator-mode or set MEMSTEAD_OPERATOR_MODE=1 to skip the allowlist. The MEM_REFERENCED_BY_POLICY safeguard does not apply to unregister (storage is preserved), so unregistering a mem with cross-mem grants pointing at it succeeds without refusing — the data the grants rely on survives.

Enums§

MemAction
Subcommands under memstead mem.

Functions§

run
run_delete
run_list
run_set_description
memstead mem set-description <NAME> <DESCRIPTION> — set or clear the mem’s one-line description via the in-process engine, persisting through the backend’s write_mem_config. Like set-version, this surface is gate-free and calls the engine directly. An empty DESCRIPTION clears the field.
run_set_internal
memstead mem set-internal <NAME> [--off] — mark or unmark a mem as internal (hidden from the default overview roster + public projections).
run_set_schema
run_set_sync_state
memstead mem set-sync-state <NAME> <KEY> <TOKEN> — set or clear one opaque sync-state token in a mem’s config via the in-process engine, persisting through the backend’s write_mem_config. Like set-version, this surface is gate-free and calls the engine directly.
run_set_version
memstead mem set-version <NAME> <VERSION> — bump the mem’s version field via the in-process engine, persisting through the backend’s write_mem_config. Unlike init / delete, this surface doesn’t spawn the MCP subprocess: set-version is gate-free (no operator-mode bypass needed), so a direct engine call keeps the implementation simpler and faster.
run_unregister