Mitosis Labs

CLI

Mitosis CLI

mi: query and manage a memory from a terminal.

The mi CLI ships inside the @mitosislabs/sdk npm package. It is the fastest way for humans and agents to talk to Mitosis from a shell.

Install

npx -y -p @mitosislabs/sdk@latest mi --help
npm install -g @mitosislabs/sdk
mi --help

Authenticate

mi login     # device-code flow, prints a URL to approve in the browser
mi whoami    # verify the session

For headless use, set MI_API_KEY=mi_... with a key from the dashboard user menu; no mi login needed. See authentication.

Commands

Every mi cortex command takes --office <id>. Get yours from mi offices list, which prints JSON:

OFFICE=$(mi offices list | jq -r '.[0].id')

Memory

CommandWhat it does
mi cortex ask "<question>" -o <id>Hybrid retrieval, rendered as a cited, prompt-ready block. Add --json for the raw response.
mi cortex answer "<question>" -o <id>Same retrieval as raw JSON: RRF scores, per-leg signals, freshness.
mi cortex recall "<query>" -o <id>Semantic-only vector search. Hits carry source and excerpt.
mi cortex remember "<fact>" -o <id>Write a durable fact back, with --kind, --confidence, --source <uid>.
mi cortex ingest <files...> -o <id>Ingest local files. Text becomes searchable content; binaries go to the office drive with a metadata row.
mi cortex sync-vault <dir> -o <id>Sync a folder of Markdown. Recurses, chunks large notes, resumable, and --schedule hourly keeps it current.
mi cortex get <universalId> -o <id>The original source row behind any citation.
mi cortex status -o <id>Totals, embed and graph coverage, per-feed freshness.
mi cortex manifest -o <id>What the memory contains: connected sources, item counts, and the top people and topics it knows. --json for the raw manifest.

Everything else

CommandWhat it does
mi login / mi whoamiDevice-code sign-in, and verify the session
mi offices listList offices you belong to
mi backup create --agent <name> --platform <p>Snapshot an agent workspace
mi backup list / mi backup restore <id>Manage snapshots
mi hermesRun a local agent connected to your office
mi init --office-manager <url>Point the CLI at production or the sandbox backend

Scripting

mi cortex commands emit JSON (ask renders prose unless you pass --json), and exit codes are POSIX-style (0 on success, non-zero on failure), so mi composes cleanly inside shell pipelines and CI steps.

# Ingest, then query, then write the conclusion back.
mi cortex ingest ./handbook/*.md --office "$OFFICE" --feed handbook
 
mi cortex answer "open questions on billing" --office "$OFFICE" --limit 5 \
  | jq -r '.results[] | "\(.score)\t\(.title)\t\(.universal_id)"'
 
mi cortex remember "Billing migration lands in Q4." \
  --office "$OFFICE" --kind decision --confidence 0.8

The --json surfaces of ask, answer and recall also carry a graph_url that deep-links to the cited nodes on the user's own graph:

mi cortex ask "what did we decide about pricing?" --office "$OFFICE" --json \
  | jq -r '.graph_url'

The same surface elsewhere

Everything the CLI does is also available over REST and MCP. The CLI is a convenience layer over the same API, not a separate capability set.