Skip to content

Add Ralph autonomous development workflow#728

Merged
chrisaddy merged 21 commits intomasterfrom
feature/ralph
Jan 28, 2026
Merged

Add Ralph autonomous development workflow#728
chrisaddy merged 21 commits intomasterfrom
feature/ralph

Conversation

@chrisaddy
Copy link
Copy Markdown
Collaborator

@chrisaddy chrisaddy commented Jan 26, 2026

Summary

  • Add mask ralph spec [issue] command for interactive spec building via Claude conversation
  • Add mask ralph loop <issue> command for autonomous implementation with pre-flight checks, label management, and PR creation
  • Add mask ralph backlog command for reviewing open issues for duplicates, overlaps, and staleness
  • Add mask ralph pr [--pr <number>] command for processing PR review feedback interactively
  • Create SPEC.md issue template with standard format (Problem, Requirements, Open Questions, Decisions, Specification)
  • Document Ralph workflow in CLAUDE.md including labels, workflow steps, and context rotation guidelines
  • Create in-progress, needs-attention, and backlog-review labels for workflow tracking

Test plan

  • Verify labels created: gh label list | grep -E "in-progress|needs-attention|backlog-review"
  • Verify commands registered: mask ralph --help
  • Test pre-flight checks catch uncommitted changes
  • Test mask ralph spec creates new issue with template
  • Test mask ralph spec <issue> starts interactive session
  • Test full loop execution on a simple spec
  • Test mask ralph backlog creates tracking issue and posts report
  • Test mask ralph pr on a PR with review comments

Closes #723
Closes #727
Closes #729

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation

    • Added Ralph autonomous development workflow documentation including commands, automation details, and best practices.
    • Updated issue template to specification-focused format with structured sections for goals, specifications, and implementation notes.
  • New Features

    • Added development workflow validation and dependency checking tooling.
  • Configuration

    • Enhanced development environment with additional package support.

✏️ Tip: You can customize this high-level summary in your review settings.

Integrate Ralph pattern for autonomous AI development loops using GitHub
issues as specs. This enables structured spec refinement and autonomous
implementation with proper context rotation.

Changes:
- Add mask ralph spec command for interactive spec building
- Add mask ralph loop command for autonomous implementation
- Create SPEC.md issue template with standard format
- Document Ralph workflow in CLAUDE.md
- Create in-progress and needs-attention labels

The workflow uses GitHub issue checkboxes as state, labels for lifecycle
tracking (refining -> ready -> in-progress), and pre-commit hooks as
the verification gate.

Closes #723

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings January 26, 2026 16:45
@github-project-automation github-project-automation Bot moved this to To Do in Overview Jan 26, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 26, 2026

📝 Walkthrough

Walkthrough

This PR adds Ralph autonomous development workflow infrastructure including documentation in CLAUDE.md, CLI command definitions in maskfile.md (with a noted duplicate block), updated issue template for spec-based workflows, environment configuration for jq dependency, and a new preflight validation script for dependency checking.

Changes

Cohort / File(s) Summary
Ralph Workflow Documentation
CLAUDE.md, maskfile.md
Added Ralph workflow documentation block (CLAUDE.md) detailing workflow phases, context rotation, and learnings. Extended maskfile.md with comprehensive Ralph command definitions (spec, loop, backlog, pr) including CLI-driven automation scripts. Note: maskfile.md contains a duplicate Ralph block requiring deduplication.
Environment & Tooling
.flox/env/manifest.toml, tools/ralph-preflight.sh
Added jq package path to flox environment manifest. Introduced new bash script implementing ralph_preflight() function that validates required CLI tools (gh always required; claude/jq conditional) and GitHub authentication status before workflow execution.
GitHub Templates
.github/ISSUE_TEMPLATE/ISSUE_TEMPLATE.md
Restructured issue template from generic "Issue" to specification-oriented "Spec" template with metadata (labels, projects), new sections (Specification, Implementation Notes, Open Questions, Decisions), and contextual placeholders for Ralph autonomous workflow integration.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add Ralph autonomous development workflow' directly summarizes the main change—introducing Ralph CLI commands and automation for the development workflow.
Linked Issues check ✅ Passed Code changes comprehensively implement requirements from #723, #727, and #729: Ralph spec/loop commands with preflight checks, backlog refinement, PR feedback processing, label lifecycle, templates, and documentation.
Out of Scope Changes check ✅ Passed All changes—maskfile commands, SPEC/CLAUDE documentation, labels, templates, and preflight tooling—are directly aligned with the linked issues' objectives and workflow integration requirements.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/ralph

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Jan 26, 2026

Greptile Overview

Greptile Summary

This PR implements the Ralph autonomous development workflow, adding commands for spec refinement (mask ralph spec), autonomous implementation loops (mask ralph loop), backlog management (mask ralph backlog), and PR review processing (mask ralph pr). The implementation includes proper error handling, temp file cleanup, and pre-flight checks for dependencies.

Key changes:

  • Added structured spec template for GitHub issues with Requirements, Decisions, and Specification sections
  • Implemented Ralph workflow commands with Claude CLI integration for autonomous development
  • Added workflow labels (in-refinement, ready, in-progress, attention-needed, backlog-review, ralph)
  • Created preflight validation script for dependency checking (jq, gh, claude)
  • Added comprehensive workflow documentation in CLAUDE.md with context rotation guidelines
  • Previous review feedback addressed: temp file trap moved before loops, proper cleanup handling

The workflow provides a complete autonomous development loop with checkboxes for tracking progress, git commit verification gates, and automatic PR creation on completion.

Confidence Score: 4/5

  • This PR is safe to merge with minor verification recommended
  • The implementation is well-structured with proper error handling, temp file cleanup, and pre-flight checks. Previous review feedback has been addressed (trap placement fixed). The main consideration is verifying that all referenced labels exist in the repository before the workflow can function fully, but this doesn't block merging since the setup command creates them.
  • Verify that all workflow labels mentioned in CLAUDE.md are created by the setup command before running other Ralph commands

Important Files Changed

Filename Overview
.github/ISSUE_TEMPLATE/ISSUE_TEMPLATE.md Converted generic issue template to structured spec template with sections for requirements, decisions, and implementation
CLAUDE.md Added Ralph workflow documentation including commands, labels, workflow steps, and completion signals - references labels that may not exist yet
maskfile.md Added comprehensive Ralph autonomous development commands (setup, spec, loop, backlog, pull-request) with proper error handling and temp file cleanup
tools/ralph-preflight.sh Added shared preflight validation script for Ralph commands to check required dependencies

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 files reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

Comment thread maskfile.md Outdated
Comment thread maskfile.md Outdated
Comment thread CLAUDE.md Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 10

