mvp-ai's picture
|
download
raw
8.24 kB
metadata
name: codex-harness
description: >-
  Codex adaptation of Trae Harness for staged requirements clarification,
  execution manifests, gated implementation, QA, browser/visual acceptance, and
  retrospective learning. Use when the user asks to run a harness, one-person
  company workflow, multi-phase development process, quality gates, or adapt
  Trae Harness to Codex.

Codex Harness

This is the Codex entry point for the original Trae Harness. Keep the deterministic state machine and gate scripts, but adapt orchestration to Codex's tool model.

Core differences from Trae

  • Do not require a decorative handshake. Start by acknowledging the user request, then either run the harness or explain the next gate.
  • Do not permanently replace the assistant identity. Codex remains a coding agent and uses this skill as a workflow.
  • Do not assume Trae SOLO paths. Resolve the harness root from the current skill directory or the checked-out repository.
  • Do not require sub-agents by default. In Codex, spawn sub-agents only when the user explicitly asks for parallel agents/delegation. Otherwise simulate the phases locally with strict context separation.
  • Prefer Codex-native tools:
    • code edits: apply_patch
    • shell gates: PowerShell / Python scripts in scripts/
    • file search: rg
    • frontend acceptance: Browser plugin / Playwright screenshots when available
    • task status: update_plan for visible phase progress
  • Keep context bounded. Each role writes an artifact, records a compact ledger entry, and is then closed or discarded.

Harness root

When this skill is installed, set the harness root mentally to the directory containing this SKILL.md.

For a local checkout, examples use:

$HARNESS = "D:\codex-harness"

For a user-installed Codex skill, examples use:

$HARNESS = "$env:CODEX_HOME\skills\codex-harness"

Standard workflow

Use this workflow for L2/L3 work or whenever the user asks for the harness. For very small L1 requests, keep the flow lightweight but still run relevant gates before delivery.

  1. Initialize state after the project/task directory is clear:
python $HARNESS\scripts\harness_orchestrator.py init <task_dir> --name <project_name>

Show the user the active marker:

HARNESS: ON
STATE: INIT
PROJECT: <project_name>
NEXT: PHASE_0 project profile
  1. Phase 0: classify the project and produce:
  • project-profile.json
  • complexity-level.txt

