Skip to content
Merged
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
7 changes: 7 additions & 0 deletions lib/messages/prune.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ const buildPrunableToolsList = (
logger.debug(`Prunable tool found - ID: ${numericId}, Tool: ${toolParameterEntry.tool}, Call ID: ${toolCallId}`)
})

if (lines.length === 0) {
return ""
}

return `<prunable-tools>\nThe 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 outputs. Keep the context free of noise.\n${lines.join('\n')}\n</prunable-tools>`
}

Expand All @@ -52,6 +56,9 @@ export const insertPruneToolContext = (
}

const prunableToolsList = buildPrunableToolsList(state, config, logger, messages)
if (!prunableToolsList) {
return
}

let nudgeString = ""
if (state.nudgeCounter >= config.strategies.pruneTool.nudge.frequency) {
Expand Down