Skip to content

CLI Reference

The memorylayer CLI is provided by the memorylayer-server package.

Installation

Terminal window
pip install memorylayer-server

Global Options

OptionDescriptionDefault
--verbose / -vEnable debug loggingfalse

Commands

memorylayer serve

Start the HTTP REST API server.

Terminal window
memorylayer serve [OPTIONS]

Options:

OptionDescriptionDefault
--portPort to listen on61001
--hostHost to bind to127.0.0.1

Examples:

Terminal window
# Start on default port
memorylayer serve
Starting memorylayer.ai server on 127.0.0.1:61001
INFO: Started server process
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://127.0.0.1:61001
Terminal window
# Custom host and port for network access
memorylayer serve --host 0.0.0.0 --port 8080
Starting memorylayer.ai server on 0.0.0.0:8080
INFO: Uvicorn running on http://0.0.0.0:8080
Terminal window
# Debug mode with verbose logging
memorylayer -v serve
Starting memorylayer.ai server on 127.0.0.1:61001
DEBUG: memorylayer_server - Loading plugins...
DEBUG: memorylayer_server - Embedding service initialized
INFO: Uvicorn running on http://127.0.0.1:61001

memorylayer version

Show version information.

Terminal window
memorylayer version
memorylayer.ai v0.1.22

memorylayer info

Show system information and configuration. Displays all MEMORYLAYER_* environment variables and their current values. Secret keys are redacted by default.

Terminal window
memorylayer info [OPTIONS]

Options:

OptionDescriptionDefault
--formatOutput format: text or jsontext
--reveal-secretsReveal secret keys in text outputfalse

Examples:

Terminal window
# Show configuration in text format (secrets redacted)
memorylayer info
# ==================================================
# MemoryLayer.ai Configuration
# exported at 2026-01-15T10:30:00+00:00
# version = v0.1.22
# ==================================================
MEMORYLAYER_DATA_DIR=/home/user/.config/memorylayer-server
MEMORYLAYER_EMBEDDING_PROVIDER=embed_server
MEMORYLAYER_EMBED_SERVER_URL=http://localhost:61051
MEMORYLAYER_LLM_PROFILE_DEFAULT_PROVIDER=openai
MEMORYLAYER_LLM_PROFILE_DEFAULT_API_KEY=(redacted)
MEMORYLAYER_LLM_PROFILE_DEFAULT_MODEL=gpt-4o-mini
MEMORYLAYER_SERVER_HOST=127.0.0.1
MEMORYLAYER_SERVER_PORT=61001
Terminal window
# JSON format for scripting
memorylayer info --format json
{
"data_dir": "/home/user/.config/memorylayer-server",
"embedding_provider": "embed_server",
"embed_server_url": "http://localhost:61051",
"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"
}
Terminal window
# Reveal all secrets (use with caution)
memorylayer info --reveal-secrets

memorylayer export

Export workspace memories and associations to NDJSON format. Connects to a running MemoryLayer server and streams the export.

Terminal window
memorylayer export [OPTIONS]

Options:

OptionDescriptionDefault
-w, --workspaceWorkspace ID to export (required)—
-o, --outputOutput file path (default: stdout)stdout
--offsetSkip first N memories0
--limitExport at most N memories (0 = unlimited)0
--include-associations / --no-associationsInclude associationstrue
--server-urlMemoryLayer server URLhttp://localhost:61001
--api-keyAPI key for authenticationnull

Examples:

Terminal window
# Export entire workspace to file
memorylayer export -w my-workspace -o backup.ndjson
Exported 142 memories and 38 associations to backup.ndjson
Terminal window
# 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}
Terminal window
# Export first 50 memories without associations
memorylayer export -w my-workspace -o partial.ndjson --limit 50 --no-associations
Exported 50 memories and 0 associations to partial.ndjson
Terminal window
# Export from a remote server with authentication
memorylayer export -w my-workspace -o backup.ndjson \
--server-url https://memorylayer.example.com \
--api-key sk-my-api-key
Exported 142 memories and 38 associations to backup.ndjson

memorylayer import

Import memories from a JSON or NDJSON file into a workspace. The format is auto-detected from the file content.

Terminal window
memorylayer import FILE [OPTIONS]

Arguments:

ArgumentDescription
FILEPath to the import file (JSON or NDJSON)

Options:

OptionDescriptionDefault
-w, --workspaceTarget workspace ID (required)—
--dry-runShow what would be imported without writingfalse
--server-urlMemoryLayer server URLhttp://localhost:61001
--api-keyAPI key for authenticationnull

Examples:

Terminal window
# Dry run to preview import
memorylayer import backup.ndjson -w my-workspace --dry-run
Would 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
Terminal window
# Import NDJSON file
memorylayer import backup.ndjson -w new-workspace
Import complete:
Imported: 140
Skipped (duplicates): 2
Errors: 0
Imported 38 associations
Terminal window
# Import JSON file into a remote server
memorylayer import data.json -w target-workspace \
--server-url https://memorylayer.example.com \
--api-key sk-my-api-key
Import complete:
Imported: 50
Skipped (duplicates): 0
Errors: 0

memorylayer —help

Show help information for all commands.

Terminal window
memorylayer --help
Usage: 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 workspace MCP server registry entries.
serve Start the HTTP REST API server.
skills Manage workspace skill packages (list / push / pull / sync / ...).
version Show version information.

You can also get help for individual commands:

Terminal window
memorylayer serve --help
memorylayer export --help
memorylayer import --help
memorylayer skills --help
memorylayer mcp --help

memorylayer skills

Manage workspace skill packages stored in MemoryLayer.

Terminal window
memorylayer skills COMMAND [OPTIONS]
SubcommandDescription
listList skills in a workspace (optionally show shadowed variants)
pushUpload a skill directory to the workspace
pullDownload a skill from the workspace to a directory
materializeMaterialize all workspace skills to a target directory
syncTwo-way sync between a local skill directory and the workspace
watchWatch a directory and auto-push changes
migrate-from-localBulk-import skills from ~/.claude/skills/ or a project

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.

Terminal window
memorylayer mcp COMMAND [OPTIONS]
SubcommandDescription
listList MCP server entries in a workspace
pushUpload an MCP server JSON spec
pullDownload workspace MCP server entries (--reveal-secrets to dump env values)
syncTwo-way sync between a local JSON file and the workspace
materializeRender entries to a .mcp.json / Claude Code config
watchWatch a JSON file and auto-push changes
migrate-from-localImport existing .mcp.json / Claude Code MCP config into the workspace

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).

Usage 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.