feat(import): add Provenance, imported Kind, and Imported flags to metadata · Entire
feat(import): add Provenance, imported Kind, and Imported flags to metadata
487032a→main·
computermode·3w ago·4 files·+80 added/-0 removed
Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
Sessions
5d96dcf7065bView transcript
[?
Implement Claude History Import FeatureClaude Code·Opus 4.8·3 steps](/content/gh/entireio/cli/session/897809d4-ecab-4dc6-aa21-97661cb62607#timeline-5d96dcf7065b/index.html)
Changes
4
api/checkpoint
Mmetadata.go+32
Ametadata_test.go+42
cmd/entire/cli
checkpoint
Maliases.go+1
session
Mstate.go+5
10 unmodified lines
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
119 unmodified lines
151
152
153
154
155
156
157
158
159
160
120 unmodified lines
281
282
283
284
285
286
287
288
289
290
79 unmodified lines
370
371
372
373
374
375
376
377
378
379
83 unmodified lines
463
464
465
466
467
468
469
470
471
472
473
10 unmodified lines
"github.com/go-git/go-git/v6/plumbing"
// Provenance records where an imported checkpoint came from, so explain/search
// can cite the original transcript honestly and re-import stays idempotent.
// Only set for imported (Kind == "imported") checkpoints.
type Provenance struct {
Source string `json:"source"` // e.g. "claude-code"
TranscriptPath string `json:"transcript_path"` // absolute path at import time
SessionID string `json:"session_id"` // agent session id
TurnUUID string `json:"turn_uuid"` // uuid of the user-prompt line that starts this turn
ParentUUID string `json:"parent_uuid,omitempty"` // parent uuid of that line
LineStart int `json:"line_start"` // 0-indexed start line of this turn in the source
LineEnd int `json:"line_end"` // exclusive end line (next turn start or EOF)
ContentHash string `json:"content_hash"` // hash of the turn slice
ImportVersion int `json:"import_version"` // importer schema version
}
// WriteOptions contains options for writing a persistent checkpoint.
type WriteOptions struct {
// CheckpointID is the stable 12-hex-char identifier
119 unmodified lines
// Kind identifies the session purpose (e.g., "agent_review"). Empty for normal sessions.
Kind string
// Provenance records the source of an imported checkpoint. Only set when
// Kind == "imported".
Provenance *Provenance
// ReviewSkills is the snapshot of skills used (only meaningful when Kind is a review kind).
// May be empty when a review is attached post-hoc without declared skills.
ReviewSkills []string
120 unmodified lines
// Multi-session support
SessionCount int // Number of sessions (1 if single session)
SessionIDs []string // All session IDs that contributed
// Imported is true when this checkpoint was imported from pre-existing
// agent history (Kind == "imported"): read-only, commit-less, local-only.
Imported bool
}
// SessionContent contains the actual content for a session.
79 unmodified lines
// Kind identifies the session purpose (e.g., "agent_review"). Empty for normal sessions.
Kind string `json:"kind,omitempty"`
// Provenance records the source of an imported checkpoint. Only set when
// Kind == "imported".
Provenance *Provenance `json:"provenance,omitempty"`
// ReviewSkills lists the review skills that were run (only set when Kind is a review kind).
// May be empty when a review was attached post-hoc without declared skills.
ReviewSkills []string `json:"review_skills,omitempty"`
83 unmodified lines
// be set so callers can keep asking "was this investigated in any way?"
// without caring about the variant.
HasInvestigation bool `json:"has_investigation,omitempty"`
// Imported is true when this checkpoint was imported from pre-existing
// agent history (a session with Kind == "imported"): read-only,
// commit-less, and local-only this pass.
Imported bool `json:"imported,omitempty"`
}
// SessionMetrics contains hook-provided session metrics from agents that report