compact

package
v0.7.7 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2026 License: MIT Imports: 12 Imported by: 1 module, 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 compact converts full.jsonl transcripts into a normalized, compact transcript.jsonl format. Only shared formatting is contained here.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compact

func Compact(redacted redact.RedactedBytes, opts MetadataFields) ([]byte, error)

Compact converts a full.jsonl transcript into the condensed transcript.jsonl format. The input must be pre-redacted (via redact.JSONLBytes or redact.AlreadyRedacted for trusted sources).

The output format puts version, agent, and cli_version on every line, merges streaming assistant fragments with the same message ID, and inlines tool results into the preceding assistant's tool_use blocks:

{"v":1,"agent":"claude-code","cli_version":"0.42.0","type":"user","ts":"...","content":"..."}
{"v":1,"agent":"claude-code","cli_version":"0.42.0","type":"assistant","ts":"...","id":"msg_xxx","content":[{"type":"text","text":"..."},{"type":"tool_use","id":"...","name":"...","input":{...},"result":{"output":"...","status":"..."}}]}

Types

type CondensedEntry added in v0.5.4

type CondensedEntry struct {
	Type       string
	Content    string
	ToolName   string
	ToolDetail string
}

func BuildCondensedEntries added in v0.5.4

func BuildCondensedEntries(content []byte) ([]CondensedEntry, error)

type MetadataFields

type MetadataFields struct {
	Agent      string // e.g. "claude-code"
	CLIVersion string // e.g. "0.42.0"
	StartLine  int    // checkpoint_transcript_start (0 = no truncation)
}

MetadataFields provides metadata fields written to every output line.

Jump to

Keyboard shortcuts

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