Why process rules exist (and who they help)

System proxy mode is pleasant when every program you care about respects WinINET or GNOME proxy settings, but that list is shorter than marketing slides suggest. Games, many Electron shells, custom updaters, and long-lived daemons often open sockets as if no proxy were configured. The opposite extreme—turning on TUN and capturing the whole machine—fixes bypasses yet reintroduces a different pain: you may not want your bank app, LAN printer utility, or corporate VPN client hairpinning through a remote exit just because the adapter is global.

Process-level rules sit in the middle. In Clash Meta (Mihomo) class cores on Windows and Linux desktops, matchers such as PROCESS-NAME and PROCESS-PATH let the engine classify a flow using the originating binary name or path, then send it to a named proxy-groups entry or DIRECT. That is the practical meaning of on-demand proxy in this article: you still write ordinary rule-based split routing, but you add a narrow rows that only fire when a specific program is on the call stack.

This guide is written for people who share the machine with mixed workloads—browser tabs that need an overseas exit beside IDE traffic that should stay domestic, or a hypervisor host where only one management executable should traverse a stable relay. If you are on Android, the platform exposes a different UX; see per-app proxy on Clash for Android instead of copying desktop YAML verbatim.

Prerequisites you cannot skip

Process metadata does not appear by magic in every build. In real deployments you should expect to satisfy most of the following before PROCESS-NAME lines do anything meaningful:

  • Mihomo-class core. Classic Clash branches without Meta extensions will not understand the same matcher vocabulary. Confirm your client embeds a recent Mihomo release if you paste examples from this page.
  • Rule mode. Global mode shortcuts policy by design; you are trying to express fine-grained choices, so keep the profile in the normal rule-evaluating path.
  • TUN or an equivalent traffic path that exposes process association. On many Windows setups, pure system proxy never attributes sockets to a process in a way the core can read. After you enable TUN, the dataplane typically sees enough context for Windows APIs or driver callbacks to label the owner process. On Linux, cgroup v2–based attribution is common; your kernel, systemd, and root capabilities must allow the core to map connections to executables. Our TUN mode guide walks through adapter setup and DNS alignment; read it before you assume process rules are broken.
  • Elevation when the OS demands it. Driver installs on Windows and capability boundaries on Linux are not optional extras; they are part of how process names become trustworthy.
ℹ️
Reality check: If a connection never traverses the Mihomo dataplane, no rule type can see it. Double VPN stacks, corporate forwarders, or containers with isolated network namespaces may show up as unexpected process names—or no match at all.

PROCESS-NAME versus PROCESS-PATH

Both matchers appear in the top-level rules: list and participate in the same first-match-wins ordering as DOMAIN-SUFFIX and GEOIP. The difference is what you are matching against:

  • PROCESS-NAME compares the simple executable label, for example firefox.exe on Windows or firefox on Linux. It is quick to type and easy to read in logs, but it collides when two programs share a generic runtime name such as java or electron.
  • PROCESS-PATH matches a substring of the full filesystem path. That disambiguates side-by-side installs: C:\Tools\BrowserA\app.exe versus C:\Tools\BrowserB\app.exe may both report as app.exe in Task Manager, yet their paths differ.

Neither matcher replaces domain intelligence. Hostname rules remain the backbone of Meta Mihomo split routing because CDNs, certificate pins, and shared APIs are still best described by name. Process rules supplement that story when the same hostname is contacted by two different programs and you genuinely need different exits.

# Illustrative excerpts—merge into your profile and rename groups.
proxy-groups:
  - name: PROXY_BROWSER
    type: select
    proxies: [YOUR_NODE, DIRECT]

rules:
  # Higher priority: only this Windows browser binary uses PROXY_BROWSER.
  - PROCESS-NAME,firefox.exe,PROXY_BROWSER
  # Path-based carve-out on Linux desktop builds.
  - PROCESS-PATH,/opt/somevendor/app/,PROXY_BROWSER
  # Your remaining DOMAIN / GEOIP / MATCH rules continue below...

Always validate syntax against the documentation hub bundled with your exact core version—field spelling drifts across releases.

Windows: tested workflow to capture exe names

Assume TUN is already healthy and browsing works under your ordinary DOMAIN rules before you overlay process matchers.

  1. Open Task Manager Details. The Processes tab shows friendly titles; Details shows .exe bases. Prefer the same spelling Mihomo logs will print—usually the on-disk basename including extension.
  2. Confirm bitness and install channel. Microsoft Store bundles sometimes launch conhost wrappers; portable zips ship a differently named updater. Match the executable that owns the outbound socket, not the splash screen launcher.
  3. Use client connection logs. Modern Mihomo GUIs expose a live connection table with process labels. Trigger the traffic, highlight the row, and copy the process field instead of guessing from marketing icons.
  4. Inject YAML near the TOP of actionable rules, but still below diagnostics you insert for rejects. Remember that GEOIP shortcuts placed above your PROCESS-NAME lines will consume traffic first; reorder intentionally.
  5. Retest domestic sites. Ensure your GEOIP CN or LAN-CIDR rules remain below the specialized process rows—or above, depending on intent—so you do not accidentally proxy traffic you meant to keep DIRECT.

