diff --git a/index.ts b/index.ts index 6b617c4..ac87705 100644 --- a/index.ts +++ b/index.ts @@ -29,7 +29,7 @@ const plugin: Plugin = (async (ctx) => { return { "experimental.chat.system.transform": async (_input: unknown, output: { system: string[] }) => { - const syntheticPrompt = loadPrompt("synthetic") + const syntheticPrompt = loadPrompt("prune-system-prompt") output.system.push(syntheticPrompt) }, "experimental.chat.messages.transform": createChatMessageTransformHandler( diff --git a/lib/messages/prune.ts b/lib/messages/prune.ts index d156e0e..f9348bf 100644 --- a/lib/messages/prune.ts +++ b/lib/messages/prune.ts @@ -8,7 +8,7 @@ import { UserMessage } from "@opencode-ai/sdk" const PRUNED_TOOL_INPUT_REPLACEMENT = '[Input removed to save context]' const PRUNED_TOOL_OUTPUT_REPLACEMENT = '[Output removed to save context - information superseded or no longer needed]' -const NUDGE_STRING = loadPrompt("nudge") +const NUDGE_STRING = loadPrompt("prune-nudge") const wrapPrunableTools = (content: string): string => ` The following tools have been invoked and are available for pruning. This list does not mandate immediate action. Consider your current goals and the resources you need before discarding valuable tool inputs or outputs. Consolidate your prunes for efficiency; it is rarely worth pruning a single tiny tool output. Keep the context free of noise. diff --git a/lib/prompt.ts b/lib/prompt.ts index 76cc94f..33a490f 100644 --- a/lib/prompt.ts +++ b/lib/prompt.ts @@ -127,7 +127,7 @@ export function buildAnalysisPrompt( const minimizedMessages = minimizeMessages(messages, alreadyPrunedIds, protectedToolCallIds) const messagesJson = JSON.stringify(minimizedMessages, null, 2).replace(/\\n/g, '\n') - return loadPrompt("pruning", { + return loadPrompt("on-idle-analysis", { available_tool_call_ids: unprunedToolCallIds.join(", "), session_history: messagesJson }) diff --git a/lib/prompts/pruning.txt b/lib/prompts/on-idle-analysis.txt similarity index 100% rename from lib/prompts/pruning.txt rename to lib/prompts/on-idle-analysis.txt diff --git a/lib/prompts/nudge.txt b/lib/prompts/prune-nudge.txt similarity index 100% rename from lib/prompts/nudge.txt rename to lib/prompts/prune-nudge.txt diff --git a/lib/prompts/synthetic.txt b/lib/prompts/prune-system-prompt.txt similarity index 100% rename from lib/prompts/synthetic.txt rename to lib/prompts/prune-system-prompt.txt diff --git a/lib/prompts/tool.txt b/lib/prompts/prune-tool-spec.txt similarity index 100% rename from lib/prompts/tool.txt rename to lib/prompts/prune-tool-spec.txt diff --git a/lib/strategies/prune-tool.ts b/lib/strategies/prune-tool.ts index e037f3f..c8f6d38 100644 --- a/lib/strategies/prune-tool.ts +++ b/lib/strategies/prune-tool.ts @@ -10,8 +10,8 @@ import type { Logger } from "../logger" import { loadPrompt } from "../prompt" import { calculateTokensSaved, getCurrentParams } from "./utils" -/** Tool description loaded from prompts/tool.txt */ -const TOOL_DESCRIPTION = loadPrompt("tool") +/** Tool description loaded from prompts/prune-tool-spec.txt */ +const TOOL_DESCRIPTION = loadPrompt("prune-tool-spec") export interface PruneToolContext { client: any