completed

Mission Run

Codex Mission Control: Production-ready mission orchestration dashboard (Next.js + local persistence + OpenAI planning/execution)

Build Codex Mission Control as a production-ready mission orchestration dashboard that accepts a software goal, generates a live execution plan, runs specialist tasks, and returns artifacts, logs, risks, and next steps.

Created: 14 Jun 2026, 7:20 am

Updated: 14 Jun 2026, 7:29 am

Repository Context

Greenfield Next.js application in a hackathon repo. We need a compelling UI, local persistence, route handlers, and OpenAI-backed planning and execution.

Constraints

Avoid mock demos. Make the MVP real end to end, keep the architecture extensible, and optimize for a strong judge-facing demo.

Execution Stepper

The mission run has finished. Completed steps remain as a visible execution trace.

Define MVP scope, user stories, and demo acceptance criteria

Completed

Set up project foundations (Next.js App Router, tooling, environment)

Completed

Design domain model and local persistence schema

Completed

Implement OpenAI client wrapper and prompt contracts

Completed

Build core route handlers for mission lifecycle

Completed

Implement mission planner: goal -> live execution plan

Completed

Implement task execution engine (specialists, queueing, state machine)

Completed

Artifacts pipeline (files, previews, downloads) and structured reporting

Completed

AI Software Execution Operating System

Primary users

Founders, product leads, architects, delivery teams, and AI-native engineering teams that need a system of record between idea and execution.

Problem solved

It transforms mission intelligence into PRDs, technical designs, engineering plans, AI execution packs, architecture maps, risk models, and traceable workflows.

Product Flow Diagram

Idea to execution intelligence

User

Submits a software idea and constraints

Mission Plan

Tasks, dependencies, owners, risks

Document Studio

PRD, TDD, engineering plan, AI pack

Mission Memory

Reusable organizational knowledge

Architecture Diagram

System components for this idea

Users

Founders + product teams

Edge

Route 53 / CDN / WAF boundary

Application VPC

Web App

Next.js App Router

API Server

TypeScript

Worker

Mission/document generation jobs

Cache

Saved docs + fast reloads

Data Plane

Primary DB

Local JSON for prototype, SQLite/PostgreSQL for production knowledge storage.

Object Storage

Generated docs, exports, artifacts

missionstasksartifactsdecisionsrisks

AI + Operations

OpenAI API

PRD, TDD, plan, AI pack

Observability

Logs, risks, decision trail

IAM / Secrets

Server-side keys + access control

Alerts

Execution and risk signals

Cloud Diagram

Deployment-ready shape

ChannelExperienceMiddlewareResources

Browser

User session

Mission UI

Dashboard + document studio

API Routes

Validate + orchestrate

Storage

Missions + cached docs

AI Client

Codex / external tools

AI Pack

Portable execution context

Doc Engine

Timeout + local fallback

OpenAI

Optional enrichment

Security posture

Keep API keys server-side, validate payloads, and preserve audit logs.

3 risk signals

Risks become visible before execution moves to tools.

Mission Document Studio

Export mission intelligence

Turn the mission into production-ready documents for executives, engineers, delivery teams, and external AI execution tools.

Choose a document type to generate an export-ready artifact.

Traceability Map

Why every task exists

This replaces vague “AI said so” planning. Each path shows which goal, requirement, task, architecture choice, or risk explains the work.

goal

Build Codex Mission Control as a production-ready mission orchestration dashboard that accepts a software goal, generates a live execution plan, runs specialist tasks, and returns artifacts, logs, risks, and next steps.

requirement

Define MVP scope, user stories, and demo acceptance criteria

task

Define MVP scope, user stories, and demo acceptance criteria

requirement

Set up project foundations (Next.js App Router, tooling, environment)

task

Set up project foundations (Next.js App Router, tooling, environment)

requirement

Design domain model and local persistence schema

task

Design domain model and local persistence schema

requirement

Implement OpenAI client wrapper and prompt contracts

task

Implement OpenAI client wrapper and prompt contracts

requirement

Build core route handlers for mission lifecycle

task

Build core route handlers for mission lifecycle

requirement

Implement mission planner: goal -> live execution plan

task

Implement mission planner: goal -> live execution plan

requirement

Implement task execution engine (specialists, queueing, state machine)

Trace paths

Kept because traceability is the product moat; renamed from relationships for clarity.

