# Safe Handling of Hermes Local State (state.db)

> Read a live Hermes state database without breaking the gateway’s write path.

Safe Handling of Hermes Local State (state.db) is a free AI agent skill on Agensi by Drizzt Studio, in DevOps & Cloud. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [Drizzt Studio](https://www.agensi.io/creators/drizztstudio)
- Category: [DevOps & Cloud](https://www.agensi.io/skills/devops-cloud)
- Version: 1.0
- Last updated: 2026-11-19
- Security: scan passed (2026-11-19); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/safe-handling-of-hermes-local-state-state-db
- Tags: devops, database, security, hermes, sqlite, safety, ops

## About this skill

How to inspect Hermes Agent’s local state.db / WAL / config without triggering WAL recovery that can permanently disable writes. Covers snapshot-then-open or mode=ro only, three-layer liveness checks, and auditing which tool actually ran. The bundled script uses a read-only connection and SQLite’s backup API, then deletes its temp snapshot.

## Requires

- Python 3.8+ (standard library only)
- Local Hermes profile directory (state.db)
- Optional: sqlite3 CLI (manual read-only queries)
- Optional: hermes CLI (config set)

Free read-only helper. One script snapshots state.db via SQLite's backup API (mode=ro), counts assistant-side tool calls, then deletes the temp copy. Also covers three-layer liveness checks and safe config.yaml edits via the Hermes CLI. Counts and arguments only; model/provider come from agent.log.

## Known limitations

Requires local file system access. Cannot repair already corrupted profiles. Snapshots can be large. Only supports SQLite-based Hermes state files. Model and provider per call are not part of the script output; get them from auxiliary.vision in config.yaml and the model=/provider= lines in logs/agent.log.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Safe Handling of Hermes Local State (state.db) skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### How does this skill reduce the risk of breaking a live Hermes state?

It documents the failure mode (a plain writable connection triggers WAL recovery and the gateway can then refuse all writes) and enforces the safe path instead: mode=ro for reads, SQLite's online backup or VACUUM INTO for a consistent snapshot, and never deleting state.db-wal/-shm. The three-layer liveness section explains how to tell a dead process from a process that connects but fails every turn.

### What specific platforms and AI agent environments is this skill compatible with?

Any local Hermes install whose state is SQLite-based (state.db + WAL), on Windows, macOS or Linux. The file-location and junction notes are Windows-specific; the read-only and snapshot rules apply everywhere.

### What is included in this free download?

A short SKILL.md covering the read-only/snapshot rules, three-layer liveness checks and config.yaml edit discipline, plus one Python script (audit_tool_usage.py) that produces a consistent snapshot with SQLite's backup API and prints tool-call counts and arguments.

### Can I use this skill to edit the live state.db file while the Hermes process is running?

No, this skill strictly enforces a read-only snapshot workflow to ensure the live database remains untouched; direct modification of a running state.db is not supported due to corruption risks.

### How does this skill help in auditing model usage and tool call frequencies?

The script counts invocations of any tool over a given window, groups them by day, and with --dump-args lists the file and question for each call. Fallback detection is a separate manual step: grep "Fallback activated" in logs/agent.log.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
