Quick Start Guide
From zero to AI with memory in 5 minutes β‘
Let's build your first Memof.ai application! Pick your weapon of choice and let's go.
Prerequisites Checklist
Before we start, make sure you have:
- β
API Token from memof.ai (format:
moa_...)
- β
Your favorite language ready (Python, JavaScript, or just cURL)
- β
5 minutes of uninterrupted focus time
- β
Coffee (optional but recommended β)
Don't have an API token? Get one at memof.ai β it takes 30 seconds!
Choose Your Path
import { Tab, Tabs } from 'rspress/theme';
Python Quick Start
Step 1: Install
Step 2: Your First Memory
Create a file called first_memory.py:
from memofai import create_moa_client
# Initialize client
client = create_moa_client(
api_token='moa_your_token_here', # Replace with your token!
environment='production'
)
# Create a workspace
print("π Creating workspace...")
workspace = client.workspaces.create({
'name': 'Quick Start Project',
'description': 'My first Memof.ai app!'
})
print(f"β
Workspace created: {workspace['name']} (ID: {workspace['id']})")
# Create a bot
print("\nπ€ Creating bot...")
bot = client.bots.create({
'name': 'Quick Start Bot',
'workspace_id': workspace['id'],
'description': 'Learning to remember things!'
})
print(f"β
Bot created: {bot['name']} (ID: {bot['id']})")
# Store some memories
print("\nπ§ Storing memories...")
memories_to_store = [
"User prefers Python over JavaScript",
"User loves clean, readable code",
"User is building an AI application",
"User's favorite framework is FastAPI"
]
for content in memories_to_store:
memory = client.memories.create({
'bot_id': bot['id'],
'content': content
})
print(f" β Stored: {content}")
# Search memories
print("\nπ Searching memories...")
results = client.memories.search({
'bot_id': bot['id'],
'query': 'programming language preferences',
'limit': 5
})
print(f"\nπ Found {len(results)} relevant memories:")
for i, result in enumerate(results, 1):
print(f"{i}. {result['content']}")
print("\nπ Success! Your AI now has permanent memory!")
Step 3: Run It
Expected Output
π Creating workspace...
β
Workspace created: Quick Start Project (ID: ws_abc123)
π€ Creating bot...
β
Bot created: Quick Start Bot (ID: bot_xyz789)
π§ Storing memories...
β Stored: User prefers Python over JavaScript
β Stored: User loves clean, readable code
β Stored: User is building an AI application
β Stored: User's favorite framework is FastAPI
π Searching memories...
π Found 2 relevant memories:
1. User prefers Python over JavaScript
2. User's favorite framework is FastAPI
π Success! Your AI now has permanent memory!
Next Steps
JavaScript Quick Start
Step 1: Install
npm install memofai
# or
pnpm add memofai
# or
yarn add memofai
Step 2: Your First Memory
Create a file called first-memory.js:
import { createMoaClient } from 'memofai';
async function main() {
// Initialize client
const client = createMoaClient({
apiToken: 'moa_your_token_here', // Replace with your token!
environment: 'production'
});
// Create a workspace
console.log('π Creating workspace...');
const workspace = await client.workspaces.create({
name: 'Quick Start Project',
description: 'My first Memof.ai app!'
});
console.log(`β
Workspace created: ${workspace.name} (ID: ${workspace.id})`);
// Create a bot
console.log('\nπ€ Creating bot...');
const bot = await client.bots.create({
name: 'Quick Start Bot',
workspaceId: workspace.id,
description: 'Learning to remember things!'
});
console.log(`β
Bot created: ${bot.name} (ID: ${bot.id})`);
// Store some memories
console.log('\nπ§ Storing memories...');
const memoriesToStore = [
'User prefers TypeScript with strict mode',
'User loves React and Next.js',
'User is building a web application',
'User values type safety'
];
for (const content of memoriesToStore) {
await client.memories.create({
botId: bot.id,
content
});
console.log(` β Stored: ${content}`);
}
// Search memories
console.log('\nπ Searching memories...');
const results = await client.memories.search({
botId: bot.id,
query: 'technology preferences',
limit: 5
});
console.log(`\nπ Found ${results.length} relevant memories:`);
results.forEach((result, i) => {
console.log(`${i + 1}. ${result.content}`);
});
console.log('\nπ Success! Your AI now has permanent memory!');
}
main().catch(console.error);
Step 3: Run It
Or if using TypeScript:
ts-node first-memory.ts
# or
tsx first-memory.ts
Expected Output
π Creating workspace...
β
Workspace created: Quick Start Project (ID: ws_abc123)
π€ Creating bot...
β
Bot created: Quick Start Bot (ID: bot_xyz789)
π§ Storing memories...
β Stored: User prefers TypeScript with strict mode
β Stored: User loves React and Next.js
β Stored: User is building a web application
β Stored: User values type safety
π Searching memories...
π Found 3 relevant memories:
1. User prefers TypeScript with strict mode
2. User loves React and Next.js
3. User values type safety
π Success! Your AI now has permanent memory!
Next Steps
HTTP Quick Start
No SDK needed! Just pure HTTP requests.
Step 1: Set Your Token
export MEMOFAI_TOKEN="moa_your_token_here"
Step 2: Create Workspace
curl -X POST https://api.memof.ai/api/workspaces/workspace/create \
-H "Authorization: Bearer $MEMOFAI_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Quick Start Project",
"description": "My first Memof.ai app!"
}'
Response:
{
"id": "ws_abc123",
"name": "Quick Start Project",
"description": "My first Memof.ai app!"
}
Step 3: Create Bot
curl -X POST https://api.memof.ai/api/bots/bot/create \
-H "Authorization: Bearer $MEMOFAI_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Quick Start Bot",
"workspace_id": "ws_abc123",
"description": "Learning to remember!"
}'
Response:
{
"id": "bot_xyz789",
"name": "Quick Start Bot",
"workspace_id": "ws_abc123"
}
Step 4: Store Memory
curl -X POST https://api.memof.ai/api/integrations/memory/store \
-H "Authorization: Bearer $MEMOFAI_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"bot_id": "bot_xyz789",
"content": "User prefers REST APIs and loves cURL"
}'
Step 5: Search Memories
curl -X POST https://api.memof.ai/api/integrations/memory/search \
-H "Authorization: Bearer $MEMOFAI_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"bot_id": "bot_xyz789",
"query": "API preferences",
"limit": 5
}'
Response:
[
{
"id": "mem_123",
"content": "User prefers REST APIs and loves cURL",
"bot_id": "bot_xyz789",
"created_at": "2025-01-15T10:30:00Z"
}
]
Next Steps
MCP Server Quick Start
Connect Claude Desktop to Memof.ai
Step 1: Install MCP Server
# Clone the repository
git clone https://github.com/memof-ai/memofai-mcp-server.git
cd memofai-mcp-server
# Install dependencies
npm install
# Build
npm run build
Step 2: Configure Claude Desktop
macOS: Edit ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: Edit %APPDATA%\Claude\claude_desktop_config.json
Add this configuration:
{
"mcpServers": {
"memofai": {
"command": "node",
"args": ["/path/to/memofai-mcp-server/dist/index.js"],
"env": {
"MEMOFAI_API_TOKEN": "moa_your_token_here",
"MEMOFAI_ENVIRONMENT": "production"
}
}
}
}
Step 3: Restart Claude Desktop
Close and reopen Claude Desktop. Look for the π icon!
Step 4: Test It
Try these commands in Claude:
"Create a workspace called 'My Test Workspace'"
"Create a bot named 'Memory Bot' in that workspace"
"Remember that I love building with AI"
"What do you know about my interests?"
Claude will use the MCP server to store and retrieve memories!
Next Steps
What Just Happened?
Let's break it down π
- Created a Workspace β Your project container
- Created a Bot β Your AI agent
- Stored Memories β Gave your bot information to remember
- Searched Memories β Retrieved relevant information by meaning
The magic? Semantic search found relevant memories even though you didn't use exact keywords!
Common Issues & Solutions
Because things don't always work first try π§
"Invalid API token"
Problem: Token is wrong or expired
Solution: Get a fresh token from memof.ai
# Make sure it starts with "moa_"
echo $MEMOFAI_TOKEN
# Should output: moa_...
"Module not found"
Problem: Package not installed
Solution: Install the SDK
# Python
pip install memofai
# JavaScript
npm install memofai
"Connection refused"
Problem: Wrong environment URL
Solution: Use 'production' environment
# Python
client = create_moa_client(
api_token='moa_...',
environment='production' # β Important!
)
// JavaScript
const client = createMoaClient({
apiToken: 'moa_...',
environment: 'production' // β Important!
});
"Rate limit exceeded"
Problem: Too many requests too fast
Solution: Add delays between requests or implement retry logic
import time
# Add small delay
time.sleep(0.1) # 100ms between requests
Next Steps
Choose your own adventure πΊοΈ
Learn the Concepts
Pick Your SDK
Advanced Topics
Framework Integration
- βοΈ React - React hooks included
- πΊ Next.js - Server & client components
- π FastAPI - Python web apps
- π Express - Node.js servers
Pro Tips
Level up your memory game π‘
1. Store Meaningful Content
# β
Good
"User Sarah from Acme Corp prefers email communication, timezone EST"
# β Bad
"user email"
2. Use Semantic Search
# You can search by concept, not exact words!
search(query="customer contact preferences")
# Will find: "Sarah prefers email", "John likes phone calls", etc.
3. Organize by Purpose
# Different bots for different purposes
user_context_bot = create_bot('User Context')
conversation_bot = create_bot('Conversation History')
knowledge_bot = create_bot('Product Knowledge')
4. Don't Over-Store
# β
Store important stuff
"User is working on authentication module"
# β Don't store everything
"User pressed button" # Too granular!
5. Include Context
# β
With context
"Customer reported login issue on 2025-01-15, resolved with password reset"
# β Without context
"login issue" # When? Who? How resolved?
Example: Full Application
A more realistic example
from memofai import create_moa_client
import os
class UserMemoryManager:
"""Manages memories for a user in your app"""
def __init__(self, user_id: str):
self.client = create_moa_client(
api_token=os.getenv('MEMOFAI_TOKEN'),
environment='production'
)
self.user_id = user_id
self.bot_id = self._get_or_create_bot()
def _get_or_create_bot(self):
"""Get or create bot for this user"""
# In production, you'd cache this!
bots = self.client.bots.list()
user_bot = next(
(b for b in bots if b['name'] == f'user_{self.user_id}'),
None
)
if not user_bot:
workspace = self.client.workspaces.list()[0]
user_bot = self.client.bots.create({
'name': f'user_{self.user_id}',
'workspace_id': workspace['id']
})
return user_bot['id']
def remember(self, content: str):
"""Store a memory"""
return self.client.memories.create({
'bot_id': self.bot_id,
'content': content
})
def recall(self, query: str, limit: int = 5):
"""Search memories"""
return self.client.memories.search({
'bot_id': self.bot_id,
'query': query,
'limit': limit
})
def get_all_memories(self):
"""Get all memories for this user"""
return self.client.memories.list({
'bot_id': self.bot_id
})
# Usage
manager = UserMemoryManager(user_id='123')
# Store preferences
manager.remember("User prefers dark mode and compact layout")
manager.remember("User is working on API integration project")
# Later, recall context
preferences = manager.recall("UI preferences")
project_context = manager.recall("current project")
print(f"UI Preferences: {preferences[0]['content']}")
print(f"Project: {project_context[0]['content']}")
Congratulations! π
You've successfully:
- β
Set up Memof.ai
- β
Created a workspace and bot
- β
Stored and retrieved memories
- β
Experienced semantic search
You're now ready to build AI applications with permanent memory!
Need Help?
We're here for you π¬
- π§ Email: support@memof.ai
- π Issues: GitHub
- π Docs: You're already here!
- π‘ Ideas: We love feature requests!
Ready for more? β Best Practices | SDK Docs