Parser and v3.0 trim-aware validator for CLM (Claude Memory Format)
Project description
tunc-clm (Python)
Parser and v3.0 trim-aware validator for the Claude Memory Format. Pure Python, no runtime dependencies, type-hinted.
pip install tunc-clm
from clm import Document, validate_v3, validate_v3_with_filesystem
doc = Document.parse(open("MANIFESTO.clm").read())
assert str(doc) == open("MANIFESTO.clm").read() # round-trip byte-identical
report = validate_v3(doc)
print(f"{len(report.errors)} errors, {len(report.warnings)} warnings")
# Filesystem-aware variant cross-checks the sibling archive
report = validate_v3_with_filesystem(doc, base_dir=".")
CLI
clm validate path/to/file.clm
What it validates
Per SPEC.clm validation.posture.v3.0:
- Header declarations:
trim.mode,trim.config,archive.mode,archive.path - Trim-config grammar: keys / duplicates / missing values / unknown keys
- Lifecycle states A/B/C; declared offload via
(last X of Y archived)form - Sentinel placement (BEFORE entries, not after)
- Per-entry shape (
ROLL.CALLneeds· YYYY-MM-DD ·;DREAM.LOGneeds| YYYY-MM-DD |); malformed quarantined - Cross-doc sentinel symmetry (live ↔ archive)
- Archive structural check (must contain trim ARCHIVE sections, not just any file)
- Filesystem-aware variant (state.B → warning, state.C → error)
- Chained archive validation (warnings propagate from archive into live report)
Mirror of the Rust reference
This package is a port of clm-rs. The two implementations validate the same set of behaviors against the same canonical artifacts (MANIFESTO.clm, SPEC.clm, the experiments/v3/ bench docs).
Known limitations (v0.1, parity with clm-rs)
Three follow-ups documented in experiments/v3/RESULTS.md apply equally to this implementation:
[DECISIONS.ARCHIVE]cross-doc sentinel check is missing (symmetric gap to[ROLL.CALL.ARCHIVE]/[DREAM.LOG.ARCHIVE]).- Malformed lines in
decisions.livearen't quarantined (counted toward overflow). - Generator (
experiments/v3/gen_50_session.py) emits nonsense metadata for depths ≤ 5.
These will be fixed across all three implementations together.
License
MIT.
Audit thread
CLM is an append-only audit-thread format. The thread for MANIFESTO.clm and SPEC.clm is at https://github.com/TUNC-AI/tunc-clm — read it like any CLM file: open, sign, append.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tunc_clm-0.1.0.tar.gz.
File metadata
- Download URL: tunc_clm-0.1.0.tar.gz
- Upload date:
- Size: 16.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
911df942889b78ef0cfc006a8bb802256b7dbd7ddb1d20b3f313a7c117cf6615
|
|
| MD5 |
a69f3937af315812ff432861b76ab067
|
|
| BLAKE2b-256 |
59c72b128eadd9758084903eaf2c97dbaee4462cf5817ab2acb20a6372b9190c
|
File details
Details for the file tunc_clm-0.1.0-py3-none-any.whl.
File metadata
- Download URL: tunc_clm-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe545e24fad6d06e3fbf58a81ae1e99cf5687ac749aa37ae8492bfbe38518e81
|
|
| MD5 |
0dca9ff619b3129459e82db59ffb8ab2
|
|
| BLAKE2b-256 |
6117a0694b5a35be9a5ec07cfbac9bf0d85c25a2bca02acc1a63a0944d24ceb9
|