Create phases to close all gaps identified by research milestone audit
Codex shell compatibility:
gpd on PATH.GPD_ACTIVE_RUNTIME=codex uv run gpd ....
</codex_runtime_notes>Reads MILESTONE-AUDIT.md, groups gaps into logical phases, creates phase entries in ROADMAP.md, and offers to plan each phase.
One command creates all fix phases — no manual $gpd-add-phase per gap.
Physics research gaps fall into distinct categories that map naturally to phase types:
<execution_context>
Research gaps include: missing derivations, unchecked limiting cases, incomplete analysis, missing figures, unvalidated numerical results, missing comparisons with literature. </purpose>
<required_reading> Read all files referenced by the invoking prompt's execution_context before starting. </required_reading>
# Find the most recent audit file
ls -t .gpd/v*-MILESTONE-AUDIT.md 2>/dev/null | head -1
Parse YAML frontmatter to extract structured gaps:
gaps.requirements -- unsatisfied research requirementsgaps.consistency -- cross-phase physics inconsistenciesgaps.completeness -- missing analysis, unchecked cases, incomplete workIf no audit file exists or has no gaps, error:
No audit gaps found. Run `$gpd-audit-milestone` first.
Group gaps by priority from REQUIREMENTS.md:
| Priority | Action |
|---|---|
must | Create phase, blocks milestone (e.g., missing key derivation, unverified central claim) |
should | Create phase, recommended (e.g., additional limiting case, comparison with second method) |
nice | Ask researcher: include or defer? (e.g., additional plots, extended parameter range) |
For consistency/completeness gaps, infer priority from affected requirements and research impact.
Cluster related gaps into logical research phases:
Grouping rules:
Example grouping:
Gap: REQ-03 unsatisfied (Limiting cases not checked)
Gap: Consistency: Phase 1 uses k_B=1 but Phase 3 uses SI units
Gap: Completeness: No comparison with Monte Carlo benchmarks
-> Phase 6: "Validate and Cross-Check Results"
- Check all limiting cases (weak coupling, high-T, classical)
- Unify unit conventions across all derivations
- Run Monte Carlo comparison at three benchmark points
- Generate comparison plots
Find highest existing phase:
# Get sorted phase list, extract last one
PHASES=$(/home/qol/.gpd/venv/bin/python -m gpd.runtime_cli --runtime codex --config-dir ./.codex --install-scope local phase list)
HIGHEST=$(echo "$PHASES" | /home/qol/.gpd/venv/bin/python -m gpd.runtime_cli --runtime codex --config-dir ./.codex --install-scope local json get .directories[-1] --default "")
if [ -z "$HIGHEST" ]; then
echo "ERROR: No existing phases found. Create phases with $gpd-plan-phase first."
# STOP — cannot determine gap phase numbering without existing phases
fi
New phases continue from there:
## Research Gap Closure Plan
**Milestone:** {version}
**Gaps to close:** {N} requirements, {M} consistency, {K} completeness
### Proposed Phases
**Phase {N}: {Name}**
Closes:
- {REQ-ID}: {description}
- Consistency: {issue description}
Tasks: {count}
**Phase {N+1}: {Name}**
Closes:
- {REQ-ID}: {description}
- Completeness: {what is missing}
Tasks: {count}
{If nice-to-have gaps exist:}
### Deferred (nice-to-have)
These gaps are optional. Include them?
- {gap description}
- {gap description}
---
Create these {X} phases? (yes / adjust / defer all optional)
Wait for researcher confirmation.
Add new phases to current milestone:
### Phase {N}: {Name}
**Goal:** {derived from gaps being closed}
**Requirements:** {REQ-IDs being satisfied}
**Gap Closure:** Closes gaps from audit
mkdir -p ".gpd/phases/{NN}-{name}"
PRE_CHECK=$(/home/qol/.gpd/venv/bin/python -m gpd.runtime_cli --runtime codex --config-dir ./.codex --install-scope local pre-commit-check --files .gpd/ROADMAP.md 2>&1) || true
echo "$PRE_CHECK"
/home/qol/.gpd/venv/bin/python -m gpd.runtime_cli --runtime codex --config-dir ./.codex --install-scope local commit "docs(roadmap): add gap closure phases {N}-{M}" --files .gpd/ROADMAP.md
## Gap Closure Phases Created
**Phases added:** {N} - {M}
**Gaps addressed:** {count} requirements, {count} consistency, {count} completeness
---
## > Next Up
**Plan first gap closure phase**
`$gpd-plan-phase {N}`
<sub>`/clear` first -> fresh context window</sub>
---
**Also available:**
- `$gpd-execute-phase {N}` -- if plans already exist
- `cat .gpd/ROADMAP.md` -- see updated roadmap
---
**After all gap phases complete:**
`$gpd-audit-milestone` -- re-audit to verify gaps closed
`$gpd-complete-milestone {version}` -- archive when audit passes
<gap_to_phase_mapping>
Requirement gap -> Tasks: