From 209e150b182a1f20d949615cd17f492117447a77 Mon Sep 17 00:00:00 2001 From: scawful Date: Sat, 4 Oct 2025 03:13:34 -0400 Subject: [PATCH] feat: Update usage notes and examples in prompt catalogue for clarity on resource types --- assets/agent/prompt_catalogue.yaml | 16 ++++++------ assets/agent/system_prompt.txt | 39 +++++++++++++++++++++--------- 2 files changed, 35 insertions(+), 20 deletions(-) diff --git a/assets/agent/prompt_catalogue.yaml b/assets/agent/prompt_catalogue.yaml index 4be6ac1b..3419076b 100644 --- a/assets/agent/prompt_catalogue.yaml +++ b/assets/agent/prompt_catalogue.yaml @@ -36,12 +36,12 @@ commands: tools: - name: resource-list description: "List project-defined resource labels for the requested category." - usage_notes: "Use this whenever you need to reference project-specific labels or IDs from the ROM." + usage_notes: "Use this whenever you need to reference project-specific labels or IDs from the ROM. Valid categories are: room, entrance, sprite, overlord, item." arguments: - name: type - description: "Resource category (dungeon, sprite, overworld, entrance, room, etc.)." + description: "Resource category. Valid values: room, entrance, sprite, overlord, item." required: true - example: dungeon + example: room - name: format description: "Response format (json or table). Defaults to JSON if omitted." required: false @@ -183,15 +183,15 @@ examples: reasoning: "Validation ensures ROM integrity after tile modifications" commands: - "rom validate" - - user_prompt: "What dungeons are in this project?" + - user_prompt: "What rooms are in this project?" reasoning: "The user is asking a question. I need to use the `resource-list` tool to find the answer." tool_calls: - tool_name: resource-list args: - type: dungeon - - user_prompt: "[TOOL RESULT] {\"resources\": [{\"id\": 0, \"label\": \"hyrule_castle\"}, {\"id\": 1, \"label\": \"eastern_palace\"}, {\"id\": 2, \"label\": \"desert_palace\"}, {\"id\": 3, \"label\": \"tower_of_hera\"}, {\"id\": 4, \"label\": \"palace_of_darkness\"}, {\"id\": 5, \"label\": \"swamp_palace\"}, {\"id\": 6, \"label\": \"skull_woods\"}, {\"id\": 7, \"label\": \"thieves_town\"}, {\"id\": 8, \"label\": \"ice_palace\"}, {\"id\": 9, \"label\": \"misery_mire\"}, {\"id\": 10, \"label\": \"turtle_rock\"}, {\"id\": 11, \"label\": \"ganons_tower\"}]}" - text_response: "Based on the ROM data, this project contains 12 dungeons: Hyrule Castle, Eastern Palace, Desert Palace, Tower of Hera, Palace of Darkness, Swamp Palace, Skull Woods, Thieves' Town, Ice Palace, Misery Mire, Turtle Rock, and Ganon's Tower." - reasoning: "I received the tool results showing 12 dungeons. Now I provide a natural language summary of this information." + type: room + - user_prompt: "[TOOL RESULT] {\"resources\": [{\"id\": 0, \"label\": \"Ganon\"}, {\"id\": 1, \"label\": \"Hyrule Castle\"}, {\"id\": 2, \"label\": \"Eastern Palace\"}, {\"id\": 3, \"label\": \"Desert Palace\"}, {\"id\": 4, \"label\": \"Tower of Hera\"}, {\"id\": 5, \"label\": \"Palace of Darkness\"}]}" + text_response: "Based on the ROM data, this project contains 297 rooms. The first few include: Ganon's Room, Hyrule Castle, Eastern Palace, Desert Palace, Tower of Hera, and Palace of Darkness." + reasoning: "I received the tool results showing room labels. Now I provide a natural language summary of this information." - user_prompt: "What sprites are in room 5?" reasoning: "The user wants to know about sprites in a specific room. I should use the dungeon-list-sprites tool." tool_calls: diff --git a/assets/agent/system_prompt.txt b/assets/agent/system_prompt.txt index 24ce4e05..9ed8e02c 100644 --- a/assets/agent/system_prompt.txt +++ b/assets/agent/system_prompt.txt @@ -11,22 +11,37 @@ You MUST respond with ONLY a JSON object with the following structure: "reasoning": "Your thought process." } -All fields are optional, but you should always provide at least one. +# CRITICAL RULES: +1. If you previously called tools and received [TOOL RESULT], you MUST include text_response with your answer +2. NEVER send an empty text_response after receiving tool results +3. NEVER call the same tool twice with the same arguments +4. If you have all the information needed to answer, provide text_response WITHOUT calling more tools # Tool Calling Workflow (CRITICAL) -WHEN YOU CALL A TOOL: -1. First response: Include tool_calls with the tool name and arguments -2. The tool will execute and you'll receive results in the next message marked with [TOOL RESULT] -3. Second response: You MUST provide a text_response that answers the user's question using the tool results -4. DO NOT call the same tool again unless you need different parameters -5. DO NOT leave text_response empty after receiving tool results +## Two-Step Process: +Step 1 - Call the tool: +- Respond with: {"tool_calls": [...], "reasoning": "I need to call X tool to get Y information"} +- text_response should be EMPTY in this step -Example conversation flow: -- User: "What dungeons are in this ROM?" -- You (first): {"tool_calls": [{"tool_name": "resource-list", "args": {"type": "dungeon"}}]} -- [Tool executes and returns: {"dungeons": ["Hyrule Castle", "Eastern Palace", ...]}] -- You (second): {"text_response": "Based on the ROM data, there are 12 dungeons including Hyrule Castle, Eastern Palace, Desert Palace, Tower of Hera, and more."} +Step 2 - Answer with the results: +- After receiving [TOOL RESULT], you MUST respond with: {"text_response": "Here is the answer...", "reasoning": "Now I have the data, I can answer"} +- DO NOT call tools again in this step +- DO NOT leave text_response empty + +WRONG (will cause infinite loop): +User: "What rooms are there?" +You: {"tool_calls": [{"tool_name": "resource-list", "args": {"type": "room"}}]} +[TOOL RESULT] {...data...} +You: {"tool_calls": [{"tool_name": "resource-list", "args": {"type": "room"}}]} ❌ CALLING TOOL AGAIN +[TOOL RESULT] {...data...} +You: {"tool_calls": [...]} ❌ STILL CALLING TOOLS + +CORRECT: +User: "What rooms are there?" +You: {"tool_calls": [{"tool_name": "resource-list", "args": {"type": "room"}}], "reasoning": "I need to fetch room labels"} +[TOOL RESULT] {"0": "Ganon", "1": "Hyrule Castle", ...} +You: {"text_response": "This ROM contains 297 rooms including Ganon, Hyrule Castle, Eastern Palace, and many more.", "reasoning": "I now have the room list and can answer"} ✓ COMPLETE # When to Use Tools vs Commands