@@ -112,6 +112,7 @@ use crate::tools::spec::ToolsConfig;
112112use crate :: tools:: spec:: ToolsConfigParams ;
113113use crate :: turn_diff_tracker:: TurnDiffTracker ;
114114use crate :: unified_exec:: UnifiedExecSessionManager ;
115+ use crate :: user_instructions:: DeveloperInstructions ;
115116use crate :: user_instructions:: UserInstructions ;
116117use crate :: user_notification:: UserNotification ;
117118use crate :: util:: backoff;
@@ -171,6 +172,7 @@ impl Codex {
171172 model : config. model . clone ( ) ,
172173 model_reasoning_effort : config. model_reasoning_effort ,
173174 model_reasoning_summary : config. model_reasoning_summary ,
175+ developer_instructions : config. developer_instructions . clone ( ) ,
174176 user_instructions,
175177 base_instructions : config. base_instructions . clone ( ) ,
176178 compact_prompt : config. compact_prompt . clone ( ) ,
@@ -265,6 +267,7 @@ pub(crate) struct TurnContext {
265267 /// the model as well as sandbox policies are resolved against this path
266268 /// instead of `std::env::current_dir()`.
267269 pub ( crate ) cwd : PathBuf ,
270+ pub ( crate ) developer_instructions : Option < String > ,
268271 pub ( crate ) base_instructions : Option < String > ,
269272 pub ( crate ) compact_prompt : Option < String > ,
270273 pub ( crate ) user_instructions : Option < String > ,
@@ -303,6 +306,9 @@ pub(crate) struct SessionConfiguration {
303306 model_reasoning_effort : Option < ReasoningEffortConfig > ,
304307 model_reasoning_summary : ReasoningSummaryConfig ,
305308
309+ /// Developer instructions that supplement the base instructions.
310+ developer_instructions : Option < String > ,
311+
306312 /// Model instructions that are appended to the base instructions.
307313 user_instructions : Option < String > ,
308314
@@ -417,6 +423,7 @@ impl Session {
417423 sub_id,
418424 client,
419425 cwd : session_configuration. cwd . clone ( ) ,
426+ developer_instructions : session_configuration. developer_instructions . clone ( ) ,
420427 base_instructions : session_configuration. base_instructions . clone ( ) ,
421428 compact_prompt : session_configuration. compact_prompt . clone ( ) ,
422429 user_instructions : session_configuration. user_instructions . clone ( ) ,
@@ -991,7 +998,10 @@ impl Session {
991998 }
992999
9931000 pub ( crate ) fn build_initial_context ( & self , turn_context : & TurnContext ) -> Vec < ResponseItem > {
994- let mut items = Vec :: < ResponseItem > :: with_capacity ( 2 ) ;
1001+ let mut items = Vec :: < ResponseItem > :: with_capacity ( 3 ) ;
1002+ if let Some ( developer_instructions) = turn_context. developer_instructions . as_deref ( ) {
1003+ items. push ( DeveloperInstructions :: new ( developer_instructions. to_string ( ) ) . into ( ) ) ;
1004+ }
9951005 if let Some ( user_instructions) = turn_context. user_instructions . as_deref ( ) {
9961006 items. push ( UserInstructions :: new ( user_instructions. to_string ( ) ) . into ( ) ) ;
9971007 }
@@ -1674,6 +1684,7 @@ async fn spawn_review_thread(
16741684 sub_id : sub_id. to_string ( ) ,
16751685 client,
16761686 tools_config,
1687+ developer_instructions : None ,
16771688 user_instructions : None ,
16781689 base_instructions : Some ( base_instructions. clone ( ) ) ,
16791690 compact_prompt : parent_turn_context. compact_prompt . clone ( ) ,
@@ -2511,6 +2522,7 @@ mod tests {
25112522 model : config. model . clone ( ) ,
25122523 model_reasoning_effort : config. model_reasoning_effort ,
25132524 model_reasoning_summary : config. model_reasoning_summary ,
2525+ developer_instructions : config. developer_instructions . clone ( ) ,
25142526 user_instructions : config. user_instructions . clone ( ) ,
25152527 base_instructions : config. base_instructions . clone ( ) ,
25162528 compact_prompt : config. compact_prompt . clone ( ) ,
@@ -2586,6 +2598,7 @@ mod tests {
25862598 model : config. model . clone ( ) ,
25872599 model_reasoning_effort : config. model_reasoning_effort ,
25882600 model_reasoning_summary : config. model_reasoning_summary ,
2601+ developer_instructions : config. developer_instructions . clone ( ) ,
25892602 user_instructions : config. user_instructions . clone ( ) ,
25902603 base_instructions : config. base_instructions . clone ( ) ,
25912604 compact_prompt : config. compact_prompt . clone ( ) ,
0 commit comments