| name | compare |
| description | Compare duplicate research directories to determine which is superseded. |
| disable-model-invocation | true |
| argument-hint | [dir1] [dir2] |
| allowed-tools | ["Read","Glob","Grep"] |
Compare Ralph Projects
Compare multiple Ralph loop directories that cover the same topic to determine which is superseded and whether anything needs porting.
Usage
/ralph:compare <dir1> <dir2> - Compare two directories
/ralph:compare <dir1> <dir2> <dir3> - Compare three directories
/ralph:compare - Will prompt for directories to compare
Reference Files (conditional — read in step 3)
- comparison-checklist.md - Aspects to compare and signs of supersession
Instructions
-
Get directories to compare:
- If
$ARGUMENTS provided, parse as space-separated directory paths
- Otherwise, ask: "Which directories would you like to compare? (e.g.,
docs/staged-learnings/tmp-feature docs/staged-learnings/feature)"
- Verify each directory exists locally
-
Resolve content from local files or research branches:
- For each directory, list files on the local filesystem first
- If a directory appears empty or has only boilerplate (just
spec.md + progress.md with no completed tasks): check for a research/<basename> branch via git branch -a --list *research/<basename>*
- If a research branch exists, read files via
git show <branch>:<path> and list files via git ls-tree --name-only <branch> <path>/
- Note to the operator which source is being used: local filesystem vs research branch
- Ralph loops push research to
research/<topic> branches — the local directory may only have initialization boilerplate while the branch has the full output
-
Read key files from each project (from whichever source resolved in step 2):
- Read:
spec.md, progress.md, info.md, assumptions-and-questions.md
- Note which files are unique to each project
-
Build comparison table:
Using the checklist in comparison-checklist.md, compare:
| Aspect | Dir A | Dir B |
|--------|-------|-------|
| Total files | X | Y |
| Iterations tracked | N | M |
| Research lines (info.md) | ~200 | ~500 |
| Implementation phases | 6 | 10 |
| Has assumptions doc | No | Yes |
| Has iteration logs | No | Yes |
| Spec version | v1 | v2 |
-
Identify superseded directory:
Check for signs of supersession:
- Minimal progress.md (just completion marker vs structured tracking)
- Significantly shorter research (fewer lines in info.md)
- Less structured spec (informal vs proper Ralph loop format)
- No iteration logs (single incomplete run vs multiple iterations)
- Missing documentation (no assumptions, codebase analysis, or Q&A)
-
Check for unique content to port:
- Read unique files in the superseded directory
- Search for sections not covered in the newer version
- If found, list specific sections that should be ported
-
Present recommendation:
## Comparison Summary
| Aspect | <dir1> | <dir2> |
|--------|--------|--------|
| ... | ... | ... |
## Recommendation
**Superseded**: <directory> is superseded by <directory>
**Porting needed**: <Yes/No>
<If yes, list specific sections>
**Action**: `rm -rf <superseded-directory>`
-
If consolidation needed instead (directories have complementary content):
## Recommendation
**Neither is fully superseded** - directories have complementary content.
**Consolidation approach**:
- Keep <directory> as target
- Port from <directory>:
- <file or section 1>
- <file or section 2>
- Delete <directory> after porting
Example
User: /ralph:compare docs/staged-learnings/tmp-monte-carlo docs/staged-learnings/monte-carlo-simulation
Claude: Comparing directories...
## Comparison Summary
| Aspect | tmp-monte-carlo | monte-carlo-simulation |
|--------|-----------------|------------------------|
| Total files | 3 | 8 |
| Iterations tracked | 2 | 7 |
| Research lines (info.md) | ~150 | ~480 |
| Implementation phases | 4 | 8 |
| Has assumptions doc | No | Yes |
| Has iteration logs | No | Yes |
| Spec version | v1 | v2 |
## Recommendation
**Superseded**: tmp-monte-carlo is superseded by monte-carlo-simulation
**Porting needed**: No - monte-carlo-simulation covers all topics with more depth
**Action**: `rm -rf docs/staged-learnings/tmp-monte-carlo`
Important Notes
- Always read files before making recommendations - don't assume based on names
- Some directories may need consolidation rather than deletion
- The "better" directory isn't always the one with more files - quality matters
- Check for unique deep research files that may exist only in the "older" directory