Use references/project-templates/*.yaml to choose the project type.

  1. Phase 1: produce research-brief.md with environment, standards, and risks. Record each research track in .harness/context-ledger.json.

  2. Phase 2: produce debate-output.json, then advance through GATE_1. Record Red, Blue, and Judge results for each debate cell.

  3. Phase 3: produce review-summary.md. Record reviewer convergence output.

  4. Phase 4: produce spec.md and execution-manifest.json, then advance through GATE_2. Record the spec/manifest handoff.

  5. Phase 5: ask for user confirmation when needed, then create .handover-complete.

  6. Module 2: implement tasks from execution-manifest.json. Record each developer role run by task slice.

  7. Run TEST_GATE, produce code-qa-report.md, produce func-qa-report.md, then run AUDIT_GATE. Record code-qa, func-qa, and user-acceptance role runs.

  8. Module 3: summarize lessons and update project memory or proposed rules only when the user wants persistent process evolution.

Advance after each phase:

python $HARNESS\scripts\harness_orchestrator.py advance <task_dir>

Check status:

python $HARNESS\scripts\harness_orchestrator.py status <task_dir>

Codex parallelism policy

The original harness assumes three child agents because Trae has a practical parallelism ceiling. Codex can improve this by treating phases as a task graph:

  • If the user explicitly asks for sub-agents, fan out independent research tracks, review dimensions, or QA checks in parallel.
  • Phase 2 debate is the exception that preserves the harness philosophy: each debate dimension runs as a fixed three-role cell with Red, Blue, and Judge executing in parallel. Codex may run multiple independent debate cells in parallel when context and tooling allow, but the cell itself is always Red/Blue/Judge.
  • Keep implementation workers on disjoint file/module ownership to avoid merge conflicts.
  • Keep blocking path work local when the next step depends on it immediately.
  • If the user did not ask for sub-agents, run the same roles sequentially: researcher, debater, reviewer, developer, code-qa, func-qa.
  • Preserve the information bottleneck regardless of parallelism: each role gets only the current phase guide, role card, and manifest slice.
  • After a real sub-agent finishes, record the result with scripts\record_agent_result.py and close it. Later phases read the compact ledger entry and artifact path, not the old agent context.
  • Do not carry over Trae's global "exactly three child agents" limit into Codex; preserve the three-agent debate cell, not the global cap.

What to load when

  • Codex adapter details: adapters/codex/coordinator.md
  • Codex parallelism rules: adapters/codex/parallelism.md
  • Context budget and lifecycle: references/constitution/context-budget.md
  • Codex lifecycle adapter: adapters/codex/context-lifecycle.md
  • Module 2 prompt adaptation: adapters/codex/module2-prompts.md
  • Project type selection: references/project-templates/*.yaml
  • Phase instructions: phase-guides/phase-*.md
  • Module 2 instructions: step-guides/step-2-*.md
  • Coordinator rules: references/agent-roster/codex-coordinator.md
  • Role constraints: the specific current role file in references/agent-roster/*.md
  • Constitution rules: load only the matching file from references/constitution/rules-by-phase/
  • Enforcement model: references/constitution/enforcement.md

Avoid loading the full constitution unless auditing or editing the framework.

For Module 2 sub-agent prompts, generate the concrete role prompt:

python $HARNESS\scripts\build_agent_prompt.py --task-dir <task_dir> --role developer --task-id <task_id>
python $HARNESS\scripts\build_agent_prompt.py --task-dir <task_dir> --role code-qa
python $HARNESS\scripts\build_agent_prompt.py --task-dir <task_dir> --role func-qa
python $HARNESS\scripts\build_agent_prompt.py --task-dir <task_dir> --role user-acceptance

After each role run, record the compact handoff:

python $HARNESS\scripts\record_agent_result.py --task-dir <task_dir> --phase <phase> --role <role> --agent-id <id> --input-summary "<bounded input>" --output-summary "<bounded output>" --artifact <artifact_path>

Gate scripts

Run these scripts as hard gates:

python $HARNESS\scripts\validate_debate_output.py <task_dir>\debate-output.json
python $HARNESS\scripts\check_testability.py <task_dir>\spec.md
python $HARNESS\scripts\validate_execution_manifest.py <task_dir>\execution-manifest.json
python $HARNESS\scripts\run_test_suite.py <task_dir>
python $HARNESS\scripts\check_visual_integrity.py <task_dir>
python $HARNESS\scripts\check_context_ledger.py <task_dir>
python $HARNESS\scripts\check_user_acceptance.py <task_dir>
python $HARNESS\scripts\harness_auditor.py --pipeline <l1|l2|l3> <task_dir> $HARNESS

If a gate fails, stop, fix the artifact or implementation, and rerun the same gate. Do not skip gates.

Visual QA in Codex

For web/mobile/UI work, use Codex's Browser plugin and GPT-5.5/Codex visual understanding after starting the local dev server. Verify at least desktop and mobile-width views, capture screenshots when useful, and include the observed result in func-qa-report.md.

For video/design tasks, check_visual_integrity.py is only a structural gate. Use actual rendered screenshots or exported frames for final acceptance.

Compatibility notes

The original Trae skill is preserved in SKILL.trae.md, with a Trae adapter at adapters/trae/SKILL.md. Codex should use this file (SKILL.md) as the active skill entry and load adapters/codex/ for Codex-specific details.

Xet Storage Details

Size:
8.24 kB
·
Xet hash:
f1a2604e4fe8014fe0e49015cac90ee4638f056a7dff3f39475ca4ffeebe3cf7

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.