@@ -372,13 +372,14 @@ impl BulletinRefreshOutcome {
372372}
373373
374374const CORTEX_ONE_SHOT_MAX_TURNS : usize = 1 ;
375- const CORTEX_INTRADAY_SYNTHESIS_SYSTEM_FALLBACK : & str = "You write concise working-memory summaries for the cortex.\n \n Output one narrative summary paragraph and nothing else." ;
376- const CORTEX_DAILY_SUMMARY_SYSTEM_FALLBACK : & str = "You write daily activity summaries for the cortex.\n \n Output the daily activity summary and nothing else." ;
375+ const CORTEX_INTRADAY_SYNTHESIS_SYSTEM_FALLBACK_TEMPLATE : & str =
376+ "cortex_intraday_synthesis_system_fallback" ;
377+ const CORTEX_DAILY_SUMMARY_SYSTEM_FALLBACK_TEMPLATE : & str = "cortex_daily_summary_system_fallback" ;
377378
378379fn render_static_prompt_or_fallback (
379380 prompt_engine : & crate :: prompts:: engine:: PromptEngine ,
380381 template_name : & ' static str ,
381- fallback : & ' static str ,
382+ fallback_template_name : & ' static str ,
382383) -> String {
383384 match prompt_engine. render_static ( template_name) {
384385 Ok ( prompt) => prompt,
@@ -388,7 +389,9 @@ fn render_static_prompt_or_fallback(
388389 template_name,
389390 "failed to render static cortex prompt, using fallback"
390391 ) ;
391- fallback. to_string ( )
392+ prompt_engine
393+ . render_static ( fallback_template_name)
394+ . expect ( "fallback cortex prompt template should render" )
392395 }
393396 }
394397}
@@ -3278,7 +3281,7 @@ pub async fn maybe_synthesize_intraday_batch(
32783281 let synthesis_preamble = render_static_prompt_or_fallback (
32793282 & prompt_engine,
32803283 "cortex_intraday_synthesis_system" ,
3281- CORTEX_INTRADAY_SYNTHESIS_SYSTEM_FALLBACK ,
3284+ CORTEX_INTRADAY_SYNTHESIS_SYSTEM_FALLBACK_TEMPLATE ,
32823285 ) ;
32833286 let prompt = prompt_engine. render_intraday_synthesis (
32843287 unsynthesized. len ( ) ,
@@ -3440,7 +3443,7 @@ pub async fn maybe_synthesize_daily_summary(
34403443 let synthesis_preamble = render_static_prompt_or_fallback (
34413444 & prompt_engine,
34423445 "cortex_daily_summary_system" ,
3443- CORTEX_DAILY_SUMMARY_SYSTEM_FALLBACK ,
3446+ CORTEX_DAILY_SUMMARY_SYSTEM_FALLBACK_TEMPLATE ,
34443447 ) ;
34453448 let prompt = prompt_engine. render_daily_summary (
34463449 & yesterday,
@@ -4662,17 +4665,18 @@ async fn fetch_memories_for_association(
46624665mod tests {
46634666 use super :: {
46644667 BULLETIN_REFRESH_CIRCUIT_OPEN_SECS , BULLETIN_REFRESH_CIRCUIT_OPEN_THRESHOLD , BranchTracker ,
4665- BulletinRefreshOutcome , CORTEX_INTRADAY_SYNTHESIS_SYSTEM_FALLBACK , CortexReceiverOutcome ,
4666- GatheredSections , HealthRuntimeState , MAINTENANCE_TASK_CANCEL_GRACE_SECS ,
4667- MaintenanceTimeoutAction , ReceiverClosedBehavior , Signal , SynthesisTaskBackoff ,
4668- WorkerTracker , apply_cancelled_warmup_status, build_kill_targets,
4669- claim_detached_completion, collect_synthesis_task, detached_timeout_transition,
4670- generate_if_dirty_under_lock, handle_cortex_receiver_result, has_completed_initial_warmup,
4671- is_cancelled_control_result, is_terminal_control_result, maintenance_task_timeout,
4672- maintenance_timeout_action, mark_knowledge_synthesis_version_complete,
4673- maybe_close_bulletin_refresh_circuit, maybe_generate_bulletin_under_lock,
4674- maybe_spawn_synthesis_task, parse_structured_success_flag, push_signal_into_buffer,
4675- record_bulletin_refresh_failure, render_static_prompt_or_fallback, should_execute_warmup,
4668+ BulletinRefreshOutcome , CORTEX_INTRADAY_SYNTHESIS_SYSTEM_FALLBACK_TEMPLATE ,
4669+ CortexReceiverOutcome , GatheredSections , HealthRuntimeState ,
4670+ MAINTENANCE_TASK_CANCEL_GRACE_SECS , MaintenanceTimeoutAction , ReceiverClosedBehavior ,
4671+ Signal , SynthesisTaskBackoff , WorkerTracker , apply_cancelled_warmup_status,
4672+ build_kill_targets, claim_detached_completion, collect_synthesis_task,
4673+ detached_timeout_transition, generate_if_dirty_under_lock, handle_cortex_receiver_result,
4674+ has_completed_initial_warmup, is_cancelled_control_result, is_terminal_control_result,
4675+ maintenance_task_timeout, maintenance_timeout_action,
4676+ mark_knowledge_synthesis_version_complete, maybe_close_bulletin_refresh_circuit,
4677+ maybe_generate_bulletin_under_lock, maybe_spawn_synthesis_task,
4678+ parse_structured_success_flag, push_signal_into_buffer, record_bulletin_refresh_failure,
4679+ render_static_prompt_or_fallback, should_execute_warmup,
46764680 should_generate_bulletin_from_bulletin_loop, signal_from_event, summarize_signal_text,
46774681 take_lagged_control_flag,
46784682 } ;
@@ -4717,10 +4721,15 @@ mod tests {
47174721 let prompt = render_static_prompt_or_fallback (
47184722 & prompt_engine,
47194723 "missing_cortex_synthesis_template" ,
4720- CORTEX_INTRADAY_SYNTHESIS_SYSTEM_FALLBACK ,
4724+ CORTEX_INTRADAY_SYNTHESIS_SYSTEM_FALLBACK_TEMPLATE ,
47214725 ) ;
47224726
4723- assert_eq ! ( prompt, CORTEX_INTRADAY_SYNTHESIS_SYSTEM_FALLBACK ) ;
4727+ assert_eq ! (
4728+ prompt,
4729+ prompt_engine
4730+ . render_static( CORTEX_INTRADAY_SYNTHESIS_SYSTEM_FALLBACK_TEMPLATE )
4731+ . expect( "fallback prompt should render" )
4732+ ) ;
47244733 }
47254734
47264735 #[ test]
0 commit comments