Documentation
¶
Overview ¶
Package claudecode is an observe.Adapter over Claude Code's own local session transcripts (~/.claude/projects/<escaped-cwd>/*.jsonl — or $CLAUDE_CONFIG_DIR if set, the officially documented override). The format is NOT versioned or documented by the vendor; everything this file assumes was confirmed against a live sample at implementation time (see the field comments below) and parsing is defensive by construction — a line, or a line's shape, this package doesn't recognize is skipped, never fatal.
Deliberately narrow in what it extracts, for two reasons at once: cost (see package observe's doc comment — no raw transcript text ever reaches disk, let alone a model) and fidelity to memcode's OWN doctrine for what's "meaningful" (sessionlog.KindToolCall's doc comment: real actions, not internal reads). A human's own ask, a real `git commit`/`push`, and a Write tool call whose full resulting content is recoverable (an Edit's is NOT — it carries only old/new fragments, not the whole file) are the only things that become a Record.
Index ¶
Constants ¶
const Source = "claude-code"
Source is this adapter's provenance tag (focus.Turn.Source and the .memcode/observe/<source>/ directory name).
Variables ¶
This section is empty.
Functions ¶
func Discover ¶
Discover locates every Claude Code session transcript for the given repo roots (see gitlog.Roots — the project(s) under this workspace Claude Code may have worked in) that was modified within the last maxAge. Missing/ inaccessible directories are simply absent from the result, never an error — most roots will have no Claude Code history at all.
func Import ¶
Import parses the new lines appended to path since fromOffset (via observe.ReadNewLines, which bounds how much is read and guarantees a line is never split across two calls), up to maxBytes of new content, and returns the Records extracted plus the offset to resume from next time. A line that fails to parse is skipped, never fatal to the rest of the file.