Expand description
Plan B t-004: shared conclusion-export pipeline used by both the CLI
(asd conclusions export) and MCP (conclusions_export tool).
Walks every indexed symbol, collects ledger entries, buckets them by
ConclusionClass, and writes one compact, byte-stable JSONL file per
class. The output is intentionally minimal — see DESIGN.md “Plan B” for
the field layout and rationale.
Structs§
- Budget
Report - Result of
check_budget.okis true iff neither the total nor any individual shard exceeds its configured cap. - Export
Record - Compact JSONL record.
preserve_orderis on for serde_json in this workspace so field order is stable across runs. Plan B t-005 requires Deserialize too so import can round-trip. - Gathered
- Walk the index, bucket every ledger entry by
ConclusionClass. Each bucket is sorted byidalone — entry_ids are deterministic hashes (blake3-derived for Plan G thinking, content-derived for others), so id-sort gives: - Import
File Result - Outcome of importing one JSONL file.
- Shard
Size - One shard file’s size measurement against the per-shard budget.
Functions§
- check_
budget - Plan K t-008: walk
out_dir, sum sizes per shard file (including per-package subdirectory shards from t-007), and compare against the budget config. Pure read of the filesystem — does not re-export. - export_
all - One-shot: gather + write all six files under
out_dir. Returns per-class (stem, entry_count, byte_count). - gather
- gather_
buckets - Back-compat wrapper: the buckets alone.
- import_
all - One-shot: read every
<class>.jsonlunderin_dirand upsert each record into the local ledger keyed by entry_id. Idempotent — re-import of unchanged JSONL is a no-op at the bytes level (set_json overwrites with identical content). - merge_
jsonl - Git merge driver for
.asd/conclusions/*.jsonl. - merge_
preserving - Fold the records already committed at
pathback into a freshly gathered bucket, so the sidecar is additive rather than a snapshot of one clone. - read_
jsonl - Read a conclusions JSONL file into records. A missing file is treated as empty (an add/add merge can hand us a nonexistent ancestor). Blank lines are skipped; a malformed line is a hard error so the driver falls back to a plain git conflict rather than silently dropping judgment.
- write_
jsonl - Write one JSONL file. Returns the byte count written.