Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds autonomous implementation support to the Specify CLI through a new "Ralph Loop" command. The feature enables controlled iteration through task execution using GitHub Copilot CLI with fresh agent contexts per iteration.
Changes:
- Adds new
specify ralphCLI command with configurable iteration limits and AI model selection - Implements cross-platform loop orchestrators (PowerShell and Bash scripts)
- Creates progress tracking with iteration history and codebase pattern discovery
- Adds comprehensive documentation including spec, plan, research, and task breakdowns
Reviewed changes
Copilot reviewed 48 out of 49 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/specify_cli/init.py | Adds ralph command with prerequisite validation, script detection, and invocation |
| scripts/powershell/ralph-loop.ps1 | PowerShell orchestrator for Windows with iteration management and Copilot CLI integration |
| scripts/bash/ralph-loop.sh | Bash orchestrator for Unix/Linux with parallel functionality to PowerShell version |
| specs/001-ralph-loop-implement/*.md | Complete specification documents (spec, plan, tasks, research, contracts, checklists) |
| .github/agents/speckit.ralph.agent.md | Agent profile defining work unit scope and execution constraints |
| templates and other support files | Templates, configuration updates, and agent context files |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if models_list: | ||
| console.print("[green]Available models:[/green]") | ||
| for m in models_list: | ||
| default_marker = " [yellow](default)[/yellow]" if m == "claude-sonnet-4.5" else "" |
There was a problem hiding this comment.
The default model name "claude-sonnet-4.5" appears to be hardcoded, but this model version may not exist. Based on typical Claude versioning, this should likely be "claude-sonnet-3.5" or verify that version 4.5 actually exists in the Copilot CLI.
| Write-Host "--- Copilot Agent Output ---" -ForegroundColor DarkCyan | ||
| $outputLines = @() | ||
| # Use speckit.ralph agent - it already knows to complete one work unit | ||
| & copilot --agent speckit.ralph -p $prompt --model $Model --allow-all-tools -s 2>&1 | ForEach-Object { |
There was a problem hiding this comment.
The scripts reference agent "speckit.ralph" but the specification documents repeatedly reference "speckit.implement" as the agent profile to use. This inconsistency needs to be resolved - either both scripts and documentation should use "speckit.ralph" or both should use "speckit.implement".
| while IFS= read -r line; do | ||
| echo "$line" | ||
| output_lines+=("$line") | ||
| done < <(copilot --agent speckit.ralph -p "$prompt" --model "$model" --allow-all-tools -s 2>&1) || exit_code=$? |
There was a problem hiding this comment.
The scripts reference agent "speckit.ralph" but the specification documents repeatedly reference "speckit.implement" as the agent profile to use. This inconsistency needs to be resolved - either both scripts and documentation should use "speckit.ralph" or both should use "speckit.implement".
7635c4b to
16d825a
Compare
Previously, specify ralph would select the first feature folder found alphabetically (e.g., 001-* over 002-*), ignoring which branch the user was on. Now it: 1. First tries to match the current branch name to a feature folder 2. Falls back to the last folder alphabetically (highest feature number) This ensures working on branch 002-foo uses specs/002-foo/tasks.md instead of incorrectly picking specs/001-bar/tasks.md.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 49 out of 50 changed files in this pull request and generated 13 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| $prompt = "Iteration $Iteration - Complete one work unit from tasks.md" | ||
|
|
||
| # Only show debug info when verbose | ||
| if ($Verbose) { | ||
| Write-Host "DEBUG: Prompt = $prompt" -ForegroundColor Magenta | ||
| Write-Host "DEBUG: WorkDir = $WorkDir" -ForegroundColor Magenta | ||
| } | ||
|
|
||
| try { | ||
| # Change to working directory so copilot finds the correct agents | ||
| $originalDir = Get-Location | ||
| if ($WorkDir -and (Test-Path $WorkDir)) { | ||
| Push-Location $WorkDir | ||
| if ($Verbose) { | ||
| Write-Host "DEBUG: Changed to $WorkDir" -ForegroundColor Magenta | ||
| } | ||
| } | ||
|
|
||
| # Refresh PATH to ensure pwsh is available (copilot CLI requires PowerShell 7+) | ||
| $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User") | ||
|
|
||
| try { | ||
| # Always stream copilot output in real-time so user can see what the agent is doing | ||
| Write-Host "" | ||
| Write-Host "--- Copilot Agent Output ---" -ForegroundColor DarkCyan | ||
| $outputLines = @() | ||
| # Use speckit.ralph agent - it already knows to complete one work unit | ||
| & copilot --agent speckit.ralph -p $prompt --model $Model --allow-all-tools -s 2>&1 | ForEach-Object { |
There was a problem hiding this comment.
The prompt variable on line 188 is directly interpolated into the command on line 215 without sanitization. If the iteration number or any other variable used to construct the prompt contains shell metacharacters, this could lead to command injection. While the iteration number is controlled (integer), consider using proper command escaping or parameterization to prevent any future issues if the prompt construction changes.
| # Simple prompt - the speckit.ralph agent already knows to complete one work unit | ||
| $prompt = "Iteration $Iteration - Complete one work unit from tasks.md" |
There was a problem hiding this comment.
The comment on line 188 references "speckit.ralph agent" and mentions it "already knows to complete one work unit", but this relies on an external agent definition. If the agent definition is missing or misconfigured, the behavior may not match expectations. Consider adding validation to check if the agent file exists before proceeding, or document this dependency more explicitly in the function docstring.
|
|
||
| | File | Purpose | | ||
| |------|---------| | ||
| | `specs/{feature}/progress.txt` | Detailed log of each iteration | |
There was a problem hiding this comment.
Inconsistency: The quickstart.md file references progress.txt (line 130) but the actual implementation creates progress.md. This should be updated to match the implementation.
| - Python 3.11+ (Specify CLI) + PowerShell 6+ and Bash (scripts) + Typer, Rich (existing CLI deps); `copilot` CLI (standalone GitHub Copilot CLI) (001-ralph-loop-implement) | ||
| - Markdown files (tasks.md, progress.txt) - no database (001-ralph-loop-implement) | ||
|
|
||
| - Python 3.11+ (Specify CLI) + PowerShell 5.1/7+ and Bash (scripts) + Typer, Rich (existing CLI deps); `gh copilot` CLI (external) (001-ralph-loop-implement) |
There was a problem hiding this comment.
The copilot-instructions.md file has duplicate and conflicting technology stack entries. Lines 6-7 mention "copilot CLI (standalone GitHub Copilot CLI)" while lines 9 says "gh copilot CLI (external)". These entries contradict each other - it should be one or the other, not both. Based on the implementation, it should only reference the standalone copilot CLI.
| - 001-ralph-loop-implement: Added Python 3.11+ (Specify CLI) + PowerShell 6+ and Bash (scripts) + Typer, Rich (existing CLI deps); `copilot` CLI (standalone GitHub Copilot CLI) | ||
|
|
||
| - 001-ralph-loop-implement: Added Python 3.11+ (Specify CLI) + PowerShell 5.1/7+ and Bash (scripts) + Typer, Rich (existing CLI deps); `gh copilot` CLI (external) |
There was a problem hiding this comment.
Lines 27-29 show duplicate "Recent Changes" entries with conflicting information. One mentions "PowerShell 6+" and "copilot CLI (standalone)", the other mentions "PowerShell 5.1/7+" and "gh copilot CLI (external)". This duplication suggests the agent context was updated multiple times without removing old entries. Clean up to show only the correct, current entry.
| - Supports `--max-iterations` (default: 10) and `--model` (default: claude-sonnet-4.5) options | ||
| - Verbose mode with `-v` flag for detailed output | ||
| - Warns about uncommitted changes before starting | ||
| - Creates progress.txt log with iteration history and codebase patterns |
There was a problem hiding this comment.
The CHANGELOG.md references progress.txt on line 22, but the implementation creates progress.md. This should be corrected to progress.md for consistency.
| console.print(tracker.render()) | ||
| console.print() | ||
| console.print("[red]Error:[/red] GitHub Copilot CLI not found.") | ||
| console.print("[dim]Install from: https://docs.github.com/copilot/using-github-copilot/using-github-copilot-chat-in-your-ide[/dim]") |
There was a problem hiding this comment.
The error message on line 1363 provides an installation link that points to the GitHub Copilot IDE documentation, but this is for the standalone CLI tool. The correct installation documentation link should point to the GitHub Copilot CLI documentation, not the IDE integration docs. The npm install command on line 1364 is correct, but the docs link is misleading.
| Write-Host "--- Copilot Agent Output ---" -ForegroundColor DarkCyan | ||
| $outputLines = @() | ||
| # Use speckit.ralph agent - it already knows to complete one work unit | ||
| & copilot --agent speckit.ralph -p $prompt --model $Model --allow-all-tools -s 2>&1 | ForEach-Object { |
There was a problem hiding this comment.
The --allow-all-tools flag on line 215 grants the copilot agent permission to execute any tool without confirmation. While this is necessary for autonomous operation, it poses a security risk if the agent is compromised or if malicious prompts are injected. Consider documenting this security tradeoff in the function comments and potentially adding a warning message on first use, or offering a more restricted mode for untrusted environments.
| npm_path = os.path.expandvars(r"%APPDATA%\npm\copilot.cmd") | ||
| if os.path.exists(npm_path): | ||
| copilot_path = npm_path |
There was a problem hiding this comment.
The Windows-specific npm path check on line 1250 uses r-string formatting with Windows path separators but there's no OS check before attempting this. If this code runs on Linux/macOS, it will try to check a non-existent Windows path. Consider adding a platform check: if platform.system() == 'Windows': before the Windows-specific path logic.
|
|
||
| ## File Formats | ||
|
|
||
| ### progress.txt |
There was a problem hiding this comment.
There's an inconsistency in file naming throughout the codebase. The implementation in both ralph-loop.ps1 (line 88) and ralph-loop.sh (line 85) creates progress.md, but the data model documentation (data-model.md lines 47, 80, 86) refers to progress.txt. The .gitignore also references progress.txt. All references should be consistent. Based on the actual implementation, it should be progress.md everywhere.
No description provided.