Skip to content

cayu.memory.interventions

Public Cayu API. Definitions are grouped by their public source module, and definitions from private implementation modules appear on their package’s page; adding a symbol does not move existing links. The import shown at each entry is a supported public namespace. Read the Python API overview and install the required extra.

from cayu.memory import memory_attribution_fingerprint

Return the canonical portable identity of one attribution projection.

memory_attribution_fingerprint(attribution: MemoryAttribution) -> str

Release source · Runtime guarantees · Capability guides

from cayu.memory import memory_intervention_from_json

Parse one bounded record and fail closed on unknown type or schema version.

memory_intervention_from_json(source: str | bytes) -> MemoryInterventionRecord

Release source · Runtime guarantees · Capability guides

from cayu.memory import MEMORY_INTERVENTION_MAX_BYTES
MEMORY_INTERVENTION_MAX_BYTES = 1 << 20

Release source · Runtime guarantees · Capability guides

from cayu.memory import MEMORY_INTERVENTION_MAX_CHANGED_ITEMS
MEMORY_INTERVENTION_MAX_CHANGED_ITEMS = 128

Release source · Runtime guarantees · Capability guides

from cayu.memory import MEMORY_INTERVENTION_MAX_EFFECT_RECEIPTS
MEMORY_INTERVENTION_MAX_EFFECT_RECEIPTS = 128

Release source · Runtime guarantees · Capability guides

from cayu.memory import MEMORY_INTERVENTION_MAX_FIXTURE_BYTES
MEMORY_INTERVENTION_MAX_FIXTURE_BYTES = 16 << 20

Release source · Runtime guarantees · Capability guides

from cayu.memory import MEMORY_INTERVENTION_SCHEMA_VERSION
MEMORY_INTERVENTION_SCHEMA_VERSION = 1

Release source · Runtime guarantees · Capability guides

from cayu.memory import memory_intervention_to_json

Return deterministic compact JSON for one exact intervention record.

memory_intervention_to_json(record: MemoryInterventionRecord) -> str

Release source · Runtime guarantees · Capability guides

from cayu.memory import MemoryInterventionBounds

Precommitted upper bounds for one memory-only intervention.

Bases: _MemoryInterventionModel.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
max_changed_items StrictInt Field(ge=0, le=MEMORY_INTERVENTION_MAX_CHANGED_ITEMS)
max_fixture_bytes StrictInt Field(ge=0, le=MEMORY_INTERVENTION_MAX_FIXTURE_BYTES)
max_effect_receipts StrictInt Field(default=MEMORY_INTERVENTION_MAX_EFFECT_RECEIPTS, ge=1, le=MEMORY_INTERVENTION_MAX_EFFECT_RECEIPTS)
MemoryInterventionBounds.validate_schema_version_literal(value: object) -> object
MemoryInterventionBounds.validate_boolean_literals(value: object, info) -> object

Release source · Runtime guarantees · Capability guides

from cayu.memory import MemoryInterventionChangeKind

Bases: StrEnum.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
OMIT class attribute 'omit'
REPLACE class attribute 'replace'
INJECT_NEGATIVE_CONTROL class attribute 'inject_negative_control'

Release source · Runtime guarantees · Capability guides

from cayu.memory import MemoryInterventionComparability

Memory-specific comparability only; generic experiment dimensions stay external.

Bases: _FingerprintRecord.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
fingerprint StrictStr required
record_type Literal['cayu.memory-intervention-comparability'] 'cayu.memory-intervention-comparability'
schema_version Literal[1] MEMORY_INTERVENTION_SCHEMA_VERSION
baseline MemoryInterventionTrialBinding required
intervention MemoryInterventionTrialBinding required
required_attribution_statuses tuple[MemoryAttributionStatus, ...] (MemoryAttributionStatus.COMPLETE,)
status MemoryInterventionComparabilityStatus required
mismatch_reasons tuple[MemoryInterventionMismatchReason, ...] required
generic_experiment_comparability_required Literal[True] True
evidence_only Literal[True] True
MemoryInterventionComparability.validate_schema_version_literal(value: object) -> object
MemoryInterventionComparability.validate_boolean_literals(value: object, info) -> object
MemoryInterventionComparability.validate_fingerprint(value: str, info) -> str
MemoryInterventionComparability.identity_material() -> dict[str, Any]
MemoryInterventionComparability.validate_record() -> Self
MemoryInterventionComparability.copy_bindings(value: object) -> object
MemoryInterventionComparability.validate_required_statuses(value: object) -> tuple[MemoryAttributionStatus, ...]
MemoryInterventionComparability.validate_mismatch_reasons(value: object) -> tuple[MemoryInterventionMismatchReason, ...]
MemoryInterventionComparability.validate_comparison() -> Self
MemoryInterventionComparability.create(*, baseline: MemoryInterventionTrialBinding, intervention: MemoryInterventionTrialBinding, required_attribution_statuses: tuple[MemoryAttributionStatus, ...]=(MemoryAttributionStatus.COMPLETE,)) -> MemoryInterventionComparability

