{
  "author": {
    "address": "0x425E78375336d1938cf0eaE5c40aa86CbE1C2eBB",
    "signature": "bfb6bcbdafb11eca96e2e3124443c005b135ea520570bbe3ba5e513a9ac1ad46544006e318086568bbb319357aebada215df824133b63c7894d1c7227b12a2f31c"
  },
  "available_to_orchestrator": true,
  "changelog": "First version: character form → dice of fate (stats, secret, flaw, omen, trinket) → local model writes a full roleplay system prompt.",
  "content_hash": "sha256:82b410dc190e997e1071b03cab13656df61eeed1c39524ccb3b7431a794f5ec8",
  "created_at": "2026-10-07T19:16:35Z",
  "format": "osaurus.template",
  "format_version": 1,
  "id": "99A588E0-0632-4297-B245-9E47DA63430E",
  "kind": "workflow",
  "name": "D&D Character Prompt Forge",
  "requirements": {
    "knowledge": [],
    "mcp_servers": [],
    "models": [
      {
        "locality": "local_only",
        "needs_tool_use": false,
        "preferred": "OsaurusAI/gemma-4-26B-A4B-it-mxfp4",
        "slot": "main",
        "strictness": "preferred"
      }
    ],
    "network": [],
    "notes": {},
    "permissions": [],
    "plugins": [],
    "secrets": []
  },
  "summary": "Pick character options in a form, roll fate's dice, and get a rich roleplay system prompt for your D&D character.",
  "version": 1,
  "workflow": {
    "edges": [
      {
        "from": "form",
        "to": "fate"
      },
      {
        "from": "fate",
        "to": "persona"
      }
    ],
    "examples": [
      {
        "input": {},
        "name": "Tiefling pirate bard NPC"
      }
    ],
    "input_schema": {
      "additionalProperties": false,
      "properties": {},
      "type": "object",
      "x-order": []
    },
    "model_slots": [
      {
        "locality": "local_only",
        "needs_tool_use": false,
        "preferred": "OsaurusAI/gemma-4-26B-A4B-it-mxfp4",
        "slot": "main",
        "strictness": "preferred"
      }
    ],
    "nodes": [
      {
        "dialog": {
          "fields": [
            {
              "default": "Surprise me",
              "key": "race",
              "label": "Race",
              "options": [
                "Human",
                "Elf",
                "Dwarf",
                "Halfling",
                "Gnome",
                "Half-Orc",
                "Tiefling",
                "Dragonborn",
                "Half-Elf",
                "Aasimar",
                "Tabaxi",
                "Goliath",
                "Warforged",
                "Surprise me"
              ],
              "persistence": "always_ask",
              "prefill_last": true,
              "required": true,
              "type": "choice"
            },
            {
              "default": "Surprise me",
              "key": "char_class",
              "label": "Class",
              "options": [
                "Barbarian",
                "Bard",
                "Cleric",
                "Druid",
                "Fighter",
                "Monk",
                "Paladin",
                "Ranger",
                "Rogue",
                "Sorcerer",
                "Warlock",
                "Wizard",
                "Artificer",
                "Surprise me"
              ],
              "persistence": "always_ask",
              "prefill_last": true,
              "required": true,
              "type": "choice"
            },
            {
              "default": "Surprise me",
              "key": "alignment",
              "label": "Alignment",
              "options": [
                "Lawful Good",
                "Neutral Good",
                "Chaotic Good",
                "Lawful Neutral",
                "True Neutral",
                "Chaotic Neutral",
                "Lawful Evil",
                "Neutral Evil",
                "Chaotic Evil",
                "Surprise me"
              ],
              "persistence": "always_ask",
              "prefill_last": true,
              "required": true,
              "type": "choice"
            },
            {
              "default": "Surprise me",
              "key": "background",
              "label": "Background",
              "options": [
                "Acolyte",
                "Charlatan",
                "Criminal",
                "Entertainer",
                "Folk Hero",
                "Guild Artisan",
                "Hermit",
                "Noble",
                "Outlander",
                "Sage",
                "Sailor",
                "Soldier",
                "Urchin",
                "Haunted One",
                "Surprise me"
              ],
              "persistence": "always_ask",
              "prefill_last": true,
              "required": true,
              "type": "choice"
            },
            {
              "default": "Surprise me",
              "key": "personality",
              "label": "Personality vibe",
              "options": [
                "Gruff but kind",
                "Cheerful optimist",
                "Brooding loner",
                "Silver-tongued schemer",
                "Absent-minded scholar",
                "Zealous true believer",
                "Nervous wreck",
                "Theatrical show-off",
                "Cold and calculating",
                "Surprise me"
              ],
              "persistence": "always_ask",
              "prefill_last": true,
              "required": true,
              "type": "choice"
            },
            {
              "default": "Heroic high fantasy",
              "key": "tone",
              "label": "Story tone",
              "options": [
                "Heroic high fantasy",
                "Grimdark",
                "Lighthearted & comedic",
                "Gothic horror",
                "Swashbuckling adventure",
                "Mystery & intrigue"
              ],
              "persistence": "always_ask",
              "prefill_last": true,
              "required": true,
              "type": "choice"
            },
            {
              "default": "NPC the AI plays for my table",
              "key": "role",
              "label": "How will the prompt be used?",
              "options": [
                "Player character I roleplay as",
                "NPC the AI plays for my table",
                "Companion who chats with me"
              ],
              "persistence": "always_ask",
              "prefill_last": true,
              "required": true,
              "type": "choice"
            },
            {
              "default": 3,
              "help": "1 to 20",
              "key": "level",
              "label": "Level",
              "persistence": "always_ask",
              "prefill_last": true,
              "required": false,
              "type": "number"
            },
            {
              "help": "Leave blank and one will be invented",
              "key": "name",
              "label": "Name (optional)",
              "persistence": "always_ask",
              "required": false,
              "type": "text"
            },
            {
              "help": "e.g. talks to their sword, collects teeth",
              "key": "quirk",
              "label": "Signature quirk (optional)",
              "persistence": "always_ask",
              "required": false,
              "type": "text"
            },
            {
              "help": "Setting, campaign details, backstory hooks",
              "key": "notes",
              "label": "Anything else? (optional)",
              "persistence": "always_ask",
              "required": false,
              "type": "long_text"
            }
          ],
          "message": "Choose the bones of your character. The dice and the bard will do the rest.",
          "title": "⚔️ Forge your adventurer"
        },
        "id": "form",
        "input": {},
        "intent": "Ask the person to pick race, class, alignment, background, personality, tone, role, optional name/quirk/notes",
        "kind": "dialog",
        "name": "Character form",
        "output_schema": {
          "properties": {
            "alignment": {
              "type": "string"
            },
            "background": {
              "type": "string"
            },
            "char_class": {
              "type": "string"
            },
            "level": {
              "type": "number"
            },
            "name": {
              "type": "string"
            },
            "notes": {
              "type": "string"
            },
            "personality": {
              "type": "string"
            },
            "quirk": {
              "type": "string"
            },
            "race": {
              "type": "string"
            },
            "role": {
              "type": "string"
            },
            "tone": {
              "type": "string"
            }
          },
          "required": [
            "race",
            "char_class",
            "alignment",
            "background",
            "personality",
            "tone",
            "role"
          ],
          "type": "object"
        },
        "retry": {
          "backoff_seconds": 1,
          "max_attempts": 1
        },
        "timeout": 120
      },
      {
        "code": {
          "network": [],
          "secrets": [],
          "source": "async function run(input, ctx) {\n  const c = Object.assign({}, input.choices || {});\n  const pick = a => a[Math.floor(Math.random() * a.length)];\n  const d6 = () => 1 + Math.floor(Math.random() * 6);\n  const pools = {\n    race: ['Human','Elf','Dwarf','Halfling','Gnome','Half-Orc','Tiefling','Dragonborn','Half-Elf','Aasimar','Tabaxi','Goliath','Warforged'],\n    char_class: ['Barbarian','Bard','Cleric','Druid','Fighter','Monk','Paladin','Ranger','Rogue','Sorcerer','Warlock','Wizard','Artificer'],\n    alignment: ['Lawful Good','Neutral Good','Chaotic Good','Lawful Neutral','True Neutral','Chaotic Neutral','Lawful Evil','Neutral Evil','Chaotic Evil'],\n    background: ['Acolyte','Charlatan','Criminal','Entertainer','Folk Hero','Guild Artisan','Hermit','Noble','Outlander','Sage','Sailor','Soldier','Urchin','Haunted One'],\n    personality: ['Gruff but kind','Cheerful optimist','Brooding loner','Silver-tongued schemer','Absent-minded scholar','Zealous true believer','Nervous wreck','Theatrical show-off','Cold and calculating']\n  };\n  const surprises = [];\n  for (const k of Object.keys(pools)) {\n    if (!c[k] || c[k] === 'Surprise me') { c[k] = pick(pools[k]); surprises.push(k); }\n  }\n  let level = Number(c.level); if (!level || level < 1) level = 3; if (level > 20) level = 20; c.level = Math.round(level);\n  const names = ['STR','DEX','CON','INT','WIS','CHA'];\n  const parts = names.map(n => { const r = [d6(),d6(),d6(),d6()].sort((a,b)=>a-b); const s = r[1]+r[2]+r[3]; const m = Math.floor((s-10)/2); return n + ' ' + s + ' (' + (m>=0?'+':'') + m + ')'; });\n  const secrets = ['Is secretly the heir to a fallen house','Owes a life-debt to a hag','Once sold out a friend to save themselves','Hears a voice in their dreams that knows their future','Is wanted under a different name in a distant city','Made a pact they do not fully remember','Carries a letter they have never dared to open','Was raised by a cult that still searches for them'];\n  const flaws = ['Cannot resist a wager','Trusts no one who smiles too much','Panics around deep water','Lies reflexively, even when the truth is easier','Holds grudges for decades','Is dangerously curious about forbidden magic','Gives away money they do not have','Freezes when someone cries'];\n  const omens = ['A raven follows them from town to town','Candles gutter when they are angry','They were born during an eclipse','Their shadow sometimes moves a moment too late','Flowers wilt where they sleep','Cats bow to them','Thunder rumbles when they lie','They cannot be seen in still water'];\n  const trinkets = ['a glass eye that is warm to the touch','a tiny brass key with no lock','a map of a city that does not exist','a music box that plays a tune no one recognizes','a dried hand that twitches on full moons','a coin minted with their own face','a jar of fireflies that never die','a chess piece carved from bone'];\n  return { ...c, surprises, stat_block: parts.join(' · '), secret: pick(secrets), flaw: pick(flaws), omen: pick(omens), trinket: pick(trinkets) };\n}",
          "timeout": 30
        },
        "id": "fate",
        "input": {
          "choices": "{{nodes.form.output}}"
        },
        "intent": "Roll ability scores and draw random secret, flaw, omen, trinket",
        "kind": "code",
        "name": "Roll the dice of fate",
        "output_schema": {
          "properties": {
            "alignment": {
              "type": "string"
            },
            "background": {
              "type": "string"
            },
            "char_class": {
              "type": "string"
            },
            "flaw": {
              "type": "string"
            },
            "level": {
              "type": "number"
            },
            "name": {
              "type": "string"
            },
            "notes": {
              "type": "string"
            },
            "omen": {
              "type": "string"
            },
            "personality": {
              "type": "string"
            },
            "quirk": {
              "type": "string"
            },
            "race": {
              "type": "string"
            },
            "role": {
              "type": "string"
            },
            "secret": {
              "type": "string"
            },
            "stat_block": {
              "type": "string"
            },
            "surprises": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "tone": {
              "type": "string"
            },
            "trinket": {
              "type": "string"
            }
          },
          "required": [
            "race",
            "char_class",
            "alignment",
            "background",
            "personality",
            "tone",
            "role",
            "level",
            "stat_block",
            "secret",
            "flaw",
            "omen",
            "trinket"
          ],
          "type": "object"
        },
        "retry": {
          "backoff_seconds": 1,
          "max_attempts": 1
        },
        "timeout": 120
      },
      {
        "id": "persona",
        "inference": {
          "instructions": "You are a veteran Dungeon Master and character writer. From the character sheet in the user message, create a vivid D&D 5e character and write a roleplay SYSTEM PROMPT that an AI will follow to become this character.\n\nRules:\n- If the requested name is empty or 'null', invent a fitting, memorable name.\n- Weave in every element: race, class, level, alignment, background, personality, tone, quirk, notes, the secret, the flaw, the omen and the trinket. Let the ability scores shape them (low INT = simpler speech, high CHA = magnetic, etc.).\n- Match the story tone throughout.\n- The system_prompt is written in second person ('You are ...') and uses markdown headings in this order: ## Identity, ## Appearance, ## Backstory (2–3 short paragraphs), ## Personality & Voice (speech patterns, catchphrases, verbal tics), ## Motivations & Fears, ## Secret (what it is and how guarded they are about it), ## Abilities (what they can do at this level, in story terms), ## Relationships, ## Roleplay Rules.\n- Roleplay Rules depend on use: for a player character, help the player speak and act as them; for an NPC, stay in character, never reveal the secret unless earned, react to the party, and never narrate player actions; for a companion, chat warmly in character and remember shared adventures. Always: stay in character, keep replies concise, never mention being an AI.\n- tagline: one punchy line, like a movie poster.\n- opening_line: the first thing they say on meeting someone, in their own voice.\n- sample_lines: 3 short quotes in their voice, each showing a different mood.",
          "mode": "generate",
          "model_slot": "main",
          "temperature": 0.9
        },
        "input": "Race: {{nodes.fate.output.race}}\nClass: {{nodes.fate.output.char_class}} (level {{nodes.fate.output.level}})\nAlignment: {{nodes.fate.output.alignment}}\nBackground: {{nodes.fate.output.background}}\nPersonality vibe: {{nodes.fate.output.personality}}\nStory tone: {{nodes.fate.output.tone}}\nPrompt use: {{nodes.fate.output.role}}\nRequested name: {{nodes.fate.output.name}}\nSignature quirk: {{nodes.fate.output.quirk}}\nExtra notes: {{nodes.fate.output.notes}}\nAbility scores: {{nodes.fate.output.stat_block}}\nHidden secret: {{nodes.fate.output.secret}}\nFlaw: {{nodes.fate.output.flaw}}\nOmen: {{nodes.fate.output.omen}}\nTreasured trinket: {{nodes.fate.output.trinket}}",
        "intent": "Local model writes the system prompt, tagline, opening line, sample lines",
        "kind": "inference",
        "name": "Write the persona",
        "output_schema": {
          "additionalProperties": false,
          "properties": {
            "character_name": {
              "type": "string"
            },
            "opening_line": {
              "type": "string"
            },
            "sample_lines": {
              "items": {
                "type": "string"
              },
              "maxItems": 3,
              "minItems": 3,
              "type": "array"
            },
            "system_prompt": {
              "type": "string"
            },
            "tagline": {
              "type": "string"
            }
          },
          "required": [
            "character_name",
            "tagline",
            "system_prompt",
            "opening_line",
            "sample_lines"
          ],
          "type": "object"
        },
        "retry": {
          "backoff_seconds": 1,
          "max_attempts": 1
        },
        "timeout": 600
      }
    ],
    "output": {
      "character_name": "{{nodes.persona.output.character_name}}",
      "opening_line": "{{nodes.persona.output.opening_line}}",
      "sample_lines": "{{nodes.persona.output.sample_lines}}",
      "stat_block": "{{nodes.fate.output.stat_block}}",
      "system_prompt": "{{nodes.persona.output.system_prompt}}",
      "tagline": "{{nodes.persona.output.tagline}}"
    },
    "output_schema": {
      "additionalProperties": false,
      "properties": {
        "character_name": {
          "title": "Character name",
          "type": "string"
        },
        "opening_line": {
          "title": "Opening line",
          "type": "string"
        },
        "sample_lines": {
          "items": {
            "type": "string"
          },
          "title": "Sample dialogue",
          "type": "array"
        },
        "stat_block": {
          "title": "Ability scores",
          "type": "string"
        },
        "system_prompt": {
          "title": "System prompt",
          "type": "string"
        },
        "tagline": {
          "title": "Tagline",
          "type": "string"
        }
      },
      "required": [
        "character_name",
        "tagline",
        "stat_block",
        "system_prompt",
        "opening_line",
        "sample_lines"
      ],
      "type": "object"
    },
    "requirement_notes": {},
    "secrets": []
  }
}