Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion lib/messages/prune.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 => `<prunable-tools>
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.
Expand Down
2 changes: 1 addition & 1 deletion lib/prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions lib/strategies/prune-tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down