Skip to main content

Typed events for Claude Code transcripts: discovery, a superset JSONL parser (Python + Rust), and ingestion-state tracking.

Project description

cc-transcript

PyPI Python Docs License: PolyForm Noncommercial

cc-transcript parses Claude Code's on-disk JSONL transcripts into a typed superset event model — every entry type preserved, nothing dropped — so you build on one faithful representation and apply your own semantic filtering on top.

The one property that makes it worth using: the parser is non-lossy. It never silently discards sidechains, synthetic turns, tool results, or unrecognized entry types; filtering is opt-in and lives in your code, not buried in the parser.

Install

uv add cc-transcript        # or: pip install cc-transcript

Quickstart

Discover the transcripts on disk, parse one, and look at the events:

from cc_transcript import TranscriptDiscovery, parse_events, AssistantEvent, UserEvent

events = parse_events(TranscriptDiscovery.find_transcripts()[0])

for event in events:
    match event:
        case UserEvent(text=text):
            print("user:", text[:80])
        case AssistantEvent(model=model, text=text):
            print(f"assistant ({model}):", text[:80])

Compose a filter from small building blocks and apply it. The builders return clauses, build_spec assembles them into a spec, and apply_spec yields the survivors:

from cc_transcript import apply_spec, build_spec, keep_only, drop_junk, drop_short

spec = build_spec(keep_only("user", "assistant"), drop_junk("structural"), drop_short(2))
clean = list(apply_spec(events, spec))

NOISE_SPEC is a ready-made spec for the universal structural noise (system reminders, local-command output, skill banners). For flag-style filtering, FilterConfig is also available — every rule is off by default, so a bare FilterConfig() passes everything through.

What problems does this solve?

  • One faithful parse. Anything reading Claude Code transcripts re-implements the same JSONL quirks (str-or-list content, tool results nested two ways, envelope-less mode markers). This is that parser, written once and typed strictly.
  • Non-lossy by design. The event model is a superset: sidechains, <synthetic> turns, thinking blocks, and unrecognized entry types all survive parsing. You decide what to drop, via composable filter specs (build_spec) or FilterConfig.
  • Incremental ingestion. FileStateStore tracks per-file mtimes in SQLite (WAL, thread-safe) so re-runs only reparse changed files, and you compose your own writes in the same transaction.
  • Pluggable backends. A Rust backend (PyO3 + rayon) is the default fast path, with a pure-Python reference parser behind the same Backend protocol as the fallback — both at full event parity.

Docs

Read the docs for the full guides — Getting Started, Filtering events, Scoring sentiment, Rust/Python backends & parity, and Compose your own policy — plus the complete API reference.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cc_transcript-0.7.0.tar.gz (72.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

cc_transcript-0.7.0-cp313-abi3-manylinux_2_28_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.13+manylinux: glibc 2.28+ x86-64

cc_transcript-0.7.0-cp313-abi3-manylinux_2_28_aarch64.whl (2.2 MB view details)

Uploaded CPython 3.13+manylinux: glibc 2.28+ ARM64

cc_transcript-0.7.0-cp313-abi3-macosx_11_0_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.13+macOS 11.0+ x86-64

cc_transcript-0.7.0-cp313-abi3-macosx_11_0_arm64.whl (2.1 MB view details)

Uploaded CPython 3.13+macOS 11.0+ ARM64

File details

Details for the file cc_transcript-0.7.0.tar.gz.

File metadata

  • Download URL: cc_transcript-0.7.0.tar.gz
  • Upload date:
  • Size: 72.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cc_transcript-0.7.0.tar.gz
Algorithm Hash digest
SHA256 8d143a6e0f57eb6e12b5a4016ca64ba75f14de2a16cbc10d516b7b8c39917a11
MD5 c9b979981fc5231c8958999ee7edccb5
BLAKE2b-256 fcfe418d91db017208cbe77fea5b0092a9438498ebcd597207ba9c299fe127c8

See more details on using hashes here.

Provenance

The following attestation bundles were made for cc_transcript-0.7.0.tar.gz:

Publisher: release-pypi.yml on yasyf/cc-transcript

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cc_transcript-0.7.0-cp313-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cc_transcript-0.7.0-cp313-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 af3fb87213f1a67e828c228acd4a74beeffd53631948e8779f5eee509c15eedb
MD5 c9f1061f4f757489b4812128c2513ddf
BLAKE2b-256 db7773cfe295ed7eacd6bf7a94a884fa0d4c15d1ecef8ce0fa6fe7744b9a3841

See more details on using hashes here.

Provenance

The following attestation bundles were made for cc_transcript-0.7.0-cp313-abi3-manylinux_2_28_x86_64.whl:

Publisher: release-pypi.yml on yasyf/cc-transcript

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cc_transcript-0.7.0-cp313-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cc_transcript-0.7.0-cp313-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 3f22c27c2bc6c6ec2e1b47b1e92f91d04b48707be48de72e146b09cd32910bec
MD5 9cd55b3d59f9376270ba863581f269ae
BLAKE2b-256 864a343e81c0745458c68cb7869d58344864b97cb1c9d3074890480b11c87782

See more details on using hashes here.

Provenance

The following attestation bundles were made for cc_transcript-0.7.0-cp313-abi3-manylinux_2_28_aarch64.whl:

Publisher: release-pypi.yml on yasyf/cc-transcript

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cc_transcript-0.7.0-cp313-abi3-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for cc_transcript-0.7.0-cp313-abi3-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 9e4acd7d16d8d31b7f71678c6bd7c7c373953970f4538e7dc83ae8d96389d3e5
MD5 eb4f93cfbb8fded91cfe4f917643d547
BLAKE2b-256 fe4074fae716d01a95047bfe6426533be257a02e5855e421b902ab314a18db8e

See more details on using hashes here.

Provenance

The following attestation bundles were made for cc_transcript-0.7.0-cp313-abi3-macosx_11_0_x86_64.whl:

Publisher: release-pypi.yml on yasyf/cc-transcript

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cc_transcript-0.7.0-cp313-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cc_transcript-0.7.0-cp313-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 509c9f6a5990c93bc05af1e7db8fe25f4eb0b95d92fe2d256c4669cd231ca456
MD5 06d7654ab721769e31b3913ba7b7d5f4
BLAKE2b-256 629045667d38df17e7a614f1187e8e19754d9b29e640ffd9c9eb992a260afc1d

See more details on using hashes here.

Provenance

The following attestation bundles were made for cc_transcript-0.7.0-cp313-abi3-macosx_11_0_arm64.whl:

Publisher: release-pypi.yml on yasyf/cc-transcript

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page