Spaces:
Sleeping
Sleeping
Architecture & Design Decisions
Deep dive into Chess Master agent system design.
Multi-Agent System
Main Agent (Chess Master)
- Responds to game context and user input
- Always outputs JSON with action + content
- Personality-driven responses with optional thinking
Subconscious Agent
- Runs every turn before main agent
- Queries Weaviate for relevant memories
- Decides which memories to inject to main agent
- Filters: no recently-given, no recently-created
Scheduler
- Coordinates trigger points
- Manages timing and idle monitoring
Memory Vector Database (Weaviate)
- Semantic search over all observations
- Supports filtering by type, date, metadata
Trigger Points
- before_match: Setup, greet opponent
- on_user_input: User sends message/action
- on_user_move: After opponent's chess move
- before_agent_move: Agent decides action
- idle_wait: Periodic check while user thinks
- after_match: Reflect, summarize
Game Context
Passed to agents each turn:
- Match metadata (id, opponent, difficulty, start_time, current_time)
- Game state (status, odds, move count, last N moves with odds delta)
- Match history (previous results, streaks)
- User local time (for context-aware responses)
Memory Schema
id: str
timestamp: datetime
content: str (what gets embedded)
memory_type: MemoryType (category for filtering)
related_match_id: Optional[str]
created_by: str ("main_agent" or "subconscious")
metadata: dict (player_name, difficulty, etc.)
Types: player_behavior, player_observation, game_context, personal_note, streak, pattern, emotional
Main Agent Response (JSON)
{
"thinking": "Optional",
"action": "send_message | stop | save_memory | set_emotion",
"content": "Message or memory content",
"tone": "playful | sharp | respectful | dismissive",
"metadata": { "optional": "context" }
}
Subconscious Flow
- Analyze current context (game state, user behavior)
- Query Weaviate semantically for relevant memories
- Filter: remove already-given and recently-created
- Decide: are these useful? Provide or empty list.
- Can iterate: search -> search -> provide (any order)
Implementation Notes
Weaviate Embedding: Use local sentence-transformers (all-MiniLM-L6-v2) Models: Gemini 3.1 Flash Lite Preview (primary, lightweight & fast), Claude Opus (fallback) Scheduler: TODO - sync vs async decision
Next Steps
- Weaviate client wrapper
- Gemini API wrapper with tool calling (primary)
- Claude API wrapper (fallback)
- Main agent response generation
- Subconscious memory retrieval
- Scheduler implementation
- Test suite with synthetic data
- Iterate on personality
Questions for Collaborative Iteration
- Memory Decay: Should older memories fade over time?
- Subconscious Judgment: Always decide, or structured fallback rules?
- Emotion Display: JSON field or separate channel?
- Match History: Store full PGN or just summaries?
- Multi-Modality (Phase 2+): How should agent receive non-text input?