Lightweight coding agent that runs in your terminal
Rust
feat: add use memories config (#12997)
jif-oaia63d8bd56912
diff --git a/codex-rs/core/config.schema.json b/codex-rs/core/config.schema.jsonindex d207d5bd8e..0a92c81825 100644--- a/codex-rs/core/config.schema.json+++ b/codex-rs/core/config.schema.json@@ -647,6 +647,10 @@"phase_2_model": {"description": "Model used for memory consolidation.","type": "string"+ },+ "use_memories": {+ "description": "When `false`, skip injecting memory usage instructions into developer prompts.",+ "type": "boolean"}},"type": "object"diff --git a/codex-rs/core/src/codex.rs b/codex-rs/core/src/codex.rsindex c511739f3a..91b24a0f25 100644--- a/codex-rs/core/src/codex.rs+++ b/codex-rs/core/src/codex.rs@@ -3075,9 +3075,10 @@ impl Session {developer_sections.push(developer_instructions.to_string());}// Add developer instructions for memories.- if let Some(memory_prompt) =- build_memory_tool_developer_instructions(&turn_context.config.codex_home).await- && turn_context.features.enabled(Feature::MemoryTool)+ if turn_context.features.enabled(Feature::MemoryTool)+ && turn_context.config.memories.use_memories+ && let Some(memory_prompt) =+ build_memory_tool_developer_instructions(&turn_context.config.codex_home).await{developer_sections.push(memory_prompt);}diff --git a/codex-rs/core/src/config/mod.rs b/codex-rs/core/src/config/mod.rsindex b3661fe790..ec06f22671 100644--- a/codex-rs/core/src/config/mod.rs+++ b/codex-rs/core/src/config/mod.rs@@ -2490,6 +2490,7 @@ persistence = "none"let memories = r#"[memories]+use_memories = falsemax_raw_memories_for_global = 512max_unused_days = 21max_rollout_age_days = 42@@ -2502,6 +2503,7 @@ phase_2_model = "gpt-5"toml::from_str::<ConfigToml>(memories).expect("TOML deserialization should succeed");assert_eq!(Some(MemoriesToml {+ use_memories: Some(false),max_raw_memories_for_global: Some(512),max_unused_days: Some(21),max_rollout_age_days: Some(42),@@ -2522,6 +2524,7 @@ phase_2_model = "gpt-5"assert_eq!(config.memories,MemoriesConfig {+ use_memories: false,max_raw_memories_for_global: 512,max_unused_days: 21,max_rollout_age_days: 42,diff --git a/codex-rs/core/src/config/types.rs b/codex-rs/core/src/config/types.rsindex ec0bf15320..874d7d9667 100644--- a/codex-rs/core/src/config/types.rs+++ b/codex-rs/core/src/config/types.rs@@ -371,6 +371,8 @@ pub struct FeedbackConfigToml {#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default, JsonSchema)]#[schemars(deny_unknown_fields)]pub struct MemoriesToml {+ /// When `false`, skip injecting memory usage instructions into developer prompts.+ pub use_memories: Option<bool>,/// Maximum number of recent raw memories retained for global consolidation.pub max_raw_memories_for_global: Option<usize>,/// Maximum number of days since a memory was last used before it becomes ineligible for phase 2 selection.@@ -390,6 +392,7 @@ pub struct MemoriesToml {/// Effective memories settings after defaults are applied.#[derive(Debug, Clone, PartialEq, Eq)]pub struct MemoriesConfig {+ pub use_memories: bool,pub max_raw_memories_for_global: usize,pub max_unused_days: i64,pub max_rollout_age_days: i64,@@ -402,6 +405,7 @@ pub struct MemoriesConfig {impl Default for MemoriesConfig {fn default() -> Self {Self {+ use_memories: true,max_raw_memories_for_global: DEFAULT_MEMORIES_MAX_RAW_MEMORIES_FOR_GLOBAL,max_unused_days: DEFAULT_MEMORIES_MAX_UNUSED_DAYS,max_rollout_age_days: DEFAULT_MEMORIES_MAX_ROLLOUT_AGE_DAYS,@@ -417,6 +421,7 @@ impl From<MemoriesToml> for MemoriesConfig {fn from(toml: MemoriesToml) -> Self {let defaults = Self::default();Self {+ use_memories: toml.use_memories.unwrap_or(defaults.use_memories),max_raw_memories_for_global: toml.max_raw_memories_for_global.unwrap_or(defaults.max_raw_memories_for_global)