Build Codex Mission Control as a production-ready mission orchestration dashboard that accepts a software goal, generates a live execution plan, runs specialist tasks, and returns artifacts, logs, risks, and next steps.drivesDefine MVP scope, user stories, and demo acceptance criteria
Define MVP scope, user stories, and demo acceptance criteriasatisfied byDefine MVP scope, user stories, and demo acceptance criteria
Build Codex Mission Control as a production-ready mission orchestration dashboard that accepts a software goal, generates a live execution plan, runs specialist tasks, and returns artifacts, logs, risks, and next steps.drivesSet up project foundations (Next.js App Router, tooling, environment)
Set up project foundations (Next.js App Router, tooling, environment)satisfied bySet up project foundations (Next.js App Router, tooling, environment)
Define MVP scope, user stories, and demo acceptance criteriaunblocksSet up project foundations (Next.js App Router, tooling, environment)
Build Codex Mission Control as a production-ready mission orchestration dashboard that accepts a software goal, generates a live execution plan, runs specialist tasks, and returns artifacts, logs, risks, and next steps.drivesDesign domain model and local persistence schema
Design domain model and local persistence schemasatisfied byDesign domain model and local persistence schema
Define MVP scope, user stories, and demo acceptance criteriaunblocksDesign domain model and local persistence schema
Set up project foundations (Next.js App Router, tooling, environment)unblocksDesign domain model and local persistence schema
Build Codex Mission Control as a production-ready mission orchestration dashboard that accepts a software goal, generates a live execution plan, runs specialist tasks, and returns artifacts, logs, risks, and next steps.drivesImplement OpenAI client wrapper and prompt contracts

Mission Decision Log

Explain the important choices

Use Mission Control as the documentation system of record

The mission needs traceable planning artifacts before execution moves into external tools.

Tradeoffs

Improves clarity and handoff quality, but requires users to maintain mission context.

Alternatives

Unstructured chat logs, standalone docs, tickets, or ad hoc planning notes.

Mission Memory

Reuse organizational knowledge

Compare MissionsPlanned capability, not shown as an executable action yet. Current executable memory action is duplicate.

Mission Steps

Task Timeline

8 tasks

Task 1

Define MVP scope, user stories, and demo acceptance criteria

completed

Lock the end-to-end happy path and non-negotiables: user inputs a software goal, system generates a structured plan, executes specialist tasks, and returns artifacts/logs/risks/next steps. Define judge-facing demo script, success metrics (latency, reliability), and what is explicitly out of scope (auth, multi-tenant, cloud DB). Produce a one-page spec and acceptance checklist to guide implementation.

Owner: plannerDependencies: 0
MVP scope + demo acceptance criteria defined; happy-path flow and out-of-scope documented.

Task 2

Set up project foundations (Next.js App Router, tooling, environment)

completed

Initialize/confirm Next.js App Router structure, TypeScript, ESLint/Prettier, Tailwind/shadcn UI (or equivalent), and env management for OpenAI. Add a consistent logging utility and basic error boundary pages. Establish a clean folder structure for server actions/route handlers, domain models, and UI components.

Owner: builderDependencies: 1
Project foundations chosen (Next.js/Tailwind/shadcn/Zod/Prisma SQLite/SSE); folder structure + env vars specified.

Task 3

Design domain model and local persistence schema

completed

Define TypeScript types and persistence schema for: Mission, Plan, TaskRun, Artifact, LogEvent, Risk, and NextStep. Choose local persistence mechanism suitable for hackathon but real (SQLite via Prisma/Drizzle, or filesystem-backed JSON with atomic writes). Implement migrations/initialization and CRUD utilities. Ensure records capture timestamps, status transitions, and trace IDs for reproducibility.

Owner: builderDependencies: 2
Prisma SQLite schema created (Mission/Plan/Task/TaskRun/Artifact/LogEvent/Risk/NextStep); Zod contracts added.

Task 4

Implement OpenAI client wrapper and prompt contracts

completed

Create a server-only OpenAI wrapper with retries, timeouts, structured outputs (JSON schema / Zod), token budgeting, and redaction of secrets in logs. Define prompt contracts for: (1) planner that outputs a mission execution plan with specialist roles, (2) executor that performs a task and returns artifacts/logs/risks/next steps. Add deterministic mode knobs (temperature, seed if available) for demo stability.

Owner: builderDependencies: 2
Server-only OpenAI client wrapper implemented (timeouts, retries, json_object, Zod parse) plus planner/executor prompt contracts.

