Skip to content

feat: User-defined memory layers + domain isolation #41

@prakashUXtech

Description

@prakashUXtech

Summary

The protocol should not dictate memory structure. Layers should be user-defined namespaces, not a hardcoded enum. Domains should isolate context within layers.

Right now MemoryType is a fixed enum: CORE, EPISODIC, SEMANTIC, PROCEDURAL. The brainstorm vision says the SDK should give you soul.layer("procedural").store(...) where layer names are arbitrary.

Spec Changes (spec/)

  • Replace fixed MemoryType with open string-based layer names
  • Add domain field to MemoryEntry (optional namespace like "finance", "legal", "personal")
  • MemoryStore protocol accepts layer + domain as query parameters
  • .soul file format: memory/{layer_name}/{domain}/ directory structure

Runtime Changes (runtime/)

  • Default layers: core, episodic, semantic, procedural (backward compatible)
  • New social layer for relationship memory (bonds, trust, interaction history)
  • Domain-aware MemoryManager — queries can scope to a domain
  • DomainIsolationMiddleware — enforces that agents only access their authorized domains

Why This Matters

  • Makes the protocol truly general-purpose, not tied to our 4-layer opinion
  • Domain isolation is Cognee's insight — agents in billing shouldn't see legal context
  • Social layer enables multi-agent relationship memory
  • Aligns with "HTTP not nginx" — the spec defines the namespace mechanism, not the names

Migration

  • MemoryType enum stays in runtime/ as a convenience, but spec/ uses plain strings
  • Existing .soul files still work (default domain = "default")

Sizing: L

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions