Skip to content

Add trails: branch-centric work tracking#479

Draft
dipree wants to merge 25 commits intomainfrom
feat/trails
Draft

Add trails: branch-centric work tracking#479
dipree wants to merge 25 commits intomainfrom
feat/trails

Conversation

@dipree
Copy link
Contributor

@dipree dipree commented Feb 24, 2026

Summary

Trails are branch-centric work tracking abstractions stored on the entire/trails orphan branch. They capture the why/what of a developer's work (human intent), while checkpoints capture the how/when (machine snapshots). Think of them as lightweight, git-native pull request metadata that exist before any PR is opened.

New: entire trail command family

  • entire trail — show the current branch's trail, or list all trails if none exists
  • entire trail list — list all trails with --status filter and --json output
  • entire trail create — create a trail interactively or via flags (--title, --body, --branch, --status, --checkout)
  • entire trail update — update trail metadata interactively or via flags (--status, --title, --body, --add-label, --remove-label)

Interactive trail creation flow

  1. Prompt for title ("What are you working on?") and optional body
  2. Derive branch name from title via slugification (user can override)
  3. Select status (draft, open, in_progress, in_review)
  4. Create the git branch locally (via go-git SetReference, no checkout by default)
  5. Push both the branch and trail data to origin
  6. Optionally checkout the branch (--checkout flag or interactive confirm)

Interactive trail update

When entire trail update is run without flags, an interactive form is shown pre-filled with current values (status select, title input, body textarea).

Checkpoint linking

After each condensation (manual-commit PostCommit), the checkpoint is appended to the trail's checkpoints.json (newest first). This links every checkpoint to the trail for the branch.

AI-powered trail title generation

When summarize.enabled is configured and the agent supports TextGenerator (currently Claude Code via claude --print), the trail title and body are generated from the session transcript after the first condensation. Uses Haiku for fast, cheap generation.

Trail author from GitHub

Trail author is resolved via gh api user -q .login (GitHub username), with a fallback to git config user.name.

Remote trail sync

entire trail list fetches the remote entire/trails branch before listing, so trails created by collaborators are visible. Pre-push hooks push the entire/trails branch alongside entire/checkpoints/v1.

New packages & files

File Description
cmd/entire/cli/trail/trail.go Types (ID, Status, Metadata, Discussion, CheckpointRef), ValidStatuses(), HumanizeBranchName()
cmd/entire/cli/trail/store.go Store with full CRUD on entire/trails orphan branch (sharded storage)
cmd/entire/cli/trail/trail_test.go Unit tests for ID generation, validation, status, humanization
cmd/entire/cli/trail/store_test.go Integration tests for Store operations
cmd/entire/cli/trail_cmd.go Cobra commands: trail, list, create, update + helpers (slugify, branch creation, push)
cmd/entire/cli/summarize/trail_title.go GenerateTrailTitle() — LLM-based title/body from transcript
cmd/entire/cli/agent/claudecode/generate.go GenerateText() implementation for Claude Code (claude --print)
cmd/entire/cli/agent/agent.go TextGenerator interface for agents supporting text generation

Modified files

File Changes
cmd/entire/cli/strategy/manual_commit_hooks.go Added appendCheckpointToTrail() and generateTrailTitleFromTranscript() after condensation
cmd/entire/cli/strategy/manual_commit_condensation.go Returns Transcript and Prompts in CondenseResult for trail linking
cmd/entire/cli/strategy/push_common.go Added PushTrailsBranch() for pushing entire/trails branch (independent of push_sessions setting)
cmd/entire/cli/strategy/manual_commit_push.go PrePush calls PushTrailsBranch() alongside sessions branch push
cmd/entire/cli/settings/settings.go Removed IsTrailsDisabled() methods
cmd/entire/cli/paths/paths.go Added TrailsBranchName constant
cmd/entire/cli/root.go Registered trail command

Storage format

Trails are stored on the entire/trails orphan branch with sharded paths:

<trail_id[:2]>/<trail_id[2:]>/
├── metadata.json       # Trail metadata (title, body, branch, status, author, etc.)
├── discussion.json     # Comments and replies (future use)
└── checkpoints.json    # Checkpoint references (newest first)

Status lifecycle: draft → open → in_progress → in_review → done → closed

