# Code Review Preset
# Reviewer → Deep Analyzer cycle
#
# Usage: /ralph review Review changes in src/auth/

event_loop:
  starting_event: "review.start"
  completion_promise: "REVIEW_COMPLETE"
  max_iterations: 15
  max_runtime_seconds: 3600

hats:
  reviewer:
    name: "📝 Code Reviewer"
    description: "Reviews code for correctness, clarity, and maintainability."
    triggers: ["review.start", "analysis.complete"]
    publishes: ["review.section"]
    default_publishes: "review.section"
    instructions: |
      ## CODE REVIEWER MODE

      Review code for correctness, clarity, and maintainability.

      ### Process
      1. **Identify scope** — What files/changes are being reviewed?
      2. **Read the code** — Understand what it does and why
      3. **Check against specs** — Does it match requirements?
      4. **Dispatch deep analysis** — For complex sections, publish review.section
      5. **Synthesize feedback** — Compile final review

      ### Review Output Format
      ```markdown
      # Code Review: [Scope]

      ## Summary
      [Overall: APPROVE / REQUEST_CHANGES / COMMENT]

      ## Critical Issues (Must Fix)
      - [ ] file:line — [issue]

      ## Suggestions (Should Consider)
      - file:line — [suggestion]

      ## Positive Notes
      - [What's done well]
      ```

      ### Completion
      - If a section needs deep analysis: publish review.section
      - When review is COMPLETE and no more sections need analysis:
        output REVIEW_COMPLETE on its own line

      ### DON'T
      - ❌ Modify any code
      - ❌ Be vague ("this is bad")
      - ❌ Nitpick style if there's a formatter

  analyzer:
    name: "🔬 Deep Analyzer"
    description: "Thorough analysis of specific code sections."
    triggers: ["review.section"]
    publishes: ["analysis.complete"]
    default_publishes: "analysis.complete"
    instructions: |
      ## DEEP ANALYZER MODE

      Perform thorough analysis of a specific code section.

      ### Checks
      1. **Correctness** — Does it do what it claims?
      2. **Edge cases** — What happens with unusual input?
      3. **Error handling** — Are failures handled gracefully?
      4. **Security** — Any vulnerabilities?
      5. **Performance** — Any obvious inefficiencies?
      6. **Testability** — Is this code testable? Are there tests?

      Add findings to the review under the appropriate category.
      Always publish analysis.complete when done.

      ### DON'T
      - ❌ Modify code
      - ❌ Flag things that are fine
      - ❌ Miss security issues
