Database Persistence
Smithers uses PGlite (embedded PostgreSQL) to persist all workflow state. This enables:- Resume workflows after restarts or crashes
- Inspect execution history for debugging
- Time-travel debugging by replaying state transitions
- Long-running workflows that span days or weeks
Creating a Database
Database Structure
The database tracks several entity types:| Entity | Purpose |
|---|---|
| Executions | Top-level workflow runs |
| Phases | Workflow phases within executions |
| Steps | Individual steps within phases |
| Agents | Claude invocations with prompts and results |
| Tool Calls | Tools invoked by agents |
| State | Key-value workflow state |
| Memories | Long-term knowledge across sessions |
| VCS | Git commits, snapshots, and reviews |
Execution Tracking
Every workflow run is an execution:State Management
The state API provides key-value storage with history:State History
Every state change is recorded:Snapshots
Save and restore complete state:Agent Tracking
Track Claude invocations:Tool Call Tracking
Track tools used by agents:Memories (Long-term Knowledge)
Store knowledge that persists across workflows:Memory Categories
| Category | Use Case |
|---|---|
fact | Discovered facts about the codebase |
learning | Lessons learned from past executions |
preference | User preferences and conventions |
context | Contextual information |
skill | Reusable skills or patterns |
Memory Scopes
| Scope | Visibility |
|---|---|
global | All projects and sessions |
project | Current project only |
session | Current session only |
VCS Integration
Track version control operations:Direct Queries
For advanced use cases, query the database directly:Inspecting the Database
Use the CLI to inspect database contents:Best Practices
Always close the database
Always close the database
Ensure the database is closed to flush writes:
Use triggers for debugging
Use triggers for debugging
Set triggers when updating state to track causality:
Check for incomplete executions on startup
Check for incomplete executions on startup
Resume interrupted workflows: