CLI Reference
The memorylayer-server package (version 0.2.0) installs two commands:
memorylayer— run the server and manage data, skills, and MCP server entriesmemorylayer-eval— score retrieval quality against a corpus (see memorylayer-eval)
Installation
pip install memorylayer-serverGlobal Options
| Option | Description | Default |
|---|---|---|
--verbose / -v | Enable debug logging | false |
Commands
memorylayer serve
Start the HTTP REST API server.
memorylayer serve [OPTIONS]Options:
| Option | Description | Default |
|---|---|---|
--port | Port to listen on | MEMORYLAYER_SERVER_PORT or 61001 |
--host | Host to bind to | MEMORYLAYER_SERVER_HOST or 127.0.0.1 |
With no configuration, the server uses SQLite under ~/.config/memorylayer-server and the hash embedding provider, so it starts without an API key or peer container. See Configuration.
Examples:
# Start on default portmemorylayer serveStarting memorylayer.ai server on 127.0.0.1:61001INFO: Started server processINFO: Waiting for application startup.INFO: Application startup complete.INFO: Uvicorn running on http://127.0.0.1:61001# Custom host and port for network accessmemorylayer serve --host 0.0.0.0 --port 8080Starting memorylayer.ai server on 0.0.0.0:8080INFO: Uvicorn running on http://0.0.0.0:8080# Debug mode with verbose loggingmemorylayer -v serveStarting memorylayer.ai server on 127.0.0.1:61001DEBUG: memorylayer_server - Loading plugins...DEBUG: memorylayer_server - Embedding service initializedINFO: Uvicorn running on http://127.0.0.1:61001memorylayer version
Show version information.
memorylayer versionmemorylayer.ai v0.2.0memorylayer info
Show system information and configuration. Displays all MEMORYLAYER_* environment variables and their current values. Secret keys are redacted by default.
memorylayer info [OPTIONS]Options:
| Option | Description | Default |
|---|---|---|
--format | Output format: text or json | text |
--reveal-secrets | Reveal secret keys in text output | false |
Examples:
# Show configuration in text format (secrets redacted)memorylayer info# ==================================================# MemoryLayer.ai Configuration# exported at 2026-01-15T10:30:00+00:00# version = v0.2.0# ==================================================MEMORYLAYER_DATA_DIR=/home/user/.config/memorylayer-serverMEMORYLAYER_EMBEDDING_PROVIDER=openaiMEMORYLAYER_EMBEDDING_OPENAI_API_KEY=(redacted)MEMORYLAYER_LLM_PROFILE_DEFAULT_PROVIDER=openaiMEMORYLAYER_LLM_PROFILE_DEFAULT_API_KEY=(redacted)MEMORYLAYER_LLM_PROFILE_DEFAULT_MODEL=gpt-4o-miniMEMORYLAYER_SERVER_HOST=127.0.0.1MEMORYLAYER_SERVER_PORT=61001# JSON format for scriptingmemorylayer info --format json{ "data_dir": "/home/user/.config/memorylayer-server", "embedding_provider": "openai", "embedding_openai_api_key": "(redacted)", "llm_profile_default_provider": "openai", "llm_profile_default_api_key": "(redacted)", "llm_profile_default_model": "gpt-4o-mini", "server_host": "127.0.0.1", "server_port": "61001"}# Reveal all secrets (use with caution)memorylayer info --reveal-secretsmemorylayer export
Export workspace memories and associations to NDJSON format. Connects to a running MemoryLayer server and streams the export.
memorylayer export [OPTIONS]Options:
| Option | Description | Default |
|---|---|---|
-w, --workspace | Workspace ID to export (required) | — |
-o, --output | Output file path (default: stdout) | stdout |
--offset | Skip first N memories | 0 |
--limit | Export at most N memories (0 = unlimited) | 0 |
--include-associations / --no-associations | Include associations | true |
--server-url | MemoryLayer server URL | http://localhost:61001 |
--api-key | API key for authentication | null |
Examples:
# Export entire workspace to filememorylayer export -w my-workspace -o backup.ndjsonExported 142 memories and 38 associations to backup.ndjson# Export to stdout (pipe to other tools)memorylayer export -w my-workspace{"type": "header", "version": "1.0", "workspace_id": "my-workspace", "exported_at": "2026-01-15T10:30:00+00:00", "total_memories": 142, "total_associations": 38, "offset": 0, "limit": 0}{"type": "memory", "index": 0, "data": {"id": "mem_abc123", "content": "User prefers Python", "type": "semantic", ...}}{"type": "memory", "index": 1, "data": {"id": "mem_def456", "content": "Project uses FastAPI", "type": "semantic", ...}}{"type": "footer", "memories_exported": 142, "associations_exported": 38}# Export first 50 memories without associationsmemorylayer export -w my-workspace -o partial.ndjson --limit 50 --no-associationsExported 50 memories and 0 associations to partial.ndjson# Export from a remote server with authenticationmemorylayer export -w my-workspace -o backup.ndjson \ --server-url https://memorylayer.example.com \ --api-key sk-my-api-keyExported 142 memories and 38 associations to backup.ndjsonmemorylayer import
Import memories from a JSON or NDJSON file into a workspace. The format is auto-detected from the file content.
memorylayer import FILE [OPTIONS]Arguments:
| Argument | Description |
|---|---|
FILE | Path to the import file (JSON or NDJSON) |
Options:
| Option | Description | Default |
|---|---|---|
-w, --workspace | Target workspace ID (required) | — |
--dry-run | Show what would be imported without writing | false |
--server-url | MemoryLayer server URL | http://localhost:61001 |
--api-key | API key for authentication | null |
Examples:
# Dry run to preview importmemorylayer import backup.ndjson -w my-workspace --dry-runWould import 142 memories and 38 associations into workspace my-workspace - [semantic] mem_abc123: User prefers Python for backend development - [semantic] mem_def456: Project uses FastAPI framework - [procedural] mem_ghi789: Deploy with docker compose up -d - [episodic] mem_jkl012: Debugging session resolved auth token expiry ... and 138 more# Import NDJSON filememorylayer import backup.ndjson -w new-workspaceImport complete: Imported: 140 Skipped (duplicates): 2 Errors: 0 Imported 38 associations# Import JSON file into a remote servermemorylayer import data.json -w target-workspace \ --server-url https://memorylayer.example.com \ --api-key sk-my-api-keyImport complete: Imported: 50 Skipped (duplicates): 0 Errors: 0memorylayer —help
Show help information for all commands.
memorylayer --helpUsage: memorylayer [OPTIONS] COMMAND [ARGS]...
MemoryLayer.ai - Memory infrastructure for LLM-powered agents.
Options: -v, --verbose Enable verbose logs --help Show this message and exit.
Commands: export Export workspace memories to NDJSON (streaming). import Import memories from JSON or NDJSON file into workspace. info Show system information and configuration. mcp Manage MCP server registry stored in MemoryLayer. serve Start the HTTP REST API server. skills Manage agent skills stored in MemoryLayer. version Show version information.You can also get help for individual commands:
memorylayer serve --helpmemorylayer export --helpmemorylayer import --helpmemorylayer skills --helpmemorylayer mcp --helpmemorylayer skills
Manage workspace skill packages stored in MemoryLayer.
memorylayer skills COMMAND [OPTIONS]| Subcommand | Description |
|---|---|
list | List visible skills (--show-shadowed includes shadowed duplicates) |
push | Parse a skill directory and upload it (--scope user|workspace|global, --mode server|mirrored|filesystem) |
pull | Download a named skill to a local directory |
materialize | Bulk-pull all visible skills to a local directory (default ~/.claude/skills) |
sync | Reconcile a mirrored skill directory with the server (--auto-push, --auto-pull) |
watch | Watch a skill directory and push changes on save |
migrate-from-local | Scan a local skills directory (default ~/.claude/skills) and push every skill found |
All subcommands accept -w / --workspace, --server-url (default http://localhost:61001), and --api-key.
Skills are stored server-side via the /v1/skills API and surfaced to MCP clients through the skills_list / skills_get / skills_get_file / skills_search tools (and skills_save in the full MCP profile).
memorylayer mcp
Manage workspace-scoped MCP server registry entries.
memorylayer mcp COMMAND [OPTIONS]| Subcommand | Description |
|---|---|
list | List registered MCP servers (--transport, --enabled-only/--all, --format text|json) |
push | Import MCP servers from a .mcp.json file |
pull | Export registered MCP servers to a .mcp.json file (--reveal-secrets to include env and header values) |
sync | Sync a .mcp.json file with MemoryLayer |
materialize | Write all enabled servers to a .mcp.json file |
watch | Watch a .mcp.json file and push changes on save |
migrate-from-local | Scan ~/.claude.json (--scope user|local) and push its MCP servers |
All subcommands accept -w / --workspace, --server-url (default http://localhost:61001), and --api-key.
Entries are stored server-side via the /v1/mcp-servers API and exposed to LLMs through the mcp_servers_* MCP tools (available in the full profile).
memorylayer-eval
Retrieval-quality harness shipped with memorylayer-server. It ingests a corpus into a fresh, temporary store, runs the queries, and reports recall@k, precision@k, MRR, and nDCG. The package bundles a small synthetic fixture corpus, so it runs with no arguments. MemoryLayer’s own CI runs memorylayer-eval gate as a required step.
memorylayer-eval {gate,run} [OPTIONS]| Command | Behavior |
|---|---|
run | Score only; always exits 0 |
gate | Score and check thresholds; exits 1 if ranking quality falls below the floors |
Common options:
| Option | Description | Default |
|---|---|---|
--corpus / --qrels | Corpus JSONL and relevance-judgment JSON | bundled fixture |
--k | Cutoff for precision/recall | 5 |
--embedding-provider | Embedding provider to evaluate | hash |
--dimensions | Embedding dimensions | provider default |
--embed-server-url | Embed-server URL when the provider is embed_server | http://localhost:61051 |
--hybrid / --no-hybrid | Force keyword + vector fusion on or off | server default |
--reranker | none, rrf, llm, or hyde | none |
--storage-backend | sqlite, postgresql, or in_memory | sqlite |
--data-dir | Storage directory | fresh temp dir |
--json | Emit JSON instead of text | off |
--min-recall, --min-first-relevant, --min-expected-top1 | Override the gate thresholds | built-in floors |
# Score the bundled fixture with the default hash embeddermemorylayer-eval run
# Gate a self-hosted embedding setupmemorylayer-eval gate --embedding-provider embed_server --dimensions 384Usage with Claude Code
The CLI is used to run the HTTP server:
HTTP Server — Run memorylayer serve in a terminal, then connect via SDK or the separate MCP server package (@scitrera/memorylayer-mcp-server).
The MCP server is a separate TypeScript package, not part of the core server CLI.
See Claude Code Integration for detailed setup instructions.