pub struct ClaudeTranscript { /* private fields */ }Expand description
A Claude Code session: the main transcript plus every subagent transcript
under its subagents/ directory, folded into one summary.
Claude Code bills a subagent’s API calls to the session that spawned it and shows them in its own cost display, but writes them to a separate file, so a session that used the Agent tool reads low if only the main transcript is counted. Each subagent file is tailed like the main one and its tokens, cost, turns, tool calls and spans are added to the parent’s. A subagent may run a different model from its parent; each line is priced by the model it names, so that is handled without special casing.
Implementations§
Source§impl ClaudeTranscript
impl ClaudeTranscript
pub fn new(path: impl Into<PathBuf>) -> Self
Sourcepub fn with_prices(self, prices: &'static Table) -> Self
pub fn with_prices(self, prices: &'static Table) -> Self
Price with this table instead of the process-wide one. Lets a test assert a cost without the developer’s own price file changing it.
Sourcepub fn with_spans(self, retention: SpanRetention) -> Self
pub fn with_spans(self, retention: SpanRetention) -> Self
Keep every span instead of the newest MAX_SPANS. See SpanRetention.