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 guide and 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.4.0.tar.gz (60.1 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.4.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.4.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.4.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.4.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.4.0.tar.gz.

File metadata

  • Download URL: cc_transcript-0.4.0.tar.gz
  • Upload date:
  • Size: 60.1 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.4.0.tar.gz
Algorithm Hash digest
SHA256 429de7fcb2f331f528741cd3f1380edecb76fb6ae2d7ce2050b1393c3920020f
MD5 6d4a7fbc560d1879cab3975da8bef6a5
BLAKE2b-256 e6cb9e964c483bdb2baba26564767b40deb685b64633a41431d4c8b3fff247ac

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cc_transcript-0.4.0-cp313-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 500ee3d88d9eba62303dfe5ba32d26839e2cc8fa4adcb7f7c8b74ed9c17ccf63
MD5 d0663509c5655372550015b4100946ff
BLAKE2b-256 1eae6298edd4109abc2822646d7840868a55ef981d39786ea377a2e9a08a6be5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cc_transcript-0.4.0-cp313-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 52a7e171f8e817cd171843ef02b50a1e877cf7c6e782ad3530e2347c16c3faff
MD5 345c3fae249513c530244bbae7c4d299
BLAKE2b-256 49595386a7c25c36d0abf93afc68596e734075354e3ff47ead8a1dcc49f001d3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cc_transcript-0.4.0-cp313-abi3-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 82bd6bf93a33e5bc809b212dd032ff942b4c7cbcdd9dd39e0287a64ffd1e0afb
MD5 d84535dbaf96ad3fcca13906f59f78d5
BLAKE2b-256 72a47ea80d13b36ad3ca5a42403dbd283832bbf5f69b06bac0a61de9e027e966

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cc_transcript-0.4.0-cp313-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d086d399387e885dbe9a9af8615c871433d42e28359620ee74f2f2a2b5375086
MD5 7b01e37b151e33249da3bd459d609bbc
BLAKE2b-256 db3adb99b683394fe5085a9aa17bc7966e0b264d6a4a6eb511b90394fb7affb3

See more details on using hashes here.

Provenance

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