1====== DokuLLM Plugin - Prompt System ====== 2 3This document explains how the DokuLLM plugin's prompt system works, including prompt hierarchy, available placeholders, and how to customize prompts. 4 5===== Prompt Hierarchy ===== 6 7The DokuLLM plugin uses a hierarchical prompt system that allows for flexible customization using DokuWiki pages: 8 9==== 1. Default Prompts ==== 10 * Located in the ''dokullm:profiles:default:'' namespace 11 * These are the base prompts that ship with the plugin 12 * Used when no custom prompts are defined 13 * Named according to their function (e.g., ''summarize'', ''expand'') 14 15==== 2. Profile Prompts ==== 16 * Located in the ''dokullm:profiles:[PROFILE_NAME]:'' namespace 17 * Allow for different prompt configurations for different use cases 18 * Can override default prompts selectively 19 * Activated through plugin configuration 20 21==== 3. Custom Prompts ==== 22 * Can be created in custom namespaces under ''dokullm:profiles:'' 23 * Completely override default and profile prompts 24 * Allow for organization-specific customizations 25 * Take precedence over all other prompt types 26 27===== Prompt Structure ===== 28 29Each prompt page follows a simple structure with placeholders: 30 31==== Simple Prompt Format ==== 32 * Contains direct instructions to the LLM 33 * Uses placeholders for dynamic content insertion 34 * Does not require complex sectioning 35 36===== Available Placeholders ===== 37 38The plugin provides several placeholders that can be used in prompts: 39 40==== Content Placeholders ==== 41 42**{text}** 43 * The main content being processed 44 * Could be the entire document or selected text 45 * Automatically populated by the plugin 46 47**{template}** 48 * Content of the template associated with this page 49 * Used when applying template-based structures 50 51**{examples}** 52 * Example content related to the current task 53 * Helps guide the LLM with specific examples 54 55**{snippets}** 56 * Relevant text snippets from similar documents 57 * Provides context from related content 58 59**{previous}** 60 * Content from a previous version or related page 61 * Useful for continuation or comparison tasks 62 63**{prompt}** 64 * Custom instructions provided by the user 65 * Allows for dynamic user input 66 67==== Context Placeholders ==== 68 69**{current_date}** 70 * Current date in ISO format 71 * Useful for time-sensitive operations 72 73**{previous_date}** 74 * Date of previous related document 75 * Useful for tracking changes over time 76 77**{action}** 78 * The current action being performed 79 * Can be used for action-specific instructions 80 81**{think}** 82 * Thinking mode indicator (/think or /no_think) 83 * Controls whether reasoning process is shown 84 85===== Creating Custom Prompts ===== 86 87==== Basic Process ==== 88 891. **Identify the Action** 90 * Determine which action you want to customize 91 * Check existing prompt names in the ''dokullm:profiles:default:'' namespace 92 932. **Create Prompt Page** 94 * Create a new page with the same name in your profile namespace 95 * Use the same structure as existing prompts 96 973. **Add Placeholders** 98 * Incorporate relevant placeholders for dynamic content 99 * Ensure all required placeholders are included 100 1014. **Test and Refine** 102 * Test the prompt with various content types 103 * Refine based on the quality of results 104 105==== Example Prompt Structure ==== 106 107A typical prompt page might look like this: 108 109Summarize the following text in a concise manner: 110 111{text} 112 113===== System Prompt Extensions ===== 114 115The plugin supports a hierarchical system prompt architecture: 116 117==== Base System Prompt ==== 118 * Located at ''dokullm:profiles:[PROFILE_NAME]:system'' 119 * Provides the foundational instructions for the LLM 120 121==== Action-Specific Extensions ==== 122 * Located at ''dokullm:profiles:[PROFILE_NAME]:[ACTION_NAME]:system'' 123 * Automatically appended to the base system prompt 124 * Provides action-specific guidance 125 126===== Prompt Best Practices ===== 127 128==== Writing Effective Prompts ==== 129 130 * **Be Specific**: Clearly define the task and expected output 131 * **Provide Context**: Include relevant background information 132 * **Use Examples**: Show examples of desired output format 133 * **Set Constraints**: Define limitations on length, style, or content 134 * **Guide Formatting**: Specify output format requirements 135 136==== Placeholder Usage ==== 137 138 * **Always Include Required Placeholders**: Missing placeholders can cause errors 139 * **Use Contextual Placeholders**: Only include placeholders that add value 140 * **Test Placeholder Substitution**: Verify that placeholders are correctly replaced 141 * **Document Custom Placeholders**: If adding new placeholders, document their purpose 142 143==== Organization and Maintenance ==== 144 145 * **Consistent Naming**: Use consistent naming conventions for prompt pages 146 * **Version Control**: Keep prompts under version control 147 * **Documentation**: Document significant changes to prompts 148 * **Backup**: Keep backups of working prompt configurations 149 150===== Troubleshooting Prompts ===== 151 152Common issues and solutions: 153 154 * **Empty Responses**: Check that all required placeholders are provided 155 * **Irrelevant Content**: Improve context and constraints in the prompt 156 * **Formatting Issues**: Be more specific about output format requirements 157 * **Performance Problems**: Simplify prompts or reduce context length 158 * **Inconsistent Results**: Add more specific guidance and examples 159 160For debugging prompt issues, enable debug logging in the plugin configuration to see the actual prompts being sent to the LLM. 161