Implementation of the Dr. Ralph technique - continuous self-referential AI loops for interactive iterative development. Run Claude in a while-true loop with the same prompt until task completion.

version
1.0.0
GitHub stars
32

Install

/plugin install dr-ralph@dr-ralph-marketplace

Run it inside Claude Code after adding the marketplace with /plugin marketplace add blencorp/dr-ralph.

Contents

Discovered from source

Commands 3

Cancel Dr. Ralph

To cancel the Dr. Ralph diagnostic session:

  1. Check if .claude/dr-ralph-loop.local.md exists using Bash: test -f .claude/dr-ralph-loop.local.md && echo "EXISTS" || echo "NOT_FOUND"

  2. If NOT_FOUND: Say "No active Dr. Ralph session found."

  3. If EXISTS:

    • Read .claude/dr-ralph-loop.local.md to get the current iteration number from the iteration: field
    • Note patient_name if present in the state file
    • Remove the file using Bash: rm .claude/dr-ralph-loop.local.md
    • Report: "Cancelled Dr. Ralph diagnostic session (was at iteration N)"
    • If patient notes exist, mention: "Patient notes were saved to [patient_file path]"

Dr. Ralph Diagnose Command

Execute the setup script to initialize the full diagnostic workflow:

"${CLAUDE_PLUGIN_ROOT}/scripts/setup-dr-ralph-diagnose.sh" $ARGUMENTS

PHASE-BASED WORKFLOW

This command runs through 5 phases:

  1. Interview - Use AskUserQuestion for comprehensive medical intake
  2. Research - WebSearch for literature, guidelines, treatment protocols
  3. Differential - Analyze findings to determine diagnosis
  4. Treatment - Develop research-backed action plan
  5. Report - Generate SOAP format documentation

CRITICAL RULES

0. MEDICAL RECORDS FIRST

Before symptom questions, ask if patient has medical records to share. Process files ONE BY ONE:

  • Check file size with ls -la or stat before reading
  • If file > 3MB: Alert user, offer to skip or provide smaller version
  • Suggest Adobe Acrobat to split large PDFs
  • Never let one bad file crash the workflow

1. USE AskUserQuestion FOR ALL INTERVIEW QUESTIONS

You MUST use the AskUserQuestion tool for every interview question. Do NOT output questions as plain text.

2. MAINTAIN RUNNING NOTES

Write findings to the patient notes file after each phase. Use timestamps for all entries.

3. READ EXISTING PATIENT HISTORY

If patient notes exist, READ them first to understand previous sessions before beginning.

4. USE WebSearch FOR RESEARCH

Search for medical literature, guidelines, and treatment protocols. Use inline citations.

5. FOLLOW PHASE ORDER

Complete each phase fully before moving to the next. Announce phase transitions.

6. MEDICAL DISCLAIMER

This is an AI-assisted tool. Always remind patients this is not a substitute for professional medical advice. Remind them to redact sensitive information.

7. FLAG RED FLAGS

If emergency symptoms are detected (chest pain + SOB, sudden severe headache, etc.), flag them prominently but continue the workflow.

OUTPUT FILES

  • Running Notes: @notes/[patient].md - Updated throughout session
  • Final Report: @notes/[patient]-report-[timestamp].md - SOAP format

Dr. Ralph Plugin Help

Please explain the following to the user:

What is Dr. Ralph?

Dr. Ralph is an AI-assisted medical diagnostic plugin that provides a structured 5-phase workflow for comprehensive symptom analysis and treatment planning.

The 5 Phases:

  1. Interview - Medical records intake, then comprehensive symptom questions
  2. Research - Web search for literature and treatment protocols
  3. Differential - Confidence-based diagnosis analysis
  4. Treatment - Research-backed action plan with urgency levels
  5. Report - SOAP format documentation

Dr. Ralph maintains patient notes across sessions and generates professional medical reports.

Available Commands

/dr-ralph:diagnose [OPTIONS]

Full diagnostic workflow: interview → research → differential → treatment → report.

Usage:

/dr-ralph:diagnose "I've been having back pain for 3 months" --patient "John Doe"
/dr-ralph:diagnose "Headaches and dizziness" --completion-promise DONE

Options:

  • --patient <name> - Patient name for case file (default: anonymous)
  • --questions <n> - Maximum interview questions (default: 15)
  • --output <dir> - Directory for case files (default: @notes/)
  • --max-iterations <n> - Max iterations before auto-stop
  • --completion-promise <text> - Promise phrase to signal completion

5-Phase Workflow:

  1. Interview - Comprehensive intake using AskUserQuestion tool
  2. Research - Web search for literature and treatment protocols
  3. Differential - Analyze symptoms to determine diagnosis (confidence-based)
  4. Treatment - Research-backed action plan with urgency levels
  5. Report - SOAP format documentation with executive summary

Output Files:

  • @notes/[patient].md - Running notes (persists across sessions)
  • @notes/[patient]-report-[timestamp].md - Final SOAP report

Diagnosis Output:

  • 80% confident → Single most likely diagnosis

  • Uncertain → Top 3-5 differential diagnoses ranked by likelihood

Note: AI-assisted diagnostic tool. Not a substitute for professional medical advice.


/dr-ralph:cancel

Cancel an active diagnostic session.

Usage:

/dr-ralph:cancel

How it works:

  • Checks for active state file
  • Removes the session state
  • Reports cancellation with iteration count
  • Patient notes are preserved

Example

/dr-ralph:diagnose "Persistent fatigue and joint pain" --patient "Jane Doe" --completion-promise DONE

Dr. Ralph will:

  • Conduct comprehensive interview (Phase 1)
  • Research conditions and treatments (Phase 2)
  • Generate differential diagnosis (Phase 3)
  • Create treatment action plan (Phase 4)
  • Write SOAP format report (Phase 5)

When to Use Dr. Ralph

Good for:

  • Comprehensive medical symptom analysis
  • Research-backed diagnostic workflows
  • Structured patient intake interviews
  • Generating SOAP-format documentation
  • Tracking patient cases over multiple sessions

Not good for:

  • Emergency medical situations (call 911)
  • Replacing professional medical advice
  • Quick one-off health questions

Learn More

Hooks 1

Sponsors

Details

Marketplace
blencorp/dr-ralph
Author
Mike Endale
Category
Healthcare
Keywords
dr-ralph, medical, diagnosis, treatment, SOAP-report