Multi-Orchestrator Dashboard Support

Design Document — Agent Orchestrator v0.5.0

Draft March 2026 Author: Design Research

Contents

  1. Executive Summary
  2. Current System Analysis
  3. Competitive Analysis
  4. Architectural Assessment
  5. Proposed UI Design
  6. Implementation Plan
  7. Edge Cases
  8. Open Questions & Trade-offs

1. Executive Summary

The Agent Orchestrator (AO) dashboard currently shows sessions from a single orchestrator config. It loads one agent-orchestrator.yaml, initializes one set of services, and displays all sessions across projects defined in that config file. There is no built-in way to see sessions from multiple orchestrator configs (e.g., different teams, different machines, or entirely separate project groups).

This document proposes extending the dashboard to support multi-orchestrator awareness: the ability to discover, aggregate, and display sessions from multiple orchestrator instances — whether they manage different projects or even the same project concurrently.

Key insight from codebase analysis: The system already supports multiple projects within a single config. The hash-based directory structure (~/.agent-orchestrator/{hash}-{projectId}/) naturally namespaces data by config location, which prevents cross-config data corruption. The main gaps are in the dashboard's service layer (hardcoded to one config) and the UI (no project switcher or orchestrator selector).

Goals

2. Current System Analysis

2.1 How the Dashboard Works Today

The dashboard is a Next.js 15 App Router application. Here is the complete data flow from config to rendered UI:

agent-orchestrator.yaml | v loadConfig() OrchestratorConfig (packages/core/ .projects: Record<string, ProjectConfig> src/config.ts) .configPath: string (auto-set by loader) | v getServices() { config, registry, sessionManager, lifecycleManager } (packages/web/ Singleton cached in globalThis._aoServices src/lib/services.ts) Lifecycle manager started at 30s poll interval | v sessionManager.list() Session[] (packages/core/ Reads from ~/.agent-orchestrator/{hash}-{projectId}/sessions/ src/session-manager.ts) Enriches with runtime liveness checks (tmux has-session) | v sessionToDashboard() DashboardSession[] (packages/web/ Flattens core types for JSON serialization src/lib/serialize.ts) Enriches with PR data from SCM, issue titles from tracker | v page.tsx (SSR) Initial render via React Server Components + /api/events (SSE) Real-time updates via 5-second polling snapshots + /api/sessions (REST) Full refresh when session membership changes | v Dashboard component Kanban board with attention zones (packages/web/ Tabs: Board | Backlog | Verify | Pull Requests src/components/ Actions: kill, send message, merge PR, restore Dashboard.tsx)

Key observations from code

AspectCurrent BehaviorSource File
Config loading Loads ONE config via findConfigFile(). Search order: AO_CONFIG_PATH env var, then walk up directory tree from CWD, then ~/.agent-orchestrator.yaml, then ~/.config/agent-orchestrator/config.yaml. packages/core/src/config.ts lines 353-413
Service singleton One getServices() singleton cached in globalThis._aoServices. Lazy-initialized on first call. Never refreshed while dashboard is running. packages/web/src/lib/services.ts lines 52-72
Project name getProjectName() returns the first project's name from config. Used in page title, favicon, and layout metadata template. packages/web/src/lib/project-name.ts
Session listing sessionManager.list() iterates ALL project directories under ~/.agent-orchestrator/{hash}-*/sessions/ for the loaded config. Returns sessions from all projects in one flat array. packages/core/src/session-manager.ts
Data directory Hash-based: ~/.agent-orchestrator/{sha256(dirname(configPath))[0:12]}-{basename(projectPath)}/. Each project gets its own directory. A .origin file inside stores the config path for collision detection. packages/core/src/paths.ts lines 20-25, 84-95
SSE events Single /api/events stream. Sends full session snapshots (id, status, activity, attentionLevel) every 5 seconds via polling. Client (useSessionEvents) applies patches to existing sessions. packages/web/src/app/api/events/route.ts
SSE membership changes When SSE snapshot IDs differ from client state, client fetches full session list from /api/sessions and resets state. packages/web/src/hooks/useSessionEvents.ts lines 80-105
Dashboard start ao dashboard spawns npx next dev inside the packages/web directory. Passes AO_CONFIG_PATH via env so Next.js finds the config. packages/cli/src/commands/dashboard.ts
Lifecycle manager Single instance started in initServices(). Polls every 30s. Triggers reactions: CI-fix auto-send, review comment forwarding, idle detection, merge-conflict rebase. Also runs backlog poller (1-min interval) that auto-claims issues labeled agent:backlog. packages/web/src/lib/services.ts lines 89-93, 113-338
Project resolution resolveProject(session, projects) maps session to project by: (1) explicit projectId, (2) session prefix match, (3) fallback to first project. packages/web/src/lib/serialize.ts lines 25-40
Tmux naming Tmux session names include config hash for global uniqueness: {hash}-{prefix}-{num}. This prevents collisions between different orchestrator configs sharing the same tmux server. packages/core/src/paths.ts lines 142-146

2.2 What Happens with Multiple Orchestrators?

Scenario A: Multiple orchestrators for different projects (different configs)

Current behavior: The dashboard only sees sessions from whichever agent-orchestrator.yaml it loaded. If you run ao dashboard from project A's directory, you see only project A's sessions. Project B's orchestrator and sessions are invisible. A developer managing 3 projects with separate configs today needs 3 dashboard tabs open on different ports.

This is the most common multi-orchestrator scenario and the primary pain point this design addresses.

Scenario B: Multiple orchestrators on the same project (same config)

