Skip to main content

CreateMemory

Struct CreateMemory 

Source
pub struct CreateMemory {
Show 22 fields pub tier: Tier, pub namespace: String, pub title: String, pub content: String, pub tags: Vec<String>, pub priority: i32, pub confidence: Option<f64>, pub source: String, pub expires_at: Option<String>, pub ttl_secs: Option<i64>, pub metadata: Value, pub agent_id: Option<String>, pub scope: Option<String>, pub on_conflict: Option<String>, pub detect_conflicts: Option<bool>, pub force: bool, pub citations: Vec<Citation>, pub source_uri: Option<String>, pub source_span: Option<SourceSpan>, pub kind: Option<String>, pub signature: Option<String>, pub created_at: Option<String>,
}

Fields§

§tier: Tier§namespace: String§title: String§content: String§tags: Vec<String>§priority: i32§confidence: Option<f64>

Confidence 0.0–1.0. None (caller omitted the field) resolves to DEFAULT_CONFIDENCE with truthful confidence_source = "default" provenance (#1591) via CreateMemory::resolved_confidence / CreateMemory::resolved_confidence_source.

§source: String§expires_at: Option<String>§ttl_secs: Option<i64>§metadata: Value§agent_id: Option<String>

Optional agent identifier. When unset, the server resolves a default via crate::identity (NHI-hardened precedence chain).

§scope: Option<String>

Optional visibility scope (Task 1.5). One of VALID_SCOPES. When unset, treated as private by the query layer.

§on_conflict: Option<String>

v0.6.3.1 P2 (G6) — collision policy when (title, namespace) already exists. One of error | merge | version. When unset, the daemon defaults to error for HTTP callers (HTTP is not legacy like MCP v1; clients that want the legacy silent-merge contract must opt in explicitly).

§detect_conflicts: Option<bool>

v0.7.0 (issue #519) — when Some(true), run a proactive detect_contradiction LLM probe against same-namespace memories BEFORE returning 201, regardless of autonomous_hooks. When Some(false), force-disable detection even if autonomous_hooks is on. When None, defer to autonomous_hooks.

Surface: the 201 response body grows a conflicts: [{...}] array listing every same-namespace candidate the LLM flags as contradictory. Each entry carries the candidate id, title, and (when LLM produces one) a suggested_merge content string the caller can pass to a follow-up memory_consolidate.

§force: bool

v0.7.0 (issue #519) — proactive contradiction detection bypass. When true, the substrate-level proactive_conflict_check is skipped on this write so a near-duplicate-with-differing-content row is inserted anyway. Default false preserves the new v0.7.0 refuse-by-default posture; callers that explicitly want the conflicting fact to land alongside the existing one set force=true.

§citations: Vec<Citation>

v0.7.0 Form 4 (issue #757) — fact-provenance citations supplied at write time. Each entry must satisfy validate::validate_citation. Empty by default.

§source_uri: Option<String>

v0.7.0 Form 4 — optional URI-form pointer to the cited source body. Must satisfy validate::validate_source_uri when set.

§source_span: Option<SourceSpan>

v0.7.0 Form 4 — optional byte-range into the parent source body. Must satisfy validate::validate_source_span when set.

§kind: Option<String>

v0.7.x Form 6 (#1385) — Batman-taxonomy memory-kind selector for the new row. Accepts any MemoryKind wire token (observation | reflection | persona | concept | entity | claim | relation | event | conversation | decision). Unknown values are silently ignored (treated as omission) for forward-compat with future variants, mirroring the MCP memory_store params["kind"] contract at src/mcp/tools/store/validation.rs:207-213. Absent / unknown → handler defaults to MemoryKind::Observation. Stored as Option<String> (not Option<MemoryKind>) so unknown future tokens deserialise without breaking the request envelope.

Pre-#1385 this field did not exist on CreateMemory, so HTTP POST /api/v1/memories silently dropped the caller’s kind and every HTTP-created row landed as Observation. The Form 6 recall kinds filter then returned zero rows against HTTP- written data even when the caller had stored kind: "claim" (the v3 NHI assessment defect D-v3-3 reproducible against the alice lan-parity postgres-backed daemon).

§signature: Option<String>

#626 Layer-3 (C7) — detached Ed25519 agent-attestation signature, standard base64, over the SignableWrite envelope (agent_id + namespace + title + kind + created_at + sha256(content)). When present, created_at MUST also be supplied (the signer cannot predict the server clock); a signature that fails to verify against the agent’s bound public key is rejected with 403. Absent ⇒ legacy unsigned write unless the operator set AI_MEMORY_REQUIRE_AGENT_ATTESTATION, in which case the gate rejects the unsigned store.

§created_at: Option<String>

#626 Layer-3 (C7) — RFC3339 timestamp the caller signed. Required when signature is present; the server validates it against the ±300s attestation freshness window and then adopts it verbatim so the verifier re-derives the identical signed envelope.

Implementations§

Source§

impl CreateMemory

Source

pub fn resolved_confidence(&self) -> f64

#1591 — effective confidence for this request: the caller’s explicit value, else the compiled DEFAULT_CONFIDENCE.

Source

pub fn resolved_confidence_source(&self) -> ConfidenceSource

#1591 — truthful confidence provenance for this request: ConfidenceSource::CallerProvided only when the caller actually sent a confidence value; ConfidenceSource::Default when the compiled fallback was stamped.

Trait Implementations§

Source§

impl Debug for CreateMemory

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for CreateMemory

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more