{"id":44330006,"url":"https://github.com/ourines/codes","last_synced_at":"2026-02-18T08:01:11.165Z","repository":{"id":337576397,"uuid":"1074011085","full_name":"ourines/codes","owner":"ourines","description":"  Codes CLI - Manage multiple Claude Code configurations with ease. Switch between different Claude API endpoints (official, proxies, alternative   providers), handle authentication tokens, and streamline your AI-powered development workflow.","archived":false,"fork":false,"pushed_at":"2026-02-13T16:41:28.000Z","size":6780,"stargazers_count":8,"open_issues_count":5,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-14T00:52:03.586Z","etag":null,"topics":["ai","api-management","claude","claude-code","configuration-management","golang","multi-config"],"latest_commit_sha":null,"homepage":"","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/ourines.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"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-10-11T01:46:28.000Z","updated_at":"2026-02-13T16:39:00.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ourines/codes","commit_stats":null,"previous_names":["ourines/codes"],"tags_count":31,"template":false,"template_full_name":null,"purl":"pkg:github/ourines/codes","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ourines%2Fcodes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ourines%2Fcodes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ourines%2Fcodes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ourines%2Fcodes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ourines","download_url":"https://codeload.github.com/ourines/codes/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ourines%2Fcodes/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29573399,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-18T07:57:19.261Z","status":"ssl_error","status_checked_at":"2026-02-18T07:57:18.820Z","response_time":162,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["ai","api-management","claude","claude-code","configuration-management","golang","multi-config"],"created_at":"2026-02-11T09:09:01.286Z","updated_at":"2026-02-18T08:01:11.158Z","avatar_url":"https://github.com/ourines.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Codes CLI\n\n[English](README.md) | [中文](README.zh-CN.md)\n\nEnvironment configuration management, project management, and multi-agent collaboration tool for Claude Code. Switch API profiles instantly, manage project workspaces, and orchestrate autonomous agent teams to tackle complex tasks in parallel.\n\n## Features\n\n- **Profile Switching** — Manage multiple API configurations (Anthropic, proxies, custom endpoints) and switch instantly\n- **Project Management** — Project aliases, workspace management, interactive TUI\n- **Agent Teams** — Autonomous Claude agents collaborating with task dependencies, messaging, and auto-reporting\n- **Workflow Templates** — YAML-based agent team templates for repeatable multi-agent pipelines\n- **Cost Tracking** — Session-level API usage statistics by project and model\n- **MCP Server** — 40 tools integrated into Claude Code for managing everything from conversations\n- **Cross-Platform** — Linux, macOS, Windows (amd64 \u0026 arm64)\n\n## Install\n\n```bash\n# Linux / macOS\ncurl -fsSL https://raw.githubusercontent.com/ourines/codes/main/install.sh | sh\n\n# Windows (PowerShell)\nirm https://raw.githubusercontent.com/ourines/codes/main/install.ps1 | iex\n\n# From source (Go 1.24+)\ngit clone https://github.com/ourines/codes.git \u0026\u0026 cd codes \u0026\u0026 make build\n```\n\nThen run `codes init` to set up shell completion and PATH.\n\n## Claude Code Integration\n\nAdd `codes` as an MCP server to let Claude Code manage agent teams, projects, and profiles directly.\n\n**Project-level** (`.mcp.json` in project root):\n\n```json\n{\n  \"mcpServers\": {\n    \"codes\": {\n      \"command\": \"codes\",\n      \"args\": [\"serve\"]\n    }\n  }\n}\n```\n\n**User-level** (`~/.claude/claude_code_config.json`):\n\n```json\n{\n  \"mcpServers\": {\n    \"codes\": {\n      \"command\": \"codes\",\n      \"args\": [\"serve\"]\n    }\n  }\n}\n```\n\nOnce configured, Claude Code gains access to 39 MCP tools:\n\n| Category | Tools | Examples |\n|----------|-------|---------|\n| **Config** (10) | Projects, profiles, remotes | `list_projects`, `switch_profile`, `sync_remote` |\n| **Agent** (21) | Teams, tasks, messages | `team_create`, `task_create`, `message_send` |\n| **Stats** (4) | Usage tracking | `stats_summary`, `stats_by_project`, `stats_by_model` |\n| **Workflow** (4) | Templates | `workflow_list`, `workflow_run`, `workflow_create` |\n\nUsage in Claude Code:\n\n```\nYou: Create a team to refactor the auth module\n\nClaude: I'll set up a team with a coder and tester...\n        [uses team_create, agent_add, task_create tools]\n\nYou: What's the status?\n\nClaude: [uses team_status tool]\n        The coder completed 2/3 tasks. Tester is waiting on task #3.\n```\n\n## Quick Start: Agent Teams\n\n```bash\n# Create a team with agents\ncodes agent team create myteam --workdir ~/Projects/myproject\ncodes agent add myteam coder --role \"implementation\" --model sonnet\ncodes agent add myteam tester --role \"testing\" --model sonnet\n\n# Start agents and create tasks\ncodes agent start-all myteam\ncodes agent task create myteam \"Implement login API\" --assign coder --priority high\ncodes agent task create myteam \"Write login tests\" --assign tester --blocked-by 1\n\n# Monitor and clean up\ncodes agent status myteam\ncodes agent stop-all myteam\n```\n\n### How It Works\n\nAgents run as independent daemon processes, polling a shared file-based task queue every 3 seconds. Each agent executes tasks by spawning Claude CLI subprocesses and auto-reports results to the team.\n\nAll state lives in `~/.codes/teams/\u003cname\u003e/` as JSON files — no databases, no message brokers. Filesystem atomic renames guarantee safe concurrent access.\n\n## Workflow Templates\n\nWorkflows are reusable YAML templates that define agent teams and tasks. Running a workflow creates a team, starts agents, and queues tasks — all in one command.\n\n```bash\n# List available workflows\ncodes workflow list\n\n# Run a built-in workflow\ncodes workflow run pre-pr-check\n\n# Create your own\ncodes workflow create my-pipeline\n```\n\nExample workflow YAML (`~/.codes/workflows/my-pipeline.yml`):\n\n```yaml\nname: my-pipeline\ndescription: Build, test, and review\nagents:\n  - name: builder\n    role: Build and compile the project\n  - name: tester\n    role: Run tests and report failures\n  - name: reviewer\n    role: Review code quality\ntasks:\n  - subject: Build project\n    assign: builder\n    prompt: Run the build and fix any compilation errors\n  - subject: Run tests\n    assign: tester\n    prompt: Execute the test suite and report results\n    blocked_by: [1]\n  - subject: Code review\n    assign: reviewer\n    prompt: Review recent changes for quality issues\n    blocked_by: [1]\n```\n\nWorkflows can also be created programmatically via the `workflow_create` MCP tool.\n\n## Commands\n\n```\ncodes                                    # Launch TUI (when TTY detected)\ncodes init [--yes]                       # Install binary + shell completion\ncodes start \u003cpath|alias\u003e                 # Launch Claude in directory (alias: s)\ncodes version / update                   # Version info / update Claude CLI\ncodes doctor                             # System diagnostics\n```\n\n### Profile Management (`codes profile`, alias: `pf`)\n\n```bash\ncodes profile add                        # Add new profile interactively\ncodes profile select                     # Switch active profile\ncodes profile test [name]                # Test connectivity\ncodes profile list / remove \u003cname\u003e\n```\n\n### Project Aliases (`codes project`, alias: `p`)\n\n```bash\ncodes project add [name] [path]          # Add project alias\ncodes project list / remove \u003cname\u003e\n```\n\n### Configuration (`codes config`, alias: `c`)\n\n```bash\ncodes config get [key]                   # Show settings\ncodes config set \u003ckey\u003e \u003cvalue\u003e           # Set value\ncodes config list \u003ckey\u003e                  # List available values\ncodes config reset [key]                 # Reset to default\ncodes config export / import \u003cfile\u003e      # Export/import configuration\n```\n\n| Key | Values | Description |\n|-----|--------|-------------|\n| `default-behavior` | `current`, `last`, `home` | Startup directory |\n| `skip-permissions` | `true`, `false` | Skip permission prompts |\n| `terminal` | `terminal`, `iterm`, `warp` | Terminal emulator |\n\n### Agent Teams (`codes agent`, alias: `a`)\n\n```bash\n# Teams\ncodes agent team create \u003cname\u003e [--workdir \u003cpath\u003e] [--description \u003ctext\u003e]\ncodes agent team list / info \u003cname\u003e / delete \u003cname\u003e\ncodes agent status \u003cname\u003e                # Team dashboard\n\n# Agents\ncodes agent add \u003cteam\u003e \u003cname\u003e [--role \u003crole\u003e] [--model \u003cmodel\u003e] [--type worker|leader]\ncodes agent remove \u003cteam\u003e \u003cname\u003e\ncodes agent start|stop \u003cteam\u003e \u003cname\u003e\ncodes agent start-all|stop-all \u003cteam\u003e\n\n# Tasks\ncodes agent task create \u003cteam\u003e \u003csubject\u003e [--assign \u003cagent\u003e] [--priority high|normal|low] [--blocked-by \u003cids\u003e]\ncodes agent task list \u003cteam\u003e [--status \u003cstatus\u003e] [--owner \u003cagent\u003e]\ncodes agent task get \u003cteam\u003e \u003cid\u003e / cancel \u003cteam\u003e \u003cid\u003e\n\n# Messages\ncodes agent message send \u003cteam\u003e \u003ccontent\u003e --from \u003cagent\u003e [--to \u003cagent\u003e]\ncodes agent message list \u003cteam\u003e --agent \u003cname\u003e\n```\n\n### Workflow Templates (`codes workflow`, alias: `wf`)\n\n```bash\ncodes workflow list                      # List all workflows\ncodes workflow run \u003cname\u003e [-d \u003cdir\u003e] [-m \u003cmodel\u003e] [-p \u003cproject\u003e]\ncodes workflow create \u003cname\u003e             # Create template\ncodes workflow delete \u003cname\u003e\n```\n\n### Cost Tracking (`codes stats`, alias: `st`)\n\n```bash\ncodes stats summary [period]             # Cost summary (today/week/month/all)\ncodes stats project [name]               # Cost by project\ncodes stats model                        # Cost by model\ncodes stats refresh                      # Force cache rebuild\n```\n\n### Remote Hosts (`codes remote`, alias: `r`)\n\n```bash\ncodes remote add \u003cname\u003e \u003cuser@host\u003e\ncodes remote list / status \u003cname\u003e\ncodes remote setup \u003cname\u003e / ssh \u003cname\u003e\n```\n\n## Configuration\n\nConfig file location: `~/.codes/config.json` (fallback: `./config.json`)\n\n```json\n{\n  \"profiles\": [\n    {\n      \"name\": \"work\",\n      \"env\": {\n        \"ANTHROPIC_BASE_URL\": \"https://api.anthropic.com\",\n        \"ANTHROPIC_AUTH_TOKEN\": \"sk-ant-xxxxx\"\n      }\n    }\n  ],\n  \"default\": \"work\",\n  \"defaultBehavior\": \"current\",\n  \"terminal\": \"terminal\",\n  \"projects\": { \"my-project\": \"/path/to/project\" }\n}\n```\n\n\u003cdetails\u003e\n\u003csummary\u003eSupported environment variables\u003c/summary\u003e\n\n| Variable | Description |\n|----------|-------------|\n| `ANTHROPIC_BASE_URL` | API endpoint URL |\n| `ANTHROPIC_AUTH_TOKEN` | Authentication token |\n| `ANTHROPIC_API_KEY` | API key (alternative auth) |\n| `ANTHROPIC_MODEL` | Default model |\n| `ANTHROPIC_DEFAULT_HAIKU_MODEL` | Haiku model override |\n| `ANTHROPIC_DEFAULT_SONNET_MODEL` | Sonnet model override |\n| `ANTHROPIC_DEFAULT_OPUS_MODEL` | Opus model override |\n| `MAX_THINKING_TOKENS` | Maximum thinking tokens |\n| `HTTP_PROXY` / `HTTPS_PROXY` | Proxy settings |\n\n\u003c/details\u003e\n\n## Development\n\n```\ncodes/\n├── cmd/codes/          # Entry point\n├── internal/\n│   ├── agent/          # Agent teams: daemon, runner, storage\n│   ├── commands/       # Cobra CLI commands\n│   ├── config/         # Configuration management\n│   ├── mcp/            # MCP server (40 tools, stdio transport)\n│   ├── session/        # Terminal session manager\n│   ├── stats/          # Cost tracking and aggregation\n│   ├── remote/         # SSH remote management\n│   ├── tui/            # Interactive TUI (bubbletea)\n│   ├── ui/             # CLI output helpers\n│   └── workflow/       # Workflow templates and orchestration\n└── .github/workflows/  # CI/CD\n```\n\n```bash\nmake build    # Build binary\nmake test     # Run tests\ngo vet ./...  # Lint\n```\n\n## License\n\n[MIT License](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fourines%2Fcodes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fourines%2Fcodes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fourines%2Fcodes/lists"}