Skip to content

Commit fb72626

Browse files
Frank Guoclaude
andcommitted
docs: restructure README and command help by persona
Separate developer vs agent vs ad-hoc touchpoints with clear tables showing what the user does and what Rekal does in response. Update push and sync Long help to explain data ownership and compaction. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1402266 commit fb72626

3 files changed

Lines changed: 68 additions & 32 deletions

File tree

README.md

Lines changed: 45 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -130,50 +130,70 @@ flowchart LR
130130
style query fill:#faf5ff,stroke:#a855f7,color:#333
131131
```
132132

133-
The flow: commit, capture, push, sync, recall.
133+
The flow: commitcapturepushsync recall.
134134

135-
1. **Commit.** You commit code as usual. The post-commit hook runs `rekal checkpoint`, which snapshots your active AI session into `data.db`. Append-only — nothing is ever modified or deleted.
135+
### Developer touchpoints
136136

137-
2. **Push.** `rekal push` encodes your data into a compact wire format (zstd compression, string interning) and writes it to your personal orphan branch `rekal/<your-email>`. Your git history stays clean — rekal data lives on a separate branch.
137+
| You do | Rekal does |
138+
|--------|------------|
139+
| `rekal init` (once per repo) | Creates `.rekal/`, installs git hooks, writes agent skill file |
140+
| `git commit` | Hook runs `rekal checkpoint` — snapshots your active AI session into `data.db` (append-only) |
141+
| `git push` | Hook runs `rekal push` — encodes only your unexported data into compact wire format (zstd + string interning) and pushes to your orphan branch `rekal/<email>` |
142+
| `rekal sync` (manual, when you want team context) | Fetches teammates' orphan branches, imports their sessions into your local DB and rebuilds the search index |
143+
| `rekal clean` (if needed) | Removes `.rekal/` and hooks from the repo |
138144

139-
3. **Sync.** `rekal sync` pulls your teammates' orphan branches and imports their session data into your local index.
145+
Day-to-day: commit and push as normal. Everything else is automatic.
140146

141-
4. **Recall.** `rekal "query"` runs a three-signal hybrid search (BM25 full-text, LSA embeddings, Nomic deep semantic embeddings) and returns scored results. The agent picks what matters.
147+
### Agent touchpoints
142148

143-
### Two databases
149+
| Agent does | Rekal does |
150+
|------------|------------|
151+
| `rekal "auth middleware"` | Runs hybrid search (BM25 + LSA + Nomic), returns scored JSON with `snippet_turn_index` pointing to the best-matching turn |
152+
| `rekal query --session <id> --offset N --limit 5` | Returns a small window of turns around the relevant part of the conversation, with `has_more` for pagination |
153+
| `rekal query --session <id> --role human` | Returns only human turns — cheapest way to understand session intent |
154+
| `rekal query --session <id> --full` | Returns everything: turns, tool calls, files touched — only when the agent needs full detail |
155+
| `rekal --file src/billing/ "discount"` | Scoped search filtered by file path |
156+
| `rekal sync` (optional, at session start) | Pulls team context before the agent starts working |
144157

145-
Rekal keeps two local DuckDB databases. The split is deliberate.
158+
The agent controls how much context it loads. Search first, drill down progressively, full sessions only when needed.
146159

147-
- **data.db** — The shared truth. Append-only. Contains sessions, turns, tool calls, checkpoints, files touched. This is what gets encoded and pushed through git. `rekal query` reads from here.
160+
```bash
161+
# Agent touches src/billing/ — first, recall prior context
162+
rekal --file src/billing/ "discount logic"
148163

149-
- **index.db** — Local intelligence. Full-text indexes, vector embeddings, file co-occurrence graphs. Never synced. Rebuilt anytime with `rekal index`. This is what powers `rekal "query"` search.
164+
# Agent finds a relevant session, drills into the matching turn
165+
rekal query --session 01JNQX... --offset 10 --limit 5
150166

151-
Thin on the wire, rich on the machine.
167+
# Agent loads full detail only if needed
168+
rekal query --session 01JNQX... --full
169+
```
152170

153-
### Orphan branches
171+
### Ad-hoc usage
154172

155-
Rekal data lives on git orphan branches named `rekal/<email>`. These branches have no common ancestor with your code branches — they do not appear in your project history, do not affect merges, and do not clutter your working tree. Standard git push and fetch move the data.
173+
```bash
174+
# Raw SQL for edge cases
175+
rekal query "SELECT id, user_email, branch FROM sessions ORDER BY captured_at DESC LIMIT 5"
156176

