You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem: Line editing is unreliable, full writes work but can have
side effects and devour tokens.
Main challenge is that LLMs suck at counting reliably. This solution
removes the need for counting and builds on the assumption that there is
plenty of patch data an LLM trained on.
But, likely the numbers are still close, which helps us deal with any
ambiguity in the patch. Bonus is that with this we can support multiple
edits in a file with a single LLM call and minimal tokens.
How it works:
* First parse the patch into a loosy format we can work with
* Iterate over the lines in the target file, if there is a match with a
hunk, create a candidate
* If that line matches with the next line for any current candidate,
keep the candidate, otherwise ditch
* Finally, we can recalculate the source and dest lines and ranges, and
re-render the patch.
The algorithm supports ambiguity (multiple hunks matching). Still needs
to be dealt with.
TODO:
- [x] Deal with ambiguity
- [x] More tests for multiple hunks
- [x] Test with diffy if the regenerated patches are correct
- [x] Add it all to the tool
- [x] Run some evals
If the evals pass we'll keep it in. After we run a set of SWE, if we see
no issues, as far as I'm concerned we can make it the default (and write
a cool blog article).
Aside, it should also be possible to Cow/borrow most of the inner values
and have this be near zero copy. The way it will be used however it's no
where near a bottleneck. Cool exercise though.
Copy file name to clipboardExpand all lines: README.md
+6-4Lines changed: 6 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -230,13 +230,15 @@ Additionally, kwaak provides a number of slash commands, `/help` will show all a
230
230
231
231
### How does it work?
232
232
233
-
On initial boot up, Kwaak will index your codebase. This can take a while, depending on the size. Once indexing has been completed once, subsequent startups will be faster. Indexes are stored with [duckdb](https://duckdb.org), and indexing is cached with [redb](https://github.com/cberner/redb).
233
+
On initial boot up, Kwaak will index your codebase. This can take a while, depending on the size. Once indexing has been completed once, subsequent startups will be faster. Indexes are stored with [duckdb](https://duckdb.org). Kwaak uses the index to provide context to the agents.
234
234
235
235
Kwaak provides a chat interface similar to other LLM chat applications. You can type messages to the agent, and the agent will try to accomplish the task and respond.
236
236
237
237
When starting a chat, the code of the current branch is copied into an on-the-fly created docker container. This container is then used to run the code and execute the commands.
238
238
239
-
After each chat completion, kwaak will lint, commit, and push the code to the remote repository if any code changes have been made. Kwaak can also create a pull request. Pull requests include an issue link to #48. This helps us identify the success rate of the agents, and also enforces transparency for code reviewers.
239
+
After each chat completion, kwaak can lint, commit, and push the code to the remote repository if any code changes have been made. Kwaak can also create a pull request. Pull requests include an issue link to #48. This helps us identify the success rate of the agents, and also enforces transparency for code reviewers. This behaviour is fully configurable.
240
+
241
+
Kwaak uses patch based editing by default. This means that only the changed lines are sent to the agent. This is more efficient. If you experience issues, try changing the edit mode to `whole` or `line`.
240
242
241
243
<palign="right">(<ahref="#readme-top">back to top</a>)</p>
242
244
@@ -376,7 +378,7 @@ max_elapsed_time_sec = 120
376
378
#### Other configuration
377
379
378
380
-**`agent_custom_constraints`**: Additional constraints / instructions for the agent.
379
-
These are passes to the agent in the system prompt and are rendered in a list. If you
381
+
These are passes to the agent in the system prompt. If you
380
382
intend to use more complicated instructions, consider adding a file to read in the
381
383
repository instead.
382
384
-**`cache_dir`, `log_dir`**: Directories for cache and logs. Defaults are within your system's cache directory.
@@ -386,7 +388,7 @@ max_elapsed_time_sec = 120
386
388
-**`otel_enabled`**: Enables OpenTelemetry tracing if set and respects all the standard OpenTelemetry environment variables.
387
389
-**`tool_executor`**: Defaults to `docker`. Can also be `local`. We **HIGHLY** recommend using `docker` for security reasons unless you are running in a secure environment.
388
390
-**`tavily_api_key`**: Enables the agent to use [tavily](https://tavily.com) for web search. Their entry-level plan is free. (we are not affiliated)
389
-
-**`agent_edit_mode`**: Defaults to `whole` (write full files at the time). If you experience issues with (very) large files, you can experiment with `line` edits.
391
+
-**`agent_edit_mode`**: Defaults to `patch`. Other options are `whole` and `line`. If you experience issues, try changing the edit mode. `whole` will always write the full file. This consumes more tokens and can have side effects.
390
392
-**`git.auto_push_remote`**: Enabled by default if a github key is present. Automatically pushes to the remote repository after each chat completion. You can disable this by setting it to `false`.
391
393
-**`git.auto_commit_disabled`**: Opt-out of automatic commits after each chat completion.
392
394
-**`tools`**: A list of tool names to enable or disable.
0 commit comments