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

cc-transcript banner

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.8.0.tar.gz (82.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.8.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.8.0-cp313-abi3-manylinux_2_28_aarch64.whl (2.3 MB view details)

Uploaded CPython 3.13+manylinux: glibc 2.28+ ARM64

cc_transcript-0.8.0-cp313-abi3-macosx_11_0_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.13+macOS 11.0+ x86-64

cc_transcript-0.8.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.8.0.tar.gz.

File metadata

  • Download URL: cc_transcript-0.8.0.tar.gz
  • Upload date:
  • Size: 82.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.8.0.tar.gz
Algorithm Hash digest
SHA256 711957e76cb21ad2752dda22e22511098a36393a658faef4bb8aac6dc4e8f055
MD5 a652f6487d31b9714a2dfeed90e0d07c
BLAKE2b-256 bf0dd77470f959c9119522c4944f9f986d684457ae3bd23dacf46555e17c6e9b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cc_transcript-0.8.0-cp313-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e737ef2b0e426255352b42445edec243e37e88890d3fd718eec2c4dac1972a7f
MD5 c4f125b49b53e02fc12326f9e05795b7
BLAKE2b-256 e12ebbc143830089ee0f8904480fb5168ce8d1a23f779e9375b545bdb6bf1ed5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cc_transcript-0.8.0-cp313-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 dee8c945ba3fe405de9e47f1192db25ae343d5c19727a6a5e39500d4753df376
MD5 8644f984c1dfab7b9e06ee0d04530ea5
BLAKE2b-256 61c389d46bc857432eb064dd37d9001d8a4074e92eebd4ffec2d0be52093ce11

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cc_transcript-0.8.0-cp313-abi3-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 e6f62188fcda6a5d1ff17f4f3b3635723b09bf8b3e6b297e56a62e585b43f3ad
MD5 1b7df7ddf75272ce52a5de390a377013
BLAKE2b-256 2f48901cbfc248a60c8c2d61dc0e4f06c572aab106fc720b05cfb408c0914687

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cc_transcript-0.8.0-cp313-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 59b8ddafc2b5f1eb32190cfd437bea2ea57e44f316fe7801fb40a1906c1df1ad
MD5 6099145fdce3376fbf1e0a6ec0b92156
BLAKE2b-256 b0437bef5ff6f87861da92ea30d35c23a7adf1c3ce854ef0854dc0a0f27f5ceb

See more details on using hashes here.

Provenance

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