Documentation
¶
Overview ¶
Package agentimport imports a coding agent's pre-existing local transcripts into Entire as read-only, commit-less checkpoints on the v1 metadata branch.
The orchestration (discovery loop, idempotent per-turn IDs, redaction, and the checkpoint write) is agent-agnostic and lives here. Each agent plugs in an Importer that knows where its transcripts live and how to split one into per-user-prompt turns. Claude Code is the only implementation today (see claude.go); others register themselves the same way.
Index ¶
Constants ¶
const LookbackDays = 30
LookbackDays bounds how far back import reaches. Fixed this pass (no flag).
Variables ¶
This section is empty.
Functions ¶
func DeriveCheckpointID ¶
func DeriveCheckpointID(sessionID, turnUUID string) id.CheckpointID
DeriveCheckpointID produces a stable 12-hex checkpoint ID for an imported turn. Re-importing the same (sessionID, turnUUID) yields the same ID, which is how import stays idempotent.
Types ¶
type Importer ¶
type Importer interface {
// Name is the registry key and the provenance source (e.g. "claude-code").
Name() string
// AgentType is the display name stored in checkpoint metadata (e.g. "Claude Code").
AgentType() types.AgentType
// Discover returns the agent's transcript files for the repo within the
// lookback window. overridePath replaces the default transcript dir;
// sessionFilter, when non-empty, keeps only matching session IDs.
Discover(repoRoot, overridePath string, now time.Time, sessionFilter []string) ([]SessionFile, error)
// SplitTurns splits one session's raw transcript bytes into per-turn units.
SplitTurns(sf SessionFile, full []byte) ([]Turn, error)
}
Importer is the per-agent seam: it locates an agent's transcripts for a repo and splits one into per-turn units. Everything else (idempotency, redaction, writing) is handled generically by Run.
type Options ¶
type Options struct {
RepoRoot string
OverridePath string
SessionFilter []string
Now time.Time
DryRun bool
}
Options configures an import run.
type Result ¶
Result summarizes an import run.
type SessionFile ¶
type SessionFile struct {
Path string // absolute path to the transcript file
SessionID string // agent session id (used in checkpoint metadata)
}
SessionFile is one discovered agent transcript for a repo.
type Turn ¶
type Turn struct {
LineStart, LineEnd int
UUID string
Prompt, Model string
CreatedAt time.Time
Tokens *types.TokenUsage
}
Turn is one user-prompt turn extracted from a session transcript. Line offsets are in raw-line space (newline-counted), matching transcript slicing and the agent token-usage helpers.