This document helps AI coding agents (Claude Code, Cursor, Copilot Workspace, Windsurf, etc.) understand and contribute to OmoiOS efficiently.
OmoiOS is a spec-driven, multi-agent orchestration system. Users describe a feature, OmoiOS plans it (requirements → design → tasks), executes it with autonomous AI agents in isolated sandboxes, and creates a PR. The core promise: "Start a feature before bed. Wake up to a PR."
Production: Frontend at https://omoios.dev, API at https://api.omoios.dev
| Document | Purpose | When to read |
|---|---|---|
| ARCHITECTURE.md | System design, service map, data flow | Before any backend work |
| UI.md | Frontend routes, components, state, design system | Before any frontend work |
| backend/CLAUDE.md | Backend conventions, patterns, anti-patterns | Before writing Python |
| CLAUDE.md | Monorepo structure, dev commands, ports | Always |
| CONTRIBUTING.md | Branch conventions, PR process, testing | Before submitting changes |
| docs/rules/ | Per-mistake rules — tripwires we've already hit (SQLAlchemy session handling, reserved column names, feature flag gotchas) | Before editing dependencies, route handlers, or models |
senior_sandbox/
├── backend/omoi_os/
│ ├── api/
│ │ ├── main.py # FastAPI app + lifespan (25+ services initialized)
│ │ └── routes/ # 38 route files by domain
│ ├── services/ # Business logic (~40 service files)
│ │ ├── models/ # SQLAlchemy 2.0 models (~77 model classes)
│ ├── workers/ # Background workers (orchestrator, sandbox)
│ └── config.py # OmoiBaseSettings (YAML + env)
│
├── backend/config/
│ ├── base.yaml # Default application settings
│ └── test.yaml # Test overrides
│
├── backend/tests/
│ ├── unit/ # Fast isolated tests
│ ├── integration/ # Multi-component tests
│ └── e2e/ # Full workflow tests
│
├── frontend/
│ ├── app/ # Next.js 15 App Router
│ │ ├── (app)/ # Authenticated routes (command, projects, sandboxes, etc.)
│ │ ├── (auth)/ # Login, register, OAuth callback
│ │ └── (dashboard)/ # Root redirect to /command
│ ├── components/
│ │ ├── ui/ # ShadCN primitives (40+) — do not modify
│ │ ├── layout/ # App shell (MainLayout, IconRail, ContextualPanel)
│ │ ├── panels/ # Sidebar panels (route-aware)
│ │ └── {domain}/ # Domain components (command, spec, sandbox, etc.)
│ │ ├── hooks/ # 29 React Query + Zustand hooks (one per domain)
│ ├── lib/api/ # HTTP client + domain-specific API functions
│ └── providers/ # Context providers (Query, Auth, Theme, PostHog)
│
├── subsystems/spec-sandbox/ # Spec execution runtime
├── docs/
│ ├── proposals/ # OmoiOS Improvement Proposals (OIPs)
│ │ ├── page_flows/ # 24 page-by-page UI flow docs
│ ├── user_journey/ # End-to-end user journey docs
│ │ └── architecture/ # 14 system deep-dive docs
└── Justfile # Task runner (just --list for all commands)
These rules prevent common mistakes. Violating them causes build failures or runtime crashes.
-
Never use
metadataorregistryas SQLAlchemy column names. They are reserved by SQLAlchemy's declarative API and causeInvalidRequestErroron import. Usechange_metadata,item_metadata, etc. -
Always use
omoi_os.utils.datetime.utc_now()instead ofdatetime.utcnow(). The former returns timezone-aware datetimes compatible with the database. -
Use
structured_output()for LLM calls that need structured data. Never manually parse JSON from LLM responses.from omoi_os.services.llm_service import get_llm_service llm = get_llm_service() result = await llm.structured_output(prompt="...", output_type=MyPydanticModel)
-
Settings go in YAML, secrets go in .env. Application settings in
config/base.yaml, secret keys/passwords in.env. Settings classes extendOmoiBaseSettings. -
Two separate service initialization points exist.
api/main.py(API server) andworkers/orchestrator_worker.py(background worker) initialize different service sets. They run as separate processes and do not share state. See the Service Availability Matrix in ARCHITECTURE.md.
-
Check
components/ui/before creating new primitives. 40+ ShadCN components are available. Don't reinvent Button, Card, Dialog, etc. -
One hook per domain in
hooks/. Follow the pattern inuseProjects.tsoruseSpecs.ts. Use React Query for server state. -
API calls go through
lib/api/client.ts. Add domain-specific files tolib/api/(e.g.,projects.ts,specs.ts). Never callfetchdirectly. -
Route groups:
(app)for authenticated pages,(auth)for auth flows, root for public pages.
- Create or edit a route file in
backend/omoi_os/api/routes/ - Add the service method in
backend/omoi_os/services/ - Register the route in
backend/omoi_os/api/main.pyif it's a new router - Add tests in
backend/tests/ - Run
just testto verify
- Create
page.tsxin the correctfrontend/app/route group - Add a sidebar panel in
components/panels/if needed, register inContextualPanel.tsx - Create domain hooks in
hooks/and API functions inlib/api/ - Use existing ShadCN components from
components/ui/
- Create the model in
backend/omoi_os/models/ - Create an Alembic migration:
cd backend && uv run alembic revision -m "description" - Apply it:
uv run alembic upgrade head - Never use
metadataorregistryas column names
Write an OIP (OmoiOS Improvement Proposal) following the template in docs/proposals/TEMPLATE.md. See docs/proposals/README.md for the process.
just --list # All available commands
just dev-all # Full stack with hot-reload
just test # Affected tests only (via testmon)
just test-all # Full test suite
just format # Auto-format code
just check # Lint + type checksPorts: PostgreSQL 15432, Redis 16379, Backend API 18000, Frontend 3000
| What you need | Where to look |
|---|---|
| API route for a feature | backend/omoi_os/api/routes/ — files named by domain |
| Business logic | backend/omoi_os/services/ — 40+ service files |
| Database schema | backend/omoi_os/models/ — SQLAlchemy models |
| Frontend page | frontend/app/(app)/ — route structure matches URL |
| React component | frontend/components/{domain}/ — grouped by domain |
| Data fetching hook | frontend/hooks/use{Domain}.ts |
| API client function | frontend/lib/api/{domain}.ts |
| Type definitions | frontend/lib/api/types.ts |
| Page flow documentation | docs/page_flows/ — 24 documented flows |
| User journey documentation | docs/user_journey/ — end-to-end journey docs |
| Architecture deep-dives | docs/architecture/01-*.md through 14-*.md |
| Improvement proposals | docs/proposals/ — OIP system |
| Config settings | backend/config/base.yaml |
| Test examples | backend/tests/unit/, backend/tests/integration/ |
OmoiOS has four core systems:
-
Planning — Spec State Machine converts feature ideas through EXPLORE → PRD → REQUIREMENTS → DESIGN → TASKS → SYNC → COMPLETE. Each phase has an LLM evaluator (quality gate).
-
Execution — OrchestratorWorker dispatches tasks to Daytona sandboxes where ClaudeSandboxWorker runs using the Claude Agent SDK. Three modes: exploration, implementation, validation.
-
Discovery — DiscoveryService enables adaptive branching when agents find new requirements during execution. A Phase 3 agent can spawn Phase 1 investigation tasks.
-
Readjustment — MonitoringLoop runs Guardian (trajectory analysis, 60s), Conductor (coherence + duplicate detection, 5min), and Health Check (30s). Can redirect, refocus, or stop agents.
See ARCHITECTURE.md for the full diagram and deep-dive links.