Memory and data persistence
Documents service purpose, endpoints, database schema, and configuration. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> |
||
|---|---|---|
| .gitignore | ||
| __init__.py | ||
| main.py | ||
| messages.py | ||
| migrate_to_postgres.py | ||
| README.md | ||
Recall Service
Memory and data persistence for Egregore.
Purpose
Stores and retrieves conversation messages using PostgreSQL. Provides the persistent memory that allows conversations to continue across sessions.
Endpoints
| Endpoint | Method | Description |
|---|---|---|
/messages |
POST | Save a single message |
/messages |
GET | Get messages with pagination |
/messages/blocks |
POST | Save multiple response blocks |
/messages/history |
GET | Get history in Claude API format |
/messages/search |
GET | Full-text search messages |
/health |
GET | Health check |
Configuration
Environment variables (from ~/.env):
| Variable | Description | Default |
|---|---|---|
DATABASE_URL |
PostgreSQL connection string | postgresql://egregore:...@localhost/egregore |
Running
# Activate venv
source ~/.venv/bin/activate
# Run directly
python main.py
# Or via systemd
sudo systemctl start recall
sudo systemctl status recall
Database Schema
Messages table with:
id- Auto-increment primary keyrole- user/assistanttype- text/tool_use/tool_resultcontent- Message contentgroup_id- Groups related messagesmetadata- JSON for tool infopriority- For notification decisionstimestamp- When saved
Includes full-text search index on content.
Dependencies
- FastAPI
- asyncpg (PostgreSQL async driver)