mvp-ai's picture
|
download
raw
6.04 kB
# Codex Harness
Codex Harness is a Codex-native adaptation of Trae Harness: a staged,
artifact-driven workflow for reducing hallucination in AI software work.
It keeps the original philosophy:
```text
vague request
-> divergent research
-> Red / Blue / Judge debate
-> locked spec and execution manifest
-> TDD implementation
-> code QA
-> functional QA
-> user-side acceptance
-> final audit
```
Repository description:
> Codex-native harness for staged requirement clarification, Red/Blue/Judge
> debate, execution manifests, TDD implementation, QA gates, browser/user
> acceptance, context budgeting, and compact sub-agent handoffs.
## Why
Large AI coding sessions fail when requirements stay vague, context becomes too
long, and later implementation agents silently invent missing decisions.
Codex Harness fixes that by moving most thinking into Module 1, then forcing
Module 2 to execute a locked manifest through gates.
Core rules:
- Module 1 can research, debate, clarify, and set boundaries.
- Module 2 is TDD execution only.
- If Module 2 finds an undecided product/rule/boundary issue, it stops and
returns a Module 1 blocker.
- Every phase produces artifacts.
- Every gate is executable.
- Every role writes a compact context ledger entry before its context is closed
or discarded.
## Codex Changes From Trae Harness
- `SKILL.md` is the active Codex skill entry.
- `SKILL.trae.md` preserves the original Trae entry.
- `adapters/codex/` contains Codex-specific coordination, parallelism, prompt,
and context lifecycle rules.
- Codex does not inherit Trae's global three-sub-agent ceiling.
- The Red / Blue / Judge debate cell is preserved: each debate dimension still
requires three isolated roles.
- GLM-5V acceptance is removed; Codex/GPT-5.5 visual understanding plus Browser
checks are used for UI acceptance.
- Context is split by phase, role, dimension, task, and artifact.
## Harness State Machine
Default flow:
```text
INIT
-> PHASE_0 project profile
-> PHASE_1 research
-> PHASE_2 Red/Blue/Judge debate
-> GATE_1 debate validation + context ledger
-> PHASE_3 review convergence
-> PHASE_4 spec + execution manifest
-> GATE_2 testability + manifest + context ledger
-> PHASE_5 handoff
-> MODULE_2_STEP_1 implementation
-> TEST_GATE tests + context ledger
-> MODULE_2_STEP_2 code QA
-> MODULE_2_STEP_3 functional QA
-> MODULE_2_STEP_4 user-side acceptance
-> USER_ACCEPTANCE_GATE
-> AUDIT_GATE
-> DONE
```
## Context Budget And Sub-Agent Lifecycle
Each real or simulated role follows:
```text
bounded prompt
-> one role / one phase / one task slice
-> required artifact
-> compact ledger entry
-> close or discard role context
```
The ledger lives at:
```text
.harness/context-ledger.json
```
Record a role result:
```powershell
python scripts\record_agent_result.py `
--task-dir <task_dir> `
--phase PHASE_2 `
--role judge `
--agent-id scope-judge `
--input-summary "Judge scope debate." `
--output-summary "Kept one must-fix boundary." `
--artifact debate-output.json
```
Validate ledger handoff:
```powershell
python scripts\check_context_ledger.py <task_dir>
```
## Install As A Codex Skill
Clone or copy this repository into your Codex skills directory:
```powershell
New-Item -ItemType Directory -Force "$env:USERPROFILE\.codex\skills" | Out-Null
git clone https://github.com/zzzkeepdd/codex-harness.git "$env:USERPROFILE\.codex\skills\codex-harness"
```
Then invoke it naturally:
```text
Use codex-harness to build a small CLI tool...
```
The visible activation marker is intentionally lightweight:
```text
HARNESS: ON
STATE: INIT
PROJECT: <project-name>
NEXT: PHASE_0 project profile
```
## Core Commands
Initialize:
```powershell
python scripts\harness_orchestrator.py init <task_dir> --name <project_name>
```
Advance:
```powershell
python scripts\harness_orchestrator.py advance <task_dir>
```
Status:
```powershell
python scripts\harness_orchestrator.py status <task_dir>
```
Generate a Module 2 role prompt:
```powershell
python scripts\build_agent_prompt.py --task-dir <task_dir> --role developer --task-id T1
python scripts\build_agent_prompt.py --task-dir <task_dir> --role code-qa
python scripts\build_agent_prompt.py --task-dir <task_dir> --role func-qa
python scripts\build_agent_prompt.py --task-dir <task_dir> --role user-acceptance
```
## Gate Scripts
```powershell
python scripts\validate_debate_output.py <task_dir>\debate-output.json
python scripts\check_testability.py <task_dir>\spec.md
python scripts\validate_execution_manifest.py <task_dir>\execution-manifest.json
python scripts\run_test_suite.py <task_dir>
python scripts\check_visual_integrity.py <task_dir>
python scripts\check_context_ledger.py <task_dir>
python scripts\check_user_acceptance.py <task_dir>
python scripts\harness_auditor.py --pipeline l2 <task_dir> .
```
## Validation
Self-tests:
```powershell
python scripts\record_agent_result.py --self-test
python scripts\check_context_ledger.py --self-test
python scripts\check_user_acceptance.py --self-test
python scripts\harness_auditor.py --self-test
python scripts\harness_orchestrator.py self-test
python C:\Users\Administrator\.codex\skills\.system\skill-creator\scripts\quick_validate.py .
```
This repository has been smoke-tested through the complete state machine with a
small CLI project, including the new context-ledger gates and final audit.
## Layout
```text
SKILL.md Codex skill entry
SKILL.trae.md Original Trae skill entry
adapters/codex/ Codex adapter docs
adapters/trae/ Trae compatibility adapter
phase-guides/ Module 1 phase guides
step-guides/ Module 2 step guides
references/agent-roster/ Role cards
references/constitution/ Rules, schemas, and enforcement docs
references/project-templates/ Project-type profiles
references/workflows/ Module workflows
scripts/ State machine and gate scripts
```
## License
MIT

Xet Storage Details

Size:
6.04 kB
·
Xet hash:
c1f66deca4f0ebce48c8c9b0c2e44625fffb6d736f19cd7a9b3732557c529acd

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