with one click
hermes-state-db-wal
Use when diagnosing Hermes state.db WAL advisories.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Use when diagnosing Hermes state.db WAL advisories.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
Use when tuning Honcho for a Hermes profile.
Use when managing crit reviews programmatically.
Use when reviewing code, plans, or live pages with crit.
Use when writing code or Markdown anywhere.
Use when preparing input for a standing Hermes goal.
Use when authoring or editing in-repo Hermes skills.
| name | hermes-state-db-wal |
| description | Use when diagnosing Hermes state.db WAL advisories. |
| version | 1.0.0 |
| author | Kiren Srinivasan |
| metadata | {"hermes":{"tags":["hermes","sqlite","wal","doctor","state.db","troubleshooting"],"related_skills":["hermes-agent"],"created_by":"agent","created_with_hermes_commit":"unknown","compatibility_reviewed_with_hermes_commit":"5988fe6cd5547d3620df1de889ac6007f5463b4d"}} |
Use when:
hermes doctor warns about a large state.db-wal (often >50 MiB)hermes doctor --fix, the user asks whether the WAL shrankDo not treat a large physical WAL alone as corruption or as a failed plan or policy validation. Session-store maintenance is separate from SOUL, AGENTS, and workspace-policy correctness unless state.db integrity or lock errors block work.
Hermes keeps the canonical session store at $HERMES_HOME/state.db (default ~/.hermes/state.db) with SQLite Write-Ahead Logging:
| Path | Role |
|---|---|
state.db | Main DB (sessions, FTS, messages) |
state.db-wal | Committed changes not yet fully absorbed or still allocated for reuse |
state.db-shm | Shared-memory WAL index and locks (not the primary content) |
Writers append to the WAL. Readers can proceed concurrently. A checkpoint copies eligible WAL pages into state.db. After reset or reuse, the physical -wal file often stays at its high-water size even when little content is still active.
Upstream: https://sqlite.org/wal.html
Hermes Doctor checks the on-disk byte size of state.db-wal, not active frames:
Source of truth in a git install: hermes_cli/doctor.py (WAL size check near the session-store health section). Re-open that file if numbers drift.
Pitfall: Doctor can keep warning while logical active content is only a few MiB.
hermes doctor --fix doesDoctor fix runs approximately:
PRAGMA wal_checkpoint(PASSIVE);
PASSIVE:
So after --fix:
mxFrame dropped.To shrink the physical file, SQLite needs either:
-wal and -shm, orTRUNCATE (or RESTART + truncate path) with no active multi-process useNever delete state.db-wal while any Hermes process has the DB open. Committed data may still depend on it.
Do not issue checkpoint PRAGMAs while explaining size unless the user asked for cleanup.
lsof $HERMES_HOME/state.db $HERMES_HOME/state.db-wal $HERMES_HOME/state.db-shmstate.db, state.db-wal, state.db-shmreferences/wal-probe.md)mxFrame and nBackfill (native endian on the host)32 + mxFrame * (page_size + 24) when page_size is 4096 (frame header is 24 bytes)Hermes session code sets journal_mode=WAL with macOS durability helpers; it does not custom-set wal_autocheckpoint on state.db in normal setup. SQLite’s default auto-checkpoint is 1000 pages. Confirm in hermes_state.py (apply_wal_with_fallback) if behavior changes.
Low urgency when:
isInit, matching dual header copies)Escalate when:
database is locked, malformed schema, or I/O errors appear$HERMES_HOME if shared incorrectly.state.db (and preferably the trio of db/wal/shm if present).Lead with the answer (shrank or not), then a small before/after table: physical size, active frames, estimated active MiB. Separate “logical checkpoint progress” from “disk reclaimed.” Keep WAL mechanics short unless the user asked for a full lesson.
references/wal-probe.md — header fields, probe snippets, PASSIVE vs TRUNCATE