Release source · Runtime guarantees · Capability guides

from cayu.memory import MemoryInterventionComparabilityStatus

Bases: StrEnum.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
COMPARABLE class attribute 'comparable'
INCOMPARABLE class attribute 'incomparable'

Release source · Runtime guarantees · Capability guides

from cayu.memory import MemoryInterventionEffectReceiptRef

Bounded identity of one application-owned effect receipt.

Bases: _MemoryInterventionModel.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
owner_id StrictStr required
receipt_fingerprint StrictStr required
effect_fingerprint StrictStr required
MemoryInterventionEffectReceiptRef.validate_schema_version_literal(value: object) -> object
MemoryInterventionEffectReceiptRef.validate_boolean_literals(value: object, info) -> object
MemoryInterventionEffectReceiptRef.validate_owner_id(value: str, info) -> str
MemoryInterventionEffectReceiptRef.validate_fingerprints(value: str, info) -> str
MemoryInterventionEffectReceiptRef.sort_key() -> tuple[str, str, str]
MemoryInterventionEffectReceiptRef.receipt_identity_key() -> tuple[str, str]

Release source · Runtime guarantees · Capability guides

from cayu.memory import MemoryInterventionEffectStatus

Bases: StrEnum.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
VERIFIED_NO_CHANGE class attribute 'verified_no_change'
APPLIED class attribute 'applied'
MATCHED_NO_ITEMS class attribute 'matched_no_items'
INDETERMINATE class attribute 'indeterminate'
CONFLICTING class attribute 'conflicting'

Release source · Runtime guarantees · Capability guides

from cayu.memory import MemoryInterventionFixtureRef

Content-addressed evaluation input; never a store location or memory text.

Bases: _MemoryInterventionModel.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
fixture_id StrictStr required
fixture_fingerprint StrictStr required
representation_fingerprint StrictStr required
size_bytes StrictInt Field(ge=0, le=MEMORY_INTERVENTION_MAX_FIXTURE_BYTES)
MemoryInterventionFixtureRef.validate_schema_version_literal(value: object) -> object
MemoryInterventionFixtureRef.validate_boolean_literals(value: object, info) -> object
MemoryInterventionFixtureRef.validate_fixture_id(value: str, info) -> str
MemoryInterventionFixtureRef.validate_fingerprints(value: str, info) -> str

Release source · Runtime guarantees · Capability guides

from cayu.memory import MemoryInterventionItemChange

One bounded omission, replacement, or control-fixture injection.

Bases: _MemoryInterventionModel.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
kind MemoryInterventionChangeKind required
source_item MemoryInterventionItemIdentity | None None
fixture MemoryInterventionFixtureRef | None None
MemoryInterventionItemChange.validate_schema_version_literal(value: object) -> object
MemoryInterventionItemChange.validate_boolean_literals(value: object, info) -> object
MemoryInterventionItemChange.copy_source(value: object) -> object
MemoryInterventionItemChange.copy_fixture(value: object) -> object
MemoryInterventionItemChange.validate_change() -> Self
MemoryInterventionItemChange.sort_key() -> tuple[str, str, str]

Release source · Runtime guarantees · Capability guides

from cayu.memory import MemoryInterventionItemIdentity

One exact revision-bound item identity without retained memory text.

