Project File Structure
Relevant source files
The following files were used as context for generating this wiki page:
Introduction
The Claude Cowork project is a desktop AI assistant built using the Electron framework, designed to provide a graphical interface for interacting with Claude AI models. It acts as an alternative to CLI-based tools like Claude Code, offering visual feedback, session management, and integrated tool execution. The architecture is split between a Main process (Electron) and a Renderer process (React), facilitating local file system access and AI model orchestration through the @anthropic-ai/claude-agent-sdk.
The project structure is organized to support a multi-step build process involving TypeScript transpilation for the Electron backend and Vite-driven bundling for the React frontend. This ensures a clear separation of concerns between system-level operations—such as configuration persistence and shell command execution—and the user interface.
Sources: README.md:1-25, package.json:1-20
Core Architectural Layers
The project follows a standard Electron application structure, divided into three primary functional domains: the Electron Main process, the UI Renderer process, and the shared build/configuration logic.
Application Workflow
The following diagram illustrates the interaction between the main components of the file structure during application startup and runtime.
The application lifecycle begins in the Main process, which sets up the native window and Inter-Process Communication (IPC) handlers.
Sources: src/electron/main.ts:1-60, src/ui/App.tsx:20-50
Technical Components and File Layout
1. Electron Main Process (src/electron/)
This directory contains the logic for the "Main" process, which has direct access to Node.js APIs and manages the application lifecycle.
| File / Directory | Description | Key Functions/Classes |
|---|---|---|
main.ts | The entry point for the Electron app. | cleanup(), mainWindow initialization |
libs/claude-settings.ts | Handles Claude-specific environment and CLI paths. | getClaudeCodePath(), getCurrentApiConfig() |
libs/config-store.ts | Manages persistence of API keys and user preferences. | loadApiConfig(), saveApiConfig() |
pathResolver.ts | Utility to locate assets and build artifacts across dev/prod. | getPreloadPath(), getUIPath() |
util.ts | IPC utilities and environment detection. | isDev(), ipcMainHandle() |
Sources: src/electron/main.ts:65-120, src/electron/libs/claude-settings.ts:8-40, src/electron/pathResolver.ts:5-25
2. UI Renderer Process (src/ui/)
The frontend is a React 19 application located in the src/ui directory. It uses Tailwind CSS for styling and Zustand for state management.
App.tsx: The root component managing the main layout, message streaming, and modal states.components/: Contains reusable UI elements likeSidebar.tsxfor session navigation andEventCard.tsxfor rendering AI/Tool outputs.render/: Includes specialized rendering logic, such asmarkdown.tsxfor formatting AI responses.store/: Contains Zustand store definitions (e.g.,useAppStore.ts) to maintain application state across components.
Sources: src/ui/App.tsx:340-450, src/ui/components/Sidebar.tsx:75-120, src/ui/render/markdown.tsx:5-15
3. Build and Configuration
The project root contains configuration files that define the build pipeline and application metadata.
The build process involves transpiling TypeScript for the Electron process and using Vite to bundle the React application into dist-react/. electron-builder then packages these artifacts into executable formats.
Sources: package.json:7-25, electron-builder.json:1-25
Build Script Summary
The package.json file defines the scripts necessary to manage the project's dual-process architecture.
| Script | Command | Purpose |
|---|---|---|
dev | bun run dev:react & bun run dev:electron | Starts Vite and Electron in parallel with hot reload. |
transpile:electron | tsc --project src/electron/tsconfig.json | Compiles backend TypeScript to JS. |
dist:mac-arm64 | ... && electron-builder --mac --arm64 | Generates a production build for Apple Silicon. |
build | tsc -b && vite build | Full production build of both UI and backend. |
Sources: package.json:7-20
Conclusion
The file structure of Claude Cowork reflects a robust Electron-React integration, separating system-level AI SDK orchestration from the interactive user interface. By isolating configuration logic in src/electron/libs and UI components in src/ui/components, the project provides a maintainable architecture for a desktop-based AI collaboration tool.
Sources: README.md:40-55, src/electron/main.ts:130-140