> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ccs.kaitran.ca/llms.txt
> Use this file to discover all available pages before exploring further.

# Droid Adapter

> Route CCS profiles to alternative CLI targets with multi-target adapter system

# Droid Adapter

CCS can delegate execution to alternative CLI targets beyond Claude Code. The Droid adapter routes profiles to the Droid CLI using the same CCS configuration system.

## Quick Start

```bash theme={null}
# Run with explicit target flag
ccs glm --target droid

# Use built-in alias (ccsd = droid target)
ccsd glm "your prompt"

# Custom aliases via env var
export CCS_DROID_ALIASES=mydroid,alt-droid
mydroid glm "your prompt"
```

## Target Resolution Priority

CCS resolves the target CLI in this order:

| Priority    | Source                     | Example                        |
| ----------- | -------------------------- | ------------------------------ |
| 1 (highest) | `--target` flag            | `--target droid`               |
| 2           | Per-profile `target` field | `target: droid` in config.yaml |
| 3           | `argv[0]` binary name      | calling via `ccsd`             |
| 4 (default) | Fallback                   | `claude`                       |

## Built-in Aliases

`ccsd` is the busybox-style argv0 shorthand — symlink or copy the `ccs` binary as `ccsd` and it auto-routes to the droid target:

```bash theme={null}
# Create ccsd symlink
ln -s $(which ccs) /usr/local/bin/ccsd

# Then use directly
ccsd glm "your prompt"   # Equivalent to: ccs glm --target droid
```

| Binary Name                    | Target             |
| ------------------------------ | ------------------ |
| `ccsd`                         | `droid` (built-in) |
| Custom via `CCS_DROID_ALIASES` | `droid`            |

### Custom Aliases via `CCS_DROID_ALIASES`

Set comma-separated argv0 aliases that all map to the droid target:

```bash theme={null}
export CCS_DROID_ALIASES=mydroid,alt-droid,factory-ccs
mydroid glm "prompt"      # Routes to droid
alt-droid codex "prompt"  # Also routes to droid
```

## Droid Detection

CCS locates the Droid binary in order:

1. `CCS_DROID_PATH` env var — explicit path override
2. PATH lookup via `which droid` (Unix) or `where.exe droid` (Windows)

**Install Droid CLI:**

```bash theme={null}
npm i -g @factory/cli
```

## Environment Variables

| Variable            | Description                                                 |
| ------------------- | ----------------------------------------------------------- |
| `CCS_DROID_ALIASES` | Comma-separated argv0 binary names that map to droid target |
| `CCS_DROID_PATH`    | Explicit absolute path to the droid binary                  |

## Config Integration

Droid adapter writes credentials to `~/.factory/settings.json` using Droid's config format:

* Profiles stored as `customModels[]` entries with `CCS `-prefixed display names
* Atomic file writes via temp file + rename
* File locking prevents concurrent write races
* Profile names validated: alphanumeric, underscore, and hyphen only

### Per-Profile Target Config

Set `target: droid` on any API, variant, or composite profile to always route that profile to Droid without needing the `--target` flag:

```yaml theme={null}
# API profile
profiles:
  my-api:
    provider: openai
    target: droid    # Always use Droid for this profile

# CLIProxy variant
cliproxy:
  variants:
    my-variant:
      provider: gemini
      target: droid    # Routes this variant to Droid CLI

# Composite variant
cliproxy:
  variants:
    my-composite:
      composite: true
      opus: gemini
      sonnet: agy
      target: droid    # Routes composite to Droid CLI
```

<Warning>
  Per-profile `target` is NOT supported for profile types: `cliproxy`, `copilot`,
  and `account`. Legacy `glmt` compatibility profiles now follow the normal
  settings-profile flow after runtime normalization, but new setups should still
  migrate to `glm` or `km`.
</Warning>

## Unsupported Profile Types

The following profile types do not support droid routing:

| Profile Type     | Workaround                   |
| ---------------- | ---------------------------- |
| `cliproxy` (raw) | Use variant profiles instead |
| `copilot`        | Not supported                |
| `account`        | Not supported                |

## Dashboard: Droid Page

The dashboard includes a dedicated Droid page at `http://localhost:3000/droid` with three tabs:

### Overview Tab

* **Binary detection** — shows whether Droid CLI is installed and its path
* **File status** — checks `~/.factory/settings.json` existence and validity
* **Warnings** — alerts for missing binary, corrupt config, or stale locks
* Auto-refreshes diagnostics every 10 seconds

### BYOK Tab (Bring Your Own Key)

Register custom LLM endpoints for use with Droid:

**Quick Settings Card:**

* Toggle settings like `enableThinking`, `enableArtifacts`
* Configure default model selection

**Reasoning Controls Card:**

* Per-model reasoning effort settings
* Provider-specific configuration:
  * **Anthropic:** `thinking.budget_tokens` (4K-64K tokens)
  * **OpenAI:** `reasoning.effort` (low/medium/high/max/xhigh)
  * **Generic:** `reasoning_effort` (string value)

**Custom Models:**

* CCS-managed models (prefixed "CCS ") registered in `~/.factory/settings.json`
* Three provider types supported:
  * `anthropic` — Anthropic Messages API
  * `openai` — OpenAI Responses API
  * `generic-chat-completion-api` — OpenAI-compatible (Groq, DeepInfra, Ollama, local)
* Smart provider detection: explicit hint → URL inference → model name inference

**Raw JSON Editor:**

* Direct editing of `~/.factory/settings.json`
* Conflict detection via mtime comparison (prevents overwriting external changes)

### Docs Tab

* Links to Factory Droid documentation
* Provider API references
* Quick access to relevant CCS docs

## Reasoning Effort Sync

CCS syncs reasoning effort settings between CLI and dashboard:

```bash theme={null}
# CLI override flags
ccs glm --target droid --thinking high
ccs km --target droid --effort medium
```

Dashboard reasoning controls write provider-specific config to `~/.factory/settings.json`. The Droid CLI reads these at startup.

## Security

* **No symlink traversal** — refuses read/write if target is symlink
* **Atomic writes** — temp file + rename prevents corruption
* **File locking** — 10s stale timeout, exponential backoff
* **Corruption backup** — `.bak` file created before writes
* **File permissions** — 0o600 (user-only read/write)

## Usage Examples

```bash theme={null}
ccs glm --target droid    # Run GLM on Droid (explicit flag)
ccs km --target droid     # Run Kimi for Coding on Droid
ccsd glm                   # Same via ccsd alias
ccs glm                    # Run GLM on Claude (default)
ccsd codex "prompt"        # Run Codex on Droid
ccsd km "prompt"           # Run Kimi API profile on Droid
```

## Related

* [Dashboard](/features/dashboard/overview) — Visual configuration interface
* [Updates Center](/features/config/updates-center) — Rollout tasks for Droid setup
* [Extended Thinking](/features/ai/extended-thinking) — Thinking/reasoning budget configuration
