Run discovery phase to investigate methods, literature, and approaches before planning
Codex shell compatibility:
gpd on PATH.GPD_ACTIVE_RUNTIME=codex uv run gpd ....
</codex_runtime_notes><codex_questioning>
Produces RESEARCH.md (with depth: quick) that informs subsequent planning via $gpd-plan-phase.
Use this when:
Depth levels:
quick (Level 1): Verify a formula, check a convention, confirm a known result (2-5 min)medium (Level 2): Choose between methods, explore a regime, compare approaches (15-30 min)deep (Level 3): Novel problems, contradictory literature, foundational choices (1+ hour)
</objective><execution_context>
Can be invoked before plan-phase for deeper literature/method investigation, or run automatically during plan-phase's research step. Accepts a depth parameter.
This workflow discovers the physics landscape: what is known, what is open, what tools exist, what methods are standard, what data is available, what approximations are valid.
NOTE: For comprehensive literature survey ("what do experts know about this"), use $gpd-research-phase instead, which produces a full-depth RESEARCH.md. This workflow produces a quick-depth RESEARCH.md (depth: quick) suitable for method selection and landscape scanning. </purpose>
<depth_levels> This workflow supports three depth levels:
| Level | Name | Time | Output | When |
|---|---|---|---|---|
| 1 | Quick Verify | 2-5 min | No file, proceed with verified knowledge | Confirming a formula, checking a known result, verifying a convention |
| 2 | Standard | 15-30 min | RESEARCH.md | Choosing between methods, exploring a new regime, setting up a calculation |
| 3 | Deep Dive | 1+ hour | Detailed RESEARCH.md with validation gates | Novel problems, ambiguous literature, competing claims, foundational choices |
Depth is determined by the caller (plan-phase.md or the user) before routing here. </depth_levels>
<source_hierarchy> MANDATORY: Authoritative sources BEFORE general search
Physics results can be subtle and sign conventions vary across references. Always verify.
See ./.codex/get-physics-done/templates/research.md for the RESEARCH.md template structure (use depth: quick for discovery-level output).
</source_hierarchy>
INIT=$(/home/qol/.gpd/venv/bin/python -m gpd.runtime_cli --runtime codex --config-dir ./.codex --install-scope local init phase-op --include state,config "${PHASE_ARG:-}")
if [ $? -ne 0 ]; then
echo "ERROR: gpd initialization failed: $INIT"
# STOP — display the error to the user and do not proceed.
fi
Parse JSON for: commit_docs, phase_found, phase_dir, phase_number, phase_name, phase_slug, state_exists.
convention_lock for unit system and sign conventions (so discovered formulas can be matched to project conventions)If phase_found is false and a phase was specified: Error — phase not found.
If no phase specified: Discovery is standalone; output goes to .gpd/analysis/. Ensure the directory exists: mkdir -p .gpd/analysis.
</step>
Extract --depth flag if present: --depth quick, --depth medium, --depth deep.
Map to internal depth levels:
--depth quick or depth=verify -> Level 1 (Quick Verification)--depth medium or depth=standard -> Level 2 (Standard Discovery)--depth deep or depth=deep -> Level 3 (Deep Dive)--depth flag -> Default to Level 2 (Standard Discovery)When called from plan-phase.md, the depth is passed as a parameter directly (not via $ARGUMENTS).
Route to appropriate level workflow below. </step>
For: Confirming a formula, checking a convention, verifying a known result is still current.
Process:
Identify the specific claim to verify:
Check against standard references:
Verify:
If verified: Return to plan-phase.md with confirmation. No RESEARCH.md needed.
If concerns found: Escalate to Level 2.
Output: Verbal confirmation to proceed, or escalation to Level 2. </step>
For: Choosing between methods, exploring a new parameter regime, setting up a new type of calculation.
Process:
Identify what to discover:
Search standard references for each approach:
For each method/technique:
- Check textbook treatments
- Find original papers where method was developed
- Look for review articles comparing approaches
Check primary literature for recent developments and applications to similar systems.
Search arXiv and journals for comparisons:
Cross-verify: Any claim from a single source -> confirm with independent source. Watch for sign conventions and normalization differences between references.
Create RESEARCH.md using ./.codex/get-physics-done/templates/research.md structure:
Return to plan-phase.md.
Output: ${phase_dir}/RESEARCH.md
</step>
For: Novel problems, ambiguous or contradictory literature, foundational choices that affect the entire calculation, high-risk methodological decisions.
Process:
Scope the discovery using ./.codex/get-physics-done/templates/research.md:
Exhaustive literature search:
Mathematical framework analysis:
Numerical landscape survey:
Cross-verify ALL findings:
Create comprehensive RESEARCH.md:
Confidence gate: If overall confidence is LOW, present options before proceeding.
Return to plan-phase.md.
Output: ${phase_dir}/RESEARCH.md (comprehensive)
</step>
Ask: What do we need to know before we can plan this phase?
Include:
Phase-scoped: ${phase_dir}/RESEARCH.md
Standalone (no phase):
mkdir -p .gpd/analysis
Write to .gpd/analysis/discovery-{slug}.md (where {slug} is derived from the discovery topic).
Contents of RESEARCH.md:
If confidence is MEDIUM: Inline: "Discovery complete (medium confidence). [brief reason]. Proceed to planning?"
If confidence is HIGH: Proceed directly, just note: "Discovery complete (high confidence)." </step>
Present them inline: "Open questions from discovery:
These may affect the derivation. Acknowledge and proceed? (yes / address first)"
If "address first": Gather user input on questions, update discovery. </step>
What's next?
NOTE: RESEARCH.md is NOT committed separately. It will be committed with phase completion.
</step>
</process>
<success_criteria>
**Level 1 (Quick Verify):**
- Standard reference consulted for formula/result/convention
- Current state verified or concerns escalated
- Verbal confirmation to proceed (no files)
**Level 2 (Standard):**
- Standard references consulted for all approaches
- Claims cross-verified against independent sources
- Conventions explicitly stated
- RESEARCH.md created with recommendation
- Confidence level MEDIUM or higher
- Ready to inform PLAN.md creation
**Level 3 (Deep Dive):**
- Discovery scope defined
- Literature exhaustively surveyed (textbooks, reviews, primary papers, arXiv)
- All claims verified against independent sources
- Conventions reconciled across references
- RESEARCH.md created with comprehensive analysis
- Quality report with source attribution
- If LOW confidence findings -> validation checkpoints defined (reproduce known result X before proceeding)
- Confidence gate passed
- Ready to inform PLAN.md creation
</success_criteria>
<!-- [end included] -->
</execution_context>
<context>
Phase or topic: $ARGUMENTS
@.gpd/STATE.md
@.gpd/ROADMAP.md
</context>
<process>
Execute the discover workflow from @./.codex/get-physics-done/workflows/discover.md end-to-end.
## Step 0: Validate Context
```bash
CONTEXT=$(/home/qol/.gpd/venv/bin/python -m gpd.runtime_cli --runtime codex --config-dir ./.codex --install-scope local --raw validate command-context discover "$ARGUMENTS")
if [ $? -ne 0 ]; then
echo "$CONTEXT"
exit 1
fi
If a phase number is supplied, use project phase context. If no project exists, require a standalone topic and proceed in standalone analysis mode.
Extract an optional phase number or standalone topic, plus the optional depth flag, from $ARGUMENTS.
Default depth: medium (Level 2).
Follow the discover workflow for the determined depth level.
/home/qol/.gpd/venv/bin/python -m gpd.runtime_cli --runtime codex --config-dir ./.codex --install-scope local commit "discover(${phase_number}): ${depth} discovery for ${phase_name}" --files ".gpd/phases/${padded_phase}-${phase_slug}/RESEARCH.md"
Show discovery summary, confidence level, and offer next actions. </process>
<success_criteria>