compact

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: MIT Imports: 9 Imported by: 0

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(content []byte, opts MetadataFields) ([]byte, error)

Compact converts a full.jsonl transcript into the condensed transcript.jsonl format.

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