LEVEL 3 · ENGINEER

Persistent Memory Server

A persistent memory workbench with revision history and one boundary for REST and MCP. Set MEMORY_TOKEN in the environment and run node cli.ts --data-dir memory-data --serve --port 8788. REST and MCP share the same store; no token is written into files.

4 stages~8 hoursTypeScript, Rustcore
Keep text, namespace and provenance togetherSerialize revisioned writesScore vectors in a real Rust processExpose REST and MCP tools
YOU END UP WITH

A persistent memory workbench with revision history and one boundary for REST and MCP.

USEFUL FOR
  • Set MEMORY_TOKEN in the environment and run node cli.ts --data-dir memory-data --serve --port 8788. REST and MCP share the same store; no token is written into files.
LEARN FIRST
  • Node 22.18+, Rust 2021 and Python 3 for the grader
  • promises, append logs, HTTP, namespaces, revisions and vector dot products.
PROJECT OUTLINE

Persistent Memory Server in 4 stages

A persistent memory workbench with revision history and one boundary for REST and MCP.

  1. Keep text, namespace and provenance together

    Every memory needs a bounded id, namespace, text and source locator. Never return a detached string without its provenance. The small feature-hashing embedding maps normalized terms into a fixed vector; it is a deterministic lexical projection, not a pretrained semantic model. Hash collisions are expected and explain why lexical evidence remains part of retrieval.

    starter · ~2 hours · TypeScript

    validateMemoryembed
  2. Serialize revisioned writes

    Load a versioned event log and reconstruct the latest record for each namespace/id pair. An update must name its expected revision. Serialize writes so two callers racing from revision zero cannot both succeed. Append before mutating the in-memory map. This is a single-process store: append completion is not a power-loss durability guarantee, and multiple server processes require an external lock or database.

    core · ~2 hours · TypeScript

    MemoryStore.putMemoryStore.list
  3. Score vectors in a real Rust process

    Compile score.rs with the standard Rust toolchain and send query and document vectors over stdin. Compute cosine similarity, returning zero for a zero-norm vector. Combine 60 percent lexical query coverage with 40 percent cosine score and use ids to break ties. Test dimensions and finite values before crossing the process boundary. The Rust binary is compiled into a private temporary directory and removed on normal process exit.

    core · ~2 hours · TypeScript

    cosineScoresMemoryStore.search
  4. Expose REST and MCP tools

    Bind a local server, require a bearer token, bound request bodies, and implement health, REST writes/search and the MCP initialization/tools subset over JSON-RPC POST. Tool execution failures use isError inside a successful JSON-RPC response; unknown protocol methods use a JSON-RPC error. This is a teaching subset without sessions, streaming or production authentication. Test actual HTTP bytes so serialization cannot drop source or revision.

    core · ~2 hours · TypeScript

    createMemoryServer

All projects · Course catalog · Source on GitHub