Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
34 changes: 12 additions & 22 deletions .claude/skills/test-repo/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This skill validates the CLI's session management and rewind functionality by ru
## When to Use

- User asks to "test against a test repo"
- User wants to validate strategy changes (manual-commit, auto-commit, shadow, dual)
- User wants to validate strategy changes (manual-commit)
- User asks to verify session hooks, commits, or rewind functionality
- After making changes to strategy code

Expand Down Expand Up @@ -54,7 +54,7 @@ Add this pattern to your Claude Code approved commands, or approve it once when
**Optional: Set strategy** (defaults to `manual-commit`):

```bash
export STRATEGY=manual-commit # or auto-commit, shadow, dual
export STRATEGY=manual-commit
```

### Test Steps
Expand Down Expand Up @@ -87,15 +87,15 @@ Execute these steps in order:
.claude/skills/test-repo/test-harness.sh list-rewind-points
```

Expected results by strategy:
Expected results:

| Check | manual-commit/shadow | auto-commit/dual |
|-------|---------------------|------------------|
| Active branch | No Entire-* trailers | Entire-Checkpoint: trailer only |
| Session state | ✓ Exists | ✗ Not used |
| Shadow branch | ✓ entire/{hash} | ✗ None |
| Metadata branch | ✓ entire/checkpoints/v1 | ✓ entire/checkpoints/v1 |
| Rewind points | ✓ At least 1 | ✓ At least 1 |
| Check | Result |
|-------|--------|
| Active branch | Optional Entire-Checkpoint: trailer |
| Session state | ✓ Exists |
| Shadow branch | ✓ entire/{hash} |
| Metadata branch | ✓ entire/checkpoints/v1 |
| Rewind points | ✓ At least 1 |

#### 4. Test Rewind

Expand All @@ -107,8 +107,7 @@ Expected results by strategy:
```

