ProposalProvenanceReader

Helpers & Utilities · AiDotNet.Evolution.Programs.Provenance

Reads a recorded provenance stream back and rebuilds the ancestry it describes.

For Beginners

Point Read at the folder your provenance sink wrote to and you get the notes back. Pass those to BuildLineages and you get, for each program the search finished with, the whole story of how it got there — which program it started from, and each AI conversation that improved it along the way, in order.

How It Works

This is the post-hoc half of provenance. Read loads a stream — one JSON Lines file or a whole directory of segments — tolerating a truncated tail rather than refusing the run’s entire history over its last partial line. BuildLineages then turns the flat record stream into the chains of accepted edits that produced each final program, oldest first, with the prompt and answer that caused every step attached to it.

The reconstruction needs no engine, no archive, and no checkpoint: everything it uses is in the stream. That is the point. Months after a run, from a directory of files, it answers “which conversations produced this program, in what order, at what cost”, which is what a post-hoc audit needs and what turns a finished search into a set of training trajectories.

Records are untrusted input by construction — the text they carry came from a language model and from program output — so nothing read here is executed, expanded, or used to build a path, and every field was bounded and redacted before it was written and is bounded again on the way back in. A stream that names a parent as its own ancestor cannot make the walk loop: visited identities are tracked and a repeat ends the chain.

Methods

Method Summary
IReadOnlyList<ProposalProvenanceLineage> BuildLineages(IReadOnlyList<ProposalProvenanceRecord> records) Rebuilds the ancestry chains described by a provenance stream.
ProposalProvenanceLineage BuildLineage(string genomeId, IReadOnlyList<ProposalProvenanceRecord> records) Rebuilds the ancestry chain of one program from a provenance stream.
ProposalProvenanceReadResult Read(string path, long maxTotalBytes) Reads a provenance stream from a JSON Lines file or a directory of segment files.
ProposalProvenanceRecord TryParse(string line) Parses one JSON Lines record, returning null when the line is not a usable record.

Fields

Field Summary
long DefaultMaxTotalBytes The default ceiling on how many bytes one read will consume.