@@ -3,8 +3,10 @@ import type { Logger } from "../logger"
33import type { PluginConfig } from "../config"
44import { buildToolIdList } from "../utils"
55import { getLastUserMessage , extractParameterKey } from "./utils"
6+ import { loadPrompt } from "../prompt"
67
78const PRUNED_TOOL_OUTPUT_REPLACEMENT = '[Output removed to save context - information superseded or no longer needed]'
9+ const NUDGE_STRING = loadPrompt ( "nudge" )
810
911const buildPrunableToolsList = (
1012 state : SessionState ,
@@ -45,6 +47,12 @@ export const insertPruneToolContext = (
4547
4648 const prunableToolsList = buildPrunableToolsList ( state , config , logger , messages )
4749
50+ let nudgeString = ""
51+ if ( state . nudgeCounter >= config . strategies . pruneTool . nudgeFrequency ) {
52+ logger . info ( "Inserting prune nudge message" )
53+ nudgeString = "\n" + NUDGE_STRING
54+ }
55+
4856 const userMessage : WithParts = {
4957 info : {
5058 id : "msg_01234567890123456789012345" ,
@@ -63,7 +71,7 @@ export const insertPruneToolContext = (
6371 sessionID : lastUserMessage . info . sessionID ,
6472 messageID : "msg_01234567890123456789012345" ,
6573 type : "text" ,
66- text : prunableToolsList ,
74+ text : prunableToolsList + nudgeString ,
6775 }
6876 ]
6977 }
0 commit comments