Antivirus suites and DRM sometimes inject intermediary processes. When connection logs attribute traffic to Service Host or a vendor shim, pinning PROCESS-NAME on the visible consumer executable may fail until you match the intermediary instead. PATH-based matchers help when vendors install multiple copies across drives.

Linux: cgroup names, Flatpak, and headless quirks

Linux desktops add variety: distro packages place binaries under /usr/bin, Steam ships runtimes inside home directories, Flatpak nests executables beneath /var/lib/flatpak, and AppImages mount ephemeral paths that change between launches. PROCESS-PATH fragments that assume a stable prefix may therefore flap.

  1. Resolve the binary: use readlink -f /proc/<pid>/exe for suspicious flows—or trust the Mihomo GUI log—to learn the authoritative path assigned by the kernel.
  2. Prefer minimal path snippets that survive minor upgrades (/opt/brave/) over entire versioned folders unless you automate updates.
  3. Systemd units may run services as unprivileged users with names you did not anticipate; cron jobs inherit different environments than interactive shells.
  4. cgroup visibility depends on unified hierarchy support. Containers (Docker, Podman) often isolate processes such that connections appear to originate from rootlesskit or bridge helpers—routing "only this container" is closer to orchestration-layer proxy settings than one more YAML row.

For systemd-managed headless Mihomo nodes, keep process rules in sync with whichever user launches the workloads you intend to classify. A server cron job curling an API will not magically pick up GNOME-wide proxy drafts.

⚠️
Electron caveat: Chat apps built on Electron often spawn renderer and GPU helper binaries with distinct names (chrome_crashpad_handler, --type=gpu-process, and similar). Matching only Electron may miss subtrees unless you consolidate by path or rely on hostname rules instead.

Combining PROCESS rules with DOMAIN and GEOIP shortcuts

Users sometimes paste a flashy PROCESS-NAME snippet at the bottom of a 4,000-line ruleset imported from strangers on the Internet, then complain that "nothing respects my browser rule." In Mihomo semantics, whichever line matches first wins. If MATCH,🚀Final already swallowed the flow—or a blunt GEOIP line fired earlier—your new row is dead code.

A sustainable pattern keeps three layers mentally distinct:

  1. Fast identity rules for LAN, captive portals, or intranet IPs that must never leave the continent.
  2. PROCESS or specialized DOMAIN overrides for the handful of executables or host clusters you micromanage.
  3. Broad GEOIP / provider-fed lists as safety nets lower in the file.

When migrating templates, diff your insertions against upstream churn. Remote RULE-SET merges can reorder nightly and silently overshadow manual rows unless you stash process overrides in a local include you control.

When process rules still do not behave

  • Fake-IP and sniffer interplay. If destination rewriting confuses matchers, revisit fake-ip filtering and sniffed hostnames; see fake-ip fundamentals and the Meta sniffer guide for layered diagnosis.
  • Windows services executing as SYSTEM sometimes fan out downloads through shared Service Host binaries—routing "this update channel" cleanly may require hostname rules instead.
  • WSL2 VMs behave like separate Linux kernels; classify Windows Mihomo expectations accordingly. Bridging LAN from the doc here is often more reliable than fantasizing about a single PROCESS line that spans host and guest.
  • Kernel permission denials: if the dataplane lacks access to cgroup metadata on Linux, the matcher never triggers. Fix capabilities before rewriting YAML yet again.

Operational summary

Process matchers are surgical instruments. They excel when binaries are distinctive, installs are stable, and you already embraced TUN-level visibility. They fail when overlapping runtimes muddy the executable name space, vendors inject shims you did not whitelist, or you expected container sandboxes to look like cozy desktop binaries.

Document every bespoke line you add: tomorrow you should still know whether PROXY_BROWSER pinned Arc, Chrome, or a patched fork. Prefer pairings with observable domain logs so you can delete obsolete rows after SDK upgrades reshuffle endpoints.

When you combine disciplined DOMAIN tables with sparing PROCESS overrides, Mihomo behaves less like an all-or-nothing VPN knob and more like a router policy—with executables mapped to hops the way network engineers map VLANs.

For a regularly patched desktop client where TUN installs without drama, grabbing the newest build first cuts down half the mystery troubleshooting calls. Start from our official download page, validate base connectivity under ordinary rules, layer process matchers afterward, then tune policy groups calmly instead of reacting to unreadable cascade failures.

If this workflow matches how you browse and build software—precise hops instead of a blind global tunnel—take the natural next step: Download Clash for free from our official page and experience the difference for yourself.