Without memory, every behavioral scoring session starts from zero. With memory engines, the behavioral AI platform maintains a persistent, structured, provenance-tracked understanding of each actor across sessions.
The Engines
- Behavioral Operating Memory — Short-term context: the last N interactions in the current session, held in working memory for the current pipeline run.
- Knowledge Graph Engine — Long-term: persistent facts about the actor stored as a typed graph (entity → relationship → entity). Every fact has a source, timestamp, and confidence.
- Embedding Layer — Vector representations of behavioral patterns, enabling semantic similarity search across actor histories.
- Data Provenance Engine — Tracks the origin of every fact in the knowledge graph: which engine generated it, from which input signals, at what time.
Code Walkthrough
// Knowledge graph: add a fact with provenance
function addFact(graph, subject, relation, object, provenance) {
graph.facts.push({
id: uuid(),
subject,
relation,
object,
confidence: provenance.confidence,
source: {
engineId: provenance.engineId,
signalIds: provenance.signalIds,
timestamp: new Date().toISOString(),
},
});
graph.index.set(`${subject}:${relation}`, object);
}
// Embedding retrieval: find similar actors
async function findSimilarActors(actorEmbedding, topK = 5) {
return vectorDB.query({
collection: "behavioral_embeddings",
vector: actorEmbedding,
topK,
filter: { domain: context.domain },
});
}
What to Watch For
- Knowledge graph facts must be erasable on a GDPR right-to-erasure request. Cascade deletions to embeddings and all downstream facts that were derived from the deleted fact.
- Provenance chains can grow very large. Index by
subjectand set a maximum depth for provenance traversal.