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-1.0.0

The shared transcript-parsing core extracted from cc-sentiment, now powering cc-pushback, cc-sentiment, and captain-hook. It parses Claude Code's on-disk JSONL transcripts into a typed superset event model — every entry type preserved, nothing dropped — so each consumer applies its own semantic filtering on top of one faithful representation.

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 the consumer, not buried in the parser.

Install

uv add cc-transcript

Quickstart

Discover the transcripts on disk, parse one, and look at the events:

from cc_transcript import TranscriptDiscovery, parse_events, AssistantEvent, UserEvent

path, _mtime = TranscriptDiscovery.find_in(TranscriptDiscovery.find_transcripts()[0].parent)[0]
events = parse_events(path)

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])

Apply cc-sentiment's filtering rules to drop sidechains, synthetic turns, and junk:

from cc_transcript import apply_filters, SENTIMENT_FILTER

clean = list(apply_filters(events, SENTIMENT_FILTER))

What problems does this solve?

  • One faithful parse, many consumers. Every project that reads 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 FilterConfig.
  • Incremental ingestion. FileStateStore tracks per-file mtimes in SQLite (WAL, thread-safe) so re-runs only reparse changed files, and consumers compose their own writes in the same transaction.
  • Pluggable backends. A pure-Python reference parser ships today; a Rust backend behind the same Backend protocol reaches parity in a later release.

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.1.0.tar.gz (22.7 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.1.0-cp313-abi3-manylinux_2_28_x86_64.whl (471.4 kB view details)

Uploaded CPython 3.13+manylinux: glibc 2.28+ x86-64

cc_transcript-0.1.0-cp313-abi3-manylinux_2_28_aarch64.whl (445.3 kB view details)

Uploaded CPython 3.13+manylinux: glibc 2.28+ ARM64

cc_transcript-0.1.0-cp313-abi3-macosx_11_0_x86_64.whl (434.0 kB view details)

Uploaded CPython 3.13+macOS 11.0+ x86-64

cc_transcript-0.1.0-cp313-abi3-macosx_11_0_arm64.whl (407.2 kB view details)

Uploaded CPython 3.13+macOS 11.0+ ARM64

File details

Details for the file cc_transcript-0.1.0.tar.gz.

File metadata

  • Download URL: cc_transcript-0.1.0.tar.gz
  • Upload date:
  • Size: 22.7 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.1.0.tar.gz
Algorithm Hash digest
SHA256 1601c7a8ecf67d5f47ebb4421418664a86db5903a85d83ba3d0d94b79748e389
MD5 ad400cbc486a8b534f5a843d8eb03bb8
BLAKE2b-256 afc2d0fa6bc0ddd25051b1615cccb6347fa6cb2f46e2eba0fb1014d23960cc97

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cc_transcript-0.1.0-cp313-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7ad7c272859dc23dbe7a9fa6799dfc7c768d6d695202fdcc0ab0c7237bb2e3d0
MD5 7fd49d0de9e0b3d3ad0e4739779172f9
BLAKE2b-256 d00be35edadcf982d7ce6839a0b200b19f9c998e70726b5c99764a643e5410b2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cc_transcript-0.1.0-cp313-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 dcc52adf540577ea5ad0cfd872215253728b50179f8bbba6ac2e0cd8e7cb4524
MD5 cbd9270cba9f2723d19ddef138d72c7e
BLAKE2b-256 796d7932ea30861e4477451a8df9f1c0b7d89fdf9ea0369730207b974c6808d7

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cc_transcript-0.1.0-cp313-abi3-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 e22c7a326e5910bef1348bed6bcf3f70c234b164d156e737260322fd162179c4
MD5 752bca92ec5cd79eededd07925657028
BLAKE2b-256 bd030a2ecfa7b565ca7d37c68630a163942b2104b2a05ad0a1ac4be52fa27826

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for cc_transcript-0.1.0-cp313-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 86893a0a2bc3215b80b3210df0ae1f77ad47911c1da9a1990e4224edfbd2f3b1
MD5 ea9352c98dc3e4e68931bebd6bc109cb
BLAKE2b-256 ad929bfafe4263d1bbd7f70c4f5e1defdabe8aca44043ce0915449b3bd74b4bf

See more details on using hashes here.

Provenance

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