Skip to content

v2.1.0 — Memory Persistence & Remember Keyword

Choose a tag to compare

@aebrer aebrer released this 16 Feb 16:07
· 15 commits to master since this release
c332edb

The Kind God now remembers what happens in the world — and you can ask it to reflect on command.

What's New for Players

The god sleeps when you're gone. When no players are online, the Kind God stops watching. No more burning through API calls all night reacting to rain. The god wakes up the moment someone joins.

"Remember." Say "remember" in chat and the Kind God will pause, close its eyes, and reflect on everything that's happened since its last reflection. It consolidates its memories on the spot — useful after a big event you want it to actually retain. You'll get honest feedback: a gold message and chime when it works, a grey message if there's nothing new to reflect on or it's still recovering from a recent reflection, and a red warning if something goes wrong.

"Remember" takes priority. If you say "dear god please remember", the god recognizes "remember" first and reflects instead of treating it as a prayer. The priority order is: remember > prayer > herald.

The god remembers across restarts. The Kind God's activity log (everything it observed — chats, prayers, deaths, its own actions) now saves to disk. Previously, restarting the backend wiped its short-term memory. Now it picks up right where it left off.

Real-time consolidation. Memory consolidation runs on a real 3-hour wall-clock timer instead of a broken tick counter that required 32+ hours of continuous gameplay to fire. The timer persists across restarts too.

Technical Changes

  • Idle tick optimization: get_player_status() returns None when the last status beacon is older than 120 seconds. The god tick loop drains buffered events silently and skips the LLM call. Events are still logged — only the LLM call is suppressed.
  • Unified keyword detection: classify_divine_request() and is_divine_request() in prayer_queue.py are the single source of truth for prayer/herald/remember classification. Priority: remember > prayer > herald.
  • Remember via DivineRequestQueue: "remember" requests are queued like prayers with full player context snapshots. The processing path checks preconditions (non-empty log, cooldown expired) before sending feedback, then runs consolidation inline.
  • Wall-clock consolidation timer: MEMORY_CONSOLIDATION_INTERVAL_SECONDS (default 3 hours, env-configurable). Stored as unix timestamp in the memory JSON, survives restarts. Failure cooldown prevents retry-spam on LLM outages.
  • Activity log persistence: data/consolidation_log.json saved via atomic writes (tmp + os.replace) on shutdown and after each consolidation. Loaded on startup. Handles missing, corrupt, and non-list JSON gracefully.
  • Player staleness threshold: Player positions older than 10 minutes are excluded from Deep God trigger checks, preventing stale cached positions from triggering underground events after players log off.
  • Error handling improvements: UnicodeDecodeError caught on file loads, logger.exception for full tracebacks on corruption, non-list JSON detection with warning, atomic writes throughout.
  • Dead code removed: _validate_block, _validate_coordinate (unused since v2.0.0), has_divine_request (superseded by prayer queue).
  • Test suite: 220 tests covering commands (36), deaths (12), events (28), deep god triggers (15), herald (10), memory (20), prayer queue (33), activity log (14), schematics (12). Pre-commit hook enforces all tests pass before every commit.