Update (April 2026): Storage architecture has evolved:
- Primary: PostgreSQL 16 + pgvector 0.6.0 (indexed queries, vector search ready)
- Fallback: File-based JSON in data/memory/stm/ and data/memory/ltm/
- Dual-write: Every save_timestamped_memory() writes to both DB and file
- Schema: memories, beliefs, agents, godel_choices, actions, model_perf tables
- Migration: scripts/migrate_to_pgvector.py ingested 361 existing memories
The memory_agent serves as the central persistence layer for mindX, storing all agent interactions, system states, and operational data in a structured, timestamped format. The data/ folder functions as a comprehensive log system where every operation is recorded as a series of timestamped JSON files, making it both a storage system and an audit trail.
The MemoryAgent (agents/memory_agent.py) organizes storage under the data/ folder with the following structure:
data/
├── memory/ # Base memory directory
│ ├── stm/ # Short-Term Memory (real-time interactions)
│ │ └── {agent_id}/ # Per-agent directories
│ │ └── {YYYYMMDD}/ # Daily subdirectories
│ │ └── {timestamp}.{memory_type}.memory.json
│ ├── ltm/ # Long-Term Memory (learned patterns)
│ │ └── {agent_id}/ # Per-agent LTM storage
│ ├── context/ # Context management
│ ├── analytics/ # Memory analytics
│ └── agent_workspaces/ # Agent-specific persistent data
│ └── {agent_id}/
│ ├── process_trace.jsonl
│ └── process_traces/
└── logs/ # System logs
├── mindx_runtime.log # Rotating runtime log (10MB, 5 backups)
├── mindx_terminal.log # Terminal output log
└── process_traces/ # Structured process traces
save_timestamped_memory)Location: data/memory/stm/{agent_id}/{YYYYMMDD}/
File Naming: {timestamp}.{memory_type}.memory.json
Example: 2026-01-17T19-30-00.123456.interaction.memory.json
Structure:
{
"timestamp": "2026-01-17T19:30:00.123456",
"memory_type": "interaction|context|learning|system_state|performance|error|goal|belief|plan",
"importance": 1|2|3|4, // CRITICAL|HIGH|MEDIUM|LOW
"agent_id": "mindx_agint",
"content": {
"input": "...",
"response": "...",
"interaction_timestamp": "...",
"success": true
},
"context": {},
"tags": ["tag1", "tag2"],
"parent_memory_id": null,
"memory_id": "fd936a7a9996ad32" // 16-char hash
}
Key Features:
YYYYMMDD) for efficient queryingparent_memory_idsave_memory)Location: data/memory/{memory_type}/{category}/
File Naming: {YYYYMMDDHHMMSS}_{microseconds}.{category}.mem.json
Example: 20260117193000_123456.cycles.mem.json
Structure:
{
"timestamp_utc": "2026-01-17T19:30:00.123456+00:00",
"memory_type": "STM|LTM",
"category": "cycles|file_operations|update_requests|errors",
"metadata": {},
"data": {}
}
log_process)Location: data/memory/agent_workspaces/{agent_id}/process_trace.jsonl
Format: JSONL (JSON Lines) - one JSON object per line
Structure:
{
"timestamp_utc": "2026-01-17T19:30:00.123456+00:00",
"process_name": "agint_perception",
"metadata": {
"agent_id": "mindx_agint"
},
"process_data": {
"timestamp": 1758093966.2996728,
"llm_status": "Offline - Error: HEALTH_CHECK",
"llm_operational": false
},
"memory_id": "fd936a7a9996ad32"
}
Dual Storage: Process logs are stored both as:
Method: get_agent_data_directory(agent_id)
Location: data/memory/agent_workspaces/{agent_id}/
Purpose: Provides each agent with a dedicated directory for:
Example Structure:
data/memory/agent_workspaces/automindx_agent_main/
├── personas.json
├── process_trace.jsonl
└── process_traces/
└── 20260117_193000_agint_perception.trace.json
The data/ folder functions as a comprehensive log system because:
Location: data/memory/stm/{agent_id}/{YYYYMMDD}/
Purpose: Real-time interaction logs, system state changes, immediate events
Volume: Currently ~53MB for mindx_agint (13,175 files), ~8MB for resource_monitor (2,001 files)
Retention: Typically 7-30 days before promotion to LTM
Query Pattern:
# Get recent memories
memories = await memory_agent.get_recent_memories(
agent_id="mindx_agint",
memory_type=MemoryType.INTERACTION,
limit=50,
days_back=7
)
Location: data/memory/ltm/{agent_id}/
Purpose: Promoted patterns, learned insights, behavioral analysis
Promotion: STM patterns are analyzed and significant ones promoted to LTM
Structure: Pattern promotion files with analysis results
Location:
data/memory/agent_workspaces/{agent_id}/process_trace.jsonldata/logs/process_traces/Purpose: Step-by-step "thought process" of agents
Format: JSONL (one JSON object per line)
Use Case: Self-analysis, debugging, audit trails
Location: data/logs/mindx_runtime.log
Purpose: Human-readable system status, errors, warnings
Rotation: 10MB max size, 5 backup files (.1, .2, .3, .4, .5)
Format: Standard Python logging format:
[2026-01-17 19:30:00] agents.memory_agent - INFO - memory_agent.save_timestamped_memory:170 - Timestamped memory saved: /path/to/file.json
Location: data/logs/mindx_terminal.log
Purpose: Raw terminal input/output for complete auditability
Format:
[2026-01-17T19:30:00.123456] Terminal output line
# Find all memory files from last 7 days
find data/memory/stm/mindx_agint -type f -name ".json" -mtime -7 | sort
View a specific memory file
cat data/memory/stm/mindx_agint/20260117/2026-01-17T19-30-00.123456.interaction.memory.json | jq .
# View recent process traces (JSONL format)
tail -100 data/memory/agent_workspaces/mindx_agint/process_trace.jsonl | jq .
Count process traces
wc -l data/memory/agent_workspaces//process_trace.jsonl
# View current log
tail -f data/logs/mindx_runtime.log
View rotated logs
cat data/logs/mindx_runtime.log.1
Search for errors
grep -i error data/logs/mindx_runtime.log | tail -20
# Get memory analysis
analysis = await memory_agent.analyze_agent_patterns(
agent_id="mindx_agint",
days_back=7
)
Generate human-readable summary
summary = await memory_agent.generate_human_readable_summary(
agent_id="mindx_agint",
days_back=1
)
Based on analysis of /home/hacker/mindX/data/memory/stm/:
mindx_agintresource_monitorid_manager_for_mastermind_primeid_manager_for_coordinator_agent_maindefault_identity_managerautomindx_agent_mainguardian_agent_mainid_manager_for_mindx_agintcoordinator_agent_mainbdi_agent_mastermind_strategy_mastermind_primeTotal STM Storage: ~65MB across ~16,000+ files
mindx_agint generates ~100-200 memory files per daymindx_agint)The system uses 9 distinct memory types:
# Get recent memories with filtering
memories = await memory_agent.get_recent_memories(
agent_id="mindx_agint",
memory_type=MemoryType.INTERACTION,
limit=50,
days_back=7
)
Get memory context for decision-making
context = await memory_agent.get_agent_memory_context(
agent_id="mindx_agint",
context_type="all", # 'recent', 'patterns', 'ltm', 'all'
limit=10
)
# Analyze agent patterns
analysis = await memory_agent.analyze_agent_patterns(
agent_id="mindx_agint",
days_back=7
)
Returns:
{
"total_memories": 150,
"memory_types": {"interaction": 100, "system_state": 50},
"activity_by_hour": {9: 20, 10: 30, ...},
"error_patterns": [...],
"success_patterns": [...],
"insights": [...]
}
# Generate improvement recommendations
recommendations = await memory_agent.generate_self_improvement_recommendations(
agent_id="mindx_agint"
)
Returns:
{
"immediate_improvements": [...],
"strategic_improvements": [...],
"behavioral_adjustments": [...],
"performance_optimizations": [...]
}
# Promote significant patterns to LTM
result = await memory_agent.promote_stm_to_ltm(
agent_id="mindx_agint",
pattern_threshold=5,
days_back=7
)
Configuration (utils/logging_config.py):
mindx_runtime.log, mindx_runtime.log.1, ..., mindx_runtime.log.5Currently, there is no automatic cleanup of old STM files. Recommendations:
Simple Coder stores update requests in simple_coder_sandbox/update_requests.json, which is separate from the memory system but follows similar patterns.
mindXagent uses memory_agent for:
Startup agent logs to:
data/memory/stm/startup_agent/ - Startup eventsdata/logs/terminal_startup.log - Terminal output during startupThe memory_agent provides a robust, timestamped, log-like storage system where every agent operation is recorded as a structured JSON file. The data/ folder functions as both a storage system and a comprehensive audit trail, enabling:
The system currently stores ~65MB of STM data across ~16,000 files, with the most active agent (mindx_agint) generating hundreds of memory records daily. The log-like structure makes it easy to view, analyze, and query the system's operational history.