Skip to content

Storage

Events are stored in a local SQLite database using bun:sqlite with WAL mode.

Database Location

text
~/.local/share/hookwatch/hookwatch.db

The path respects $XDG_DATA_HOME if set: $XDG_DATA_HOME/hookwatch/hookwatch.db

Schema

ColumnTypeDescription
idINTEGER PRIMARY KEYAuto-incrementing event ID
timestampINTEGER NOT NULLEpoch milliseconds (generated at write time)
eventTEXT NOT NULLHook event type (e.g. PreToolUse)
session_idTEXT NOT NULLFrom hook stdin
cwdTEXT NOT NULLWorking directory at time of event
tool_nameTEXTTool name for tool events, NULL otherwise
session_nameTEXTHuman-readable session name
hook_duration_msINTEGERhookwatch handler execution time in milliseconds
stdinTEXT NOT NULLFull event JSON from hook stdin
wrapped_commandTEXTCommand being wrapped, NULL for bare handler events
stdoutTEXTHook output JSON (bare) or captured child stdout (wrapped); NULL if no output
stderrTEXTCaptured child stderr for wrapped events; NULL for bare events
exit_codeINTEGER NOT NULL DEFAULT 0Exit code of the hook or wrapped child process
hookwatch_logTEXTInternal diagnostics with severity prefix; NULL if no issues

Schema Version

Current schema version: 3. On version mismatch, hookwatch renames the old database to hookwatch.db.v<old_version> and creates a fresh database.

Released under the MIT License.