Current behavior: Both orchestrators read/write the same session metadata directory. This creates race conditions and data corruption:
!!
Verdict: Running multiple orchestrators on the same config is unsafe today and should be detected and blocked, not supported as a feature. The dashboard should warn users when this is detected.

Scenario C: Multiple orchestrators for different projects (same config file)

Current behavior: This works correctly today. One config file can define multiple projects, and a single orchestrator manages all of them. Sessions are naturally namespaced by project prefix (int-1 vs ao-3). Data directories are separate ({hash}-integrator/ vs {hash}-backend/). The dashboard already shows sessions from all projects in one view.

This is the recommended approach for managing multiple projects and requires no changes.

2.3 What Already Works Well

The hash-based directory structure is an excellent foundation for multi-orchestrator support.

3. Competitive Analysis

How do similar tools handle multi-project / multi-instance dashboards? The following table summarizes research across developer tools, infrastructure platforms, and AI coding agent orchestrators.

Tool Multi-Project Approach Navigation Pattern Key Takeaway for AO
Vercel Dashboard Team-level dashboard showing all projects with deployment status, last commit, and domain. Click into a project for deployment history and settings. Collapsible sidebar with team/project hierarchy. Project list supports search and filtering. Breadcrumb navigation for drill-down. Sidebar navigation with team-to-project hierarchy is the gold standard for developer tools. The sidebar auto-hides on narrow viewports. Projects show aggregate status (last deployment, branch).
Railway Projects as containers for services. Each project gets a visual canvas showing service topology. Services show deploy status, resource usage. Project list (grid of cards) at top level. Click project to see canvas. Service detail in side panel. Canvas view is powerful for infrastructure topology. For AO, the kanban board serves a similar role. Project cards with aggregate stats work well as entry points.
Backstage (Spotify) Software catalog listing all services, libraries, data pipelines across the org. Searchable and filterable by kind, lifecycle stage, owner, tags. Top-level catalog view with faceted filters (sidebar). Plugin-based detail pages per entity. Search is the primary discovery mechanism. Catalog approach scales to 1000+ services but is overkill for AO's typical 2-10 projects. The faceted filter pattern (sidebar with checkboxes/toggles) could work for project filtering.
Portainer Multi-environment dashboard. Each environment (Docker host, K8s cluster, Swarm) gets its own tile showing container/pod counts, resource usage, health. Environment list in sidebar. Click environment to see its containers/services. Global dashboard shows aggregated health across all environments. Closest analogy: environment = orchestrator instance. Summary tiles with container counts = session counts per project. The "home" view aggregating all environments is exactly what AO needs.
Superset IDE Unified terminal showing all active AI coding agents. Agents isolated via git worktrees. Status indicators: running, completed, waiting for input. Built-in diff viewer. Agent list with real-time status. Notification system for attention-needed events. One-click jump to editor (VS Code, Cursor, etc.). Most architecturally similar to AO. Flat agent list with status filtering. Git worktree isolation. Agent-agnostic (Claude Code, Codex, etc.). Validates AO's design choices.
OpenAI Codex App "Command center for agents" — centralized view of all AI coding agents across projects. Task list with change review workflow. Agent task list with status. PR-style diff review for each agent's changes. Centralized management. The "command center" branding resonates with AO's orchestrator concept. The change review workflow (built-in diff) is a feature AO could adopt.
Gitpod Workspace list with state indicators (running, stopped, archived). Each workspace is tied to a repository + branch. Flat workspace list with status colors and sort/filter. "New Workspace" button at top. Pin favorite workspaces. Simple flat list works when items are under 20. The "pin" feature is interesting for AO — pin important projects to the top of the sidebar.
GitHub Codespaces Codespace list grouped by repository. Status indicators (active, stopped). Machine type and last used timestamp shown. Flat list, grouped by repo. "View All" to see older/stopped workspaces. Quick actions inline. Repository grouping = project grouping. Natural and familiar for developers. The "grouped flat list" pattern avoids the overhead of a sidebar for simple cases.
Claude Code Agent Teams Terminal-based multi-agent coordination. One session acts as team lead, others are teammates. Communication via message passing between sessions. Keyboard shortcuts: Shift+Up/Down for teammate selection, Ctrl+T for task list, Enter to view session. No GUI dashboard. Terminal-first, no web dashboard. AO fills a gap here — providing the visual dashboard that Claude Code Agent Teams lacks. The task list concept maps to AO's kanban board.

Pattern Synthesis

Pattern 1: Sidebar with Hierarchy

Used by: Vercel, Portainer, Backstage

Left sidebar shows project/environment list. Click to filter main content area. Collapsible for space. Best for 3-15 items. Supports keyboard navigation.

Fit for AO: Excellent. AO has 2-10 projects, perfect sidebar range.

Pattern 2: Project Switcher Dropdown

Used by: GitHub, GitLab, Sentry

Header dropdown to switch project context. Shows one project at a time. Good when you mostly work in one project. Loses multi-project overview.

Fit for AO: Partial. Loses the "all projects at once" view that's valuable for orchestration.

Pattern 3: Summary Tiles + Drill-down

Used by: Railway, Portainer, Grafana

Top-level shows aggregated counts per project/environment. Click to drill into details. Best for overview dashboards where you need to triage across many things.

Fit for AO: Good for overview. Summary tiles with session counts and attention badges per orchestrator.

Pattern 4: Flat List with Grouping

Used by: Gitpod, Codespaces, Superset IDE

All items in one list, grouped by project/repo. Works well for fewer than 20 total items. Simple, no navigation overhead. Groups can be collapsed.

Fit for AO: Good. The kanban board already groups by attention level; adding project grouping within columns is natural.

