Evidence packets¶
Encode, decode and complete the evidence packets that carry sources with an answer.
evidence ¶
Lossless, bounded source packets for memory evidence.
Packets preserve complete source text, roles, observation times and occurrence order. They assert no answer or temporal inference. IDs are lowercase SHA-256 handles, encoded as base64url without padding in the packet.
EvidenceSelection dataclass ¶
encode_source_packet ¶
encode_source_packet(groups: Sequence[Sequence[Source]]) -> str
Serialize complete observations, factoring shared text and session metadata.
decode_source_packet ¶
decode_source_packet(packet: str) -> list[list[Source]]
Validate and reconstruct each original observation without interpretation.
complete_evidence ¶
complete_evidence(candidates: Sequence[Sequence[Source]], selected: Sequence[int], budget_bytes: int) -> EvidenceSelection
Retain a source selection and append ranked complete groups within its byte cap.
Candidate order is the caller's retrieval order. Existing selected groups remain mandatory; a budget that cannot contain them fails explicitly.