Holonic Memory
Holonic Memory is the persistent, fractal memory system that backs every WEB6 AI agent. Memory is organised in a four-level hierarchy โ Session, Agent, User, Group โ where each level inherits context from levels above it. A Leela assistant in SovereignTrust remembers not just the current conversation, but the user's full trust portfolio history, all previous Leela sessions, and shared wisdom from the broader OASIS community.
What you'll build
- Understand the four-level holonic memory hierarchy
- Write and read session-scoped memory (per-conversation context)
- Write and read agent-scoped memory (persistent agent knowledge)
- Share memory across users at group level
- Query memory with semantic search
- Use memory as automatic system-prompt context injection
WEB6 API Reference โ Holonic Memory section โ ยท npm: @oasisomniverse/web6-api โ
The Holonic Memory Hierarchy
Group Memory โ shared across all members of a group (community wisdom, org policies)
โโ User Memory โ persistent per avatar (preferences, history, long-term context)
โโ Agent Memory โ per AI agent (domain knowledge, learned patterns)
โโ Session Memory โ per conversation (current turn context, short-term state)
| Level | Scope | Typical use | TTL |
|---|---|---|---|
Session | Single conversation | Current intent, in-progress task state | 24h |
Agent | All sessions for one agent | Agent's learned preferences, tool patterns | Permanent |
User | All sessions for one avatar | User profile, history, preferences | Permanent |
Group | All members of a group | Org policies, shared knowledge base, collective memory | Permanent |
Write & Read Memory
import { ai } from './web6.js'; // Write a fact to user-level memory await ai.memory.write({ level: 'User', ownerId: avatarId, key: 'trustPreferences', value: { jurisdiction: 'England and Wales', preferredTrustType: 'Discretionary' }, tags: ['legal', 'preferences'], }); // Write to session memory (current conversation only) await ai.memory.write({ level: 'Session', sessionId: currentSessionId, key: 'currentDocumentId', value: docId, });
// Read a specific key const { result: prefs } = await ai.memory.read({ level: 'User', ownerId: avatarId, key: 'trustPreferences', }); console.log('Jurisdiction:', prefs.value.jurisdiction);
Semantic Search Over Memory
Memory supports vector search โ find relevant context by meaning, not just key lookup.
// Semantic search: "what does this user know about trusts?" const { result: hits } = await ai.memory.search({ query: 'trust deed jurisdiction preferences', ownerId: avatarId, levels: ['User', 'Agent'], // search across these levels topK: 5, }); hits.forEach(h => console.log(h.key, '(' + h.score.toFixed(2) + ')', h.value));
Auto-Injecting Memory into AI Calls
The most powerful pattern: tell WEB6 to automatically prepend relevant memory as system-prompt context on every AI call โ no manual lookup needed.
const { result } = await ai.chat.complete({ messages: [{ role: 'user', content: 'Should my trust be discretionary or fixed?' }], provider: 'anthropic', model: 'claude-3-5-sonnet', memoryContext: { avatarId, sessionId, injectLevels: ['Session', 'User', 'Group'], // inject these automatically topK: 8, // top 8 relevant memories }, }); // The AI call automatically received the user's jurisdiction preferences, // previous trust discussions, and community-wide legal knowledge โ without // any extra code on your side. console.log(result.content);
Group Memory โ Shared Knowledge Base
// Write a policy to the SovereignTrust group memory await ai.memory.write({ level: 'Group', ownerId: sovereignTrustGroupId, key: 'legalPolicy:2026', value: 'All trust deeds must comply with Trustee Act 2000 and HMRC IHT400 guidance.', tags: ['legal', 'compliance', '2026'], }); // Any avatar in the group can now benefit from this knowledge // when they chat with Leela โ it's injected automatically.
You now know the full OASIS stack โ WEB4 identity and storage, WEB5 game mechanics and spatial worlds, and WEB6 AI agents and memory. The next step is picking a case study that matches what you want to build and following it step by step.