🤖 Fix all issues with AI agents
In @.github/ISSUE_TEMPLATE/SPEC.md:
- Around line 12-13: Update the SPEC template to remind users to manually
replace the date placeholders by adding an inline comment or note next to the
"**Created:** YYYY-MM-DD" and "**Last discussed:** YYYY-MM-DD" lines (search for
the exact "YYYY-MM-DD" strings or heading tokens "**Created:**" and "**Last
discussed:**") that instructs maintainers that GitHub does not inject dates and
they must update these fields manually.
- Line 6: Replace the hardcoded project reference projects:
["pocketsizefund/11"] in the issue templates (BUG.md, FEATURE.md, SPEC.md) with
the correct project identifier or remove the projects field entirely; locate the
exact string projects: ["pocketsizefund/11"] in each template and either change
it to projects: ["oscmcompany/1"] (per README) or delete that line so
contributors can manually assign issues.

In `@CLAUDE.md`:
- Around line 81-83: Rename the subsection header "### Wiggum Learnings" to "###
Ralph Learnings" so the title matches the description; locate the header string
"### Wiggum Learnings" in the CLAUDE.md content and replace it with "### Ralph
Learnings" (leave the following paragraph "Document failure patterns here after
Ralph loops to prevent recurrence:" unchanged).

In `@maskfile.md`:
- Around line 738-1064: The issue: the Ralph workflow assumes labels (refining,
ready, in-progress, needs-attention) exist but never creates or documents them;
add a setup step that creates these labels before first use. Implement a new
"ralph setup" command/section in maskfile.md that iterates the four label specs
(names, colors, descriptions) and uses gh label create (or skips if exists via
gh label list) to ensure labels exist, and update documentation/CLAUDE.md to
instruct running "mask ralph setup" before using "mask ralph spec" or "mask
ralph loop"; reference the label names
("refining","ready","in-progress","needs-attention"), the new command name
("mask ralph setup" or "ralph setup"), and use "gh label create" / "gh label
list" in the implementation.
- Around line 770-808: The inline template assigned to template_body in the spec
command diverges from the canonical .github/ISSUE_TEMPLATE/SPEC.md (missing
front matter and mismatched labels); update the spec command to load and use the
SPEC.md content instead of duplicating it inline by replacing the heredoc
assignment to template_body with code that reads .github/ISSUE_TEMPLATE/SPEC.md
(extracting the body after the front-matter and substituting dates), and ensure
the labels passed (e.g., "refining" and "feature") match the front-matter so
both sources remain identical.
- Around line 770-808: The heredoc assigned to template_body uses a
single-quoted delimiter (cat <<'TEMPLATE') which prevents command substitution
so $(date +%Y-%m-%d) will be literal; change the heredoc to an unquoted
delimiter (cat <<TEMPLATE) so command substitution runs, and escape any dollar
signs you want to remain literal inside the template; update the template_body
assignment accordingly (look for template_body and the heredoc start cat
<<'TEMPLATE').
- Around line 996-1011: The PR body template stored in pr_body is missing the
required completion marker; update the pr_body construction to append the
literal tag <promise>COMPLETE</promise> (alongside existing "Closes
#${issue_number}") so the loop detector that checks for that marker can detect
completion; ensure you modify the block that builds pr_body (uses variables
pr_body, issue_number, iteration) to include the tag before EOF.
- Around line 1031-1043: The modified_files report uses `git diff --name-only
origin/master` while the branch may not be pushed, so the posted failure_comment
can show an incomplete diff; ensure the branch is pushed before generating
modified_files and building failure_comment (e.g., run a push for branch_name
such as `git push --set-upstream origin ${branch_name}`) so the comparison
reflects the remote state, and/or change the modified_files logic to compare
against the local HEAD only if push fails and clearly indicate that the branch
wasn't pushed in the failure_comment; update the modified_files assignment and
the failure_comment construction to reference this pushed-or-local status.
- Around line 878-884: The script hardcodes "master" as the default branch;
change it to detect the repo's actual default branch and compare against that.
Replace the fixed "master" check using current_branch=$(git rev-parse
--abbrev-ref HEAD) by computing default_branch dynamically (e.g., use git
symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed
's|refs/remotes/origin/||' or fallback to parsing git remote show origin or
checking for "main"/"master"), then compare current_branch to default_branch and
adjust the echo/exit logic (references: current_branch, default_branch, git
rev-parse, git symbolic-ref, git remote show origin).
- Around line 974-979: The CLI invocation that launches Claude (the line
containing the claude command with arguments including
"--dangerously-skip-permissions") must not silently disable permissions; remove
the "--dangerously-skip-permissions" flag from the claude invocation and instead
restrict tools via Claude's config (explicitly enable only required tools like
git/test runners) or add an explicit user-acknowledgement step before running
the loop (e.g., a confirmation prompt/check) so autonomous iterations cannot
perform destructive shell/git actions without consent; update the invocation
string and document the required tool permissions accordingly.

Comment thread .github/ISSUE_TEMPLATE/SPEC.md Outdated
Comment thread .github/ISSUE_TEMPLATE/SPEC.md Outdated
Comment thread CLAUDE.md Outdated
Comment thread maskfile.md
Comment thread maskfile.md Outdated
Comment thread maskfile.md Outdated
Comment thread maskfile.md
Comment thread maskfile.md
Comment thread maskfile.md Outdated
@github-project-automation github-project-automation Bot moved this from To Do to In Progress in Overview Jan 26, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a “Ralph” autonomous development workflow to the repo by introducing Mask commands for spec refinement and autonomous implementation loops, plus supporting documentation/templates.

Changes:

  • Adds mask ralph spec [issue_number] to create/refine GitHub-issue-backed specs via an interactive Claude session.
  • Adds mask ralph loop <issue_number> to run an autonomous implementation loop with pre-flight checks, label transitions, and PR creation on completion.
  • Introduces a SPEC.md GitHub issue template and documents the Ralph workflow in CLAUDE.md.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 8 comments.

File Description
maskfile.md Adds the ralph spec and ralph loop Mask tasks that create/refine spec issues and run the autonomous loop.
CLAUDE.md Documents Ralph commands, labels, workflow steps, and completion signal.
.github/ISSUE_TEMPLATE/SPEC.md Adds a standardized spec issue template (Problem/Requirements/Open Questions/Decisions/Specification).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread maskfile.md Outdated
Comment thread maskfile.md Outdated
Comment thread maskfile.md
Comment thread maskfile.md Outdated
Comment thread maskfile.md Outdated
Comment thread maskfile.md Outdated
Comment thread maskfile.md Outdated
Comment thread maskfile.md
Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 files reviewed, 4 comments

Edit Code Review Agent Settings | Greptile

Comment thread maskfile.md Outdated
Comment thread maskfile.md Outdated
Comment thread maskfile.md Outdated
Comment thread CLAUDE.md Outdated
chrisaddy and others added 2 commits January 26, 2026 12:03
Implements #727: Adds a new command to the Ralph workflow that analyzes
open GitHub issues for:
- Potential duplicates or overlapping issues
- Stale issues (no activity for 60+ days)
- Issues that may already be implemented (via codebase search)
- Consolidation opportunities

The command posts analysis results as comments on a dedicated
"Backlog Review" tracking issue, creating it if it doesn't exist.

Key features:
- On-demand execution via `mask ralph backlog`
- Uses Claude to analyze issue similarities and search codebase
- Suggestions only (no auto-closing)
- Includes confidence levels on findings
- Creates/reuses backlog-review labeled tracking issue

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add backlog command to the Ralph Workflow documentation and include
the new backlog-review label in the labels section.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings January 26, 2026 17:04
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@maskfile.md`:
- Around line 814-815: The command uses an undocumented label --label "feature"
which will fail because "feature" is not in the repository labels per CLAUDE.md;
remove the --label "feature" argument (or replace it with one of the documented
labels such as "refining", "ready", "in-progress", "needs-attention", or
"backlog-review") so the command only uses valid labels and succeeds (search for
the string --label "feature" in maskfile.md to locate and update it).
♻️ Duplicate comments (13)
CLAUDE.md (2)

59-62: Verify that workflow labels exist before first use.

The workflow requires four labels (refining, ready, in-progress, needs-attention), but the PR objectives mention creating only two (in-progress and needs-attention). The commands will fail if refining or ready labels don't exist.


90-90: Rename "Wiggum Learnings" to "Ralph Learnings" for consistency.

The subsection contradicts its description: "Document failure patterns here after Ralph loops." The entire workflow is named "Ralph," and "Wiggum" appears nowhere else in the codebase or documentation.

maskfile.md (11)

770-808: Command substitution not evaluated in single-quoted heredoc.

The heredoc uses <<'TEMPLATE' (single-quoted delimiter), which prevents shell expansion. Line 773's $(date +%Y-%m-%d) will be inserted literally as the string $(date +%Y-%m-%d) rather than the actual date.


770-808: Template duplication with .github/ISSUE_TEMPLATE/SPEC.md.

The inline template differs from the canonical file template. Maintaining two copies will cause drift.


824-826: Consider using gh --jq flag to simplify parsing.

The current approach pipes gh output through jq, which works but requires jq as a separate dependency.


878-884: Hardcoded "master" branch may not work for repositories using "main".

The pre-flight checks assume the default branch is "master", but many repositories use "main" as their default branch.


894-900: Silent error handling could hide authentication or network failures.

The || echo "" fallback silently converts gh issue view failures (missing auth, network errors) into an empty labels list, producing a misleading error message about the missing ready label.


962-972: Trap inside loop causes temp file leak.

Creating tmpfile and setting trap inside the loop (lines 971-972) means each iteration overwrites the trap, so only the last temp file gets cleaned up. Earlier iterations' temp files will remain on disk.


974-983: Pipeline failure with set -euo pipefail leaves issue in inconsistent state.

Any failure in the claude | grep | tee | jq pipeline will abort the script immediately, leaving the issue labeled in-progress without transitioning to needs-attention or posting a failure comment.


978-978: Security risk: --dangerously-skip-permissions disables all permission prompts.

This flag allows Claude to execute any operation without user confirmation. A malicious or compromised issue spec could use prompt injection to execute arbitrary commands when mask ralph loop runs.


996-1011: Missing <promise>COMPLETE</promise> marker in PR body.

The PR objectives specify including the completion marker in the PR body, but the template (lines 996-1011) only includes Closes #${issue_number} without the <promise>COMPLETE</promise> tag detected on line 986.


1031-1043: Branch not pushed before failure report, making review difficult.

Line 1031 reports modified files using git diff --name-only origin/master, but the branch hasn't been pushed when max iterations is reached. Reviewers checking the failure comment won't be able to access the branch.


738-1064: Labels assumed to exist but never created.

The Ralph commands use four labels (refining, ready, in-progress, needs-attention), but there's no command or documentation for creating them before first use.

Comment thread maskfile.md Outdated
Implements #729: Adds a command to process PR review feedback with
two phases:

Planning (Interactive):
- Auto-detects PR from current branch (or use --pr flag)
- Fetches unresolved review threads via GraphQL API
- Presents each suggestion one by one
- User can Accept, Skip, Modify, or Quit
- Builds a plan of approved changes

Execution (Autonomous):
- Claude implements all approved suggestions
- Commits changes with meaningful messages
- Posts reply to each thread explaining what was done
- Resolves conversations via GraphQL API
- Pushes changes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread maskfile.md Outdated
Comment thread maskfile.md
Comment thread maskfile.md Outdated
Comment thread maskfile.md Outdated
chrisaddy and others added 2 commits January 26, 2026 12:22
- Remove dates from spec template (issue state has date info)
- Move tmpfile creation and trap outside loop to prevent orphaned temp files
- Add ERR trap handler to clean up and update labels on unexpected exits
- Add explicit gh auth status check before fetching issue labels
- Add <promise>COMPLETE</promise> marker to PR body per requirements
- Push branch before posting failure comment so reviewers can access it
- Use --template flag for gh issue create instead of inline body
- Use JSON output for issue creation to reliably parse issue numbers
- Remove hardcoded pocketsizefund/11 project reference from all templates

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Link new issues to oscmcompany/1 project board automatically.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings January 26, 2026 17:23
Show first 3 lines of code blocks with line count summary instead of
full code. Makes review comments with large suggested diffs easier
to parse during interactive planning.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In @.github/ISSUE_TEMPLATE/SPEC.md:
- Line 1: Remove the trailing space on line 1 of the SPEC.md template: open
.github/ISSUE_TEMPLATE/SPEC.md and delete the extra whitespace at the end of the
first line so the file starts with a clean line without any trailing space.

In `@maskfile.md`:
- Around line 1412-1416: The PR uses the unsafe flag
--dangerously-skip-permissions when invoking the claude CLI (in the command that
sets result=$(claude ... --dangerously-skip-permissions --system-prompt
"${system_prompt}" "Implement the suggestions in the plan. Output results JSON
when done.") — replace this with an explicit, least-privilege permission option
or remove it and require an explicit consent flow, or add a clear
comment/docstring near the claude invocation referencing the security trade-off
and linking to an explicit permission configuration; update the invocation site
(the claude call and any callers that set system_prompt/result) to use the safer
permission mechanism or document the justification.
♻️ Duplicate comments (7)
CLAUDE.md (2)

58-65: Verify that all documented labels exist in the repository.

The PR description mentions creating in-progress and needs-attention labels, but the workflow also requires refining and ready labels. Ensure all five labels exist before using the Ralph workflow.

#!/bin/bash
# Verify all Ralph workflow labels exist

required_labels=("refining" "ready" "in-progress" "needs-attention" "backlog-review")

echo "Checking for required labels..."
existing_labels=$(gh label list --json name --jq '.[].name')

for label in "${required_labels[@]}"; do
    if echo "$existing_labels" | grep -q "^${label}$"; then
        echo "✓ Label '${label}' exists"
    else
        echo "✗ Label '${label}' is MISSING"
    fi
done

91-93: Rename "Wiggum Learnings" to "Ralph Learnings" for consistency.

The subsection title "Wiggum Learnings" contradicts its description which references "Ralph loops". This should be "Ralph Learnings" to match the workflow context throughout the document.

📝 Suggested fix
-### Wiggum Learnings
+### Ralph Learnings
maskfile.md (5)

773-774: Verify feature label exists or remove it.

Per learnings: "Only use labels already available on the GitHub repository." The feature label is used here but may not exist. Consider using only documented Ralph labels or verify the label exists first.

#!/bin/bash
# Check if 'feature' label exists
gh label list --json name --jq '.[].name' | grep -q "^feature$" && echo "Label exists" || echo "Label MISSING"

751-765: Add jq to the dependency checks.

The command uses jq at lines 777 and 787-788 but doesn't verify it's installed. With set -euo pipefail, this will fail with an unhelpful "command not found" error.

🔧 Proposed fix
 if ! command -v claude &> /dev/null; then
     echo "Claude CLI is required"
     exit 1
 fi
+
+if ! command -v jq &> /dev/null; then
+    echo "jq is required"
+    exit 1
+fi

840-854: Hardcoded "master" branch may not work for all repositories.

Many repositories use "main" as the default branch. Consider detecting the default branch dynamically.

🔧 Proposed fix
+default_branch=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's|refs/remotes/origin/||' || echo "master")
 current_branch=$(git rev-parse --abbrev-ref HEAD)
-if [ "$current_branch" != "master" ]; then
-    echo "Error: Not on master branch (currently on: ${current_branch})"
-    echo "Run: git checkout master"
+if [ "$current_branch" != "$default_branch" ]; then
+    echo "Error: Not on default branch ${default_branch} (currently on: ${current_branch})"
+    echo "Run: git checkout ${default_branch}"
     exit 1
 fi
-echo "  On master branch"
+echo "  On default branch (${default_branch})"

-echo "  Pulling latest master"
-if ! git pull --ff-only origin master; then
-    echo "Error: Could not pull latest master"
+echo "  Pulling latest ${default_branch}"
+if ! git pull --ff-only origin "$default_branch"; then
+    echo "Error: Could not pull latest ${default_branch}"
     echo "Resolve conflicts or check network/auth"
     exit 1
 fi
-echo "  Master is up to date"
+echo "  ${default_branch} is up to date"

964-972: Security concern: --dangerously-skip-permissions disables all permission prompts.

This flag allows Claude to execute any operation without user confirmation. Combined with feeding the GitHub issue body (which could contain prompt injection) as context, this creates a risk where a malicious issue spec could cause arbitrary command execution.

Consider:

  1. Removing the flag and configuring Claude's permissions explicitly via its configuration file
  2. Adding an explicit user acknowledgment before running the loop
  3. Documenting this security decision prominently if autonomous execution is required

1082-1096: Add jq to the dependency checks.

The command uses jq at lines 1135-1136 but doesn't verify it's installed.

🔧 Proposed fix
 if ! command -v claude &> /dev/null; then
     echo "Claude CLI is required"
     exit 1
 fi
+
+if ! command -v jq &> /dev/null; then
+    echo "jq is required"
+    exit 1
+fi

Comment thread .github/ISSUE_TEMPLATE/ISSUE_TEMPLATE.md
Comment thread maskfile.md
chrisaddy and others added 4 commits January 26, 2026 12:31
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ng master

Changed the ralph loop pre-flight checks to dynamically detect the repository's
default branch instead of assuming "master". This supports repositories that use
"main" or other branch names as their default.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Creates refining, ready, in-progress, needs-attention, and backlog-review
labels if they don't exist. Skips labels that already exist.

Run `mask ralph setup` once before using other Ralph commands.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@chrisaddy
Copy link
Copy Markdown
Collaborator Author

Re: @forstmeier's comment on maskfile.md line 783 (label colors): Applied the suggested color scheme:

  • ralph: #6f42c1 (purple - actor label)
  • in-refinement: #d93f0b (orange-red)
  • ready: #0e8a16 (green)
  • in-progress: #fbca04 (yellow)
  • attention-needed: #b60205 (red)
  • backlog-review: #0052cc (blue)

@chrisaddy
Copy link
Copy Markdown
Collaborator Author

Addressed @forstmeier's comments on maskfile.md lines 867 and 870: Added mask ralph ready <issue_number> as a separate command to mark specs as ready for implementation. This replaces the manual gh issue edit instruction. Updated CLAUDE.md documentation accordingly.

@chrisaddy
Copy link
Copy Markdown
Collaborator Author

Addressed @forstmeier's comment on maskfile.md line 1 (formatting): Removed separator lines (===) from echo output throughout the Ralph commands. Messages now use simple sentence case without decorative separators.

@chrisaddy
Copy link
Copy Markdown
Collaborator Author

Addressed @forstmeier's comments on maskfile.md lines 973 and 1030: Error comments now include diagnostic context - git status (last 20 files) and recent commits (last 5) are appended to the issue comment when the loop fails unexpectedly.

@chrisaddy
Copy link
Copy Markdown
Collaborator Author

Re: @forstmeier's comment on maskfile.md line 1086 (using existing templates): Keeping current behavior where Ralph uses its own simpler format for PRs. The spec template is already used for issues. Template integration for PRs could be explored in a follow-up if needed.

@chrisaddy
Copy link
Copy Markdown
Collaborator Author

Addressed @forstmeier's comment on maskfile.md line 1189: Created tools/ralph-preflight.sh with shared dependency checks. All Ralph commands now source this script and call ralph_preflight with flags for optional dependencies (--claude, --jq). This eliminates the duplicated check blocks across commands.

@chrisaddy
Copy link
Copy Markdown
Collaborator Author

Addressed @forstmeier's comments on maskfile.md lines 1207 and 1256: Removed staleness checking from mask ralph backlog since this is already handled by the stale workflow action. The backlog command now focuses on duplicates, overlaps, and potentially implemented issues.

@chrisaddy
Copy link
Copy Markdown
Collaborator Author

Addressed @forstmeier's comment on maskfile.md line 1263: Changed placeholder instructions in the backlog report template to HTML comments (<\!-- -->) so they'll be hidden if accidentally included in the output.

@chrisaddy
Copy link
Copy Markdown
Collaborator Author

Re: @forstmeier's comment on maskfile.md line 1295: The command is already named pull-request (not pr), which aligns with your preference. The CLAUDE.md docs reference it as mask ralph pr for brevity but could be updated to mask ralph pull-request if you'd like full consistency.

@chrisaddy
Copy link
Copy Markdown
Collaborator Author

Re: @forstmeier's comment on maskfile.md line 1373 (GraphQL usage): The gh pr view CLI doesn't expose review thread details like thread IDs, resolution status, or the ability to reply/resolve threads. GraphQL is necessary here to get the thread IDs needed for the addPullRequestReviewThreadReply and resolveReviewThread mutations later in the script.

@chrisaddy
Copy link
Copy Markdown
Collaborator Author

Addressed @forstmeier's comment about assignee field: The Ralph loop now automatically assigns the current GitHub user to the issue when starting work, and assigns them to the PR when it's created. Updated CLAUDE.md workflow documentation to reflect this.

Labels:
- Rename refining -> in-refinement, needs-attention -> attention-needed
- Add 'ralph' actor label for human/Ralph handoff flexibility
- Apply consistent color scheme per reviewer suggestion

Commands:
- Add 'mask ralph ready <issue_number>' command
- Extract shared preflight checks to tools/ralph-preflight.sh
- Auto-assign current GitHub user to issue and PR

Documentation:
- Change [issue] -> [issue_number] for clarity
- Add compaction note to Ralph Learnings section
- Document auto-assignment in workflow steps

Output formatting:
- Remove separator lines (===) from echo output
- Add git status and recent commits to error comments
- Use HTML comments for placeholders in backlog report

Removed:
- Staleness checking (handled by stale workflow action)

Template consolidation:
- Remove separate BUG.md, FEATURE.md, SPEC.md (merged via #722)
- Update consolidated ISSUE_TEMPLATE.md with in-refinement label

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment thread maskfile.md Outdated
@chrisaddy chrisaddy requested a review from forstmeier January 27, 2026 15:10
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Copilot AI review requested due to automatic review settings January 27, 2026 15:11
coderabbitai[bot]
coderabbitai Bot previously requested changes Jan 27, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@maskfile.md`:
- Around line 829-833: Update the system prompt text that still instructs to use
a "Problem" section so it matches the current spec template which uses
"Description": find and replace the literal prompt phrase "Problem" with
"Description" in the system instruction block (also ensure the negative
instruction about adding the 'ready' label remains unchanged). Verify any other
occurrences of the word "Problem" in the prompt template are updated to
"Description" so headings won't be mismatched when generating specs.
- Around line 746-751: The preflight script invoked by source
"${MASKFILE_DIR}/tools/ralph-preflight.sh" and called via ralph_preflight
doesn't verify jq, causing ralph setup to fail when jq is missing; update the
ralph-preflight logic to include jq in its required tools check (e.g., add a
command -v jq or include "jq" in the required tools list) and ensure the script
exits with a clear error if jq is not found so ralph_preflight will fail fast
with a helpful message.

Comment thread maskfile.md
Comment thread maskfile.md
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 13 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread maskfile.md
Comment thread maskfile.md
Comment thread maskfile.md
Comment thread maskfile.md
Comment thread maskfile.md
Comment thread CLAUDE.md
Comment thread tools/ralph-preflight.sh
Comment thread maskfile.md
Comment thread maskfile.md
Comment thread maskfile.md
Copy link
Copy Markdown
Collaborator

@forstmeier forstmeier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. 👍

Bots have a few points of feedback to address but after that we can just cut additional stories based on anything they find and merge this.

@chrisaddy chrisaddy merged commit 8ae5db7 into master Jan 28, 2026
9 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Overview Jan 28, 2026
@chrisaddy chrisaddy deleted the feature/ralph branch January 28, 2026 03:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

3 participants