Search from the terminal

Search your cortex, read a note and list the newest notes from the terminal with memorinth search, get and recent: the query syntax, output for pipes, and JSON.

On this page

Three commands read your cortex from the terminal: search finds notes, get prints one, and recent lists the newest. They read the cortex agents use, or the one you name with --cortex <path>, and change nothing. Agents write through their memory tools; these only read.

They go through Memorinth’s engine, the same background process your agent sessions and the app use, so you get the same results an agent would. If the engine isn’t running, they start it. If it can’t start, they say so: run Check with doctor to see why.

$ memorinth search sqlite storage

Search works by meaning when the search model is on this computer, and by keywords either way. In a terminal each note shows its title, its status, how relevant it is, its path and the passage that matched. When nothing matches, it prints No notes match and still exits 0.

Narrow it down

The query takes the same terms as search in the app and the search_memory tool agents call:

Write Keeps
#rust or tag:rust Notes with that tag
type:decision One kind: memory, fact, decision or note
status:accepted Notes with that status
path:memory/atlas Notes whose path contains that text
NOT tag:draft Leaves those notes out
a OR b Either one
( … ) Groups terms
"two words" Keeps words together

In a shell, quote terms that start with # or hold parentheses, or the shell reads them first:

$ memorinth search caching type:decision status:accepted
$ memorinth search '(#storage OR #search)' type:decision

With only terms and no words, it lists every note they keep, newest first:

$ memorinth search type:fact status:needs-review

A term that starts with a minus, such as -tag:draft, looks like an option to memorinth. Put -- before it:

$ memorinth search sqlite -- -tag:draft

NOT tag:draft does the same without the --. Searching has the whole query language, with recipes.

Options

Option
-n, --limit <n> At most this many notes (default 10)
--folder <folder> Only in this folder or subfolder, like facts or memory/project
--tag <tag> Only notes with this tag. Give it again for more; a note needs all of them
--history Also retired facts, and superseded or deprecated decisions
--cortex <path> Read this cortex instead of the one agents use
--json The hits as JSON, as the engine gives them

Read a note

$ memorinth get "Store times in UTC"

get finds a note by its id, its path in the cortex, or its title, and prints it as Markdown with its frontmatter. In a terminal, the notes it links to and the notes linking to it come after. cat is another name for it. It exits 1 when there’s no such note.

$ memorinth get "decisions/0042 Store times in UTC.md"
$ memorinth cat "Store times in UTC" --json

--json gives the note, its links and its backlinks.

The newest notes

$ memorinth recent

The ten most recently updated notes, newest first, as agents’ list_recent tool gives them. --folder keeps one folder, memory, decisions, facts or user, and -n changes how many.

$ memorinth recent --folder decisions -n 5

--due lists the facts past their review date instead, all of them unless you pass -n. Keeping facts true says what to do with them.

$ memorinth recent --due

In scripts

In a pipe, search and recent print one note per line, its path and its title with a tab between:

decisions/0042 Store times in UTC.md	Store times in UTC
memory/The login bug was a time zone mix-up.md	The login bug was a time zone mix-up

So you can feed the paths to other tools:

$ memorinth search '#atlas' | cut -f1

All three take --json for the full data. Each exits 0 when it worked and 1 on an error; a wrong option exits 2.

Updated