All Frameworks
CLI Quickstart
Zero-dependency shell functions for storing and recalling memory from the command line.
1Set Your API Key
Export your AgenticMemory API key so the shell functions can authenticate.
export AGENTICMEMORY_API_KEY="amk_your_key_here"
export AGENTICMEMORY_SPACE="your_space_id"
export AGENTICMEMORY_BASE="https://agenticmemory.ai/v1"
2Define Shell Functions
Add these to your .bashrc or .zshrc. Each wraps a single curl call.
# Store a message to memory
amem-store() {
local role="${1:-user}"
local content="$2"
curl -s -X POST \
"${AGENTICMEMORY_BASE}/memory/${AGENTICMEMORY_SPACE}/messages" \
-H "Authorization: Bearer ${AGENTICMEMORY_API_KEY}" \
-H "Content-Type: application/json" \
-d "{\"role\":\"${role}\",\"content\":\"${content}\"}"
}
# Recall recent messages
amem-recall() {
local limit="${1:-10}"
curl -s \
"${AGENTICMEMORY_BASE}/memory/${AGENTICMEMORY_SPACE}/messages?limit=${limit}" \
-H "Authorization: Bearer ${AGENTICMEMORY_API_KEY}" \
| python3 -m json.tool
}
# Search memory
amem-search() {
local query="$1"
curl -s -X POST \
"${AGENTICMEMORY_BASE}/memory/${AGENTICMEMORY_SPACE}/search" \
-H "Authorization: Bearer ${AGENTICMEMORY_API_KEY}" \
-H "Content-Type: application/json" \
-d "{\"query\":\"${query}\",\"scope\":\"all\"}" \
| python3 -m json.tool
}
# Set a context key
amem-context() {
local key="$1"
local value="$2"
curl -s -X PUT \
"${AGENTICMEMORY_BASE}/memory/${AGENTICMEMORY_SPACE}/context/${key}" \
-H "Authorization: Bearer ${AGENTICMEMORY_API_KEY}" \
-H "Content-Type: application/json" \
-d "{\"value\":\"${value}\"}"
}
# List all spaces
amem-spaces() {
curl -s \
"${AGENTICMEMORY_BASE}/spaces" \
-H "Authorization: Bearer ${AGENTICMEMORY_API_KEY}" \
| python3 -m json.tool
}
3Use It
Source the functions and start storing and recalling memory from your terminal.
# Source the functions
source ~/.bashrc
# Store a few messages
amem-store user "What is the capital of France?"
amem-store assistant "The capital of France is Paris."
amem-store user "What about Germany?"
amem-store assistant "The capital of Germany is Berlin."
# Recall the last 5 messages
amem-recall 5
# [
# {"role": "user", "content": "What is the capital of France?", ...},
# {"role": "assistant", "content": "The capital of France is Paris.", ...},
# ...
# ]
# Search for a topic
amem-search "capital"
# Set context
amem-context preferred_language "English"
# Pipe into scripts
amem-recall 20 | jq '.[].content'
Free tier: 1 space, 1K messages/month. Upgrade to Pro ($24.99/mo) for semantic search + auto-summaries.