← Catalog

@pi-unipi/ralph

Long-running iterative development loops for Pi coding agent

Extension

Install

Install with PiG

pig install npm:@pi-unipi/ralph

Install with Pi

pi install npm:@pi-unipi/ralph
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "skills": [
    "./SKILL.md"
  ],
  "themes": [],
  "prompts": [],
  "extensions": [
    "./index.ts"
  ]
}

README

Written by the package's publisher, shown as published in version 2.20.5 (README.md). PiG does not review it.

@pi-unipi/ralph

Long-running iterative loops that persist across sessions. Start a loop, the agent works through tasks, calls ralph_done after each step, and reflects periodically. If the session crashes or you close Pi, the loop resumes where it left off.

Ralph is for work that takes more than one pass — migrating a codebase, implementing a multi-step feature, or processing a backlog. The agent iterates until the task is done or it hits the iteration limit.

Commands

CommandDescription
/unipi:ralph start <name|path>Start a new loop
/unipi:ralph stopPause current loop
/unipi:ralph resume <name>Resume a paused loop
/unipi:ralph statusShow all loops
/unipi:ralph cancel <name>Delete loop state
/unipi:ralph archive <name>Move loop to archive
/unipi:ralph clean [--all]Clean completed loops
/unipi:ralph list --archivedShow archived loops
/unipi:ralph nuke [--yes]Delete all ralph data

Command arguments autocomplete: subcommands with descriptions, live loop names with status, and start flags are suggested as you type.

Options

FlagDescription
--max-iterations NStop after N iterations (default: 50)
--items-per-iteration NSuggest N items per turn (prompt hint)
--reflect-every NReflect every N iterations

Special Triggers

The workflow work skill detects ralph and encourages loops when a plan has 3 or more subtasks. Instead of executing everything in one pass, the agent starts a ralph loop and iterates through the checklist.

Ralph registers with the info-screen dashboard, showing active loops, total iterations, and loop status. The footer package subscribes to RALPH_LOOP_START, RALPH_LOOP_END, and RALPH_ITERATION_DONE events to display loop stats in the status bar.

How the Agent Uses Ralph

  1. Agent calls ralph_start with a task description and checklist
  2. Ralph creates a task file in .unipi/ralph/ and begins the loop
  3. Agent works on the first checklist item, then calls ralph_done
  4. Ralph marks the item complete and returns the next iteration
  5. At reflection intervals, the agent pauses to review progress
  6. When all items are done (or max iterations reached), the loop ends

The ralph_done tool signals completion of one iteration. The agent decides what to do each iteration — ralph just tracks progress and persists state.

Task File Format

Loops operate on markdown task files:

# Task

Redesign the authentication system.

## Goals
- Migrate to JWT refresh tokens
- Add role-based access control

## Checklist
- [x] Design token rotation
- [ ] Implement refresh endpoint
- [ ] Add RBAC middleware
- [ ] Write tests

## Notes
Session 1: Completed token rotation design.

Configurables

Loop behavior is controlled per-invocation via flags:

SettingDefaultWhat It Does
max-iterations50Hard stop after N iterations
items-per-iteration3Hint for how many checklist items per pass
reflect-every5Iterations between reflection prompts

These are set when starting a loop, not in a config file. Each loop can have different settings.

State Storage

.unipi/ralph/
├── loop-name.state.json    ← active/paused state
├── loop-name.md            ← task file
└── archive/
    └── loop-name.*         ← archived loops

State persists across sessions. Close Pi, reopen, resume the loop — it picks up where it left off.

License

MIT