Shared memory engine with profile-based personas
Find a file
2026-04-05 18:58:58 +00:00
build/lib/memory_advanced feat: implement Obsidian VaultManager and StoreConfig integration 2026-04-02 22:54:12 +00:00
docs feat(experience): complete reviewed learning loop with anti-pattern detection 2026-04-03 00:31:25 +00:00
src feat(profiles): add advanced memory profile for gaia 2026-04-05 18:58:58 +00:00
tests feat(core): bootstrap memory-advanced with profile-based personas 2026-04-02 21:26:48 +00:00
.env.example feat(core): bootstrap memory-advanced with profile-based personas 2026-04-02 21:26:48 +00:00
.gitignore feat(core): bootstrap memory-advanced with profile-based personas 2026-04-02 21:26:48 +00:00
policy.json feat(core): bootstrap memory-advanced with profile-based personas 2026-04-02 21:26:48 +00:00
pyproject.toml feat(core): bootstrap memory-advanced with profile-based personas 2026-04-02 21:26:48 +00:00
README.md feat(core): bootstrap memory-advanced with profile-based personas 2026-04-02 21:26:48 +00:00
README_MCP.md feat(core): bootstrap memory-advanced with profile-based personas 2026-04-02 21:26:48 +00:00

Memory Advanced

Shared memory engine for multiple agent personas. Gremory v2 adds layered memory, brokered retrieval, Chronos ingest, and profile-based identity defaults.

Goals

  • Build one reusable memory core for multiple personas.
  • Learn from outcomes across sessions.
  • Keep project memories isolated from each other.
  • Make every retrieval explainable.
  • Separate core, domain, restricted, vault, and shadow memory concerns.
  • Avoid fork drift between persona-specific repos.

Data Model

Default memory home: ~/.codex/cortex (override with MEMORY_ADVANCED_HOME or profile-specific env such as RIAS_MEMORY_HOME / KALI_MEMORY_HOME). Central backends are loaded from .env. Consent policy is loaded from policy.json (override path with MEMORY_ADVANCED_POLICY_FILE).

  • identity.json: live persona traits and communication preferences.
  • layers/<layer>.jsonl: physically separated episodic records with layer, scope, sensitivity, task_tags.
  • archives/<layer>.jsonl: archived episodic records.
  • rules.json: procedural rules extracted from successful episodes.
  • project_profiles/<project>.json: per-project stats, tendencies, and dominant layers.
  • shadow_persona.jsonl: proposed identity changes pending review and promotion.
  • explanations.jsonl: retrieval explanation logs, including broker decisions.

Gremory v2 Layers

  • identity, procedures: core
  • projects, household: domain
  • private, social: restricted
  • secrets, health, finance: vault
  • shadow: review-only / not auto-recalled

Profiles

Profiles live under src/memory_advanced/profiles/.

  • rias: verification-oriented defaults
  • kali: security- and architecture-oriented defaults

The engine stays shared. Only persona defaults move between profiles.

CLI

Run from source:

python3 -m memory_advanced.cli --profile rias init
python3 -m memory_advanced.cli --profile rias health
python3 -m memory_advanced.cli --profile rias remember --project KrakenSniper --task "debug ws reconnect" --outcome "fixed retry jitter" --success --confidence 0.82 --tags websocket,retry --consent-level internal
python3 -m memory_advanced.cli --profile kali remember --project Security --task "review daemon token flow" --outcome "documented auth mismatch" --success --confidence 0.91 --tags auth,doctor --layer procedures
python3 -m memory_advanced.cli --profile rias chronos schema
python3 -m memory_advanced.cli --profile rias chronos sessions --limit 10
python3 -m memory_advanced.cli --profile rias chronos ingest --project Nexus
python3 -m memory_advanced.cli --profile rias reflect --project KrakenSniper
python3 -m memory_advanced.cli --profile rias recall --project KrakenSniper --query "reconnect retry strategy" -k 5 --task-tags coding
python3 -m memory_advanced.cli --profile rias persona show

Design Notes

  • Scoring = lexical similarity + recency + confidence + success weight.
  • Reflection promotes successful event patterns into procedures.
  • Retrieval writes an explanation entry with exact scoring factors and broker layer decisions.
  • Default consent is strict.
  • remember supports --consent-level (none|internal|strict|summary) and --sensitive-fields for controlled persistence and redaction.
  • remember also supports --layer, --scope, --sensitivity, and --task-tags.
  • policy.json controls consent blocks, task-tag-to-layer mapping, restricted/vault/shadow layers, and never-auto-recall behavior.
  • Vault layers force local-summary-only redaction and disable central writes.
  • Shadow persona proposals are stored separately and only become live traits after explicit review then promotion.
  • Event storage is now physically separated by layer under layers/.
  • archive preserves a local audit trail while removing the event from active recall.
  • rewrite allows surgical correction instead of only deleting and re-adding memories.
  • Central write path targets memories, task_episodes, failed_approaches and rule sync to procedures, learned_patterns when table columns match.
  • The same store and ingest engine are reused by every persona profile.