Configuration & Environment
Relevant source files
The following files were used as context for generating this wiki page:
The Configuration & Environment system of Open Claude Cowork manages the initialization, API credentials, and runtime settings required to power a multi-provider AI desktop application. It ensures that the Electron frontend, Node.js backend, and various AI SDKs (Claude and Opencode) are correctly synchronized with external services like Composio for tool routing.
The environment is primarily driven by a .env file containing sensitive API keys and a series of JSON configuration files, such as opencode.json, which are dynamically updated by the backend server during the initialization of tools and sessions.
Sources: README.md:104-124, server/server.js:12-14
Environment Setup and Variables
The project utilizes a .env file to manage secrets and connection strings. A template is provided via .env.example. The setup.sh script automates the population of these variables by prompting the user or retrieving keys via the Composio CLI.
Key Environment Variables
| Variable | Purpose | Source |
|---|---|---|
ANTHROPIC_API_KEY | Authentication for the Claude Agent SDK. | README.md:112, setup.sh:64 |
OPENCODE_API_KEY | Authentication for the Opencode SDK. | README.md:115 |
COMPOSIO_API_KEY | Authentication for the Composio Tool Router. | README.md:119, setup.sh:84 |
OPENCODE_HOSTNAME | Host for the Opencode server (default: 127.0.0.1). | README.md:116, server/providers/opencode-provider.js:15 |
OPENCODE_PORT | Port for the Opencode server (default: 4096). | README.md:117, server/providers/opencode-provider.js:16 |
Sources: README.md:110-120, setup.sh:60-95
Automated Initialization Flow
The system uses a shell script to ensure the environment is ready for execution. This script handles dependency installation and credential management.
The setup.sh script specifically uses sed to inject retrieved keys into the .env file.
Sources: setup.sh:11-105
Backend Server Configuration
The backend server (Express) acts as a configuration orchestrator. Upon startup, it pre-initializes the Composio session and generates a local configuration file for the Opencode provider.
Dynamic Configuration Generation
The server automatically generates server/opencode.json to store Model Context Protocol (MCP) settings. This file is required for the Opencode SDK to access tools routed through Composio.
Sources: server/server.js:24-52, README.md:204-225
Provider-Specific Logic
The system supports two primary providers, each with distinct configuration requirements:
- Claude Provider: Configured via the
ANTHROPIC_API_KEYand utilizessettingSources: ['user', 'project']to load skills from.claude/skills/. - Opencode Provider: Configured to either start a new local server on a specific port or connect to an
existingServerUrl. It maps Claude-style MCP configurations to the Opencode internal format.
Sources: README.md:183-195, server/providers/opencode-provider.js:13-64
Client-Side State and Model Configuration
The Electron renderer process manages runtime configuration, such as the currently selected model and provider, persisting these settings in localStorage.
Model Options per Provider
The application defines a static configuration object for available models:
| Provider | Model Value | Description |
|---|---|---|
| Claude | claude-sonnet-4-5-20250514 | Default; balanced for everyday tasks. |
| Claude | claude-opus-4-5-20250514 | Most capable for complex work. |
| Opencode | opencode/big-pickle | Default; reasoning model. |
| Opencode | opencode/grok-code | xAI coding model. |
Sources: renderer/renderer.js:46-65
Runtime Configuration Logic
When a user selects a provider in the UI, the updateModelDropdowns(provider) function is triggered. This function:
- Updates the
selectedModelto the provider's default. - Saves the
selectedProviderandselectedModeltolocalStorage. - Re-renders the UI dropdowns with appropriate descriptions and checkmarks.
Sources: renderer/renderer.js:527-560
Conclusion
The Configuration & Environment of Open Claude Cowork is a hybrid of static environment variables and dynamic runtime configurations. By automating the link between Composio's tool router and the AI providers via setup.sh and server.js, the system creates a seamless environment for agentic tool use without requiring manual JSON editing from the user.
Sources: README.md:218-220, server/server.js:145-155