Files
the-nexus/nexus/mempalace/config.py
Alexander Whitestone 367a06a849
Some checks failed
CI / test (pull_request) Failing after 7s
CI / validate (pull_request) Failing after 3s
feat: MemPalace × Evennia fleet memory scaffold (#1075)
Add foundational architecture for the MemPalace × Evennia integration
milestone.  All sub-issues (Phase 1–4 and infra) can now build on top
of this scaffold.

**nexus/mempalace/**
- `config.py` — MEMPALACE_PATH, FLEET_PALACE_PATH, FLEET_WING, CORE_ROOMS
- `searcher.py` — `search_memories()`, `search_fleet()`, `add_memory()`,
  `MemPalaceResult`, `MemPalaceUnavailable`; ChromaDB imported lazily

**nexus/evennia_mempalace/**
Commands:
- `CmdRecall` — `recall <query>` / `recall <query> --fleet`
- `CmdEnterRoom` — `enter room <topic>` teleports to a palace room
- `CmdRecord` / `CmdNote` / `CmdEvent` — write decisions, breakthroughs,
  and events into the palace (Phase 4)

Typeclasses:
- `MemPalaceRoom` — room whose description auto-populates from palace search
- `StewardNPC` — answers player questions via wing memory search (Phase 3)

All classes use a graceful Evennia stub so the module imports cleanly
outside a live Evennia/Django environment.

**docs/mempalace/rooms.yaml** (#1082 deliverable)
Fleet-wide room taxonomy standard: 5 required core rooms, 3 write rooms,
optional domain rooms, tunnel policy, and privacy rules.

**tests/**
- `test_mempalace_searcher.py` — 20 tests covering config, ChromaDB mocking,
  search/add, error paths
- `test_evennia_mempalace_commands.py` — 20 tests covering all commands,
  `_closest_room`, `_extract_topic`, StewardNPC responses

40 new tests, all passing.

Refs #1075
2026-04-07 10:07:15 -04:00

47 lines
2.4 KiB
Python

"""MemPalace configuration — paths and fleet settings.
All configuration is driven by environment variables so that
different wizards on different VPSes can use the same code with
their own palace directories.
"""
from __future__ import annotations
import os
from pathlib import Path
# ── Palace path ──────────────────────────────────────────────────────────────
# Default: ~/.mempalace/palace/ (local wizard palace)
# Override via MEMPALACE_PATH env var (useful for fleet shared wing)
_default = Path.home() / ".mempalace" / "palace"
MEMPALACE_PATH: Path = Path(os.environ.get("MEMPALACE_PATH", str(_default)))
# ── Fleet shared wing ─────────────────────────────────────────────────────────
# Path to the shared fleet palace on Alpha (used by --fleet searches)
_fleet_default = Path("/var/lib/mempalace/fleet")
FLEET_PALACE_PATH: Path = Path(
os.environ.get("FLEET_PALACE_PATH", str(_fleet_default))
)
# ── Wing name ─────────────────────────────────────────────────────────────────
# Identifies this wizard's wing within a shared palace.
# Populated from MEMPALACE_WING env var or falls back to system username.
def _default_wing() -> str:
import getpass
return os.environ.get("MEMPALACE_WING", getpass.getuser())
FLEET_WING: str = _default_wing()
# ── Fleet rooms standard ─────────────────────────────────────────────────────
# Canonical rooms every wizard must have (see docs/mempalace/rooms.yaml)
CORE_ROOMS: list[str] = [
"forge", # CI, builds, infra
"hermes", # agent platform, gateway, CLI
"nexus", # reports, docs, KT
"issues", # tickets, backlog
"experiments", # prototypes, spikes
]
# ── ChromaDB collection name ──────────────────────────────────────────────────
COLLECTION_NAME: str = os.environ.get("MEMPALACE_COLLECTION", "palace")