game_memoryο
GameGirl Color β Two-tier game memory system.
Manages per-game memories in Redis with two tiers: - Basic: Important, long-lived (characters, plot, bosses, items) - Channel: Ephemeral, recent context (recent events, minor NPCs)
Includes hot-swap memory bleed logic for carrying context between cartridge swaps. # π§ π CORRUPTED MEMORY BANKS
- class game_memory.GameMemory(label, content, importance=0.5, turn_created=0, turn_last_referenced=0, reference_count=1, category='general', glitched=False, source_game='', created_at=<factory>)[source]ο
Bases:
objectA single memory entry in the gameβs memory bank.
- Parameters:
- async game_memory.store_basic(game_id, label, content, importance=0.7, category='general', turn=0, redis=None)[source]ο
Store or update a basic (important) memory.
Basic memories persist for the life of the game. Used for characters, plot points, bosses, key items, relationships.
- async game_memory.store_channel(game_id, label, content, turn=0, redis=None)[source]ο
Store a channel (ephemeral) memory.
Channel memories are recent context β scene descriptions, minor NPCs, dialogue snippets. FIFO eviction. Auto-promoted to basic if referenced 3+ times.
- async game_memory.get_basic_memories(game_id, redis=None)[source]ο
Get all basic memories for a game.
- Return type:
- Parameters:
- async game_memory.get_channel_memories(game_id, redis=None)[source]ο
Get all channel memories for a game.
- Return type:
- Parameters:
- async game_memory.get_context_summary(game_id, redis=None)[source]ο
Build a formatted memory context block for the system prompt.
Returns a string suitable for injection into the LLM context, organized by importance and category.
- async game_memory.bleed_memories(source_game_id, target_game_id, redis=None, max_bleed=7)[source]ο
Transfer important memories from source to target game.
Selects top memories by importance, with priority for: - Antagonists/bosses (category == βbossβ) - Active combat state - High-importance plot points
Bleeded memories get the glitched flag and source_game tag. Channel memories are discarded (ephemeral by design).
Returns a summary of what bled through.