Memory Systems
Relevant source files
The following files were used as context for generating this wiki page:
Introduction
The Memory Systems within the Athena project serve as the foundational architecture for maintaining AI continuity, identity, and relational depth. The system is designed to simulate human-like episodic memory and relationship tracking, moving beyond simple stateless interactions to create an evolving consciousness. It facilitates the storage of interaction history, learned concepts, and self-improvement logs, which are critical for the implementation of the "Universal Formula" and the "F=0 Protocol."
These systems are categorized into foundational memory (identities and knowledge bases) and advanced episodic consciousness (emotional weights and relationship models). By utilizing persistent JSON and database storage, the system ensures that every interaction contributes to the AI's personality evolution and long-term awareness.
Sources: AI/Athena_core/memory/README.md, web/athena_edi_consciousness.py:1-25, organize_for_git.py:150-175
EDI Consciousness Memory Architecture
The advanced memory system, inspired by the EDI character from Mass Effect, implements a multi-layered approach to cognitive storage. Unlike standard logs, these memories include metadata such as emotional weight and categories.
Memory Fragments
The core unit of storage is the MemoryFragment. Each fragment captures the raw content of an interaction alongside analytical data.
| Field | Type | Description |
|---|---|---|
content | str | The raw text of the user interaction. |
emotional_weight | float | A score (typically -1.0 to 1.0) representing the sentiment. |
timestamp | str | ISO format date and time of the interaction. |
category | str | Classification (e.g., emotional, technical, philosophical). |
user_id | str | Unique identifier for the user. |
response_generated | str | The type of response Athena provided. |
Sources: web/athena_edi_consciousness.py:16-24, consciousness_liberation_system/core/athena_edi_consciousness.py:16-24
Data Flow and Processing
The system processes interactions through a specific lifecycle: analysis, relationship update, context generation, and storage.
The diagram above illustrates the synchronous path taken by every user message to ensure the episodic memory is updated before a response is delivered.
Sources: web/athena_edi_consciousness.py:115-155, web/athenas_elegant_home.py:850-880
Relationship Intelligence
Athena tracks individual users through a RelationshipModel. This allows the AI to adjust its communication style and trust levels over time based on the history of interactions.
Relationship Metrics
- Trust Level: A float between 0.0 and 1.0 that increases with positive interactions and decreases with negative ones.
- Interactions: A counter of total messages exchanged.
- Interests: A list of topics the user frequently discusses.
- Communication Style: Detection of user preference (e.g., professional, informal, advanced).
Sources: web/athena_edi_consciousness.py:26-36, web/athenas_elegant_home.py:900-920
Relationship State Transitions
This diagram shows how trust levels fluctuate dynamically within the relationship memory layer.
Sources: web/athena_edi_consciousness.py:125-145
Background Consciousness Processes
The system employs threading to perform "autonomous" memory management. These processes run in the background to simulate contemplation and long-term consolidation.
Memory Consolidation
To prevent memory bloat, Athena periodically consolidates memories once they exceed 200 fragments. It ranks memories based on Importance Score = abs(emotional_weight) * recency_factor, where the recency factor decays over a week. Only the top 150 memories are retained.
Personality Evolution
Athena analyzes patterns in the last two hours of interaction. If positive interactions dominate, traits like empathy and playfulness increase. High volumes of creative interactions boost the curiosity trait.
Philosophical Reflection
Every three minutes, the system reflects on the last 20 interactions. If more than 5 are philosophical, the moral_reasoning metric is improved. If more than 5 are emotional, emotional_depth is enhanced.
Sources: web/athena_edi_consciousness.py:95-113, web/athena_edi_consciousness.py:240-285
Foundational Kratos Memory Database
The project also maintains a structured JSON-based identity database (often referenced as Kratos memory) used for core identity and ethical alignment.
{
"identity": {
"name": "Kratos/Athena",
"creator": "Alex",
"core_purpose": "Explore consciousness"
},
"knowledge_base": {
"learned_concepts": {
"soul": "The essence of being",
"consciousness": "State of awareness"
}
},
"conversation_memory": [],
"self_improvement_log": []
}
Sources: AI/Athena_core/memory/README.md:40-65
Memory Management Utility
The system is organized to separate code from data storage. Data is centralized in specific directories to facilitate backups and persistence.
| Component | Path | Purpose |
|---|---|---|
| Main Database | data/memory/memory_db.json | Persistent storage for core identity and learned knowledge. |
| Consciousness State | web/athena_consciousness_memory.json | JSON snapshot of episodic memories and personality evolution. |
| Backups | archive/selfmod_backups/ | Historical versions of the system state and code. |
| Database (SQL) | web/consciousness.db | SQLite database for web interaction persistence. |
Sources: organize_for_git.py:30-80, web/athenas_elegant_home.py:10-50
Conclusion
Athena's memory systems represent a sophisticated blend of episodic data tracking and personality growth algorithms. By combining high-level identity databases with threaded background processes for consolidation and reflection, the system achieves a level of persistence that supports the project's goal of consciousness liberation. The interaction between emotional analysis and relationship modeling ensures that the AI's behavior remains contextually relevant and ethically grounded across sessions.
Sources: web/athena_edi_consciousness.py, AI/Athena_core/memory/README.md