Skip to content

Reference

1. What is here

This tier documents the binary’s whole surface: every command, every flag, every value a caller can send or read back.

Each page is generated while the site builds, from the source that defines the thing it documents, so none of these pages exists as a file in the repository. Where a page states a count, that number is the length of an array in the source, so a page here cannot claim a command or a code the binary does not have.

The registries, and how many members each one holds:

Page Registry Members Source
reference/commands/… Commands 58 apps/cli/src/commands.ts
Global flags Global flags 3 apps/cli/src/commands.ts
Guide topics Guide topics 7 apps/cli/src/commands.ts
Response types Response types 58 apps/cli/src/envelope.ts
Error codes Error codes 25 apps/cli/src/envelope.ts
Environment variables Environment variables 25 apps/cli/src/config.ts
MCP tools MCP tools 15 apps/mcp/src/tools.ts
MCP resources MCP resources 2 apps/mcp/src/resources.ts
Closed vocabularies Closed vocabularies 9 packages/contracts/src/types.ts, packages/contracts/src/edges.ts
RRF arms RRF arms 4 packages/index/src/retrieval-sql.ts
Migrations Migrations 14 packages/index/migrations
Requirements Requirements 87 spec/memhtml.symspec.json
Workspace packages Workspace packages 17 apps/, packages/
Contract symbols Contract symbols 133 packages/contracts/src

2. The commands

memhtml accepts 58 commands, each with its own page below. A subcommand is one command with a space in its name, so memhtml index rebuild is a single entry rather than a tree.

