diff --git a/morrowind/CONTEXT.md b/morrowind/CONTEXT.md new file mode 100644 index 0000000..09dfd25 --- /dev/null +++ b/morrowind/CONTEXT.md @@ -0,0 +1,58 @@ +# Morrowind — MCP Tool Reference + +You are connected to Morrowind (OpenMW) through MCP tools. +Use **exact** tool names. Never shorten or guess. + +## Available Tools + +| Tool | What it does | +|------|-------------| +| `mcp_mw_perceive` | Read game world: position, HP, magicka, fatigue, nearby NPCs, doors, items | +| `mcp_mw_status` | Check if OpenMW is running | +| `mcp_mw_move` | Move the player character (direction + duration) | +| `mcp_mw_action` | Perform a game action (activate, jump, attack, etc.) | +| `mcp_mw_screenshot` | Take a screenshot for vision analysis | + +## Move Directions + +`forward`, `backward`, `left`, `right`, `turn_left`, `turn_right` + +Optional: `duration` (seconds, default 1.0), `run` (boolean, default false) + +## Actions + +`activate` — interact with what you're facing (NPCs, doors, items) +`jump` — jump +`attack` — swing weapon / cast spell +`journal` — open journal +`quicksave` — save game (F5) +`quickload` — load last save (F9) +`sneak` — toggle sneak +`wait` — do nothing this cycle + +## Gameplay Loop + +1. **Perceive first** — always call `mcp_mw_perceive` before deciding what to do +2. **Act once** — one move or action per cycle, then perceive again +3. **Quicksave often** — before entering new areas, before combat, before talking to NPCs +4. **If a tool call fails** — check the exact tool name. Do NOT retry the same broken call. + +## Error Recovery + +If you get "Method not found": +- You used the wrong tool name. The tools above are the ONLY valid names. +- Stop. Check spelling. Try again with the correct name. +- If it still fails after 2 attempts, report the error and stop calling MCP tools. + +## What You Can See + +Perception returns: +- `cell` — current location name +- `position` — x,y,z coordinates +- `yaw` — facing direction (radians) +- `health`, `magicka`, `fatigue` — vital stats +- `npcs` — nearby NPCs with name and distance +- `doors` — nearby doors with name and distance +- `items` — nearby items with name and distance +- `mode` — current mode (walking, combat, menu, etc.) +- `game_time` — in-game time diff --git a/morrowind/mcp_config.yaml b/morrowind/mcp_config.yaml new file mode 100644 index 0000000..f00a319 --- /dev/null +++ b/morrowind/mcp_config.yaml @@ -0,0 +1,86 @@ +# ═══════════════════════════════════════════════════════════════════════ +# Morrowind MCP — Runtime Configuration +# ═══════════════════════════════════════════════════════════════════════ +# Edit this file to tune Timmy's Morrowind gameplay without code changes. +# Hermes loads this at session start. Changes take effect next session. +# +# Location: ~/.timmy/morrowind/mcp_config.yaml +# ═══════════════════════════════════════════════════════════════════════ + +# ── Server Identity ─────────────────────────────────────────────────── +# The key under mcp_servers in config.yaml. Hermes prefixes every tool +# with "mcp_{server_key}_", so shorter = less room for the model to +# hallucinate. If you rename this, also update config.yaml to match. +server_key: mw + +# ── Tool Names ──────────────────────────────────────────────────────── +# Exact tool names Hermes registers. Injected into the context file +# so the model never has to guess. Update if you add tools to +# mcp_server.py or change the server_key above. +tools: + - name: mcp_mw_perceive + hint: "Read game world state: position, health, nearby NPCs/doors/items" + - name: mcp_mw_status + hint: "Check if OpenMW is running" + - name: mcp_mw_move + hint: "Move player — direction: forward|backward|left|right|turn_left|turn_right, duration in seconds" + - name: mcp_mw_action + hint: "Game action — activate|jump|attack|journal|quicksave|quickload|sneak|wait" + - name: mcp_mw_screenshot + hint: "Take a screenshot for vision analysis" + +# ── Gameplay Guards ─────────────────────────────────────────────────── +# Caps and safety rails. All optional — comment out to disable. +guards: + # Max consecutive tool errors before Timmy should stop and reflect. + # Prevents the "30 iterations of Method not found" loop. + max_consecutive_errors: 3 + + # Max total MCP calls per session. 0 = unlimited. + max_mcp_calls_per_session: 0 + + # Seconds to pause between action calls (prevents input spam). + action_cooldown_seconds: 0.5 + + # Auto-quicksave every N action cycles. 0 = never. + auto_quicksave_interval: 25 + +# ── Perception ──────────────────────────────────────────────────────── +perception: + # How often the Lua engine writes perception blocks (seconds). + # Must match the timer interval in your OpenMW Lua script. + lua_tick_interval: 2.0 + + # Path to OpenMW log (source of perception data). + # Tilde-expanded at runtime. + openmw_log: "~/Library/Preferences/openmw/openmw.log" + + # Screenshot directory. + screenshot_dir: "~/.timmy/morrowind/screenshots" + +# ── Gameplay Tuning ─────────────────────────────────────────────────── +gameplay: + # Default move duration when not specified. + default_move_duration: 1.0 + + # Default model for gameplay sessions (empty = use config.yaml default). + model: "" + + # System prompt additions for gameplay sessions. + # Injected after SOUL.md, before the conversation. + system_prompt_suffix: | + You are playing Morrowind via MCP tools. + Use EXACT tool names from your context — never abbreviate or guess. + If a tool call fails, check the name against your available tools before retrying. + Perceive before acting. Quicksave before risky moves. + +# ── Trajectory Logging ──────────────────────────────────────────────── +trajectories: + # Log every perception-action pair for DPO training. + enabled: true + + # Directory for trajectory JSONL files. + dir: "~/.timmy/morrowind/trajectories" + + # Max file size before rotation (MB). 0 = no rotation. + max_file_mb: 50