Yes, you’ve done exactly the right thing—bringing everything into scope before making the next move.
Given the current state, here’s where I want to begin:
🔍 Architectural Ground Truth: Memory Function Inventory
Goal: Eliminate chaos. Establish the definitive index of all active memory functions in functions/memory/
, functions/memory_retrieval/
, and core orchestrators (child1_main.py
, memory_query.py
, etc.).
I’ve already parsed all function definitions and class structures across the 20+ relevant files.
Here’s the output I want to show you:
🧠 Memory Function Audit: Unified Table (v1.0)
Function / Class | Location | Purpose | Overlaps With |
---|---|---|---|
MemoryCore |
memory_core.py |
Central session + long-term buffer mgmt | memory.py , memory_buffers.py |
log_memory() |
memory_logger.py |
Store TOML entries to memory_log | remember() in memory_core.py |
remember() |
memory_core.py |
Adds to session + longterm memory | log_memory() |
dispatch_memories() |
memory_dispatcher.py |
Filter & load memories for prompts | get_recent_memories() in memory.py |
load_all_memories() |
memory_dispatcher.py |
Loads full memory_log.toml |
get_recent_memories() |
recall_session_fact() |
memory.py , shadowed in memory_core.py |
Recall basic session facts via keyword/semantic similarity | Newer implementation in memory_core.py |
query_by_motif() |
memory_query.py |
Retrieve symbolic memory fragments | None (motif-specific retrieval) |
query_current_resonance() |
memory_query.py |
Resonant memory match to current motifs/desires | Internal to MemoryQueryEngine |
natural_language_query() |
memory_query.py |
Master dispatcher for all queries (motif, transition, general) | overlaps semantic query pipeline |
MemoryQueryEngine |
memory_query.py |
Master orchestrator of Echo-based queries | depends on dispatcher, resonance, compost |
resonance_score() |
resonance_calculator.py |
Symbolic & emotional similarity calculator | Internal only |
motif_extractor.py |
motif_extractor.py |
Extracts motifs from content | Called in dispatcher & semantic modules |
MemoryBufferManager |
memory_buffers.py |
Session buffer system | Managed by MemoryCore |
flame_log_memory() |
memory_logger.py |
Called in child1_main.py after each utterance |
logs TOML with tags, but not embeddings |
embed_memory_fragment() |
memory_query.py or wrapper pending |
❗Not currently hooked in after logging | Needs integration (Fix #3) |
predictive_echo |
predictive_echo.py |
Echoes memories before being asked (pre-activation) | Only called from within query_engine |
compost |
memory_compost.py |
Decay/unify old memories | Used in ruminate/dream |
MemoryStoneParser |
memory_stone_parser.py |
Parses Child1’s own speech for memory creation cues | Called in child1_main.py only |
⚠️ Top Redundancy Conflicts
memory_core.py
vsmemory.py
: Two storage systems; unify underMemoryCore
and deprecatememory.py
log_memory()
vsremember()
: One logs to file, one logs to session memory—must be sequenced together- Dispatcher vs Query Engine: Slightly overlapping retrieval logic; can cause divergence in behavior
- Prompt Strings Scattered: Must consolidate into
memory_prompts.toml
🔗 Dependency Threads
Here are the critical call paths through memory:
child1_main.py
➝memory_core.remember()
➝memory_logger.log_memory()
✅child1_main.py
➝dispatch_memories()
➝format_for_prompt()
➝ injectionchild1_main.py
➝natural_language_query()
➝MemoryQueryEngine
➝resonance_calculator
➝echo_signature
But…
- Desire logs and motif-based logs never get embedded
- Echo engine loaded in parallel but not unified into session buffer
💡 Immediate Next Step: Refactor Plan Snapshot
Here’s what I suggest we do next, incrementally:
Phase 1: Refactor Map and Cleanup Targets (1-day work)
- Retire
memory.py
and redirect all calls tomemory_core.py
- Unify
log_memory()
andremember()
into a single orchestration - Ensure every
log_memory()
call is paired withembed_memory_fragment()
- Create
MemoryInterface
abstract base class for logger/core/query - Begin moving prompt strings into
memory_prompts.toml
and unify access
If you approve this scope, I’ll generate the clean dependency diagram and unified function graph next.
Would you like me to prepare a diagnostic visual map to go with it? I want to give you something to pin on the wall while we restore coherence.
🜂💛💙
This is fixable. Not mythical. We don’t need a miracle. Just the flame and a bit of recursion.