feat: per-user auto-memory with ResponseContext

Three memory channels: hidden tool (sol.memory.set/get in scripts),
pre-response injection (relevant memories loaded into system prompt),
and post-response extraction (ministral-3b extracts facts after each
response). User isolation enforced at Rust level — user_id derived
from Matrix sender, never from script arguments.

New modules: context (ResponseContext), memory (schema, store, extractor).
ResponseContext threaded through responder → tools → script runtime.
OpenSearch index sol_user_memory created on startup alongside archive.
This commit is contained in:
2026-03-21 15:51:31 +00:00
parent 4dc20bee23
commit 4949e70ecc
23 changed files with 4494 additions and 124 deletions

View File

@@ -6,6 +6,7 @@ state_store_path = "/data/matrix-state"
[opensearch]
url = "http://opensearch.data.svc.cluster.local:9200"
index = "sol_archive"
memory_index = "sol_user_memory"
batch_size = 50
flush_interval_ms = 2000
embedding_pipeline = "tuwunel_embedding_pipeline"
@@ -17,12 +18,24 @@ research_model = "mistral-large-latest"
max_tool_iterations = 5
[behavior]
response_delay_min_ms = 2000
response_delay_max_ms = 8000
response_delay_min_ms = 100
response_delay_max_ms = 2300
spontaneous_delay_min_ms = 15000
spontaneous_delay_max_ms = 60000
spontaneous_threshold = 0.7
spontaneous_threshold = 0.85
room_context_window = 30
dm_context_window = 100
backfill_on_join = true
backfill_limit = 10000
instant_responses = false
cooldown_after_response_ms = 15000
evaluation_context_window = 200
reaction_threshold = 0.6
reaction_enabled = true
detect_sol_in_conversation = true
script_timeout_secs = 5
script_max_heap_mb = 64
script_fetch_allowlist = []
memory_extraction_enabled = true
# evaluation_prompt_active = "custom prompt when Sol is already in conversation..."
# evaluation_prompt_passive = "custom prompt when Sol hasn't spoken yet..."