-
Notifications
You must be signed in to change notification settings - Fork 6k
feat: configurable compaction #4149
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
base: dev
Are you sure you want to change the base?
Conversation
55d51e3 to
03211fa
Compare
772b621 to
eb855e1
Compare
|
@maxeonyx have u seen how we handle /init? I was thinking a cleaner solution here would be to make compact a built in slash command, a user could override the prompt by defining their own compact and it wouldn't require additional config fields The main change this would require is allowing slash commands to register functions to execute, which ofc couldn't be done in json but perhaps for now that functionality would remain internal |
|
I haven't seen that, no, but I assumed compact has special handling due to the fact that it replaces the full context window. I am very open to doing this a different way. |
|
@rekram1-node in your suggestion, then, I would define my own |
03211fa to
10a1998
Compare
f1dc981 to
3e15a39
Compare
f8ee907 to
6a9856d
Compare
I agree, I think I would advocate for trying to build the built-in slash commands such as /compact with the sdk, in other words forcing yourself to use the same functionality that a custom plugin developer would use. That would drive a architecture which makes sure that user custom commands can be just as powerful as the ones provided by default. |
|
Yup total agreement, currently jumping between several fixes and then I can come back to these new feature prs |
|
I have the new version mostly implemented but I'm on holiday atm - feel free to take it over or close as I won't able to do the final "runnable as functions" part. But I have done the "custom md file to implement custom compact-type command". I can add precedence for overriding /compact - that's a good idea. |
10a1998 to
0ee7d14
Compare
/compact via markdown files
d47ece7 to
69bcc27
Compare
|
@rekram1-node @einarpersson This PR is ready for your review, hope it's what you are imagining. It has turned out pretty clean I think. |
bd56afe to
ec204d7
Compare
/compact via markdown files/compact commands
b574f2b to
6df3686
Compare
|
@rekram1-node Keeping this up-to date is becoming a hassle - would you be able to review? |
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
/compact commands3426717 to
0560497
Compare
0560497 to
d9e801f
Compare
This will help to address the many issues about compaction
Closes #3031
I have had great success using this version with a custom "handover" compact prompt.
example: override
/compactwithcompact.mdThis will now affect auto-compaction.
~/.config/opencode/command/compact.mdexample: custom command
/handover~/.config/opencode/command/handover.mdexample: set auto-compact to use
/handover~/.config/opencode/opencode.json{ "compaction": { "command": "handover" } }I have spent a lot of time making this PR as small and well integrated as possible, as I'm relying on it for my day-to-day work.