Skip to main content

Crate alaya

Crate alaya 

Source
Expand description

§Alaya

A neuroscience and Buddhist psychology-inspired memory engine for conversational AI agents.

Alaya (Sanskrit: alaya-vijnana, “storehouse consciousness”) provides three memory stores, a Hebbian graph overlay, hybrid retrieval with spreading activation, and adaptive lifecycle processes — all without coupling to any specific LLM or agent framework.

§Quick Start

use alaya::{Alaya, NewEpisode, Role, EpisodeContext, Query};

let alaya = Alaya::open_in_memory().unwrap();

// Store an episode
alaya.episodes().store(&NewEpisode {
    content: "Rust has zero-cost abstractions.".to_string(),
    role: Role::User,
    session_id: "session-1".to_string(),
    timestamp: 1700000000,
    context: EpisodeContext::default(),
    embedding: None,
}).unwrap();

// Query memories
let results = alaya.knowledge().query(&Query::simple("Rust")).unwrap();
assert!(!results.is_empty());

Re-exports§

pub use hooks::MemoryHooks;
pub use hooks::NoOpHooks;

Modules§

hooks
Webhook/callback hooks for memory lifecycle events.
managers
Sub-manager types for the Alaya coordinator.

Structs§

Alaya
The main entry point. Owns a SQLite connection and exposes the full store / query / lifecycle API via focused sub-managers.
BoostWeights
Category
CategoryId
Conflict
ConflictId
ConsolidationReport
DreamReport
Episode
EpisodeContext
EpisodeId
ExportData
ExportReport
ForgettingReport
ImportReport
Impression
ImpressionId
Interaction
Input to the perfuming process. The agent constructs this from whatever interaction format it uses (Signal message, Discord message, HTTP request, etc.)
KnowledgeFilter
Link
LinkId
MemoryStatus
MockEmbeddingProvider
Mock embedding provider for tests. Returns deterministic embeddings based on a hash of the input text.
MockExtractionProvider
Mock extraction provider for tests. Returns pre-configured nodes.
NewEpisode
NewImpression
NewSemanticNode
NoOpProvider
A no-op provider for when no LLM is available. Consolidation and perfuming simply skip the LLM-dependent steps.
NodeId
NodeStrength
PerfumingReport
Preference
PreferenceId
PurgeReport
Query
QueryContext
ReconcileReport
ScoredMemory
SemanticNode
TransformationReport

Enums§

AlayaError
ConflictStatus
ConflictStrategy
LinkType
NodeRef
PurgeFilter
Role
SemanticType

Traits§

ConsolidationProvider
The agent provides this trait to support intelligent consolidation. Alaya never calls an LLM directly — the agent owns the LLM connection.
EmbeddingProvider
Trait for automatic embedding generation.
ExtractionProvider
Trait for automatic knowledge extraction from episodes.

Type Aliases§

Result