Axiom StudioAXIOMSTUDIO
All docs

CLI Reference

memora-cli is a command-line client for the Memora REST API, built from the same module as the server and shipping alongside it. Every command here talks to a running memora-core over HTTP, with one exception noted under content migration.

Invocation

memora-cli [global-flags] <command> [args...]

Global flags may appear before or after the command name. Most commands operate inside a workspace and fail with a usage error when none is set, either through --workspace or MEMORA_WORKSPACE.

Global Flags

FieldValue
--endpointServer URL. Environment MEMORA_ENDPOINT. Default http://localhost:7777.
--api-keyBearer token. Environment MEMORA_API_KEY.
--agent-idThe writing agent. Environment MEMORA_AGENT_ID. Default agent_opaque_local.
--workspace, -wTarget workspace. Environment MEMORA_WORKSPACE.
--output, -oOutput format. Environment MEMORA_OUTPUT. Default text.
--timeoutRequest timeout as a Go duration, such as 45s. Default 30s.
--no-colorDisable coloured output.
--quiet, -qSuppress normal output.
--verbose, -vEnable verbose output.

Every write the CLI sends carries an agent ID, defaulting to agent_opaque_local. Attributing writes from different services to different agents is worth doing early, because the ledger and recall filters both key on it and the attribution cannot be reconstructed afterwards.

Output Formats

FieldValue
textHuman-readable. The default.
jsonA single JSON document.
jsonlJSON Lines, one record per line.
yamlYAML.

An unrecognised value falls back to text without an error, so a misspelled format is only visible in the output shape.

Exit Codes

FieldValue
0Success.
1Usage error — a missing argument, an unknown command, or no workspace set.
2Authentication failure. The server returned 401.
3Server fault. The server returned a 5xx.
4Client error. Any other 4xx, or a local failure such as an unreadable file.
5Watermark conflict. The server returned 412.
8Not found. The server returned 404.

Exit code 5 is the one worth branching on in scripts: it means a conditional write lost a race and the correct response is to re-read and retry, not to abort.

if ! memora-cli patch "$MEM" --patch "$OPS" --if-match "$WMK"; then
    [ $? -eq 5 ] && echo "watermark moved; re-read and retry"
fi

Workspace and Collection Commands

SectionDescription
workspaces listList workspaces.
workspaces create --name <name> [--region <region>]Create a workspace.
workspaces show <ws_id>Read one workspace.
workspaces delete <ws_id>Delete a workspace.
collections listList collections in the current workspace.
collections create <name>Create a collection. The name is positional, not a flag.

Memory Commands

SectionDescription
imprintCreate a Memory. Requires --text or --from-file.
lookup <mem_id>Read a Memory with its Cells.
update <mem_id>Replace a Memory's content. Requires a watermark.
patch <mem_id>Apply find-and-replace operations. Requires a watermark.
append <mem_id>Append to a Memory's content.
forget <mem_id>Delete a Memory, cascading to its edges.
listList Memories in the current workspace.
watermarks <mem_id>Show watermark history for a Memory.

imprint

FieldValue
--textContent to store. Pass - to read standard input.
--from-fileRead content from a file instead.
--collectionCollection to file the Memory under.
--chunkerOverride the workspace chunker for this imprint.
--chunker-optChunker configuration as key=value. Repeatable.
--tagTag as key=value. Repeatable.
--auto-linkForce auto-linking on for this imprint.
--no-auto-linkForce auto-linking off for this imprint.

update, patch, and append

FieldValue
--textNew content for update and append. Pass - for standard input.
--from-fileRead new content from a file. update only.
--patchA JSON array of {"old_string": …, "new_string": …} operations. patch only.
--patch-fileRead the operations array from a file. patch only.
--if-matchThe watermark the caller expects to be current.

append takes --text only; unlike update it has no --from-file, so appending a file's contents means piping it in with --text -.

A --if-match value that no longer matches the Memory's head returns 412 and the CLI exits 5, having changed nothing.

list

FieldValue
--collectionRestrict to one collection.
--limitMaximum Memories to return.

Recall Commands

SectionDescription
recall <query>Run a recall query.
pin create --query <text>Save a recall query.
pin listList saved queries.
pin delete <pin_id>Delete a saved query.

recall

FieldValue
--modehybrid, keyword, vector, or lookup. Default hybrid.
--kNumber of results. Default 5.
--collectionRestrict to one collection.
--neighbor-depthExpand this many hops along graph edges from each seed hit.
--edge-typesComma-separated edge types to follow during expansion.

pin create

FieldValue
--queryThe query text. Required.
--modeRecall mode to save. Default hybrid.
--kNumber of results to save. Default 10.
--watermarkBind the pin to a watermark, holding results at that point in time.
--labelAn optional human-readable label.

Pins default to k = 10, recall defaults to k = 5. Saving a query and running it directly return different numbers of results unless --k is given explicitly on both.

Graph Commands

SectionDescription
link <src_mem_id> <tgt_mem_id> --type <edge_type>Create an edge between two Memories.
unlink <edge_id>Remove an edge.
neighbors <mem_id>One-hop neighbours of a Memory.
traverse <seed_mem_id>Breadth-first traversal from a Memory, returned in layers.
graph statsNode count and edge count by type for the workspace.
FieldValue
--typeEdge type for link. See Concepts for the seven types.
--propertiesJSON properties to attach to the edge on link.
--directionout, in, or both, for neighbors and traverse.
--typesComma-separated edge types to filter by, for neighbors and traverse.
--kMaximum neighbours to return, for neighbors.
--depthTraversal depth, for traverse. Capped at 3; a larger value returns graph_traverse_depth_exceeded.

unlink refuses to remove a vector_neighbor edge, returning cannot_unlink_synthetic_edge, because those edges are written by the system rather than asserted by a caller.

Agent Commands

SectionDescription
agents listList agents registered in the workspace.
agents register --agent-id <id>Register an agent.
FieldValue
--agent-idThe agent identifier to register.
--providerThe identity provider that vouches for it.
--display-nameA human-readable name.

Explicit registration is optional for writing: an unknown agent that passes its identity check is registered automatically on first write. Registering ahead of time is how a display name and provider get attached.

Operational Commands

SectionDescription
healthLiveness check against the server.
readyReadiness check, reporting per-adapter status.
versionPrint the client version, commit, and build date.
migrate contentBackfill Memory and Cell bodies into a content store.

migrate content

This is the one command that does not go through the REST API. It opens the metadata and content stores directly, so it must run on a host with access to the data directory rather than against a remote endpoint.

FieldValue
--workspaceThe workspace to migrate. Required.
--collectionRestrict the backfill to one collection.
--data-dirData directory holding the SQLite database. Environment MEMORA_DATA_DIR. Default ./data.
--metadata-driverMetadata driver to read from. Environment MEMORA_METADATA_DRIVER. Default sqlite.
--content-driverContent driver to write to. Environment MEMORA_CONTENT_DRIVER. Default sqlite.
--content-dsnTarget DSN. Environment MEMORA_CONTENT_DSN. Defaults to the SQLite database for the sqlite driver, or <data-dir>/content otherwise.
--dry-runReport counts without writing.
--verifyCompare content between the metadata store and the content store.
--resume-fromContinue from a given Memory ID after an interruption.
--max-rateMemories per second. Default 100. 0 removes the limit.

The command prints a JSON result and exits 4 when --verify finds any mismatch, which makes a verification pass usable as a deployment gate. See Operations for the migration procedure.