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.5.0.tar.gz (62.2 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.5.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.5.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.5.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.5.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.5.0.tar.gz.

File metadata

  • Download URL: cc_transcript-0.5.0.tar.gz
  • Upload date:
  • Size: 62.2 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.5.0.tar.gz
Algorithm Hash digest
SHA256 36bad7e59b06404b799eda4c90e3b798b671e5f2e19b8959db37df3a5b2a039f
MD5 47c2fe2d39a223e08eeafb60b6321bca
BLAKE2b-256 bcdedb4a84c8b1f4df590063e090706c834d97057f7b3f18c6cdf6886691e8e7

See more details on using hashes here.

Provenance

The following attestation bundles were made for cc_transcript-0.5.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.5.0-cp313-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cc_transcript-0.5.0-cp313-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 03ae48d729fe6756e0daa896f91b3525796a76c6d635889dcd8ce15d683b53fd
MD5 ba72e5b108a3977fd306ebc195737966
BLAKE2b-256 ed6072001114968e40f59d4972695cf3eb502feceb50bee17d8ce6c8b63b61ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for cc_transcript-0.5.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.5.0-cp313-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cc_transcript-0.5.0-cp313-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 d7cde2e4986e971c6725501ddf21f8e17575cf1b37893434b8b8db6b5e46acec
MD5 39d9f265c0315e9650ff43c87113e643
BLAKE2b-256 5e82e74df6fee531373d443504e70c598609f519f25cbf85cd7a0012c427bf70

See more details on using hashes here.

Provenance

The following attestation bundles were made for cc_transcript-0.5.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.5.0-cp313-abi3-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for cc_transcript-0.5.0-cp313-abi3-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 c74a0dc936b6bc9126a71318216f59953caf719ab6546ba6c7fe0ac0b4c2638d
MD5 46128812e7d1d8878f332a8929878ee9
BLAKE2b-256 2de3e1f5686f884883a9d1bf66b2898a059a47dec7c4d5a2191107b9ee3187ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for cc_transcript-0.5.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.5.0-cp313-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cc_transcript-0.5.0-cp313-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1c4a294946b18f8ce5d5a29f2af42ff373e895ac85fd543c82f69847e4744816
MD5 e7a4a89b600c008d1276da667f43bd4f
BLAKE2b-256 63aeae92ad0cc1e594f8aacd0bc31b45ec07db17d5b16e8ff21414622f2cc15b

See more details on using hashes here.

Provenance

The following attestation bundles were made for cc_transcript-0.5.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