From af74ed8f05d750c5e3148920478a652ece851ca8 Mon Sep 17 00:00:00 2001 From: Evan Senter Date: Thu, 1 Jan 2026 22:41:27 +0000 Subject: [PATCH] docs: Add database protection warning to CLAUDE.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add prominent warning section making clear that the database contains irreplaceable historical data and must never be dropped. Documents what operations are safe vs. forbidden. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- CLAUDE.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/CLAUDE.md b/CLAUDE.md index 6004fd7..bb6cc7c 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -27,6 +27,28 @@ Key components: - **Auto-refresh** queries automatically refresh stale data (>5 min old) - **LaunchAgent** for always-on availability (macOS) +--- + +## ⚠️ DATABASE PROTECTION - READ THIS ⚠️ + +**The database at `~/.claude/contrib/analytics/data.db` contains irreplaceable historical data.** + +### NEVER do any of the following: +- Add code that deletes the database file (`os.remove()`, `unlink()`, `rm`) +- Add `DROP TABLE` statements for `events`, `sessions`, `ingested_files`, or `git_commits` +- Add `DELETE FROM` for user data tables (only `patterns` table can be cleared - it's re-computed) +- Add any "reset" or "clear all" functionality that destroys historical data + +### Safe operations: +- `DELETE FROM patterns` - OK, patterns are re-computed derived data +- `make uninstall` - OK, preserves database (only removes LaunchAgent + MCP config) +- `make reinstall` - OK, just reinstalls Python package + +### If you need to test destructive operations: +Use a temporary database in tests (all tests already do this via `tmpdir`). + +--- + ## Commands ```bash