CLI โ smem
The SharedMemory CLI lets you manage AI memory from your terminal. Add memories, search the knowledge graph, ask questions, and check status.
npm install -g @sharedmemory/cli
Setupโ
# Set your API key
smem config --api-key sm_agent_...
# Optional: set API URL (defaults to https://api.sharedmemory.ai)
smem config --base-url https://api.sharedmemory.ai
# Optional: set default project (volume)
smem config --volume your-project-id
# View current config
smem config --show
Commandsโ
smem add <content>โ
Add a memory to the current volume.
smem add "John Smith is the CTO of Acme Corp"
Options:
| Flag | Description | Default |
|---|---|---|
-v, --volume <id> | Volume ID | config default |
-t, --type <type> | Memory type: factual, episodic, procedural | factual |
-a, --agent <name> | Agent name for attribution | cli |
Example output:
APPROVED (92% confidence)
Reason: New factual information about John Smith
Memory ID: a1b2c3d4-...
smem search <query>โ
Search entities in the knowledge graph.
smem search "React"
Options:
| Flag | Description | Default |
|---|---|---|
-v, --volume <id> | Volume ID | config default |
-m, --mode <mode> | Search mode: hybrid, vector, graph | hybrid |
-n, --limit <n> | Max results | 10 |
Example output:
3 entities found
1. React [technology] (12 facts)
A JavaScript library for building user interfaces
2. React Native [technology] (5 facts)
Mobile app framework built on React
3. React Router [library] (3 facts)
smem ask <question>โ
Ask a question โ the LLM answers using your stored memories and knowledge graph.
smem ask "What technologies does John use?"
Options:
| Flag | Description | Default |
|---|---|---|
-v, --volume <id> | Volume ID | config default |
--learn | Auto-learn from the conversation | false |
Example output:
3 relevant memories:
1. (95%) John uses React and TypeScript daily
by onboarding-agent ยท 2024-01-15
2. (87%) John's team migrated to Next.js
by cli ยท 2024-01-20
Graph facts:
John Smith โ USES โ React
John Smith โ USES โ TypeScript
John Smith โ MEMBER_OF โ Engineering Team
Total: 5 results
smem profileโ
View the auto-generated profile for the current volume.
smem profile
smem profile --volume another-volume
smem profile --refresh # force regenerate
smem volumesโ
List all memory volumes you have access to.
smem volumes
Example output:
Memory Volumes:
My Project (a1b2c3d4-...) โ active
Shared Team (e5f6g7h8-...)
smem statusโ
Check your API connection and configuration.
smem status
Example output:
โ Connected to SharedMemory
URL: https://api.sharedmemory.ai
Volume: a1b2c3d4-...
Version: 2.0
Scriptingโ
smem works well in scripts and CI/CD pipelines:
# Add build metadata as memory
smem add "Deployed v${VERSION} to production at $(date)" --type event
# Search and pipe to other tools
smem search "deployment" --limit 5
Agent Managementโ
smem agents listโ
List agents in an organization.
smem agents list --org <org-id>
smem agents list --org <org-id> --project <project-id>
smem agents createโ
Create a new agent with an auto-generated API key.
smem agents create --org <org-id> --project <project-id> --name "my-agent"
smem 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...
โ Save this key now โ it won't be shown again.
smem agents delete <agent_id>โ
Deactivate an agent and revoke its API key.
smem agents delete a1b2c3d4-... --org <org-id>
smem agents rotate-key <agent_id>โ
Rotate an agent's API key without recreating it.
smem agents rotate-key a1b2c3d4-... --org <org-id>