your accumulated claude code lore as a deterministic knowledge graph. every session, file, project, tool, and resume relationship becomes a node or edge that builds itself from your transcripts. all data stays local at ~/.claude/lore/lore.db.
/plugin marketplace add anipotts/claude-code-tips
/plugin install lore@anipotts/lore today's sessions, cost, top tools (dashboard)
/lore search "websocket" full-text search across all conversations
/lore hotspots files you keep editing across sessions
/lore loops repeated patterns across sessions
/lore:help full intent menu
knowledge-graph commands (schema v3+):
/lore:remember "decision: chose D1 over Supabase" capture a decision/lesson/reminder/todo
/lore:remember list --tag d1 list tagged notes
/lore:graph cooccurrence hook.py files that show up alongside hook.py
/lore:graph project lore top files + sessions for a project
/lore:graph summary graph-wide counts
/lore:export notes json snapshot of your notes
/lore:export project anipotts.com bundled json for a project
/lore:remember writes to a user-controlled notes table; /lore:graph reads the live file_cooccurrences view (computed from tool_calls, no extra storage); /lore:export writes portable snapshots. Session-resume edges and error-resolution edges are intentionally deferred -- they would need heuristics that are easier to validate once tagged data exists.
a single python hook (hooks/hook.py) dispatches all events:
| event | what it does |
|---|---|
| SessionEnd | ingests the session transcript into sqlite |
| SessionStart | recalls relevant past sessions for the current project |
| PreCompact | flags cost anomalies before context compression |
| PostToolUseFailure | logs error patterns for /lore health intent |
| SubagentStop | tracks subagent usage |
data lives at ~/.claude/lore/lore.db. legacy users on the v1.x mine plugin: ~/.claude/mine.db is migrated automatically on first run, kept in place as a backup until you remove it manually. nothing leaves your machine.
/lore (default dashboard) shows two summary lines:
LIFETIME: 1,373 sessions · 661,949 messages · 105 active days · favorite Opus 4.6
COVERAGE: 691 / 1,373 main sessions (50.3%) — older transcripts deleted by CC retention sweep
LIFETIME is the canonical lifetime total, mirrored from Anthropic's pre-computed ~/.claude/stats-cache.json and matches what Claude Code's built-in /usage shows.
COVERAGE is how much of the lifetime total lore has full transcript data for. The gap is the difference between sessions that ever happened (LIFETIME) and sessions whose JSONL transcripts are still on disk (lore can ingest). Two reasons the gap exists:
- CC's retention sweep deleted older JSONLs. Claude Code periodically deletes transcripts older than the
cleanupPeriodDayssetting. Default is 30 days. If you set 30 and have a year of history, the sweep deleted 11 months of transcripts before lore could ingest them. - You installed lore after some sessions had already happened. Sessions before lore was installed never had their JSONLs ingested while they existed.
LIFETIME doesn't have these problems because Anthropic's stats-cache.json is computed from the same JSONLs but with a different retention rule (it accumulates totals into a single file before deleting).
To stop CC from deleting transcripts so lore can ingest them all:
- Open your Claude Code settings file at
~/.claude/settings.json. - Set
cleanupPeriodDaysto a large number.9999is "effectively forever" without tripping any validation.
{
"cleanupPeriodDays": 9999
}- Save. The next CC SessionStart picks up the new value. No restart needed.
You can also set it per-project in .claude/settings.json (project) or .claude/settings.local.json (project, gitignored), or globally via the user file above. Local-project value wins over user-global per CC's standard precedence.
Trade-off: disk space. Each main session JSONL is typically 50 KB - 5 MB; subagent transcripts can run larger. With cleanupPeriodDays: 9999 and heavy use, ~/.claude/projects/ can grow to several gigabytes per year. Run du -sh ~/.claude/projects/ periodically to monitor.
Constraint: cleanupPeriodDays: 0 is rejected by CC v2.1.83+ as an invalid value. Use 1 for "yesterday only" if you really want minimal retention; otherwise prefer 90, 180, 365, or 9999.
cleanupPeriodDays is a settings.json field, not an environment variable. CC does not currently expose an env-var override for it. If a future CC release adds one (e.g., CLAUDE_CODE_CLEANUP_PERIOD_DAYS), this README will be updated to mention it.
jq '.cleanupPeriodDays // "not set (defaults to 30)"' ~/.claude/settings.jsonThe transcript bytes are gone from ~/.claude/projects/, so lore can never reconstruct them. But the per-session METADATA (sessionId, project, message count, created/modified timestamps, first prompt) still exists in ~/.claude/projects/<project>/sessions-index.json files for as long as CC keeps those indexes around. Lore ingests these into the anthropic_session_index table on every SessionStart, so even sessions whose transcripts were deleted have their metadata preserved.
Query: sqlite3 ~/.claude/lore/lore.db "SELECT session_id, project_path, message_count, created FROM anthropic_session_index ORDER BY created DESC LIMIT 20;"
.claude-plugin/plugin.json- plugin manifesthooks/hook.py- unified hook dispatcherhooks/hooks.json- hook event registrationsscripts/mine.py- bulk session parser (backfill, incremental, export). filename retained for v2.x source compatibility; will be renamed once the bun port landsscripts/schema.sql- database schemacommands/lore.md-/loreslash command (routes to skills/query)skills/query/SKILL.md- intent routingskills/help/SKILL.md-/lore:helptests/- pytest suite
the mine plugin was renamed to lore in v2.0 and repositioned around its knowledge-graph dimension. the slash command is now /lore (not /mine). the database moved from ~/.claude/mine.db to ~/.claude/lore/lore.db; the migration is automatic on first launch and your old file is left in place as a backup. no data loss, no manual steps.