Skip to main content

ClaudeTranscript

Struct ClaudeTranscript 

Source
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

Source

pub fn new(path: impl Into<PathBuf>) -> Self

Source

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.

Source

pub fn with_spans(self, retention: SpanRetention) -> Self

Keep every span instead of the newest MAX_SPANS. See SpanRetention.

Source

pub fn set_registry_hints(&mut self, ps: &PidSession)

Trait Implementations§

Source§

impl SessionTracker for ClaudeTranscript

Source§

fn refresh(&mut self) -> Result<bool>

Ingest whatever was appended since the last call. Returns true when there is still unread data (the byte budget was exhausted).
Source§

fn summary(&self) -> &SessionSummary

Source§

fn path(&self) -> &Path

Source§

fn refresh_all(&mut self) -> Result<()>

Ingest the whole file, however many refreshes that takes. For a one-shot read such as an export; the live collector spreads a large transcript over several ticks instead.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.