Documentation
¶
Overview ¶
Package episode parses a Claude Code session transcript (JSONL) into a structured Episode and renders it as a markdown "episode" file for the identity vault. It is the v0 of the episodic substrate — raw per-session capture, no distillation, not indexed into the vault's search layer.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Capture ¶
Capture parses the transcript at transcriptPath, renders the episode markdown, and writes it to outputDir. Returns the written file path. Overwrites an existing file with the same derived ID — re-running against a finalized transcript is idempotent by design. Uses atomic temp-file + rename so concurrent SessionEnd hook invocations cannot produce torn files.
func RenderMarkdown ¶
RenderMarkdown turns a parsed Episode into a vault-ready markdown file. Schema is intentionally simple: frontmatter + section-per-signal-type. No distillation, no prose — the next layer (arc distillation) will consume this structure.
Types ¶
type CaptureBatch ¶ added in v0.1.6
type CaptureBatch struct {
Captured []string // episode file paths written, in transcript-path order
Skipped map[string]string // transcript path -> reason (empty/malformed/parse error)
}
CaptureBatch summarizes a directory capture: the episode files written and the transcripts that were skipped (with the reason). Skipping is deliberate — a noise or partial transcript in a large history must not abort the whole batch.
func CaptureDir ¶ added in v0.1.6
func CaptureDir(dir, outputDir string) (CaptureBatch, error)
CaptureDir captures every *.jsonl transcript found recursively under dir into outputDir. It is the bootstrap entry point: point it at a project's Claude Code transcript directory (e.g. ~/.claude/projects/<slug>) to seed an identity vault from sessions that already exist. Malformed/empty transcripts go into Skipped rather than failing the run; capture itself is idempotent.
type Episode ¶
type Episode struct {
ID string
SessionID string
StartedAt string
EndedAt string
CWD string
GitBranch string
UserMessages []Message
AssistantMessages []Message
ToolCounts map[string]int
Commits []string
PRs []PRLink
FilesTouched []string
}
Episode is the structured output of parsing a session transcript.
func ParseTranscript ¶
ParseTranscript reads a Claude Code JSONL transcript and returns the distilled Episode. Noise records (system reminders, tool results, thinking blocks) are filtered — only real human/assistant exchanges, tool uses, and structural events are kept.