Recommendation for AO: A hybrid of Pattern 1 (sidebar) + Pattern 3 (summary tiles). The sidebar shows orchestrator instances and their projects with session counts and attention indicators. Clicking a project filters the existing kanban board. An "All" option shows everything (current behavior). For single-config deployments with one project, the sidebar is hidden entirely — zero visual regression.

4. Architectural Assessment

4.1 Discovery: How to Find All Orchestrator Instances

The key architectural question is: how does one dashboard know about other orchestrators? Three options, not mutually exclusive:

Option A: Scan the data directory (recommended for v1)

All orchestrators store data under ~/.agent-orchestrator/. The dashboard can scan for all {hash}-{projectId}/ directories and read their .origin files to reconstruct which config each one belongs to.

~/.agent-orchestrator/
  a3b4c5d6e7f8-integrator/        # Config A, project "integrator"
    .origin                        # Contains: /home/user/integrator/agent-orchestrator.yaml
    sessions/
      int-1, int-2, ...
  a3b4c5d6e7f8-backend/           # Config A, project "backend"
    .origin
    sessions/
      bk-1, bk-2, ...
  f1e2d3c4b5a6-my-other-project/  # Config B (different directory)
    .origin                        # Contains: /home/user/other/agent-orchestrator.yaml
    sessions/
      mop-1, ...
+
Pros: Zero config — works immediately. Discovers all orchestrators that have ever been used on this machine. No network required. Leverages existing .origin file mechanism. Lightweight filesystem scan (single readdirSync + a few readFileSync calls).
-
Cons: Only discovers local orchestrators. Stale directories from deleted configs will appear until manually cleaned. Requires reading each config file to get project metadata (project names, repos, etc.).

Option B: Config file lists other configs

# In agent-orchestrator.yaml
federation:
  - ~/other-project/agent-orchestrator.yaml
  - ~/third-project/agent-orchestrator.yaml

Explicit but requires manual maintenance. Could be combined with Option A as an override for non-standard locations or remote configs.

Option C: Network discovery (future)

For multi-machine setups: a central registry, mDNS/Bonjour discovery, or SSH-based scanning. Out of scope for v1 but the architecture should not preclude it. The OrchestratorInstance interface should include a remote?: { host: string; port: number } field for forward compatibility.

4.2 Service Layer Changes

The current getServices() singleton returns one config and one session manager. For multi-orchestrator support, we need a multi-config service layer that can manage multiple session managers simultaneously.

// NEW: packages/web/src/lib/multi-services.ts

interface OrchestratorInstance {
  /** Unique ID: the 12-char config hash from paths.ts */
  id: string;

  /** Human-readable label derived from config directory basename */
  label: string;

  /** Absolute path to the config file */
  configPath: string;

  /** Parsed and validated OrchestratorConfig */
  config: OrchestratorConfig;

  /** Plugin registry for this config (each config may use different plugins) */
  registry: PluginRegistry;

  /** Session manager for this config */
  sessionManager: OpenCodeSessionManager;

  /** Whether the lifecycle manager is active (only for the "primary" instance) */
  lifecycleActive: boolean;

  /** Project IDs defined in this orchestrator's config */
  projectIds: string[];

  /** Whether this config file still exists on disk */
  isAlive: boolean;
}

interface MultiServices {
  /** All discovered orchestrator instances (primary first) */
  instances: OrchestratorInstance[];

  /** The primary instance (from the config that started this dashboard) */
  primary: OrchestratorInstance;

  /** Get sessions across ALL instances, tagged with orchestratorId */
  listAll(): Promise<Array<Session & { orchestratorId: string }>>;

  /** Get sessions for a specific orchestrator */
  list(orchestratorId: string): Promise<Session[]>;

  /** Find which instance owns a session ID (scans all instances) */
  findOwner(sessionId: string): OrchestratorInstance | null;

  /** Re-scan filesystem for new/removed instances */
  refresh(): Promise<void>;
}
Critical constraint: The lifecycle manager (which triggers reactions like CI-fix auto-send, backlog auto-claim, and idle detection) must only run for the primary orchestrator. Satellite orchestrator instances discovered via filesystem scan are read-only from this dashboard. Their own ao start processes manage their lifecycle independently. This prevents duplicate reactions (two lifecycle managers both sending "fix CI" to the same session) and permission issues (satellite configs may use different GitHub tokens).

4.3 API Route Changes

Route Current Behavior Proposed Change
GET /api/sessions Returns sessions from one config. Response: { sessions, stats, orchestratorId, globalPause } Add ?orchestrator={hash} and ?project={id} query params for filtering. Default: return all. Add orchestratorId and orchestratorLabel fields to each session. Add instances[] to response with summary info per orchestrator.
GET /api/events SSE stream from one session manager. Polls every 5 seconds. Aggregate snapshots from all instances. Include orchestratorId in each session entry. Support ?orchestrator={hash} to filter the stream to one instance.
GET /api/backlog Lists agent:backlog issues across projects in one config. Aggregate across all instances. Add orchestratorId to each issue response. De-duplicate issues that appear in multiple configs (same repo).
POST /api/sessions/:id/* Kill, send, restore by session ID. Assumes session belongs to the loaded config. Accept orchestratorId in request body. If omitted, auto-discover which instance owns the session by scanning all instances. Warn if session ID is ambiguous across instances.
POST /api/spawn Spawns session using primary config's session manager. Accept optional orchestratorId in body. Only allow spawning in orchestrators whose lifecycle is active (primary only, unless satellite explicitly opts in).
GET /api/orchestrators Does not exist NEW. List all discovered orchestrator instances with: id, label, configPath, projectIds, sessionCount, activeSessionCount, needsAttentionCount, isPrimary, isAlive.

4.4 Data Model Changes

The DashboardSession type gains two new fields:

// packages/web/src/lib/types.ts

export interface DashboardSession {
  // ... all existing fields unchanged ...

  /** Config hash of the orchestrator instance that owns this session */
  orchestratorId: string;

  /** Human-readable orchestrator label (e.g., "desktop", "work") */
  orchestratorLabel: string;
}

