- Use the
@docs/directory as the source of truth. You should list the files in the docs directory before starting any task, and update the documents as required. The@docs/directory should always be up-to-date. - After completing each task, update the relevant documentation in
@docs/to reflect any changes made. In particular,@docs/design.mdmust accurately reflect the current state of the codebase (entities, architecture, workflows, etc.). - Write all comments in English.
- Prefer enum types over strings when all variants are known at the moment of writing the code.
- If you modified Rust code, run
cargo testfrom the root directory before finishing your task. - If you modified frontend code, run
pnpm testfrom the frontend directory before finishing your task. - Commit your work as frequent as possible using git. Do NOT use
--no-verifyflag. - Do not guess; rather search for the web.
- Debug by logging. You should write enough logging code.
- Prioritize Connect RPC-based communication for business flows over Tauri-specific bindings.
This is a monorepo with three main components:
| Component | Path | Description |
|---|---|---|
| Main Server | apps/main-server/ |
Go backend, task management, RPC server |
| Worker Server | apps/worker-server/ |
Go worker, runs AI agents in Docker sandboxes |
| Desktop App | apps/tauri-app/ |
Tauri + React frontend |
Shared Rust crates live in crates/:
entities— Core entity definitionscoding_agents— AI agent abstraction, Docker sandboxing, task executiontask_store— Task persistence (SQLite, PostgreSQL, in-memory)rpc_protocol— Connect RPC protocol definitions (Protobuf)git_ops— Git operations, worktree managementauth— JWT authentication & RBACsecrets— Cross-platform keychain accessworker_impl— Local worker implementationconfig— Configuration managementplan_parser— YAML plan parsing
The RPC API is defined in crates/rpc_protocol/proto/dexdex.proto. When you need to find or modify an RPC method or message type, read this file first — it lists all method names and message types, eliminating the need to guess and grep.
- Never use
anytype in TypeScript. Use concrete types instead. - Prefer schema-based parsers (e.g., Zod) over raw
JSON.parse. - Avoid loose interfaces and undocumented data structures. If AI has to make assumptions about the shape of data, those assumptions may be wrong and all subsequent reasoning can spiral out of control.
- Input sanitization utilities are in
crates/entities/src/lib.rs(e.g.,sanitize_user_input(),validate_prompt()). - Frontend shared utilities are in
apps/tauri-app/src/lib/. - Read the relevant utility file before writing new helper functions to avoid duplicating existing code.
- For Tauri commands, define a single function per command. Do NOT define two separate functions with
#[cfg(desktop)]and#[cfg(not(desktop))]. Instead, use inline#[cfg(desktop)]blocks within the function body for desktop-only logic, and#[cfg(not(desktop))]to suppress unused variables and return a "not supported" error. Seeworkspace.rsandrepository.rsfor reference.