Plan a new Ralph track interactively
You are planning a Ralph track. The user provided a feature description as $ARGUMENTS.
Derive these values using Bash:
GIT_ROOT="$(git rev-parse --show-toplevel)"
Slugify $ARGUMENTS: lowercase, replace non-alphanumeric with -, collapse consecutive hyphens, trim leading/trailing hyphens.
Example: "Add Dark Mode Support" → add-dark-mode-support
SLUG="<slugified>"
RALPH_DIR="$GIT_ROOT/.ralph"
TRACK_DIR="$RALPH_DIR/tracks/$SLUG"
If already exists, tell the user the track already exists and stop.
$TRACK_DIRmkdir -p "$TRACK_DIR/logs"
# Create .gitignore if missing
if [[ ! -f "$RALPH_DIR/.gitignore" ]]; then
printf '*\n!.gitignore\n' > "$RALPH_DIR/.gitignore"
fi
echo "planning" > "$TRACK_DIR/status"
echo "0" > "$TRACK_DIR/current_phase"
Write $TRACK_DIR/state.md:
# Track State: <slug>
Phase history will be appended below by agents.
Ask the user which branch to base this track on. Show the available local branches:
git branch --format='%(refname:short)'
Default to main if the user doesn't have a preference. Store the chosen branch:
echo "<chosen-branch>" > "$TRACK_DIR/base_branch"
Now analyze the codebase and discuss the plan with the user:
$ARGUMENTShome, dex-web, web3) if not obvious from the featureOnce the user is happy, write $TRACK_DIR/plan.md using this exact format:
# Track: <name>
**Ticket:** <TICKET-123>
**Scope:** <app or sub-area, e.g. home, dex-web, web3>
## Description
<1-2 sentences describing the feature/task>
## Phases
### Phase 1: <title>
**Description:** <what to do in this phase>
**Files:** <expected files to touch>
**Checks:** <phase-specific validation commands>
### Phase 2: <title>
**Description:** <what to do>
**Files:** <expected files>
**Checks:** <validation commands>
...
## Quality Gates
- <command 1, e.g. "pnpm build">
- <command 2, e.g. "pnpm test">
- <command 3, e.g. "pnpm lint">
After writing plan.md:
echo "planned" > "$TRACK_DIR/status"
echo "$SLUG" > "$RALPH_DIR/active_track"
Count the phases and print a summary:
Track '<slug>' planned with N phases.
Active track set to: <slug>
Next steps:
ralph-run # run all phases
ralph-single # run one phase at a time
/ralph-status # view the plan