## Claude Code Documentation

Claude Code is Anthropic’s official CLI for Claude, designed for software engineering tasks. Entire has first-class integration with Claude Code — it is the default agent and is the most stable integration, capturing full session transcripts, file changes, tool calls, token usage, and nested subagent sessions.

## Prerequisites

- [Entire CLI installed](https://docs.entire.io/installation)
- [Claude Code installed](https://docs.anthropic.com/en/docs/claude-code)
- A Git repository with Entire enabled

## Enable

```
entire agent add claude-code
claude
```

### How it works

Entire automatically detects when Claude Code is active and begins capturing the session via Git hooks:

1. **Session Detection** — when Claude Code starts, Entire detects the process.
2. **Hook Triggers** — Git hooks fire on file changes and commits.
3. **Checkpoint Creation** — checkpoints are created when you or the agent make a Git commit.
4. **Metadata Capture** — session data is stored on the `entire/checkpoints/v1` branch.

### What gets captured

Entire captures the following from Claude Code sessions:

| Data          | Description                                        |
|---------------|----------------------------------------------------|
| Conversation  | Full transcript of prompts and responses            |
| File changes  | All files modified during the session              |
| Tool calls    | Commands executed, files read, etc.                |
| Token usage   | Input, output, and cache tokens                     |
| Timestamps    | Start time, checkpoints, end time                  |

### Features

**Nested session support.** When Claude Code spawns sub-agents via the Task tool, Entire captures these as nested sessions:

```
Main Session
├── Checkpoint 1
├── Sub-agent Session (Task: "Run tests")
│   ├── Sub-checkpoint 1
│   └── Sub-checkpoint 2
└── Checkpoint 2
```

Nested sessions preserve the full context of complex multi-agent workflows.

**Rewind during sessions.** Use `entire checkpoint rewind` while Claude Code is running to restore to a previous checkpoint. See the [`checkpoint rewind` command reference](https://docs.entire.io/cli-reference/checkpoint#checkpoint-rewind) for full flag documentation.

**Resume previous sessions.** Switch to a session’s branch with `entire session resume BRANCH`. The CLI restores the session log if needed and prints the Claude Code resume command. See the [`session resume` command reference](https://docs.entire.io/cli-reference/sessions#session-resume) for full flag documentation.

**Explain commits.** Inspect any commit or checkpoint with `entire checkpoint explain`. See the [`checkpoint explain` command reference](https://docs.entire.io/cli-reference/checkpoint#checkpoint-explain) for full flag documentation.

The `--generate` flag on `entire checkpoint explain` requires the configured provider CLI, such as Claude CLI, to be installed and authenticated.

### Best practices

**Commit at logical points.** Create checkpoints at natural stopping points: after implementing a feature, before making major changes, or when you’d want to rewind later.

**Review sessions in PRs.** Commits include `Entire-Checkpoint` trailers. Reviewers can click through to view session details — understanding _why_ code was written helps with review.

### Example workflow

A typical workflow with Claude Code and Entire:

```
# 1. Enable Entire
cd my-project
entire enable

# 2. Start Claude Code
claude

# 3. Work with Claude (in Claude Code)
> Add user authentication with JWT tokens

# 4. Check status (in another terminal)
entire status

# 5. Made a mistake? Rewind
entire checkpoint rewind

# 6. Commit when ready
git add .
git commit -m "Add JWT authentication"

# 7. Push to see on entire.io
git push
```

Your session is now visible on [entire.io](/content/site-root.html) with full context for code review.

## Troubleshooting

### Session not being captured

1. Verify Entire is enabled: `entire status`
2. Check that Git hooks are installed: `ls .git/hooks`
3. Ensure Claude Code is running from within the repository

### Rewind not working

Rewind requires an active session with checkpoints. Check:

```
entire status
```

If no session is active, checkpoints may only exist on the sessions branch.