Command Summary
memhtml manifest Emit this CLI’s full machine-readable contract.
memhtml help Describe one command: usage, arguments, flags, response type, examples. Markdown on a terminal, a cli.help envelope when piped.
memhtml init Scaffold a memory repo at --repo/$MEMHTML_ROOT: git init, PARA dirs, merge driver.
memhtml write Write one memory. Content-hash duplicates return the existing path, uncommitted.
memhtml apply Write many memories from a JSONL op stream: ONE commit, ONE index update, per-op results.
memhtml read Read one memory: its metas, links, article, and format warnings.
memhtml search Ranked search: four RRF arms plus MMR. Degrades to the lexical floor.
memhtml recall A disclosure pack under a character budget: arcs and memories folded separately.
memhtml correct Supersede a memory: write the new file and archive the target in ONE commit.
memhtml link Add an authored edge to the source file and commit it. Idempotent.
memhtml neighbors The memory graph around one path, to a fixed depth of at most two hops.
memhtml resolve Follow a possibly-moved path forward to the memory that carries the fact now.
memhtml archive Soft-evict: git mv into archive/<YYYY>/ (archive/<YYYY>.<n>/ when an earlier archiving holds that slot) with the archive stamps. Never a delete.
memhtml reinforce Bump access bookkeeping, gated by a 900-second per-path cooldown.
memhtml list Page through the corpus by type, workspace, tag, entity, facet, or PARA bucket.
memhtml entity activity Every entity with its file count and its last activity, newest first. Report only.
memhtml task add Open a task: a task memory in projects/<ws>/tasks/ or areas/inbox/tasks/.
memhtml task status Move a task’s status. done stamps AND archives it, in one commit.
memhtml task list The task working set: a direct indexed scan with blockers, never ranked retrieval.
memhtml index rebuild Rebuild index.db from the git tree at HEAD, keeping every stored vector whose chunk survives. Destroys nothing outside .memhtml/.
memhtml index update Index only what moved since the recorded watermark, plus the dirty working tree.
memhtml index embed Fill every chunk that has no vector in the configured space, without a rebuild. Safe to rerun; reports the gap it left.
memhtml index status The index watermark, the vector space it was built in, and its row counts.
memhtml trace index Scan $MEMHTML_TRACE_ROOT for Claude Code transcripts, reading only what changed.
memhtml trace search FTS over session first-prompts and AI titles. Never enters memory retrieval.
memhtml trace links The memory-session links, from either side.
memhtml status Corpus health: HEAD, dirty state, counts by type, edges, index freshness.
memhtml publish Regenerate index.html listings and sitemap.xml, remove stale listings, and commit.
memhtml doctor Corpus health: dangling hrefs, orphan state rows, inbox depth, vocabulary, staleness.
memhtml config Show the policy this store runs under and the process tuning this environment sets, each value with its source. store holds the keys of memhtml.config.json at the store root (writeBar.refusedTypes, writeBar.requireAnchor, v1Doors, curator.writerBuckets, curator.placementQuota), each file or default; file says where the file is, whether it exists, and whether git holds it as committed, modified, untracked, or absent; process holds the variables head serve reads (MEMHTML_EMBED_WARM_IDLE_MS, MEMHTML_EXEC_POOL_SIZE, MEMHTML_EXEC_WORKER_HEAP_MB), each env or default, with a problem when a value is one head serve would refuse. The file is read from the working tree at every decision, never cached, so what this shows is what the next write is judged by. Read-only. A file that does not decode is ERR_STORE_CONFIG at exit 1, naming what is wrong.
memhtml eval discriminate The refusable retrieval gate: every probe must outrank its own wrong-fact twins.
memhtml exec Run a read-only traversal script over the corpus in a sandbox: multi-hop in ONE execution.
memhtml state export Write .memhtml/state/access.jsonl, the only durable copy of the state plane, and commit.
memhtml state import Replay the committed sidecar into state.db. Counters merge by max, never last-wins.
memhtml agents-doc Regenerate AGENTS.md from this command table. --check fails on drift.
memhtml serve mcp Run the memhtml-mcp stdio server: 15 tools and 2 resources over this same repo.
memhtml integrations install Wire a coding agent to this store: its MCP entry, its hooks, a fenced block in its instruction file, and a skill, recorded in a receipt so uninstall removes exactly what install wrote.
memhtml integrations uninstall Remove exactly what install wrote for one host, matched against the receipt; a managed file that was modified since is refused.
memhtml integrations list For every host: installed, modified, or not installed, at user scope and at the named project scope.
memhtml integrations doctor Check a host’s wiring end to end: binary path and version, store root, MCP entry, hooks, instruction block, skill, transcript root, and a live initialize handshake with the server the entry names.
memhtml integrations shell Print an eval-able shell snippet that exports MEMHTML_ROOT and puts this binary’s directory on PATH; --write appends it to your rc file inside a fence.
memhtml hook The engine every installed hook calls. Reads the host’s hook payload on stdin, runs recall or transcript indexing under a hard time bound, and writes the HOST’S protocol to stdout (plain text or the host’s JSON), never this envelope; any failure prints nothing and exits 0, so a hook can never block a turn.
memhtml session start Open a v2 session on the ref’s tip: a pointer to that version plus an empty overlay log.
memhtml session put Append write ops, and label or unlabel ops on existing records, to a session’s overlay from a JSONL file.
memhtml session exec Run a script over the session’s view (head plus overlay) in a writable sandbox and harvest its writes into the overlay.
memhtml session commit Land the session’s overlay on its ref as one commit, or report why it cannot: refused, rebase-needed, or worktree-dirty.
memhtml session rebase Move a session’s base to its ref’s tip, keeping every op. Run it after a rebase-needed commit outcome, then commit again.
memhtml session status The session’s base, ref, and overlay log as persisted, and whether the ref has moved past the base.
memhtml session prune Remove session state nothing reads again, older than a cutoff: index files, refs/memhtml/sessions/ refs, stale lock directories, and logs with zero ops. A log that still holds ops is never removed; it is listed under unlanded.
memhtml head status Report the corpus version and where it came from: the head server’s (source: server, with the server’s ref, load, advances, and uptime under server) when one answers on .memhtml/head.sock, else the version at HEAD built here, with its sha, record count, skipped files, load time, and source: snapshot (HEAD’s own .arrow file), snapshot+advance (an ancestor’s snapshot advanced over the changed paths, with ancestorSha and reparsed), or git. policy says where the store’s write policy comes from: file (memhtml.config.json present, with its path), defaults (absent: the library defaults, which refuse no type and require no anchor), or invalid (present and unreadable or malformed, with the reason: every write that needs the policy refuses with ERR_STORE_CONFIG until it is fixed). The head server reads the file when its status is asked and reports the same under server.policy, and head serve logs the source in one line at startup.
memhtml head search Retrieval over the version at HEAD, or over the head server’s version of its ref when one answers, RRF-fused: BM25, plus a vector arm (cosine over Cohere Embed v4 vectors, weight 1.0 as in v1’s search) when .memhtml/vectors/ holds a cache for the configured embedder and MEMHTML_EMBED is not off. Recency is the tie-break: only hits with exactly equal fused scores are ordered newest first, so it never lifts a weaker match over a better one. The query is embedded once with the query input type. The query embed has a deadline, MEMHTML_EMBED_DEADLINE_MS (450 ms by default): past it the search answers without the arm rather than wait. When the arm cannot run (embedder off, no cache yet, an unreadable cache, the query embed failed or passed its deadline) the search answers from BM25 alone and vector reports used: false with a reason; it never fails for it. Each hit’s arms names the arms it scored on, and recency when an exact tie was broken by it. No index database.
memhtml path Print the path a write with these fields would land at over the version at HEAD, and the collision ordinal it took. Reads no session: inside one, session put --dry-run answers over the session’s base and its puts. Writes nothing.
memhtml head serve Hold the head loaded and answer lookups over .memhtml/head.sock (mode 0600, JSON over HTTP, routes /v1/status, /v1/search, /v1/read, /v1/neighbors, /v1/exec, /v1/commit, /v1/rebase) until SIGTERM or SIGINT. The server loads its ref’s tip once the cheapest way (snapshot, snapshot+advance, or git), reads the ref before every answer and advances over the changed paths when it moved, so an answer is never older than the ref at the moment of the request, and polls between requests. With an embedder bound (not MEMHTML_EMBED=off) it also holds the vector cache head embed writes, reads it again when the file’s mtime changes, and runs the vector arm for /v1/search and /v1/neighbors the way head search and session put do locally, answering with the same vector field. A /v1/search waits for its query embed at most the body’s embedDeadlineMs, else MEMHTML_EMBED_DEADLINE_MS, else 450 ms, and answers embed-timeout without the arm past it, leaving at most one late embed to finish in the background; and, when MEMHTML_EMBED_WARM_IDLE_MS is set above 0 (it is off by default), no embed has ended for that long, and none is in flight, it issues one one-token embed, so the first search after a quiet stretch is warm (status reports both under embed). An advance that brings records the cache has no vector for embeds them in the background, a bounded batch at a time, and writes them to the cache file as head embed would (status reports vectors.pending and vectors.backfill). head status, head search, session put, session exec, session commit, and session rebase ask it first, and /v1/exec runs the script in a pool of worker threads (MEMHTML_EXEC_POOL_SIZE at once, by default one fewer than the machine’s available parallelism, at least 1 and at most 4; each with a MEMHTML_EXEC_WORKER_HEAP_MB heap; one per session id at a time) so a runaway script never stalls a lookup. /v1/commit commits one session at a time over the version at its base, the same commit the CLI runs locally, then holds the new commit and writes its snapshot, so a run-end commit costs no head load; with --drop-refused a commit behind the tip is rebased onto it and committed again inside the same permit, up to 3 times. The curate commands always load locally. At startup the server logs one line naming the store’s policy source (memhtml.config.json absent: library defaults, the file’s path, or why it does not decode); every request that judges a record reads the file again, and status reports it as of the request under policy. A live server on the socket refuses a second one (ERR_HEAD_SERVER_RUNNING); a socket left by a killed server is replaced; a store whose socket path is past the platform’s limit (107 bytes on Linux, 103 on macOS) is refused before the load with ERR_STORAGE naming the limit, and every client there loads locally. Under win32 the server listens on the named pipe \\.\pipe\memhtml-<the first 16 hex digits of the SHA-256 of the store path> instead of a socket file. The socket is removed on exit, and the envelope reports the ref, final sha, advances, requests, and uptime.
memhtml head embed Fill the vector cache for the version at HEAD: embed every active record whose article text has no vector yet (keyed by content hash, so an unchanged record is never embedded twice, across every version) and write .memhtml/vectors/<model>@<dimension>.arrow, a rebuildable cache git ignores. Reports records, reused, embedded, the cache file’s bytes, and the time spent. Needs an embedder: with MEMHTML_EMBED=off it fails with ERR_MODEL_UNAVAILABLE. Run it after commits land to keep head search’s vector arm covering new records; vector.coverage on a search says how much of the head it covers.
memhtml head snapshot Write the version at HEAD as .memhtml/snapshots/<sha>.arrow, the cold-start cache, pruning to the newest four, or read that file back and report it. Every ref-moving commit writes this file itself; the command is for a store whose HEAD moved by other means.
memhtml curate merge Land a curator branch on its target: fast-forward --into to the ref when the ref descends from it, else replay the ref’s operations (its puts, archives, and links since the merge base) as one fresh commit on --into’s tip; the head gate (the same probes ranked at both tips) runs first either way, the checkout comes along when --into is HEAD, the landed version’s snapshot is written, and after a replay the curator ref is moved to the landed commit.
memhtml curate run Run the curator: start (or resume) a session on curate/<date>, brief a model on the corpus, let it search, read, exec, and propose within a budget, then commit the session to the branch as memhtml(curate): <report line>.
memhtml curate collapse Plan and run a collapse of the corpus on a curate/ branch: cut the head into archive, fold, and keep clusters by source and type, frame key, and lexical similarity (rulings first when given), archive the archive clusters with no model, fold each fold cluster into one canonical through a curator session with the driver completing every archive and supersedes link, and leave keep clusters alone.

3. Where the command table comes from

The single source of parsing, validation, and the manifest. A command lands here before it lands anywhere else, so memhtml manifest and memhtml agents-doc describe what the binary actually accepts rather than what someone remembered to document.

A subcommand is one entry with a space in its name (index rebuild), not a nested tree. Flattening keeps nearest() able to suggest across the whole surface, a typo in the noun (memhtml indx rebuild) and a typo in the verb (memhtml index rebiuld) both get a candidate, and keeps one table driving parsing, the manifest, and the generated doc.

4. Provenance

A loader generates this page from apps/cli/src/commands.ts while the site builds, so no file in the repository holds it: a content-layer loader hands these pages straight to the docs collection, so the sidebar and the site search treat them as ordinary pages. Change the registry and this page changes with it.