feat: trail commit — smart commits from trajectory chapters#19
Open
barryonthecape wants to merge 1 commit intomainfrom
Open
feat: trail commit — smart commits from trajectory chapters#19barryonthecape wants to merge 1 commit intomainfrom
barryonthecape wants to merge 1 commit intomainfrom
Conversation
This adds a new 'trail commit' command that reads trajectory chapters/decisions to group changed files into logical commits. Features: - --dry-run: preview commits without creating them - --ai: use LLM for smarter file grouping - --trajectory <id>: commit only a specific trajectory - --base <ref>: override the git ref to diff against - Filters out .trajectories/ metadata files from user commits - Resets staging area between commits to prevent accidental batch commits - Handles startRef === HEAD (no new commits since trajectory started) Each commit includes: - Subject derived from chapter title - Body with decisions/findings from chapter events - Trajectory ID trailer (Trajectory: traj_xxx) Closes #9
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
trail commitreads your active/recent trajectory's chapters and decisions to automatically group changed files into logical, well-structured git commits — one per chapter. Each commit gets a rich message derived from the trajectory narrative.Motivation
When an agent works on a task, it naturally produces changes in logical units (setup, implementation, testing, docs). The trajectory records these as chapters. But when it's time to commit, you typically just do
git add . && git commit— lumping everything together.This command bridges that gap: it uses the trajectory you already created to drive commit structure.
How It Works
startRef— active or recently completed trajectories that have a_trace.startRef(automatically captured bytrail start)startRefto find all changed files (handles the "no new commits yet" case)tool_calleventrawvalues to match changed file paths to the chapter that created themExample
Given a trajectory with chapters
Setup JWT library,Write auth middleware, andAdd tests:Commit Message Format
Each commit gets:
Trajectory: traj_xxxtrailer linking the commit back to the trajectoryFlags
--dry-run--ai--trajectory <id>--base <ref>--model <model>--aimodeKey Design Decisions
.trajectories/files are excluded from user commits — trajectory metadata stays as a separate "chore" commitstartRef === HEAD— whentrail startwas called but no commits were made yet, diffs the working tree directlyTodo / Future Work
filesChangedarray after successful commitstrail completeintegration (commit on complete)--amendflag to retroactively amend commits with trajectory info