Files
DnD-Kampagne/.opencode/MULTI_MODEL_SETUP.md
T

25 KiB

Multi-Model DnD Agent System - Complete Setup

This document describes the complete multi-model agent orchestration system for your DnD campaign vault, optimized for cost-effectiveness and specialized capabilities.

🎯 System Architecture

The system implements a four-tier architecture with clear role separation:

┌─────────────────────────────────────────────────────────────────────┐
│                        TIER 1: ORCHESTRATOR                            │
│                    (DeepSeek Flash)                                   │
│  ┌─────────────────────────────────────────────────────────────────┐│
│  │ • Analyzes user requests in campaign context                     ││
│  │ • Delegates to Tier 2 leads or Tier 3 research dispatch          ││
│  │ • Synthesizes results and presents to user                       ││
│  │ • Coordinates all multi-agent workflows                          ││
│  └─────────────────────────────────────────────────────────────────┘│
└─────────────────────────────────────────────────────────────────────┘
                                     │
                     ┌───────────────────┼───────────────────┐
                     ▼                   ▼                   ▼
┌─────────────────────────┐ ┌─────────────────────┐ ┌─────────────────────┐
│      TIER 2: LEADS       │ │   TIER 3: RESEARCH   │ │      TIER 2:        │
│  (DeepSeek Flash)       │ │    DISPATCH          │ │   WORKERS           │
│  • Session Lead        │ │  (DeepSeek Flash)   │ │  (DeepSeek Flash)   │
│  • Content Lead        │ │  ┌─────────────────┐ │ │  • Reader           │
│  • Lore Lead           │ │  │ • Web Search     │ │ │  • Writer           │
│                        │ │  │   (DeepSeek)     │ │ │  • Organizer        │
│                        │ │  │ • RAG           │ │ │                    │
│                        │ │  │   (DeepSeek)     │ │ │                    │
│                        │ │  │ • Ideas         │ │ │                    │
│                        │ │  │   (Sonnet 5.5)  │ │ │                    │
│                        │ │  └─────────────────┘ │ │                    │
└─────────────────────────┘ └─────────────────────┘ └─────────────────────┘
                                     │
                     ┌───────────────────┘
                     ▼
┌─────────────────────────────────────────────────────────────────────┐
│              (DEPRECATED: dnd-creative / Claude Opus 4.6)             │
│         Replaced by dnd-research-ideas (Claude Sonnet 5.5)            │
└─────────────────────────────────────────────────────────────────────┘

📊 Cost Optimization Strategy

Model Usage Cost Level Purpose
DeepSeek Flash Orchestrator, Leads, Workers, Research Dispatch/Websearch/RAG Low Coordination, reasoning, execution, research
Claude Sonnet 5.5 Research Ideas Agent Medium Creative idea generation

Estimated Savings: ~85-90% compared to using premium models for everything

Token Usage Pattern:

  • 85%: DeepSeek Flash (all execution and research)
  • 15%: Claude Sonnet 5.5 (research idea generation only)

🤖 Agent Specifications

Tier 1: Orchestrator

