Skip to content

CLI

The mt CLI is a thin wrapper over the SDK for terminal-driven workflows. Best at:

  • One-shot recording from shell scripts (mt record "...")
  • Wrapping a subprocess and streaming stdout/stderr as turns (mt observe -- claude-code)
  • Quick search from the terminal (mt search "..." --mode summaries)
Terminal window
pnpm add -g @memoturn/cli
mt --version
Terminal window
mt init

Interactive setup — stores api key + default project + email at ~/.memoturn/config.json. Override per-invocation with --api-key, --project, --email, --base-url.

One-shot record_turn (role=event).

Terminal window
mt record "deploying the worker tonight"
mt record --session sprint-42 "kicked off staging deploy"

Wrap a subprocess. Each chunk of stdout becomes a turn (role=assistant); stderr is recorded too unless --no-stderr. Use --session to scope all the turns under one session id, --flush-ms to control the buffer flush cadence (default 400 ms).

Terminal window
mt observe --session debug-incident -- python train.py
mt observe -- claude-code

Hybrid search from the terminal. --mode matches the SDK modes; --limit caps results.

Terminal window
mt search "hyperdrive connection limit"
mt search "parseUser" --mode entities
mt search "what did we figure out about auth" --mode summaries --limit 3

Output is one hit per line: score [mode d=<dense_rank> l=<lexical_rank>] <content>.

Set the default project slug for subsequent calls.

Print the resolved config (api key masked).

Every flag has a MEMOTURN_* env-var equivalent: MEMOTURN_API_KEY, MEMOTURN_PROJECT, MEMOTURN_USER_EMAIL, MEMOTURN_BASE_URL. Useful for CI and ephemeral shells.