Add import tool for sessions prior to enabling Entire#1527
Conversation
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Entire-Checkpoint: 3d478cdad9c1
…tadata Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Entire-Checkpoint: 5d96dcf7065b
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Entire-Checkpoint: f85986b0716e
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Entire-Checkpoint: d027d2f148a0
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Entire-Checkpoint: 487abe46ddad
…sage Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Entire-Checkpoint: 3866c6eb201d
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Entire-Checkpoint: 8db9350e70f6
…h label Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Entire-Checkpoint: 132601907855
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Entire-Checkpoint: 9643642e02f9
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Entire-Checkpoint: dc1cf8d69df4
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Entire-Checkpoint: 996ef1f5522c
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Entire-Checkpoint: 412f636a521e
…-store access Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Entire-Checkpoint: f2e9d10c5908
Imported checkpoints now live on entire/checkpoints/v1 (tagged Kind:imported) instead of a local-only entire/imports/v1 ref. They are redacted and pushed like normal checkpoints, which is what lights up server-side search/recap/UI. This collapses the read paths back to a single store and fixes two bugs that came from the two-ref design: - explain <imported-id> now resolves (was: not found, only consulted v1+shadow) - imported checkpoints no longer duplicate as [temporary] (shadow-branch scanner no longer mis-reads a second metadata ref) Removes ImportsRefs/OpenImports/ImportsBranchName and the read-path unions; keeps Kind:imported, provenance, the [imported] label, rewind refusal, and the deterministic-ID idempotency. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Entire-Checkpoint: fb2f7d9f9b04
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 4 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 241ac12. Configure here.
There was a problem hiding this comment.
Pull request overview
Adds a new “import existing Claude Code transcripts” pathway so a repo adopting Entire can populate checkpoint history from past Claude sessions. The PR introduces an importclaude package, a hidden entire import claude-code command, an enable-time prompt, and extends the checkpoint metadata contract to represent imported (read-only) checkpoints with provenance.
Changes:
- Add import orchestration (
importclaude) that discovers recent Claude session JSONL files, splits them into per-user-prompt turns, derives deterministic checkpoint IDs, and writes them as imported checkpoints. - Extend checkpoint metadata to carry
ImportedandProvenance, and surface imported checkpoints in list/explain flows while refusing rewind. - Add CLI entry points (hidden
importcommand +entire enableprompt) and integration/unit tests covering the end-to-end behavior.
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| cmd/entire/cli/strategy/strategy.go | Adds RewindPoint.Imported flag to represent imported checkpoints in rewind/list presentation. |
| cmd/entire/cli/strategy/manual_commit_types.go | Adds Imported field to checkpoint info struct used by strategy/UI plumbing. |
| cmd/entire/cli/strategy/common.go | Propagates Imported from checkpoint store info into strategy-level info. |
| cmd/entire/cli/setup.go | Adds enable-time prompt that optionally imports recent Claude transcripts. |
| cmd/entire/cli/setup_import_prompt_test.go | Tests prompt skipping behavior in non-interactive / no-transcript scenarios. |
| cmd/entire/cli/session/state.go | Introduces KindImported to tag imported checkpoints. |
| cmd/entire/cli/root.go | Registers new hidden import command group. |
| cmd/entire/cli/rewind.go | Refuses rewinding to imported checkpoints with a clear message. |
| cmd/entire/cli/rewind_imports_test.go | Tests the imported-checkpoint rewind refusal behavior. |
| cmd/entire/cli/labs.go | Adds entire import claude-code to labs-discoverable experimental commands. |
| cmd/entire/cli/integration_test/import_claude_test.go | End-to-end integration test for import, labeling, explain-by-id, idempotency, and rewind refusal. |
| cmd/entire/cli/importclaude/turns.go | Implements transcript splitting into turns + per-turn token/model extraction. |
| cmd/entire/cli/importclaude/turns_test.go | Unit tests for turn splitting and tool_result exclusion. |
| cmd/entire/cli/importclaude/importer.go | Implements discovery + idempotent write of imported checkpoints into persistent store. |
| cmd/entire/cli/importclaude/importer_test.go | Unit tests for import/idempotency and dry-run behavior. |
| cmd/entire/cli/importclaude/id.go | Deterministic checkpoint ID derivation for imported turns. |
| cmd/entire/cli/importclaude/id_test.go | Unit test for deterministic/distinct imported IDs. |
| cmd/entire/cli/importclaude/discover.go | Discovers recent transcript files with a fixed lookback + optional filtering. |
| cmd/entire/cli/importclaude/discover_test.go | Unit tests for lookback and session filtering behavior. |
| cmd/entire/cli/import_cmd.go | Adds hidden entire import claude-code command and flags. |
| cmd/entire/cli/import_cmd_test.go | CLI-level test ensuring dry-run reports counts. |
| cmd/entire/cli/explain.go | Includes imported checkpoints in checkpoint list grouping + blocks summary generation for imported checkpoints. |
| cmd/entire/cli/checkpoint/persistent.go | Persists Provenance and carries forward an Imported summary umbrella flag. |
| cmd/entire/cli/checkpoint/persistent_imported_test.go | Tests that imported checkpoints surface on list as imported. |
| cmd/entire/cli/checkpoint/aliases.go | Exposes Provenance via alias for CLI checkpoint package. |
| api/checkpoint/metadata.go | Adds Provenance type and Imported fields to metadata contract. |
| api/checkpoint/metadata_test.go | Tests JSON round-trip for provenance and imported flags. |
Renames cmd/entire/cli/importclaude -> cmd/entire/cli/agentimport with an Importer seam (Discover + SplitTurns) and a static set of supported agents, so other agents can be added without touching the orchestration. Claude Code is the only implementation today. Also drops the enable-time import prompt; importing is a hidden command only (entire import <agent>, discoverable via entire labs). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Entire-Checkpoint: e58fc114f6a9
- explain: cap live (commit-linked + temporary) checkpoints to the limit before appending imported ones, so a large import can't evict recent checkpoints from 'checkpoint list' - agentimport: redact each session transcript once per file instead of once per turn (O(files) not O(turns)) - correct stale 'local-only'/'entire/imports/v1' wording in Kind/flag/field comments — imported checkpoints live on v1 and push like normal checkpoints Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Entire-Checkpoint: f553c0e9a83c
…points Address review findings on imported-checkpoint history: - Call strategy.EnsureRedactionConfigured() before import writes so imported transcripts honor opt-in PII, custom_redactions, and redactor packs, not just always-on secret scanning. Covered by a custom-redaction test. - Store only the transcript basename (transcript_file) in provenance instead of the absolute path, which leaked local usernames/repo layout onto the shared v1 branch. - Hash the redacted turn slice instead of raw bytes, closing a confirmation attack against guessed raw prompt/output content. - Gate the explain "--generate" hint on summary.Imported, since imported history is read-only and --generate is refused. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Entire-Checkpoint: 3e645399c3f3
Provenance was written to metadata.json but never read: idempotency comes from the deterministic checkpoint ID (sha256(sessionID/turnUUID)), and explain never cited it. Removing the Provenance struct/field and the now-dead Turn fields (ParentUUID) and import-version constant. Imported checkpoints keep Kind and the Imported flag. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Entire-Checkpoint: 4315ab0b3062

