Anthropic & Claude Native Integration
Relevant source files
The following files were used as context for generating this wiki page:
- AGENTS.md
- README.md
- src/commands/api-command/create-command.ts
- src/channels/official-channels-runtime.ts (Context derived from tests/unit/channels/official-channels-runtime.test.ts)
- src/web-server/shared-routes.ts (Context derived from tests/unit/web-server/shared-routes.test.ts)
- src/commands/browser-command.ts
- src/config/loader/yaml-serializer.ts
Anthropic and Claude native integration within CCS provides a specialized environment for managing official Claude Code runtimes, isolated account contexts, and Anthropic-compatible API profiles. This system ensures that users can switch between native Claude subscriptions and various third-party providers without "configuration thrash," maintaining stable session state and isolated environment variables for each profile.
The integration supports the native Claude Code CLI while enhancing it with local tools, account-based resource sharing, and official plugin management. Key capabilities include managing CLAUDE_CONFIG_DIR for account isolation, injecting official channels (Telegram, Discord, iMessage) at runtime, and bridging browser automation directly into Claude sessions.
Sources: README.md:1-40, AGENTS.md:1-40, src/config/loader/yaml-serializer.ts:25-50
Architecture and Profile Management
The system utilizes a multi-layered profile resolution strategy to handle native Claude accounts alongside routed API profiles. Native integration relies heavily on the isolation of the ~/.claude/ directory, managed via the CLAUDE_CONFIG_DIR environment variable.
Profile Resolution Priority
- Built-in CLIProxy providers: Gemini, Codex, Antigravity.
- User-defined providers: Configured in
config.cliproxy. - Settings-based profiles: Configured in
config.profiles. - Account-based profiles: Isolated through
profiles.jsonand specific config directories.
Sources: AGENTS.md:30-45, src/config/loader/yaml-serializer.ts:40-65
Runtime Configuration Flow
The following diagram illustrates how CCS resolves a profile and prepares the environment for the native Claude runtime.
The diagram shows the logic flow from command entry to process spawning, highlighting the distinction between native account handling and API mapping.
Sources: src/commands/api-command/create-command.ts:320-400, src/config/loader/yaml-serializer.ts:150-180
Native Claude Feature Enhancements
Official Channels Integration
CCS automates the enablement of official Anthropic channel plugins (Telegram, Discord, iMessage) by injecting the --channels flag at runtime. This logic is restricted to native Claude default or account sessions and requires a compatible Claude Code version (v2.1.80+).
| Channel | Requirement | Runtime Injection Flag |
|---|---|---|
| Telegram | TELEGRAM_BOT_TOKEN | --channels plugin:telegram |
| Discord | Discord Bot Token | --channels plugin:discord |
| iMessage | System Permissions | --channels plugin:imessage |
Sources: tests/unit/channels/official-channels-runtime.test.ts:50-150
Browser Attach Mode
The native integration includes a "Browser Attach" feature that allows Claude to reuse a running Chrome/Chromium session for automation tasks. This is distinct from Codex tools as it relies on a specific user_data_dir and a remote debugging port (devtools_port).
Sources: src/commands/browser-command.ts:80-120, src/config/loader/yaml-serializer.ts:275-290
Shared Resource Management
The integration provides a mechanism to share skills, agents, and commands across different Claude accounts through symlinking. This prevents duplication of logic while maintaining account-level auth isolation.
Shared Content Types
- Skills: Markdown files located in
~/.ccs/shared/skills/. - Agents: Markdown prompts located in
~/.ccs/shared/agents/. - Commands: Workflow steps located in
~/.ccs/shared/commands/.
The class diagram represents the relationship between the central CCS shared storage and individual Claude configuration directories.
Sources: tests/unit/web-server/shared-routes.test.ts:100-250, scripts/postinstall.js:100-140
API Profile Creation for Anthropic
CCS allows the creation of API profiles that specifically target Anthropic-compatible backends or direct Anthropic API access.
Configuration Options
| Flag | Description | Default/Preset Behavior |
|---|---|---|
--preset anthropic | Uses native Anthropic API headers | Bypasses local base URL |
--model | Sets ANTHROPIC_MODEL | Defaults to claude-sonnet-4-6 |
--1m | Enables extended context [1m] | Opt-in for compatible mappings |
--target | Sets execution runtime | claude (default), droid, or codex |
Sources: src/commands/api-command/create-command.ts:150-300
Extended Context Logic
For Claude-based API profiles, CCS manages the "Extended Context" preference. If enabled, CCS explicitly writes [1m] to compatible Claude model mappings within the profile's .settings.json file. This is handled as an opt-in feature to prevent unexpected 429 errors from providers that require specific pay-as-you-go (PAYG) entitlements for long-context requests.
Sources: src/commands/api-command/create-command.ts:260-285, src/config/loader/yaml-serializer.ts:215-235
Technical Summary
The Anthropic & Claude Native Integration in CCS acts as a sophisticated wrapper around the official Claude Code CLI. By managing environment variables like CLAUDE_CONFIG_DIR and CCS_HOME, and providing structured YAML configuration for profiles and account settings, it enables professional workflows across multiple AI identities. The inclusion of shared resource symlinking and automated channel injection further extends the functionality of the native tools without altering the underlying Anthropic binary logic.
Sources: README.md:15-30, AGENTS.md:15-30, scripts/postinstall.js:150-250