Feature: Unified perception stream data model #21

Open
opened 2025-12-11 00:06:46 +00:00 by blightbow · 0 comments
Owner

Overview

Replace dual context_buffer/conversation_history with unified perception_stream that maintains chronological order.

PerceptionEvent Schema

PerceptionEvent = {
    "id": str,                    # Unique event ID
    "timestamp": str,             # ISO timestamp
    "event_type": str,            # "external" | "self_action" | "self_speech" | "tool_result" | "tick"
    "source": {
        "entity_id": str,         # Dbref or identifier
        "entity_name": str,       # Display name
        "source_type": str,       # "say" | "pose" | "page" | "whisper" | "channel" | "system"
    },
    "content": str,               # The actual message/action content
    "narrative_text": str | None, # Full prose version (for poses, rich descriptions)
    "importance": int,            # 1-10 scale for truncation decisions
    "requires_response": bool,    # Does this event need assistant action?
    "addressing": str | None,     # Who is this directed at?
    "metadata": dict,             # Additional context (tool params, results, etc.)
}

Storage Changes

Current New
script.db.conversation_history script.db.perception_stream
character.db.context_buffer Removed

Architectural Pattern

Following MemexLLM's clean separation:

storage = EventniaAttributeStorage(script)  # Backend
algorithm = ImportanceWeightedAlgorithm()   # Truncation logic
perception_manager = PerceptionManager(storage, algorithm)

Files to Modify

  • assistant_script.py - Add perception_stream attribute
  • assistant_character.py - Remove context_buffer

Phase

Phase 1 of Milestone #4

## Overview Replace dual `context_buffer`/`conversation_history` with unified `perception_stream` that maintains chronological order. ## PerceptionEvent Schema ```python PerceptionEvent = { "id": str, # Unique event ID "timestamp": str, # ISO timestamp "event_type": str, # "external" | "self_action" | "self_speech" | "tool_result" | "tick" "source": { "entity_id": str, # Dbref or identifier "entity_name": str, # Display name "source_type": str, # "say" | "pose" | "page" | "whisper" | "channel" | "system" }, "content": str, # The actual message/action content "narrative_text": str | None, # Full prose version (for poses, rich descriptions) "importance": int, # 1-10 scale for truncation decisions "requires_response": bool, # Does this event need assistant action? "addressing": str | None, # Who is this directed at? "metadata": dict, # Additional context (tool params, results, etc.) } ``` ## Storage Changes | Current | New | |---------|-----| | `script.db.conversation_history` | `script.db.perception_stream` | | `character.db.context_buffer` | Removed | ## Architectural Pattern Following MemexLLM's clean separation: ```python storage = EventniaAttributeStorage(script) # Backend algorithm = ImportanceWeightedAlgorithm() # Truncation logic perception_manager = PerceptionManager(storage, algorithm) ``` ## Files to Modify - `assistant_script.py` - Add `perception_stream` attribute - `assistant_character.py` - Remove `context_buffer` ## Phase Phase 1 of Milestone #4
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
blightbow/evennia_ai#21
No description provided.