Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show working directory before saving files #427

Open
Miyou opened this issue Jan 29, 2025 · 2 comments
Open

Show working directory before saving files #427

Miyou opened this issue Jan 29, 2025 · 2 comments
Labels

Comments

@Miyou
Copy link
Contributor

Miyou commented Jan 29, 2025

I had an agent running and told it to make some edits in another folder. It used cd, then I told it to write some files to its own workspace but both it and I forgot that it had cd'd away from its workspace. Perhaps showing the current working directory on each file save prompt could be useful?

@ErikBjare
Copy link
Owner

ErikBjare commented Jan 29, 2025

Anthropic has suggested that the solution to this is to always use absolute paths...

While building our agent for SWE-bench, we actually spent more time optimizing our tools than the overall prompt. For example, we found that the model would make mistakes with tools using relative filepaths after the agent had moved out of the root directory. To fix this, we changed the tool to always require absolute filepaths—and we found that the model used this method flawlessly.

I've considered adding it to the system prompt and optimizing for such use by returning full paths wherever we provide one.

@ErikBjare
Copy link
Owner

I now mention a preference for absolute paths it in the system prompt: ba11552

Some tools should probably be updated to return absolute paths instead of relative ones.

Maybe also inject the current working directory in a ephemeral context message (we used to do something like this) before the last user/assistant message so that it can easily/reliably construct correct paths from relative dir output (like ls, find).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants