Skip to content

Handle multi session better#32

Merged
gtrrz-victor merged 14 commits intomainfrom
soph/multi-session
Jan 15, 2026
Merged

Handle multi session better#32
gtrrz-victor merged 14 commits intomainfrom
soph/multi-session

Conversation

@Soph
Copy link
Collaborator

@Soph Soph commented Jan 12, 2026

Before:
When two sessions had interleaved checkpoints and the user committed, the second session's data would overwrite the first session's data on entire/sessions:

ab/c123def456/
├── metadata.json      # Only session B's metadata
├── full.jsonl         # Only session B's transcript
└── prompt.txt         # Only session B's prompts

After:
Both sessions are preserved with archiving:

ab/c123def456/
├── metadata.json      # session_count: 2, session_ids: [A, B], merged files_touched
├── full.jsonl         # Session B (most recent)
├── prompt.txt         # Session B
└── 1/                 # Session A (archived)
    ├── metadata.json
    ├── full.jsonl
    └── prompt.txt

Concurrent Session Warning Message

Before:

Another session is active with uncommitted changes. You can continue here, but
checkpoints from both sessions will be interleaved.

To resume the other session instead, close here and run: claude -r abc123

After:

Another session is active: "How about this logic: - if there is no folder..."

You can continue here, but checkpoints from both sessions will be interleaved.

To resume the other session instead, exit Claude and run: claude -r abc123

Press the up arrow key to get your prompt back.

And when resuming/rewinding:

  ---
  Scenario 1: Single session with local log newer
  $ entire resume feature/add-auth

  Switched to branch 'feature/add-auth'

  Warning: Local session log(s) have newer entries than the checkpoint:
    "Add JWT authentication to the API"
      Local last entry:      2026-01-14 15:32:18
      Checkpoint last entry: 2026-01-14 14:45:03

  Overwriting will lose the newer local entries.

    Overwrite local session logs with checkpoint versions? [y/N] y

  Session restored to: /Users/dev/.claude/projects/.../abc123.jsonl
  Session: 2026-01-14-abc123-uuid

  To continue this session, run:
    claude --resume abc123

  ---
  Scenario 2: Multi-session checkpoint with mixed statuses
  $ entire resume feature/refactor-db

  Switched to branch 'feature/refactor-db'

  Warning: Local session log(s) have newer entries than the checkpoint:
    "Refactor database connection pooling"
      Local last entry:      2026-01-14 16:20:45
      Checkpoint last entry: 2026-01-14 15:10:22

  These other session(s) will also be restored:
    "Add migration for users table" (new)
    "Fix failing tests in db_test.go" (checkpoint is newer)

  Overwriting will lose the newer local entries.

    Overwrite local session logs with checkpoint versions? [y/N] y

  Restored 3 sessions. To continue, run:
    claude --resume abc123  # Add migration for users table
    claude --resume def456  # Fix failing tests in db_test.go
    claude --resume ghi789  # Refactor database connection pooling (most recent)

  ---
  Scenario 3: No conflicts (proceeds without prompt)
  $ entire resume feature/new-feature

  Switched to branch 'feature/new-feature'
  Writing transcript to: /Users/dev/.claude/projects/.../xyz789.jsonl
  Session: 2026-01-14-xyz789-uuid

  To continue this session, run:
    claude --resume xyz789

Soph added 5 commits January 13, 2026 10:56
Entire-Checkpoint: e3e035743cb8
Entire-Checkpoint: 43d37025251f
Entire-Checkpoint: 50a05055ba87
Entire-Checkpoint: bcb1ad8ffbac
Entire-Checkpoint: f0c3dbdad0d8
@Soph Soph force-pushed the soph/multi-session branch from 4b19ee3 to 928d14f Compare January 13, 2026 10:03
@Soph
Copy link
Collaborator Author

Soph commented Jan 13, 2026

Testing, entire/5325d1c was the branch based of the head commit in main. I used two agent sessions to do things and didn't commit in between. State after the second session see below:

