From fbfc9c38cbe83583ac010b1baa520cca1a83c4a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Sun, 22 Mar 2026 03:46:18 -0400 Subject: [PATCH] feat(02-01): inject connector capabilities into CEO prompt - Add allConnectors optional field to PromptContext interface - Import getConnectorStrengths from connector-matching module - Add 'Available Connectors for Hiring' section with per-connector status and strengths - Add 'Connector Assignment Guide' mapping role types to preferred connectors - Replace generic 'Choose the best runtime' text with connector-aware guidance - Pass allConnectors from snapshot in orchestration-service.ts - No type errors, all existing tests pass --- src/main/orchestration-service.ts | 1 + src/main/prompt-builder.ts | 27 +++++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/main/orchestration-service.ts b/src/main/orchestration-service.ts index add31d79..30b869d3 100644 --- a/src/main/orchestration-service.ts +++ b/src/main/orchestration-service.ts @@ -257,6 +257,7 @@ export function createOrchestrationService({ recentDocuments: snapshot.documents .filter((document) => document.companyId === companyId && (document.authorAgentId === agent.id || document.reviewerAgentId === agent.id || document.status === "in_review")) .slice(0, 5), + allConnectors: snapshot.connectors.map((c) => ({ id: c.id, label: c.label, status: c.status })), }) : null; if (apiUrl) { diff --git a/src/main/prompt-builder.ts b/src/main/prompt-builder.ts index 78ee2da6..9195b728 100644 --- a/src/main/prompt-builder.ts +++ b/src/main/prompt-builder.ts @@ -1,7 +1,8 @@ -import type { AgentRecord, AgentMessageRecord, ApprovalRecord, DocumentRecord, GoalRecord, KnowledgeEntryRecord, MeetingRecord, ProjectRecord, SprintRecord, TaskRecord } from "@shared/types"; +import type { AgentRecord, AgentMessageRecord, ApprovalRecord, ConnectorId, DocumentRecord, GoalRecord, KnowledgeEntryRecord, MeetingRecord, ProjectRecord, SprintRecord, TaskRecord } from "@shared/types"; import type { AppLocale } from "@shared/locale"; import { DEPARTMENT_LABELS } from "@shared/constants"; import { getLocalePromptInstruction } from "@shared/localization"; +import { getConnectorStrengths } from "./connector-matching"; interface PromptContext { agent: AgentRecord; @@ -29,6 +30,7 @@ interface PromptContext { relevantKnowledge?: KnowledgeEntryRecord[]; activeSprint?: SprintRecord | null; recentDocuments?: DocumentRecord[]; + allConnectors?: Array<{ id: string; label: string; status: string }>; } export function buildSystemPrompt(ctx: PromptContext): string { @@ -877,7 +879,7 @@ For EACH role, use POST /api/companies/{companyId}/agents with: - Specific role and title - Detailed capabilities describing what they should own - reportsTo: YOUR agent ID (they report to you) -- connectorId: Choose the best runtime for their role +- connectorId: Use the connector recommended in the "Available Connectors" section above. If no section is shown, use claude_local. - budgetMonthlyUsd: Appropriate budget (recommend $50-250/agent) - model: Best model for the role's complexity @@ -889,6 +891,27 @@ After submitting ALL hire requests, create an approve_ceo_strategy approval that IMPORTANT: Wait for the Board to approve before starting business operations. `); + + // Inject connector capability data so the CEO can make informed hiring decisions + if (ctx.allConnectors && ctx.allConnectors.length > 0) { + const connectorLines = ctx.allConnectors.map((c) => { + const strengths = getConnectorStrengths(c.id as ConnectorId); + return `- **${c.label}** (\`${c.id}\`): ${strengths} [STATUS: ${c.status}]`; + }); + + sections.push(`# Available Connectors for Hiring +When hiring agents, assign the best connector for their role: +${connectorLines.join("\n")} + +Connector Assignment Guide: +- Engineering/code roles: prefer claude_local or codex_local +- Research/analysis roles: prefer gemini_local (falls back to claude_local) +- Content/writing roles: prefer claude_local +- Management/coordination: prefer claude_local +- If preferred connector is not listed as "ready", use the next best available +- NEVER assign a connector with status "not_installed" or "error" +`); + } } else if (hasPendingOrgApproval) { sections.push(`# Operating Instructions (CEO — Awaiting Org Approval)