Reference and help
How it works inside
This is the same story as How MemIndex works, one level down: how work becomes a note, when your agent's hooks run, and what lives in your data folder. You do not need it to use MemIndex. It helps when you build on it or chase a problem.
From work to note
- Capture. Your agent runs a small command, a hook, at fixed points: a prompt, a tool call, the end of a turn, the end of a session. The hook sends the prompt to the service over HTTP. It writes every other event to a file in a spool folder and exits, so it never slows your agent.
- Clean. The service drains the spool and applies the skip rules, private tags and secret filtering. Then it queues the event.
- Write. The note writer you chose reads the queue and answers in a structured form. The service parses the answer and stores notes and session summaries in a local SQLite database.
- Index. Stored notes also get a vector for search by meaning.
- Recall. At the next session start, the service builds the startup panel from the stored notes. During a session, your agent can search for more.
Folder context files and the session records behind long sessions carry memory into files on disk.
The hook lifecycle
Each agent has its own hook set. For Claude Code, the events are:
| Event | What MemIndex does |
|---|---|
| Session start (startup, resume, clear, compact) | Starts the service if needed, then gives the agent its startup panel. |
| Prompt submitted | Starts or continues the session and stores the prompt. |
| After a tool call, and after a failed one | Hands the call to the spool for a note. |
| Before a file or search tool runs | Adds notes about that file when there are any. |
| Before compaction, and when a turn ends | Asks for a summary. |
| Session end | Marks the session finished. |
A hook that fails exits quietly and prints one line, so a broken MemIndex never stops your agent. When the service does not answer, hooks keep their events in the spool and send them when it returns. After repeated failures your agent gets one notice.
Other agents register the same ideas in their own way. Their pages say what they record and where their settings live.
What lives in your data folder
The folder is ~/.memindex, or the path in MEMINDEX_DATA_DIR.
| Item | What it holds | If you delete it |
|---|---|---|
memindex.db |
Your notes, sessions, prompts and summaries, in SQLite. | You lose your memory. Back it up. |
settings.json and .env |
Your settings and any keys. | Settings reset. Keep both private. |
snapshots/ |
Automatic copies of the database. | Fewer restore points. |
backups/ |
Copies made before an import. | Keep until the import is verified. |
bottles/ |
Session records for long sessions. | The next compaction rebuilds what it needs. |
corpora/ |
Your knowledge agents. | You rebuild them. |
models/ |
The search model, downloaded once. | It downloads again. |
vectors.db |
Search vectors. | Rebuilt from the database. Word search only until then. |
logs/ |
Daily service logs. | Safe. |
state/ |
The spool of events not yet applied, and import ledgers. | Events not yet applied are lost. |
worker-secret |
The install secret. | MemIndex creates a new one. Never copy it to another computer. |
Do not delete or move the database files while the service runs. npx memindex stop first. See Backups and restore.