pub struct Experience {Show 15 fields
pub id: ExperienceId,
pub collective_id: CollectiveId,
pub content: String,
pub embedding: Vec<f32>,
pub experience_type: ExperienceType,
pub importance: f32,
pub confidence: f32,
pub applications: BTreeMap<InstanceId, u32>,
pub domain: Vec<String>,
pub related_files: Vec<String>,
pub source_agent: AgentId,
pub source_task: Option<TaskId>,
pub timestamp: Timestamp,
pub last_reinforced: Timestamp,
pub archived: bool,
}Expand description
A stored experience — the core data type in PulseDB.
Experiences are agent-learned knowledge units stored in collectives. Each experience has content, a semantic embedding for vector search, a rich type, and metadata for filtering and ranking.
§Serialization Note
The embedding field is marked #[serde(skip)] because embeddings are
stored in a separate EMBEDDINGS_TABLE for performance. The storage
layer reconstitutes the full struct by joining both tables on read.
Fields§
§id: ExperienceIdUnique identifier (UUID v7, time-ordered).
collective_id: CollectiveIdThe collective this experience belongs to.
content: StringThe experience content (text). Immutable after creation.
embedding: Vec<f32>Semantic embedding vector. Immutable after creation.
Stored separately in EMBEDDINGS_TABLE; skipped during postcard serialization of the main experience record.
experience_type: ExperienceTypeRich experience type with associated data.
importance: f32Importance score (0.0–1.0). Higher = more important.
confidence: f32Confidence score (0.0–1.0). Higher = more confident.
applications: BTreeMap<InstanceId, u32>Per-instance application/reinforcement counters.
The total application count is available via applications().
domain: Vec<String>Domain tags for categorical filtering (e.g., [“rust”, “async”]).
Related source file paths.
source_agent: AgentIdThe agent that created this experience.
source_task: Option<TaskId>Optional task context where this experience was created.
timestamp: TimestampWhen this experience was recorded.
last_reinforced: TimestampLast time this experience was explicitly reinforced.
archived: boolWhether this experience is archived (soft-deleted).
Archived experiences are excluded from search results but remain
in storage and can be restored via unarchive_experience().
Implementations§
Source§impl Experience
impl Experience
Sourcepub fn applications(&self) -> u32
pub fn applications(&self) -> u32
Returns the total application count across all instance buckets.
Trait Implementations§
Source§impl Clone for Experience
impl Clone for Experience
Source§fn clone(&self) -> Experience
fn clone(&self) -> Experience
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Experience
impl Debug for Experience
Source§impl<'de> Deserialize<'de> for Experience
impl<'de> Deserialize<'de> for Experience
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Experience
impl RefUnwindSafe for Experience
impl Send for Experience
impl Sync for Experience
impl Unpin for Experience
impl UnsafeUnpin for Experience
impl UnwindSafe for Experience
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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