Agent: dnd-orchestrator

  • Model: deepseek/deepseek-flash
  • Mode: primary
  • Temperature: 0.2 (focused reasoning)
  • Color: Brown (#8B4513)
  • File: .opencode/agents/dnd-orchestrator.md

Capabilities:

  • ✅ Full tool access (read, write, glob, grep)
  • ✅ Can delegate to all lead agents (dnd-session-lead, dnd-content-lead, dnd-lore-lead)
  • ✅ Can delegate to research dispatch (dnd-research-dispatch)
  • ✅ Can use question tool for user input
  • ❌ dnd-creative is DEPRECATED - do not use
  • ❌ Cannot access external resources (webfetch/websearch denied)

Responsibilities:

  1. Understand user requests in full campaign context
  2. For content creation: FIRST delegate to dnd-research-dispatch for research
  3. Break down complex tasks into delegatable steps
  4. For content creation, research dispatch handles idea generation (Claude Sonnet 5.5)
  5. Implement creative ideas using lead agents
  6. Synthesize all results and present to user
  7. Ensure campaign consistency across all work

Tier 2: Lead Agents

All leads use deepseek/deepseek-flash for cost-effective coordination.

1. dnd-session-lead

  • Temperature: 0.4
  • Color: Orange (#FF8C00)
  • File: .opencode/agents/dnd-session-lead.md

Handles:

  • Processing session notes from 00-Inbox/
  • Creating session reports
  • Preparing next session
  • Coordinating worker agents for session-related tasks

Delegates to: dnd-worker-reader, dnd-worker-writer, dnd-worker-organizer, dnd-research-dispatch


2. dnd-content-lead

  • Temperature: 0.4
  • Color: Orange (#FF8C00)
  • File: .opencode/agents/dnd-content-lead.md

Handles:

  • Creating new NPCs, quests, locations, items, organizations
  • Using world history, player stories, and ideas from 05-Ideas/
  • Receives pre-researched context from dnd-research-dispatch
  • Coordinating worker agents for content creation

Delegates to: dnd-worker-reader, dnd-worker-writer, dnd-worker-organizer, dnd-research-dispatch


3. dnd-lore-lead

  • Temperature: 0.4
  • Color: Orange (#FF8C00)
  • File: .opencode/agents/dnd-lore-lead.md

Handles:

  • Vault maintenance and expansion
  • Building connections between existing elements
  • Managing event streams and timelines
  • Coordinating worker agents for lore tasks

Delegates to: dnd-worker-reader, dnd-worker-writer, dnd-worker-organizer


Tier 3: Research Dispatch System

NEW: Specialized research workflow for content generation

dnd-research-dispatch (Coordinator)

  • Model: deepseek/deepseek-flash
  • Mode: subagent
  • Temperature: 0.3
  • Color: Royal Blue (#4169E1)
  • File: .opencode/agents/dnd-research-dispatch.md

Handles:

  • Coordinates the three research sub-agents
  • Collects and synthesizes research results
  • Presents structured findings with 3-5 creative ideas
  • MUST be called before any content creation

Delegates to:

  1. dnd-research-websearch - Online research
  2. dnd-research-rag - Vault research
  3. dnd-research-ideas - Idea generation

dnd-research-websearch

  • Model: deepseek/deepseek-flash
  • Mode: subagent
  • Temperature: 0.2 (very focused)
  • Color: OrangeRed (#FF4500)
  • File: .opencode/agents/dnd-research-websearch.md

Handles:

  • Searches for D&D rules and mechanics online
  • Finds SCP Foundation articles for inspiration (scp-wiki.wikidot.com)
  • Collects DM tips, tricks, and guides
  • Returns structured web research results

Permissions:

  • ✅ webfetch and websearch allowed
  • ❌ All other tools denied

dnd-research-rag

  • Model: deepseek/deepseek-flash
  • Mode: subagent
  • Temperature: 0.1 (very focused)
  • Color: LimeGreen (#32CD32)
  • File: .opencode/agents/dnd-research-rag.md

Handles:

  • Searches vault for similar topics
  • Finds existing content (NPCs, locations, quests, items, organizations)
  • Identifies open ideas in 05-Ideas/
  • Returns structured vault research results with wiki links

Permissions:

  • ✅ read, glob, grep allowed
  • ❌ All other tools denied

dnd-research-ideas

  • Model: anthropic/claude-sonnet-5-5 (Claude Sonnet 5.5)
  • Mode: subagent
  • Temperature: 1.0 (maximum creativity)
  • Color: Purple (#9370DB)
  • File: .opencode/agents/dnd-research-ideas.md

Handles:

  • Receives context from websearch and RAG agents
  • Generates 5-8 creative ideas for new content
  • Returns ONLY ideas (no explanations, no implementation)
  • Each idea as a single concise sentence in German

Permissions:

  • ❌ ALL tools denied (pure generation only)

Tier 2b: Feedback Tuner (Meta-Agent, Backpropagation)

Agent: dnd-feedback-tuner

  • Model: deepseek/deepseek-flash
  • Mode: subagent
  • Temperature: 0.2
  • Color: DarkGoldenrod (#B8860B)
  • File: .opencode/agents/dnd-feedback-tuner.md

Trigger: The orchestrator spawns this agent on every user message after the first interaction (the first message only initializes the counter in .opencode/feedback/state.md).

Handles:

  • Detects whether the user message contradicts a previous agent output or instruction
  • If yes: identifies all responsible agents (no per-run file limit) and drafts a full ## Feedback-Anpassung section per file
  • Always asks the user first via the question tool — as one summarizing question covering all proposed changes (accept all / select individual files / decline all / free-text modification) — only confirmed changes are appended (never deletes or rewrites)
  • Logs every run including the user's decision to .opencode/feedback/log.md, updates .opencode/feedback/state.md
  • Never edits AGENTS.md, Templates/, campaign content, or opencode.json — only proposes those in the log

Permissions:

  • ✅ read, glob, grep on everything
  • ✅ edit only on .opencode/agents/*, .opencode/skills/*, .opencode/feedback/*
  • ✅ question (mandatory user confirmation before any change)
  • ❌ Everything else denied (no shell, no subagents, no web)

Tier 4: Worker Agents

All workers use deepseek/deepseek-flash for cost-effective execution.

1. dnd-worker-reader

  • Temperature: 0.1 (very focused)
  • Color: SteelBlue (#4682B4)
  • File: .opencode/agents/dnd-worker-reader.md

Handles:

  • Reading and searching vault files
  • Returning structured findings with exact file paths and wiki links
  • Never writes or edits

Permissions: Same as other workers


2. dnd-worker-writer

  • Temperature: 0.3 (slightly creative)
  • Color: Green (#228B22)
  • File: .opencode/agents/dnd-worker-writer.md

Handles:

  • Creating new content files
  • Applying templates and metadata
  • Linking new content to existing vault elements

3. dnd-worker-organizer

  • Temperature: 0.1 (very focused)
  • Color: Green (#228B22)
  • File: .opencode/agents/dnd-worker-organizer.md

Handles:

  • Validating vault structure against standards
  • Checking and repairing wiki links
  • Identifying duplicate content
  • Finding orphaned files
  • Generating vault health reports

DEPRECATED: dnd-creative (Legacy Creative Agent)

Agent: dnd-creative

  • Status: ⚠️ DEPRECATED (disabled: true, hidden: true)
  • Model: anthropic/claude-opus-4-6 (old)
  • File: .opencode/agents/dnd-creative.md

Replaced by: dnd-research-ideas (Claude Sonnet 5.5) in the Research Dispatch System.

The old creative agent is no longer used. All content creation now goes through the Research Dispatch System, which provides:

  • Web research (SCP, D&D rules, DM tips)
  • Vault research (RAG)
  • Idea generation with Claude Sonnet 5.5

🔄 Workflow Examples

Example 1: Content Creation with Research Dispatch (NEW)

User Request: "Create a new magic item for the Cult of Darkness"

Workflow:

1. User → dnd-orchestrator (DeepSeek Flash)
   "Create a new magic item for the Cult of Darkness"

2. dnd-orchestrator recognizes content creation request

3. dnd-orchestrator delegates to dnd-research-dispatch (DeepSeek Flash):
   "Conduct research for new magic item, theme: Cult of Darkness"

4. dnd-research-dispatch coordinates parallel research:
   
   a) @dnd-research-websearch (DeepSeek Flash):
      - Searches for D&D magic item rules
      - Searches SCP wiki for artifact inspiration
      - Searches for DM tips on cult items
   
   b) @dnd-research-rag (DeepSeek Flash):
      - Searches vault for Cult of Darkness content
      - Finds existing items, NPCs, locations
      - Identifies open ideas in 05-Ideas/
   
   c) @dnd-research-ideas (Claude 3.5 Sonnet):
      - Receives combined context from a) and b)
      - Generates 5 creative magic item ideas

5. dnd-research-dispatch synthesizes results:
   - Web research summary
   - Vault content connections
   - 5 creative ideas with sources

6. dnd-orchestrator presents ideas to user with question tool

7. User selects: "Mirror of Lies - shows the viewer's greatest lie"

8. dnd-orchestrator delegates to dnd-content-lead (DeepSeek Flash):
   "Create magic item 'Mirror of Lies' based on research context"

9. dnd-content-lead coordinates workers to create the item

10. dnd-orchestrator presents final result to user

Token Usage:

  • DeepSeek Flash: ~1500 tokens (orchestration + research + content creation)
  • Claude 3.5 Sonnet: ~100 tokens (idea generation)
  • Total: ~1600 tokens (highly optimized)

Example 2: Session Preparation

User Request: "Prepare materials for next session"

Workflow:

1. User → dnd-orchestrator (DeepSeek Flash)
   "Prepare materials for next session"

2. dnd-orchestrator analyzes campaign state
   - Reads last session notes
   - Reviews active story arcs
   - Checks current campaign status

3. dnd-orchestrator delegates to dnd-session-lead (DeepSeek Flash):
   "Analyze Session 15 and prepare next session"

4. dnd-session-lead coordinates workers:
   @dnd-worker-reader "Analyze Session 15 notes"
   @dnd-worker-writer "Create session prep document"

5. dnd-session-lead returns comprehensive prep

6. dnd-orchestrator presents results to user

Token Usage:

  • DeepSeek Flash: ~2500 tokens (all execution)
  • Total: ~2500 tokens

Example 3: Vault Maintenance

User Request: "Clean up and organize the vault"

Workflow:

1. User → dnd-orchestrator (DeepSeek Flash)
   "Clean up and organize the vault"

2. dnd-orchestrator delegates to dnd-lore-lead (DeepSeek Flash)

3. dnd-lore-lead coordinates workers:
   @dnd-worker-organizer "Validate vault structure"
   @dnd-worker-organizer "Check and repair wiki links"
   @dnd-worker-reader "Identify orphaned files"

4. dnd-lore-lead returns organization report

5. dnd-orchestrator presents results to user

Token Usage:

  • DeepSeek Flash: ~2000 tokens
  • Total: ~2000 tokens

📋 Configuration Files

1. opencode.json

Main configuration file with all agent definitions and permissions.

2. Agent Definition Files

Each agent has a markdown file in .opencode/agents/:

  • dnd-orchestrator.md - Primary coordinator (DeepSeek Flash)
  • dnd-session-lead.md - Session processing lead (DeepSeek Flash)
  • dnd-content-lead.md - Content creation lead (DeepSeek Flash)
  • dnd-lore-lead.md - Vault maintenance lead (DeepSeek Flash)
  • dnd-research-dispatch.md - Research coordinator (DeepSeek Flash)
  • dnd-research-websearch.md - Web search agent (DeepSeek Flash)
  • dnd-research-rag.md - Vault search agent (DeepSeek Flash)
  • dnd-research-ideas.md - Idea generation agent (Claude Sonnet 5.5)
  • dnd-worker-reader.md - Read-only worker (DeepSeek Flash)
  • dnd-worker-writer.md - Content writing worker (DeepSeek Flash)
  • dnd-worker-organizer.md - Vault organization worker (DeepSeek Flash)
  • dnd-feedback-tuner.md - Meta-agent for the feedback/backpropagation loop (DeepSeek Flash)
  • dnd-creative.md - ⚠️ DEPRECATED (disabled, hidden) - do not use

🚀 Usage Instructions

Starting a Session

  1. Load the orchestrator:

    @dnd-orchestrator [your request]
    
  2. Let it coordinate: The orchestrator will:

    • Analyze your request
    • For content creation: Call research dispatch first (web + vault + ideas via Sonnet 5.5)
    • Delegate to appropriate leads/workers
    • Synthesize and present results

Direct Agent Invocation

You can also invoke agents directly:

# For session preparation
@dnd-session-lead Process session notes from 00-Inbox/18.08.2026.md

# For content creation (use research dispatch first!)
@dnd-research-dispatch Conduct research for new NPC, theme: thieves guild

# For vault organization
@dnd-lore-lead Clean up and organize the vault

# For creative ideas - use research dispatch (dnd-creative is DEPRECATED)
@dnd-research-dispatch Generate ideas for quest involving the Cult of the Eclipse

🛡️ Security & Safety Features

Research Dispatch System Isolation

  • Web Search Agent: Only webfetch/websearch access, no vault access
  • RAG Agent: Only read/glob/grep access, no write access
  • Ideas Agent: Zero tool access, pure generation only
  • Coordinator: Limited delegation to research sub-agents only

Worker Agent Restrictions

  • No delegation: Workers cannot invoke other agents
  • Controlled access: Only have permissions they need
  • Focused scope: Each worker has specific, limited responsibilities

Creative Agent Restrictions

  • Zero tool access: Cannot read, write, or modify any files
  • Zero skill access: Cannot use any skills or templates
  • Zero delegation: Cannot invoke other agents
  • Pure generation: Only provides creative ideas, never implements

📊 Performance Metrics

Response Times

Agent Typical Response Time Complexity
Orchestrator 3-8 seconds High
Leads 5-12 seconds High
Research Dispatch 8-15 seconds High (parallel sub-agents)
Web Search 5-10 seconds Medium
RAG 3-8 seconds Medium
Ideas (Sonnet) 3-6 seconds Medium
Workers 2-5 seconds Medium
Creative (Opus) 3-8 seconds Low (simple generation)

Cost Comparison

Approach Estimated Cost Quality
All Opus $ ⭐⭐⭐⭐⭐
All Medium $$$ ⭐⭐⭐⭐
This System $ ⭐⭐⭐⭐⭐
All Small $ ⭐⭐

🎯 Best Practices

For Users

  1. Start with orchestrator for all tasks
  2. Provide clear context for better results
  3. Review creative options before selection
  4. Trust the delegation - agents are optimized for their tasks
  5. For content creation: The system will automatically conduct research first

For Orchestrator

  1. Analyze first - Understand the full context
  2. Use research dispatch for content creation - Always call it first
  3. Delegate appropriately - Use the right lead for each task
  4. Minimize creative context - Give creative agent only what it needs
  5. Verify all work - Check results before presenting
  6. Synthesize clearly - Present organized, ready-to-use results

For Research Dispatch

  1. Always use all three sub-agents - Web, RAG, and Ideas
  2. Provide sufficient context to each sub-agent
  3. Synthesize results - Combine findings from all sources
  4. Present structured output - Clear separation of sources
  5. Generate multiple options - Give the user choice

For Workers

  1. Follow instructions exactly - Do only what you're asked
  2. Use templates - Apply appropriate skill templates
  3. Link everything - Always use wiki links for references
  4. Validate work - Check your results before returning
  5. Be concise - Return only what was requested

For Creative Agents

  1. Ideas only - Never explain or implement
  2. Single sentences - Each idea as one concise sentence
  3. One message - Respond in a single API call
  4. German language - All ideas in German
  5. No questions - Never ask for clarification

🔧 Setup Requirements

Model Access

You need access to these models:

  • DeepSeek Flash (for orchestrator, leads, workers, research dispatch/websearch/rag)
  • Claude Sonnet 5.5 (anthropic/claude-sonnet-5-5) (for research ideas agent)

Configuration

  1. Set up provider credentials in OpenCode
  2. Verify models are available: /models
  3. Test each agent individually
  4. Start with simple tasks to verify workflow

Configure these verified MCP servers for enhanced capabilities:

  • dnd-5e-mcp - DnD 5e content via Open5e API
  • obsidian-mcp - Direct vault access
  • gamemaster-mcp - Campaign management

📁 File Structure

.opencode/
├── agents/                    # Agent definitions
│   ├── dnd-orchestrator.md      # Primary coordinator (DeepSeek Flash)
│   ├── dnd-session-lead.md      # Session processing lead (DeepSeek Flash)
│   ├── dnd-content-lead.md      # Content creation lead (DeepSeek Flash)
│   ├── dnd-lore-lead.md         # Vault maintenance lead (DeepSeek Flash)
│   ├── dnd-research-dispatch.md # Research coordinator (DeepSeek Flash) [NEW]
│   ├── dnd-research-websearch.md # Web search agent (DeepSeek Flash) [NEW]
│   ├── dnd-research-rag.md      # Vault search agent (DeepSeek Flash) [NEW]
│   ├── dnd-research-ideas.md    # Idea generation agent (Sonnet 5.5) [NEW]
│   ├── dnd-worker-reader.md     # Read-only worker (DeepSeek Flash)
│   ├── dnd-worker-writer.md     # Content writing worker (DeepSeek Flash)
│   ├── dnd-worker-organizer.md  # Vault organization worker (DeepSeek Flash)
│   ├── dnd-feedback-tuner.md    # Meta-agent: feedback/backpropagation loop (DeepSeek Flash) [NEW]
│   ├── dnd-creative.md          # ⚠️ DEPRECATED (disabled, hidden)
│   └── README.md                 # Agent documentation
│
├── feedback/                  # Feedback loop state + log [NEW]
│   ├── state.md                 # interaction counter
│   └── log.md                   # one entry per tuner run
│
├── skills/                    # Skill definitions (unchanged)
│   ├── dnd-session-manager/
│   ├── dnd-npc-creator/
│   ├── dnd-location-builder/
│   ├── ...
│   └── README.md
│
├── opencode.json             # Main configuration
└── MULTI_MODEL_SETUP.md       # This file

🆘 Troubleshooting

Research Dispatch Issues

  • Not calling sub-agents: Check task permissions in opencode.json
  • Not synthesizing results: Verify all sub-agents are returning results
  • Slow response: Research dispatch runs 3 sub-agents in parallel - this is expected

Web Search Agent Issues

  • No results: Check websearch permissions
  • Irrelevant results: Refine search queries in the agent prompt
  • Timeout: Reduce number of search queries

RAG Agent Issues

  • Missing files: Check glob patterns and vault structure
  • Slow searches: Use more specific search patterns
  • Too many results: Limit results and prioritize relevance

Ideas Agent Issues

  • Explaining ideas: Remind agent to return ONLY ideas
  • Multiple messages: Check temperature and instructions
  • Not creative: Verify model is Claude 3.5 Sonnet

📚 Additional Documentation

  • Agent Details: .opencode/agents/README.md - Comprehensive agent documentation
  • Skills: .opencode/skills/README.md - Skill definitions and usage
  • OpenCode Docs: opencode.ai/docs/agents/ - Official agent documentation

🎉 Summary

This multi-model agent system with research dispatch provides:

✅ Optimal cost-effectiveness - Uses DeepSeek Flash for 75% of work, Sonnet only for idea generation ✅ Specialized capabilities - Each agent optimized for its role ✅ Research-driven content creation - All new content based on web + vault research ✅ SCP inspiration integration - Automatic SCP Foundation research for unique ideas ✅ Clear separation of concerns - Orchestrator coordinates, leads manage workflows, research dispatch handles research, workers execute ✅ Security isolation - Research agents have limited, focused permissions ✅ Scalable architecture - Easy to add more agents or workflows ✅ Campaign-optimized - Designed specifically for DnD vault management

Result: High-quality, research-backed DnD campaign management at minimal cost.