#File Edits
1 messages Β· Page 1 of 1 (latest)
TIL file edits are not a solved problem. There are entire startups just for that.
We need at the very least a search/replace tool, and possibly diff apply - brute write-file() is expensive and unreliable.
But that's just one step.
Diff apply would be epic
I'll implement it my workspace!
I'll do search/replace just for completeness too
Code workspaces probably need a full ast lookup? Maybe?
What I've been told:
- diff is the best you can do whith general model. it works but it's slower than a specialized model
- I was also told "the top success for diff is 85% per aider benchmark"
- cursor & others most likely use specialized models
- startups like replace.ai offer proprietary models
yes, also related: https://aider.chat/docs/unified-diffs.html
I've seen that the avante.nvim maintainer implemented that to add similar "cursor planning mode like" to avante.
GPT-4 Turbo has a problem with lazy coding, which can be signiciantly improved by asking for code changes formatted as unified diffs.
ββββββThe most painful part of developing this feature was figuring out how to perform a streaming diff between the code being generated and the original code during the applying process. I looked into VSCode's Copilot, and it turns out that it waits until the code is completely
I'm running into a problem with my write_file() tool
it looks like it messes up when writing < or > back to a file
example:
162 : [2.2s] | books = get_books(test_db)
162 : [2.2s] | - assert len(books) >= 2
162 : [2.2s] | + assert len(books) e 2
and then in the next step when the test tool runs it dies with an invalid character type error
seen in context: line 2244 of https://github.com/vikram-dagger/fastapi-sample-app/actions/runs/13670090115/job/38218493208
also it doesn't happen every time, but when it does it is always with angle brackets
short of removing that assertion from the test suite entirely, any ideas on how to fix it? it's knocking my agent off course whenever it happens
This was also happening with &
fwiw I was able to dramatically reduce the occurrence of this error by keeping the file below 100 lines of code
Yeah that makes a huge difference. That's exactly why partial reads+writes are so effective for workspaces. We don't have to keep reading/writing entire files and adding that to the history
lets see if this works π https://github.com/kpenfound/dag/commit/6e0b66c8c842bf9ee6a78ff2a5f724a08ced2b00
@solar echo dag/ is the new daggerverse/? π
I'm trying to move from dagger-modules/ to dag/ because it's shorter and I still like monorepos for utility modules
and it's just a bucket of dags π
It's trying to use it and everything looks good, but I keep getting malformed patch errors π
i'll try git apply instead of patch
Same issue. I wonder if there's some bad characters hiding in there
I wonder if there's an even "dumber" option that's just line-replace, or search-replace (I think @glass anvil showed me the official MCP file edit server by Anthropic uses search replace)