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.6.0.tar.gz (62.4 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.6.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.6.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.6.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.6.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.6.0.tar.gz.

File metadata

  • Download URL: cc_transcript-0.6.0.tar.gz
  • Upload date:
  • Size: 62.4 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.6.0.tar.gz
Algorithm Hash digest
SHA256 2ef841ddce5e4870eb3791988bf9e47c5cf379ac8e0e1442d13f91a9bbdc8ae2
MD5 10826d0610cbac9b9586ada2aebb75ec
BLAKE2b-256 9dbb52848209ef1341c31f83450cdb33016e373f276b97237948867fed68856e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cc_transcript-0.6.0-cp313-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0c865ad82bdaa90e11c3ece40f78969a5af0829d526241cb05517c60694ed4f2
MD5 c271c312011e6bf8def21c674974c67c
BLAKE2b-256 00f572040b890f9b6c3fecf499f7f3621b7f992e7c9ec5aa5c48bd77cd822f19

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cc_transcript-0.6.0-cp313-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 8ab2c0ab483bc07600e66b178a22860b1552636de0b2cf1e65ff903320e8d7f0
MD5 676b5213ceaf5927b91ed006756dd6fd
BLAKE2b-256 0f46c5f046aa218366f7512d56cb997c5b00ddbf027e2a44eef6c9b97bb319b9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cc_transcript-0.6.0-cp313-abi3-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 03664f2bad6256f771d5d41eedf055069f0a1ced6198859a017440555cf6600a
MD5 caab522a77c5ae159c1b432f0c7bb866
BLAKE2b-256 b2e44ae4492a6de1db3aa64a5e2e03f66b231fb4e02ee001cd86e693fa1d7acb

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cc_transcript-0.6.0-cp313-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7ba269ac6a5afd396d961a906e2c00083baca1ccc94704988294b51d803651b3
MD5 7964d55ae47cfb0f48d78453f42d87d6
BLAKE2b-256 1dfb3ee6f2d12476959246e57c7132f91ca3d5bd746fa5ae2c64ba5963e00069

See more details on using hashes here.

Provenance

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