Role: Bootstrap Rekal in a git repository. The only command a developer must run once per repo.
Invocation: rekal init.
- Must be run inside a git repository. Otherwise exit with "not a git repository".
- Resolve git root — Exit if not in a git repo.
- Check if already initialized — If
.rekal/exists, print "already initialized" and exit. User must runrekal cleanfirst to reinitialize. - Create
.rekal/— Directory for local databases. - Create data DB — Open
.rekal/data.db, run data DDL (sessions, turns, tool_calls, checkpoints, files_touched, checkpoint_sessions, checkpoint_state). - Create index DB — Open
.rekal/index.db, run index DDL (turns_ft, tool_calls_index, files_index, session_facets, file_cooccurrence, session_embeddings, index_state). - Update
.gitignore— Append.rekal/if not already present. - Install hooks:
post-commit— runsrekal checkpointpre-push— runsrekal push- Hooks contain the marker
# managed by rekal. Existing non-Rekal hooks are not overwritten.
- Create orphan branch —
rekal/<email>with emptyrekal.bodyanddict.bin. If the branch exists on the remote, fetch it. If it exists locally, leave it. - Import existing data — If the orphan branch has data (body > 9 bytes), import sessions and checkpoints into data DB.
- Install Claude Code skill — Write
.claude/skills/rekal/SKILL.mdfor agent integration. - Gitignore
.claude— If.claude/already existed (user has settings, CLAUDE.md, etc.), only ignore.claude/skills/. Otherwise ignore the entire.claude/directory. - Initial checkpoint — Capture any existing sessions.
- Print —
Rekal initialized.
No user-facing flags. Non-interactive.