SSE snapshot events also gain orchestrator context:

export interface SSESnapshotEvent {
  type: "snapshot";
  sessions: Array<{
    id: string;
    orchestratorId: string;    // NEW
    status: SessionStatus;
    activity: ActivityState | null;
    attentionLevel: AttentionLevel;
    lastActivityAt: string;
  }>;
}

New type for the orchestrators API:

export interface OrchestratorInstanceInfo {
  id: string;                   // 12-char config hash
  label: string;                // Config dir basename (e.g., "agent-orchestrator")
  configPath: string;           // Absolute path to yaml
  projectIds: string[];         // Project keys from config
  sessionCount: number;         // Total sessions
  activeSessionCount: number;   // Non-terminal sessions
  needsAttentionCount: number;  // Sessions in "respond" or "merge" zones
  isPrimary: boolean;           // This dashboard's own config
  isAlive: boolean;             // Config file still exists on disk
}

4.5 Session ID Uniqueness Across Orchestrators

Session IDs are scoped per-project within a config (int-1, ao-3). Two different configs managing different projects will have naturally unique prefixes due to sessionPrefix validation within each config. However, two configs could define projects with the same path or prefix, leading to ID collisions in the aggregated view.

Resolution: Use {orchestratorId}:{sessionId} as the composite key in the dashboard. The orchestratorId is the 12-char config hash. This is analogous to Kubernetes namespace/name. The session ID alone remains sufficient within a single orchestrator (backwards compatible). The composite key is only needed in the multi-orchestrator aggregated view. API routes that mutate sessions (kill, send, restore) accept the composite key and parse out both parts.
// Composite key utilities
function compositeKey(orchestratorId: string, sessionId: string): string {
  return `${orchestratorId}:${sessionId}`;
}

function parseCompositeKey(key: string): { orchestratorId: string; sessionId: string } | null {
  const colonIdx = key.indexOf(":");
  if (colonIdx === -1) return null;
  return {
    orchestratorId: key.slice(0, colonIdx),
    sessionId: key.slice(colonIdx + 1),
  };
}

5. Proposed UI Design

5.0 Visual Mockups

Below are high-fidelity mockups showing the proposed multi-orchestrator dashboard. These match the current AO dashboard's dark theme and design language.

Current Dashboard (Single Orchestrator, Single Project)

Orchestrator
5 sessions · 3 working · 4 PRs · 1 need attention
orchestrator
Board
Backlog 3
Verify
Pull Requests 4
Working 3
ao-1
terminal
Add OAuth2 login flow with GitHub provider
feat/auth-flow PR #42 CI ✓
ao-2
terminal
Fix rate limiter bypass on batch endpoints
fix/rate-limit
ao-3
terminal
Migrate user table to new schema
feat/db-migrate PR #45 CI ✗
Review 1
ao-4
terminal
Add WebSocket support for real-time events
feat/websocket PR #40 CI ✓ review pending
Merge 1
ao-5
Update API rate limit docs
docs/rate-limit PR #38 approved ✓
Merge PR #38
▲ Current single-project dashboard — no sidebar needed

Proposed Multi-Orchestrator Dashboard (Sidebar + All Projects View)

All Projects 8
DESKTOP
~/Desktop/agent-orchestrator
ao
5
integrator
3
WORK
~/work/agent-orchestrator
backend
2
frontend
0
‹ Collapse
Agent Orchestrator
8 sessions · 4 working · 6 PRs · 2 need attention
orchestrator
Desktop running
5 sessions
3 working · 1 review · 1 merge
Work running
3 sessions
1 working · 1 respond · 1 review
Board
Backlog 5
Verify
Pull Requests 6
Working 4
ao-1 desktop
Add OAuth2 login flow
ao-2 desktop
Fix rate limiter bypass
bk-1 work
Optimize DB query perf
ao-3 desktop
Migrate user table schema
Respond 1
bk-2 work
Add caching layer for API
changes requested 2 comments
Review 2
ao-4 desktop
WebSocket real-time events
int-1 work
REST API pagination
Merge 1
ao-5 desktop
Update rate limit docs
Merge PR #38
▲ Multi-orchestrator view — sidebar shows 2 orchestrators, cards tagged with source, overview cards at top

Filtered View (Single Project Selected — "ao" from Desktop)

ALL
ao
int
bk
fe
›
Agent Orchestrator / ao
5 sessions · 3 working · 4 PRs · 0 need attention
Board
Backlog
Verify
Pull Requests 4
Working 3
ao-1
Add OAuth2 login flow
ao-2
Fix rate limiter bypass
ao-3
Migrate user table schema
Review 1
ao-4
WebSocket real-time events
Merge 1
ao-5
Update rate limit docs
Merge PR #38
▲ Filtered view — collapsed sidebar, breadcrumb shows "ao" project, no orchestrator tags on cards

Conflict Warning Banner

⚠
Conflict: Project "backend" is managed by 2 orchestrators
This can cause session ID conflicts, duplicate lifecycle reactions, and metadata corruption. Stop one orchestrator to resolve.
Config A: ~/Desktop/agent-orchestrator.yaml (primary, lifecycle active)
Config B: ~/work/agent-orchestrator.yaml (read-only in this dashboard)
Dismiss Learn More
▲ Red conflict banner when same project is managed by multiple orchestrators