Task 5

Build core route handlers for mission lifecycle

completed

Create route handlers/server actions for: create mission, generate plan, start execution, stream execution events, fetch mission state, fetch artifacts, and retry a failed task. Ensure handlers persist state changes and emit log events. Enforce input validation with Zod and robust error handling with user-friendly messages.

Owner: builderDependencies: 2
Mission lifecycle API surface designed (create/plan/execute/cancel/events/artifacts/retry) and repo hydration helper defined.

Task 6

Implement mission planner: goal -> live execution plan

completed

Wire the planner prompt to generate a structured plan (phases, tasks, dependencies, expected artifacts, risk checks). Store the plan in persistence and render incremental updates (optimistically show skeleton then hydrate). Add a validation layer to reject malformed plans and auto-repair by re-prompting with error feedback.

Owner: builderDependencies: 2
Planner validation rules and auto-repair strategy defined (unique keys, deps exist, DAG/no cycles, capped retries).

Task 7

Implement task execution engine (specialists, queueing, state machine)

completed

Create a minimal orchestration engine: task state machine (queued/running/succeeded/failed/canceled), dependency resolution, concurrency limits, and backoff retry. Each task run calls the executor prompt with context (goal, plan, prior artifacts). Persist streaming log events and artifacts as they arrive. Provide cancellation and rerun semantics for judge-facing control.

Owner: builderDependencies: 2
Orchestrator design completed (state machine, dependency scheduler, concurrency cap, retries/backoff, SSE log persistence, cancellation semantics).

Task 8

Artifacts pipeline (files, previews, downloads) and structured reporting

completed

Standardize artifact types (markdown report, code diff/patch, JSON output, links) and storage (DB rows + filesystem blobs if needed). Implement rendering components: markdown viewer, JSON viewer, diff viewer, and download endpoints. Ensure the final mission summary aggregates artifacts, logs, risks, and next steps into a single shareable report view.

Owner: builderDependencies: 2
Artifact pipeline + mission report UX specified (artifact types/viewers, storage strategy, report aggregation).

Audit Trail

Execution Log

8 logs

Mission plan generated successfully.

success

14 Jun 2026, 7:21 am

Locked MVP happy path: goal -> plan -> execute tasks -> artifacts/logs/risks/next steps -> report.

info

14 Jun 2026, 7:29 am

Selected stack: Next.js App Router + Tailwind/shadcn + Zod + Prisma SQLite + SSE.

info

14 Jun 2026, 7:29 am

Defined persistence schema and Zod contracts for plan and executor outputs.

info

14 Jun 2026, 7:29 am

Implemented OpenAI wrapper with retries/timeouts and strict JSON parsing; added redaction.

info

14 Jun 2026, 7:29 am

Specified mission lifecycle API including SSE events, retry/cancel controls, and artifact fetch/download.

info

14 Jun 2026, 7:29 am

Designed planner validation + auto-repair loop and orchestrator state machine with dependency resolution + concurrency.

info

14 Jun 2026, 7:29 am

Key integration work remaining: wire specs into actual Next.js handlers/pages and prove full end-to-end run.

warning

14 Jun 2026, 7:29 am

Mission Outputs

Artifacts

5 artifacts

Mission Plan

plan

We will deliver a real, end-to-end MVP of Codex Mission Control that plans and executes missions with OpenAI and persists all outputs locally for a reliable judge demo. First, we lock the MVP acceptance criteria and demo script so every engineering decision supports a crisp narrative: goal in, live plan out, specialists execute, artifacts/logs/risks/next steps returned. Next, we lay foundations in a greenfield Next.js App Router codebase with consistent structure and environment handling. We then define the domain model (Mission/Plan/TaskRun/Artifact/LogEvent/Risk/NextStep) and implement local persistence (preferably SQLite via an ORM) to ensure the demo survives refreshes and feels production-oriented. With persistence in place, we build an OpenAI server-only wrapper and strict prompt contracts using structured outputs and validation. This enables a reliable planner that converts the user’s goal into an execution plan, and an executor that performs each specialist task and emits artifacts and logs. We then implement the mission lifecycle API: create mission, generate plan, run tasks, stream events, retry failures, and fetch state. On top of that, we build a simple but real orchestration engine with a state machine, dependency resolution, concurrency limits, and retry semantics. The engine persists incremental log events and artifacts so the UI can show live progress. The UI is designed to be judge-facing and practical: a Mission Builder to start runs, a Plan View to inspect dependencies, and a Live Run View with task statuses, streaming logs, and an artifacts panel with previews and downloads. We prioritize clarity and control (run/cancel/retry/export) to demonstrate real orchestration rather than a static mock. Finally, we harden for demo reliability: observability, guardrails, graceful error handling, and curated mission templates that still execute real calls. We close with tests, performance polish (especially for logs), and a shareable final mission report that aggregates artifacts, risks, and next steps into a compelling output suitable for judges.

