Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

feat: accept custom instructions in profiles (#1803)

aedc15a5cf0b50
diff --git a/codex-rs/core/src/config.rs b/codex-rs/core/src/config.rs
index 87629d821a..b43dc56ba0 100644
--- a/codex-rs/core/src/config.rs
+++ b/codex-rs/core/src/config.rs
@@ -480,10 +480,12 @@ impl Config {
// Load base instructions override from a file if specified. If the
// path is relative, resolve it against the effective cwd so the
// behaviour matches other path-like config values.
- let file_base_instructions = Self::get_base_instructions(
- cfg.experimental_instructions_file.as_ref(),
- &resolved_cwd,
- )?;
+ let experimental_instructions_path = config_profile
+ .experimental_instructions_file
+ .as_ref()
+ .or(cfg.experimental_instructions_file.as_ref());
+ let file_base_instructions =
+ Self::get_base_instructions(experimental_instructions_path, &resolved_cwd)?;
let base_instructions = base_instructions.or(file_base_instructions);
let config = Self {
diff --git a/codex-rs/core/src/config_profile.rs b/codex-rs/core/src/config_profile.rs
index 176a9b1500..d945d1df7a 100644
--- a/codex-rs/core/src/config_profile.rs
+++ b/codex-rs/core/src/config_profile.rs
@@ -1,4 +1,5 @@
use serde::Deserialize;
+use std::path::PathBuf;
use crate::config_types::ReasoningEffort;
use crate::config_types::ReasoningSummary;
@@ -17,4 +18,5 @@ pub struct ConfigProfile {
pub model_reasoning_effort: Option<ReasoningEffort>,
pub model_reasoning_summary: Option<ReasoningSummary>,
pub chatgpt_base_url: Option<String>,
+ pub experimental_instructions_file: Option<PathBuf>,
}