Skip to content

Database

Snippbot uses SQLite for all persistence. Each subsystem has its own database file to avoid schema conflicts and allow independent migration.

FilePathContents
main.db~/.snippbot/main.dbAgents, projects, tasks, chat history
scheduler.db~/.snippbot/scheduler.dbJobs, runs, chains, activity patterns
workflows.db~/.snippbot/workflows.dbWorkflow definitions, runs, templates
hooks.db~/.snippbot/hooks.dbHooks, deliveries, webhook endpoints
channels.db~/.snippbot/channels.dbPlatform credentials, bindings, access rules
skills.db~/.snippbot/skills.dbTool registry, MCP server configs
devices.db~/.snippbot/devices.dbDevice registrations, execution history
memory_{agent_id}.db~/.snippbot/agents/{id}/Episodic memory, knowledge graph

| profile_settings.db | ~/.snippbot/profile_settings.db | User profile (display name, theme, avatar) |

Database migrations run automatically on daemon startup. Each database file has a schema_version table tracking the applied migration version.

If a migration fails, the daemon logs the error and exits. To diagnose:

Terminal window
tail -50 ~/.snippbot/logs/daemon.log | grep -i migrat

Pre-upgrade backups are saved automatically to ~/.snippbot/backups/ before each migration.

Stores agent definitions.

ColumnTypeDescription
idTEXT PKUUID
nameTEXTDisplay name
archetypeTEXTOne of 10 archetypes
modelTEXTLLM model ID
system_promptTEXTCustom instructions
tools_configTEXTJSON — enabled tools
memory_configTEXTJSON — memory settings
trust_scoreREAL0.0–1.0
created_atTEXTISO 8601
updated_atTEXTISO 8601
ColumnTypeDescription
idTEXT PKUUID
nameTEXTProject name
goalTEXTHigh-level goal
statusTEXTpending, planning, in_progress, paused, completed, failed
agent_idTEXT FKAssigned agent
execution_strategyTEXTsequential, parallel, dag
created_atTEXTISO 8601
ColumnTypeDescription
idTEXT PKUUID
project_idTEXT FKParent project
titleTEXTTask title
descriptionTEXTDetailed description
statusTEXTpending, running, completed, failed, skipped
depends_onTEXTJSON array of task IDs
resultTEXTTask output
errorTEXTError message if failed
started_atTEXTISO 8601
completed_atTEXTISO 8601
ColumnTypeDescription
idTEXT PKUUID
nameTEXTJob name
goalTEXTAgent goal
agent_idTEXT FKExecuting agent
schedule_configTEXTJSON — type, expression, timezone
delivery_configTEXTJSON — channel, format
retry_configTEXTJSON — attempts, strategy
condition_configTEXTJSON — condition type, expression
statusTEXTactive, paused, completed, failed
run_countINTEGERTotal runs
next_run_atTEXTNext scheduled time
last_run_atTEXTLast execution time
ColumnTypeDescription
idTEXT PKUUID
job_idTEXT FKParent job
statusTEXTrunning, completed, failed, cancelled
trigger_timeTEXTWhen the job was supposed to fire
started_atTEXTActual start time
completed_atTEXTEnd time
outputTEXTAgent result
errorTEXTError if failed
attemptINTEGERRetry attempt number
ColumnTypeDescription
platformTEXT PKPlatform ID (slack, discord, etc.)
encrypted_dataBLOBFernet-encrypted JSON of credentials
previewTEXTMasked preview for display
created_atTEXTISO 8601
updated_atTEXTISO 8601
ColumnTypeDescription
idTEXT PKUUID
platformTEXTPlatform ID
channel_idTEXTPlatform channel ID
channel_nameTEXTDisplay name
agent_idTEXT FKBound agent
access_modeTEXTopen, allowlist, admin_only
enabledINTEGER1 = active
ColumnTypeDescription
idTEXT PKUUID
nameTEXTHook name
eventTEXTEvent type to subscribe to
typeTEXTwebhook, script, announcement, chain
configTEXTJSON — URL, secret, code, etc.
conditionTEXTOptional filter expression
enabledINTEGER1 = active
ColumnTypeDescription
idTEXT PKUUID
hook_idTEXT FKParent hook
event_typeTEXTEvent that triggered
statusTEXTsuccess, failed, pending
attemptINTEGERAttempt number
response_codeINTEGERHTTP status (for webhooks)
latency_msINTEGERRound-trip time
delivered_atTEXTISO 8601

All databases use these pragmas for performance and safety:

PRAGMA journal_mode = WAL; -- Write-ahead logging for concurrent reads
PRAGMA synchronous = NORMAL; -- Balance safety and performance
PRAGMA foreign_keys = ON; -- Enforce referential integrity
PRAGMA cache_size = -64000; -- 64 MB cache
Terminal window
# List backups
snippbot reset --list-backups
# Restore from backup
snippbot reset --restore pre-upgrade-2026-03-01

Automatic backups are created before each migration and can also be scheduled via a cron job pointing to ~/.snippbot/.