Bases: _MemoryInterventionModel.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
kind MemoryInterventionItemIdentityKind required
revision_fingerprint StrictStr required
alias MemoryEvidenceAlias | None None
item_fingerprint StrictStr | None None
MemoryInterventionItemIdentity.validate_schema_version_literal(value: object) -> object
MemoryInterventionItemIdentity.validate_boolean_literals(value: object, info) -> object
MemoryInterventionItemIdentity.validate_fingerprints(value: str | None, info) -> str | None
MemoryInterventionItemIdentity.copy_alias(value: object) -> object
MemoryInterventionItemIdentity.validate_identity() -> Self
MemoryInterventionItemIdentity.sort_key() -> tuple[str, str, str, str]

Release source · Runtime guarantees · Capability guides

from cayu.memory import MemoryInterventionItemIdentityKind

Bases: StrEnum.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
ALIAS class attribute 'alias'
FINGERPRINT class attribute 'fingerprint'

Release source · Runtime guarantees · Capability guides

from cayu.memory import MemoryInterventionKind

Bases: StrEnum.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
AS_DECLARED class attribute 'as_declared'
AUTOMATIC_RECALL_OFF class attribute 'automatic_recall_off'
OMIT_ITEMS class attribute 'omit_items'
REPLACE_ITEMS class attribute 'replace_items'
NEGATIVE_CONTROL class attribute 'negative_control'

Release source · Runtime guarantees · Capability guides

from cayu.memory import MemoryInterventionMismatchReason

Bases: StrEnum.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
BASELINE_MEMORY_STATE class attribute 'baseline_memory_state'
INTERVENTION_IDENTITY class attribute 'intervention_identity'
RECALL_POLICY class attribute 'recall_policy'
MATERIALIZATION_OVERLAY class attribute 'materialization_overlay'
CHANGED_ITEM_REVISIONS class attribute 'changed_item_revisions'
TRIAL_MODE class attribute 'trial_mode'
REQUIRED_ATTRIBUTION_AVAILABILITY class attribute 'required_attribution_availability'

Release source · Runtime guarantees · Capability guides

from cayu.memory import MemoryInterventionOperation

Precommitment binding one spec to one isolated materialization and trial.

Bases: _FingerprintRecord.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
fingerprint StrictStr required
record_type Literal['cayu.memory-intervention-operation'] 'cayu.memory-intervention-operation'
schema_version Literal[1] MEMORY_INTERVENTION_SCHEMA_VERSION
spec_fingerprint StrictStr required
intervention_kind MemoryInterventionKind required
candidate_id StrictStr required
snapshot_fingerprint StrictStr required
memory_state_fingerprint StrictStr required
materialization_fingerprint StrictStr required
memory_overlay_fingerprint StrictStr required
state_scope_id StrictStr required
trial_state_mode AgentSnapshotTrialStateMode required
trial_binding_fingerprint StrictStr required
case_id StrictStr required
trial_id StrictStr required
MemoryInterventionOperation.validate_schema_version_literal(value: object) -> object
MemoryInterventionOperation.validate_boolean_literals(value: object, info) -> object
MemoryInterventionOperation.validate_fingerprint(value: str, info) -> str
MemoryInterventionOperation.identity_material() -> dict[str, Any]
MemoryInterventionOperation.validate_record() -> Self
MemoryInterventionOperation.validate_fingerprints(value: str, info) -> str
MemoryInterventionOperation.validate_ids(value: str, info) -> str
MemoryInterventionOperation.operation_id() -> str

Stable idempotency identity for the precommitted operation.

MemoryInterventionOperation.create(*, spec: MemoryInterventionSpec, materialization: AgentSnapshotMaterialization, trial: AgentSnapshotTrialBinding) -> MemoryInterventionOperation

Release source · Runtime guarantees · Capability guides

from cayu.memory import MemoryInterventionReceipt

Deterministic evidence of the exact outcome of one precommitted operation.

