Expand description
The memfork command: an MCP server, a shared daemon and a command line.
MemFork gives an agent branchable memory — store and recall things, fork
the whole of memory before a risky step, then merge the fork or discard it.
This crate is what a user installs; the engine underneath is
memfork_core.
Most people never call this library. They install the binary and run:
memfork init # register the MCP server with the clients they have
memfork doctor # what is installed, and what is talking to itThe library exists because the binary is a thin shell over it, which lets each piece be tested directly rather than only through a subprocess — and because the Python package on PyPI offers the same command through an entry point, so the two must not drift apart.
// What `memfork mcp` does, minus the argument parsing.
use std::sync::Arc;
use memfork::tools::dispatch::Session;
let session = Arc::new(Session::new(memfork_core::Db::new()));
memfork::mcp::serve_stdio(session).await§What is where
toolsis the tool registry: one set of definitions serving the MCP server, the vendor function-calling formats andmemfork call.mcpserves those tools over stdio, andserveserves them over loopback HTTP for the daemon.proxyis what a client actually talks to: it answers the handshake itself and forwards tool calls to the daemon, starting one if none is running.clientsis the client adapter registry and the config editors behindinit, which registers MemFork with the MCP clients on the machine.doctorreports what this install is and what it is talking to.persistis the write-ahead log, snapshots and the lock that gives one process ownership of a data directory.launchworks out how to start MemFork again, which is not the same question as “where is this executable” once a Python wheel is involved.runis the command line itself.
§Memory is kept, and shared
What an agent stores is written to a data directory and is still there next
time. Several clients can use one store at once: the first that needs it
starts a daemon that owns the directory, and the rest connect to that,
while each keeps its own current branch. --ephemeral keeps nothing and
shares nothing.
The project README covers installation and the full command reference:
https://github.com/memforkdb/memfork. The design is in
docs/DESIGN.md.
Modules§
- agent
- A scripted agent: a client of the daemon that does exactly what it is told, with no model behind it.
- autopilot
- Autopilot: memory that protects itself (DESIGN §5.6).
- board
- The task board: tasks, and claims on them that expire (DESIGN §6.5).
- brain
- The Brain: a read-only page, served by the daemon on its loopback listener, that shows what the engine knows and what it decided.
- cli
- Command-line surface over the engine (DESIGN §5).
- client
- Talking to the daemon from the command line: operations, and the activity
stream for
memfork watch. - clients
- The client adapter registry (DESIGN §6.1).
- daemon
- Finding, starting and stopping the daemon.
- demo
memfork demo: the whole product moving, on a store that is thrown away.- doctor
memfork doctor— what this install is, and what it is talking to.- events
- What the daemon is doing, as it happens, for
memfork watch(DESIGN §5.3). - exec
- Executing a parsed command against an engine, and rendering the result.
- facts
- Verified facts: findings that know when they have gone stale (DESIGN §6.7).
- find
- Finding memory by text (DESIGN §6.6).
- flags
- Duplicates and contradictions, flagged and never fixed (DESIGN §6.12).
- history
- Drawing
memfork log --graph: every branch as a tree, newest first. - init
memfork init— register the MCP server with the clients installed here.- launch
- How to start another MemFork.
- lessons
- Lessons from discarded forks (DESIGN §6.9).
- maintenance
- Self-maintaining memory, using the agents’ own intelligence (DESIGN §6.13).
- mcp
memfork mcp— the MCP server over stdio (DESIGN §6).- namespace
- Project namespaces (DESIGN §6.3).
- persist
- Durability (DESIGN §4.5): the data directory, the lock, the log and the snapshot, tied into one thing a caller can open.
- plans
- Plans: tasks with dependencies and acceptance commands (DESIGN §6.11).
- policy
- The machine-wide policy an administrator can place (DESIGN §5.4).
- prompts
- MCP prompts: MemFork’s routines as one-step commands (DESIGN §6.14).
- proxy
- Forwarding a stdio MCP session to the daemon.
- render
- Turning a command’s result into lines for a person (DESIGN §5.2).
- run
- Everything
memforkthe command does (DESIGN §5). - secrets
- Keeping credentials out of shared memory (DESIGN §6.10).
- serve
memfork serve— the local daemon (DESIGN §5).- shared
- What every session in one process shares besides the store: the task board’s leases, the side structure of statistics and fact hashes, the file hasher’s cache, and the directory of connected sessions autopilot acts on.
- sidecar
- What the daemon keeps beside the store, outside its history (DESIGN §6.8).
- style
- Colour, glyphs and motion for what a person reads (DESIGN §5.2).
- tools
- The MCP tool surface (DESIGN §6), defined once and used everywhere.
Constants§
- VERSION
- The version of this crate.