symbiont/test_sessions.py
Symbiont 5565f29c17 Rename sessions → Engram: persistent memory across Claude instances
Engram is the physical trace a memory leaves in neural tissue.
Every Claude session now writes its engrams to /data/symbiont/engram.db.

Changes:
- sessions.py → engram.py with class Engram (SessionRegistry alias kept)
- sessions.db → engram.db
- CLAUDE.md updated to use Engram
- Genesis session registered with full build history

Muse ecosystem: Cortex + Dendrite + Symbiont + Engram

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 13:45:34 +00:00

43 lines
1.4 KiB
Python

#!/usr/bin/env python3
"""Test the session registry end-to-end."""
import sys
sys.path.insert(0, "/data/symbiont")
from symbiont.sessions import SessionRegistry, sitrep
reg = SessionRegistry()
# Register this session (the one that built everything)
sid = reg.register(
"cowork",
"Building Symbiont core: router, dispatcher, sessions, Dendrite integration"
)
print(f"Registered session: {sid}")
# Log some progress
reg.log(sid, "Built LLM router with Haiku classifier and model tier dispatch")
reg.log(sid, "Added systemd life support (API service + heartbeat timer)")
reg.log(sid, "Integrated Dendrite headless browser via web.py")
reg.log(sid, "Created session registry for cross-instance awareness")
reg.log(sid, "Deployed CLAUDE.md bootstrap for new sessions")
# Lock a resource to test that
reg.lock_resource(sid, "/data/symbiont/symbiont/router.py", "May refactor to Elixir soon")
# Print the sitrep
print()
print(sitrep())
# Test the API endpoints too
import urllib.request, json
resp = urllib.request.urlopen("http://localhost:8111/sitrep", timeout=5)
api_sitrep = json.loads(resp.read())
print(f"API /sitrep active sessions: {len(api_sitrep['active'])}")
# Complete this session
reg.complete(sid, "Built Symbiont v0.1: router, dispatcher, ledger, heartbeat, Dendrite, sessions, CLAUDE.md")
print(f"\nSession {sid} completed.")
# Final sitrep showing it moved to completed
print()
print(sitrep())