what gets captured

LayerWhat
MessagesEvery prompt, response, tool call — full fidelity, no truncation
Tool operationsEvery Read, Write, Edit, Bash — tool name, target file, cwd
DelegationsWhich agents spawned which, in what order
ClassificationMessage type, role, and threading — so Claude can filter by what you said vs what it said
File identityPermanent ID for every file — survives renames, moves, repo migrations
Repo identityGit root commit hash — survives repo moves

live capture

~/.claude/projects/**/*.jsonl
       ↓
  [worker]  watches for new sessions every 2s, indexes changes automatically
       ↓
  [MCP]  exposes database as read-only SQL

The worker scans session files every 2 seconds. When a file grows, it parses the new content, embeds, and writes to the database. Crash-safe: idempotent inserts, startup backfill recovers missed sessions.

enrichment

The worker runs a full enrichment cycle every 30 minutes:

LayerWhat it produces
Session importanceWhich sessions matter most, which connect the most ideas
File graphFile co-edit relationships across sessions
Agent trackingWhich agents spawned which, in what order
FingerprintsSession summaries — key decisions, tool patterns
Project attributionMaps sessions to repos automatically

All enrichment is safe to wipe. Recomputed automatically.

views

Views compose raw tables into a flat surface Claude queries directly. When Claude reads the schema, it sees:

ViewWhat it shows
chunksEvery chunk (messages + file bodies). Type is a column. Default for semantic search.
messagesMessage-specific columns — tool ops, delegations, file identity.
sessionsEvery session with project, importance scores, session clusters, fingerprints.

Claude writes WHERE is_hub = 1 like it's a column that always existed. The views handle the joins and noise filtering.

Views are plain .sql files at ~/.flex/views/claude_code/. Edit them to change what Claude sees. Your copy takes precedence over defaults. Run flex sync to install.

file tracking

Flex tracks files through renames, moves, and repo migrations using permanent IDs. When you ask "what's the history of auth.py?", Claude finds every session that touched it — even if the file was renamed three times.

Four identity layers:

LayerWhat it tracksSurvives
FilePermanent ID per fileRenames, moves, repo migrations
RepoGit root commit hashRepo moves, worktree deletion
ContentSHA-256 of file contentPath changes, branch switches
URLPermanent ID per URLNormalization differences

Identity is resolved at capture time and persists forever. A heal cycle runs every 24 hours to backfill any gaps.

# every session that touched a file, across all renames
$ flex search "@file path=src/auth.py"

# or just ask Claude
"Use flex: what's the history of auth.py?"

presets

Named queries that ship with Flex. Discovered automatically when Claude reads the schema — it uses them when they fit.

@orient          read the database — schema, queries, presets
@health          pipeline freshness, embedding coverage
@digest          multi-day activity summary
@sprints         work periods detected by 6h gaps
@story           session narrative — timeline, artifacts, agents
@file            every session that touched a file, across renames
@genealogy       concept lineage — key sessions, key excerpts
@delegation-tree recursive agent tree
@bridges         sessions that connect different areas of work