This is the entry point for AI coding agents working on Symphony Cloud. Read this file first. Follow the protocols exactly.
- Read this file completely before doing any work.
- Traverse the knowledge graph starting at
docs/_index.md. - Check policy gates — run
bash scripts/harness/check-policy.shto see if your changes trigger any policies. - Implement changes following the constraints below.
- Update documentation — any code change that affects architecture, APIs, schemas, or env vars must have a corresponding doc update.
- Run checks —
make -f Makefile.control checkbefore committing.
| Path | Type | Description |
|---|---|---|
apps/app |
Next.js | Main dashboard (port 3000) |
apps/api |
Next.js | Control plane API (port 3002) |
apps/web |
Next.js | Marketing site (port 3001) |
apps/docs |
Mintlify | Public docs (port 3004) |
apps/email |
React Email | Email templates (port 3003) |
apps/storybook |
Storybook | Component explorer (port 6006) |
apps/studio |
Prisma Studio | DB explorer (port 5555) |
packages/database |
Prisma | ORM + schema + migrations (12 models) |
packages/design-system |
shadcn/ui | Shared UI components (55+) |
packages/symphony-client |
TypeScript | HTTP client for Symphony engine API |
packages/auth |
Clerk | Authentication |
packages/payments |
Stripe | Billing |
packages/observability |
Sentry | Error tracking + logging |
.control/ |
YAML | Policy gates, commands, topology |
docs/ |
Markdown | Knowledge graph (Obsidian-flavored) |
scripts/harness/ |
Bash | Automation scripts |
The API (apps/api) exposes these /v1/* route groups:
| Route Group | Methods | Description |
|---|---|---|
/v1/instances |
GET, POST | List/create Symphony instances |
/v1/instances/:id |
GET, PATCH, DELETE | Detail/update/soft-delete instance |
/v1/instances/:id/state |
GET | Proxy to engine /api/v1/state |
/v1/instances/:id/refresh |
POST | Proxy to engine /api/v1/refresh |
/v1/instances/:id/agents |
GET | Active agents from engine state |
/v1/instances/:id/shutdown |
POST | Graceful engine shutdown |
/v1/workflows |
GET, POST | List/create workflows |
/v1/workflows/:id |
GET, PATCH, DELETE | Detail/update (auto-version)/soft-delete |
/v1/workflows/:id/deploy |
POST | Deploy workflow to instance |
/v1/runs |
GET | List runs (cursor pagination) |
/v1/runs/:id |
GET | Run detail with sessions |
/v1/api-keys |
GET, POST | List (masked)/create (encrypted) |
/v1/api-keys/:id |
DELETE | Delete API key |
/v1/usage |
GET | Aggregate billing period stats |
/v1/settings |
GET, PATCH | Org settings (upsert pattern) |
/cron/monitor |
GET | Health check all instances |
All /v1/* routes use authenticateRequest() from lib/auth.ts (Clerk JWT + org scoping).
API lib modules: lib/crypto.ts (AES-256-GCM), lib/railway.ts (provisioning), lib/monitoring.ts (health checks).
All commands are defined in .control/commands.yaml and accessible via Makefile.control:
| Command | What it does | When to use |
|---|---|---|
make -f Makefile.control smoke |
Install + check + build app | After pulling changes |
make -f Makefile.control check |
Lint (biome) + typecheck (tsc) | Before every commit |
make -f Makefile.control test |
Run vitest | Before pushing |
make -f Makefile.control build |
Full Turborepo build | Before deploy |
make -f Makefile.control ci |
check + test + build | Full local CI simulation |
make -f Makefile.control docs-check |
Verify docs freshness | After docs/ changes |
make -f Makefile.control policy-check |
Policy gate warnings | Before committing |
make -f Makefile.control audit |
Full entropy audit | Periodic health check |
Direct bun commands also work:
bun install— install dependenciesbun dev— start all apps in dev modebun run build— build all appsbun run test— run vitestbun run check— lint via biome/ultracitebun run migrate— Prisma format + generate + migrate devbun run db:push— Prisma format + generate + db push
Before starting any task, check for pending dependency updates:
- Review open PRs — Run
gh pr list --state openand note any dependabot PRs that affect packages you're working in. - Incorporate relevant updates — If dependabot has pending updates for packages in your task scope, apply those updates as part of your branch rather than leaving them as separate PRs.
- Batch by workspace — Use
bun update <pkg>at the workspace root to update across all packages simultaneously. Do not manually edit individualpackage.jsonfiles for version bumps. - Follow risk tiers:
- Patch / types-only: Apply freely, verify with
make -f Makefile.control check. - Minor: Review changelog, run full
make -f Makefile.control ci. - Major: Review migration guide, run full CI, write an ADR if behavior changes (
docs/decisions/).
- Patch / types-only: Apply freely, verify with
- Post-update verification: After any dependency change, run at minimum:
bun install(regenerate lockfile)make -f Makefile.control check(lint + typecheck)make -f Makefile.control test(test suite)
- Clean up — After updates are merged, close superseded dependabot PRs with a reference to the consolidation commit.
These are hard rules. Violations will be caught by CI or pre-commit hooks.
- App Router only — No
pages/directory. All routes use Next.js App Router. - Server Components by default — Only add
'use client'when the component needs browser APIs, hooks, or event handlers. - Prisma for database — All schema changes go through
packages/database/prisma/schema.prisma. Always runbun run migrateorbun run db:pushafter changes. - No secrets in code — Environment variables go in
.env.local(gitignored). Document them indocs/schemas/env-variables.md. - Workspace imports — Use
@repo/<package>imports. Never use relative paths across package boundaries. - Update docs on schema changes — Any change to the database schema, API contracts, or environment variables requires a documentation update.
- ADR for architectural decisions — Major changes need an Architecture Decision Record in
docs/decisions/. - Policy compliance — Check
.control/policy.yamlfor risk gates before committing high-risk changes. - Biome formatting — Code is formatted by Biome. Run
bun run fixto auto-format. Do not fight the formatter. - TypeScript strict mode —
noEmittypecheck must pass. Noanytypes without justification.
The knowledge graph lives in docs/ using Obsidian-flavored Markdown:
Start at docs/_index.md. It contains:
- The full graph map (every document listed)
- Tag taxonomy for filtering
- Traversal instructions for different tasks
Navigate by domain:
- Architecture:
docs/architecture/— System diagrams, app descriptions, data flow - API Contracts:
docs/api-contracts/— HTTP API specs, webhook schemas - Decisions:
docs/decisions/— ADRs explaining why things are the way they are - Runbooks:
docs/runbooks/— Step-by-step operational procedures - Schemas:
docs/schemas/— Database schema docs, env variable catalog
When starting a task:
- Read
docs/_index.mdto orient - Read the domain-specific architecture doc (e.g.,
docs/architecture/app-dashboard.md) - Read related ADRs in
docs/decisions/ - Check
docs/schemas/env-variables.mdif touching configuration - Read the relevant runbook if performing an operational task
- Wikilinks:
[[architecture/overview]]links todocs/architecture/overview.md - Callouts:
> [!decision],> [!warning],> [!context] - Diagrams: Mermaid code blocks for system diagrams
Documents are tagged with frontmatter for filtering:
| Prefix | Values | Purpose |
|---|---|---|
domain/ |
auth, database, billing, dashboard, api, symphony-client, marketing, design, infra | What subsystem |
phase/ |
1, 2, 3, 4, 5 | Roadmap phase |
status/ |
draft, active, deprecated | Document lifecycle |
type/ |
architecture, api-contract, decision, runbook, schema | Document kind |
Before pushing any branch:
- Pending dependabot PRs reviewed; relevant updates incorporated or noted
- Documentation updated for any schema, API, or env var changes
-
make -f Makefile.control checkpasses (lint + typecheck) -
make -f Makefile.control testpasses (vitest) -
make -f Makefile.control policy-checkreviewed (no unaddressed warnings) -
docs/_index.mdupdated if new docs were added - No broken
[[wikilinks]](make -f Makefile.control wikilinks-check) - Commit messages are clear and reference relevant context