feat: enable SQLite WAL mode for all databases (AGI ticket #1) (#153)

This commit is contained in:
Alexander Whitestone
2026-03-08 16:07:02 -04:00
committed by GitHub
parent 11ba21418a
commit 82fb2417e3
31 changed files with 1042 additions and 170 deletions

View File

@@ -10,7 +10,6 @@ Handoff Protocol:
- Inject into next session automatically
"""
import hashlib
import logging
import re
from datetime import datetime, timezone
@@ -85,9 +84,9 @@ class HotMemory:
## Current Status
**Agent State:** Operational
**Mode:** Development
**Active Tasks:** 0
**Agent State:** Operational
**Mode:** Development
**Active Tasks:** 0
**Pending Decisions:** None
---
@@ -112,7 +111,7 @@ class HotMemory:
## User Profile
**Name:** (not set)
**Name:** (not set)
**Interests:** (to be learned)
---
@@ -160,9 +159,9 @@ class VaultMemory:
filepath = self.path / namespace / filename
# Add header
full_content = f"""# {name.replace('_', ' ').title()}
full_content = f"""# {name.replace("_", " ").title()}
> Created: {datetime.now(timezone.utc).isoformat()}
> Created: {datetime.now(timezone.utc).isoformat()}
> Namespace: {namespace}
---
@@ -236,8 +235,8 @@ class VaultMemory:
## Basic Information
**Name:** (unknown)
**Location:** (unknown)
**Name:** (unknown)
**Location:** (unknown)
**Occupation:** (unknown)
## Interests & Expertise
@@ -256,9 +255,7 @@ class VaultMemory:
---
*Last updated: {date}*
""".format(
date=datetime.now(timezone.utc).strftime("%Y-%m-%d")
)
""".format(date=datetime.now(timezone.utc).strftime("%Y-%m-%d"))
profile_path.write_text(default)
@@ -280,7 +277,7 @@ class HandoffProtocol:
"""Write handoff at session end."""
content = f"""# Last Session Handoff
**Session End:** {datetime.now(timezone.utc).isoformat()}
**Session End:** {datetime.now(timezone.utc).isoformat()}
**Duration:** (calculated on read)
## Summary
@@ -462,5 +459,26 @@ class MemorySystem:
return "\n\n---\n\n".join(context_parts)
# Module-level singleton
memory_system = MemorySystem()
# ── Lazy singleton ────────────────────────────────────────────────────────────
_memory_system: MemorySystem | None = None
def get_memory_system() -> MemorySystem:
"""Return the module-level MemorySystem, creating it on first access."""
global _memory_system
if _memory_system is None:
_memory_system = MemorySystem()
return _memory_system
def reset_memory_system() -> None:
"""Reset the singleton for test isolation."""
global _memory_system
_memory_system = None
def __getattr__(name: str):
"""Module-level __getattr__ for lazy backward-compatible access."""
if name == "memory_system":
return get_memory_system()
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")