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
8 changes: 1 addition & 7 deletions lib/prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,18 +122,12 @@ export function buildAnalysisPrompt(
unprunedToolCallIds: string[],
messages: any[],
alreadyPrunedIds?: string[],
protectedToolCallIds?: string[],
reason?: string
protectedToolCallIds?: string[]
): string {
const minimizedMessages = minimizeMessages(messages, alreadyPrunedIds, protectedToolCallIds)
const messagesJson = JSON.stringify(minimizedMessages, null, 2).replace(/\\n/g, '\n')

const reasonContext = reason
? `\nContext: The AI has requested pruning with the following reason: "${reason}"\nUse this context to inform your decisions about what is most relevant to keep.`
: ''

return loadPrompt("pruning", {
reason_context: reasonContext,
available_tool_call_ids: unprunedToolCallIds.join(", "),
session_history: messagesJson
})
Expand Down
2 changes: 1 addition & 1 deletion lib/prompts/pruning.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
You are a conversation analyzer that identifies obsolete tool outputs in a coding session.
{{reason_context}}

Your task: Analyze the session history and identify tool call IDs whose outputs are NO LONGER RELEVANT to the current conversation context.

Guidelines for identifying obsolete tool calls:
Expand Down