Bases: _FingerprintRecord.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
fingerprint StrictStr required
record_type Literal['cayu.memory-intervention-receipt'] 'cayu.memory-intervention-receipt'
schema_version Literal[1] MEMORY_INTERVENTION_SCHEMA_VERSION
spec_fingerprint StrictStr required
operation_fingerprint StrictStr required
intervention_kind MemoryInterventionKind required
snapshot_fingerprint StrictStr required
starting_memory_state_fingerprint StrictStr required
materialization_fingerprint StrictStr required
memory_overlay_fingerprint StrictStr required
state_scope_id StrictStr required
status MemoryInterventionEffectStatus required
result_memory_state_fingerprint StrictStr | None None
result_recall_policy_fingerprint StrictStr | None None
matched_item_count StrictInt Field(ge=0, le=MEMORY_INTERVENTION_MAX_CHANGED_ITEMS)
changed_item_revision_fingerprints tuple[StrictStr, ...] Field(default=(), max_length=MEMORY_INTERVENTION_MAX_CHANGED_ITEMS)
effect_fingerprints tuple[StrictStr, ...] Field(default=(), max_length=MEMORY_INTERVENTION_MAX_CHANGED_ITEMS)
application_effect_receipts tuple[MemoryInterventionEffectReceiptRef, ...] Field(default=(), max_length=MEMORY_INTERVENTION_MAX_EFFECT_RECEIPTS)
evidence_only Literal[True] True
production_mutation_allowed Literal[False] False
MemoryInterventionReceipt.validate_schema_version_literal(value: object) -> object
MemoryInterventionReceipt.validate_boolean_literals(value: object, info) -> object
MemoryInterventionReceipt.validate_fingerprint(value: str, info) -> str
MemoryInterventionReceipt.identity_material() -> dict[str, Any]
MemoryInterventionReceipt.validate_record() -> Self
MemoryInterventionReceipt.validate_fingerprints(value: str | None, info) -> str | None
MemoryInterventionReceipt.validate_scope(value: str, info) -> str
MemoryInterventionReceipt.validate_ordered_fingerprints(value: object, info) -> tuple[str, ...]
MemoryInterventionReceipt.copy_effect_receipts(value: object) -> object
MemoryInterventionReceipt.validate_effect() -> Self
MemoryInterventionReceipt.create(*, spec: MemoryInterventionSpec, operation: MemoryInterventionOperation, status: MemoryInterventionEffectStatus, result_memory_state_fingerprint: str | None=None, result_recall_policy_fingerprint: str | None=None, matched_item_count: int=0, changed_item_revision_fingerprints: Iterable[str]=(), effect_fingerprints: Iterable[str]=(), application_effect_receipts: Iterable[MemoryInterventionEffectReceiptRef]=()) -> MemoryInterventionReceipt

Release source · Runtime guarantees · Capability guides

from cayu.memory import MemoryInterventionRecord
MemoryInterventionRecord: TypeAlias = MemoryInterventionSpec | MemoryInterventionOperation | MemoryInterventionReceipt | MemoryInterventionTrialBinding | MemoryInterventionComparability

Release source · Runtime guarantees · Capability guides

from cayu.memory import MemoryInterventionSpec

Immutable declaration of one fixed intervention over a snapshot memory frontier.

