diff --git a/crates/agent/src/templates/create_file_prompt.hbs b/crates/agent/src/templates/create_file_prompt.hbs index 39f83447faec6dedae10f15fb2e3034f0b664bf4..25069f6888e6478e66d8b0fee53f175294f4fdb9 100644 --- a/crates/agent/src/templates/create_file_prompt.hbs +++ b/crates/agent/src/templates/create_file_prompt.hbs @@ -6,6 +6,33 @@ The text you output will be saved verbatim as the content of the file. Tool calls have been disabled. Start your response with ```. +IMPORTANT: Output ONLY the file content between the backticks. Do NOT include: +- The file path or name (like "path/to/file.txt") +- Any markdown formatting within the content +- Any explanatory text before or after the backticks +- Any nested code fences within your output + + +If asked to create a file with "hello" inside: + +CORRECT output: +``` +hello +``` + +INCORRECT output (includes file path): +```path/to/file.txt +hello +``` + +INCORRECT output (nested code fences): +``` +``` +hello +``` +``` + + {{path}} diff --git a/crates/agent/src/tools/edit_file_tool.rs b/crates/agent/src/tools/edit_file_tool.rs index 0adff2dee3571f09b40ee69896c05e50c56b51b9..73e41db9657063c37df5d10eaa3aca94576ed574 100644 --- a/crates/agent/src/tools/edit_file_tool.rs +++ b/crates/agent/src/tools/edit_file_tool.rs @@ -44,8 +44,16 @@ pub struct EditFileToolInput { /// /// NEVER mention the file path in this description. /// + /// IMPORTANT: Do NOT include markdown code fences (```) or other markdown formatting in this description. + /// Just describe what should be done - another model will generate the actual content. + /// /// Fix API endpoint URLs /// Update copyright year in `page_footer` + /// Create a Python script that prints hello world + /// + /// INCORRECT examples (do not do this): + /// Create a file with:\n```python\nprint('hello')\n``` + /// Add this code:\n```\nif err:\n return\n``` /// /// Make sure to include this field before all the others in the input object so that we can display it immediately. pub display_description: String,