Skip to content

Commit 099bbc5

Browse files
authored
feat: align CortexPilot with the L0 command tower contract (#66)
1 parent c1c183a commit 099bbc5

42 files changed

Lines changed: 1846 additions & 142 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
# CortexPilot
22

3-
One request. One command tower. One proof pack you can inspect before you
4-
trust the run.
3+
The command tower for AI engineering.
54

6-
CortexPilot gives Codex / Claude Code teams one governed operator path from the
7-
PM request to the Workflow Case to Proof & Replay instead of scattered agents,
8-
local scripts, and after-the-fact logs.
5+
Stop babysitting AI coding work. CortexPilot helps teams plan, delegate, track,
6+
resume, and prove long-running engineering work across Codex and Claude Code
7+
instead of juggling scattered chats, local scripts, and after-the-fact logs.
98

109
CortexPilot is a contract-first multi-agent orchestration repository.
1110

@@ -15,8 +14,8 @@ The public story is intentionally narrower than the full monorepo:
1514
- **Choose the right adoption path second**
1615
- **Open MCP / API / builder / skills surfaces only after the real job is clear**
1716

18-
Current public boundary: CortexPilot is a repo-backed operator control plane,
19-
not a hosted product, and the shipped MCP surface remains **read-only**.
17+
Current public boundary: CortexPilot is a repo-backed AI engineering command
18+
tower, not a hosted product, and the shipped MCP surface remains **read-only**.
2019

2120
Current lane order is deliberate:
2221

@@ -105,12 +104,26 @@ Most agent demos stop at "the model replied." CortexPilot is built for the next
105104
question: **can we inspect what happened, review what changed, classify the
106105
workflow case, and rerun it without guessing?**
107106

107+
The deeper product claim is straightforward:
108+
109+
- **Plan** the next move instead of improvising one more prompt.
110+
- **Delegate** scoped work without losing the case record.
111+
- **Track** live progress and queue posture from one command tower.
112+
- **Resume** long-running work when humans step away or sessions degrade.
113+
- **Prove** what happened with evidence, compare, replay, and approvals.
114+
115+
The engineering philosophy underneath that loop is equally explicit:
116+
117+
- **Prompt Engineering**: write the right worker brief, scope, constraints, and deliverables.
118+
- **Context Engineering**: keep the right material in the right head, and treat explicit handoff as a fallback rather than the default loop.
119+
- **Harness Engineering**: move work through contracts, runtime bindings, approvals, and proof surfaces so the system can keep operating safely.
120+
108121
This repository combines:
109122

110-
- **Command Tower**: one operator surface for governed AI work, live run visibility, and queue posture
123+
- **Command Tower**: one operator surface for governed AI work, live run visibility, queue posture, and L0-style oversight
111124
- **Workflow Cases**: one stable operating record that ties request, verdict, proof, and linked runs together
112125
- **Proof & Replay**: one place to inspect evidence bundles, compare reruns, and replay failures before promotion
113-
- **Operator surfaces**: a web dashboard plus a macOS desktop shell for the same control plane
126+
- **Control surfaces**: a web dashboard plus a macOS desktop shell for the same command tower
114127
- **Read-only inspection surfaces**: repo-local MCP, API, and contract read models that expose truth without turning mirrors into execution authority
115128
- **Governed boundaries**: fail-closed gates for CI, host safety, repo hygiene, and public-proof honesty
116129

apps/dashboard/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
## Positioning
44

5-
This module is the repository's **web operator surface**.
5+
This module is the repository's **web command-tower surface**.
66

77
Read it as:
88

9-
- the browser-based control surface for runs, sessions, reviews, and command
10-
visibility
9+
- the browser-based command tower for plan, delegate, track, resume, and prove
10+
loops
1111
- a way to inspect and operate CortexPilot Command Tower orchestration truth from the web
12-
- a repo-owned UI for evaluating control-plane behavior
12+
- a repo-owned UI for L0-style oversight and case-driven operator review
1313

1414
Do **not** read it as:
1515

@@ -28,9 +28,9 @@ Do **not** read it as:
2828
## Why This Module Exists
2929

3030
If `apps/orchestrator/` is the machine room, `apps/dashboard/` is the glass
31-
window operators use to see what the machine room is doing. Its job is
32-
visibility and control, not pretending the whole repository is already a
33-
finished consumer product.
31+
command tower operators use to see what the machine room is doing. Its job is
32+
visibility, delegation, and proof-first oversight, not pretending the whole
33+
repository is already a finished consumer product.
3434

3535
## Input / Output
3636

apps/dashboard/app/layout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import WebVitalsBridge from "../components/WebVitalsBridge";
44
import "./globals.css";
55

66
export const metadata = {
7-
title: "CortexPilot | AI Work Command Tower for Codex, Claude Code, and MCP",
7+
title: "CortexPilot | The command tower for AI engineering",
88
description:
9-
"Operate Codex and Claude Code workflows through one AI Work Command Tower with Workflow Cases, Model Context Protocol (MCP)-readable proof and replay, public first-run cases, and one governed operator path.",
9+
"Stop babysitting AI coding work. CortexPilot plans, delegates, tracks, resumes, and proves long-running engineering work across Codex and Claude Code with Workflow Cases, read-only MCP truth, and replayable proof.",
1010
};
1111

1212
export const dynamic = "force-dynamic";

apps/dashboard/app/pm/components/PMIntakeRightSidebar.tsx

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,29 @@ function summarizeCapabilityTriggers(report: ExecutionPlanReport): string[] {
115115
return triggers;
116116
}
117117

118+
function summarizeWorkerPromptContracts(report: ExecutionPlanReport): Array<{
119+
id: string;
120+
role: string;
121+
scope: string;
122+
verification: string;
123+
}> {
124+
const rawContracts = Array.isArray(report.worker_prompt_contracts) ? report.worker_prompt_contracts : [];
125+
return rawContracts
126+
.filter((item) => typeof item === "object" && item !== null && !Array.isArray(item))
127+
.map((item) => {
128+
const record = item as Record<string, unknown>;
129+
const verificationRaw = Array.isArray(record.verification_requirements)
130+
? record.verification_requirements.map((entry) => String(entry || "").trim()).filter(Boolean)
131+
: [];
132+
return {
133+
id: String(record.prompt_contract_id || "-").trim() || "-",
134+
role: String((record.assigned_agent as Record<string, unknown> | undefined)?.role || "-").trim() || "-",
135+
scope: String(record.scope || "-").trim() || "-",
136+
verification: verificationRaw.length > 0 ? verificationRaw.join(", ") : "-",
137+
};
138+
});
139+
}
140+
118141
export default function PMIntakeRightSidebar(props: Props) {
119142
const {
120143
pmJourneyContext,
@@ -281,6 +304,10 @@ export default function PMIntakeRightSidebar(props: Props) {
281304
const flightPlanPredictedReports = executionPlanPreview ? compactList(executionPlanPreview.predicted_reports) : "-";
282305
const flightPlanPredictedArtifacts = executionPlanPreview ? compactList(executionPlanPreview.predicted_artifacts) : "-";
283306
const flightPlanAcceptanceChecks = executionPlanPreview ? summarizeAcceptanceChecks(executionPlanPreview) : "-";
307+
const workerPromptContracts = executionPlanPreview ? summarizeWorkerPromptContracts(executionPlanPreview) : [];
308+
const wavePlan = executionPlanPreview && typeof executionPlanPreview.wave_plan === "object" && executionPlanPreview.wave_plan
309+
? (executionPlanPreview.wave_plan as Record<string, unknown>)
310+
: null;
284311

285312
return (
286313
<aside className="pm-claude-right" aria-label="Context sidebar">
@@ -573,6 +600,30 @@ export default function PMIntakeRightSidebar(props: Props) {
573600
</ul>
574601
</>
575602
) : null}
603+
{wavePlan ? (
604+
<>
605+
<strong>Wave plan snapshot</strong>
606+
<ul className="pm-question-list">
607+
<li>Wave ID: {String(wavePlan.wave_id || "-")}</li>
608+
<li>Execution mode: {String(wavePlan.execution_mode || "-")}</li>
609+
<li>Workers in this wave: {String(wavePlan.worker_count || "-")}</li>
610+
<li>Wake policy ref: {String(wavePlan.wake_policy_ref || "-")}</li>
611+
<li>Completion policy ref: {String(wavePlan.completion_policy_ref || "-")}</li>
612+
</ul>
613+
</>
614+
) : null}
615+
{workerPromptContracts.length > 0 ? (
616+
<>
617+
<strong>Worker prompt contracts</strong>
618+
<ul className="pm-question-list">
619+
{workerPromptContracts.map((item) => (
620+
<li key={item.id}>
621+
<span className="mono">{item.id}</span> · {item.role} · {item.scope} · verify via {item.verification}
622+
</li>
623+
))}
624+
</ul>
625+
</>
626+
) : null}
576627
<details>
577628
<summary className="pm-details-summary">Contract preview excerpts</summary>
578629
<div className="mono">allowed paths: {flightPlanAllowedPaths}</div>

apps/dashboard/app/policies/page.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ import { fetchPolicies } from "../../lib/api";
44
import { safeLoad } from "../../lib/serverPageData";
55

66
const SECTIONS = [
7+
{
8+
title: "Control-plane runtime policy",
9+
key: "control_plane_runtime_policy",
10+
desc: "L0 command-tower rules for session lifecycle, wake policy, completion governance, and harness evolution",
11+
},
712
{ title: "Agent registry", key: "agent_registry", desc: "Registered agent roles and permission mappings" },
813
{ title: "Command allowlist", key: "command_allowlist", desc: "System commands that operators may execute" },
914
{ title: "Forbidden actions", key: "forbidden_actions", desc: "Globally blocked high-risk actions" },

apps/dashboard/components/AppNav.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,21 @@ function buildNavSections(locale: UiLocale): NavSection[] {
2626
{ href: "/", label: uiCopy.dashboard.labels.overview, icon: "grid" },
2727
{ href: "/pm", label: uiCopy.dashboard.labels.pmIntake, icon: "message" },
2828
{ href: "/command-tower", label: uiCopy.dashboard.labels.commandTower, icon: "tower" },
29+
{ href: "/workflows", label: uiCopy.dashboard.labels.workflowCases, icon: "workflow" },
2930
{ href: "/runs", label: uiCopy.dashboard.labels.runs, icon: "play" },
3031
{ href: "/god-mode", label: uiCopy.dashboard.labels.quickApproval, icon: "zap" },
32+
{ href: "/agents", label: uiCopy.dashboard.labels.agents, icon: "bot" },
33+
{ href: "/contracts", label: uiCopy.dashboard.labels.contracts, icon: "file" },
3134
],
3235
},
3336
{
3437
title: uiCopy.dashboard.sectionAdvanced,
3538
items: [
3639
{ href: "/search", label: uiCopy.dashboard.labels.search, icon: "search" },
37-
{ href: "/agents", label: uiCopy.dashboard.labels.agents, icon: "bot" },
38-
{ href: "/workflows", label: uiCopy.dashboard.labels.workflowCases, icon: "workflow" },
3940
{ href: "/events", label: uiCopy.dashboard.labels.events, icon: "activity" },
4041
{ href: "/reviews", label: uiCopy.dashboard.labels.reviews, icon: "check" },
4142
{ href: "/diff-gate", label: uiCopy.dashboard.labels.diffGate, icon: "shield" },
4243
{ href: "/tests", label: uiCopy.dashboard.labels.tests, icon: "test" },
43-
{ href: "/contracts", label: uiCopy.dashboard.labels.contracts, icon: "file" },
4444
{ href: "/policies", label: uiCopy.dashboard.labels.policies, icon: "lock" },
4545
{ href: "/locks", label: uiCopy.dashboard.labels.locks, icon: "key" },
4646
{ href: "/worktrees", label: uiCopy.dashboard.labels.worktrees, icon: "tree" },

apps/dashboard/components/DashboardHomeStorySections.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,25 @@ export default function DashboardHomeStorySections({
9999
</div>
100100
</section>
101101

102+
<section className="app-section" aria-labelledby="dashboard-public-advantages-title">
103+
<div className="section-header">
104+
<div>
105+
<h2 id="dashboard-public-advantages-title" className="section-title">
106+
{homePhase2Copy.publicAdvantagesTitle}
107+
</h2>
108+
<p>{homePhase2Copy.publicAdvantagesDescription}</p>
109+
</div>
110+
</div>
111+
<div className="quick-grid">
112+
{homePhase2Copy.publicAdvantageCards.map((item) => (
113+
<Link key={item.title} href={resolveHomeHref(item.href)} className="quick-card">
114+
<span className="quick-card-title">{item.title}</span>
115+
<span className="quick-card-desc">{item.desc}</span>
116+
</Link>
117+
))}
118+
</div>
119+
</section>
120+
102121
<section className="app-section" aria-labelledby="dashboard-public-templates-title">
103122
<div className="section-header">
104123
<div>

apps/dashboard/tests/command_tower_ui.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ describe("command tower ui surfaces", () => {
226226

227227
expect(screen.getByRole("navigation", { name: "控制台导航" })).toBeInTheDocument();
228228
expect(screen.getByRole("link", { name: "指挥塔" })).toBeInTheDocument();
229-
expect(screen.getByText(/\s*11/)).toBeInTheDocument();
229+
expect(screen.getByText(/\s*8/)).toBeInTheDocument();
230230
});
231231

232232
it("keeps command tower page copy aligned across locales", () => {

apps/dashboard/tests/home_page.test.tsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,14 @@ describe("dashboard home run-summary clarity", () => {
5858
it("renders first-run CTA and onboarding guidance when no runs", async () => {
5959
render(await Home());
6060

61-
expect(screen.getByRole("heading", { name: "Command Tower for Codex and Claude Code workflows" })).toBeInTheDocument();
61+
expect(screen.getByRole("heading", { name: "The command tower for AI engineering" })).toBeInTheDocument();
6262
expect(
63-
screen.getByText(/See one proven workflow first, then choose the right adoption path\./)
63+
screen.getByText(/Stop babysitting AI coding work\./)
6464
).toBeInTheDocument();
65+
expect(screen.getByText("Three engineering layers behind the command tower")).toBeInTheDocument();
66+
expect(screen.getByText("Prompt Engineering")).toBeInTheDocument();
67+
expect(screen.getByText("Context Engineering")).toBeInTheDocument();
68+
expect(screen.getByText("Harness Engineering")).toBeInTheDocument();
6569
expect(screen.getByRole("link", { name: "Start first task" })).toHaveAttribute("href", "/pm");
6670
expect(screen.getAllByRole("link", { name: /Workflow Cases/ })[0]).toHaveAttribute("href", "/workflows");
6771

@@ -222,7 +226,7 @@ describe("dashboard home run-summary clarity", () => {
222226

223227
render(await Home());
224228

225-
expect(screen.getByRole("heading", { name: "面向 Codex 和 Claude Code 工作流的指挥塔" })).toBeInTheDocument();
229+
expect(screen.getByRole("heading", { name: "AI 工程的指挥塔" })).toBeInTheDocument();
226230
expect(screen.getByRole("link", { name: "启动首个任务" })).toHaveAttribute("href", "/pm");
227231
expect(screen.getByText("选择正确的采用路径")).toBeInTheDocument();
228232
expect(screen.getByRole("link", { name: "打开 AI + MCP + API 页面" })).toHaveAttribute(
@@ -412,8 +416,8 @@ describe("dashboard home run-summary clarity", () => {
412416
});
413417

414418
it("renders the public shell with English-first layout metadata and chrome copy", () => {
415-
expect(metadata.title).toBe("CortexPilot | AI Work Command Tower for Codex, Claude Code, and MCP");
416-
expect(metadata.description).toContain("Model Context Protocol (MCP)-readable proof and replay");
419+
expect(metadata.title).toBe("CortexPilot | The command tower for AI engineering");
420+
expect(metadata.description).toContain("Stop babysitting AI coding work.");
417421

418422
render(
419423
<DashboardShellChrome>
@@ -423,8 +427,8 @@ describe("dashboard home run-summary clarity", () => {
423427

424428
expect(screen.getByRole("link", { name: "Skip to dashboard content" })).toHaveAttribute("href", "#dashboard-content");
425429
expect(screen.getAllByLabelText("Dashboard navigation").length).toBeGreaterThan(0);
426-
expect(screen.getByText("Command Tower · Workflow Cases · Proof & Replay")).toBeInTheDocument();
427-
expect(screen.getByText("Operator control plane")).toBeInTheDocument();
430+
expect(screen.getByText("Plan · Delegate · Track · Resume · Prove")).toBeInTheDocument();
431+
expect(screen.getByText("AI engineering command tower")).toBeInTheDocument();
428432
expect(screen.getByLabelText("Platform status overview")).toBeInTheDocument();
429433
expect(screen.getByText("Governance view")).toBeInTheDocument();
430434
expect(screen.getByText("Live verification required")).toBeInTheDocument();

apps/dashboard/tests/pm_intake_components_branches.test.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,21 @@ describe("pm intake right sidebar component branches", () => {
337337
predicted_reports: ["task_result.json", "review_report.json"],
338338
predicted_artifacts: ["queue.jsonl", "patch.diff"],
339339
requires_human_approval: true,
340+
wave_plan: {
341+
wave_id: "bundle-preview-1",
342+
execution_mode: "long_running",
343+
worker_count: 1,
344+
wake_policy_ref: "policies/control_plane_runtime_policy.json#/wake_policy",
345+
completion_policy_ref: "policies/control_plane_runtime_policy.json#/wave_completion_policy",
346+
},
347+
worker_prompt_contracts: [
348+
{
349+
prompt_contract_id: "worker-prompt-1",
350+
assigned_agent: { role: "WORKER", agent_id: "agent-1" },
351+
scope: "Queue the latest workflow case run",
352+
verification_requirements: ["repo_hygiene"],
353+
},
354+
],
340355
contract_preview: {
341356
assigned_agent: { role: "WORKER", agent_id: "agent-1" },
342357
owner_agent: { role: "TECH_LEAD", agent_id: "agent-2" },
@@ -355,6 +370,10 @@ describe("pm intake right sidebar component branches", () => {
355370
expect(screen.getByText(/Capability triggers: Search \(1 query\), Manual approval/)).toBeInTheDocument();
356371
expect(screen.getByText("Operator notes")).toBeInTheDocument();
357372
expect(screen.getByText("Risk gates")).toBeInTheDocument();
373+
expect(screen.getByText("Wave plan snapshot")).toBeInTheDocument();
374+
expect(screen.getByText(/Wave ID: bundle-preview-1/)).toBeInTheDocument();
375+
expect(screen.getByText("Worker prompt contracts")).toBeInTheDocument();
376+
expect(screen.getByText(/worker-prompt-1/)).toBeInTheDocument();
358377
expect(screen.getByText("Contract preview excerpts")).toBeInTheDocument();
359378
expect(screen.getByText("Advanced planning payloads")).toBeInTheDocument();
360379
});

0 commit comments

Comments
 (0)