MVP spec and acceptance criteria

analysis

Defines judge-facing MVP: goal->plan->execute->stream logs->persist artifacts/risks/next steps->report. Includes non-negotiables (SQLite persistence, structured OpenAI outputs w/ validation, SSE, error handling, retries) and demo checklist.

Persistence + domain contracts

execution

Prisma SQLite schema covers Mission/Plan/Task/TaskRun/Artifact/LogEvent/Risk/NextStep with timestamps and traceId. Zod contracts enforce MissionInput, Plan shape (phases/tasks/deps/artifacts/riskChecks), and ExecutorResult (summary/logs/artifacts/risks/nextSteps).

OpenAI wrapper and prompt contracts

execution

Server-only OpenAI client uses abortable timeouts, retries, response_format=json_object, JSON.parse + Zod parsing, and secret redaction. Prompts define planner (phases/tasks with unique keys/deps) and executor (structured task results with artifacts, risks, next steps).

Global build review (risks + mitigations)

review

Top risks: (1) SSE + frequent SQLite writes can degrade performance—mitigate by throttling UI, batching inserts, limiting log history, WAL mode. (2) OpenAI structured output drift—mitigate with strict Zod parsing, repair prompts, short prompts, low temperature, cap task count. Remaining work: wire specs into real Next.js routes/pages and run an end-to-end mission.

Final Summary

Mission intelligence cockpit

A compact command-center view of what was learned, what is risky, and what should happen next.

Ready for handoff

3

Risks

3

Next Steps

6

Stack Items

5

Tables

Outcome

Mission design completed: MVP spec, architecture, persistence schema, OpenAI structured planning/execution contracts, mission lifecycle API, orchestrator behavior, and artifact/reporting UX are defined and ready to be wired into a working Next.js demo.

Risk Radar

Risks and mitigations

+
  • SSE + frequent SQLite writes may cause performance issues during streaming.
  • OpenAI responses may drift from strict JSON/schema, requiring repair and retries.
  • Long-running execution in a Next.js request lifecycle may be fragile without careful async handling and bounded tasks.

Execution Path

Recommended next steps

+
  • Implement Next.js route handlers for create/plan/execute/cancel/retry/artifacts and the SSE events endpoint backed by persisted LogEvents.
  • Wire UI pages (mission list/new/detail/report) to APIs and validate real-time updates (queued/running/succeeded/failed/canceled).
  • Run a full demo mission (>=3 tasks), verify artifact previews/downloads, and confirm report aggregates risks + next steps with an audit trail for retries.

Architecture

Technical foundation

+

Tech stack

  • Next.js App Router
  • TypeScript
  • Tailwind CSS
  • Route Handlers
  • OpenAI API
  • Local JSON or SQLite persistence

Database

Local JSON for prototype, SQLite/PostgreSQL for production knowledge storage.

Tables

  • missions
  • tasks
  • artifacts
  • decisions
  • risks

Project Shape

Suggested file structure

+
  • src/app/page.tsx
  • src/app/api/missions/route.ts
  • src/components/mission-dashboard.tsx
  • src/lib/services/mission-service.ts
  • src/lib/openai.ts
  • data/missions.json

Operating Model

Best practices and handoff path

+

Best practices

  • Keep AI provider calls behind server-side route handlers.
  • Use deterministic mock responses for demos when API keys are missing.
  • Validate all mutation endpoints with zod.
  • Track stageEnteredAt separately from updatedAt for accurate bottleneck alerts.
  • Keep domain logic in services so UI and API routes stay thin.

How to use this context

  • Use the PRD to align product scope and target users.
  • Use the technical design to implement architecture and data flow.
  • Use the engineering plan to create sprint tickets.
  • Use the AI execution pack as context for Codex or another execution tool.
  • Use risks and decision log as review gates before implementation.