Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
8166f82
feat: adopt sessions across worktrees
peyton-alt Jun 18, 2026
2bc10ef
fix: address session adopt review findings
peyton-alt Jun 18, 2026
efeca6c
fix: clarify adopted transcript path
peyton-alt Jun 18, 2026
899e590
fix: reset adopted checkpoint window
peyton-alt Jun 22, 2026
40b8864
fix: guard adopt against shared session stores
peyton-alt Jun 22, 2026
b422e64
fix: anchor adopted prompt windows
peyton-alt Jun 22, 2026
7beae84
fix: clear adopted legacy transcript offsets
peyton-alt Jun 22, 2026
096be67
fix: harden session adopt review cases
peyton-alt Jun 22, 2026
a089e14
fix: validate adopted transcript ownership
peyton-alt Jun 22, 2026
f071731
fix: restore store interface lint suppressions
peyton-alt Jun 22, 2026
db9ada8
fix: support shared-store session adoption
peyton-alt Jun 22, 2026
b492e45
Harden session adoption state replacement
peyton-alt Jun 23, 2026
d4e9717
Restore checkpoint store abstraction boundary
peyton-alt Jun 23, 2026
20429fc
Serialize same-store session adoption
peyton-alt Jun 23, 2026
b7042ed
chore(lint): align ireturn allow-list
peyton-alt Jun 23, 2026
654c16a
fix(session): lock external session adoption
peyton-alt Jun 23, 2026
6a4c0ba
Merge branch 'main' into feat/session-adopt
peyton-alt Jun 23, 2026
3d3df24
refactor(session): share session state locks
peyton-alt Jun 23, 2026
fc2189a
Merge branch 'main' into feat/session-adopt
peyton-alt Jun 24, 2026
def2ba2
Merge branch 'main' into feat/session-adopt
peyton-alt Jun 24, 2026
8379e34
fix(session): clear adopted source owner
peyton-alt Jun 24, 2026
4f4a780
fix(session): clear adopted review metadata
peyton-alt Jun 24, 2026
739e4e7
fix(session): preserve adopted review metadata
peyton-alt Jun 24, 2026
4b00f10
fix(session): reset adopted turn id
peyton-alt Jun 24, 2026
55639cc
Merge branch 'main' into feat/session-adopt
peyton-alt Jun 24, 2026
1b1026c
fix(session): preserve target untracked files on adopt
peyton-alt Jun 24, 2026
c3cc95b
Merge branch 'main' into feat/session-adopt
peyton-alt Jun 25, 2026
96bc295
Merge branch 'main' into feat/session-adopt
peyton-alt Jun 29, 2026
cf4e18d
fix: reset adopted checkpoint token usage
peyton-alt Jun 29, 2026
99e8234
fix: require adoption worktree ownership metadata
peyton-alt Jun 29, 2026
77ddb98
Merge remote-tracking branch 'origin/main' into feat/session-adopt
peyton-alt Jun 29, 2026
6c132f2
fix: preserve git common dir for adoption locks
peyton-alt Jun 29, 2026
3087e41
docs: document session adoption
peyton-alt Jun 29, 2026
04464a2
fix: clarify session adopt yes flag
peyton-alt Jun 29, 2026
830e823
Merge branch 'main' into feat/session-adopt
peyton-alt Jun 29, 2026
0df9dd1
Merge branch 'main' into feat/session-adopt
peyton-alt Jun 29, 2026
536005b
Merge branch 'main' into feat/session-adopt
peyton-alt Jun 30, 2026
3819557
fix: retire source session after external adoption
peyton-alt Jun 30, 2026
9cab96c
fix: canonicalize adopt session stores
peyton-alt Jun 30, 2026
3734030
fix: roll back target on adopt retire failure
peyton-alt Jun 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,15 @@ pointing at the canonical group form. Newer experimental command families are
discoverable through `entire labs` and may remain hidden from root help while
their canonical paths are still runnable.

