---
title: write-surfaces
description: "The write-surfaces block of the CLI's guide."
---

## 1. The block, verbatim

There are three ways to put a memory into the corpus, and they are all legitimate. First, this CLI: `memhtml write` for one memory, `memhtml apply` for many. Second, the MCP server: `memhtml serve mcp` speaks stdio with the same tools and resources over this same repo, and it is the door to use when you are already an MCP client. Third, editing files under $MEMHTML\_ROOT directly with your normal file tools: the git tree IS the system of record and `.memhtml/index.db` is only a projection of it, so a hand-written or hand-edited memory file is as real as one this CLI wrote. `memhtml index update` projects uncommitted working-tree changes as well as committed ones, so a dirty edit is searchable before you commit it. What you take on by editing directly is everything the write path would have done for you: the file must satisfy the format (run `memhtml doctor`, and `memhtml read <path>` reports per-file format warnings), you own choosing a path that does not collide, you own noticing that the content already exists somewhere else, and you own the commit. `memhtml sleep run` refuses to start on a dirty tree, so an uncommitted edit blocks curation until it is committed or stashed. A CLI command and a running `memhtml serve mcp` may share one store: the index is WAL SQLite, which admits one writer at a time and any number of concurrent readers, so a second writer waits its turn rather than failing. The one thing to keep clear of is `memhtml sleep run`, and for a git reason rather than a database one: a run holds a checked-out `sleep/<date>` branch, so a write landing during it commits onto that branch and is merged as if it were curation or lost when the branch is dropped.

## 2. Commands it names

* [`memhtml write`](/reference/commands/write/)
* [`memhtml apply`](/reference/commands/apply/)
* [`memhtml read`](/reference/commands/read/)
* [`memhtml index update`](/reference/commands/index-update/)
* [`memhtml sleep run`](/reference/commands/sleep-run/)
* [`memhtml doctor`](/reference/commands/doctor/)
* [`memhtml serve mcp`](/reference/commands/serve-mcp/)

## 3. Provenance

A loader generates this page from `apps/cli/src/commands.ts` while the site builds, so no file in the repository holds it: the block is authored beside `COMMANDS` and is served verbatim by `memhtml manifest`, so this page and the live answer are the same bytes. Change the registry and this page changes with it.