Expand description
§tokmd-types
Tier 0 (Core Types)
This crate defines the core data structures and contracts for tokmd.
It contains only data types, Serde definitions, and schema_version.
§Stability Policy
JSON-first stability: The primary contract is the JSON schema, not Rust struct literals.
- JSON consumers: Stable. New fields have sensible defaults; removed/renamed fields
bump
SCHEMA_VERSION. - Rust library consumers: Semi-stable. New fields may be added in minor versions,
which can break struct literal construction. Use
Default+ field mutation or..Default::default()patterns for forward compatibility.
If you need strict Rust API stability, pin to an exact version.
§What belongs here
- Pure data structs (Receipts, Rows, Reports)
- Serialization/Deserialization logic
- Stability markers (SCHEMA_VERSION)
§What does NOT belong here
- File I/O
- CLI argument parsing
- Complex business logic
- Tokei dependencies
Modules§
- cockpit
- Cockpit receipt types for PR metrics and evidence gates.
Structs§
- Artifact
Entry - Entry describing an artifact in the handoff bundle.
- Artifact
Hash - Hash for artifact integrity.
- Capability
Status - Status of a detected capability.
- Context
Bundle Manifest - Manifest for a context bundle directory (bundle.txt + receipt.json + manifest.json).
- Context
Excluded Path - Explicitly excluded path with reason for context bundles.
- Context
File Row - Context
LogRecord - Log record for context command JSONL append mode. Contains metadata only (not file contents) for lightweight logging.
- Context
Receipt - Diff
Receipt - JSON receipt for diff output with envelope metadata.
- DiffRow
- A row in the diff output showing changes for a single language.
- Diff
Totals - Aggregate totals for the diff.
- Export
Args - Export
Args Meta - Export
Data - Export
Receipt - FileRow
- Handoff
Complexity - Simplified complexity report for handoff intelligence.
- Handoff
Derived - Simplified derived metrics for handoff intelligence.
- Handoff
Excluded Path - Explicitly excluded path with reason.
- Handoff
Hotspot - Simplified hotspot row for handoff intelligence.
- Handoff
Intelligence - Intelligence bundle for handoff containing tree, hotspots, complexity, and derived metrics.
- Handoff
Manifest - Manifest for a handoff bundle containing LLM-ready artifacts.
- Lang
Args - Lang
Args Meta - Lang
Receipt - Lang
Report - LangRow
- Module
Args - Module
Args Meta - Module
Receipt - Module
Report - Module
Row - Policy
Excluded File - A file excluded by per-file cap / classification policy.
- RunReceipt
- Scan
Args - Smart
Excluded File - A file excluded by smart-exclude heuristics (lockfiles, minified, etc.).
- Token
Audit - Post-write audit comparing actual output to estimates.
- Token
Estimation Meta - Metadata about how token estimates were produced.
- Tool
Info - Totals
- A small totals struct shared by summary outputs.
Enums§
- Analysis
Format - Capability
State - State of a capability: available, skipped, or unavailable.
- Child
Include Mode - Children
Mode - Commit
Intent Kind - Classification of a commit’s intent, derived from subject line.
- Config
Mode - Export
Format - File
Classification - Classification of a file for bundle hygiene purposes.
- File
Kind - Inclusion
Policy - How a file is included in the context/handoff bundle.
- Redact
Mode - Scan
Status - Table
Format
Constants§
- CONTEXT_
BUNDLE_ SCHEMA_ VERSION - Schema version for context bundle manifests.
- CONTEXT_
SCHEMA_ VERSION - Schema version for context receipts (separate from SCHEMA_VERSION used by lang/module/export/diff).
- HANDOFF_
SCHEMA_ VERSION - Schema version for handoff receipts.
- SCHEMA_
VERSION - The current schema version for all receipt types.