Why editing the subscription file never works
A subscription is replaced wholesale every time it updates, so hand-edited lines disappear. Clash Verge solves this by keeping your changes in a separate layer that is merged in when the final config is generated. The subscription can update as often as it likes.
When you create a new item on the Profiles page you can choose Merge (a YAML fragment) or Script (JavaScript). Bind it to a profile from that profile card, or use the global Merge and Script, which apply to every profile.
Keep a way back
Note which profile currently works before you attach an extension. Unbinding it puts you straight back to that state.
Which one fits which job
- 1
Merge: a YAML fragment
Top-level keys such as mixed-port, mode and log-level are overwritten directly. Rules use three dedicated keys: prepend-rules inserts at the top, append-rules adds at the end, filter-rules deletes matching lines. If you want your own rules to win, use prepend-rules.
- 2
Script: one main function
The signature is main(config). You receive the whole config object, change it, and return the whole object. This is the right tool for conditional bulk edits, such as adding interval and tolerance to every url-test group or filtering nodes by keyword.
- 3
Order of execution
Subscription first, then Merge, then Script. When several extensions are attached they run in the order you arranged them, and the last write to a field wins.
Check what was actually merged
Opening the file from the profile menu shows the raw subscription, not the result. To see what the core is really running, use the option that shows the runtime config. Your Merge and Script changes should all be there. If they are not, the usual cause is YAML indentation, and the first screen of the Logs page will carry a parse error with a line number.
- Never put MATCH in prepend-rules; it swallows every rule after it
- A Script must return the entire config object, not a fragment
- Saving regenerates and hot-reloads the config; you do not need to restart the app
Common questions
I set a dns block in my Merge and nothing changed. Why?
Check the DNS override switch in the client. While it is on, Clash Verge replaces the dns section of the config with its own settings. Turn it off to let your version through.
Can I attach several Merge files at once?
Yes. Extensions form a chain and run in the order you arrange them. Give each Merge a single job, for example one for rules and one for ports and DNS, so problems are easy to trace.