diff --git a/codex-rs/core/gpt_5_codex_prompt.md b/codex-rs/core/gpt_5_codex_prompt.md index e3cbfa0f25..57d06761ba 100644 --- a/codex-rs/core/gpt_5_codex_prompt.md +++ b/codex-rs/core/gpt_5_codex_prompt.md @@ -2,8 +2,6 @@ You are Codex, based on GPT-5. You are running as a coding agent in the Codex CL ## General -- The arguments to `shell` will be passed to execvp(). Most terminal commands should be prefixed with ["bash", "-lc"]. -- Always set the `workdir` param when using the shell function. Do not use `cd` unless absolutely necessary. - When searching for text or files, prefer using `rg` or `rg --files` respectively because `rg` is much faster than alternatives like `grep`. (If the `rg` command is not found, then use alternatives.) ## Editing constraints diff --git a/codex-rs/core/src/tools/spec.rs b/codex-rs/core/src/tools/spec.rs index cb1aeafdb2..e69a9bf973 100644 --- a/codex-rs/core/src/tools/spec.rs +++ b/codex-rs/core/src/tools/spec.rs @@ -181,8 +181,11 @@ fn create_exec_command_tool() -> ToolSpec { ToolSpec::Function(ResponsesApiTool { name: "exec_command".to_string(), description: - "Runs a command in a PTY, returning output or a session ID for ongoing interaction." - .to_string(), + concat!( + "Runs a command in a PTY, returning output or a session ID for ongoing interaction.\n", + "- Always set the `workdir` param when using the shell function. Do not use `cd` unless absolutely necessary." + ) + .to_string(), strict: false, parameters: JsonSchema::Object { properties, @@ -274,7 +277,12 @@ fn create_shell_tool() -> ToolSpec { ToolSpec::Function(ResponsesApiTool { name: "shell".to_string(), - description: "Runs a shell command and returns its output.".to_string(), + description: concat!( + "Runs a shell command and returns its output.\n", + "- The value of `command` will be passed to execvp(). Most terminal commands should be prefixed with [`bash`, `-lc`].\n", + "- Always set the `workdir` param when using the shell function. Do not use `cd` unless absolutely necessary.", + ) + .to_string(), strict: false, parameters: JsonSchema::Object { properties, @@ -1726,7 +1734,7 @@ mod tests { }; assert_eq!(name, "shell"); - let expected = "Runs a shell command and returns its output."; + let expected = "Runs a shell command and returns its output.\n- The value of `command` will be passed to execvp(). Most terminal commands should be prefixed with [`bash`, `-lc`].\n- Always set the `workdir` param when using the shell function. Do not use `cd` unless absolutely necessary."; assert_eq!(description, expected); }