Disk truth
DiskTruth
A session’s disk-level activity exported from cc-review.
Usage
DiskTruth(
session_id,
turns,
attributions,
)Attributes
session_id: SessionId-
The Claude session UUID the export covers.
turns: tuple[TreeTurn, …]-
The session’s tree-bracketed turns, in ledger order.
attributions: tuple[FileAttribution, …]- Version-dimensioned per-file attribution ranges.
Example
>>> truth = export_activity(session_id)
>>> changed = [turn for turn in truth.turns if turn.tree_end != turn.tree_start] if truth else []TreeTurn
One Claude prompt-to-stop window bracketed by working-tree snapshots.
Usage
TreeTurn(
turn_id,
repo_root,
started_at_ms,
ended_at_ms,
tree_start,
tree_end,
status
)Attributes
turn_id: int-
cc-review’s identifier for the turn.
repo_root: str-
The repository the tree snapshots were taken in.
started_at_ms: int-
Integer-millisecond timestamp the turn opened.
ended_at_ms: int-
Integer-millisecond timestamp the turn closed; 0 while the turn is still open.
tree_start: str-
The working-tree hash at turn open.
tree_end: str-
The working-tree hash at turn close; empty while open.
status: str-
cc-review’s turn state: open,
closed, orinterrupted.
FileAttribution
One file’s attribution ranges within one review version.
Usage
FileAttribution(review_id, version, file_path, ranges)Attributions are keyed by (version, file_path) — the version dimension is preserved because flat per-session ranges were ambiguous across review versions.
Attributes
review_id: str-
The review the version belongs to.
version: int-
The review version number the ranges were computed against.
file_path: str-
The file the ranges cover, relative to the repo root.
ranges: tuple[AttributionRange, …]- The attributed spans, in file order.
AttributionRange
An inclusive span of new-side diff lines attributed to one turn.
Usage
AttributionRange(start, end, turn_id)Attributes
start: int-
The first attributed line, 1-based.
end: int-
The last attributed line, inclusive.
turn_id: int | None- The turn that wrote the span; None when unattributed.
load_export()
Parse a cc-review export activity payload.
Usage
load_export(data)Strict by contract: every field must be present, and timestamps are integer milliseconds.
Raises
SchemaError-
When
datadoes not carry the literalcc-review.activity/1schema.
export_activity()
Export session_id’s disk truth by shelling out to cc-review.
Usage
export_activity(session_id, *, binary="cc-review")Runs <binary> export activity --session <uuid> and parses its stdout via load_export().
Returns
DiskTruth | None-
The parsed export, or None when the binary is absent or exits
nonzero — consumers degrade to transcript-only activity.