{"id":45454067,"url":"https://github.com/foxj77/claudectx","last_synced_at":"2026-04-28T22:00:59.407Z","repository":{"id":331279117,"uuid":"1126005105","full_name":"foxj77/claudectx","owner":"foxj77","description":"Fast way to switch between Claude Code configuration profiles","archived":false,"fork":false,"pushed_at":"2026-04-28T21:24:03.000Z","size":131,"stargazers_count":114,"open_issues_count":3,"forks_count":9,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-04-28T21:30:40.696Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/foxj77.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-31T21:12:09.000Z","updated_at":"2026-04-28T20:15:50.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/foxj77/claudectx","commit_stats":null,"previous_names":["foxj77/claudectx"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/foxj77/claudectx","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foxj77%2Fclaudectx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foxj77%2Fclaudectx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foxj77%2Fclaudectx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foxj77%2Fclaudectx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/foxj77","download_url":"https://codeload.github.com/foxj77/claudectx/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foxj77%2Fclaudectx/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32400873,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T19:38:08.556Z","status":"ssl_error","status_checked_at":"2026-04-28T19:37:55.688Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-02-22T06:00:14.130Z","updated_at":"2026-04-28T22:00:59.401Z","avatar_url":"https://github.com/foxj77.png","language":"Go","funding_links":[],"categories":["Tooling 🧰","Other","工具 🧰"],"sub_categories":["Config Managers","配置管理器"],"readme":"# claudectx\n\n**Stop editing config files. Start switching in seconds.**\n\n![Version](https://img.shields.io/badge/version-1.2.0-blue)\n![License](https://img.shields.io/badge/license-MIT-green)\n![Tests](https://img.shields.io/badge/tests-85%2B%20passing-brightgreen)\n\n---\n\n## Why claudectx?\n\n**The Problem:** You're juggling multiple Claude Code setups—work account, personal projects, different API providers, client-specific instructions. Every time you need to switch, you're manually editing `settings.json`, swapping CLAUDE.md files, and hoping you don't break something.\n\n**The Solution:** `claudectx` lets you switch your entire Claude Code configuration with a single command. No more file editing. No more mistakes. Just type `claudectx work` and you're done.\n\n```bash\n# Before: Edit files, copy settings, pray nothing breaks\nvim ~/.claude/settings.json  # 😰\n\n# After: One command, instant switch\nclaudectx work  # ✅\n```\n\n### Why Developers Choose claudectx\n\n| Pain Point | How claudectx Helps |\n|------------|---------------------|\n| \"I keep overwriting my settings\" | Automatic backups before every switch |\n| \"Switching takes 5+ minutes\" | Switch in under 1 second |\n| \"I broke my config and lost work\" | Instant rollback if anything fails |\n| \"I have 4 different API providers\" | Unlimited profiles, easy toggle |\n| \"My team needs the same setup\" | Export/import profiles as JSON |\n\n### Who Benefits Most\n\n- **Consultants \u0026 Freelancers** — Switch between client configs instantly\n- **Teams** — Share standardized profiles across developers\n- **Power Users** — Test different models, API providers, and MCP servers\n- **Anyone** who's tired of manual configuration management\n\n---\n\n## What is claudectx?\n\nclaudectx is a command-line tool that lets you quickly switch between different Claude Code configurations. Think of it like profiles for your browser, but for Claude Code.\n\n**Perfect for:**\n- 👔 Switching between work and personal Claude accounts\n- 🏢 Managing different client configurations\n- 🔌 Testing different API providers (Anthropic, Bedrock, OpenRouter, Z.AI, custom endpoints)\n- 🛠️ Using different tool permissions and MCP servers\n- 📝 Maintaining separate instruction sets (CLAUDE.md files)\n\n---\n\n## Quick Start\n\n### Interactive Mode\n\nThe easiest way to switch profiles:\n\n```bash\nclaudectx\n```\n\nUse **↑/↓ arrow keys** to navigate, **Enter** to select:\n\n```\nSelect a profile:\n\n  work\n❯ personal (current)\n  client-acme\n\nUse ↑/↓ to navigate, Enter to select, Esc/Ctrl+C to cancel\n```\n\n### Direct Switch\n\nIf you know the profile name:\n\n```bash\nclaudectx work\n```\n\n### Toggle Between Profiles\n\nQuickly switch back and forth:\n\n```bash\nclaudectx -\n```\n\n---\n\n## Installation\n\n### macOS / Linux (Homebrew)\n\n```bash\nbrew install foxj77/tap/claudectx\n```\n\nThis will install claudectx and shell completions automatically.\n\n### Manual Installation\n\n**Option 1: Install to your user directory (no sudo required)**\n\n```bash\ncd ~/Downloads\ngit clone https://github.com/foxj77/claudectx.git\ncd claudectx\nmake install-user\n```\n\nThis installs to `~/go/bin/claudectx`. Make sure `~/go/bin` is in your PATH:\n\n```bash\n# For bash\necho 'export PATH=\"$PATH:~/go/bin\"' \u003e\u003e ~/.bashrc\nsource ~/.bashrc\n\n# For zsh\necho 'export PATH=\"$PATH:~/go/bin\"' \u003e\u003e ~/.zshrc\nsource ~/.zshrc\n```\n\n**Option 2: Install system-wide**\n\n```bash\ncd ~/Downloads\ngit clone https://github.com/foxj77/claudectx.git\ncd claudectx\nsudo make install\n```\n\nThis installs to `/usr/local/bin/claudectx`.\n\n**Option 3: Download pre-built binary**\n\nDownload pre-built binaries for your platform from the [releases page](https://github.com/foxj77/claudectx/releases).\n\nAvailable for:\n- macOS (Intel and Apple Silicon)\n- Linux (x64 and ARM64)\n- Windows (x64)\n\n---\n\n## Complete Usage Guide\n\n### Managing Profiles\n\n**Create a new profile** from your current settings:\n```bash\nclaudectx -n work\n```\n\n**List all profiles** (simple text output):\n```bash\nclaudectx -l\n```\n\n**Show current profile**:\n```bash\nclaudectx -c\n```\n\n**Delete a profile**:\n```bash\nclaudectx -d old-client\n```\n\n### Advanced Features\n\n**Export a profile** to share with teammates:\n```bash\n# Export to file\nclaudectx export work work-profile.json\n\n# Export to stdout (for piping)\nclaudectx export work\n```\n\n**Import a profile**:\n```bash\n# Import from file\nclaudectx import work-profile.json\n\n# Import and rename\nclaudectx import work-profile.json client-new\n\n# Import from stdin\ncat work-profile.json | claudectx import\n```\n\n**Check profile health** (validates settings):\n```bash\n# Check current profile\nclaudectx health\n\n# Check specific profile\nclaudectx health work\n```\n\n**Transfer profiles between machines**:\n```bash\nclaudectx export work | ssh remote-machine 'claudectx import - work'\n```\n\n---\n\n## Real-World Examples\n\n### Freelancer Managing Multiple Clients\n\n```bash\n# Create profiles for each client\nclaudectx -n client-acme\nclaudectx -n client-globex\nclaudectx -n personal\n\n# Switch to client work\nclaudectx client-acme\n\n# Quick toggle between client and personal\nclaudectx -\n\n# Export client profile for backup\nclaudectx export client-acme ~/backups/acme-$(date +%Y%m%d).json\n```\n\n### Developer with Work and Personal Accounts\n\n```bash\n# Create work profile\nclaudectx -n work\n\n# Create personal profile\nclaudectx -n personal\n\n# Start work day\nclaudectx work\n\n# End of day, switch to personal\nclaudectx personal\n\n# Or use interactive mode\nclaudectx\n```\n\n### Team Sharing Configuration\n\n```bash\n# Team lead creates and exports standard config\nclaudectx -n team-standard\nclaudectx export team-standard team-config.json\n\n# Share file with team (email, Slack, git repo, etc.)\n\n# Team members import\nclaudectx import team-config.json work\n```\n\n---\n\n## Example Configurations\n\nHere are real-world profile configurations you can use as templates.\n\n### Creating a Profile for Alternative API Providers (e.g., GLM-4.7 via Z.AI)\n\nFirst, configure your current Claude Code settings, then save them as a profile:\n\n**1. Edit your settings file** (`~/.claude/settings.json`):\n```json\n{\n  \"env\": {\n    \"ANTHROPIC_AUTH_TOKEN\": \"a1b2c3d4e5f6789012345678abcdef90.XyZ123AbCdEfGhIjKlMn\",\n    \"ANTHROPIC_BASE_URL\": \"https://api.z.ai/api/anthropic\",\n    \"ANTHROPIC_DEFAULT_HAIKU_MODEL\": \"glm-4.5-air\",\n    \"ANTHROPIC_DEFAULT_OPUS_MODEL\": \"glm-4.7\",\n    \"ANTHROPIC_DEFAULT_SONNET_MODEL\": \"glm-4.7\",\n    \"API_TIMEOUT_MS\": \"3000000\"\n  },\n  \"permissions\": {}\n}\n```\n\n**2. Save it as a profile:**\n```bash\nclaudectx -n glm-provider\n```\n\n**3. Switch to it anytime:**\n```bash\nclaudectx glm-provider\n```\n\n### Creating a Profile with MCP Servers\n\nIf you use MCP (Model Context Protocol) servers, you can include them in profiles:\n\n**1. Your MCP configuration** (`~/.claude/profiles/devops/mcp.json`):\n```json\n{\n  \"flux-operator-mcp\": {\n    \"type\": \"stdio\",\n    \"command\": \"/opt/homebrew/bin/flux-operator-mcp\",\n    \"args\": [\"serve\"],\n    \"env\": {\n      \"KUBECONFIG\": \"/Users/yourname/.kube/config\"\n    }\n  }\n}\n```\n\n**2. Combined with settings** (`~/.claude/profiles/devops/settings.json`):\n```json\n{\n  \"env\": {\n    \"KUBECONFIG\": \"/Users/yourname/.kube/config\"\n  },\n  \"permissions\": {\n    \"allow\": [\"Bash(kubectl *)\"]\n  }\n}\n```\n\n### Creating a Profile for AWS Bedrock\n\n```json\n{\n  \"env\": {\n    \"ANTHROPIC_MODEL\": \"anthropic.claude-3-5-sonnet-20241022-v2:0\",\n    \"AWS_REGION\": \"us-east-1\",\n    \"AWS_PROFILE\": \"production\",\n    \"CLAUDE_CODE_USE_BEDROCK\": \"1\"\n  },\n  \"permissions\": {}\n}\n```\n\nSave as a profile:\n```bash\nclaudectx -n bedrock-prod\n```\n\n### Creating a Profile with Custom CLAUDE.md Instructions\n\nEach profile can have its own global instructions file:\n\n**1. Create your profile:**\n```bash\nclaudectx -n client-acme\n```\n\n**2. Edit the profile's CLAUDE.md** (`~/.claude/profiles/client-acme/CLAUDE.md`):\n```markdown\n# ACME Corp Project Guidelines\n\n- Always use TypeScript\n- Follow ACME's coding standards\n- Never commit directly to main\n- Run tests before suggesting commits\n```\n\nWhen you switch to `client-acme`, this CLAUDE.md becomes your global instructions.\n\n### Quick Profile Creation Workflow\n\n```bash\n# 1. Configure Claude Code however you want (edit settings.json, CLAUDE.md, etc.)\n\n# 2. Save current config as a new profile\nclaudectx -n my-new-profile\n\n# 3. Verify it was created\nclaudectx -l\n\n# 4. Switch away and back to test\nclaudectx -               # Toggle to previous\nclaudectx my-new-profile  # Switch back\n```\n\n---\n\n## What Gets Switched?\n\nWhen you switch profiles, claudectx manages:\n\n- ✅ `~/.claude/settings.json` - All your Claude Code settings\n- ✅ `~/.claude/CLAUDE.md` - Your global instructions\n- ✅ Model preferences (opus, sonnet, haiku)\n- ✅ Environment variables\n- ✅ Tool permissions\n- ✅ API configuration\n\n**What stays the same:**\n- ❌ Project-level settings in `.claude/` folders\n- ❌ OAuth session tokens\n- ❌ Conversation history\n- ❌ Project-specific configurations\n\n---\n\n## Safety Features\n\nclaudectx is designed to be **safe and reliable**:\n\n🛡️ **Automatic Backups**\nEvery switch creates a timestamped backup in `~/.claude/backups/`\n\n🔍 **Validation**\nProfiles are validated before switching to prevent corruption\n\n↩️ **Automatic Rollback**\nIf anything goes wrong during a switch, your previous config is automatically restored\n\n💾 **Atomic Operations**\nSettings files are updated atomically - no partial updates\n\n🎨 **Clear Feedback**\nColor-coded output shows success (green), warnings (yellow), and errors (red)\n\n---\n\n## Shell Completion\n\nEnable tab completion for your shell:\n\n**Bash:**\n```bash\nsource /path/to/claudectx/completion/bash_completion.sh\n```\n\n**Zsh:**\n```bash\n# Copy to a directory in your $fpath\ncp /path/to/claudectx/completion/zsh_completion.sh /usr/local/share/zsh/site-functions/_claudectx\n```\n\n**Fish:**\n```bash\ncp /path/to/claudectx/completion/fish_completion.fish ~/.config/fish/completions/\n```\n\n---\n\n## Troubleshooting\n\n### \"command not found: claudectx\"\n\nMake sure the installation directory is in your PATH:\n\n```bash\n# Check if ~/go/bin is in PATH\necho $PATH | grep go/bin\n\n# If not, add it:\necho 'export PATH=\"$PATH:~/go/bin\"' \u003e\u003e ~/.zshrc  # or ~/.bashrc\nsource ~/.zshrc  # or source ~/.bashrc\n```\n\n### \"profile does not exist\"\n\nList available profiles to see what exists:\n\n```bash\nclaudectx -l\n```\n\n### Accidentally deleted a profile\n\nCheck your backups:\n\n```bash\nls ~/.claude/backups/\n```\n\nEach backup directory contains a complete copy of your settings.\n\n### Settings aren't taking effect\n\nMake sure Claude Code isn't running when you switch profiles. Restart Claude Code after switching.\n\n---\n\n## How It Works\n\nclaudectx stores each profile in `~/.claude/profiles/`:\n\n```\n~/.claude/\n├── .claudectx-current      # Tracks which profile is active\n├── .claudectx-previous     # Enables toggle with 'claudectx -'\n├── profiles/\n│   ├── work/\n│   │   ├── settings.json\n│   │   └── CLAUDE.md\n│   └── personal/\n│       ├── settings.json\n│       └── CLAUDE.md\n├── backups/                # Automatic backups\n│   └── backup-1234567890/\n└── settings.json           # Active config (symlinked)\n```\n\nWhen you switch profiles, claudectx copies the profile's files to the active locations.\n\n---\n\n## Get Help\n\n**View all commands:**\n```bash\nclaudectx --help\n```\n\n**Check version:**\n```bash\nclaudectx --version\n```\n\n**Found a bug?**\n[Open an issue](https://github.com/foxj77/claudectx/issues) on GitHub\n\n---\n\n## Comparison with Other Tools\n\n| Feature | claudectx | cctx | Manual switching |\n|---------|-----------|------|------------------|\n| Interactive selection | ✅ | ❌ | ❌ |\n| Automatic backups | ✅ | ❌ | ❌ |\n| Validation | ✅ | ❌ | ❌ |\n| CLAUDE.md support | ✅ | ❌ | ✅ |\n| Export/import | ✅ | ❌ | ❌ |\n| Shell completion | ✅ | ❌ | ❌ |\n| Health checks | ✅ | ❌ | ❌ |\n| Rollback on error | ✅ | ❌ | ❌ |\n\n---\n\n## License\n\nMIT License - see [LICENSE](LICENSE)\n\n---\n\n## Credits\n\nInspired by [kubectx](https://github.com/ahmetb/kubectx) - the excellent Kubernetes context switcher.\n\nBuilt by [John Fox](https://github.com/foxj77) for the Claude Code community.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoxj77%2Fclaudectx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffoxj77%2Fclaudectx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoxj77%2Fclaudectx/lists"}