Coworker Documentation
repository·main·Indexed 27 days ago
https://github.com/accomplish-ai/coworkerAn open-source AI desktop agent designed to automate local file management, document creation, and browser-based tasks. It features a local-first approach allowing users to provide their own AI models via API keys or local providers like Ollama. The project includes the @coworker_ai/agent-core library for managing tasks, storage, permissions, and skills, as well as the dev-browser-mcp server for browser interaction via Builtin or Remote CDP modes.
What's inside Coworker
- Coworker is an open-source AI desktop agent designed to run locally on your machine. It automates file management, document creation, and browser-based tasks. Unlike chat-only AI, Coworker is an 'action-oriented' tool that can interact with your local filesystem and various web services. It follows a local-first privacy model where you control folder access and use your own AI models or API keys.
Overview of Accomplish Architecture
mainAccomplish is an open-source AI automation assistant designed for desktop use (macOS, Windows, Linux). It allows users to delegate complex software engineering tasks to an AI agent capable of web browsing, code writing, command execution, and file management. The system follows a local-first approach where users provide their own API keys for various LLM providers.Overview of Coworker™ AI Desktop Agent
mainCoworker is an open-source AI desktop agent designed to run locally on your machine. It automates file management, document creation, and browser-based workflows. Unlike chat-only AI, Coworker can perform actions such as organizing files, renaming/moving files based on rules, and connecting to tools like Notion, Google Drive, and Dropbox via local APIs. It is built with a local-first privacy approach, meaning files stay on your machine and you control which folders the agent can access.Overview of Coworker capabilities
mainCoworker is designed to act as an autonomous agent for local tasks. Key capabilities include:
- File Management: Sort, rename, and move files based on content or specific rules.
- Document Writing: Prompt the agent to write, summarize, or rewrite documents.
- Tool Connections: Connect to services like Notion, Google Drive, and Dropbox via local APIs.
- Custom Skills: Define and save repeatable workflows as custom skills.
- Browser Automation: Automate workflows such as research and form entry.
Privacy Note: Coworker runs locally. You must explicitly choose which folders the agent is allowed to access, and you must approve every action the agent attempts to take.
Understand the Accomplish Architecture Components
mainThe Accomplish system is divided into five primary functional layers that manage the lifecycle of AI tasks, from user interaction to local execution:
- Electron Shell (
apps/desktop): Handles UI-specific native concerns like the system tray, native dialogs, OAuth popups, and IPC forwarding. It acts as a thin client to the daemon. - React UI (
apps/web): The user interface for managing tasks, viewing execution progress (messages, todos, permissions), and configuring settings (skills, connectors, integrations). - Standalone Daemon (
apps/daemon): A Node.js process that serves as the primary execution engine. It manages the task lifecycle viaTaskService, handles scheduling, and spawns individualopencode servesubprocesses for each task. - Core Logic (
packages/agent-core): The shared ESM substrate used by both the daemon and desktop. It contains critical logic for task management (TaskManager), theOpenCodeAdapter(the bridge to execution), security (SecureStorage), and database management (SQLite). - Execution Subprocess (
opencode serve): A per-task subprocess that provides the actual environment for the AI. It includes built-in tools (Bash, Read, Write, Edit, etc.), manages MCP server connections, and handles native permission and question flows.
- Electron Shell (
Architectural implementation details for Coworker
mainThe system relies on several key architectural patterns for reliability and performance:
- SQLite with WAL mode: Used to enable concurrent reads during writes, supporting the IPC-heavy architecture where the UI reads while tasks write.
- Singleton settings rows:
app_settingsandprovider_metause aCHECK id=1constraint to ensure only one configuration row exists. - JSON-in-TEXT columns: Provider credentials, model configs, and OAuth metadata are stored as serialized JSON in TEXT columns for easier schema evolution.
- Denormalized favorites:
task_favoritescopiespromptandsummaryfromtasksto allow independent display without complex JOINs. - In-memory completion state:
CompletionFlowStateis intentionally not persisted. If the app crashes mid-task, the task is marked as failed rather than attempting to reconstruct state. - Machine-derived encryption key:
SecureStorageuses PBKDF2 with machine-specific inputs (platform, homedir, username) to avoid OS keychain permission prompts while remaining suitable for rotatable API keys. - Ephemeral React state: The Zustand store is purely derived from IPC events. On restart, task history is reloaded from SQLite, but in-flight execution state (e.g.,
currentTool,startupStage) is lost.
Coworker architecture overview
mainCoworker is an Electron-based desktop application with a React interface built using Vite.
Project Structure:
apps/desktop/: Contains the Electron application (main, preload, and renderer processes).packages/shared/: Contains shared TypeScript types.
Core Mechanics:
- The main process executes the OpenCode CLI via
node-ptyto perform tasks. - API keys are stored in the operating system's secure storage.
Understand Accomplish Desktop Data Storage
mainAccomplish Desktop uses a combination of persisted and ephemeral storage.
Persisted to Disk:
- SQLite DB: Stores Tasks, Messages, Todos, Providers, Skills, Connectors, and App Settings.
- Secure Storage: Stores API Keys and OAuth Tokens using AES-256-GCM encryption.
- Skills Directory: Contains
SKILL.mdfiles (both official and custom).
In-Memory (Ephemeral):
- Completion State: Tracks flow state and retry counts. This is lost on crash.
- Permission Promises: Handles deferred HTTP responses with a 5-minute timeout.
- React Store: Uses Zustand; rebuilt from IPC on restart.
External Data:
- OpenCode Data: Located at
~/.local/share/opencode/. Contains sessions, messages, and its own database. - opencode.json: A file generated per task containing the system prompt and MCP configuration.
Understand the Accomplish System Scope and External Interactions
mainAccomplish is a local-first desktop application that acts as a bridge between users and AI agent capabilities. It runs entirely on the user's machine without a cloud backend. Orchestration, storage, and credential management are handled locally, while the system connects to external LLM providers and local model servers via the OpenCode CLI.
External Entities and Interactions
Entity Type Interaction Data Exchanged Protocol End User Stakeholder Desktop UI Task prompts, settings, approvals Electron UI LLM Cloud Providers External API API calls via OpenCode CLI Prompts, completions, tool calls HTTPS Local Model Servers External Service API calls via OpenCode CLI Prompts, completions HTTP (localhost) GitHub External Platform OAuth, releases, CI/CD Auth tokens, build artifacts HTTPS MCP Tool Servers External Service MCP protocol via OpenCode CLI Tool invocations, results stdio / HTTPS Filesystem OS Resource File read/write by agent Code files, documents OS API Security and Data Protection in Accomplish
mainAccomplish is a local-first desktop application. It does not use user accounts or cloud-based logins; the user running the app owns all data.
Key Security Features:
- Authentication: API keys and OAuth tokens (e.g., for GitHub Copilot or OpenAI) are stored using AES-256-GCM encryption with a machine-derived PBKDF2 key.
- Agent Permissions: The OpenCode CLI requests explicit permission for dangerous operations like file writes or shell commands. Users must approve or deny these via the UI.
- Data Protection: Files are stored with
0o600permissions. There is no backend, so data is not sent to a central server, though LLM API calls are made via HTTPS to the respective providers. - Secrets Management: Uses a custom
SecureStorageclass rather than the OS Keychain to avoid macOS permission prompts.
Understand Coworker architecture
mainCoworker is built using Electron with a React UI packaged via Vite. The architecture is organized as follows:
apps/desktop/: The Electron application containing the main process, preload scripts, and the renderer process.packages/shared/: Shared TypeScript types used across the workspace.
Key Technical Details:
- The main process executes the OpenCode CLI using
node-ptyto perform tasks. - API keys are stored securely using the operating system's native keychain.
Understand the Coworker architecture
mainCoworker is built using an Electron-based desktop application with a React UI bundled via Vite.
Project Structure
apps/desktop/: Contains the Electron application (main, preload, and renderer processes).packages/shared/: Contains shared TypeScript types.
Core Components
- Main Process: Uses
node-ptyto spawn the OpenCode CLI for task execution. - Security: API keys are stored securely in the operating system's keychain.