원클릭으로
gpd-branch-hypothesis
Create a hypothesis branch for parallel investigation of an alternative approach
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Create a hypothesis branch for parallel investigation of an alternative approach
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Add research phase to end of current milestone in roadmap
Capture idea or task as todo from current research conversation context
Prepare a paper for arXiv submission with validation and packaging
Audit research milestone completion against original research goals
List pending research todos and select one to work on
Archive historical entries from STATE.md to keep it under the 150-line target
| name | gpd-branch-hypothesis |
| description | Create a hypothesis branch for parallel investigation of an alternative approach |
| argument-hint | <description> |
| context_mode | project-required |
| requires | {"files":[".gpd/ROADMAP.md",".gpd/STATE.md"]} |
| allowed-tools | ["read_file","write_file","shell","grep","glob"] |
<codex_runtime_notes> Codex shell compatibility:
gpd on PATH.GPD_ACTIVE_RUNTIME=codex uv run gpd ....
</codex_runtime_notes>Hypothesis branches allow a researcher to explore "what if?" questions without polluting the main research state. Each branch gets its own STATE.md fork and hypothesis documentation, enabling side-by-side comparison later via $gpd-compare-branches.
Common triggers:
<execution_context>
Create a git branch for parallel investigation of an alternative hypothesis or approach. Sets up isolated research state with hypothesis documentation, enabling side-by-side comparison later via $gpd-compare-branches. Common in physics when multiple approximation schemes, gauge choices, or derivation pathways need to be compared systematically.<required_reading> Read all files referenced by the invoking prompt's execution_context before starting. </required_reading>
Load project context:INIT=$(/Users/charlie/.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: phase_dir, phase_number, state_exists, roadmap_exists, commit_docs.
This command requires project context because it forks hypothesis state from the active roadmap and STATE.md.
Example: $gpd-branch-hypothesis Use dimensional regularization instead of hard cutoff
-> description = "Use dimensional regularization instead of hard cutoff"
If no arguments provided:
ERROR: Hypothesis description required
Usage: $gpd-branch-hypothesis <description>
Example: $gpd-branch-hypothesis Use dimensional regularization instead of hard cutoff
Exit.
Generate a branch slug from the description:Example: "Use dimensional regularization instead of hard cutoff" -> slug = "use-dimensional-regularization-instead-of-hard"
Verify the repository is in a clean state for branching:# Check for uncommitted changes
git status --porcelain
If uncommitted changes exist:
Offer to stash instead of hard-failing:
Uncommitted changes detected:
{list of files from git status}
Options:
1. "Stash changes" — Auto-stash and continue
2. "Abort" — I'll handle this manually
If "Stash changes":
git stash push -m "gpd: auto-stash before hypothesis branch ${SLUG}"
Inform user: "Changes stashed. Recover later with git stash pop."
Continue to create_branch.
If "Abort": Exit.
Record the current branch name for the hypothesis metadata:
PARENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
Create the hypothesis branch:
git checkout -b "hypothesis/${SLUG}"
If branch already exists:
ERROR: Branch hypothesis/{slug} already exists.
Either:
1. Switch to it: git checkout hypothesis/{slug}
2. Choose a different description
3. Delete it first: git branch -D hypothesis/{slug}
Exit.
Create the hypothesis documentation directory and file:mkdir -p .gpd/hypotheses/${SLUG}
Write .gpd/hypotheses/${SLUG}/HYPOTHESIS.md:
# Hypothesis: {description}
## Description
{description}
## Motivation
<!-- Why is this alternative worth investigating? -->
<!-- What limitation of the current approach does it address? -->
[To be filled by researcher]
## Expected Outcome
<!-- What do you expect to find if this hypothesis is correct? -->
<!-- What observable difference should exist vs. the main approach? -->
[To be filled by researcher]
## Success Criteria
<!-- How will you know this approach is better/worse/equivalent? -->
- [ ] [Criterion 1]
- [ ] [Criterion 2]
- [ ] [Criterion 3]
## Metadata
- **Parent branch:** {parent_branch}
- **Created:** {YYYY-MM-DD}
- **Status:** Active
- **Current phase:** [same as parent STATE.md current phase]
Help the researcher populate the HYPOTHESIS.md placeholders by inferring content from the research context.
1. Read project context:
# Get current phase and project state via gpd CLI
INIT=$(/Users/charlie/.gpd/venv/bin/python -m gpd.runtime_cli --runtime codex --config-dir ./.codex --install-scope local init progress --include roadmap,state)
Parse from INIT JSON: project_exists, state_exists, current_phase (object with number, name, directory), state_content, roadmap_content.
Run centralized context preflight before continuing:
CONTEXT=$(/Users/charlie/.gpd/venv/bin/python -m gpd.runtime_cli --runtime codex --config-dir ./.codex --install-scope local --raw validate command-context branch-hypothesis "$ARGUMENTS")
if [ $? -ne 0 ]; then
echo "$CONTEXT"
exit 1
fi
Then find the current phase directory:
CURRENT_PHASE_NUM="${current_phase.number}"
PHASE_DIR=$(/Users/charlie/.gpd/venv/bin/python -m gpd.runtime_cli --runtime codex --config-dir ./.codex --install-scope local --raw phase find "$CURRENT_PHASE_NUM")
if [ $? -ne 0 ]; then
echo "ERROR: Could not find phase directory for phase $CURRENT_PHASE_NUM"
# STOP — display the error to the user and do not proceed.
fi
Use the read_file tool to read .gpd/STATE.md, .gpd/ROADMAP.md, and any SUMMARY.md files in the phase directory. If state_content and roadmap_content were included via --include, use those directly instead of re-reading.
2. Generate draft content for each placeholder section:
Using the hypothesis description, project state, and latest research results, draft:
3. Update HYPOTHESIS.md with drafts:
Replace the placeholder sections with the generated content, clearly marked as AI-drafted for researcher review:
## Motivation
<!-- AI-drafted from project context — review and edit -->
{generated motivation referencing current approach limitations}
## Expected Outcome
<!-- AI-drafted — review and edit -->
{generated expected outcome with specific observables}
## Success Criteria
<!-- AI-drafted — review and edit -->
- [ ] {specific testable criterion 1}
- [ ] {specific testable criterion 2}
- [ ] {specific testable criterion 3}
4. Present to researcher:
Drafted motivation, expected outcome, and success criteria from project context.
Review and edit: .gpd/hypotheses/{slug}/HYPOTHESIS.md
The AI-drafted content is marked with <!-- AI-drafted --> comments.
Edit these sections before proceeding to planning.
Fork STATE.md to include hypothesis context:
/Users/charlie/.gpd/venv/bin/python -m gpd.runtime_cli --runtime codex --config-dir ./.codex --install-scope local state add-decision --phase "${CURRENT_PHASE_NUM}" --summary "Created hypothesis branch: ${description}" --rationale "Investigating alternative approach on branch hypothesis/${slug}"
STATE.md via apply_patch tool. After the ## Current Position section, add:## Active Hypothesis
**Branch:** hypothesis/{slug}
**Description:** {description}
**Parent:** {parent_branch}
This is a hypothesis branch investigating an alternative approach.
Compare results with parent branch via `$gpd-compare-branches`.
state.json, and future JSON-driven state rewrites may replace it. The durable record for the hypothesis is the gpd state add-decision entry plus .gpd/hypotheses/${SLUG}/HYPOTHESIS.md.
The commit CLI command respects commit_docs from .gpd/config.json internally — if commit_docs is false, the commit is automatically skipped.
PRE_CHECK=$(/Users/charlie/.gpd/venv/bin/python -m gpd.runtime_cli --runtime codex --config-dir ./.codex --install-scope local pre-commit-check --files .gpd/hypotheses/${SLUG}/HYPOTHESIS.md .gpd/STATE.md 2>&1) || true
echo "$PRE_CHECK"
/Users/charlie/.gpd/venv/bin/python -m gpd.runtime_cli --runtime codex --config-dir ./.codex --install-scope local commit "docs: create hypothesis branch for {slug}" --files .gpd/hypotheses/${SLUG}/HYPOTHESIS.md .gpd/STATE.md
Present completion summary:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
GPD > HYPOTHESIS BRANCH CREATED
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
**Branch:** hypothesis/{slug}
**Description:** {description}
**Parent:** {parent_branch}
**Hypothesis doc:** .gpd/hypotheses/{slug}/HYPOTHESIS.md
---
## Next Steps
1. **Fill in HYPOTHESIS.md** — document motivation, expected outcome, and success criteria
2. **Plan the phase** using the alternative approach:
$gpd-plan-phase {current_phase}
<sub>/clear first -> fresh context window</sub>
3. **Execute and compare** when ready:
$gpd-compare-branches
---
**Also available:**
- Switch back to parent: `git checkout {parent_branch}`
- List hypothesis branches: `git branch --list 'hypothesis/*'`
---
<anti_patterns>
</anti_patterns>
<success_criteria> Hypothesis branch creation is complete when:
hypothesis/{slug} created.gpd/hypotheses/{slug}/HYPOTHESIS.md created with metadata</success_criteria>
</execution_context>
Arguments: $ARGUMENTS (format: )@.gpd/STATE.md @.gpd/ROADMAP.md
Execute the branch-hypothesis workflow from @./.codex/get-physics-done/workflows/branch-hypothesis.md end-to-end. Preserve all validation gates (argument parsing, git state checks, branch creation, hypothesis documentation).