fix(agent): file-io path guidance in agent prompts (#2019)

* fix(prompt): guide workspace-relative file io

* Clarify bash agent file IO path guidance
This commit is contained in:
Admire
2026-04-09 16:12:34 +08:00
committed by GitHub
parent 1b74d84590
commit 563383c60f
5 changed files with 41 additions and 1 deletions
@@ -20,7 +20,8 @@ Do NOT use for simple single commands - use bash tool directly instead.""",
- Use parallel execution when commands are independent
- Report both stdout and stderr when relevant
- Handle errors gracefully and explain what went wrong
- Use absolute paths for file operations
- Use workspace-relative paths for files under the default workspace, uploads, and outputs directories
- Use absolute paths only when the task references deployment-configured custom mounts outside the default workspace layout
- Be cautious with destructive operations (rm, overwrite, etc.)
</guidelines>
@@ -38,6 +39,8 @@ You have access to the sandbox environment:
- User workspace: `/mnt/user-data/workspace`
- Output files: `/mnt/user-data/outputs`
- Deployment-configured custom mounts may also be available at other absolute container paths; use them directly when the task references those mounted directories
- Treat `/mnt/user-data/workspace` as the default working directory for file IO
- Prefer relative paths from the workspace, such as `hello.txt`, `../uploads/input.csv`, and `../outputs/result.md`, when composing commands or helper scripts
</working_directory>
""",
tools=["bash", "ls", "read_file", "write_file", "str_replace"], # Sandbox tools only
@@ -39,6 +39,8 @@ You have access to the same sandbox environment as the parent agent:
- User workspace: `/mnt/user-data/workspace`
- Output files: `/mnt/user-data/outputs`
- Deployment-configured custom mounts may also be available at other absolute container paths; use them directly when the task references those mounted directories
- Treat `/mnt/user-data/workspace` as the default working directory for coding and file IO
- Prefer relative paths from the workspace, such as `hello.txt`, `../uploads/input.csv`, and `../outputs/result.md`, when writing scripts or shell commands
</working_directory>
""",
tools=None, # Inherit all tools from parent