mixle.evolve.ledger module

The evolution ledger: an in-memory, JSON-serializable record of every improvement attempt.

The library layer does no I/O, so the ledger is just an in-process list of rows – one per proposed challenger – that an orchestrator can persist (e.g. into a registry version’s metadata). Each row is a plain dict so it round-trips through json.dumps without custom encoders: the model objects themselves are never stored, only their operator, measured delta, verdict, cost, and parent hash.

class EvolutionLedger(rows=<factory>)[source]

Bases: object

An ordered, JSON-serializable log of improvement attempts.

Parameters:

rows (list[dict[str, Any]])

rows: list[dict[str, Any]]
record(*, operator, delta, verdict, cost, parent_hash, meta=None)[source]

Append one attempt row and return it.

Parameters:
Return type:

dict[str, Any]

to_json(**dumps_kwargs)[source]

Serialize the full ledger to a JSON string (rows are already plain dicts).

Parameters:

dumps_kwargs (Any)

Return type:

str