Compare commits

...

1 Commits

Author SHA1 Message Date
pakrym-oai
5db3e5fba4 shell tool: move shell usage instructions from prompt to tool description (#6473) 2025-11-10 15:36:12 -08:00
2 changed files with 12 additions and 6 deletions

View File

@@ -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

View File

@@ -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);
}