← 返回 Skills 市场
tankeito

clash-verge-auto-switch

作者 tankeito · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
98
总下载
1
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install clash-verge-auto-switch
功能描述
Use when the user wants Codex to speed test Clash Verge Rev or Mihomo proxies, auto-detect currently used Clash groups from the live controller, switch a sel...
使用说明 (SKILL.md)

Clash Verge Auto Switch

This skill gives Codex a reliable workflow for Clash Verge Rev and Mihomo proxy switching on macOS. It is meant for users who want a concrete node selected from a selector group, not just a passive health check.

When To Use It

Use this skill when the user asks to:

  • speed test Clash Verge or Mihomo nodes
  • switch the currently used Clash selector groups to the fastest node
  • diagnose why the Clash controller cannot be reached
  • install or remove a timed automatic switch job on macOS

Quick Start

Run the main script:

/usr/bin/python3 ~/.codex/skills/clash-verge-auto-switch/scripts/switch_fastest.py

By default it auto-discovers the current active selector chain from the live Clash controller. To inspect what it found:

/usr/bin/python3 ~/.codex/skills/clash-verge-auto-switch/scripts/switch_fastest.py --list-groups

Target explicit groups:

/usr/bin/python3 ~/.codex/skills/clash-verge-auto-switch/scripts/switch_fastest.py \
  --group 'Proxy' \
  --group 'ChatGPT'

Dry-run without changing selections:

/usr/bin/python3 ~/.codex/skills/clash-verge-auto-switch/scripts/switch_fastest.py --dry-run

Workflow

  1. Check whether the Mihomo controller is reachable.
  2. If the user did not name target groups, inspect the live /proxies tree and auto-discover groups from the current active selection chain.
  3. Expand url-test, fallback, and load-balance groups into leaf proxies, but do not rewrite nested selector groups unless the user explicitly targets them.
  4. Test candidate proxies with the controller delay API and switch the selector group to the lowest-latency healthy node.
  5. Report the winning node, measured latency, and whether a switch happened.

Group Discovery

  • Default mode is --group-scope current, which follows the currently selected chain from the live Clash proxy tree.
  • Use --group-scope top-level when you want all top-level selector groups discovered from the current controller session.
  • Use --group-scope all when you want every selector group in the current Clash instance.
  • Use explicit --group flags when the user wants exact control.

Scheduling

For a true custom-minute schedule on macOS, use the bundled launchd installer instead of Codex automations because Codex recurring schedules only support hourly intervals.

Install:

~/.codex/skills/clash-verge-auto-switch/scripts/install_launch_agent.sh \
  --interval-minutes 30 \
  --group-scope current

Remove:

~/.codex/skills/clash-verge-auto-switch/scripts/uninstall_launch_agent.sh

Notes

  • Read runtime-notes.md when you need the generic controller discovery and group-detection rules.
  • If the controller is offline, ask the user whether Clash Verge should be opened first or run the script with --launch-if-needed.
安全使用建议
This skill appears to do what it says: discover a local Clash controller, test proxies, switch selector groups, and optionally install a macOS LaunchAgent to run periodically. Before installing, review the included scripts (switch_fastest.py and install_launch_agent.sh). Key points to consider: - The script will read local Clash config files (~/.config/clash/config.yaml and Clash Verge's config path) and will read CLASH_API_UNIX_SOCKET, CLASH_API_URL, and CLASH_API_SECRET environment variables if present. If a controller secret exists it will be used in an Authorization header to the controller API. - The script uses curl to communicate with the controller and may change selector state (it performs switches). Use --dry-run first to verify behavior. - The install script writes a LaunchAgent plist to ~/Library/LaunchAgents and runs the script at the chosen interval; inspect the generated plist and logs before enabling. Installation requires explicit user action; do not run the installer unless you trust the code and understand the schedule. - If you are unsure, run the Python script manually with --list-groups and --dry-run, and verify it only talks to your intended controller. If you rely on a secret, rotate it if you suspect exposure. If you want to be extra cautious, run the code in a controlled account or inspect it line-by-line before permitting installation.
功能分析
Type: OpenClaw Skill Name: clash-verge-auto-switch Version: 1.0.0 The skill provides automated proxy switching for Clash Verge/Mihomo on macOS, utilizing risky capabilities such as local configuration/secret retrieval and system persistence. Specifically, 'switch_fastest.py' reads application config files to extract API secrets, and 'install_launch_agent.sh' installs a macOS launchd agent to ensure the script runs on a schedule. While these actions are documented and align with the stated purpose of maintaining a high-speed proxy connection, the combination of persistence and credential access warrants a suspicious classification under the provided criteria for high-risk behaviors.
能力评估
Purpose & Capability
Name/description match the implementation: the scripts discover a local Mihomo/Clash controller (via explicit args, CLASH_API_* env vars, or local config files), call the controller API, run latency tests, and switch selector groups. No unrelated cloud credentials or unrelated binaries are requested.
Instruction Scope
SKILL.md and the scripts instruct the agent to read local Clash config files (~/.config/clash/config.yaml and ~/Library/Application Support/...), consult environment variables (CLASH_API_UNIX_SOCKET, CLASH_API_URL, CLASH_API_SECRET), call the controller via curl (HTTP or unix socket), and optionally launch the Clash app. These actions are within the stated purpose but are broad (they examine local config and may modify controller state by switching selectors).
Install Mechanism
There is no external download; install is a local zsh script that writes a user LaunchAgent plist under ~/Library/LaunchAgents and uses launchctl. This is a standard macOS user-level installation method and the script does not pull code from remote URLs.
Credentials
The skill does not declare required env vars but will read CLASH_API_UNIX_SOCKET, CLASH_API_URL, and CLASH_API_SECRET if present and will use any 'secret' from local configs as an Authorization header to the controller. While these env/config accesses are necessary for discovering and authenticating to a Clash controller, users should be aware the script will read local config files and environment variables and may send the secret value to the controller API.
Persistence & Privilege
The provided installer creates a user LaunchAgent that will run the bundled Python script at the chosen interval and write logs to ~/Library/Logs. The skill does not set always:true; installation is explicit via the install script, but installing grants the script periodic execution under the user account.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install clash-verge-auto-switch
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /clash-verge-auto-switch 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
- Initial release of clash-verge-auto-switch. - Enables speed testing of Clash Verge Rev and Mihomo proxy nodes. - Automatically discovers and switches selector groups to the fastest working proxy on macOS. - Diagnoses controller connectivity issues and offers troubleshooting. - Adds install/uninstall scripts for setting up an automatic switch job using macOS launchd with user-defined intervals.
元数据
Slug clash-verge-auto-switch
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

clash-verge-auto-switch 是什么?

Use when the user wants Codex to speed test Clash Verge Rev or Mihomo proxies, auto-detect currently used Clash groups from the live controller, switch a sel... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 98 次。

如何安装 clash-verge-auto-switch?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install clash-verge-auto-switch」即可一键安装,无需额外配置。

clash-verge-auto-switch 是免费的吗?

是的,clash-verge-auto-switch 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

clash-verge-auto-switch 支持哪些平台?

clash-verge-auto-switch 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 clash-verge-auto-switch?

由 tankeito(@tankeito)开发并维护,当前版本 v1.0.0。

💬 留言讨论