project-architecture
Understand the Orient monorepo architecture for making technical decisions. Use this skill when onboarding, adding new features, modifying services, or evaluating design choices. Covers packages, bots, agents, MCP servers, mini-apps, and Docker deployment.
安装与使用
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
查看来源 ↗使用指南技能说明
Orient Architecture
System Overview
Orient is a pnpm monorepo implementing an AI-powered project management system. The architecture features a multi-MCP-server pattern with pluggable bot frontends (Slack, WhatsApp) connected to a shared AI/Agent infrastructure.
┌─────────────────────────────────────────────────────────────────────────────┐
│ Messaging Frontends │
│ ┌─────────────────┐ ┌─────────────────┐ │
│ │ WhatsApp Bot │ │ Slack Bot │ │
│ │ (@orient/bot-wp)│ │ (@orient/bot-sl)│ │
│ └────────┬────────┘ └────────┬────────┘ │
│ └──────────────────┬────────────────────────┘ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ Agent Registry │ │
│ │ (@orient/agents) - Context resolution, tool permissions, skills │ │
│ └──────────────────────────────┬──────────────────────────────────────┘ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ OpenCode Server (AI Processing) │ │
│ │ ├── coding-server (MCP for dev tasks) │ │
│ │ ├── assistant-server (MCP for JIRA, Slack, Messaging, Calendar) │ │
│ │ └── core-server (MCP for skills, system, agents) │ │
│ └──────────────────────────────┬──────────────────────────────────────┘ │
│ ▼ │
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │
│ │ PostgreSQL │ │ Object Storage │ │ External APIs │ │
│ │ (Drizzle ORM) │ │ (MinIO / R2) │ │ (JIRA, Google) │ │
│ └─────────────────┘ └─────────────────┘ └─────────────────┘ │
└─────────────────────────────────────────────────────────────────────────────┘
Monorepo Structure
orient/
├── packages/
│ ├── agents/ # Agent registry, prompts, skills, permissions
│ ├── apps/ # Mini-apps system (manifests, edit sessions)
│ ├── mcp-servers/ # MCP server types and configs
│ ├── mcp-tools/ # MCP tool definitions and registry
│ ├── core/ # Shared utilities, config, logging, types
│ ├── database/ # Drizzle ORM schemas (PostgreSQL)
│ ├── database-services/ # DB service implementations
│ ├── integrations/ # External integrations (JIRA, GitHub, Google)
│ ├── bot-whatsapp/ # WhatsApp bot (Baileys)
│ ├── bot-slack/ # Slack bot (Bolt)
│ ├── api-gateway/ # REST API, webhooks, schedulers
│ ├── dashboard/ # React admin dashboard
│ └── test-utils/ # Test factories, mocks
├── src/ # ⚠️ DEPRECATED - Do not write new code here
├── apps/ # Standalone mini-apps (e.g., meeting-scheduler)
├── data/ # Seeds, migrations
├── docker/ # Docker configs and compose files
├── tests/ # Cross-package tests (e2e, integration)
├── skills/ # Global skill definitions
└── pnpm-workspace.yaml
Package Descriptions
| Package | Status | Description |
|---|---|---|
@orient/core |
✅ Stable | Config loading, logging (winston), base types |
@orient/database |
✅ Stable | Drizzle ORM schemas, PostgreSQL client |
@orient/database-services |
✅ Stable | MessageDatabase, SlackDatabase, SchedulerDatabase, WebhookDatabase |
@orient/agents |
✅ Stable | Agent registry, skills service, prompts, tool permissions |
@orient/apps |
✅ Stable | Mini-apps manifests, types, validation, edit sessions |
@orient/mcp-servers |
🚧 Types Only | MCP server type definitions (impl in src/mcp-servers/) |
@orient/mcp-tools |
✅ Stable | MCP tool registry & definitions |
@orient/integrations |
✅ Stable | JIRA, GitHub, Google (Sheets, Slides, Gmail, Calendar) |
@orient/bot-whatsapp |
✅ Stable | WhatsApp bot using Baileys |
@orient/bot-slack |
✅ Stable | Slack bot using Bolt |
@orient/api-gateway |
✅ Stable | REST API, webhooks |
@orient/dashboard |
✅ Stable | Admin dashboard (React + Express) |
@orient/test-utils |
✅ Stable | Test factories, mocks, DB helpers |
Multi-MCP-Server Architecture
Orient implements three specialized MCP servers, replacing the legacy monolithic server:
| Server | Purpose | Key Tools |
|---|---|---|
| coding-server | Development tasks | ai_first_slides_*, ai_first_create_app, Agent tools |
| assistant-server | Full PM capabilities | All JIRA tools, Slack/WhatsApp, Google (Calendar, Gmail), Sheets |
| core-server | System & skills | ai_first_list_skills, ai_first_health_check, Agent tools |
All servers share the discover_tools tool for dynamic capability discovery.
CLI Usage:
# Start specific server
npm run start:mcp:coding
npm run start:mcp:assistant
npm run start:mcp:core
Agent Registry
Agents are managed via the Dashboard UI and stored in PostgreSQL. The @orient/agents package provides the runtime.
┌─────────────────────────────────────────┐
│ Dashboard UI │
│ (Agents Tab - CRUD operations) │
└────────────────────┬────────────────────┘
▼
┌─────────────────────────────────────────┐
│ Agent Registry │
│ - Context resolution (platform, chat) │
│ - Skills assignment │
│ - Tool allow/ask/deny patterns │
└────────────────────┬────────────────────┘
▼
┌─────────────────────────────────────────┐
│ PostgreSQL Tables │
│ agents | agent_skills | agent_tools │
│ context_rules │
└─────────────────────────────────────────┘
Default Agents
| Agent | Description |
|---|---|
pm-assistant |
Primary agent for JIRA, meetings, project management |
communicator |
Slack/WhatsApp messaging with proper formatting |
scheduler |
Calendar management, reminders |
explorer |
Fast codebase exploration, documentation lookup |
app-builder |
Create Mini-Apps via PR workflow |
onboarder |
Guides new users through setup |
Agent Mentions
In Slack or WhatsApp, prefix message with @agent-id to override default agent:
@explorer find the auth config
Mini-Apps System (@orient/apps)
Allows generating small React apps via AI prompts, managed through Git worktrees.
Key Tools:
-
ai_first_create_app- Generate a new app from a prompt -
ai_first_list_apps- List existing apps -
ai_first_get_app- Get app details -
ai_first_update_app- Update an existing app -
ai_first_share_app- Generate a shareable link
Edit Session Flow:
- Create Git worktree for isolated development
- Scaffold app or load existing
- Create OpenCode session
- Send prompt to AI for code generation
- Auto-commit changes
- Build app (
npm install && npm run build) - Track commit history for rollback
Note: This feature is under active development. See
TODO.md.
Data Flow (Incoming Message)
1. Message received (WhatsApp/Slack)
│
├── Check permission (read_only, read_write, ignored)
│ └── ignored: Drop message
│ └── read_only: Store message, don't respond
│ └── read_write: Store message, process
│
▼
2. Resolve Agent (AgentRegistry → context rules → default)
│
▼
3. Send to OpenCode server (MCP) for AI processing
│
▼
4. OpenCode uses MCP tools (JIRA, Slides, etc.)
│
▼
5. Return response to user
│
▼
6. Store outgoing message in PostgreSQL
Docker Deployment
Uses per-package Dockerfiles with multi-stage builds.
# Local Development (v2 compose)
docker compose -f docker/docker-compose.v2.yml -f docker/docker-compose.local.yml up -d
# Production
USE_V2_COMPOSE=1 ./deploy-server.sh deploy
# Or manually:
docker compose -f docker/docker-compose.v2.yml \
-f docker/docker-compose.prod.yml \
-f docker/docker-compose.r2.yml up -d
Key CLI Commands
# Development
npm run dev:slack # Run Slack bot in dev mode
npm run dev:whatsapp # Run WhatsApp bot in dev mode
npm run dev:mcp # Run coding MCP server in dev mode
npm run dev:infra # Start Docker infrastructure (Postgres, etc.)
# Database
npm run db:migrate # Run migrations
npm run db:seed:all # Seed all data
npm run agents:seed # Seed default agents
# Testing
npm run test # Run all tests
npm run test:e2e # Run E2E tests
npm run test:unit # Run unit tests only
npm run test:docker:build # Test Docker builds
# Build
npm run build # TypeScript compile
npm run build:all # Build packages + root + dashboard
Architectural Decisions
When to Create a New Package
Create a new package when:
- Functionality is distinct and reusable across the system
- Has its own lifecycle (startup/shutdown)
- Could be published as a standalone npm package
Extend existing package when:
- Functionality is tightly coupled to existing code
- Only used in one context
Adding New Features
-
New Agent: Add via Dashboard UI, seed via
data/seeds/agents.ts -
New MCP Tool: Add to
packages/mcp-tools/orsrc/tools/ -
New Integration: Add to
@orient/integrations -
New Bot Platform: Follow
bot-whatsapp/bot-slackpattern
Database Schema Patterns
- Use platform-specific tables:
messages/slack_messages - PostgreSQL for structured data, Object Storage for media
- Drizzle ORM for type-safe queries
使用示例
查看来源仓库中的使用示例与配置说明。
查看来源 ↗来源历史
- 收录时间
- 2026-01-20
- 索引更新时间
- 2026-01-26
- Branch
- main
收录与同步日期属于本站记录。源码修改历史请查看来源仓库。
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!