https://entire.io/gh/entireio/cli/trails/668
What
Adds the ability to import a coding agent's pre-existing local transcripts into Entire as read-only checkpoints, so a repo adopting Entire isn't starting from zero (
checkpoint list/explain,search,tokens, and server-side recap/UI work on day-one history). Supports #1336 (enable doesn't prompt to import yet - requires manual kickoff for validation first). Claude Code is the only agent implemented; the package is structured so others can be added.Surface: a hidden command, discoverable via
entire labs:There is intentionally no enable-time prompt this pass — importing is an explicit, opt-in command.
How
cmd/entire/cli/agentimport/package. The orchestration (discovery loop, idempotent per-turn IDs, redaction, checkpoint write) is agent-agnostic; each agent plugs in anImporter(Discover+SplitTurns). A static list of supported importers backsentire import <agent>— adding an agent is a newImporter, no command wiring.~/.claude/projects/<sanitized-repo-path>/*.jsonl(fixed one-month lookback), splits each session into per-user-prompt turns, and writes one checkpoint per turn — reusing existing transcript parsing, per-turn token accounting (incl. subagent rollups), and redaction (redact.JSONLBytes).entire/checkpoints/v1metadata branch, taggedKind:"imported"with provenance (source, session/turn UUIDs, line range, content hash, import version). They're commit-less (noEntire-Checkpointtrailer) and surface inlist/explainvia anImportedflag, labeled[imported].sha256(sessionID + "/" + turnUUID), so re-running skips already-imported turns.checkpoint rewindrefuses imported checkpoints with a clear read-only message.Tradeoffs / known limitations (do later)
entire enable(an earlier iteration prompted at enable time; removed for now). Users runentire import claude-codewhen they want it.transcript_path) sync on the next push, unless checkpoint pushing is disabled. (An earlier iteration kept imports local-only on a separateentire/imports/v1ref; reverted — it caused explain-by-id and[temporary]-duplication bugs and was a cross-cutting overhaul. Single-ref is simpler; a local-only/opt-in-to-push mode could be revisited.)entire import <agent>surface leave room for others).Reviewer notes
Kind:"imported"+Provenance+ anImportedumbrella flag were added to the checkpoint metadata contract (api/checkpoint).mise run lint(0 issues) andmise run test:ci(unit + integration + e2e canary) green; an end-to-end integration test covers dry-run, import,[imported]labeling (no[temporary]duplication), explain-by-id, idempotency, and rewind refusal.