opencode icon indicating copy to clipboard operation
opencode copied to clipboard

morph file edit tool using Fast Apply

Open bhaktatejas922 opened this issue 4 months ago • 14 comments

Optional Fast Apply model

bhaktatejas922 avatar Aug 13 '25 23:08 bhaktatejas922

improves edit performance and speed considerably.

bhaktatejas922 avatar Aug 13 '25 23:08 bhaktatejas922

still testing this so left it as a draft. Might need some conditional system prompt changes

bhaktatejas922 avatar Aug 13 '25 23:08 bhaktatejas922

still testing this so left it as a draft. Might need some conditional system prompt changes

curious which models you tested this with and what you found? no system prompt changes necessary?

adamdotdevin avatar Aug 15 '25 11:08 adamdotdevin

Tested this with qwen3 and qwen3-coder running on ollama.

What a difference it makes! I didn't find a case where the edit failed yet.

image

P.S. No system prompt changes necessary.

I would ship this ASAP - it makes such a huge difference in quality and it is allot faster.

SMFloris avatar Aug 17 '25 10:08 SMFloris

i guess my main question remaining is how this interacts with permissions config and other places where we support listing tools (agent config comes to mind). ideally any alt edit tool like this "becomes" the edit tool, so that any config interacting with edit applies to the morphedit tool when you choose to use it instead of the default edit. cc @thdxr

adamdotdevin avatar Aug 17 '25 12:08 adamdotdevin

i guess my main question remaining is how this interacts with permissions config and other places where we support listing tools (agent config comes to mind). ideally any alt edit tool like this "becomes" the edit tool, so that any config interacting with edit applies to the morphedit tool when you choose to use it instead of the default edit. cc @thdxr

do the changes in the registry not address this?

bhaktatejas922 avatar Aug 18 '25 07:08 bhaktatejas922

i guess my main question remaining is how this interacts with permissions config and other places where we support listing tools (agent config comes to mind). ideally any alt edit tool like this "becomes" the edit tool, so that any config interacting with edit applies to the morphedit tool when you choose to use it instead of the default edit. cc @thdxr

do the changes in the registry not address this?

no, if someone has permissions for an agent configured to "edit: ask", for instance, then that won't get picked up if they're using "morphedit". we need to have a notion of replacing the default "edit" tool, instead

adamdotdevin avatar Aug 18 '25 12:08 adamdotdevin

i guess my main question remaining is how this interacts with permissions config and other places where we support listing tools (agent config comes to mind). ideally any alt edit tool like this "becomes" the edit tool, so that any config interacting with edit applies to the morphedit tool when you choose to use it instead of the default edit. cc @thdxr

do the changes in the registry not address this?

no, if someone has permissions for an agent configured to "edit: ask", for instance, then that won't get picked up if they're using "morphedit". we need to have a notion of replacing the default "edit" tool, instead

Ah I get it now. Just pushed an update to address this

bhaktatejas922 avatar Aug 19 '25 08:08 bhaktatejas922

sorry, i could have been more clear about what i'm thinking. i'd still expect this morph tool to live in it's own tool definition/file, it should simply replace the edit tool in the registry if enabled. i think of it like the "default app" on iOS (email, calendar, maps, etc.); the user can swap out the default edit tool for their preferred edit tool, with morph being one of those options. does that make sense? this latest approach/commit won't scale well to other tools in the sense that edit.ts will be a mess, we definitely want to isolate each tool in it's own file.

adamdotdevin avatar Aug 19 '25 10:08 adamdotdevin

sorry, i could have been more clear about what i'm thinking. i'd still expect this morph tool to live in it's own tool definition/file, it should simply replace the edit tool in the registry if enabled. i think of it like the "default app" on iOS (email, calendar, maps, etc.); the user can swap out the default edit tool for their preferred edit tool, with morph being one of those options. does that make sense? this latest approach/commit won't scale well to other tools in the sense that edit.ts will be a mess, we definitely want to isolate each tool in it's own file.

AH ok yeah my bad. the new changes should reflect what youre saying

bhaktatejas922 avatar Aug 20 '25 23:08 bhaktatejas922

@adamdotdevin good to go?

bhaktatejas922 avatar Aug 23 '25 04:08 bhaktatejas922

@adamdotdevin lmk if you want to see any other changes made

bhaktatejas922 avatar Aug 28 '25 00:08 bhaktatejas922

It would be helpful if it also supported setting the baseUrl to an alternate server, like OpenRouter. There are already existing provider definitions that could be used to define Morph as a provider, and rely on the existing provider api-key definition, not introduce a separate environment variable. The definition of api-keys as environment variables are a separate feature.

Also, I would suggest using a consistent terminology in that this is an 'apply' model, not an 'edit' model. Having a custom edit/instruct model (separate from the agent/orchestrator) would be another feature down the line.

Since there's also a gap in how edits and compacts are hardcoded and not customizeable, a new "support" mode could be introduced that allows the definition of these models as support agents, allowing a definition of the apply, edit, and compact models.

matfax avatar Sep 18 '25 06:09 matfax

@adamdotdevin lmk if you want me to clean this up a bit if you want to get this in

bhaktatejas922 avatar Sep 22 '25 07:09 bhaktatejas922