**Expected Behavior:**
- **Manual-commit/shadow**: Shows warning listing untracked files that will be deleted (files created after the checkpoint that weren't present at session start)
- **Auto-commit/dual**: No warning (git reset doesn't delete untracked files)
- Shows warning listing untracked files that will be deleted (files created after the checkpoint that weren't present at session start)

Example warning output (manual-commit):
```
Expand Down Expand Up @@ -144,7 +143,7 @@ go build -o /tmp/entire-bin ./cmd/entire && \

## Expected Results by Strategy

### Manual-Commit Strategy (default, alias: shadow)
### Manual-Commit Strategy (default)
- Active branch commits: **NO modifications** (no commits created by Entire)
- Shadow branches: `entire/<commit-hash[:7]>` created for checkpoints
- Metadata: stored on both shadow branches and `entire/checkpoints/v1` branch (condensed on user commits)
Expand All @@ -153,15 +152,6 @@ go build -o /tmp/entire-bin ./cmd/entire && \
- Preserves untracked files that existed at session start
- AllowsMainBranch: **true** (safe on main/master)

### Auto-Commit Strategy (alias: dual)
- Active branch commits: **clean commits** with only `Entire-Checkpoint: <12-hex-char>` trailer
- Shadow branches: none
- Metadata: stored on orphan `entire/checkpoints/v1` branch at sharded paths
- Rewind: full reset allowed if commit is only on current branch
- Uses `git reset --hard` which doesn't delete untracked files
- **No preview warnings** (untracked files are safe)
- AllowsMainBranch: **false** (creates commits on active branch)

## Additional Testing (Optional)

### Test Subagent Checkpoints
Expand Down
2 changes: 1 addition & 1 deletion .claude/skills/test-repo/test-harness.sh
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ verify-shadow-branch)
if git branch -a | grep -E "entire/[0-9a-f]"; then
echo "✓ Shadow branch exists"
else
echo "Note: No shadow branch (expected for auto-commit strategy)"
echo "Note: No shadow branch"
fi
;;

Expand Down
2 changes: 0 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ body:
description: "Which strategy is configured? (check `.entire/settings.json` or `entire status`)"
options:
- manual-commit (default)
- auto-commit
- Not sure
validations:
required: true

Expand Down
23 changes: 5 additions & 18 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,7 @@ All strategies implement:

| Strategy | Main Branch | Metadata Storage | Use Case |
|----------|-------------|------------------|----------|
| **manual-commit** (default) | Unchanged (no commits) | `entire/<HEAD-hash>-<worktreeHash>` branches + `entire/checkpoints/v1` | Recommended for most workflows |
| **auto-commit** | Creates clean commits | Orphan `entire/checkpoints/v1` branch | Teams that want code commits from sessions |
| **manual-commit** (default) | Unchanged (no commits) | `entire/<HEAD-hash>-<worktreeHash>` branches + `entire/checkpoints/v1` | Session management without modifying active branch |

#### Strategy Details

Expand All @@ -307,16 +306,6 @@ All strategies implement:
- PrePush hook can push `entire/checkpoints/v1` branch alongside user pushes
- `AllowsMainBranch() = true` - safe to use on main/master since it never modifies commit history

**Auto-Commit Strategy** (`auto_commit.go`)
- Code commits to active branch with **clean history** (commits have `Entire-Checkpoint` trailer only)
- Metadata stored on orphan `entire/checkpoints/v1` branch at sharded paths: `<id[:2]>/<id[2:]>/`
- Uses `checkpoint.WriteCommitted()` for metadata storage
- Checkpoint ID (12-hex-char) links code commits to metadata on `entire/checkpoints/v1`
- Full rewind allowed if commit is only on current branch (not in main); otherwise logs-only
- Rewind via `git reset --hard`
- PrePush hook can push `entire/checkpoints/v1` branch alongside user pushes
- `AllowsMainBranch() = true` - creates commits on active branch, safe to use on main/master

#### Key Files

- `strategy.go` - Interface definition and context structs (`StepContext`, `TaskStepContext`, `RewindPoint`, etc.)
Expand All @@ -334,7 +323,6 @@ All strategies implement:
- `manual_commit_hooks.go` - Git hook handlers (prepare-commit-msg, post-commit, pre-push)
- `manual_commit_reset.go` - Shadow branch reset/cleanup functionality
- `session_state.go` - Package-level session state functions (`LoadSessionState`, `SaveSessionState`, `ListSessionStates`, `FindMostRecentSession`)
- `auto_commit.go` - Auto-commit strategy implementation
- `hooks.go` - Git hook installation

#### Checkpoint Package (`cmd/entire/cli/checkpoint/`)
Expand Down Expand Up @@ -432,10 +420,9 @@ Both strategies use a **12-hex-char random checkpoint ID** (e.g., `a3b2c4d5e6f7`

**How checkpoint IDs work:**

1. **Generated once per checkpoint**: Either when saving (auto-commit) or when condensing (manual-commit)
1. **Generated once per checkpoint**: When condensing session metadata to the metadata branch

2. **Added to user commits** via `Entire-Checkpoint` trailer:
- **Auto-commit**: Added programmatically when creating the commit
- **Manual-commit**: Added via `prepare-commit-msg` hook (user can remove it before committing)

3. **Used for directory sharding** on `entire/checkpoints/v1` branch:
Expand Down Expand Up @@ -500,12 +487,12 @@ Commit subject: `Checkpoint: <checkpoint-id>` (or custom subject for task checkp

Trailers:
- `Entire-Session: <session-id>` - Session identifier
- `Entire-Strategy: <strategy>` - Strategy name (manual-commit or auto-commit)
- `Entire-Strategy: <strategy>` - Strategy name (manual-commit)
- `Entire-Agent: <agent-name>` - Agent name (optional, e.g., "Claude Code")
- `Ephemeral-branch: <branch>` - Shadow branch name (optional, manual-commit only)
- `Ephemeral-branch: <branch>` - Shadow branch name (optional)
- `Entire-Metadata-Task: <path>` - Task metadata path (optional, for task checkpoints)

**Note:** Both strategies keep active branch history **clean** - the only addition to user commits is the single `Entire-Checkpoint` trailer. Manual-commit never creates commits on the active branch (user creates them manually). Auto-commit creates commits but only adds the checkpoint trailer. All detailed session data (transcripts, prompts, context) is stored on the `entire/checkpoints/v1` orphan branch or shadow branches.
**Note:** Manual-commit keeps active branch history clean - the only addition to user commits is the single `Entire-Checkpoint` trailer. Manual-commit never creates commits on the active branch (user creates them manually). All detailed session data (transcripts, prompts, context) is stored on the `entire/checkpoints/v1` orphan branch or shadow branches.

#### Multi-Session Behavior

Expand Down
18 changes: 2 additions & 16 deletions GEMINI.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,7 @@ All strategies implement:

| Strategy | Main Branch | Metadata Storage | Use Case |
|----------|-------------|------------------|----------|
| **manual-commit** (default) | Unchanged (no commits) | `entire/<HEAD-hash>` branches + `entire/checkpoints/v1` | Recommended for most workflows |
| **auto-commit** | Creates clean commits | Orphan `entire/checkpoints/v1` branch | Teams that want code commits from sessions |

Legacy names `shadow` and `dual` are only recognized when reading settings or checkpoint metadata.
| **manual-commit** (default) | Unchanged (no commits) | `entire/<HEAD-hash>` branches + `entire/checkpoints/v1` | Session management without modifying active branch |

#### Strategy Details

Expand All @@ -176,16 +173,6 @@ Legacy names `shadow` and `dual` are only recognized when reading settings or ch
- PrePush hook can push `entire/checkpoints/v1` branch alongside user pushes
- `AllowsMainBranch() = true` - safe to use on main/master since it never modifies commit history

**Auto-Commit Strategy** (`auto_commit.go`)
- Code commits to active branch with **clean history** (commits have `Entire-Checkpoint` trailer only)
- Metadata stored on orphan `entire/checkpoints/v1` branch at sharded paths: `<id[:2]>/<id[2:]>/`
- Uses `checkpoint.WriteCommitted()` for metadata storage
- Checkpoint ID (12-hex-char) links code commits to metadata on `entire/checkpoints/v1`
- Full rewind allowed if commit is only on current branch (not in main); otherwise logs-only
- Rewind via `git reset --hard`
- PrePush hook can push `entire/checkpoints/v1` branch alongside user pushes
- `AllowsMainBranch() = false` - creates commits, so not recommended on main branch

#### Key Files

- `strategy.go` - Interface definition and context structs (`StepContext`, `TaskStepContext`, `RewindPoint`, etc.)
Expand All @@ -202,7 +189,6 @@ Legacy names `shadow` and `dual` are only recognized when reading settings or ch
- `manual_commit_logs.go` - Session log retrieval and session listing
- `manual_commit_hooks.go` - Git hook handlers (prepare-commit-msg, pre-push)
- `manual_commit_reset.go` - Shadow branch reset/cleanup functionality
- `auto_commit.go` - Auto-commit strategy implementation
- `hooks.go` - Git hook installation

#### Checkpoint Package (`cmd/entire/cli/checkpoint/`)
Expand Down Expand Up @@ -248,7 +234,7 @@ Legacy names `shadow` and `dual` are only recognized when reading settings or ch

#### Commit Trailers

**On active branch commits (auto-commit strategy only):**
**On active branch commits:**
- `Entire-Checkpoint: <checkpoint-id>` - 12-hex-char ID linking to metadata on `entire/checkpoints/v1`

**On shadow branch commits (`entire/<commit-hash>`):**
Expand Down
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,11 @@ Multiple AI sessions can run on the same commit. If you start a second session w
| `--local` | Write settings to `settings.local.json` instead of `settings.json` |
| `--project` | Write settings to `settings.json` even if it already exists |
| `--skip-push-sessions` | Disable automatic pushing of session logs on git push |
| `--strategy <name>` | Strategy to use: `manual-commit` (default) or `auto-commit` |
| `--telemetry=false` | Disable anonymous usage analytics |

**Examples:**

```
# Use auto-commit strategy
entire enable --strategy auto-commit

# Force reinstall hooks
entire enable --force

Expand Down Expand Up @@ -234,7 +230,7 @@ Personal overrides, gitignored by default:
|--------------------------------------|----------------------------------|------------------------------------------------------|
| `enabled` | `true`, `false` | Enable/disable Entire |
| `log_level` | `debug`, `info`, `warn`, `error` | Logging verbosity |
| `strategy` | `manual-commit`, `auto-commit` | Session capture strategy |
| `strategy` | `manual-commit` | Session capture strategy |
| `strategy_options.push_sessions` | `true`, `false` | Auto-push `entire/checkpoints/v1` branch on git push |
| `strategy_options.summarize.enabled` | `true`, `false` | Auto-generate AI summaries at commit time |
| `telemetry` | `true`, `false` | Send anonymous usage statistics to Posthog |
Expand Down Expand Up @@ -291,7 +287,7 @@ Entire automatically redacts detected secrets (API keys, tokens, credentials) wh
|--------------------------|-------------------------------------------------------------------------------------------|
| "Not a git repository" | Navigate to a Git repository first |
| "Entire is disabled" | Run `entire enable` |
| "No rewind points found" | Work with Claude Code and commit (manual-commit) or wait for agent response (auto-commit) |
| "No rewind points found" | Work with Claude Code and commit your changes |
| "shadow branch conflict" | Run `entire reset --force` |

### SSH Authentication Errors
Expand Down
2 changes: 1 addition & 1 deletion cmd/entire/cli/checkpoint/checkpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ type WriteCommittedOptions struct {
// This is useful for copying task metadata files, subagent transcripts, etc.
MetadataDir string

// Task checkpoint fields (for auto-commit strategy task checkpoints)
// Task checkpoint fields (for task/subagent checkpoints)
IsTask bool // Whether this is a task checkpoint
ToolUseID string // Tool use ID for task checkpoints

Expand Down
4 changes: 1 addition & 3 deletions cmd/entire/cli/clean.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ This command finds and removes orphaned data from any strategy:
reference them.

Checkpoint metadata (entire/checkpoints/v1 branch)
For auto-commit checkpoints: orphaned when commits are rebased/squashed
and no commit references the checkpoint ID anymore.
Manual-commit checkpoints are permanent (condensed history) and are
Checkpoints are permanent (condensed session history) and are
never considered orphaned.

Default: shows a preview of items that would be deleted.
Expand Down
22 changes: 1 addition & 21 deletions cmd/entire/cli/config.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
package cli

import (
"context"
"fmt"
"log/slog"
"strings"

"github.com/entireio/cli/cmd/entire/cli/agent"
"github.com/entireio/cli/cmd/entire/cli/logging"
"github.com/entireio/cli/cmd/entire/cli/settings"
"github.com/entireio/cli/cmd/entire/cli/strategy"

Expand Down Expand Up @@ -67,24 +64,7 @@ func IsEnabled() (bool, error) {
//

func GetStrategy() strategy.Strategy {
s, err := settings.Load()
if err != nil {
// Fall back to default on error
logging.Info(context.Background(), "falling back to default strategy - failed to load settings",
slog.String("error", err.Error()))
return strategy.Default()
}

strat, err := strategy.Get(s.Strategy)
if err != nil {
// Fall back to default if strategy not found
logging.Info(context.Background(), "falling back to default strategy - configured strategy not found",
slog.String("configured", s.Strategy),
slog.String("error", err.Error()))
return strategy.Default()
}

return strat
return strategy.NewManualCommitStrategy()
}

// GetLogLevel returns the configured log level from settings.
Expand Down
Loading