- `session` (alias: `sessions`): `list`, `info`, `tokens`, `stop`, `attach`, `resume`, `current`.
- `session` (alias: `sessions`): `list`, `info`, `tokens`, `stop`, `attach`, `adopt`, `resume`, `current`.
`resume` with a branch arg switches to it and resumes its session; with no arg
it opens an interactive picker of stopped sessions (across all worktrees),
resolving each to its branch and pointing at the owning worktree when the
branch is checked out elsewhere. Resume keeps an existing local session log
as-is by default (`--force` overwrites it from the checkpoint).
`adopt` moves an active session from another repo or worktree into the current
worktree and resets target-local checkpoint bookkeeping so future commits link
to the adopted session from the new location.
- `checkpoint` (aliases: `cp`, `checkpoints`): `list`, `explain`, `tokens`, `search`, plus
the deprecated `rewind` (functional, prints a cobra deprecation message, will
be removed in a future release)
Expand Down
5 changes: 5 additions & 0 deletions cmd/entire/cli/lifecycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,11 @@ func handleLifecycleSessionStart(ctx context.Context, ag agent.Agent, event *age
// so ErrStateNotFound is the normal first-session path — only warn on
// genuinely unexpected errors, matching the rest of this file.
mutErr := strategy.MutateSessionState(ctx, event.SessionID, func(state *strategy.SessionState) error {
if state.AdoptedIntoWorktreePath != "" {
logging.Info(logCtx, "skipping adopted-away source session start",
slog.String("adopted_into_worktree", state.AdoptedIntoWorktreePath))
return strategy.ErrMutationSkip
}
persistEventMetadataToState(event, state)
if transErr := strategy.TransitionAndLog(ctx, state, session.EventSessionStart, session.TransitionContext{}, session.NoOpActionHandler{}); transErr != nil {
logging.Warn(logCtx, "session start transition failed",
Expand Down
21 changes: 19 additions & 2 deletions cmd/entire/cli/session/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,16 @@ type State struct {
// Derived from .git/worktrees/<name>/, stable across git worktree move
WorktreeID string `json:"worktree_id,omitempty"`

// AdoptedIntoWorktreePath marks a source-side tombstone left behind after
// `entire session adopt` moves this session into another repository/worktree.
// Hook TurnStart must not reactivate tombstoned source records, otherwise the
// same session ID can diverge in two session stores.
AdoptedIntoWorktreePath string `json:"adopted_into_worktree_path,omitempty"`

// AdoptedIntoWorktreeID is the target worktree ID paired with
// AdoptedIntoWorktreePath when available.
AdoptedIntoWorktreeID string `json:"adopted_into_worktree_id,omitempty"`

// Branch is the git branch HEAD pointed at the last time this session took a
// turn. Captured on each turn start so it tracks branches created or renamed
// after the session began. Empty when HEAD was detached or for sessions
Expand Down Expand Up @@ -384,8 +394,7 @@ func (s *State) NormalizeAfterLoad(ctx context.Context) {
// will see 0 for these fields and fall back to scoping from the transcript start.
// This is acceptable since CLI upgrades are monotonic and the worst case is
// redundant transcript content in a condensation, not data loss.
s.CondensedTranscriptLines = 0
s.TranscriptLinesAtStart = 0
s.ClearLegacyTranscriptOffsets()

// Backfill AttributionBaseCommit for sessions created before this field existed.
// Without this, a mid-turn commit would migrate BaseCommit and the fallback in
Expand All @@ -402,6 +411,14 @@ func (s *State) NormalizeAfterLoad(ctx context.Context) {
}
}

// ClearLegacyTranscriptOffsets clears deprecated transcript offset fields so
// callers that intentionally reset CheckpointTranscriptStart do not re-persist
// stale legacy state.
func (s *State) ClearLegacyTranscriptOffsets() {
s.CondensedTranscriptLines = 0
s.TranscriptLinesAtStart = 0
}

// RealignAttributionBase sets AttributionBaseCommit to newBase and clears any
// bookkeeping whose meaning depends on attribution being diverged from the
// shadow-branch base. Call this every time a code path intentionally brings
Expand Down
Loading
Loading