claudecode

package
v0.54.1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

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

func Discover(repoRoots []string) []string

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

func Import(path string, fromOffset, maxBytes int64) ([]observe.Record, int64, error)

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.

Types

type Importer

type Importer struct{}

Importer is the zero-value observe.Adapter implementation — stateless, every method a pure function of its arguments.

func (Importer) Discover

func (Importer) Discover(repoRoots []string) []string

func (Importer) Import

func (Importer) Import(path string, fromOffset, maxBytes int64) ([]observe.Record, int64, error)

func (Importer) Source

func (Importer) Source() string

Jump to

Keyboard shortcuts

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