Docs / Command line export and search

Export and search your memories from the command line

Two commands in the modelbrain_admin tool let you take your memories out as plain files, or search them without opening an assistant. Both arrived in 0.5.1. Both ask the running ModelBrain app, so the app must be open, and neither changes anything.

Where the tool is
macOS

/Applications/ModelBrain.app/Contents/MacOS/modelbrain_admin

Windows

%LOCALAPPDATA%\Programs\ModelBrain\modelbrain_admin.exe

Linux

The install script links it as modelbrain, so type modelbrain export and modelbrain recall.

The examples below write modelbrain_admin; use the path or name for your system. Every command accepts --store-dir <dir> if your memories are not in the default location.

Export your memories
modelbrain_admin export --out ~/modelbrain-export modelbrain_admin export --out ~/mb.jsonl-dir --format jsonl modelbrain_admin export --out ~/work-only --partition work

The files hold your memories as plain, unencrypted text. Keep them somewhere you trust.

Search your memories
modelbrain_admin recall deploy runbook modelbrain_admin recall why postgres -k 10 --partition work modelbrain_admin recall relay --json

Prints the best matches with their partition, a relevance number, the key and the start of the text. -k sets how many (1 to 50, default 5), --partition NAME limits the search to one partition, and --json prints the raw results instead. A long memory is cut after 600 characters in the printout; the full text is in the app or in an export.

Exit codes
0
Done. For recall, at least one match was printed.
1
Failed. The message says why, for example that ModelBrain is not running or the target folder already exists.
2
The command was typed wrongly.
3
export finished, but some long memories are incomplete (pieces not synced to this computer yet) or were cut short. Those files say so. Run it again after sync finishes.
4
recall ran fine and found nothing.
What was checked

Before release, both commands were run against a live ModelBrain with its real search model on Linux: a search found the right memory, an export wrote the Markdown and JSON Lines files with a 500-sentence memory complete in one file, and a second export onto the same folder was refused. Automated tests cover the rest. They have not been hand-checked on a real store of your size or on Windows, so check an export before you rely on it as a backup.

Questions

Can I get my memories out of ModelBrain as plain files?

Yes, from version 0.5.1. The export command writes one Markdown file per memory, in a folder per partition, or a single memories.jsonl file. The app must be running, and the command never changes anything.

Does export include earlier versions of a memory I replaced?

Not by default. Only the current version of each memory is written, and a replaced memory is named in the supersedes field of the one that replaced it. From version 0.6, add --history to write each replaced version as its own record with a superseded_by field, plus deleted_at for forgotten ones.

Why does export say some memories are incomplete?

A long memory is stored in pieces. If some pieces synced from another computer have not arrived yet, the file is marked incomplete and the command exits with code 3. Run it again after sync finishes.

Not connected yet?

Start with install and connect.

Install →
Having trouble?

Common issues, per platform.

Troubleshooting →