157-
## Using Rekal with your agent
177+
# Rebuild the search index after manual DB changes
178+
rekal index
158179

159-
Rekal is agent-first. The agent is the primary consumer.
180+
# View recent checkpoints
181+
rekal log
182+
```
160183

161-
When you run `rekal init`, it installs a Claude Code skill that teaches the agent how to use Rekal. The agent learns to search for prior context before modifying files, load sessions progressively to stay within token budgets, and use the structured output to make informed decisions.
184+
### Two databases
162185

163-
The agent workflow:
186+
Rekal keeps two local DuckDB databases. The split is deliberate.
164187

165-
```bash
166-
# Agent touches src/billing/ — first, recall prior context
167-
rekal --file src/billing/ "discount logic"
188+
- **data.db** — The shared truth. Append-only. Contains sessions, turns, tool calls, checkpoints, files touched. This is what gets encoded and pushed through git. `rekal query` reads from here.
168189

169-
# Agent finds a relevant session, drills in
170-
rekal query --session 01JNQX... --limit 5
190+
- **index.db** — Local intelligence. Full-text indexes, vector embeddings, file co-occurrence graphs. Never synced. Rebuilt anytime with `rekal index`. This is what powers `rekal "query"` search.
171191

172-
# Agent loads more detail if needed
173-
rekal query --session 01JNQX... --full
174-
```
192+
Thin on the wire, rich on the machine.
175193

176-
The agent controls how much context it loads. Lightweight search first, full sessions only when needed.
194+
### Orphan branches
195+
196+
Rekal data lives on git orphan branches named `rekal/<email>`. These branches have no common ancestor with your code branches — they do not appear in your project history, do not affect merges, and do not clutter your working tree. Standard git push and fetch move the data.
177197

178198
## Commands reference
179199

cmd/rekal/cli/push.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,19 @@ func newPushCmd() *cobra.Command {
1717
Short: "Push Rekal data to the remote branch",
1818
Long: `Export new checkpoints to the wire format and push to the remote orphan branch.
1919
20-
Unexported checkpoints in data.db are encoded into the compact binary wire
21-
format (rekal.body + dict.bin) and committed to the local orphan branch
22-
(rekal/<email>). The branch is then pushed to origin.
20+
Only YOUR unexported checkpoints are pushed — team data imported via 'rekal sync'
21+
is never re-exported. Each user pushes to their own branch (rekal/<email>).
22+
23+
Checkpoints contain sessions (conversation turns, tool calls) and file change
24+
metadata anchored to git commits. They are encoded into a compact binary wire
25+
format (rekal.body + dict.bin) using zstd compression and string interning —
26+
a 2-10 MB session compresses to ~300 bytes on the wire.
2327
2428
Use --force to overwrite the remote branch when it has diverged from local
2529
(e.g. after a rebuild or conflict).
2630
27-
Normally runs automatically via the pre-push hook installed by 'rekal init'.`,
31+
Normally runs automatically via the pre-push git hook installed by 'rekal init'.
32+
You do not need to run this manually.`,
2833
RunE: func(cmd *cobra.Command, _ []string) error {
2934
cmd.SilenceUsage = true
3035

cmd/rekal/cli/sync.go

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,23 @@ func newSyncCmd() *cobra.Command {
1717
cmd := &cobra.Command{
1818
Use: "sync",
1919
Short: "Sync team context from remote rekal branches",
20-
Long: `Fetch rekal branches from the remote and merge into the local search index.
20+
Long: `Fetch team session data from remote rekal branches and import into the local database.
21+
22+
This is a manual, deliberate operation — it is NOT automated via git hooks.
23+
Run it when you want to pull your team's session history before starting work.
24+
25+
Imported data includes conversation turns, tool calls, and file change metadata
26+
from your teammates' AI coding sessions. Imported checkpoints are marked as
27+
exported so they are never re-pushed to your own branch.
2128
2229
By default, fetches all rekal/* branches (whole team). Use --self to fetch
2330
only your own rekal branch — useful when syncing across your own machines
24-
(e.g. pulling context from your work laptop to your home machine) without
25-
fetching the whole team's data.`,
31+
(e.g. pulling context from your work laptop to your home machine).
32+
33+
Typical usage:
34+
Developer: Run 'rekal sync' at the start of the day
35+
Agent: Run 'rekal sync' at the start of a session if team context matters
36+
Ad-hoc: Run 'rekal sync --self' to pull your own data from another machine`,
2637
RunE: func(cmd *cobra.Command, _ []string) error {
2738
cmd.SilenceUsage = true
2839

0 commit comments

Comments
 (0)