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 @@ -289,8 +289,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 @@ -309,16 +308,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 @@ -336,7 +325,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 @@ -434,10 +422,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 @@ -502,12 +489,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
58 changes: 28 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ Entire hooks into your Git workflow to capture AI agent sessions as you work. Se

With Entire, you can:

* **Understand why code changed** — see the full prompt/response transcript and files touched
* **Recover instantly** — rewind to a known-good checkpoint when an agent goes sideways and resume seamlessly
* **Keep Git history clean** — preserve agent context on a separate branch
* **Onboard faster** — show the path from prompt → change → commit
* **Maintain traceability** — support audit and compliance requirements when needed
- **Understand why code changed** — see the full prompt/response transcript and files touched
- **Recover instantly** — rewind to a known-good checkpoint when an agent goes sideways and resume seamlessly
- **Keep Git history clean** — preserve agent context on a separate branch
- **Onboard faster** — show the path from prompt → change → commit
- **Maintain traceability** — support audit and compliance requirements when needed

## Table of Contents

Expand Down Expand Up @@ -59,6 +59,7 @@ entire enable
This installs agent and git hooks to work with your AI agent (Claude Code or Gemini CLI). The hooks capture session data at specific points in your workflow. Your code commits stay clean—all session metadata is stored on a separate `entire/checkpoints/v1` branch.

**When checkpoints are created** depends on your chosen strategy (default is `manual-commit`):
Copy link
Contributor

Choose a reason for hiding this comment

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

stale reference to strategies


- **Manual-commit**: Checkpoints are created when you or the agent make a git commit
- **Auto-commit**: Checkpoints are created after each agent response

Expand Down Expand Up @@ -129,7 +130,7 @@ Your Branch entire/checkpoints/v1
│ │
│ ┌─── Agent works ───┐ │
│ │ Step 1 │ │
│ │ Step 2 │ │
│ │ Step 2 │ │
│ │ Step 3 │ │
│ └───────────────────┘ │
│ │
Expand Down Expand Up @@ -163,37 +164,33 @@ Multiple AI sessions can run on the same commit. If you start a second session w

## Commands Reference

| Command | Description |
| ---------------- | ----------------------------------------------------------------------------- |
| `entire clean` | Clean up orphaned Entire data |
| `entire disable` | Remove Entire hooks from repository |
| `entire doctor` | Fix or clean up stuck sessions |
| `entire enable` | Enable Entire in your repository (uses `manual-commit` by default) |
| `entire explain` | Explain a session or commit |
| `entire reset` | Delete the shadow branch and session state for the current HEAD commit |
| Command | Description |
| ---------------- | ------------------------------------------------------------------------------------------------- |
| `entire clean` | Clean up orphaned Entire data |
| `entire disable` | Remove Entire hooks from repository |
| `entire doctor` | Fix or clean up stuck sessions |
| `entire enable` | Enable Entire in your repository (uses `manual-commit` by default) |
| `entire explain` | Explain a session or commit |
| `entire reset` | Delete the shadow branch and session state for the current HEAD commit |
| `entire resume` | Switch to a branch, restore latest checkpointed session metadata, and show command(s) to continue |
| `entire rewind` | Rewind to a previous checkpoint |
| `entire status` | Show current session and strategy info |
| `entire version` | Show Entire CLI version |
| `entire rewind` | Rewind to a previous checkpoint |
| `entire status` | Show current session and strategy info |
| `entire version` | Show Entire CLI version |

### `entire enable` Flags

| Flag | Description |
|------------------------|--------------------------------------------------------------------|
| ---------------------- | ------------------------------------------------------------------ |
| `--agent <name>` | AI agent to install hooks for: `claude-code` (default) or `gemini` |
| `--force`, `-f` | Force reinstall hooks (removes existing Entire hooks first) |
| `--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 @@ -231,10 +228,10 @@ Personal overrides, gitignored by default:
### Configuration Options

| Option | Values | Description |
|--------------------------------------|----------------------------------|------------------------------------------------------|
| ------------------------------------ | -------------------------------- | ---------------------------------------------------- |
| `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 All @@ -254,6 +251,7 @@ When enabled, Entire automatically generates AI summaries for checkpoints at com
```

**Requirements:**

- Claude CLI must be installed and authenticated (`claude` command available in PATH)
- Summary generation is non-blocking: failures are logged but don't prevent commits

Expand Down Expand Up @@ -287,12 +285,12 @@ Entire automatically redacts detected secrets (API keys, tokens, credentials) wh

### Common Issues

| Issue | Solution |
|--------------------------|-------------------------------------------------------------------------------------------|
| "Not a git repository" | Navigate to a Git repository first |
| "Entire is disabled" | Run `entire enable` |
| "No rewind points found" | Work with your configured agent and commit (manual-commit) or wait for an agent response (auto-commit) |
| "shadow branch conflict" | Run `entire reset --force` |
| Issue | Solution |
| ------------------------ | ------------------------------------------------------- |
| "Not a git repository" | Navigate to a Git repository first |
| "Entire is disabled" | Run `entire enable` |
| "No rewind points found" | Work with your configured agent 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
Loading