Experimental memory layer for Kali identity and behavior learning (Fork of rias-memory)
Find a file
2026-04-02 21:15:24 +00:00
docs Introduce Ingestion Layer: added CHRONOS_INGEST_PLAN.md and initial chronos_ingest.py implementation for controlled knowledge distillation from raw logs to Gremory v2 2026-04-01 19:28:27 +00:00
src/kali_memory sync(memory): align kali-memory with rias chronos workflow 2026-04-02 21:15:24 +00:00
tests sync(memory): align kali-memory with rias chronos workflow 2026-04-02 21:15:24 +00:00
.env.example Bootstrap rias-memory Gremory v2 2026-04-01 18:34:42 +00:00
.gitignore sync(memory): align kali-memory with rias chronos workflow 2026-04-02 21:15:24 +00:00
policy.json Bootstrap rias-memory Gremory v2 2026-04-01 18:34:42 +00:00
pyproject.toml Final Kali Rebrand: module renamed to kali_memory, pyproject.toml updated with new scripts and package name, all internal references cleaned 2026-04-01 18:55:11 +00:00
README.md sync(memory): align kali-memory with rias chronos workflow 2026-04-02 21:15:24 +00:00
README_MCP.md sync(memory): align kali-memory with rias chronos workflow 2026-04-02 21:15:24 +00:00

kali_memory

Experimental memory layer for Codex identity and behavior learning. Gremory v2 adds layered memory, brokered retrieval, and shadow persona review.

Goals

  • Build persistent identity traits and response style.
  • 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.

Data Model

Default memory home: ~/.codex/cortex (override with KALI_MEMORY_HOME). Central backends are loaded from .env. Consent policy is loaded from policy.json (override path with RIAS_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

CLI

Run from source:

python3 -m kali_memory.cli init
python3 -m kali_memory.cli health
python3 -m kali_memory.cli remember --project KrakenSniper --task "debug ws reconnect" --outcome "fixed retry jitter" --success --confidence 0.82 --tags websocket,retry --consent-level internal
python3 -m kali_memory.cli remember --project HomeAssistant --task "wire esp config bridge" --outcome "write path works" --success --confidence 0.95 --tags mcp,ha --layer household --task-tags homeassistant
python3 -m kali_memory.cli reflect --project KrakenSniper
python3 -m kali_memory.cli recall --project KrakenSniper --query "reconnect retry strategy" -k 5 --task-tags coding
python3 -m kali_memory.cli recall --query "daily preference" --task-tags private --allow-restricted --explicit-consent
python3 -m kali_memory.cli explain --last
python3 -m kali_memory.cli cleanup --event-id <uuid>
python3 -m kali_memory.cli archive --event-id <uuid> --reason "obsolete"
python3 -m kali_memory.cli rewrite --event-id <uuid> --outcome "corrected result" --layer household
python3 -m kali_memory.cli persona show
python3 -m kali_memory.cli persona set --key verbosity --value concise
python3 -m kali_memory.cli persona propose --key tone --value "warmer" --reason "user requested softer phrasing"
python3 -m kali_memory.cli persona shadow-list --status draft
python3 -m kali_memory.cli persona review --proposal-id <uuid> --decision approved --note "looks right"
python3 -m kali_memory.cli persona promote --proposal-id <uuid>

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.