File tree Expand file tree Collapse file tree 4 files changed +16
-4
lines changed
Expand file tree Collapse file tree 4 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -568,6 +568,12 @@ export namespace Config {
568568 } ,
569569 ) ,
570570 instructions : z . array ( z . string ( ) ) . optional ( ) . describe ( "Additional instruction files or patterns to include" ) ,
571+ compactPrompt : z
572+ . string ( )
573+ . optional ( )
574+ . describe (
575+ "Custom prompt to use for the /compact command. If not specified, uses the default summarization prompt." ,
576+ ) ,
571577 layout : Layout . optional ( ) . describe ( "@deprecated Always uses stretch layout." ) ,
572578 permission : z
573579 . object ( {
Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ export namespace SessionCompaction {
103103 const toSummarize = await MessageV2 . filterCompacted ( MessageV2 . stream ( input . sessionID ) )
104104 const model = await Provider . getModel ( input . providerID , input . modelID )
105105 const system = [
106- ...SystemPrompt . summarize ( model . providerID ) ,
106+ ...( await SystemPrompt . summarize ( model . providerID ) ) ,
107107 ...( await SystemPrompt . environment ( ) ) ,
108108 ...( await SystemPrompt . custom ( ) ) ,
109109 ]
Original file line number Diff line number Diff line change @@ -116,12 +116,14 @@ export namespace SystemPrompt {
116116 return Promise . all ( found ) . then ( ( result ) => result . filter ( Boolean ) )
117117 }
118118
119- export function summarize ( providerID : string ) {
119+ export async function summarize ( providerID : string ) {
120+ const config = await Config . get ( )
121+ const prompt = config . compactPrompt || PROMPT_SUMMARIZE
120122 switch ( providerID ) {
121123 case "anthropic" :
122- return [ PROMPT_ANTHROPIC_SPOOF . trim ( ) , PROMPT_SUMMARIZE ]
124+ return [ PROMPT_ANTHROPIC_SPOOF . trim ( ) , prompt ]
123125 default :
124- return [ PROMPT_SUMMARIZE ]
126+ return [ prompt ]
125127 }
126128 }
127129
Original file line number Diff line number Diff line change @@ -454,6 +454,10 @@ export type Config = {
454454 * Additional instruction files or patterns to include
455455 */
456456 instructions ?: Array < string >
457+ /**
458+ * Custom prompt to use for the /compact command. If not specified, uses the default summarization prompt.
459+ */
460+ compactPrompt ?: string
457461 layout ?: LayoutConfig
458462 permission ?: {
459463 edit ?: "ask" | "allow" | "deny"
You can’t perform that action at this time.
0 commit comments