@@ -116,6 +116,12 @@ def config_group():
116116 default = None ,
117117 help = "Apply Git ignore rules during repository analysis (default: enabled)" ,
118118)
119+ @click .option (
120+ "--prompt-caching/--no-prompt-caching" ,
121+ default = None ,
122+ help = "Add prompt-cache breakpoints to agentic LLM calls; auto-falls back to "
123+ "normal calls if the provider rejects them (default: enabled)" ,
124+ )
119125def config_set (
120126 api_key : Optional [str ],
121127 base_url : Optional [str ],
@@ -131,6 +137,7 @@ def config_set(
131137 api_version : Optional [str ] = None ,
132138 azure_deployment : Optional [str ] = None ,
133139 use_gitignore : Optional [bool ] = None ,
140+ prompt_caching : Optional [bool ] = None ,
134141):
135142 """
136143 Set configuration values for CodeWiki.
@@ -183,7 +190,7 @@ def config_set(
183190 """
184191 try :
185192 # Check if at least one option is provided
186- if not any ([api_key , base_url , main_model , cluster_model , fallback_model , max_tokens , max_token_per_module , max_token_per_leaf_module , max_depth , provider , aws_region , api_version , azure_deployment , use_gitignore is not None ]):
193+ if not any ([api_key , base_url , main_model , cluster_model , fallback_model , max_tokens , max_token_per_module , max_token_per_leaf_module , max_depth , provider , aws_region , api_version , azure_deployment , use_gitignore is not None , prompt_caching is not None ]):
187194 click .echo ("No options provided. Use --help for usage information." )
188195 sys .exit (EXIT_CONFIG_ERROR )
189196
@@ -250,6 +257,9 @@ def config_set(
250257 if use_gitignore is not None :
251258 validated_data ['use_gitignore' ] = use_gitignore
252259
260+ if prompt_caching is not None :
261+ validated_data ['prompt_caching' ] = prompt_caching
262+
253263 # Create config manager and save
254264 manager = ConfigManager ()
255265 manager .load () # Load existing config if present
@@ -269,6 +279,7 @@ def config_set(
269279 api_version = validated_data .get ('api_version' ),
270280 azure_deployment = validated_data .get ('azure_deployment' ),
271281 use_gitignore = validated_data .get ('use_gitignore' ),
282+ prompt_caching = validated_data .get ('prompt_caching' ),
272283 )
273284
274285 # Display success messages
@@ -332,6 +343,9 @@ def config_set(
332343 if use_gitignore is not None :
333344 click .secho (f"✓ Use gitignore: { use_gitignore } " , fg = "green" )
334345
346+ if prompt_caching is not None :
347+ click .secho (f"✓ Prompt caching: { prompt_caching } " , fg = "green" )
348+
335349 click .echo ("\n " + click .style ("Configuration updated successfully." , fg = "green" , bold = True ))
336350
337351 except ConfigurationError as e :
@@ -393,6 +407,7 @@ def config_show(output_json: bool):
393407 "max_token_per_leaf_module" : config .max_token_per_leaf_module if config else 16000 ,
394408 "max_depth" : config .max_depth if config else 2 ,
395409 "use_gitignore" : config .use_gitignore if config else True ,
410+ "prompt_caching" : config .prompt_caching if config else True ,
396411 "agent_instructions" : config .agent_instructions .to_dict () if config and config .agent_instructions else {},
397412 "config_file" : str (manager .config_file_path )
398413 }
@@ -448,6 +463,7 @@ def config_show(output_json: bool):
448463 click .echo (f" Max Tokens: { config .max_tokens } " )
449464 click .echo (f" Max Token/Module: { config .max_token_per_module } " )
450465 click .echo (f" Max Token/Leaf Module: { config .max_token_per_leaf_module } " )
466+ click .echo (f" Prompt Caching: { config .prompt_caching } " )
451467
452468 click .echo ()
453469 click .secho ("Decomposition Settings" , fg = "cyan" , bold = True )
0 commit comments