agentleFS
JinchengGao-InftyJinchengGao-Infty/agent-loadout/skills/clashverge-rules-debug/SKILL.md

clashverge-rules-debug

Skill3 starsChanged 8 months agoMITView on GitHub

Diagnose and fix ClashVerge Rev routing problems on macOS, especially TUN/fake-ip issues that break SSH, cloudflared, WebSocket, or domain-specific direct routing. Use when traffic is being hijacked by ClashVerge, domains resolve to 198.18.x.x, or specific processes/domains need DIRECT bypass. Chinese triggers: clash, 代理, 分流, 直连, 网络不通, 198.18, 翻墙规则, VPN规则.

The file

We split this skill into the rules it gives an agent

11 rules. About 0 are common, 1 is distinctive, and 10 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 10

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use this skill for macOS ClashVerge Rev debugging when a host or process must bypass TUN/proxy, especially for ssh, cloudflared, WebSocket, …

    line 8
  2. Very specific:

    Write DIRECT rules into the active rules file, usually under prepend.

    line 14
  3. Very specific:

    Write the hostname into the active merge file under dns.fake-ip-filter.

    line 15
  4. Very specific:

    If the issue must be fixed immediately, patch the generated clash-verge.yaml too.

    line 16
  5. Distinctive:

    Read the service log. Trust the log over assumptions.

    line 20
  6. Very specific:

    If the result is 198.18.x.x, Clash fake-ip is in play.

    line 29
  7. Very specific:

    Add a DIRECT rule to the active rules template under prepend:

    line 43
  8. Very specific:

    Add the hostname to dns.fake-ip-filter in the active merge template:

    line 50
  9. Very specific:

    Prefer editing the active profile's rules and merge files for persistence.

    line 93
  10. Very specific:

    Use direct edits to clash-verge.yaml only for immediate fixes.

    line 94
  11. Very specific:

    If hostname is still 198.18.x.x after config change, you likely missed the fake-ip cache flush.

    line 97

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

ClashVerge Rules Debug

Use this skill for macOS ClashVerge Rev debugging when a host or process must bypass TUN/proxy, especially for ssh, cloudflared, WebSocket, Cloudflare Access, campus VPN, or any hostname that starts resolving to 198.18.x.x.

Minimal Workflow

  1. Find the active profile in profiles.yaml.
  2. Find that profile's merge, rules, and script files.
  3. Write DIRECT rules into the active rules file, usually under prepend.
  4. Write the hostname into the active merge file under dns.fake-ip-filter.
  5. If the issue must be fixed immediately, patch the generated clash-verge.yaml too.
  6. Reload Mihomo through the unix socket controller.
  7. Flush fake-ip cache and macOS DNS cache.
  8. Re-test DNS and the failing command.
  9. Read the service log. Trust the log over assumptions.

What To Check First

  1. Confirm the symptom.
    dig +short <host>
    dscacheutil -q host -a name <host>
    If the result is 198.18.x.x, Clash fake-ip is in play.
  2. Confirm Mihomo is intercepting the traffic.
    rg -n "<host>" ~/Library/Application\ Support/io.github.clash-verge-rev.clash-verge-rev/logs/service/service_latest.log
  3. Identify the active profile and its enhancement files. Read ~/Library/Application Support/io.github.clash-verge-rev.clash-verge-rev/profiles.yaml

The Reliable Fix Pattern

For a host that must bypass Clash:

  1. Add a DIRECT rule to the active rules template under prepend:
    prepend:
      - DOMAIN,example.com,DIRECT
      - PROCESS-NAME,cloudflared,DIRECT
  2. Add the hostname to dns.fake-ip-filter in the active merge template:
    dns:
      fake-ip-filter:
        - example.com
  3. Reload and flush caches:
    curl --unix-socket /tmp/verge/verge-mihomo.sock \
      -X PATCH 'http://localhost/configs?force=true' \
      -H 'Content-Type: application/json' \
      -d '{"path":"'$HOME'/Library/Application Support/io.github.clash-verge-rev.clash-verge-rev/clash-verge.yaml"}'
    curl --unix-socket /tmp/verge/verge-mihomo.sock -X POST http://localhost/cache/fakeip/flush
    dscacheutil -flushcache
  4. Verify:
    dig +short example.com  # Should NOT be 198.18.x.x

Useful Controller Commands

# Check version
curl --unix-socket /tmp/verge/verge-mihomo.sock http://localhost/version

# View current config
curl --unix-socket /tmp/verge/verge-mihomo.sock http://localhost/configs

# Reload config
curl --unix-socket /tmp/verge/verge-mihomo.sock \
  -X PATCH 'http://localhost/configs?force=true' \
  -H 'Content-Type: application/json' \
  -d '{"path":"'$HOME'/Library/Application Support/io.github.clash-verge-rev.clash-verge-rev/clash-verge.yaml"}'

# Flush fake-ip cache
curl --unix-socket /tmp/verge/verge-mihomo.sock -X POST http://localhost/cache/fakeip/flush

Key Principles

  • Prefer editing the active profile's rules and merge files for persistence.
  • Use direct edits to clash-verge.yaml only for immediate fixes.
  • PROCESS-NAME rules protect specific processes; DOMAIN rules protect specific hosts.
  • The service log is the source of truth.
  • If hostname is still 198.18.x.x after config change, you likely missed the fake-ip cache flush.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.