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.1.tar.gz (72.5 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.1-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.1-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.1-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.1-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.1.tar.gz.

File metadata

  • Download URL: cc_transcript-0.7.1.tar.gz
  • Upload date:
  • Size: 72.5 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.1.tar.gz
Algorithm Hash digest
SHA256 b35d0002fda17353f49a7390b1de7cb30fb8c3e70ed48d2ea4815cea72e2d106
MD5 07bfc043da3ed4e0b2b8f84aafc4c1fc
BLAKE2b-256 2e82a8affe22fde6c034f928f261779b48ece2fef912415e52e54cc944c144dd

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cc_transcript-0.7.1-cp313-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1365a17a71c3e9f253f1e6229d49d8f462918d92ae732fd5db9fb1bc3ffce0fd
MD5 450f4f36ecd7b75948a7da8170f69900
BLAKE2b-256 068bdc78759a2943ad964f9ddaf5146872c07bffc0d44764a182806ad8490020

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cc_transcript-0.7.1-cp313-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 0deee52953a22957b78178d6729747e8feb0c3e6a2d78f73716494fe97ffd33f
MD5 e7079e204f236abf93bcbd72a4404bac
BLAKE2b-256 5681f4b5f1ef0fb3585c4005e00c8eaf4d6eaab5098830ce2e74990238406c6b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cc_transcript-0.7.1-cp313-abi3-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 f2f3f3724ec9fcf2f3517a94a3b649263861d62444af3fe9f3041c73e8664fd1
MD5 785b414afbe6793738531135db447ad8
BLAKE2b-256 aefb881cc8f47204205267043b5a6e7878ed58a08e570a9adf25fbca23367121

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cc_transcript-0.7.1-cp313-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d7bd42df6a2ddad5d48a505d3f59e106217a2d88e165e52dac46f6502556b81d
MD5 67bee04977757f98c2ff2c801a4c9fd1
BLAKE2b-256 28ecdde12972a87df89864a7459014c2da8e9cf96286fbacaef270f91d1c6f9d

See more details on using hashes here.

Provenance

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