cc-switch-cli CLAUDE.md

Repository instructions for cc-switch-cli, a Rust application that switches between provider settings for coding-agent command-line tools.

In plain words
What is it for?
Use them when running, building, formatting, linting, testing, or changing cc-switch-cli.
Why use it?
They collect the project’s commands, configuration model, architecture, formatting checks, lints, and tests in one place.

Instructions file

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/saladday/cc-switch-cli/claude-md
Clone the repo
git clone --depth 1 https://github.com/SaladDay/cc-switch-cli
Per session 2,533 This file is loaded in full into every session.
When invoked 2,533 The same file — it is already loaded in full.
Security scan B 1 finding. Scan, not verified.
Origin 98% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.02533 $0.02533
Opus 5 $0.01267 $0.01267
Sonnet 5 $0.00507 $0.00507
Haiku 4.5 $0.00253 $0.00253

Measured 3d ago against content hash 2463ba11bc6e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

cc-switch-cli CLAUDE.md scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

- Claude: `~/.claude/settings.json`, `~/.claude.json`, `~/.claude/CLAUDE.md`
Origin

This is a copy

98% identical to cc-switch-cli AGENTS.md — 4 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

CLAUDE.md · 119 lines

How it starts

The opening of the file, as written. The whole thing — 119 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Commands

The Rust crate lives in src-tauri/. Run Cargo commands from that directory unless a command explicitly targets repository-root assets or scripts.

cd src-tauri

cargo run                                  # Run cc-switch in interactive mode
cargo run -- provider list                 # Run a specific CLI command
cargo run -- --app codex provider list     # Run a command for a specific app
cargo run -- proxy show                    # Inspect proxy state
cargo run -- env tools                     # Check local CLI tools
cargo build --release                      # Build release binary at target/release/cc-switch

cargo fmt                                  # Format Rust code
cargo fmt --check                          # Check formatting, matching CI
cargo clippy                               # Run lints
cargo test                                 # Run all tests
cargo test provider_switch                 # Run tests whose names contain provider_switch
cargo test --test provider_commands        # Run a single integration test target
cargo test --features test-hooks           # Run tests with the test-hooks feature enabled

The repository pins Rust through src-tauri/rust-toolchain.toml to Rust 1.91.1 with rustfmt and clippy. CI currently runs cargo fmt --check for changes under src-tauri/**.

Project overview

CC-Switch CLI is a Rust command-line management tool for Claude Code, Codex, Gemini, OpenCode, Hermes, and OpenClaw. It manages provider configurations, MCP servers, prompts, skills, WebDAV sync, local proxy routes, failover, daemon/start flows, deep-link imports, workspace memory files, and environment checks.

The main crate is src-tauri/; the repository root contains docs, assets, install/update scripts, packaging metadata, and Nix files.

Key Rust entry points:

  • src/main.rs parses CLI arguments, initializes logging, creates startup state for most commands, and dispatches to command handlers.
  • src/lib.rs declares crate modules and re-exports public types used by integration tests and command code.
  • src/cli/mod.rs defines the top-level Clap CLI, global --app flag, and command enum.
  • src/cli/commands/ contains direct command implementations for providers, MCP, prompts, skills, config/WebDAV, proxy, failover, Hermes, start, daemon, env, update, completions, and internal commands.
  • src/commands/ contains library command helpers that are not top-level Clap subcommands, including OpenClaw workspace file and daily memory operations.
  • src/cli/interactive/ and src/cli/tui/ contain the interactive ratatui UI, runtime action handlers, forms, overlays, route state, and UI rendering.
  • src/services/ contains durable business logic used by commands and the TUI: providers, auth, MCP, prompts, skills, proxy, WebDAV sync, stream checks, speed tests, environment checks, visible apps, subscription/coding-plan quota checks, and state coordination.
  • src/database/ is the SQLite persistence layer. Database owns a mutex-wrapped rusqlite connection, schema creation/migration, backups, and DAO modules for providers, MCP, prompts, skills, settings, proxy state, stream checks, universal providers, and failover queues.
  • src/app_config.rs, src/provider.rs, and app-specific config modules (claude_*, codex_config.rs, gemini_*, hermes_config.rs, opencode_config.rs, openclaw_config.rs) define the shared configuration model and live-file adapters for supported apps.
  • src/deeplink/ implements the ccswitch://v1/import?... import protocol for provider resources and is exported through lib.rs for tests and callers.
  • src/proxy/ implements the local multi-app proxy with Axum handlers, request forwarding, provider routing/failover, provider-specific transformations, response/stream handling, usage logging, model mapping, cache/thinking rectifiers, circuit breaking, and metrics.
  • src/daemon/ implements the Unix supervisor daemon, IPC protocol, logging, pidfile, and restart support.
  • src/store.rs defines AppState, which ties together the database, an in-memory MultiAppConfig snapshot, startup live-config imports/recovery, and ProxyService.

Read the full file on GitHub · 119 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 119 lines · 2,533 tokens per session scan B 2463ba11bc6e

Subscribe to this mod's changes

cc-switch-cli CLAUDE.md is an instructions file published in the GitHub repository SaladDay/cc-switch-cli (4,929 stars, last pushed 3d ago), licensed MIT. It adds 2,533 tokens to every session, about $0.0127 per session on Opus 5. A static security scan graded it B with 1 finding (reads agent configuration directories). It is 98% identical to cc-switch-cli AGENTS.md, differing in 4 lines, and is treated as a copy.

Related

Other instructions, from other repositories

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 6,785 tokens

spec-kit AGENTS.md

AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.

github/spec-kit · 7,104 tokens

codex AGENTS.md

AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.

openai/codex · 5,182 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,345 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).

microsoft/vscode · 5,001 tokens

next.js AGENTS.md

Instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,296 tokens