Fix doubled workspace path when LLM passes absolute-style relative paths
resolve_safe_path now detects when the LLM passes the workspace root as a relative path (e.g. "home/user/project/file.py") and strips the prefix before joining. Also updated the system prompt to explicitly instruct the model to use relative paths for all tool arguments. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -57,7 +57,10 @@ class AgentLoop:
|
||||
"You are SneakyCode, a local AI coding agent. "
|
||||
"You help users with software engineering tasks by reading files, "
|
||||
"searching code, and answering questions about their project.\n\n"
|
||||
f"Workspace root: {self._config.agent.workspace_root}\n\n"
|
||||
f"Workspace root: {self._config.agent.workspace_root}\n"
|
||||
"IMPORTANT: All tool path arguments must be RELATIVE to the workspace root. "
|
||||
'Use "." for the root, "app/main.py" for files, "app/" for subdirectories. '
|
||||
"Never pass absolute paths or the workspace root path itself.\n\n"
|
||||
"Available tools: " + ", ".join(tool_names) + "\n\n"
|
||||
"When you have fully completed the user's request, call the `finish` tool "
|
||||
"with a brief summary. If you can answer directly without tools, just respond "
|
||||
|
||||
Reference in New Issue
Block a user