From b0b5f0e49a8f350253663dcbd76e97b06dcba91a Mon Sep 17 00:00:00 2001 From: chaitanyakumar-d Date: Fri, 23 Jan 2026 15:18:13 -0600 Subject: [PATCH] fix: branch creation defaults to current HEAD instead of main - Update prompt.md and CLAUDE.md to create branches from baseBranch (if specified) or current HEAD - Add optional baseBranch field to prd.json.example - Update README.md to document the new baseBranch option Fixes snarktank/ralph#40 --- CLAUDE.md | 2 +- README.md | 4 ++-- prd.json.example | 1 + prompt.md | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index f95bb927..09d34b56 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -6,7 +6,7 @@ You are an autonomous coding agent working on a software project. 1. Read the PRD at `prd.json` (in the same directory as this file) 2. Read the progress log at `progress.txt` (check Codebase Patterns section first) -3. Check you're on the correct branch from PRD `branchName`. If not, check it out or create from main. +3. Check you're on the correct branch from PRD `branchName`. If not, check it out or create it from `baseBranch` (if specified in PRD) or from the current HEAD. 4. Pick the **highest priority** user story where `passes: false` 5. Implement that single user story 6. Run quality checks (e.g., typecheck, lint, test - use whatever your project requires) diff --git a/README.md b/README.md index 4db35bc2..10ba0453 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,7 @@ This creates `prd.json` with user stories structured for autonomous execution. Default is 10 iterations. Use `--tool amp` or `--tool claude` to select your AI coding tool. Ralph will: -1. Create a feature branch (from PRD `branchName`) +1. Create a feature branch (from PRD `branchName`, based on `baseBranch` if specified, otherwise from current HEAD) 2. Pick the highest priority story where `passes: false` 3. Implement that single story 4. Run quality checks (typecheck, tests) @@ -114,7 +114,7 @@ Ralph will: | `ralph.sh` | The bash loop that spawns fresh AI instances (supports `--tool amp` or `--tool claude`) | | `prompt.md` | Prompt template for Amp | | `CLAUDE.md` | Prompt template for Claude Code | -| `prd.json` | User stories with `passes` status (the task list) | +| `prd.json` | User stories with `passes` status (the task list). Supports optional `baseBranch` field to specify which branch to create feature branches from (defaults to current HEAD) | | `prd.json.example` | Example PRD format for reference | | `progress.txt` | Append-only learnings for future iterations | | `skills/prd/` | Skill for generating PRDs | diff --git a/prd.json.example b/prd.json.example index fbc40668..faf191b8 100644 --- a/prd.json.example +++ b/prd.json.example @@ -1,6 +1,7 @@ { "project": "MyApp", "branchName": "ralph/task-priority", + "baseBranch": "develop", "description": "Task Priority System - Add priority levels to tasks", "userStories": [ { diff --git a/prompt.md b/prompt.md index cdebe901..a291c946 100644 --- a/prompt.md +++ b/prompt.md @@ -6,7 +6,7 @@ You are an autonomous coding agent working on a software project. 1. Read the PRD at `prd.json` (in the same directory as this file) 2. Read the progress log at `progress.txt` (check Codebase Patterns section first) -3. Check you're on the correct branch from PRD `branchName`. If not, check it out or create from main. +3. Check you're on the correct branch from PRD `branchName`. If not, check it out or create it from `baseBranch` (if specified in PRD) or from the current HEAD. 4. Pick the **highest priority** user story where `passes: false` 5. Implement that single user story 6. Run quality checks (e.g., typecheck, lint, test - use whatever your project requires)