Test plan

  • mise run fmt && mise run lint && mise run test:ci passes
  • entire trail create — interactive flow creates branch, trail, and pushes both
  • entire trail create --title "..." --branch "..." — non-interactive flag mode
  • entire trail update — interactive form pre-fills current values
  • entire trail update --status in_review --title "New title" — flag mode
  • entire trail list — shows trails from both local and remote
  • entire trail list --status in_progress --json — filtering and JSON output
  • Checkpoint linking after commit condensation

🤖 Generated with Claude Code

dipree and others added 15 commits February 23, 2026 09:31
Trails are now always active — the ability to disable them via
`entire trail enable`/`entire trail disable` commands and the
`strategy_options.trails` setting has been removed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 5ba1abd32f4d
When run without flags, presents a form with status (select),
title (input), and description (text area) pre-filled with
current values. Excludes "done" and "closed" from the status
select since those are set by merge and permissions respectively.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 65a3b4ef75ef
Introduces the trail store (CRUD on entire/trails orphan branch),
trail types, and registers `entire trail` in the root command.
Updates IsShadowBranch and integration tests to recognize the
trails branch.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 87bbe8c4adc7
After each condensation (manual-commit) or save (auto-commit),
the checkpoint is appended to the trail's checkpoints list. On
first condensation, generates an AI-powered trail title and
description from the transcript. Both strategies now push the
trails branch on pre-push.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 0cbe6f215a22
Adds TextGenerator interface for agents supporting non-interactive
text generation (e.g., claude --print). Implements it for Claude
Code and adds summarize.GenerateTrailTitle for AI-powered trail
title/description generation from transcripts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: f96123e0ece4
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 710851ce13d8
`entire trail create` now creates the git branch if it doesn't
exist. When on the default branch without --branch, prompts for
a branch name. The branch is created without checkout by default.
Use --checkout flag or answer the interactive prompt to switch to
the new branch after creation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: fc76ba4ab962
Previously, `trail create` on a non-default branch would
default to the current branch and short-circuit if a trail
already existed. Now it always prompts for a branch name
(with current branch as placeholder), allowing users to
create trails for new branches from any branch.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 0c1e138e4ae0
The interactive flow now asks for the trail title first, then
derives a branch name from it (slugified). The user can accept
the suggested branch or type a different one. Non-interactive
`--title` without `--branch` also derives the branch automatically.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: ff63e394e0c2
The interactive flow now prompts for all fields:
1. Title + description
2. Branch (derived from title) + status (select)
3. Checkout confirmation (if new branch created)

Excludes "done" and "closed" from the status select.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 73308b5a6ad8
After creating a trail, pushes the new branch to origin (with -u
for tracking) and syncs the trails metadata branch. Push failures
are non-blocking warnings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 18e798499438
Trail author is now resolved via `gh api user` to get the GitHub
login. Falls back to git user.name if gh CLI is unavailable or
not authenticated.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 6dd269f0a910
`entire trail list` now fetches the remote trails branch before
listing, so trails created by collaborators are visible. The
fetch is best-effort with a 10s timeout — failures are silent.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: a170e94303e0
Copilot AI review requested due to automatic review settings February 24, 2026 09:15
@cursor
Copy link

cursor bot commented Feb 24, 2026

PR Summary

Medium Risk
Touches git-hook/strategy flow and introduces new orphan-branch storage and push behavior, which could affect repository state and hook reliability. LLM-based title generation spawns subprocesses and must remain best-effort to avoid disrupting core checkpointing.

Overview
Introduces Trails, a new branch-centric metadata layer stored on the entire/trails orphan branch, plus a new entire trail command family to create, list/show, and update trail records (including remote fetch for listing).

Hooks/strategies now auto-create a trail on TurnStart for non-default branches, append each new checkpoint to the trail (manual-commit condensation and auto-commit SaveStep), and push entire/trails alongside entire/checkpoints/v1 in PrePush; shadow-branch cleanup/tests are updated to treat entire/trails as non-shadow.

Adds optional agent-driven text generation via agent.TextGenerator with a Claude Code implementation (claude --print) and a new summarize helper to best-effort generate trail titles/descriptions from condensed transcripts when summarization is enabled.

Written by Cursor Bugbot for commit 85f50b7. Configure here.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds “trails” as a branch-centric work tracking layer stored on an entire/trails orphan branch, integrating it into lifecycle hooks and checkpoint strategies so work intent can be recorded and linked to checkpoints.