5.1 Layout Overview

The new layout adds a collapsible sidebar on the left showing orchestrator instances and their projects. The main content area retains the existing kanban board, backlog, verify, and PRs tabs but gains project-level filtering. The sidebar only appears when multiple orchestrator instances are discovered.

Full layout with sidebar expanded: +--- Sidebar (240px) ---+--- Main Content Area --------------------------------+ | | | | All Projects 8 | Agent Orchestrator | | | 8 sessions . 3 working . 5 PRs . 2 need attention | | DESKTOP ~/desktop | ---------------------------------------------------- | | * ao 5 | Board Backlog (3) Verify Pull Requests (5) | | * integrator 3 | ---------------------------------------------------- | | | | | WORK ~/work | +-----------+ +-----------+ +----------+ +--------+ | | * backend 2 | | WORKING | | PENDING | | REVIEW | | MERGE | | | * frontend 1 | | 3 | | 2 | | 1 | | 2 | | | | | | | | | | | | | | | | [ao-1] | | [int-3] | | [bk-2] | | [ao-5] | | | | | [ao-2] | | [bk-1] | | | | [in-4] | | | | | [fe-1] | | | | | | | | | | +-----------+ +-----------+ +----------+ +--------+ | | | | +-----------------------+--------------------------------------------------------+

5.2 Sidebar Design

The sidebar is a new component that appears on the left when multiple orchestrator instances (or multiple projects within one instance) are detected. For single-config, single-project deployments, it is hidden entirely — the dashboard looks identical to today.

Sidebar visibility rules

ScenarioSidebar State
1 orchestrator, 1 projectHidden (current behavior preserved)
1 orchestrator, 2+ projectsShown with project list (no orchestrator grouping)
2+ orchestratorsShown with orchestrator groups and project lists

Sidebar states

  1. Expanded (default): ~240px wide. Shows orchestrator group headers, project names, session counts, attention dots.
  2. Collapsed: ~48px wide. Shows 2-letter project abbreviations with color-coded dots. Toggle button at bottom.
Expanded sidebar: Collapsed sidebar: +---------------------------+ +------+ | | | | | All Projects 8 | | ALL | | | |------| | DESKTOP ~/desktop | | ao | | * ao 5 | | in | | * integrator 3 | |------| | | | bk | | WORK ~/work | | fe | | * backend 2 | | | | * frontend 1 | | | | | | [<] | | [< Collapse] | +------+ +---------------------------+ Color coding: green = has active (non-terminal) sessions blue = has sessions, none need attention gray = no active sessions red dot = has sessions needing attention (respond/merge zones)

5.3 Project Filtering

Clicking a project in the sidebar filters the main kanban board, backlog, verify, and PR tabs to show only that project's sessions. The filter is reflected in both the URL (for shareability) and the header breadcrumb.

Header changes based on filter: No filter (All Projects): Agent Orchestrator 8 sessions . 3 working . 5 PRs . 2 need attention Single project selected: Agent Orchestrator / integrator 3 sessions . 2 working . 2 PRs URL patterns: / # All projects /?project=integrator # Single project (within primary orchestrator) /?orchestrator=a3b4c5d6e7f8 # All projects in one orchestrator /?orchestrator=a3b4&project=backend # Specific project in specific orchestrator

5.4 Orchestrator Instance Indicators on Session Cards

When the "All Projects" view is active and sessions come from multiple orchestrators, each session card shows a subtle orchestrator tag. This tag is hidden when filtered to a single orchestrator/project (to reduce visual noise).

Session card in "All Projects" view: +-------------------------------------------------------+ | * ao-3 | desktop [terminal] | | | | Implement user authentication flow | | | | feat/auth-flow . PR #42 CI passing review pending | +-------------------------------------------------------+ ^ ^ | | session id orchestrator tag (config dir basename) only shown in multi-orchestrator "All" view Session card when filtered to a single project: +-------------------------------------------------------+ | * ao-3 [terminal] | | | | Implement user authentication flow | | ... | +-------------------------------------------------------+ orchestrator tag hidden — no ambiguity when filtered

5.5 Global Overview Page

An optional "Overview" landing page (or a section above the kanban board) showing all orchestrator instances at a glance with summary cards. Clicking a card filters to that orchestrator.

Overview section (shown above kanban when 2+ orchestrators detected): +----------------------------------+ +----------------------------------+ | | | | | DESKTOP ~/desktop/ao.yaml | | WORK ~/work/ao.yaml | | | | | | 5 sessions 3 working | | 3 sessions 1 working | | 4 PRs 1 needs attn | | 2 PRs 0 needs attn | | | | | | Projects: ao, integrator | | Projects: backend, frontend | | Orchestrator: running | | Orchestrator: idle | | Primary: yes | | Primary: no (read-only) | | | | | +----------------------------------+ +----------------------------------+

5.6 Same-Project Conflict Warning

If discovery reveals that two different orchestrator configs both define a project with the same repo field, the dashboard displays a prominent conflict warning banner.

!! CONFLICT: Project "integrator" (org/integrator) is managed by 2 orchestrators This can cause session ID conflicts, duplicate lifecycle reactions, and metadata corruption. Stop one orchestrator to resolve. Config A: ~/desktop/agent-orchestrator.yaml (primary, lifecycle active) Config B: ~/work/agent-orchestrator.yaml (read-only in this dashboard) [Dismiss] [Learn More]

6. Implementation Plan

Phase 1: Discovery and Multi-Config Service Layer

Phase 1 — Foundation (1-2 weeks)

