Skip to content

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.

TablePurpose
channelsChannel connector configs and credentials
personasAgent profiles with model, capabilities, and skill lists
bindingsChannel-to-persona routing (thread-level or channel-default)
threadsConversation threads keyed by channel + external ID
messagesFull message history, append-only, inbound and outbound
queue_itemsDurable work queue with status, retry, and dead-letter
runsAgent execution records with session ID and token usage
schedulesCron/interval/one-shot job definitions
memory_itemsPer-thread structured memory (facts, summaries, notes)
artifactsAgent output files with path, MIME type, and checksum
audit_logAppend-only audit trail of all side-effecting operations
tool_resultsIdempotent tool result cache keyed by run + request ID
background_tasksBackground agent tasks with status, provider, and sandbox settings
a2a_tasksAgent-to-agent delegation tasks and their state
execution_environmentsSprite execution environments
execution_env_checkpointsCheckpoints of execution environments
imagesInbound images with state, metadata, and owning thread and message
image_source_messagesInternal source references used to re-link images after a restart or redelivery
image_ingestionsIngestion ledger: one row per image-bearing message, pending until the message is enqueued
image_admission_recordsTerminal records for image-bearing messages that were not routed
findingsSaved answers from vision Inspections
finding_imagesLinks between findings and the images they inspected
voice_sessionsBrowser voice session state
voice_delegationsBackend work delegated from a voice session
voice_outputsOutputs returned to a voice session
voice_auth_bindingBrowser voice login authority
voice_auth_revision_allocatorRevision counter for browser voice login grants
voice_auth_sessionsBrowser 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.

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 are versioned SQL files in src/core/database/migrations/. They’re numbered sequentially: 001-initial-schema.sql, 002-...sql, etc.

Apply pending migrations:

Terminal window
npx talonctl migrate

The 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.

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:

RepositoryTable
ChannelRepositorychannels
PersonaRepositorypersonas
BindingRepositorybindings
ThreadRepositorythreads
MessageRepositorymessages
QueueRepositoryqueue_items
RunRepositoryruns
ScheduleRepositoryschedules
MemoryRepositorymemory_items
ArtifactRepositoryartifacts
AuditRepositoryaudit_log
ToolResultRepositorytool_results
BackgroundTaskRepositorybackground_tasks
A2ATaskRepositorya2a_tasks
ExecutionEnvRepositoryexecution_environments
ExecutionEnvCheckpointRepositoryexecution_env_checkpoints
ImageRepositoryimages, image_source_messages
ImageIngestionRepositoryimage_ingestions, image_source_messages, image_admission_records
FindingRepositoryfindings, finding_images
VoiceRepositoryvoice_sessions, voice_delegations, voice_outputs
VoiceAuthRepositoryvoice_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.

Terminal window
npx talonctl backup

This 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.

The database file path is configured in talond.yaml:

storage:
type: sqlite
path: data/talond.sqlite

The default path is data/talond.sqlite. WAL and SHM files (talond.sqlite-wal, talond.sqlite-shm) are co-located and managed automatically by SQLite.