feat: link exchanges to git branches with --branch filter#11
Merged
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Implements openspec change add-branch-linking: - G1: indexer captures gitBranch from the exchange-boundary user entry into the new exchanges.git_branch column (NULL when absent) - G2: migration v8 adds the column and backfills existing exchanges by re-parsing session jsonl files (success-parsed-lines ply coordinates, silent skip on missing jsonl, idempotent) - G3: loci context --branch reverse lookup (LEFT JOIN palace_objects so undistilled exchanges are included, chronological order, AND-combinable with --symbol, exit 1 when neither given) - G4: loci search --branch filters BM25/HNSW candidates before RRF - G5: git_branch field in search/context JSON output, prime instructions and CLAUDE.md/AGENTS.md document the new options Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Adopt main's rewritten agent-action-trigger PRIME_TEXT structure and re-apply the --branch additions in its style: a 'work on a specific branch' trigger bullet and a loci context --branch example in the Context section. CLAUDE.md keeps both --branch command lines with main's shortened --symbol comment. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Links conversation history (exchanges) to git branches so that questions like "do you remember the work on this branch?" can be answered via
loci. Implements openspec changeadd-branch-linking(G1–G5).Claude Code session logs (.jsonl) already record a
gitBranchfield on every entry, so this requires no extra hooks and no git command execution. Since a single session can span multiple branches (observed in real data), linking is done at exchange granularity.Changes
gitBranchfrom the exchange-boundary user entry into the newexchanges.git_branchcolumn (missing / empty string → NULL)loci context --branch NAME: partial-match reverse lookup in chronological order. Uses LEFT JOIN on palace_objects so undistilled exchanges are included. AND-combinable with--symbol; exits 1 when neither is givenloci search "query" --branch NAME: filters BM25 / HNSW candidates before RRF fusiongit_branchfield to search / context JSON output; updates prime instructions, CLAUDE.md, and AGENTS.md (new)Compatibility
loci context --symbolstandalone behavior is unchanged (--symbolgoes from required to either-one-required)Testing
loci context --branch "1.0-hardening"andloci search --branchreturn actual past conversationsOut of scope
--branchtranslation layer)--since/--untiltime filters; distinguishing reused branch names🤖 Generated with Claude Code