There's two main issues with our attachment file handling:
- We use synthetic file ids and replace them magically with file contents, which confuses the AI and can lead it down rabbit holes.
- You can't preview the attachment files in the chat UI.
Current state:
When you upload files, we generate file ids in chat stream handler and then resolve the file id to content in write_file
Proposed state:
Instead what we should do is have proper temp paths and then allow the AI to copy files from the temp path into the codebase. This is less magical to the AI, and if we do this for "attach as chat context" as well, then the user could prompt the user to say "actually let's use this in the app itself" and the AI could copy the image file (right now this isn't possible). We'll probably need to introduce a new tool called copy_file to support this.
There's two main issues with our attachment file handling:
Current state:
When you upload files, we generate file ids in chat stream handler and then resolve the file id to content in write_file
Proposed state:
Instead what we should do is have proper temp paths and then allow the AI to copy files from the temp path into the codebase. This is less magical to the AI, and if we do this for "attach as chat context" as well, then the user could prompt the user to say "actually let's use this in the app itself" and the AI could copy the image file (right now this isn't possible). We'll probably need to introduce a new tool called copy_file to support this.