episode

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 4, 2026 License: MIT Imports: 9 Imported by: 0

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

func Capture(transcriptPath, outputDir string) (string, error)

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

func RenderMarkdown(ep *Episode) string

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 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

func ParseTranscript(path string) (*Episode, error)

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.

type Message

type Message struct {
	Timestamp string
	Text      string
}

Message is one verbatim text exchange captured from a session transcript.

type PRLink struct {
	Number     int
	URL        string
	Repository string
	Timestamp  string
}

PRLink is a pull request announced by a pr-link record.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL