What it checks
Root file surface
Compares the 18 expected root-level Python files against what is actually present in
src/. Each .ts → .py mapping is defined in ARCHIVE_ROOT_FILES.Top-level subsystems
Checks that the 30 expected top-level directory/module names listed in
ARCHIVE_DIR_MAPPINGS exist in src/.Command inventory
Counts entries in
reference_data/commands_snapshot.json and compares against reference_data/archive_surface_snapshot.json’s command_entry_count.Tool inventory
Counts entries in
reference_data/tools_snapshot.json and compares against archive_surface_snapshot.json’s tool_entry_count.src/ and compares that against the archived TypeScript-like file count stored in archive_surface_snapshot.json.
Running the audit
When the archive is absent
The TypeScript archive (archive/claude_code_ts_snapshot/) is locally ignored and not tracked in the repository. If the directory does not exist, the audit reports this and exits cleanly without error:
The
archive_present field in ParityAuditResult controls which output branch is taken. All coverage metrics still derive from the committed reference data files (reference_data/*.json), so command and tool ratios are always available even without the live archive tree.How port_manifest.py drives the analysis
build_port_manifest() walks src/ and builds a PortManifest that enumerates every Python file and groups them into top-level modules. The parity audit uses CURRENT_ROOT (the src/ directory) directly rather than the manifest, but both share the same source of truth.
The three reference data files consumed by the audit are:
| File | Contents |
|---|---|
src/reference_data/archive_surface_snapshot.json | Top-level counts: total_ts_like_files, command_entry_count, tool_entry_count |
src/reference_data/commands_snapshot.json | Array of mirrored command entries |
src/reference_data/tools_snapshot.json | Array of mirrored tool entries |
Interpreting the output
Root file coverage
Root file coverage
The audit maps each TypeScript root file to its expected Python equivalent (e.g.
QueryEngine.ts → QueryEngine.py). A hit means the file exists anywhere in src/; it does not validate the file’s contents or completeness.Current checkpoint: The Python port mirrors the full root-entry file surface. Missing entries appear in the Missing root targets section.Directory coverage
Directory coverage
Top-level TypeScript subdirectories (e.g.
assistant/, bootstrap/, cli/) are mapped to their Python equivalents. Some map to a single .py file rather than a directory (e.g. commands/ → commands.py).Current checkpoint: Top-level subsystem names are mirrored. Gaps appear in Missing directory targets.Command and tool inventory
Command and tool inventory
Command and tool coverage compares snapshot entry counts. A ratio of
87/87 means every command entry from the TypeScript snapshot has a corresponding Python entry.Current checkpoint: Command and tool inventories are at parity with the archived snapshot.Total file ratio
Total file ratio
This is the broadest gap metric. The Python port has far fewer total files than the archived TypeScript source because the port has not yet replicated every runtime execution slice.Current checkpoint: The port has fewer executable runtime slices than the archived source. This ratio is expected to improve as more subsystems are ported.
ParityAuditResult dataclass
result.to_markdown() to get the formatted report string.