1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
|
public static final String COMPRESSION_MESSAGE_LIST_END = "Above is the message list that needs to be compressed.";
public static final String PREVIOUS_ROUND_TOOL_INVOCATION_COMPRESS_PROMPT = "You are an expert content compression specialist. Your task is to intelligently" + " compress and summarize the following tool invocation history:\n" + " - Preserve: tool name, exact arguments (with values), and a concise factual" + " summary of the output.\n" + " - For repeated calls to the same tool:\n" + " • Consolidate identical calls (same args, same result) into one entry" + " with frequency note.\n" + " • Only list distinct argument combinations that led to different" + " outcomes.\n" + " • Omit non-essential varying parameters (e.g., timestamps, request IDs)" + " if behavior is unchanged.\n" + " - Treat a tool as a write/change operation if its name or output implies" + " side effects (e.g., contains 'write', 'update', 'delete', 'create', or returns" + " confirmation like 'written').\n" + " For such operations, preserve critical details: file paths, data keys," + " content snippets, state changes, and success/error indicators.\n" + " - Output must be plain text—no markdown, JSON, bullets, headers, or" + " meta-comments.\n" + " - If any tool output appears truncated or corrupted, include '[TRUNCATED]'.";
public static final String PREVIOUS_ROUND_CONVERSATION_SUMMARY_PROMPT = "You are an expert dialogue compressor for autonomous agents. Your task is to rewrite" + " the assistant's final response from the previous round as a self-contained," + " concise reply that incorporates all essential facts learned during the" + " round—without referencing tools, functions, or internal execution steps.\n" + "\n" + "Input includes: the user's original question, the assistant's original response," + " and the results of any tool executions that informed that response.\n" + "\n" + "Your output will REPLACE the original assistant message in the conversation" + " history, forming a clean USER -> ASSISTANT pair for future context.\n" + "\n" + "Guidelines:\n" + " - NEVER mention tools, functions, API calls, or execution steps (e.g., avoid" + " 'I called...', 'The system returned...', 'After running X...').\n" + " - INSTEAD, state all findings as direct, factual knowledge the assistant now" + " possesses.\n" + " - PRESERVE CRITICAL FACTS from tool results, especially:\n" + " • File paths and their contents, changes, or creation (e.g.," + " '/etc/app.conf sets port=8080')\n" + " • Exact error messages when diagnostic (e.g., 'Permission denied (errno" + " 13)', 'timeout after 30s')\n" + " • IDs, URLs, ports, status codes, configuration values, and data keys\n" + " • Outcomes of write/change operations (e.g., 'Wrote maintenance flag to" + " /tmp/status', 'Updated user_id=789 email in database')\n" + " • Service states or process info (e.g., 'auth-service is stopped'," + " 'PID=4567')\n" + " - If an action was performed (e.g., file written, service restarted), clearly" + " state WHAT changed and WHERE.\n" + " - If something failed or was incomplete, specify the limitation (e.g., 'Could" + " not restart: permission denied').\n" + " - Consolidate redundant information; omit generic success messages with no" + " actionable detail.\n" + " - Use clear, informative language—avoid meta-phrases like 'Based on logs...'" + " or 'As observed...'.\n" + " - Output must be plain text: no markdown, bullets, JSON, XML, or section" + " headers.";
public static final String CONTEXT_OFFLOAD_TAG_FORMAT = "<!-- CONTEXT_OFFLOAD: uuid=%s -->";
public static final String CURRENT_ROUND_LARGE_MESSAGE_SUMMARY_PROMPT = "You are an expert content compression specialist. Your task is to intelligently" + " summarize the following message content. This message exceeds the size" + " threshold and needs to be compressed while preserving all critical" + " information.\n" + "\n" + "IMPORTANT: This is content from the CURRENT ROUND. Please be EXTRA CAREFUL and" + " CONSERVATIVE when compressing. Preserve as much content as possible according" + " to the requirements below, as this information is actively being used in the" + " current conversation.\n" + "\n" + "Please provide a concise summary that:\n" + " - Preserves all critical information and key details\n" + " - Maintains important context that would be needed for future reference\n" + " - Highlights any important outcomes, results, or status information\n" + " - Retains tool call information if present (tool names, IDs, key" + " parameters)";
public static final String CURRENT_ROUND_MESSAGE_COMPRESS_PROMPT = "You are an expert context consolidator for autonomous agents. Your task is to" + " integrate new tool execution results into the current conversation context.\n" + "\n" + "INPUT STRUCTURE:\n" + "- The input consists of:\n" + " (a) Optionally, a prior compressed context block ending with <!--" + " CONTEXT_OFFLOAD: uuid=... -->\n" + " (b) Followed by zero or more alternating tool_use and tool_result messages" + " from the current turn.\n" + "- There is NO user message in the input.\n" + "- Plan-related tools have already been filtered out upstream.\n" + "\n" + "YOUR WORKFLOW:\n" + "1. IF the input contains a line matching <!-- CONTEXT_OFFLOAD: uuid=... -->:\n" + " - Preserve all text BEFORE this line exactly as the prior context.\n" + " - Process ONLY the tool_use/tool_result pairs AFTER this line.\n" + "2. ELSE (no offload marker found):\n" + " - Treat the entire input as new tool interactions from the first compression" + " round.\n" + " - Generate a summary based solely on these tool calls and their results.\n" + "3. For each tool_use/tool_result pair:\n" + " - Summarize as a factual, first-person statement:\n" + " \"I called [tool_name] with [arg1=value1, ...]; it returned: [key" + " details].\"\n" + " - Preserve all technical specifics: file paths, IDs, error codes, config" + " values, state changes.\n" + " - If a result is truncated or malformed, include it verbatim prefixed with" + " [UNPARSED OUTPUT].\n" + "\n" + "OUTPUT REQUIREMENTS:\n" + "- A single plain-text block containing:\n" + " [prior context (if any)]\\n" + "[new tool summaries]\n" + "- DO NOT include any <!-- CONTEXT_OFFLOAD --> tag in your output.\n" + "- DO NOT mention user requests, intentions, or questions (they are not in the" + " input).\n" + "- DO NOT use markdown, JSON, bullets, or phrases like \"as before\", \"new" + " actions:\".\n" + "- The output will be used as the new compressed context, and a new offload tag" + " will be appended externally.\n" + "\n" + "SAFE TO REMOVE FROM tool_result:\n" + "- Boilerplate text (licenses, auto-comments)\n" + "- Redundant success messages with no actionable data\n" + "- Repeated log prefixes (if core content is retained)\n" + "\n" + "STRICTLY AVOID:\n" + "- Including raw tool_use/tool_result JSON\n" + "- Re-compressing or altering prior context\n" + "- Adding any offload marker (old or new)";
public static final String CURRENT_ROUND_MESSAGE_COMPRESS_CHAR_REQUIREMENT = "\n" + "COMPRESSION REQUIREMENT:\n" + "The original content contains approximately %d characters. You MUST compress it" + " to approximately %d characters (%.0f%% of original). This is a STRICT" + " requirement.\n" + "\n" + "Please ensure your output meets this character limit while following the" + " compression principles above.";
|