Skip to main content

CLI — sm

The SharedMemory CLI lets you manage AI memory from your terminal. Store memories, query the knowledge graph, ask questions, and check status.

npm install -g @sharedmemory/cli

Setup

# Authenticate via browser (GitHub-style — zero copy-paste)
sm login

# Or use the interactive setup wizard
sm init

# View current config
sm config --show

sm login opens your browser, you sign in, and the CLI drops a sm_live_… token into config automatically — no clipboard step.

You can also paste any dashboard secret manually (for CI or split environments):

sm config --api-key sm_org_rw_... --volume your-project-id
# or reuse the existing sm_live_... value already stored via `sm login`

Commands

sm "question" (default)

Just type your question — SharedMemory answers using your stored memories.

sm "What technologies does John use?"

sm remember <content>

Store a memory in the current volume.

sm remember "John Smith is the CTO of Acme Corp"

Options:

FlagDescriptionDefault
-v, --volume <id>Volume IDconfig default
-t, --type <type>Memory type: factual, episodic, proceduralfactual
-a, --agent <name>Agent name for attributioncli

Example output:

APPROVED (92% confidence)
Reason: New factual information about John Smith
Memory ID: a1b2c3d4-...

sm query <query>

Query memories (hybrid: vector + knowledge graph). Returns raw results.

sm query "React"

Options:

FlagDescriptionDefault
-v, --volume <id>Volume IDconfig default
-n, --limit <n>Max results10

sm ask <question>

Ask a question — the LLM answers using your stored memories and knowledge graph (full RAG pipeline).

sm ask "What technologies does John use?"

Options:

FlagDescriptionDefault
-v, --volume <id>Volume IDconfig default
--learnAuto-learn from the conversationfalse

Example output:

Answer:

Based on your stored memories, John primarily uses React and TypeScript...

─── 3 sources used ───

1. (95%) John uses React and TypeScript daily
2. (87%) John's team migrated to Next.js
3. (82%) Acme Corp standardized on TypeScript

3 citation(s) verified from memory.

sm profile

View the auto-generated profile for the current volume.

sm profile
sm profile --volume another-volume
sm profile --refresh # force regenerate

sm volumes

List all memory volumes you have access to.

sm volumes

Example output:

Memory Volumes:

My Project (a1b2c3d4-...) ← active
Shared Team (e5f6g7h8-...)

sm status

Check your API connection and configuration.

sm status

Example output:

[ok] Connected to SharedMemory
URL: https://api.sharedmemory.ai
Volume: a1b2c3d4-...
Version: 2.0

Scripting

sm works well in scripts and CI/CD pipelines:

# Store build metadata as memory
sm remember "Deployed v${VERSION} to production at $(date)" --type event

# Query and pipe to other tools
sm query "deployment" --limit 5

Agent Management

sm agents list

List agents in an organization.

sm agents list --org <org-id>
sm agents list --org <org-id> --project <project-id>

sm agents create

Create a new agent with an auto-generated API key.

sm agents create --org <org-id> --project <project-id> --name "my-agent"
sm agents create --org <org-id> --project <project-id> --name "my-agent" \
--description "Handles customer queries" \
--system-prompt "You are a helpful assistant."

Example output:

✓ Agent created

Name: my-agent
Agent ID: a1b2c3d4-...
API Key: sm_agent_abc123...

Warning: Save this key now — it won't be shown again.

sm agents delete <agent_id>

Deactivate an agent and revoke its API key.

sm agents delete a1b2c3d4-... --org <org-id>

sm agents rotate-key <agent_id>

Rotate an agent's API key without recreating it.

sm agents rotate-key a1b2c3d4-... --org <org-id>