Build the discovery mechanism and multi-config service layer without changing the UI. All existing functionality continues to work unchanged. The new code is additive.

Key implementation: packages/core/src/discovery.ts
// packages/core/src/discovery.ts

import { readdirSync, readFileSync, existsSync } from "node:fs";
import { join } from "node:path";
import { homedir } from "node:os";

export interface DiscoveredInstance {
  /** Directory name, e.g. "a3b4c5d6e7f8-integrator" */
  dirName: string;
  /** Full path to the instance directory */
  dirPath: string;
  /** Config path from .origin file */
  configPath: string;
  /** Config hash (first 12 chars of dirName) */
  hash: string;
  /** Project ID (rest of dirName after hash-) */
  projectId: string;
}

/** Group key: config hash. Value: all project instances for that config. */
export type DiscoveredInstanceMap = Map<string, DiscoveredInstance[]>;

const HASH_PROJECT_PATTERN = /^([a-f0-9]{12})-(.+)$/;

/**
 * Scan ~/.agent-orchestrator/ for all orchestrator instance directories.
 * Returns instances grouped by config hash (one hash = one config file).
 *
 * Skips directories where:
 * - Name doesn't match {hash}-{projectId} pattern
 * - .origin file is missing (not a managed directory)
 * - Config path in .origin no longer exists (stale/deleted config)
 */
export function discoverInstances(): DiscoveredInstanceMap {
  const baseDir = join(homedir(), ".agent-orchestrator");
  if (!existsSync(baseDir)) return new Map();

  let entries: ReturnType<typeof readdirSync>;
  try {
    entries = readdirSync(baseDir, { withFileTypes: true });
  } catch {
    return new Map();
  }

  const byHash: DiscoveredInstanceMap = new Map();

  for (const entry of entries) {
    if (!entry.isDirectory()) continue;

    const match = entry.name.match(HASH_PROJECT_PATTERN);
    if (!match) continue;

    const [, hash, projectId] = match;
    const dirPath = join(baseDir, entry.name);
    const originPath = join(dirPath, ".origin");

    let configPath: string;
    try {
      if (!existsSync(originPath)) continue;
      configPath = readFileSync(originPath, "utf-8").trim();
    } catch {
      continue; // Unreadable .origin file
    }

    // Skip if config file was deleted
    if (!existsSync(configPath)) continue;

    const instance: DiscoveredInstance = {
      dirName: entry.name,
      dirPath,
      configPath,
      hash,
      projectId,
    };

    const group = byHash.get(hash) ?? [];
    group.push(instance);
    byHash.set(hash, group);
  }

  return byHash;
}
Key implementation: packages/web/src/lib/multi-services.ts (skeleton)
// packages/web/src/lib/multi-services.ts

import {
  loadConfig,
  createPluginRegistry,
  createSessionManager,
  discoverInstances,
  generateConfigHash,
  type OrchestratorConfig,
  type PluginRegistry,
  type OpenCodeSessionManager,
} from "@composio/ao-core";

// Static plugin imports (same as services.ts)
import pluginRuntimeTmux from "@composio/ao-plugin-runtime-tmux";
import pluginAgentClaudeCode from "@composio/ao-plugin-agent-claude-code";
// ... other plugins ...

export interface OrchestratorInstance {
  id: string;
  label: string;
  configPath: string;
  config: OrchestratorConfig;
  registry: PluginRegistry;
  sessionManager: OpenCodeSessionManager;
  lifecycleActive: boolean;
  projectIds: string[];
  isAlive: boolean;
}

export interface MultiServices {
  instances: OrchestratorInstance[];
  primary: OrchestratorInstance;
}

const globalForMulti = globalThis as typeof globalThis & {
  _aoMultiServices?: MultiServices;
  _aoMultiInit?: Promise<MultiServices>;
  _aoMultiLastScan?: number;
};

const SCAN_CACHE_TTL_MS = 30_000; // Re-scan filesystem at most every 30s

export async function getMultiServices(): Promise<MultiServices> {
  if (globalForMulti._aoMultiServices) {
    // Refresh satellite instances periodically
    const now = Date.now();
    if (now - (globalForMulti._aoMultiLastScan ?? 0) > SCAN_CACHE_TTL_MS) {
      globalForMulti._aoMultiLastScan = now;
      void refreshSatellites(globalForMulti._aoMultiServices);
    }
    return globalForMulti._aoMultiServices;
  }

  if (!globalForMulti._aoMultiInit) {
    globalForMulti._aoMultiInit = initMultiServices().catch((err) => {
      globalForMulti._aoMultiInit = undefined;
      throw err;
    });
  }

  return globalForMulti._aoMultiInit;
}

async function initMultiServices(): Promise<MultiServices> {
  // 1. Load primary config (same as current getServices())
  const primaryConfig = loadConfig();
  const primaryHash = generateConfigHash(primaryConfig.configPath!);
  const primaryRegistry = createPluginRegistry();
  registerPlugins(primaryRegistry);
  const primarySM = createSessionManager({
    config: primaryConfig,
    registry: primaryRegistry,
  });

  const primary: OrchestratorInstance = {
    id: primaryHash,
    label: deriveLabel(primaryConfig),
    configPath: primaryConfig.configPath!,
    config: primaryConfig,
    registry: primaryRegistry,
    sessionManager: primarySM,
    lifecycleActive: true,  // Only primary gets lifecycle
    projectIds: Object.keys(primaryConfig.projects),
    isAlive: true,
  };

  // 2. Discover satellite instances
  const discovered = discoverInstances();
  const satellites: OrchestratorInstance[] = [];

  for (const [hash, projects] of discovered) {
    if (hash === primaryHash) continue; // Skip primary

    const configPath = projects[0].configPath;
    try {
      const config = loadConfig(configPath);
      const registry = createPluginRegistry();
      registerPlugins(registry);
      const sm = createSessionManager({ config, registry });

      satellites.push({
        id: hash,
        label: deriveLabel(config),
        configPath,
        config,
        registry,
        sessionManager: sm,
        lifecycleActive: false,  // Read-only
        projectIds: Object.keys(config.projects),
        isAlive: true,
      });
    } catch {
      // Invalid config — skip this satellite
    }
  }

  const services: MultiServices = {
    instances: [primary, ...satellites],
    primary,
  };

  globalForMulti._aoMultiServices = services;
  globalForMulti._aoMultiLastScan = Date.now();
  return services;
}

