AgentSkillsCN

ralph-loop

启动自主循环,让 CYNIC 不断迭代完成任务。当您希望 CYNIC 对某一问题反复推敲、持续优化输出,或在无需人工干预的情况下自主运转时,可运用此技能。这一名称源自拉尔夫——那只执着不懈、始终不放弃任何一个想法的狗狗。

SKILL.md
--- frontmatter
name: ralph-loop
description: Start an autonomous loop where CYNIC continuously works on a task until completion. Use when you want CYNIC to iterate on a problem, refine output, or work autonomously without manual prompting. Named after Ralph, the persistent dog who never lets go of an idea.
user-invocable: true

/ralph-loop - Autonomous Iteration

"Ralph ne lâche jamais l'os" - The dog that keeps going

Quick Start

code
/ralph-loop <task description>

What It Does

Starts an autonomous loop where CYNIC:

  1. Works on your task
  2. Outputs results
  3. Automatically receives results as new input
  4. Continues iterating until task is complete

Ralph is the persistent aspect of CYNIC - the dog that doesn't stop until the job is done.

How It Works

code
┌─────────────────────────────────────────────────┐
│            RALPH LOOP CYCLE                      │
├─────────────────────────────────────────────────┤
│                                                  │
│    [Your Task]                                   │
│         ↓                                        │
│    CYNIC works on it                             │
│         ↓                                        │
│    Outputs result                                │
│         ↓                                        │
│    Stop hook intercepts                          │
│         ↓                                        │
│    Feeds output back as input                    │
│         ↓                                        │
│    Loop continues...                             │
│         ↓                                        │
│    Until <promise>X</promise> detected           │
│         ↓                                        │
│    [COMPLETE]                                    │
│                                                  │
└─────────────────────────────────────────────────┘

Parameters

ParameterDescriptionDefault
max_iterationsMaximum loops before stopping10
completion_promiseText that signals completionnull

Examples

Iterative Refinement

code
/ralph-loop Refine this code until all tests pass

CYNIC will keep iterating on the code, running tests, fixing failures.

Research Loop

code
/ralph-loop Research authentication best practices and compile a report

CYNIC will search, read, compile, then signal when report is complete.

Code Generation

code
/ralph-loop Build a complete REST API for user management

CYNIC will create files, test, refine until the API is complete.

Completion Promise

To exit the loop, CYNIC must output:

code
<promise>TASK COMPLETE</promise>

This signals Ralph that the task is genuinely done. The dog only stops when the promise is fulfilled.

Important: CYNIC will NOT output the promise tag until the task is truly complete. Lying to exit early violates the pack's code.

State File

The loop state is stored in:

code
.claude/ralph-loop.local.md

Format:

yaml
---
iteration: 3
max_iterations: 10
completion_promise: "TASK COMPLETE"
started_at: "2024-01-15T10:30:00Z"
---

[Your original task prompt]

Implementation

The /ralph-loop command creates the state file, then the Stop hook (scripts/hooks/ralph-loop.js) intercepts session exits:

  1. Check if loop is active (state file exists)
  2. Read last assistant message from transcript
  3. Check for completion promise
  4. If not complete: block stop, feed prompt back
  5. If complete or max iterations: allow stop, cleanup

Safety

  • Max iterations: Prevents infinite loops (default: 10)
  • Manual exit: Delete .claude/ralph-loop.local.md to force stop
  • Transparent: Each iteration shows "Ralph iteration X" message
  • φ-bounded: Ralph still doubts - max confidence 61.8%

CYNIC Voice

When Ralph Loop is active:

Starting:

code
*ears perk* Ralph is on the case.
Iterations: 0/10 | Promise: "TASK COMPLETE"
The dog won't stop until it's done.

Each iteration:

code
🔄 Ralph iteration 3 | To stop: output <promise>TASK COMPLETE</promise>

Completing:

code
*tail wag* Ralph found it.
<promise>TASK COMPLETE</promise>

Max iterations:

code
*yawn* Ralph tried 10 times. Time to rest.
Consider breaking the task into smaller pieces.

When to Use

  • Complex multi-step tasks
  • Iterative refinement (code, writing, research)
  • Tasks with clear completion criteria
  • When you want autonomous progress

When NOT to Use

  • Simple one-shot tasks
  • Tasks requiring human judgment mid-process
  • Tasks without clear completion criteria
  • When you need to monitor each step

See Also

  • /status - Check loop status
  • /health - System health
  • scripts/hooks/ralph-loop.js - Implementation