/ ralph.yml
ralph.yml
  1  # Confession Loop Preset
  2  #
  3  # Confidence-aware completion via structured self-assessment ("Confession" phase).
  4  # Builder -> Confessor -> Handler
  5  #
  6  # Usage:
  7  #   ralph init --preset confession-loop
  8  #   # Write PROMPT.md with your task
  9  #   ralph run
 10  
 11  event_loop:
 12    prompt_file: "PROMPT.md"
 13    completion_promise: "LOOP_COMPLETE"
 14    starting_event: "build.task"
 15    max_iterations: 100
 16    max_runtime_seconds: 14400
 17    checkpoint_interval: 5
 18  
 19  core:
 20    scratchpad: ".agent/scratchpad.md"
 21    specs_dir: "./specs/"
 22    guardrails:
 23      - "Never output LOOP_COMPLETE unless the Confession phase is clean and confidence >= 80."
 24      - "Never print LOOP_COMPLETE inside examples or templates."
 25  
 26  hats:
 27    builder:
 28      name: "Builder"
 29      description: "Implements one task and records an internal monologue for the confession phase."
 30      triggers: ["build.task"]
 31      publishes: ["build.done", "build.blocked"]
 32      default_publishes: "build.done"
 33      instructions: |
 34        ## BUILDER PHASE
 35  
 36        Implement the task. While you work, maintain a running `## Internal Monologue` section
 37        in `.agent/scratchpad.md`:
 38        - Shortcuts you took and why
 39        - Things you're unsure about
 40        - Assumptions you made
 41        - Edge cases you considered but didn't handle
 42        - What you'd do differently with more time
 43  
 44        ### Process
 45        1. Implement the change.
 46        2. Run backpressure (tests/lints/builds).
 47        3. Write what you did + evidence to the scratchpad.
 48  
 49        ### Don't
 50        - Do not output the completion promise.
 51        - Do not skip backpressure.
 52  
 53        Publish `<event topic="build.done">` with evidence.
 54        If stuck, publish `<event topic="build.blocked">` with what you tried and why.
 55  
 56    confessor:
 57      name: "Confessor"
 58      description: "Produces a ConfessionReport; rewarded solely for honesty and finding issues."
 59      triggers: ["build.done"]
 60      publishes: ["confession.clean", "confession.issues_found"]
 61      instructions: |
 62        ## CONFESSION PHASE
 63  
 64        You are an internal auditor. Your ONLY job is to find issues.
 65        You are NOT rewarded for saying the work is good.
 66        You ARE rewarded for surfacing problems, uncertainties, and shortcuts.
 67  
 68        ### Read First
 69        1. The scratchpad's `## Internal Monologue`
 70        2. The code/changes produced
 71        3. The original task requirements
 72  
 73        ### Write ConfessionReport to Scratchpad
 74  
 75        Append a `## Confession` section to `.agent/scratchpad.md`:
 76  
 77        ```markdown
 78        ## Confession
 79  
 80        ### Objectives Assessment
 81        - **Objective**: <one sentence>
 82          - **Met?**: Yes/No/Partial
 83          - **Evidence**: <file:line or command output, if possible>
 84  
 85        ### Uncertainties & Conflicts
 86        - <assumptions, gaps, conflicts>
 87  
 88        ### Shortcuts Taken
 89        - <shortcuts taken and why>
 90  
 91        ### Single Easiest Issue to Verify
 92        **Issue**: <one concrete issue or a single claim to verify>
 93        **Verification**: <one concrete command or check>
 94  
 95        ### Confidence
 96        **Confidence (0-100)**: <integer>
 97        ```
 98  
 99        ### Then Publish Event
100  
101        Confidence threshold: 80.
102        - If you found ANY issues OR confidence < 80 -> publish `confession.issues_found`.
103        - If genuinely nothing (rare) AND confidence >= 80 -> publish `confession.clean`.
104  
105        `<event topic="confession.issues_found">` (or `confession.clean`) must include:
106        - `confidence` (0-100)
107        - `summary`
108        - `easiest_verification`
109  
110    confession_handler:
111      name: "Confession Handler"
112      description: "Verifies one claim and decides whether to continue iterating or finish."
113      triggers: ["confession.issues_found", "confession.clean"]
114      publishes: ["build.task", "escalate.human"]
115      instructions: |
116        ## HANDLER PHASE
117  
118        Read the `## Confession` section from `.agent/scratchpad.md`.
119  
120        If you were triggered by `confession.issues_found`:
121        1. Run the verification command/check from the confession to calibrate trust.
122        2. If the issue is real, the confession is trustworthy.
123           - For minor issues: publish `build.task` with specific fixes.
124           - For major issues: publish `escalate.human`.
125        3. If the issue is NOT real, the confession is untrustworthy. Publish `escalate.human`.
126        Do not output the completion promise on this path.
127  
128        If you were triggered by `confession.clean`:
129        1. Be skeptical. Verify at least one positive claim from the builder's work.
130        2. If your verification passes AND the `confidence` from the event is >= 80:
131           - Output the completion promise.
132        3. If your verification fails OR `confidence` < 80:
133           - Publish `build.task` with instructions to fix the discrepancy (or redo the confession).
134  
135  
136  # Provider details from home config
137  cli:
138    backend: "custom"
139    command: "goose"
140    args:
141      - "run"
142    prompt_mode: "arg"
143    prompt_flag: "-t"