CLI Reference
Complete command reference for the mx CLI.
Full command reference for @memnexus-ai/cli. Install with:
npm install -g @memnexus-ai/cli
Global options
| Option | Description |
|---|---|
--no-color | Disable colored output |
--version | Show CLI version |
--help | Show help for any command |
auth
Manage authentication and API keys
mx auth login
Configure API key for authentication
| Option | Description | Default |
|---|---|---|
--api-key <key> | API key to store | — |
--interactive | Prompt for API key (mask input) | — |
mx auth logout
Remove stored credentials
mx auth status
Show current authentication status
| Option | Description | Default |
|---|---|---|
--format <format> | Output format (json|table|yaml) | — |
mx auth whoami
Show the authenticated account identity (email, isTestUser, plan, endpoint)
| Option | Description | Default |
|---|---|---|
--format <format> | Output format (json|table|yaml) | — |
config
Manage CLI configuration
mx config get <key>
Get a configuration value
mx config set <key> <value>
Set a configuration value
mx config list
List all configuration values
mx config reset
Reset configuration to defaults
mx config agent
Show AI agent detection status and effective defaults
| Option | Description | Default |
|---|---|---|
--format <format> | Output format (json|table) | table |
mx config env
Show all supported environment variables and their current values
mx config dev
Switch all URLs to the dev environment
mx config prod
Switch all URLs to the production environment
memories
Manage memories
mx memories list
List memories
| Option | Description | Default |
|---|---|---|
--page <number> | Page number | 0 |
--limit <number> | Results per page | 10 |
--last <number> | Get N most recent memories (shortcut for --limit N --sort createdAt:desc) | — |
--sort <field> | Sort by field (createdAt:asc, createdAt:desc, eventTime:asc, eventTime:desc) | — |
--named | List only named memories. Output is paged: stdout holds one page. --page counts from 0; at most 500 per page via --limit. To get every named memory, use --all. To walk by hand, use --page 0, 1, 2 ... until the footer or stderr notice shows neither "Next" nor "More may exist". With --format json or yaml there is no footer: when more pages exist, a notice on stderr gives the total and the next --page. --topics, --topic and --exclude-topics exit with a validation error when combined with --named | — |
--all | With --named: fetch every page (500 per page unless --limit is set) and print one list, de-duplicated by id. Exits non-zero, with a message on stderr, if it cannot reach the total the server reports or stops at the 200-page cap. Cannot be combined with --page or --last | — |
--recent <duration> | Filter: stored in the last duration, by ingestion time; with --named, when the current version was stored (e.g., 7d, 2w, 1h, 30m). On list, --recent overrides --after | — |
--after <date> | Filter: stored after this date, by ingestion time; with --named, when the current version was stored (ISO 8601) | — |
--before <date> | Filter: stored before this date, by ingestion time; with --named, when the current version was stored (ISO 8601) | — |
--topics <topics> | Filter: comma-separated list of topics (matches ANY) | — |
--topic <topics> | Alias for --topics | — |
--exclude-topics <topics> | Filter: exclude memories with these topics (comma-separated) | — |
--format <format> | Output format (json|table|yaml) | — |
mx memories get [id] [moreIds]
Get one or more memories by ID (supports piping with --stdin)
| Option | Description | Default |
|---|---|---|
--format <format> | Output format (json|table|yaml) | — |
--name <name> | Get memory by name instead of ID | — |
--detail <level> | Detail level: minimal, standard (default), full | standard |
--similar | Find semantically similar memories (single ID only) | — |
--conversation | Find memories from the same conversation (single ID only) | — |
--related | Find memories with shared topics (single ID only) | — |
--limit <number> | Maximum number of related results | 5 |
--stdin | Read memory IDs from stdin (one per line or space-separated) | — |
--include-vectors | Include embedding vectors in json/yaml output (debugging; stripped by default) | — |
mx memories create
Create a new memory
| Option | Description | Default |
|---|---|---|
--conversation-id <id> | Conversation ID (REQUIRED - use "NEW" to create a new conversation) | — |
--content <text> | Memory content | — |
--content-file <path> | Read memory content verbatim from a file ("-" for stdin). Shell-safe: backticks and $(...) in the text are stored literally instead of being expanded by your shell. Mutually exclusive with --content. | — |
--name <name> | Assign a kebab-case name for deterministic retrieval | — |
--upsert | With --name: if the name already exists, replace that memory with a new version silently. Without --upsert this release still replaces it but warns on stderr; the next release will refuse (#5485). To update on purpose, prefer mx memories update --name. | — |
--memory-type <type> | Memory type (episodic|semantic|procedural) | — |
--context <context> | Context identifier | — |
--topics <topics> | Comma-separated topics | — |
--role <role> | Role (user|assistant|system) | — |
--importance <number> | Importance score (0-1) | — |
--supersedes <id> | ID of memory this supersedes (auto-creates SUPERSEDES relationship) | — |
--code-context <json> | Structured context tag (JSON object). Example: '{"product":"memnexus","team":"mcp","role":"team-lead"}'. Scopes knowledge to a product/team/service/role for retrieval. | — |
--product <name> | Shorthand for codeContext.product | — |
--repo <name> | Shorthand for codeContext.repo | — |
--service <name> | Shorthand for codeContext.service | — |
--component <name> | Shorthand for codeContext.component | — |
--team <name> | Shorthand for codeContext.team | — |
--code-role <name> | Shorthand for codeContext.role (authorship role, e.g. team-lead) | — |
--task-id <id> | Task identifier for agentic loop memories (groups attempts at the same problem) | — |
--outcome <outcome> | Task outcome: resolved | unresolved | — |
--distill | Request LLM distillation into structured 5-section notebook (Pro/Enterprise only) | — |
--interactive | Interactive mode | — |
--stdin-jsonl | Streaming batch create: read JSONL from stdin (one createMemory object per line), create with bounded concurrency (MX_CREATE_CONCURRENCY, default 4), and emit one JSONL result line per input line on stdout ({line, ok, id?, error?, code?}). On failure, code is one of PARSE_ERROR | CREATE_FAILED | QUOTA_STOPPED | NOT_ATTEMPTED | OUTPUT_CLOSED. Exits non-zero if any line failed. | — |
--format <format> | Output format (json|table|yaml) | — |
mx memories update [id]
Update an existing memory (by ID or --name)
| Option | Description | Default |
|---|---|---|
--name <name> | Update a named memory. With --content or --content-file, creates a new version (SUPERSEDES chain). With only --topics, --memory-type, --context or --code-context, updates the current version in place (GH #5614). | — |
--assign-name <name> | Assign a name to an existing memory (kebab-case, 2-64 chars) | — |
--rename <newName> | Rename a named memory (use with --name or an ID that has a name) | — |
--content <text> | Updated content | — |
--content-file <path> | Read updated content verbatim from a file ("-" for stdin). Shell-safe: backticks and $(...) in the text are stored literally instead of being expanded by your shell. Mutually exclusive with --content. | — |
--memory-type <type> | Updated memory type | — |
--context <context> | Updated context | — |
--topics <topics> | Updated topics (comma-separated) | — |
--importance <number> | Updated importance (0-1) | — |
--code-context <json> | Structured context tag (JSON object). Example: '{"product":"memnexus","team":"mcp","role":"team-lead"}'. Scopes knowledge to a product/team/service/role for retrieval. | — |
--outcome <outcome> | Set the task outcome: resolved | unresolved | none (none clears it). By ID only. | — |
--conversation-id <id> | Conversation to group the new version with. Named update (--name) with --content or --content-file only. | — |
--format <format> | Output format (json|table|yaml) | — |
mx memories history <name>
Show version history for a named memory
| Option | Description | Default |
|---|---|---|
--format <format> | Output format (json|table|yaml) | — |
--limit <number> | Maximum versions to show | 20 |
mx memories delete [id]
Delete one or more memories (single, or --batch/--stdin/--all)
| Option | Description | Default |
|---|---|---|
--force | Skip confirmation prompt (single delete only) | — |
--batch <ids...> | Batch delete multiple memories by ID (space- or comma-separated) | — |
--stdin | Batch delete memory IDs read from stdin (one per line or space-separated) | — |
--all | Batch delete ALL of your memories (supports --recent/--topics/--before/--after filters) | — |
--yes | Confirm batch deletion (required for --batch/--stdin/--all in non-interactive mode) | — |
--i-know-this-deletes-everything | Required (with --yes) for unfiltered --all in non-interactive mode | — |
--recent <duration> | Filter for --all: memories from last duration (e.g. 7d, 2w, 1h) | — |
--topics <topics> | Filter for --all: comma-separated topics (matches ANY) | — |
--before <date> | Filter for --all: created before this date (ISO 8601) | — |
--after <date> | Filter for --all: created after this date (ISO 8601) | — |
--format <format> | Output format (json for pure-JSON scripting output) | — |
mx memories search
Search memories (keyword, semantic, hybrid; see also: graphrag query)
| Option | Description | Default |
|---|---|---|
--query <text> | Search query | — |
--limit <number> | Maximum results | 10 |
--mode <mode> | Search mode (unified|content|facts) | — |
--method <method> | Search method: keyword (TF-IDF), semantic (vector), hybrid (both) | — |
--threshold <number> | Minimum score threshold for semantic search (0-1) | 0.5 |
--vector-weight <number> | Weight for vector search in hybrid mode (0-1) | 0.7 |
--fulltext-weight <number> | Weight for fulltext search in hybrid mode (0-1) | 0.3 |
--event-from <datetime> | Filter: event time start, when the described event happened (ISO 8601) | — |
--after <datetime> | Alias for --event-from: event time start (ISO 8601). On search this is event time, not stored time; combines with --recent | — |
--event-to <datetime> | Filter: event time end, when the described event happened (ISO 8601) | — |
--before <datetime> | Alias for --event-to: event time end (ISO 8601). On search this is event time, not stored time | — |
--recent <duration> | Filter: memories stored in the last duration, by ingestion time (e.g., 7d, 2w, 1h, 30m). On search, --recent overrides --from and combines with --after/--event-from | — |
--from <datetime> | Filter: ingestion time start, when the memory was stored (ISO 8601) | — |
--to <datetime> | Filter: ingestion time end, when the memory was stored (ISO 8601) | — |
--topics <topics> | Filter: comma-separated list of topics (matches ANY) | — |
--topic <topics> | Alias for --topics | — |
--exclude-topics <topics> | Filter: exclude memories with these topics (comma-separated) | — |
--type <type> | Filter: memory type (episodic|semantic|procedural) | — |
--conversation-id <id> | Filter: conversation ID | — |
--preview <number> | Content preview length in characters | 100 |
--format <format> | Output format (json|table|yaml|llm|compact) | — |
--compact | Compact output: ID, date, first line (shorthand for --format compact) | — |
--id-only | Output only memory IDs (newline-separated, for piping) | — |
--explain | Include search scoring explanation | — |
--brief | Quick lookup preset: --limit 5 --preview 80 --format json | — |
--timeline | Timeline mode: sort chronologically with timestamps and state indicators. Use --preview <N> (N>100) to show inline content | — |
--group-by <field> | Group results by field (conversation). Shows memories organized by conversation. | — |
--expand-entities | Enable entity graph traversal branch in hybrid search | — |
--expand-topics | Enable topic graph traversal branch in hybrid search | — |
--expand-facts | Enable fact graph traversal branch in hybrid search | — |
--include-superseded | Include superseded/contradicted memories in results | — |
--content-only | Strip output to minimal fields: {id, createdAt, topics, content} (JSON output only) | — |
--effective-only | Exclude superseded/contradicted memories (passes includeSuperseded: false to API) | — |
--task-id <id> | Task-scoped retrieval: own-history first, cross-task fills remainder | — |
--outcome-filter <filter> | Filter by outcome: resolved | unresolved | any | — |
--sort <field> | Sort results by field: score (default), createdAt, updatedAt, eventTime | — |
--order <dir> | Sort direction: asc | desc (default: desc) | — |
--scope <pairs> | Filter by codeContext scope; keys product, service, team, role (e.g. product:memnexus,service:core-api) | — |
--strict | High-precision mode: fulltext-only, no semantic blending. Use for status/incident/deployment queries where exact-token match matters (sets --mode content --method keyword) | — |
mx memories relationships
Manage memory relationships (SUPERSEDES, FOLLOWS, RESOLVES, etc.)
mx memories relationships list <id>
List relationships for a memory
| Option | Description | Default |
|---|---|---|
--direction <dir> | Direction: outgoing (from this memory), incoming (to this memory), both | both |
--format <format> | Output format (json|table|yaml) | — |
mx memories relationships create <id>
Create a relationship from this memory to another
| Option | Description | Default |
|---|---|---|
--target <id> | Target memory ID | — |
--type <type> | Relationship type (SUPERSEDES|FOLLOWS|RESOLVES|CONTRADICTS|REFERENCES) | — |
--confidence <number> | Confidence score (0-1) | 1.0 |
--reason <text> | Explanation for the relationship | — |
--interactive | Interactive mode | — |
--format <format> | Output format (json|table|yaml) | — |
mx memories relationships delete <id> <relationshipId>
Delete a relationship
| Option | Description | Default |
|---|---|---|
--force | Skip confirmation prompt | — |
mx memories timeline <id>
Get timeline context for a memory (related memories before and after)
| Option | Description | Default |
|---|---|---|
--before <number> | Number of memories before | 5 |
--after <number> | Number of memories after | 5 |
--format <format> | Output format (json|table|yaml) | — |
mx memories detect-relationships <id>
Auto-detect potential relationships for a memory
| Option | Description | Default |
|---|---|---|
--auto-create | Automatically create high-confidence relationships | — |
--min-confidence <number> | Minimum confidence threshold (0-1) | 0.7 |
--format <format> | Output format (json|table|yaml) | — |
mx memories digest
AI-synthesized summary for humans — reports, handoffs, Slack updates (alias: recall | see also: recap)
| Option | Description | Default |
|---|---|---|
--query <text> | Search query for the digest (required) | — |
--recent <duration> | Time window (e.g., 24h, 7d, 2w) | — |
--topics <topics> | Filter by topics (comma-separated) | — |
--digest-format <format> | Digest format (structured|narrative|timeline|status-report) | structured |
--max-sources <number> | Maximum source memories to consider | 20 |
--show-sources | Display source memory IDs | — |
--scope <pairs> | Restrict to memories whose codeContext matches, as comma-separated key:value pairs (e.g. product:memnexus,team:retrieval). Keys: product, service, team, role. All pairs must match. No match returns 0 sources; there is no unscoped fallback | — |
--include-unscoped | With --scope, also include memories that carry no codeContext (default: scoped only) | — |
--format <format> | Output format (json|yaml|llm) | — |
mx memories status
Project status: Done / In Progress / Remaining — AI synthesis of memory corpus (alias for: digest --digest-format status-report)
| Option | Description | Default |
|---|---|---|
--query <text> | Topic or project to get status for (required) | — |
--recent <duration> | Time window (e.g., 24h, 7d, 2w) | — |
--topics <topics> | Filter by topics (comma-separated) | — |
--max-sources <number> | Maximum source memories to consider | 20 |
--show-sources | Display source memory IDs | — |
--format <format> | Output format (json|yaml|llm) | — |
mx memories recap
Quick raw recap of recent work — fast, agent-friendly (see also: digest / recall)
| Option | Description | Default |
|---|---|---|
--recent <duration> | Time window (e.g., 24h, 7d, 2w) | 24h |
--query <text> | Optional search query to filter results | — |
--limit <number> | Maximum memories to fetch | 200 |
--exclude-topics <topics> | Exclude memories with these topics (comma-separated) | auto-saved |
--format <format> | Output format (json|table|yaml) | — |
mx memories build-context
Get contextual briefing before starting work
| Option | Description | Default |
|---|---|---|
--context <text> | What you are about to work on | — |
--files <paths...> | File paths you will be touching | — |
--recent <hours> | How far back to look in hours (default: 24) | 24 |
--scope <pairs> | Restrict to memories whose codeContext matches, as comma-separated key:value pairs (e.g. product:memnexus,team:retrieval). Keys: product, service, team, role. All pairs must match. No match returns 0 sources; there is no unscoped fallback | — |
--include-unscoped | With --scope, also include memories that carry no codeContext (default: scoped only) | — |
--format <format> | Output format (json|table|yaml) | — |
mx memories stats
Aggregated memory analytics (group by day, week, month, or topic)
| Option | Description | Default |
|---|---|---|
--group-by <dimension> | Group by: day, week, month, topic (required) | — |
--after <date> | Start date filter (ISO 8601 or YYYY-MM-DD) | — |
--before <date> | End date filter | — |
--recent <duration> | Time window (e.g. 1w, 2w, 1mo) | — |
--topic <topic> | Filter to a specific topic before grouping | — |
--limit <n> | Max groups to return | 20 |
--format <fmt> | Output format: table (default), json, csv | — |
conversations
Query and manage conversations
mx conversations list
List conversations
| Option | Description | Default |
|---|---|---|
--page <number> | Page number | 0 |
--limit <number> | Results per page | 10 |
--recent <duration> | Time window (e.g., 24h, 7d, 2w) | — |
--since <iso> | Only conversations created at or after this time, ISO 8601 (e.g. 2026-07-01 or 2026-07-01T00:00:00Z). Cannot be combined with --recent, by design, so neither bound is silently dropped | — |
--min-memories <n> | Only show conversations with at least N memories; 0 includes empty conversations | 1 |
--sort <field> | Sort by: createdAt (default), memoryCount, or lastActivityAt. Note: lastActivityAt currently sorts by creation time, because the server never updates it (#5794) | — |
--order <dir> | Sort direction: asc | desc (default: desc) | — |
--format <format> | Output format (json|table|yaml) | — |
mx conversations summary <id>
Get conversation summary
| Option | Description | Default |
|---|---|---|
--format <format> | Output format (json|table|yaml) | — |
mx conversations timeline <id>
Get conversation timeline
| Option | Description | Default |
|---|---|---|
--format <format> | Output format (json|table|yaml) | — |
mx conversations search
Search conversations
| Option | Description | Default |
|---|---|---|
--query <text> | Search query | — |
--limit <number> | Maximum results | 10 |
--format <format> | Output format (json|table|yaml) | — |
--brief | Quick lookup preset: --limit 5 --format json | — |
mx conversations by-topic
Find conversations by topic
| Option | Description | Default |
|---|---|---|
--topic <id> | Topic ID | — |
--topic-id <id> | Topic ID (alias for --topic) | — |
--format <format> | Output format (json|table|yaml) | — |
facts
Manage semantic facts
mx facts list
List facts
| Option | Description | Default |
|---|---|---|
--page <number> | Page number | 0 |
--limit <number> | Results per page | 10 |
--format <format> | Output format (json|table|yaml) | — |
mx facts get <id>
Get a specific fact
| Option | Description | Default |
|---|---|---|
--format <format> | Output format (json|table|yaml) | — |
mx facts create
Create a new fact
| Option | Description | Default |
|---|---|---|
--subject <text> | Fact subject (entity name) | — |
--predicate <text> | Relationship type | — |
--object <text> | Fact object (related entity) | — |
--confidence <number> | Confidence score (0-1) | 1.0 |
--memory-id <id> | Associated memory ID | — |
--interactive | Interactive mode | — |
--format <format> | Output format (json|table|yaml) | — |
mx facts update <id>
Update an existing fact
| Option | Description | Default |
|---|---|---|
--subject <text> | Updated subject | — |
--predicate <text> | Updated predicate | — |
--object <text> | Updated object | — |
--confidence <number> | Updated confidence (0-1) | — |
--format <format> | Output format (json|table|yaml) | — |
mx facts delete <id>
Delete a fact
| Option | Description | Default |
|---|---|---|
--force | Skip confirmation prompt | — |
mx facts search
Search facts
| Option | Description | Default |
|---|---|---|
--query <text> | Search query | — |
--limit <number> | Maximum results | 10 |
--format <format> | Output format (json|table|yaml) | — |
--brief | Quick lookup preset: --limit 5 --format json | — |
topics
Manage topics and graph operations
mx topics list
List topics
| Option | Description | Default |
|---|---|---|
--page <number> | Page number | 0 |
--limit <number> | Results per page | 10 |
--context-id <id> | Filter by context | — |
--format <format> | Output format (json|table|yaml) | — |
mx topics get <id>
Get topic details
| Option | Description | Default |
|---|---|---|
--format <format> | Output format (json|table|yaml) | — |
mx topics merge
Merge two topics
| Option | Description | Default |
|---|---|---|
--source-id <id> | Source topic ID | — |
--target-id <id> | Target topic ID | — |
--force | Skip confirmation | — |
--format <format> | Output format (json|table|yaml) | — |
mx topics discover-related
Discover related topics via graph traversal (see also: search)
| Option | Description | Default |
|---|---|---|
--topic <id> | Topic ID (required) | — |
--topic-id <id> | Topic ID (alias for --topic) | — |
--context-id <id> | Filter by context | — |
--limit <number> | Max results | 10 |
--format <format> | Output format (json|table|yaml) | — |
mx topics similarity
Calculate similarity between topics
| Option | Description | Default |
|---|---|---|
--topic-id-1 <id> | First topic ID (required) | — |
--topic-id-2 <id> | Second topic ID (required) | — |
--format <format> | Output format (json|table|yaml) | — |
mx topics find-similar
Find similar topics
| Option | Description | Default |
|---|---|---|
--topic-id <id> | Topic ID (required) | — |
--threshold <number> | Similarity threshold (0-1) | 0.7 |
--limit <number> | Max results | 10 |
--format <format> | Output format (json|table|yaml) | — |
mx topics cluster
Cluster topics using graph algorithms
| Option | Description | Default |
|---|---|---|
--algorithm <type> | Clustering algorithm (kmeans|hierarchical|dbscan) | kmeans |
--num-clusters <number> | Number of clusters | — |
--context-id <id> | Filter by context | — |
--format <format> | Output format (json|table|yaml) | — |
mx topics detect-communities
Detect communities in topic graph
| Option | Description | Default |
|---|---|---|
--algorithm <type> | Community detection algorithm (louvain|label-propagation) | louvain |
--context-id <id> | Filter by context | — |
--min-size <number> | Minimum community size | 2 |
--format <format> | Output format (json|table|yaml) | — |
mx topics search
Search topics by query string (see also: discover-related)
| Option | Description | Default |
|---|---|---|
--query <text> | Search query (required) | — |
--limit <number> | Maximum results | 10 |
--format <format> | Output format (json|table|yaml) | — |
entities
Manage entities and graph health
mx entities list
List entities
| Option | Description | Default |
|---|---|---|
--query <text> | Filter by entity name (case-insensitive substring match) | — |
--type <type> | Filter by entity type (e.g., PERSON, TECHNOLOGY) | — |
--limit <number> | Results per page | 10 |
--offset <number> | Number of entities to skip | 0 |
--format <format> | Output format (json|table|yaml) | — |
mx entities get <id>
Get entity details
| Option | Description | Default |
|---|---|---|
--format <format> | Output format (json|table|yaml) | — |
mx entities memories <id>
Get memories mentioning an entity
| Option | Description | Default |
|---|---|---|
--limit <number> | Results per page | 10 |
--offset <number> | Number of memories to skip | 0 |
--format <format> | Output format (json|table|yaml) | — |
mx entities health
Show graph health and extraction coverage
| Option | Description | Default |
|---|---|---|
--format <format> | Output format (json|table|yaml) | — |
patterns
Manage behavioral patterns
mx patterns list
List patterns
| Option | Description | Default |
|---|---|---|
--page <number> | Page number | 0 |
--limit <number> | Results per page | 10 |
--format <format> | Output format (json|table|yaml) | — |
mx patterns compile
Compile patterns from memories
mx patterns update <id>
Update a pattern
| Option | Description | Default |
|---|---|---|
--description <text> | Updated description | — |
--active <boolean> | Enable/disable pattern | — |
--metadata <json> | Updated metadata | — |
--format <format> | Output format (json|table|yaml) | — |
mx patterns feedback
Record pattern feedback
| Option | Description | Default |
|---|---|---|
--pattern-id <id> | Pattern ID (required) | — |
--feedback-type <type> | Feedback type (positive|negative|neutral) (required) | — |
--comment <text> | Feedback comment | — |
mx patterns behavior-state
Get behavioral state
| Option | Description | Default |
|---|---|---|
--format <format> | Output format (json|table|yaml) | — |
mx patterns set-behavior-state
Set behavioral state
| Option | Description | Default |
|---|---|---|
--state <json> | Behavioral state JSON (required) | — |
--merge | Merge with existing state instead of replacing | — |
mx patterns detect
Detect recurring behavioral patterns from memories
| Option | Description | Default |
|---|---|---|
--context-filter <context> | Filter patterns by context | — |
--timeframe-start <date> | Start of detection timeframe (ISO 8601) | — |
--timeframe-end <date> | End of detection timeframe (ISO 8601) | — |
--min-confidence <number> | Minimum confidence threshold (0-1) | 0.5 |
--max-results <number> | Maximum patterns to return | 20 |
--auto-store | Automatically store detected patterns | — |
--format <format> | Output format (json|table|yaml) | — |
mx patterns analyze
Analyze pattern trends, correlations, and generate insights
| Option | Description | Default |
|---|---|---|
--time-range <days> | Analysis time range in days | 30 |
--group-by <criteria> | Group analysis by criteria (type|context|confidence) | — |
--include-details | Include detailed breakdown | — |
--format <format> | Output format (json|table|yaml) | — |
mx patterns compile-instructions
Compile stored behavioral patterns into actionable AI context instructions
| Option | Description | Default |
|---|---|---|
--context <tags> | Comma-separated topic tags matching current conversation topics (boosts patterns with matching metadata) | — |
--query <text> | Current query or task description; enables embedding-based matching for more relevant instructions (max 2000 characters) | — |
--token-budget <n> | Maximum tokens to use for instructions (50-2000) | 200 |
--min-confidence <n> | Minimum pattern confidence threshold (0-1) | 0.6 |
--max-instructions <n> | Maximum number of instructions to return (1-10) | 5 |
--format <format> | Output format (json|table) | table |
graphrag
Execute GraphRAG queries
mx graphrag query
Execute GraphRAG query (see also: memories search)
| Option | Description | Default |
|---|---|---|
--query <text> | Query text (required) | — |
--context-id <id> | Context ID | — |
--mode <mode> | Query mode (local|global|hybrid) | hybrid |
--max-depth <number> | Graph traversal depth | 3 |
--limit <number> | Max results | 10 |
--format <format> | Output format (json|table|yaml) | — |
mx graphrag explain <result-id>
Explain query result
| Option | Description | Default |
|---|---|---|
--format <format> | Output format (json|table|yaml) | — |
mx graphrag query-communities
Query communities
| Option | Description | Default |
|---|---|---|
--query <text> | Query text (required) | — |
--context-id <id> | Context ID | — |
--limit <number> | Max communities | 10 |
--format <format> | Output format (json|table|yaml) | — |
artifacts
Manage artifacts
mx artifacts list
List artifacts
| Option | Description | Default |
|---|---|---|
--page <number> | Page number | 0 |
--limit <number> | Results per page | 10 |
--context-id <id> | Filter by context | — |
--type <type> | Filter by artifact type | — |
--format <format> | Output format (json|table|yaml) | — |
mx artifacts get <id>
Get artifact details
| Option | Description | Default |
|---|---|---|
--format <format> | Output format (json|table|yaml) | — |
mx artifacts create
Create artifact
| Option | Description | Default |
|---|---|---|
--name <name> | Artifact name | — |
--type <type> | Artifact type | — |
--context-id <id> | Context ID | — |
--data <json> | Artifact data as JSON | — |
--metadata <json> | Artifact metadata as JSON | — |
--interactive | Interactive mode | — |
--format <format> | Output format (json|table|yaml) | — |
mx artifacts update <id>
Update artifact
| Option | Description | Default |
|---|---|---|
--name <name> | Updated name | — |
--data <json> | Updated data | — |
--metadata <json> | Updated metadata | — |
--format <format> | Output format (json|table|yaml) | — |
mx artifacts delete <id>
Delete artifact
| Option | Description | Default |
|---|---|---|
--force | Skip confirmation | — |
apikeys
Manage API keys
mx apikeys list
List API keys
| Option | Description | Default |
|---|---|---|
--page <number> | Page number | 0 |
--limit <number> | Results per page | 10 |
--format <format> | Output format (json|table|yaml) | — |
mx apikeys create
Create API key
| Option | Description | Default |
|---|---|---|
--label <label> | Key label (optional) | — |
--expires-at <date> | Expiration date (ISO 8601 format, optional) | — |
mx apikeys delete <id>
Delete API key
| Option | Description | Default |
|---|---|---|
--force | Skip confirmation | — |
system
System health and statistics
mx system health
Check system health
| Option | Description | Default |
|---|---|---|
--format <format> | Output format (json|table|yaml) | — |
mx system status
Get system status
| Option | Description | Default |
|---|---|---|
--format <format> | Output format (json|table|yaml) | — |
mx system features
Get feature flags
| Option | Description | Default |
|---|---|---|
--format <format> | Output format (json|table|yaml) | — |
update
Check for and install CLI updates
mx update
Check for and install CLI updates
| Option | Description | Default |
|---|---|---|
--check | Check for updates without installing | — |
--version <version> | Install a specific version | — |
--yes | Skip confirmation prompt | — |
narratives
Manage narrative threads (group related memories into storylines)
mx narratives list
List narrative threads
| Option | Description | Default |
|---|---|---|
--page <number> | Page number | 0 |
--limit <number> | Results per page | 10 |
--state <state> | Filter by state (open|resolved|reopened|superseded) | — |
--topics <topics> | Filter by topics (comma-separated) | — |
--format <format> | Output format (json|table|yaml) | — |
mx narratives get <id>
Get a specific narrative
| Option | Description | Default |
|---|---|---|
--format <format> | Output format (json|table|yaml) | — |
mx narratives create
Create a new narrative thread
| Option | Description | Default |
|---|---|---|
--title <text> | Narrative title | — |
--root-memory-id <id> | ID of the first memory in this narrative | — |
--topics <topics> | Comma-separated topics | — |
--interactive | Interactive mode | — |
--format <format> | Output format (json|table|yaml) | — |
mx narratives update <id>
Update a narrative
| Option | Description | Default |
|---|---|---|
--title <text> | Updated title | — |
--state <state> | Updated state (open|resolved|reopened|superseded) | — |
--topics <topics> | Updated topics (comma-separated) | — |
--format <format> | Output format (json|table|yaml) | — |
mx narratives delete <id>
Delete a narrative (memories are preserved)
| Option | Description | Default |
|---|---|---|
--force | Skip confirmation prompt | — |
mx narratives timeline <id>
Get timeline of memories in a narrative
| Option | Description | Default |
|---|---|---|
--limit <number> | Maximum memories to return | 20 |
--page <number> | Page number | 0 |
--format <format> | Output format (json|table|yaml) | — |
setup
Configure MCP server integration for AI coding agents
mx setup verify
Health-check all configured agents
mx setup rules
Write or update MemNexus steering rules for an agent
| Option | Description | Default |
|---|---|---|
--agent <id> | Agent to target (default: claude-code) | claude-code |
--project <dir> | Project directory (default: global scope) | — |
--dry-run | Preview changes without writing files | — |
--print | Print rules to stdout instead of writing to a file (for copy-paste) | — |
--no-markers | Omit BEGIN/END comment markers from output (with --print) | — |
mx setup remove
Remove MemNexus config from an agent
| Option | Description | Default |
|---|---|---|
--agent <id> | Agent to remove config from | — |
--project <dir> | Project directory (default: global scope) | — |
mx setup hooks
Install or remove the CommitContext post-commit hook
| Option | Description | Default |
|---|---|---|
--project <dir> | Project directory (default: cwd) | — |
--remove | Remove the hook instead of installing | — |
--yes | Skip confirmation prompts | — |
--dry-run | Preview changes without writing files | — |
mx setup skills
Install or manage MemNexus Claude Code slash commands (/mx-save, /mx-checkpoint, /mx-buildcontext)
| Option | Description | Default |
|---|---|---|
--dry-run | Preview changes without writing files | — |
--force | Overwrite even if versions match | — |
--remove | Remove all mx-* skills | — |
--list | Show installed skills and their versions | — |
mcp
MCP bridge commands
mx mcp serve
Start stdio↔HTTP MCP bridge (used by AI agents)
| Option | Description | Default |
|---|---|---|
--url <url> | MCP server URL | https://mcp.memnexus.ai/mcp |
--verbose | Log full JSON-RPC message payloads | — |
--inject-rules | Inject MemNexus steering rules into the MCP initialize response (used for Claude Desktop) | — |
mx mcp logs
Show MCP bridge log file location and recent output
| Option | Description | Default |
|---|---|---|
-n, --lines <count> | Number of lines to show | 50 |
-f, --follow | Follow log output (like tail -f) | — |
--path | Only print the log file path | — |
mx mcp status
Show MCP bridge connection status
| Option | Description | Default |
|---|---|---|
--json | Output as JSON | — |
mx mcp install
Configure MCP bridge for an AI coding agent (alias for mx setup)
| Option | Description | Default |
|---|---|---|
--client <id> | Agent to configure: claude-code | claude-desktop | copilot | cursor | codex | opencode | chatgpt. Omit for interactive picker. | — |
--project <dir> | Project directory (default: global scope) | — |
--yes | Skip confirmation prompts | — |
--dry-run | Preview changes without writing files | — |
--skip-hooks | Skip lifecycle hook installation | — |
mx mcp hooks
Manage MemNexus lifecycle hooks
mx mcp hooks remove
Remove MemNexus lifecycle hooks from an AI coding agent
| Option | Description | Default |
|---|---|---|
--client <id> | Agent to remove hooks from (default: claude-code) | claude-code |
--project <dir> | Project directory (default: global scope) | — |
mx mcp restart
Restart the MCP bridge (kills running bridge processes so the MCP client auto-restarts them)
mx mcp doctor
Run a full MCP health check (bridge status + agent config verification)
| Option | Description | Default |
|---|---|---|
--json | Output as JSON | — |
mx mcp list
List AI coding agents and their MemNexus MCP configuration status
| Option | Description | Default |
|---|---|---|
--json | Output as JSON | — |
hook
Git hook handlers
mx hook post-commit
Capture commit context (called by post-commit hook)
| Option | Description | Default |
|---|---|---|
--cwd <dir> | Working directory | current directory |
--dry-run | Print output without saving | — |
--no-sync | Skip API sync (cache only) | — |
--summarizer <type> | Summarizer: llm (default) or heuristic | llm |
--no-enrich | Skip commit message enrichment | — |
commit-context
View captured commit context entries
mx commit-context list
List recent commit contexts
| Option | Description | Default |
|---|---|---|
--local | Read from local cache only (no API) | — |
--recent <period> | Time filter (e.g. 24h, 7d) | 7d |
--limit <n> | Max results | 10 |
--branch <name> | Filter by branch name | — |
--agent <name> | Filter by agent name (e.g. claude-code) | — |
--format <format> | Output format | — |
mx commit-context show <sha>
Show full commit context for a specific commit
| Option | Description | Default |
|---|---|---|
--local | Read from local cache only | — |
--format <format> | Output format | — |
mx commit-context sync
Upload unsynced local cache entries to the API
| Option | Description | Default |
|---|---|---|
--limit <n> | Max entries to sync | 50 |
--dry-run | Show what would be synced without syncing | — |
--format <format> | Output format | — |
feedback
Send a bug report, feature request or question about MemNexus itself to the MemNexus team (not mx patterns feedback)
mx feedback
Send a bug report, feature request or question about MemNexus itself to the MemNexus team (not mx patterns feedback)
| Option | Description | Default |
|---|---|---|
--title <text> | Short title (5-200 characters, required) | — |
--body <text> | Details (10-5000 characters, required). For a bug: steps to reproduce, expected and actual behaviour, error messages. For text with backticks or $(...), use --body-file: the shell expands them inside double quotes. | — |
--body-file <path> | Read the body verbatim from a file ("-" for stdin). Shell-safe: backticks and $(...) are sent literally. Mutually exclusive with --body. | — |
--category <category> | One of: bug, feature, question, other | other |
Environment variables
| Variable | Description | Default |
|---|---|---|
MX_API_URL | API base URL | https://api.memnexus.ai |
MX_API_KEY | Authentication key | — |
MX_OUTPUT_FORMAT | Default output format | table |
MX_DEFAULT_PAGE_SIZE | Pagination size | 20 |
MX_REQUEST_TIMEOUT_MS | How long one API call may wait for a response, SDK retries included, in milliseconds (1000 to 600000). On timeout the command exits 4 and names this variable. mx memories recall, digest and status keep their own 180 s limit (MX_RECALL_MAX_MS for recall and digest) | 60000 |
MX_NAME_SUGGESTIONS | Set to 0, false or off to stop mx memories get --name making one extra request on a miss. With it on, a miss lists up to 3 similar existing names on stderr, labelled as not the requested name; the request has a 5 s total limit and a 2 MB body cap, and on any failure the plain advice prints. The exit code (1) is the same either way | on |
Exit codes
Every error is written to stderr. Scripts can branch on the exit code (mx --help lists the same codes):
| Code | Meaning |
|---|---|
0 | Success |
1 | General failure: not found (HTTP 404), an error the CLI did not expect, or a request that got no response for a reason other than a network failure |
2 | Invalid or missing input (HTTP 400, 413 or 422, or the CLI's own input check) |
3 | Authentication or permission failure (HTTP 401, 403) |
4 | Network failure: the request failed below HTTP (connection refused or reset, DNS failure, timeout, abort, or a TLS certificate error). The Cause: line on stderr names the code. A retry can succeed for connection, DNS and timeout causes; a TLS cause usually needs a certificate or URL fix. A call with no response within MX_REQUEST_TIMEOUT_MS (default 60000 ms) exits 4 with a message naming that variable. An HTTP response never exits with 4 |
5 | Server-side failure: HTTP 5xx, 429 and other HTTP errors, a quota limit, an unusable response body, or the client-side timeout of mx memories digest |
6 | Partial result from mx memories search, digest or status: at least one search branch failed |
mx mcp serve is a long-running bridge and keeps its own exit behaviour.