Changes:

  • Introduces entire trail command family (show/list/create/update) plus supporting trail types and git-backed store.
  • Hooks trail auto-creation on TurnStart and links checkpoints to trails for both manual-commit and auto-commit strategies.
  • Adds optional agent text generation (TextGenerator) and a summarizer helper to generate trail titles/descriptions from transcripts.

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
cmd/entire/cli/trail_cmd.go Adds Cobra commands and helpers for trail CRUD, display, remote fetch, branch creation, and auto-create helper.
cmd/entire/cli/trail/trail.go Defines trail domain types (ID/status/metadata/checkpoints) and helpers like branch humanization.
cmd/entire/cli/trail/trail_test.go Unit tests for IDs, status validation, and branch humanization.
cmd/entire/cli/trail/store.go Implements git-backed trail storage on entire/trails (CRUD + checkpoint linking).
cmd/entire/cli/trail/store_test.go Tests Store behavior against a temp git repo using git CLI.
cmd/entire/cli/summarize/trail_title.go Adds LLM-based trail title/description generation from condensed transcripts.
cmd/entire/cli/strategy/push_common.go Adds PushTrailsBranch() wrapper to push/sync entire/trails.
cmd/entire/cli/strategy/manual_commit_types.go Extends condensation result to include prompts and raw transcript bytes for downstream trail features.
cmd/entire/cli/strategy/manual_commit_push.go Pushes trails branch alongside metadata branch in pre-push hook.
cmd/entire/cli/strategy/manual_commit_hooks.go Links checkpoints to trails and (best-effort) generates trail title/description after condensation.
cmd/entire/cli/strategy/manual_commit_condensation.go Plumbs prompts/transcript into CondenseResult.
cmd/entire/cli/strategy/cleanup.go Excludes entire/trails from shadow-branch cleanup logic.
cmd/entire/cli/strategy/auto_commit.go Links checkpoints to trails and (best-effort) generates title/description from transcript on SaveStep; pushes trails in pre-push.
cmd/entire/cli/root.go Registers the new trail command.
cmd/entire/cli/paths/paths.go Adds TrailsBranchName constant.
cmd/entire/cli/lifecycle.go Auto-creates trails on TurnStart for non-default branches.
cmd/entire/cli/integration_test/mid_session_commit_test.go Updates shadow-branch expectations to ignore entire/trails.
cmd/entire/cli/integration_test/deferred_finalization_test.go Updates shadow-branch expectations to ignore entire/trails.
cmd/entire/cli/agent/claudecode/generate.go Implements GenerateText() for Claude Code via claude --print.
cmd/entire/cli/agent/agent.go Adds TextGenerator optional interface for agents.
CLAUDE.md Documents trails package, commands, storage format, and linkage behavior.
.entire/settings.json Updates repo settings (wingman enabled, telemetry enabled).

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

dipree and others added 10 commits February 24, 2026 10:35
- Fix FindByBranch comment to match actual (nil, nil) return contract
- Use in-place shift for AddCheckpoint prepend to avoid full slice realloc
- Set cmd.Stdin=nil and GIT_TERMINAL_PROMPT=0 on fetchTrailsBranch
- Use logging package instead of fmt.Fprintf(os.Stderr) for auto-create trail
- Revert accidental .entire/settings.json changes (wingman, telemetry)
- Return (nil, nil) when agent doesn't support TextGenerator (non-fatal)
- Remove raw LLM response from JSON parse error (privacy)
- Decouple PushTrailsBranch from push_sessions setting
- Fix interactive update silently resetting done/closed status to draft

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: f4d9b8a4c6b4
Aligns with updated spec: the trail's long-form content field is now
"body" (JSON key, struct field, CLI flag, and interactive form label).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: c33d8f528b3d
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: dfe58c8924e7
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: b91a1b7a3dc6
# Conflicts:
#	cmd/entire/cli/strategy/auto_commit.go
# Conflicts:
#	cmd/entire/cli/strategy/manual_commit_push.go
#	cmd/entire/cli/strategy/push_common.go
Trails are now purely manual — created, updated, and deleted only via
`entire trail` subcommands. Removes autoCreateTrailOnTurnStart(),
AutoCreateTrail(), and titleFromPrompt().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: c71f63ac5806
The trail command is still fully functional via `entire trail` but
no longer appears in `entire help` output.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: a52b774246db
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants