60 lines
1.4 KiB
Markdown
60 lines
1.4 KiB
Markdown
|
|
# 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
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# 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 key
|
||
|
|
- `role` - user/assistant
|
||
|
|
- `type` - text/tool_use/tool_result
|
||
|
|
- `content` - Message content
|
||
|
|
- `group_id` - Groups related messages
|
||
|
|
- `metadata` - JSON for tool info
|
||
|
|
- `priority` - For notification decisions
|
||
|
|
- `timestamp` - When saved
|
||
|
|
|
||
|
|
Includes full-text search index on content.
|
||
|
|
|
||
|
|
## Dependencies
|
||
|
|
|
||
|
|
- FastAPI
|
||
|
|
- asyncpg (PostgreSQL async driver)
|