|
| 1 | +--- |
| 2 | +name: gpd-add-phase |
| 3 | +description: Add research phase to end of current milestone in roadmap |
| 4 | +argument-hint: <description> |
| 5 | +context_mode: project-required |
| 6 | +allowed-tools: |
| 7 | + - read_file |
| 8 | + - write_file |
| 9 | + - shell |
| 10 | +--- |
| 11 | +<codex_runtime_notes> |
| 12 | +Codex shell compatibility: |
| 13 | +- When shell steps call the GPD CLI, use /home/qol/.gpd/venv/bin/python -m gpd.runtime_cli --runtime codex --config-dir ./.codex --install-scope local instead of the ambient `gpd` on PATH. |
| 14 | +- If you intentionally need the repo environment, keep the runtime pin: `GPD_ACTIVE_RUNTIME=codex uv run gpd ...`. |
| 15 | +</codex_runtime_notes> |
| 16 | + |
| 17 | + |
| 18 | +<!-- Tool names and @ includes are platform-specific. The installer translates paths for your runtime. --> |
| 19 | +<!-- Allowed-tools are runtime-specific. Other platforms may use different tool interfaces. --> |
| 20 | + |
| 21 | +<objective> |
| 22 | +Add a new integer phase to the end of the current milestone in the roadmap. |
| 23 | + |
| 24 | +Routes to the add-phase workflow which handles: |
| 25 | + |
| 26 | +- Phase number calculation (next sequential integer) |
| 27 | +- Directory creation with slug generation |
| 28 | +- Roadmap structure updates |
| 29 | +- STATE.md roadmap evolution tracking |
| 30 | + |
| 31 | +Typical research phases include: |
| 32 | + |
| 33 | +- Literature review (survey existing results, identify gaps) |
| 34 | +- Formalism development (define notation, establish framework) |
| 35 | +- Analytical calculation (derive key results, check limiting cases) |
| 36 | +- Numerical implementation (code up simulations, set parameters) |
| 37 | +- Validation (compare with known results, verify dimensional consistency) |
| 38 | +- Interpretation (extract physical meaning, identify novel predictions) |
| 39 | +- Paper writing (draft manuscript, prepare figures) |
| 40 | + </objective> |
| 41 | + |
| 42 | +<execution_context> |
| 43 | +@.gpd/ROADMAP.md |
| 44 | +@.gpd/STATE.md |
| 45 | + |
| 46 | +<!-- [included: add-phase.md] --> |
| 47 | +<purpose> |
| 48 | +Add a new integer phase to the end of the current milestone in the roadmap. Automatically calculates next phase number, creates phase directory, and updates roadmap structure. Phases represent major stages of a physics research project (e.g., literature review, formalism development, analytical calculation, numerical implementation, validation). |
| 49 | +</purpose> |
| 50 | + |
| 51 | +<required_reading> |
| 52 | +Read all files referenced by the invoking prompt's execution_context before starting. |
| 53 | +</required_reading> |
| 54 | + |
| 55 | +<process> |
| 56 | + |
| 57 | +<step name="parse_arguments"> |
| 58 | +Parse the command arguments: |
| 59 | +- All arguments become the phase description |
| 60 | +- Example: `$gpd-add-phase Develop effective Hamiltonian formalism` -> description = "Develop effective Hamiltonian formalism" |
| 61 | +- Example: `$gpd-add-phase Validate perturbative expansion against exact diagonalization` -> description = "Validate perturbative expansion against exact diagonalization" |
| 62 | + |
| 63 | +If no arguments provided: |
| 64 | + |
| 65 | +``` |
| 66 | +ERROR: Phase description required |
| 67 | +Usage: $gpd-add-phase <description> |
| 68 | +Example: $gpd-add-phase Derive renormalization group equations |
| 69 | +``` |
| 70 | + |
| 71 | +Exit. |
| 72 | +</step> |
| 73 | + |
| 74 | +<step name="init_context"> |
| 75 | +Load phase operation context: |
| 76 | + |
| 77 | +```bash |
| 78 | +INIT=$(/home/qol/.gpd/venv/bin/python -m gpd.runtime_cli --runtime codex --config-dir ./.codex --install-scope local init phase-op "0") |
| 79 | +if [ $? -ne 0 ]; then |
| 80 | + echo "ERROR: gpd initialization failed: $INIT" |
| 81 | + # STOP — display the error to the user and do not proceed. |
| 82 | +fi |
| 83 | +``` |
| 84 | + |
| 85 | +Check `roadmap_exists` from init JSON. If false: |
| 86 | + |
| 87 | +``` |
| 88 | +ERROR: No roadmap found (.gpd/ROADMAP.md) |
| 89 | +Run $gpd-new-project to initialize. |
| 90 | +``` |
| 91 | + |
| 92 | +Exit. |
| 93 | +</step> |
| 94 | + |
| 95 | +<step name="add_phase"> |
| 96 | +**Delegate the phase addition to gpd CLI:** |
| 97 | + |
| 98 | +```bash |
| 99 | +RESULT=$(/home/qol/.gpd/venv/bin/python -m gpd.runtime_cli --runtime codex --config-dir ./.codex --install-scope local phase add "${description}") |
| 100 | +if [ $? -ne 0 ]; then |
| 101 | + echo "ERROR: phase add failed: $RESULT" |
| 102 | + # STOP — do not proceed. |
| 103 | +fi |
| 104 | +``` |
| 105 | + |
| 106 | +The CLI handles: |
| 107 | + |
| 108 | +- Finding the highest existing integer phase number |
| 109 | +- Calculating next phase number (max + 1) |
| 110 | +- Generating slug from description |
| 111 | +- Creating the phase directory (`.gpd/phases/{NN}-{slug}/`) |
| 112 | +- Inserting the phase entry into ROADMAP.md with Goal, Depends on, and Plans sections |
| 113 | + |
| 114 | +Extract from result: `phase_number`, `padded`, `name`, `slug`, `directory`. |
| 115 | +</step> |
| 116 | + |
| 117 | +<step name="update_project_state"> |
| 118 | +Update project state to reflect the new phase: |
| 119 | + |
| 120 | +1. Record the decision via gpd (handles STATE.md + state.json sync): |
| 121 | + |
| 122 | +```bash |
| 123 | +/home/qol/.gpd/venv/bin/python -m gpd.runtime_cli --runtime codex --config-dir ./.codex --install-scope local state add-decision --phase "${N}" --summary "Added Phase ${N}: ${description}" --rationale "Extends current milestone with new research phase" |
| 124 | +``` |
| 125 | + |
| 126 | +2. Update last activity timestamp: |
| 127 | + |
| 128 | +```bash |
| 129 | +/home/qol/.gpd/venv/bin/python -m gpd.runtime_cli --runtime codex --config-dir ./.codex --install-scope local state update "Last Activity" "$(date +%Y-%m-%d)" |
| 130 | +``` |
| 131 | + |
| 132 | +This ensures STATE.md and state.json stay in sync. Do NOT edit STATE.md directly — always use gpd state commands. |
| 133 | +</step> |
| 134 | + |
| 135 | +<step name="completion"> |
| 136 | +Present completion summary: |
| 137 | + |
| 138 | +``` |
| 139 | +Phase {N} added to current milestone: |
| 140 | +- Description: {description} |
| 141 | +- Directory: .gpd/phases/{phase-num}-{slug}/ |
| 142 | +- Status: Not planned yet |
| 143 | +
|
| 144 | +Roadmap updated: .gpd/ROADMAP.md |
| 145 | +
|
| 146 | +--- |
| 147 | +
|
| 148 | +## Next Up |
| 149 | +
|
| 150 | +**Phase {N}: {description}** |
| 151 | +
|
| 152 | +`$gpd-plan-phase {N}` |
| 153 | +
|
| 154 | +<sub>`/clear` first -> fresh context window</sub> |
| 155 | +
|
| 156 | +--- |
| 157 | +
|
| 158 | +**Also available:** |
| 159 | +- `$gpd-add-phase <description>` -- add another phase |
| 160 | +- Review roadmap |
| 161 | +
|
| 162 | +--- |
| 163 | +``` |
| 164 | + |
| 165 | +</step> |
| 166 | + |
| 167 | +</process> |
| 168 | + |
| 169 | +<success_criteria> |
| 170 | + |
| 171 | +- [ ] `gpd phase add` executed successfully |
| 172 | +- [ ] Phase directory created |
| 173 | +- [ ] Roadmap updated with new phase entry |
| 174 | +- [ ] Decision recorded via `gpd state add-decision` (STATE.md + state.json synced) |
| 175 | +- [ ] User informed of next steps |
| 176 | + |
| 177 | +</success_criteria> |
| 178 | + |
| 179 | +<!-- [end included] --> |
| 180 | + |
| 181 | +</execution_context> |
| 182 | + |
| 183 | +<process> |
| 184 | +**Follow the add-phase workflow** from `@./.codex/get-physics-done/workflows/add-phase.md`. |
| 185 | + |
| 186 | +The workflow handles all logic including: |
| 187 | + |
| 188 | +1. Argument parsing and validation |
| 189 | +2. Roadmap existence checking |
| 190 | +3. Current milestone identification |
| 191 | +4. Next phase number calculation (ignoring decimals) |
| 192 | +5. Slug generation from description |
| 193 | +6. Phase directory creation |
| 194 | +7. Roadmap entry insertion |
| 195 | +8. STATE.md updates |
| 196 | + </process> |
0 commit comments