feat: Implement Architect role & design_task tool (#189)
Adds the Architect role for design/architecture investigations with persistent sessions and structured design proposals. ## New Features - **Architect role** with opus (complex) and sonnet (standard) levels - **design_task tool** — Creates To Design issues and dispatches architect - **Workflow states:** To Design → Designing → Planning - **Completion rules:** architect:done → Planning, architect:blocked → Refining - **Auto-level selection** based on complexity keywords ## Files Changed (22 files, 546 additions) ### New Files - lib/tools/design-task.ts — design_task tool implementation - lib/tools/design-task.test.ts — 16 tests for architect functionality ### Core Changes - lib/tiers.ts — ARCHITECT_LEVELS, WorkerRole type, models, emoji - lib/workflow.ts — toDesign/designing states, completion rules - lib/projects.ts — architect WorkerState on Project type - lib/dispatch.ts — architect role support in dispatch pipeline - lib/services/pipeline.ts — architect completion rules - lib/model-selector.ts — architect level selection heuristic ### Integration - index.ts — Register design_task tool, architect config schema - lib/notify.ts — architect role in notifications - lib/bootstrap-hook.ts — architect session key parsing - lib/services/tick.ts — architect in queue processing - lib/services/heartbeat.ts — architect in health checks - lib/tools/health.ts — architect in health scans - lib/tools/status.ts — architect in status dashboard - lib/tools/work-start.ts — architect role option - lib/tools/work-finish.ts — architect validation - lib/tools/project-register.ts — architect labels + role scaffolding - lib/templates.ts — architect instructions + AGENTS.md updates - lib/setup/workspace.ts — architect role file scaffolding - lib/setup/smart-model-selector.ts — architect in model assignment - lib/setup/llm-model-selector.ts — architect in LLM prompt
This commit is contained in:
@@ -306,7 +306,7 @@ async function performHealthPass(
|
||||
const { provider } = await createProvider({ repo: project.repo });
|
||||
let fixedCount = 0;
|
||||
|
||||
for (const role of ["dev", "qa"] as const) {
|
||||
for (const role of ["dev", "qa", "architect"] as const) {
|
||||
// Check worker health (session liveness, label consistency, etc)
|
||||
const healthFixes = await checkWorkerHealth({
|
||||
workspaceDir,
|
||||
|
||||
@@ -26,24 +26,28 @@ import {
|
||||
* Kept for backward compatibility.
|
||||
*/
|
||||
export const COMPLETION_RULES: Record<string, CompletionRule> = {
|
||||
"dev:done": { from: "Doing", to: "To Test", gitPull: true, detectPr: true },
|
||||
"qa:pass": { from: "Testing", to: "Done", closeIssue: true },
|
||||
"qa:fail": { from: "Testing", to: "To Improve", reopenIssue: true },
|
||||
"qa:refine": { from: "Testing", to: "Refining" },
|
||||
"dev:blocked": { from: "Doing", to: "Refining" },
|
||||
"qa:blocked": { from: "Testing", to: "Refining" },
|
||||
"dev:done": { from: "Doing", to: "To Test", gitPull: true, detectPr: true },
|
||||
"qa:pass": { from: "Testing", to: "Done", closeIssue: true },
|
||||
"qa:fail": { from: "Testing", to: "To Improve", reopenIssue: true },
|
||||
"qa:refine": { from: "Testing", to: "Refining" },
|
||||
"dev:blocked": { from: "Doing", to: "Refining" },
|
||||
"qa:blocked": { from: "Testing", to: "Refining" },
|
||||
"architect:done": { from: "Designing", to: "Planning" },
|
||||
"architect:blocked": { from: "Designing", to: "Refining" },
|
||||
};
|
||||
|
||||
/**
|
||||
* @deprecated Use getNextStateDescription() from workflow.ts instead.
|
||||
*/
|
||||
export const NEXT_STATE: Record<string, string> = {
|
||||
"dev:done": "QA queue",
|
||||
"dev:blocked": "moved to Refining - needs human input",
|
||||
"qa:pass": "Done!",
|
||||
"qa:fail": "back to DEV",
|
||||
"qa:refine": "awaiting human decision",
|
||||
"qa:blocked": "moved to Refining - needs human input",
|
||||
"dev:done": "QA queue",
|
||||
"dev:blocked": "moved to Refining - needs human input",
|
||||
"qa:pass": "Done!",
|
||||
"qa:fail": "back to DEV",
|
||||
"qa:refine": "awaiting human decision",
|
||||
"qa:blocked": "moved to Refining - needs human input",
|
||||
"architect:done": "Planning — ready for review",
|
||||
"architect:blocked": "moved to Refining - needs clarification",
|
||||
};
|
||||
|
||||
// Re-export CompletionRule type for backward compatibility
|
||||
@@ -77,7 +81,7 @@ export function getRule(
|
||||
export async function executeCompletion(opts: {
|
||||
workspaceDir: string;
|
||||
groupId: string;
|
||||
role: "dev" | "qa";
|
||||
role: "dev" | "qa" | "architect";
|
||||
result: string;
|
||||
issueId: number;
|
||||
summary?: string;
|
||||
|
||||
@@ -11,7 +11,7 @@ import { createProvider } from "../providers/index.js";
|
||||
import { selectLevel } from "../model-selector.js";
|
||||
import { getWorker, getSessionForLevel, readProjects } from "../projects.js";
|
||||
import { dispatchTask } from "../dispatch.js";
|
||||
import { DEV_LEVELS, QA_LEVELS, isDevLevel } from "../tiers.js";
|
||||
import { DEV_LEVELS, QA_LEVELS, ARCHITECT_LEVELS, isDevLevel, levelRole } from "../tiers.js";
|
||||
import {
|
||||
DEFAULT_WORKFLOW,
|
||||
getQueueLabels,
|
||||
@@ -56,10 +56,11 @@ export function detectLevelFromLabels(labels: string[]): string | null {
|
||||
const level = l.slice(dot + 1);
|
||||
if (role === "dev" && (DEV_LEVELS as readonly string[]).includes(level)) return level;
|
||||
if (role === "qa" && (QA_LEVELS as readonly string[]).includes(level)) return level;
|
||||
if (role === "architect" && (ARCHITECT_LEVELS as readonly string[]).includes(level)) return level;
|
||||
}
|
||||
|
||||
// Fallback: plain level name
|
||||
const all = [...DEV_LEVELS, ...QA_LEVELS] as readonly string[];
|
||||
const all = [...DEV_LEVELS, ...QA_LEVELS, ...ARCHITECT_LEVELS] as readonly string[];
|
||||
return all.find((l) => lower.includes(l)) ?? null;
|
||||
}
|
||||
|
||||
@@ -164,7 +165,7 @@ export async function projectTick(opts: {
|
||||
|
||||
const provider = opts.provider ?? (await createProvider({ repo: project.repo })).provider;
|
||||
const roleExecution = project.roleExecution ?? "parallel";
|
||||
const roles: Role[] = targetRole ? [targetRole] : ["dev", "qa"];
|
||||
const roles: Role[] = targetRole ? [targetRole] : ["dev", "qa", "architect"];
|
||||
|
||||
const pickups: TickAction[] = [];
|
||||
const skipped: TickResult["skipped"] = [];
|
||||
@@ -185,7 +186,9 @@ export async function projectTick(opts: {
|
||||
skipped.push({ role, reason: `Already active (#${worker.issueId})` });
|
||||
continue;
|
||||
}
|
||||
if (roleExecution === "sequential" && getWorker(fresh, role === "dev" ? "qa" : "dev").active) {
|
||||
// Check sequential role execution: any other role must be inactive
|
||||
const otherRoles = (["dev", "qa", "architect"] as const).filter(r => r !== role);
|
||||
if (roleExecution === "sequential" && otherRoles.some(r => getWorker(fresh, r).active)) {
|
||||
skipped.push({ role, reason: "Sequential: other role active" });
|
||||
continue;
|
||||
}
|
||||
@@ -244,10 +247,9 @@ export async function projectTick(opts: {
|
||||
function resolveLevelForIssue(issue: Issue, role: Role): string {
|
||||
const labelLevel = detectLevelFromLabels(issue.labels);
|
||||
if (labelLevel) {
|
||||
// QA role but label specifies a dev level → heuristic picks the right QA level
|
||||
if (role === "qa" && isDevLevel(labelLevel)) return selectLevel(issue.title, issue.description ?? "", role).level;
|
||||
// DEV role but label specifies a QA level → heuristic picks the right dev level
|
||||
if (role === "dev" && !isDevLevel(labelLevel)) return selectLevel(issue.title, issue.description ?? "", role).level;
|
||||
const labelRole = levelRole(labelLevel);
|
||||
// If label level belongs to a different role, use heuristic for correct role
|
||||
if (labelRole && labelRole !== role) return selectLevel(issue.title, issue.description ?? "", role).level;
|
||||
return labelLevel;
|
||||
}
|
||||
return selectLevel(issue.title, issue.description ?? "", role).level;
|
||||
|
||||
Reference in New Issue
Block a user