Recover sqlite database

From markmhendrickson/neotoma · View interactive version

Recover sqlite database is an AI agent skill from the GitHub repository markmhendrickson/neotoma. Check Neotoma SQLite integrity and run .recover when the DB is corrupt (malformed disk image, btree errors). Use when MCP/API fails with SQLite corruption.

How to use this skill

Skill file

Recover Neotoma SQLite Database

When to use

Neotoma errors such as database disk image is malformed, failed PRAGMA integrity_check, or btreeInitPage / SQLITE_CORRUPT on the local SQLite file (neotoma.db or neotoma.prod.db under NEOTOMA_DATA_DIR).

Preconditions

Script (primary)

From the Neotoma repo root:

# Check only (exit 0 = ok, 2 = corrupt)
node scripts/recover_sqlite_database.js
node scripts/recover_sqlite_database.js --env production

# Write recovered copy (does not replace live DB)
node scripts/recover_sqlite_database.js --env production --recover

Or: npm run recover:db and npm run recover:db:prod -- --recover (see package.json).

Output is a sibling file like neotoma.prod.recovered-<timestamp>.db. Verify it reports PRAGMA integrity_check: ok, then manually archive the live .db/-wal/-shm and cp the recovered file to the live name.

After swap

Do not

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.