memoryd-http ist ein C99-CGI-Programm (HTML 4.01) ueber den MCP-Server von memoryd (vendor/cgi/cgi.h, tests/test-http.sh); Makefile baut und installiert es, README beschreibt es, tests/run.py angepasst.
memoryd
What an agent remembered, searchable by meaning.
One fact per file, one embedding per fact, and a search that answers "how was it with the
frost protection" with the note that says "coolant down to -25 °C" — even though the word
frost never appears in it. Served over MCP, like tasksd and skilld.
memoryd # stdio, JSON-RPC per line
memoryd --http 8795 # Streamable HTTP, so every host uses the same store
Storage
One JSON file per memory under $MEMORYDIR (default $XDG_DATA_HOME/memoryd, else ~/.local/share/memoryd):
{
"id": "m00001",
"scope": "van/technik",
"text": "Der Frostschutz steht auf -25 Grad, aufgefüllt wird G12+ blau.",
"tags": "kühlmittel",
"source": "konrad",
"model": "nomic-embed-text",
"created": 1794147600,
"embedding": [0.0428, 0.0418, ...]
}
Readable, diffable, backupable without a database. A scope is a free string and selects
itself plus its children, so van covers van/technik — the same rule as tasksd.
Tools
| tool | what it is for |
|---|---|
memory_add |
store one fact: text (required), scope, tags, source |
memory_search |
meaning-based search with scores; scope and limit optional |
memory_list |
what exists in a scope, newest first |
memory_get |
one memory in full |
memory_update |
correct a fact (re-embeds the new text) |
memory_delete |
remove what is wrong or obsolete |
memory_scopes |
which scopes exist, how many memories each |
Knowledge bases — a wiki next to the memories
A knowledge base is a named collection of pages. Same mechanics as a memory (title, text, embedding, searchable by meaning), different purpose: memories are what an agent picked up along the way, a knowledge base is what a human wrote down to be read again.
$MEMORYDIR/kb/<slug>/kb.json {"name","slug","description","created"}
$MEMORYDIR/kb/<slug>/e00001.json {"id","title","text","tags","source",
"created","updated","model","embedding",
"history":[{"text","updated"}]}
| tool | what it is for |
|---|---|
kb_create |
a base per subject area (olivia-technik, fleet-junction); "Olivia Technik" becomes the slug olivia-technik |
kb_list |
which bases exist, how many pages, what they are for |
kb_write |
a page; the same title updates it instead of duplicating |
kb_read |
one page in full, optionally with its earlier versions |
kb_search |
by meaning; without kb it searches all bases and ranks globally |
kb_entries |
what a base already covers |
kb_delete |
one page |
kb_drop |
a whole base — needs confirm="yes", otherwise it only says what would be lost |
Two decisions that matter:
- Same title = update, with history. The previous text moves into
history(five versions), and the answer saysupdated … earlier version kept in history. A wiki that silently overwrites is not a wiki. - Search ranks globally across bases unless one is named — the best page wins, not the best page per base.
The embedder
OpenAI-compatible /v1/embeddings, EMBED_URL (default
http://127.0.0.1:8091/v1/embeddings), EMBED_MODEL (default nomic-embed-text, 768
dimensions).
It is not required to run. If it does not answer, the memory is stored without a
vector and the tool says so (WITHOUT embedding); search then falls back to a
case-insensitive substring match and labels the result substring match. A store that
silently pretends to understand meaning is worse than one that admits it is matching
letters.
What does not belong here
Secrets, keys, passwords, long transcripts. The text is the conclusion, not the raw material — one paragraph that still makes sense to an agent who was not there. A store that keeps everything makes every search worse.
Build and test
make # C99 + POSIX, no dependency beyond libc, libm, and curl at runtime
make test # 16 checks against the running service (HTTP + stdio), stub embedder
sudo make install
The suite starts its own embedder stub with deterministic vectors, so it does not depend on a model being loaded on this machine.
Web UI (CGI)
memoryd-http is a C99 CGI program: HTML 4.01, no JavaScript, no auth. It never reads
the memory files itself — every list, search, read, add, update and delete is a
tools/call against memoryd (MEMORYD_URL, default http://127.0.0.1:8795/mcp). The
browser and the agents therefore share one store.
| Address | Effect |
|---|---|
/ |
memories, filter with ?scope=…&limit=… |
/search?q=… |
semantic search, optional &scope=… |
/scopes |
scopes with counts |
/new |
add a memory |
/m/<id> |
one memory with created/source |
/m/<id>/edit |
edit text, tags, scope |
/m/<id>/delete |
POST only |
make # memoryd and memoryd-http
sudo make install # /usr/local/bin/memoryd, /usr/local/lib/cgi-bin/memoryd-http
With busybox httpd (the four fleet CGIs share the navigation when installed side by side):
install -d /srv/www/cgi-bin
install -m 0755 memoryd-http /srv/www/cgi-bin/
MEMORYD_URL=http://127.0.0.1:8795/mcp \
busybox httpd -f -p 0.0.0.0:8798 -h /srv/www
vendor/cgi/cgi.h is the shared CGI helper (the same file lives in wikid, skilld and
tasksd): environment, HTML shell, Markdown, form parameters and the MCP call.