Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 22, 2026

Implements the Ralph Loop pattern: an AI workflow that iterates through a PRD task list, executing each task autonomously with human oversight via PR review.

Core Components

  • .github/workflows/ralph-loop-basic.md - Workflow reads JSON PRD, selects first incomplete task with satisfied dependencies using jq, executes via Copilot engine, updates task status, logs progress, creates PR for review
  • examples/ralph/prd-example.json - PRD schema with tasks containing id, title, description, status, priority, dependencies[]
  • examples/ralph/README.md - Usage instructions, customization options, troubleshooting

Task Selection Logic

# Finds first incomplete task where all dependencies are complete
jq -r '.tasks[] | 
  select(.status == "incomplete") |
  select(
    (.dependencies | length) == 0 or
    all(.dependencies[]; . as $dep | any(.tasks[]; .id == $dep and .status == "complete"))
  )'

Workflow Pattern

Each run processes one task:

  1. Parse PRD → 2. Select task → 3. Execute with AI → 4. Quality checks → 5. Mark complete → 6. Create PR

Human merges PR, triggers next run for subsequent task. Continues until all tasks complete.

Security Model

Read-only permissions + safe-outputs.create-pull-request ensures human review before any repository modifications.

Original prompt

This section details on the original issue you should resolve

<issue_title>[plan] Create basic Ralph Loop workflow example</issue_title>
<issue_description>## Objective

Implement a basic Ralph Loop workflow that demonstrates the core pattern: iterating through a list of tasks until all are complete.

Context

This is the foundational workflow that implements the Ralph Loop pattern. It should read a PRD-like structure, pick an incomplete task, execute it, and mark it complete.

Approach

  1. Create .github/workflows/ralph-loop-basic.md with:

    • Frontmatter defining the PRD structure (list of tasks)
    • Logic to find the first incomplete task
    • Execute the task using Copilot CLI
    • Mark task as complete
    • Commit changes if quality checks pass
  2. Use JSON file for task tracking (similar to prd.json in Ralph)

  3. Include minimal quality checks:

    • Basic linting
    • Unit tests (if applicable)
  4. Add progress tracking to append-only file

Files to Create

  • .github/workflows/ralph-loop-basic.md - Basic Ralph Loop workflow
  • examples/ralph/prd-example.json - Example PRD structure
  • examples/ralph/README.md - Usage instructions

Acceptance Criteria

  • Workflow reads tasks from JSON file
  • Workflow selects first incomplete task
  • Workflow executes task using AI engine
  • Workflow marks task complete on success
  • Workflow appends learnings to progress.txt
  • README explains how to use the example
    Related to Add Ralph Loop examples for agentic workflows #11132

AI generated by Plan Command for #11132

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 22, 2026 02:47
- Created .github/workflows/ralph-loop-basic.md workflow
- Created examples/ralph/prd-example.json task structure
- Created examples/ralph/README.md with usage instructions
- Compiled workflow to ralph-loop-basic.lock.yml

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement basic Ralph Loop workflow example Add Ralph Loop workflow example for iterative task execution Jan 22, 2026
Copilot AI requested a review from mnkiefer January 22, 2026 02:56
@pelikhan pelikhan closed this Jan 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[plan] Create basic Ralph Loop workflow example

3 participants