ralph-integrate
Integrate Ralph with your project's existing CLAUDE.md files, skills, and agent preferences. Run after installing Ralph, or rerun anytime you add new skills/agents.
SKILL.md
| Name | ralph-integrate |
| Description | Integrate Ralph with your project's existing CLAUDE.md files, skills, and agent preferences. Run after installing Ralph, or rerun anytime you add new skills/agents. |
name: ralph-integrate description: Integrate Ralph with your project's existing CLAUDE.md files, skills, and agent preferences. Run after installing Ralph, or rerun anytime you add new skills/agents.
Ralph Integration
Integrate Ralph with your project's existing configuration.
What This Does
- Discovers CLAUDE.md files and skills in your project
- Integrates them into Ralph prompts
- Resolves any conflicting instructions
- Configures agent types based on your preferences
When to Run
- After installing Ralph - Initial setup
- After adding a new skill - So Ralph knows to use it
- After adding a new agent type - To configure which phases use it
- After updating CLAUDE.md - To sync new rules
This is idempotent - safe to run multiple times. It will re-discover and update the ## Project Integration section in Ralph prompts, replacing the previous integration.
Usage
/ralph-integrate
Or with preferences:
/ralph-integrate use opus-engineer for implementation
Steps
1. Discover Project Configuration
Search for existing configuration:
# CLAUDE.md files
find . -name "CLAUDE.md" -o -name "claude.md" 2>/dev/null | grep -v node_modules | grep -v .ralph
# Skills
find .claude/skills -name "SKILL.md" 2>/dev/null
Read each file and extract:
- Testing commands and requirements
- Code style rules
- Agent types defined
- Project-specific conventions
2. Check for Conflicts
Compare discovered rules with Ralph's defaults in:
.ralph/prompts/base.md.ralph/prompts/manager.md.ralph/prompts/test.md.ralph/prompts/implement.md
Project CLAUDE.md always wins over Ralph defaults.
3. Update Ralph Prompts
Update .ralph/prompts/base.md:
Look for an existing ## Project Integration section. If found, replace it entirely. If not found, add it at the end.
Use these markers to make it replaceable:
<!-- RALPH_INTEGRATION_START -->
## Project Integration
### From CLAUDE.md
[Paste relevant sections from project CLAUDE.md]
### Available Skills
- /skill-name - [description]
### Testing Configuration
- Command: [discovered test command]
- Coverage: [if specified]
<!-- RALPH_INTEGRATION_END -->
On subsequent runs, replace everything between the markers.
Update .ralph/prompts/manager.md agent types:
If the project has specialized agents (e.g., opus-engineer), update:
### Subagent Configuration
| Phase | Agent Type | Reason |
|-------|------------|--------|
| investigate | general-purpose | Fast exploration |
| implement | [PROJECT_AGENT] | [reason] |
| test | general-purpose | Standard testing |
| review | [PROJECT_AGENT] | Thorough review |
And update the Task calls accordingly.
Update .ralph/prompts/test.md:
If a test skill exists:
### Run Tests
Use the project's test skill:
/test
[Or specific command from CLAUDE.md]
4. Copy to Installed Location
After updating prompts in the source, sync to the installed location:
# If .ralph/ exists in project root
cp prompts/*.md .ralph/prompts/
5. Report Results
Output a summary:
## Integration Complete
### Discovered
- CLAUDE.md: [paths]
- Skills: [list with descriptions]
### Changes Made
- base.md: Added [X] project rules
- manager.md: Updated agent type to [Y] for [phases]
- test.md: Integrated [test skill/command]
### Conflicts Resolved
- [conflict]: [resolution]
### Next Steps
- Review changes in .ralph/prompts/
- Run `.ralph/ralph.sh <project>` to test
Agent Type Configuration
If the user specifies agent preferences, update manager.md:
| Preference | Update |
|---|---|
use opus-engineer | Set subagent_type: "opus-engineer" for implement |
use sonnet for review | Add model: "sonnet" to review Task |
use haiku for investigate | Add model: "haiku" to investigate Task |
Example
User runs: /ralph-integrate use opus-engineer for implementation
Finds:
./CLAUDE.mdwith testing rules.claude/skills/test/SKILL.md.claude/skills/opus-engineer/SKILL.md
Updates .ralph/prompts/base.md:
## Project Integration
### Testing
- Use `/test` skill for running tests
- Require passing tests before review
### Skills Available to Ralph
- /test - Comprehensive test runner
- /opus-engineer - Implementation specialist
Updates .ralph/prompts/manager.md:
For implement phase:
Task(
description: "implement for {story-id}",
prompt: [combined prompt],
subagent_type: "opus-engineer"
)