Architecture

How Mneme works, precisely

Technical deep dives into the enforcement path: retrieval scoring, rule evaluation, decision memory, and the design choices behind them. Enforcement is deterministic, with no embeddings or model judgment in the verdict path.

The big picture: Mneme sits as its own layer of the AI engineering stack, alongside CI/CD and testing. The runtime stack below shows where it operates: in the Governance infrastructure layer.
Position in the AI engineering stack A vertical stack of layers: Applications at the top, then AI coding agents, then the Mneme HQ decision and control layer (emphasized), then architectural knowledge (ADRs, standards, project memory), then infrastructure (Git, CI/CD, tests). Mneme sits as its own layer alongside the others rather than replacing them. POSITION IN THE AI ENGINEERING STACK Applications AI coding agents Claude Code · Codex CLI · Kiro · Claude Agent SDK Mneme HQ Decision and Control Layer enforce · before generation · across supported agents Architectural knowledge ADRs · Standards · Project memory Infrastructure Git · CI/CD · Tests A layer alongside CI/CD, testing, and review — not a replacement for them.

An autonomous agent system is not one layer. Models produce candidate output. Harnesses coordinate execution, retries, and tool use. Execution systems maintain long-running loops, sessions, and memory. Governance infrastructure defines and enforces the architectural constraints the output must satisfy. Verification confirms the resulting system still passes its objective checks. Mneme operates in the governance infrastructure layer as the decision and control layer. It stays logically separate from harnesses and execution systems and connects to them at supported mutation, model-middleware, and CI boundaries.

5
Verification · enforcement Tests, builds, deploy-time checks, deterministic verdicts
4
Governance infrastructure Decision graph, applicability, precedence, pre-generation enforcement, propagation across surfaces — Mneme's layer
3
Execution systems Long-running loops, sessions, memory, continuity infrastructure
2
Harnesses Tool orchestration, retries, planning loops, context lifecycle
1
Models Candidate output, generation, probability over tokens

Harnesses coordinate execution; governance defines constraints; verification enforces invariants. None of those layers can do the others' jobs. The argument in full: Harness Engineering Still Needs Governance. The concept page that anchors this stack: Governance Infrastructure.

Layer 4 above answers what has been decided and whether it applies. A separate class of tooling — code review, PR prioritization, change-management systems — answers what changed and whether it is safe to ship. Both are necessary. Neither can do the other's job.

Decision plane · Mneme

  • What architecture has been decided?
  • Which decision applies here?
  • Is it authoritative?
  • What constraint follows?
  • Can this action proceed?

Change plane · review & change management

  • What changed?
  • Is the implementation correct?
  • What risk does it introduce?
  • Which PR deserves attention?
  • Is it ready to merge?

The two planes compose over MCP rather than merge: a change-management system could ask Mneme's Decision Index which decisions govern a proposed change, while keeping full ownership of review, risk scoring, and merge readiness. MCP is the interoperability boundary that would make that composition possible; the local Decision MCP server, introduced in 0.9.0, runs as a stdio process. See the MCP integration overview for how that boundary is defined.

A developer sketching a flow by hand, application code open on the monitor behind
Architecture starts as a human sketch. Mneme is what keeps it true after the agents take over.

Inside Layer 4 · enforcement path
MemoryStore
→
DecisionRetriever
→
Enforcement scope
→
Rule evaluation
→
PASS / WARN / FAIL

mneme check loads project_memory.json, scores each decision against the query with fixed field weights, resolves which rules apply to the target path, and evaluates the proposed content. It returns PASS, WARN, or FAIL and makes no model call. Typed literal rules and single-term rules run against the whole decision corpus. The top three ranked decisions also have their multi-term rules checked. If Mneme cannot resolve path applicability for a scoped rule, the run reports INCOMPLETE, an operational state that sits outside the three policy verdicts. Same query, same content, same memory file, same result.

→

Read the source

DecisionRetriever, MemoryStore, ContextBuilder, and the benchmark harness are all open source under MIT.

View on GitHub →