Skip to content

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.

Source module-attribute

Source = tuple[str, str, str, str, str]

MAX_PACKET_BYTES module-attribute

MAX_PACKET_BYTES = 1048576

MAX_SOURCE_BYTES module-attribute

MAX_SOURCE_BYTES = 4194304

MAX_GROUPS module-attribute

MAX_GROUPS = 4096

MAX_OCCURRENCES module-attribute

MAX_OCCURRENCES = 65536

MAX_CANDIDATES module-attribute

MAX_CANDIDATES = 64

EvidenceSelection dataclass

selected instance-attribute

selected: tuple[int, ...]

packet instance-attribute

packet: str

packet_bytes instance-attribute

packet_bytes: int

__init__

__init__(selected: tuple[int, ...], packet: str, packet_bytes: int) -> None

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.