function registerPlugins(registry: PluginRegistry): void {
  registry.register(pluginRuntimeTmux);
  registry.register(pluginAgentClaudeCode);
  // ... register all plugins ...
}

function deriveLabel(config: OrchestratorConfig): string {
  // Use config directory basename as label
  if (!config.configPath) return "unknown";
  const parts = config.configPath.split("/");
  // Go up one level from the filename
  return parts[parts.length - 2] ?? "orchestrator";
}

async function refreshSatellites(_services: MultiServices): Promise<void> {
  // Re-scan and add/remove satellite instances
  // Implementation deferred to Phase 1 PR
}

Phase 2: API Layer Updates

Phase 2 — API Aggregation (1 week)

Update existing API routes to support multi-orchestrator queries. Add orchestratorId to responses. Maintain backwards compatibility (existing clients that don't send orchestrator params see aggregated results).

Phase 3: UI Components

Phase 3 — Sidebar and Filtering (1-2 weeks)

Add the project sidebar, project filter state management, orchestrator badges, and overview cards.

Phase 4: Conflict Detection and Safety

Phase 4 — Safety Guardrails (0.5 weeks)

Detect same-project conflicts across orchestrators and surface warnings in both dashboard and CLI.

7. Edge Cases

Same project managed by multiple orchestrators

Risk level: Critical

What breaks: Session ID collisions, duplicate lifecycle reactions, metadata corruption, tmux name collisions.

Detection method: Compare project.repo values across all discovered configs. Two configs defining projects with the same org/repo triggers a conflict.

Mitigation strategy:

  • Display prominent red warning banner in dashboard with both config paths
  • Mark conflicting orchestrator instance with a warning icon in sidebar
  • Disable mutation actions (kill, send, restore, spawn) for the non-primary orchestrator's sessions of the conflicting project
  • ao start CLI should check for conflicts at startup and warn (but not block, since the user may intend to stop the other one)
  • Log conflict detection results for debugging
Orphaned session directories (stale configs)

Risk level: Low

Scenario: User deletes or moves a config file, but session directories remain under ~/.agent-orchestrator/. The .origin file points to a path that no longer exists.

Detection: discoverInstances() checks existsSync(configPath) and skips directories where the config is missing.

Handling options:

  • Default: Silently skip. The stale directories are invisible to the dashboard. No action needed from the user.
  • Optional: A "Cleanup" button in settings or CLI (ao cleanup --stale) that lists orphaned directories and offers to remove them (behind confirmation). Shows total disk space that would be freed.
  • Future: Show orphaned instances in the sidebar with a "stale" badge. Allow browsing their sessions read-only (useful for forensics).
Config changes while dashboard is running

Risk level: Low

Scenario: User adds a new project to their YAML, or creates a new config file, while the dashboard is running.

Current behavior: The dashboard uses a cached config singleton. Changes are not visible until dashboard restart.

Proposed behavior:

  • New orchestrator instances (new config files): The filesystem discovery scan runs every 30 seconds (configurable via SCAN_CACHE_TTL_MS). New instance directories with valid .origin files are picked up automatically. The sidebar updates without restart.
  • New projects within existing config: Requires dashboard restart. The config is parsed once at instance initialization and cached. This is acceptable because adding projects to a config is infrequent.
  • Future enhancement: File watcher (fs.watchFile) on config files to invalidate the service singleton. Would enable hot-reload of project additions.
Schema mismatches between config versions

Risk level: Medium

Scenario: A satellite config was created with an older or newer version of AO that uses a different config schema. Zod validation fails when the dashboard tries to load it.

Handling:

  • Wrap loadConfig(configPath) in try/catch for each discovered config during multi-service initialization
  • If validation fails, create a degraded OrchestratorInstance with isAlive: false and the error message stored
  • Show the instance in the sidebar with an "incompatible" badge and tooltip showing the error
  • Do not let one bad config crash the entire dashboard — graceful degradation is essential
Performance with many instances (10+ orchestrators, 50+ sessions)

Risk level: Medium

Concern: Each session manager reads session metadata from disk (one readdirSync + N readFileSync per session). With 10 orchestrators and 50+ sessions, the initial page load could be slow. SSE aggregation compounds this.

Mitigation strategy:

  • Lazy loading: Only initialize session managers for satellite instances when their sessions are first requested (sidebar click or API query with ?orchestrator=)
  • Scoped SSE: The SSE stream only polls session managers for the currently active filter. If the user is viewing "desktop/ao", only the desktop orchestrator's session manager is polled. "All" view polls all, but at a lower frequency (10s instead of 5s).
  • Discovery cache: Filesystem scan is cached with 30s TTL. The scan itself is fast (single readdirSync on ~/.agent-orchestrator/).
  • Session list pagination: For 50+ sessions in the aggregated view, add virtual scrolling or "show more" pagination to the kanban columns.
Lifecycle manager scope and isolation

Risk level: Critical design decision

Question: Should the dashboard's lifecycle manager also manage sessions from satellite orchestrators?

Answer: No. The lifecycle manager runs only for the primary orchestrator.

Rationale:

  • Duplicate reactions: If two lifecycle managers both detect a CI failure on the same session, both would send "fix CI" messages to the agent. The agent receives confusing duplicate instructions.
  • Permission isolation: Satellite configs may use different GitHub tokens, different SCM plugins, or different tracker configurations. The primary dashboard's lifecycle manager would use wrong credentials.
  • Notification routing: Each config defines its own notificationRouting. The primary's routing should not be applied to satellite sessions.
  • Backlog double-claim: The backlog poller would see satellite projects' agent:backlog issues and try to spawn sessions, but it would create them in the primary config's data directory, not the satellite's.

How it works: Satellite orchestrators should have their own ao start process that runs their lifecycle manager independently. The dashboard provides read-only visibility (and limited write actions like kill/send) into satellite sessions.

Port conflicts with multiple dashboards

Risk level: Low

Scenario: Before this feature, users ran separate dashboards per config on different ports. After this feature, one dashboard shows everything. But old dashboard processes may still be running.

Handling:

  • Document the migration: "One dashboard now shows all orchestrators. Stop extra dashboard instances."
  • The ao dashboard command already handles port conflicts (EADDRINUSE) with a clear error message.
  • The --rebuild flag already stops existing dashboards on the same port.
Tmux server differences across orchestrators

Risk level: Low

Scenario: Two orchestrators on the same machine share the same tmux server. Session names include the config hash, so they don't collide. But the dashboard's "terminal" view needs to know which tmux sessions belong to which orchestrator.

Current behavior: The terminal page (/sessions/[id]) connects to the tmux session by name. The name includes the hash, so it naturally connects to the correct session regardless of which orchestrator created it.

Conclusion: No change needed. The hash-based tmux naming already solves this.

8. Open Questions & Trade-offs

# Question Options Recommendation
1 Should the sidebar be always-visible or only appear when multiple instances exist? A) Always show for consistency
B) Auto-detect and show only when needed
C) User toggle in settings
B) Auto-detect. Single-instance, single-project deployments should look identical to today. Zero visual regression. The sidebar auto-appears when discovery finds 2+ orchestrator instances or 2+ projects within one instance.
2 How to handle mutations (kill, send, merge) on satellite orchestrator sessions? A) Allow all mutations freely
B) Fully read-only for satellites
C) Allow with visual indicator
C) Allow with visual indicator. Kill and send use tmux, which works regardless of which config created the session. Merge calls GitHub, which is also global. The actions are technically safe. Show a subtle "remote" badge on the action button so the user knows they're acting on a satellite session.
3 Should the discovery use filesystem scanning or explicit configuration? A) Filesystem-only (zero config)
B) Config-only (explicit federation list)
C) Filesystem with config overrides
C) Filesystem with config overrides. Auto-discover locally for zero-config experience. Support an optional federation key in the config for explicit additions (remote hosts, non-standard paths). This is the most flexible approach.
4 What is the unique identifier for a session across orchestrators? A) orchestratorId:sessionId
B) UUID per session
C) Hash of config+project+sessionId
A) orchestratorId:sessionId. Simplest, most debuggable, and aligns with the existing hash-based architecture. The orchestratorId is the 12-char config hash already used in tmux names and directory paths. Example: a3b4c5d6e7f8:int-3.
5 Should the multi-orchestrator feature also support the CLI? A) Dashboard only
B) Both dashboard and CLI simultaneously
C) CLI in a follow-up PR
C) CLI in a follow-up. The discovery module in packages/core is shared code. A follow-up PR can add ao list --all, ao status --all, and ao sessions --orchestrator= flags to the CLI using the same discoverInstances() function.
6 What about multi-machine orchestrators? A) Build now
B) Design the interface for it, build later
C) Ignore entirely
B) Design for it, build later. The OrchestratorInstance interface should include an optional remote?: { host: string; port: number; apiKey?: string } field. Phase 1 only implements local discovery. Network discovery (SSH tunnel, mDNS, central registry) can be added as a Phase 5 without breaking changes.
7 Should the sidebar remember the user's last selected filter? A) localStorage only
B) URL params only
C) Both
C) Both. URL params (?project=ao&orchestrator=abc123) for shareability and deep-linking. localStorage for restoring the last filter on fresh page loads with no URL params. URL params take precedence when present.
8 Should we show sessions from stale/orphaned configs? A) Always skip silently
B) Show with "stale" indicator
C) Show in a separate "Archived" section
A) Skip silently for v1. Stale directories are uncommon and showing them adds complexity. The discovery function already filters them out by checking existsSync(configPath). A future ao cleanup command can help users remove stale directories.

Summary of Effort

PhaseScopeEstimateDependencies
Phase 1Discovery module + multi-config service layer1-2 weeksNone
Phase 2API route updates (sessions, events, backlog, mutations)1 weekPhase 1
Phase 3Sidebar UI, filtering, orchestrator indicators, overview cards1-2 weeksPhase 2
Phase 4Conflict detection, warning banners, CLI warnings0.5 weeksPhase 1
Total3.5-5.5 weeks
Key design principle: The single-orchestrator experience remains the default and is visually unchanged. Multi-orchestrator features activate automatically when multiple instances are detected via filesystem scanning. Zero configuration required. The architecture supports future network discovery for multi-machine setups without breaking changes.

Agent Orchestrator — Multi-Orchestrator Dashboard Design Document — March 2026