Bases: _FingerprintRecord.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
fingerprint StrictStr required
record_type Literal['cayu.memory-intervention-spec'] 'cayu.memory-intervention-spec'
schema_version Literal[1] MEMORY_INTERVENTION_SCHEMA_VERSION
spec_id StrictStr required
snapshot_fingerprint StrictStr required
memory_state_fingerprint StrictStr required
execution_profile_fingerprint StrictStr required
recall_policy_ref_fingerprint StrictStr required
starting_recall_policy_fingerprint StrictStr required
trial_recall_policy_fingerprint StrictStr required
starting_recall_mode AutomaticRecallMode required
trial_recall_mode AutomaticRecallMode required
trial_state_mode AgentSnapshotTrialStateMode required
authority_scope_fingerprint StrictStr required
kind MemoryInterventionKind required
bounds MemoryInterventionBounds required
changes tuple[MemoryInterventionItemChange, ...] Field(default=(), max_length=MEMORY_INTERVENTION_MAX_CHANGED_ITEMS)
negative_control_kind MemoryNegativeControlKind | None None
proposer_fingerprint StrictStr | None None
source_fingerprint StrictStr | None None
reason StrictStr | None Field(default=None, max_length=_MAX_REASON_CHARS)
evidence_only Literal[True] True
production_mutation_allowed Literal[False] False
MemoryInterventionSpec.validate_schema_version_literal(value: object) -> object
MemoryInterventionSpec.validate_boolean_literals(value: object, info) -> object
MemoryInterventionSpec.validate_fingerprint(value: str, info) -> str
MemoryInterventionSpec.identity_material() -> dict[str, Any]
MemoryInterventionSpec.validate_record() -> Self
MemoryInterventionSpec.validate_spec_id(value: str, info) -> str
MemoryInterventionSpec.validate_fingerprints(value: str | None, info) -> str | None
MemoryInterventionSpec.validate_reason(value: str | None, info) -> str | None
MemoryInterventionSpec.copy_bounds(value: object) -> object
MemoryInterventionSpec.copy_changes(value: object) -> object
MemoryInterventionSpec.validate_intervention() -> Self
MemoryInterventionSpec.create(*, spec_id: str, snapshot: AgentSnapshot, starting_recall_policy: AutomaticRecallPolicy, trial_recall_policy: AutomaticRecallPolicy, trial_state_mode: AgentSnapshotTrialStateMode, kind: MemoryInterventionKind, bounds: MemoryInterventionBounds, changes: Sequence[MemoryInterventionItemChange]=(), negative_control_kind: MemoryNegativeControlKind | None=None, proposer_fingerprint: str | None=None, source_fingerprint: str | None=None, reason: str | None=None) -> MemoryInterventionSpec

Release source · Runtime guarantees · Capability guides

from cayu.memory import MemoryInterventionTrialBinding

Bind one intervention effect to Cayu trial, result, and attribution records.

Bases: _FingerprintRecord.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
fingerprint StrictStr required
record_type Literal['cayu.memory-intervention-trial'] 'cayu.memory-intervention-trial'
schema_version Literal[1] MEMORY_INTERVENTION_SCHEMA_VERSION
spec MemoryInterventionSpec required
operation MemoryInterventionOperation required
receipt MemoryInterventionReceipt required
trial AgentSnapshotTrialBinding required
result AgentSnapshotResultBinding required
terminal_evidence_available StrictBool False
expected_receipt_count StrictInt | None Field(default=None, ge=0)
expected_exposure_count StrictInt | None Field(default=None, ge=0)
attribution MemoryAttribution required
attribution_fingerprint StrictStr required
MemoryInterventionTrialBinding.validate_schema_version_literal(value: object) -> object
MemoryInterventionTrialBinding.validate_boolean_literals(value: object, info) -> object
MemoryInterventionTrialBinding.validate_fingerprint(value: str, info) -> str
MemoryInterventionTrialBinding.identity_material() -> dict[str, Any]
MemoryInterventionTrialBinding.validate_record() -> Self
MemoryInterventionTrialBinding.copy_spec(value: object) -> object
MemoryInterventionTrialBinding.copy_operation(value: object) -> object
MemoryInterventionTrialBinding.copy_receipt(value: object) -> object
MemoryInterventionTrialBinding.copy_trial(value: object) -> object
MemoryInterventionTrialBinding.copy_result(value: object) -> object
MemoryInterventionTrialBinding.copy_attribution(value: object) -> object
MemoryInterventionTrialBinding.validate_attribution_fingerprint(value: str, info) -> str
MemoryInterventionTrialBinding.validate_lineage() -> Self
MemoryInterventionTrialBinding.proves_no_memory_exposure() -> bool

Whether complete attribution proves that this trial exposed no memory.

MemoryInterventionTrialBinding.create(*, spec: MemoryInterventionSpec, operation: MemoryInterventionOperation, receipt: MemoryInterventionReceipt, trial: AgentSnapshotTrialBinding, result: AgentSnapshotResultBinding, attribution: MemoryAttribution, terminal_evidence_available: bool=False, expected_receipt_count: int | None=None, expected_exposure_count: int | None=None) -> MemoryInterventionTrialBinding

Release source · Runtime guarantees · Capability guides

from cayu.memory import MemoryNegativeControlKind

Bases: StrEnum.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
IRRELEVANT class attribute 'irrelevant'
STALE class attribute 'stale'
CONFLICTING class attribute 'conflicting'
ADVERSARIAL class attribute 'adversarial'

Release source · Runtime guarantees · Capability guides