Database reference
Talon uses SQLite with WAL mode and foreign keys enabled. The entire daemon state — messages, queue, personas, memory, schedules, audit log — lives in a single file. No external database dependency.
Schema overview
Section titled “Schema overview”| Table | Purpose |
|---|---|
channels | Channel connector configs and credentials |
personas | Agent profiles with model, capabilities, and skill lists |
bindings | Channel-to-persona routing (thread-level or channel-default) |
threads | Conversation threads keyed by channel + external ID |
messages | Full message history, append-only, inbound and outbound |
queue_items | Durable work queue with status, retry, and dead-letter |
runs | Agent execution records with session ID and token usage |
schedules | Cron/interval/one-shot job definitions |
memory_items | Per-thread structured memory (facts, summaries, notes) |
artifacts | Agent output files with path, MIME type, and checksum |
audit_log | Append-only audit trail of all side-effecting operations |
tool_results | Idempotent tool result cache keyed by run + request ID |
background_tasks | Background agent tasks with status, provider, and sandbox settings |
a2a_tasks | Agent-to-agent delegation tasks and their state |
execution_environments | Sprite execution environments |
execution_env_checkpoints | Checkpoints of execution environments |
images | Inbound images with state, metadata, and owning thread and message |
image_source_messages | Internal source references used to re-link images after a restart or redelivery |
image_ingestions | Ingestion ledger: one row per image-bearing message, pending until the message is enqueued |
image_admission_records | Terminal records for image-bearing messages that were not routed |
findings | Saved answers from vision Inspections |
finding_images | Links between findings and the images they inspected |
voice_sessions | Browser voice session state |
voice_delegations | Backend work delegated from a voice session |
voice_outputs | Outputs returned to a voice session |
voice_auth_binding | Browser voice login authority |
voice_auth_revision_allocator | Revision counter for browser voice login grants |
voice_auth_sessions | Browser voice login sessions, stored as one-way hashes |
Image and finding rows outlive the normalized image file. The images.retentionHours setting deletes only the file. The voice tables do not store raw audio.
Schema is defined in src/core/database/migrations/001-initial-schema.sql and later migrations.
WAL mode
Section titled “WAL mode”SQLite is opened in Write-Ahead Logging mode. This gives:
- Concurrent readers — reads don’t block writes and vice versa
- Crash safety — WAL file is replayed on restart after an unclean shutdown
- Better write throughput — multiple writes batch into WAL before checkpoint
Foreign keys are enabled on every connection. Cascade deletes are defined where appropriate (e.g., deleting a thread cascades to messages, queue items, and memory items).
Migrations
Section titled “Migrations”Migrations are versioned SQL files in src/core/database/migrations/. They’re numbered sequentially: 001-initial-schema.sql, 002-...sql, etc.
Apply pending migrations:
npx talonctl migrateThe daemon also runs migrate automatically on startup. It’s idempotent — already-applied migrations are skipped. Migration state is tracked in SQLite’s PRAGMA user_version, which holds the highest applied migration number.
Repository pattern
Section titled “Repository pattern”All database access goes through repository classes in src/core/database/repositories/. Each repository is typed and covers one table or a small group of related tables:
| Repository | Table |
|---|---|
ChannelRepository | channels |
PersonaRepository | personas |
BindingRepository | bindings |
ThreadRepository | threads |
MessageRepository | messages |
QueueRepository | queue_items |
RunRepository | runs |
ScheduleRepository | schedules |
MemoryRepository | memory_items |
ArtifactRepository | artifacts |
AuditRepository | audit_log |
ToolResultRepository | tool_results |
BackgroundTaskRepository | background_tasks |
A2ATaskRepository | a2a_tasks |
ExecutionEnvRepository | execution_environments |
ExecutionEnvCheckpointRepository | execution_env_checkpoints |
ImageRepository | images, image_source_messages |
ImageIngestionRepository | image_ingestions, image_source_messages, image_admission_records |
FindingRepository | findings, finding_images |
VoiceRepository | voice_sessions, voice_delegations, voice_outputs |
VoiceAuthRepository | voice_auth_binding, voice_auth_revision_allocator, voice_auth_sessions |
Every repository method returns Result<T, E> from neverthrow. There are no raw throws across module boundaries. This makes the database layer swap-able in the future — the interface contract is typed, not SQLite-specific.
Backup
Section titled “Backup”npx talonctl backupThis creates a timestamped backup directory, by default data/backups/talond-<timestamp>/. It contains an atomic copy of the SQLite database, talond.yaml, and the personas/ and skills/ directories. Use --output <path> to choose another location. No daemon is required. Run it before upgrades or migrations.
Database location
Section titled “Database location”The database file path is configured in talond.yaml:
storage: type: sqlite path: data/talond.sqliteThe default path is data/talond.sqlite. WAL and SHM files (talond.sqlite-wal, talond.sqlite-shm) are co-located and managed automatically by SQLite.