-
Notifications
You must be signed in to change notification settings - Fork 0
05 Memory memory system
LAP-CHRIS\chris edited this page May 19, 2026
·
3 revisions
Krnl-AI implements multiple memory types, each serving a distinct cognitive function. All memory is stored locally via SQLite in community mode.
| Type | Purpose | Persistence |
|---|---|---|
| Working Memory | Immediate context for the current cycle | Volatile (in-memory) |
| Episodic Memory | History of past execution cycles | SQLite |
| Semantic Memory | Factual knowledge and relationships | SQLite (vectors) |
| Emotional Memory | History of emotional state transitions | SQLite |
Stores the current input and intermediate processing state during a cognitive cycle.
from krnlai import CognitiveAgent
agent = CognitiveAgent()
agent.working_memory.store("current context")
context = agent.working_memory.recall()Records each cognitive cycle as an episode with input, output, timestamp, and metadata.
# Episodic memory is automatically populated after each cycle
# You can query recent episodes:
agent.episodic_memory.recent(5)
# Search by episode type:
agent.episodic_memory.search("cycle")Stores factual knowledge that can be retrieved via semantic search.
# Store a fact
agent.semantic_memory.store_fact(
subject="project",
predicate="uses",
object_val="SQLite",
confidence=0.9,
)
# Search for relevant facts
results = agent.semantic_memory.search("storage backend")Tracks emotional state transitions over time.
# View emotional timeline
agent.emotional_memory.timeline()
# Search emotional history by trigger
agent.emotional_memory.search_by_trigger("error")
# Count recorded states
agent.emotional_memory.countkrnlai memory search "my query"
krnlai memory snapshot
krnlai memory metrics# Search memory via HTTP
curl -X POST http://localhost:5001/memory/search \
-H "Content-Type: application/json" \
-d '{"query": "project decision"}'
# Get memory metrics
curl http://localhost:5001/memory/metricsKrnl-AI Community — MIT License