Development Workflow
Relevant source files
The following files were used as context for generating this wiki page:
The development workflow for the Open Claude Cowork project involves a multi-tier architecture combining an Electron-based desktop frontend with a Node.js/Express backend. This environment supports multi-provider AI integration (Claude Agent SDK and Opencode SDK) and specialized tool routing via Composio. Developers interact with the system through automated setup scripts and a dual-process execution model to manage both the local server and the client interface.
Sources: README.md:144-164, package.json:6-10
Environment Setup and Configuration
Starting development requires configuring local environment variables and installing dependencies across both the root and server directories. The project provides an automated setup.sh script to streamline this process.
Automated Setup Process
The setup.sh script performs the following critical tasks:
- CLI Installation: Checks for and installs the Composio CLI.
- Authentication: Facilitates user login for Composio and retrieves the necessary API key.
- Environment Initialization: Creates a
.envfile from a template and prompts for the Anthropic API key. - Dependency Management: Executes
npm installin the root and theserver/directory.
Sources: setup.sh:10-97, README.md:65-74
Configuration Requirements
Developers must ensure the following keys are present in the .env file:
| Variable | Description | Source |
|---|---|---|
ANTHROPIC_API_KEY | Required for Claude Provider (starts with sk-ant-) | README.md:88, setup.sh:66 |
OPENCODE_API_KEY | Required for Opencode Provider (optional) | README.md:91 |
COMPOSIO_API_KEY | Required for Tool Router integration | README.md:96, setup.sh:79 |
Execution Architecture
The application operates as two decoupled processes that must be running simultaneously during development.
The diagram above shows the relationship between the two terminal processes required for local development.
Sources: README.md:104-114, README.md:144-164
Backend Workflow (server/server.js)
The backend is responsible for session management and tool configuration. Upon startup, it pre-initializes a Composio session and automatically generates an opencode.json file containing remote MCP (Model Context Protocol) configurations.
- Key Endpoint:
POST /api/chathandles incoming messages and routes them to the selected provider. - Streaming: Uses Server-Sent Events (SSE) to stream token-by-token responses back to the Electron renderer.
Sources: server/server.js:24-42, server/server.js:68-150
Frontend Workflow (renderer/renderer.js)
The renderer manages the UI state, including multi-chat sessions and real-time visualization of tool calls.
- Session Management: Generates unique chat IDs (e.g.,
chat_171...) and persists state tolocalStorage. - Stream Handling: Implements a reader to process SSE chunks, updating the UI dynamically for both text content and tool execution status.
Sources: renderer/renderer.js:68-100, renderer/renderer.js:581-698
Development Scripts
The project utilizes npm scripts to manage the lifecycle of the application.
| Command | Location | Description |
|---|---|---|
npm run dev | Root | Starts Electron with electron-reload enabled for the renderer. |
npm start | Root | Starts the Electron application in production-like mode. |
npm start | server/ | Starts the Express backend server on port 3001. |
Sources: package.json:6-10, server/package.json:6-9, main.js:6-17
Multi-Provider Support Workflow
Developers can switch between providers in real-time, which changes how requests are routed in the backend.
This sequence illustrates the dynamic routing logic based on user selection in the UI.
Sources: server/server.js:90-112, renderer/renderer.js:45-63
Conclusion
The development workflow is centered on a dual-process system where the backend handles AI logic and tool routing, while the frontend provides a high-fidelity interface for interaction. Automated setup and clear separation of concerns between Electron's main process and the Express backend allow for rapid iteration on AI capabilities and UI enhancements.
Sources: README.md:144-164, setup.sh:99-123