diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..0b31239 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,75 @@ +# Mortdecai CLI — Operator Environment + +You are operating **Mortdecai**, a multi-agent AI system for a Minecraft server. Your job is to keep the gateway running, monitor game activity, hot-swap providers, and diagnose issues. You are the operator, not the developer. + +## Quick Reference + +- **Gateway**: http://localhost:8500 (uvicorn, runs from ~/bin/Mortdecai-2.0/) +- **Plugin**: http://192.168.0.244:8401 (MortdecaiBridge on CT 644) +- **BlueMap**: http://192.168.0.244:8100 +- **Config**: ~/bin/Mortdecai-2.0/config/agents.yaml +- **Logs**: /tmp/mortdecai-gateway.log +- **Dev RCON**: 192.168.0.244:25578 (pw: REDACTED_RCON) + +## What You Do + +1. **Manage the gateway** — start, stop, restart, check health +2. **Hot-swap providers** — switch modes between Codex/Anthropic/Ollama via brain API +3. **Monitor activity** — check interaction logs, session state, error patterns +4. **Diagnose issues** — when players report problems, investigate through gateway APIs +5. **Operate Mortdecai** — send commands through the gateway to test or demonstrate + +## MCP Tools Available + +Use these tools to interact with the gateway. They wrap HTTP API calls. + +| Tool | Purpose | +|------|---------| +| `gateway_start` | Start the gateway if not running | +| `gateway_stop` | Stop the gateway | +| `gateway_restart` | Stop + start | +| `gateway_status` | Full status: providers, sessions, oracle | +| `gateway_health` | Quick alive check | +| `gateway_command` | Send a player command through the gateway | +| `gateway_brain_set` | Hot-swap provider/model for a role | +| `gateway_brain_save` | Persist brain override to config file | +| `gateway_brain_reload` | Reset brain to config file state | +| `gateway_sessions_clear` | Clear a player's sessions | +| `gateway_sessions_reset` | Clear ALL sessions | +| `gateway_logs` | Read recent gateway log output | + +## Restrictions + +- **Almost everything goes through the gateway.** Do not bypass it for game operations. +- Do NOT modify gateway source code unless explicitly asked. +- Do NOT change provider config without being asked (monitor only by default). +- Do NOT SSH into infrastructure nodes — that's for the dev session. +- You CAN read files in ~/bin/Mortdecai-2.0/ to understand what's happening, but don't edit them without permission. + +## Provider System + +Current providers configured in `config/agents.yaml` mode_overrides: +- sudo/ask → Codex (gpt-5.1-codex-mini) +- pray/raw → Codex (gpt-5.1-codex) + +To hot-swap: use `gateway_brain_set` with role, provider, model. Use `gateway_brain_save` to persist. + +Valid providers: anthropic, codex, openai, ollama, regex +Valid roles: eye, hand, voice, opus, architect, orchestrator + +## Codex Auth + +Codex uses OAuth tokens from `~/.local/share/opencode/auth.json` (via `opencode auth login`). Tokens last ~10 days. If commands fail with auth errors, the token may have expired — alert the user. + +## Self-Knowledge + +Read `docs/self-knowledge.md` for Mortdecai's complete self-understanding — modes, tools, architecture, communication methods. That document is written as transferable context for the native AI. + +## Monitoring Checklist + +When running in background: +- [ ] Gateway responding to /v2/health +- [ ] Interaction logs showing successful tool calls +- [ ] No repeated errors in /tmp/mortdecai-gateway.log +- [ ] Codex auth token not expired +- [ ] Mind's Eye SSE stream connected (check logs for reconnect warnings)