test1234 on  entire/5325d1c [$] via 💎 v3.4.7
❯ find .entire
.entire
.entire/settings.json
.entire/logs
.entire/logs/2026-01-13-d488d465-0877-473a-8dc1-8a3e0c9c6f91.log
.entire/logs/2026-01-13-7bf322a0-638e-4284-80a5-f99654f343e2.log
.entire/.gitignore
.entire/metadata
.entire/metadata/2026-01-13-d488d465-0877-473a-8dc1-8a3e0c9c6f91
.entire/metadata/2026-01-13-d488d465-0877-473a-8dc1-8a3e0c9c6f91/full.jsonl
.entire/metadata/2026-01-13-d488d465-0877-473a-8dc1-8a3e0c9c6f91/context.md
.entire/metadata/2026-01-13-d488d465-0877-473a-8dc1-8a3e0c9c6f91/prompt.txt
.entire/metadata/2026-01-13-d488d465-0877-473a-8dc1-8a3e0c9c6f91/summary.txt
.entire/metadata/2026-01-13-7bf322a0-638e-4284-80a5-f99654f343e2
.entire/metadata/2026-01-13-7bf322a0-638e-4284-80a5-f99654f343e2/full.jsonl
.entire/metadata/2026-01-13-7bf322a0-638e-4284-80a5-f99654f343e2/context.md
.entire/metadata/2026-01-13-7bf322a0-638e-4284-80a5-f99654f343e2/prompt.txt
.entire/metadata/2026-01-13-7bf322a0-638e-4284-80a5-f99654f343e2/summary.txt
.entire/current_session

Then I did a commit in main branch, and looked at entire/sessions

test1234 on  entire/5325d1c [$] via 💎 v3.4.7
❯ git checkout entire/sessions
Switched to branch 'entire/sessions'

test1234 on  entire/sessions [$?]
❯ ls
e3

test1234 on  entire/sessions [$?]
❯ find e3
e3
e3/402324506f
e3/402324506f/full.jsonl
e3/402324506f/context.md
e3/402324506f/content_hash.txt
e3/402324506f/metadata.json
e3/402324506f/prompt.txt
e3/402324506f/1
e3/402324506f/1/full.jsonl
e3/402324506f/1/context.md
e3/402324506f/1/content_hash.txt
e3/402324506f/1/metadata.json
e3/402324506f/1/prompt.txt

test1234 on  entire/sessions [$?]
❯ cat e3/402324506f/metadata.json
{
  "checkpoint_id": "e3402324506f",
  "session_id": "2026-01-13-d488d465-0877-473a-8dc1-8a3e0c9c6f91",
  "strategy": "manual-commit",
  "created_at": "2026-01-13T11:37:42.258057+01:00",
  "checkpoints_count": 2,
  "files_touched": [
    "random_number.rb"
  ],
  "session_count": 2,
  "session_ids": [
    "2026-01-13-7bf322a0-638e-4284-80a5-f99654f343e2",
    "2026-01-13-d488d465-0877-473a-8dc1-8a3e0c9c6f91"
  ]
}%
test1234 on  entire/sessions [$?]
❯ cat e3/402324506f/1/metadata.json
{
  "checkpoint_id": "e3402324506f",
  "session_id": "2026-01-13-7bf322a0-638e-4284-80a5-f99654f343e2",
  "strategy": "manual-commit",
  "created_at": "2026-01-13T11:37:42.255509+01:00",
  "checkpoints_count": 1,
  "files_touched": [
    "random_number.rb"
  ],
  "session_count": 1,
  "session_ids": [
    "2026-01-13-7bf322a0-638e-4284-80a5-f99654f343e2"
  ]
}%

Soph and others added 3 commits January 13, 2026 17:27
Entire-Checkpoint: 8ae9468023c2
migrate shadow branch if base commit changed after pull/rebase
@Soph
Copy link
Collaborator Author

Soph commented Jan 14, 2026


  Restored 2 sessions. Resume with:
    claude --continue uuid1  # Add password hashing...
    claude --continue uuid2  # Fix login validation... (most recent)

  For single-session checkpoints:
  claude --continue uuid1  # Add user authentication...````

Soph and others added 5 commits January 14, 2026 11:40
@gtrrz-victor gtrrz-victor merged commit a9516df into main Jan 15, 2026
3 checks passed
@gtrrz-victor gtrrz-victor deleted the soph/multi-session branch January 15, 2026 00:36
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