Expand description
Mem configuration loading, validation, and top-level CRUD.
Handles .memstead/config.json parsing, cross-field validation, and the
update_config_field write helper. Projections/mediums, their
validators, and the pre-rework migration have been dropped by the
workspace rewrite — projections / mediums
survive as unknown keys captured into MemConfig.extra so legacy
configs still round-trip, but the engine does not interpret them.
Port of @memstead/config (config-contract.js, index.js) and @agent-adapters/config-mcp (workspace.js).
Structs§
- Community
Override - Community detection override.
- Config
Check Result - Result of config validation — errors are fatal, warnings are informational.
- MemConfig
- Full mem configuration loaded from .memstead/config.json.
- Publish
Config - Publish config.
- Published
MemConfig - Strict-ingress shape of a mem config. This is the only metadata
form that enters a
.memarchive.MemConfigcarries author-only fields (writeGuidance, rules, publish, readMems, language, community, defaultSchema, vcs, plus any key captured inextra) that never belong in a published archive;published_config_fromprojectsMemConfig→PublishedMemConfig, dropping everything outside the whitelist. - Read
MemSpec - One entry in
MemConfig.read_mems— a read-only sealed mem archive attached to the primary mem as reference material. - Role
Config - Role-based publish config.
- Schema
Ref - Reference to a schema by exact name and version —
name@x.y.z. - VcsConfig
- VCS layout for a writable mem — optional
{ gitdir, worktree }pair in.memstead/config.json. When absent, the engine resolves the default:.git/at mem root with.as worktree.
Enums§
- Config
Error - Publish
Conversion Error - Errors returned by
published_config_from. Actionable messages — the caller (export pipeline, publish pipeline) surfaces these directly to the user without wrapping a raw serde error. - Read
MemSource - How the app reconstitutes a read mem’s cache file when missing.
Constants§
- ARCHIVE_
CONFIG_ PATH - Member path of the published config inside a sealed archive.
- ARCHIVE_
EXTENSION - File extension (without dot) of a sealed archive — the sole spelling. The one deliberately-distinct token in a project that is otherwise “memstead” everywhere — short, and derived from the project name.
- ARCHIVE_
META_ DIR - In-zip meta directory of a sealed archive — the only spelling.
- ARCHIVE_
PROVENANCE_ PATH - Member path of the optional authoring-provenance payload inside a
sealed archive (see
crate::archive_provenance). Additive: archives predating provenance omit it, and an engine that does not recognise it tolerates it as an unknown meta member. - ARCHIVE_
SCHEMA_ PREFIX - Member-path prefix of the embedded schema tree (manifest at
<prefix>schema.yaml, type files under<prefix>types/). - MEM_
META_ DIR - The per-mem engine-internal directory under a folder mem’s
root —
<mem_root>/.memstead/holdsconfig.jsonandchanges.jsonl. Defined here (rather than inmemstead-base) because mem-config loading lives in this crate andmemstead-basedepends on it;memstead-basere-exports the constant for downstream consumers. Distinct from the workspace store directory (memstead_base::WORKSPACE_STORE_DIR) and from the in-zip member paths inside sealed archives (ARCHIVE_META_DIR), which are a separate on-disk format and never use this constant. - PUBLISHED_
MEM_ FORMAT - Archive format integer written to the archive config’s
formatfield. Bumped to3for the schema-path relocation (embedded schema moved from top-levelschema/to the meta-dir schema tree).format: 1(V1) andformat: 2(V2, top-levelschema/tree) archives are rejected cleanly (pre-release, no external users to migrate).
Functions§
- check_
config - Validate a raw config JSON value. Returns structured errors and warnings.
- load_
and_ validate - Load, validate, and parse a mem config from disk.
- load_
config - Load and parse a config from a mem directory.
Reads
<mem_dir>/.memstead/config.json. - parse_
mem_ config - Parse a raw JSON value into a MemConfig.
- published_
config_ from - The whitelist projection. Everything author-only is discarded; only
the fields that make sense outside the author’s working directory
ride into the archive.
formatis pinned atPUBLISHED_MEM_FORMAT. - update_
config_ field - Update a top-level config field.