Skip to content

Comments

feat: improve vibe loop (stop condition no longer promise complete but instead jq no passes=false stories) and add codex support#93

Open
NNTin wants to merge 2 commits intosnarktank:mainfrom
NNTin:main
Open

feat: improve vibe loop (stop condition no longer promise complete but instead jq no passes=false stories) and add codex support#93
NNTin wants to merge 2 commits intosnarktank:mainfrom
NNTin:main

Conversation

@NNTin
Copy link

@NNTin NNTin commented Feb 9, 2026

Sometimes the Claude Agent repeats the instruction to say COMPLETE when it is almost done - even though it is not done. This ends the vibe loop prematurely.

The check has instead moved to

  REMAINING_STORIES="$(jq '.userStories[] | select(.passes == false) | {id, title, passes}' "$PRD_FILE")"
  if [[ -z "$REMAINING_STORIES" ]]; then
    echo ""
    echo "Ralph completed all tasks!"
    echo "Completed at iteration $i of $MAX_ITERATIONS"
    exit 0
  fi

With this done Codex support is now easier done and thus was also added.
Tested the ralph loop here with Codex and Claude, confirmed it is working.

@greptile-apps
Copy link

greptile-apps bot commented Feb 9, 2026

Greptile Overview

Greptile Summary

This PR improves the vibe loop completion detection by replacing the unreliable <promise>COMPLETE</promise> output parsing with a robust PRD-based check using jq to count remaining incomplete stories. The PR also adds Codex CLI support as a third tool option alongside Amp and Claude Code.

Key Changes:

  • Replaced output string parsing with check_prd_completion() function that directly queries prd.json for stories with passes == false
  • Added --tool codex option with appropriate command invocation using codex exec --dangerously-bypass-approvals-and-sandbox
  • Updated all documentation files (README.md, AGENTS.md, CLAUDE.md, prompt.md) to reflect new completion pattern and Codex support
  • Removed instruction for agents to output <promise>COMPLETE</promise> from agent prompt files

Rationale:
The previous approach was brittle - agents would sometimes repeat the completion instruction prematurely. The new approach is more reliable as it checks the source of truth (prd.json) rather than parsing agent output.

Confidence Score: 4/5

  • This PR is safe to merge with one minor verification needed
  • The core improvement (PRD-based completion checking) is well-implemented and solves a real problem. The new check_prd_completion() function properly handles edge cases with error checking. Codex integration follows the same pattern as existing tools. Only concern is the potentially incorrect Codex documentation URL in README.md which should be verified.
  • README.md - verify Codex documentation link is correct

Important Files Changed

Filename Overview
ralph.sh Replaced <promise>COMPLETE</promise> check with PRD-based completion function; added Codex support
AGENTS.md Updated documentation to reflect Codex support and new completion pattern
CLAUDE.md Simplified stop condition instructions - removed <promise>COMPLETE</promise> requirement
README.md Added Codex references throughout documentation including installation and usage
prompt.md Simplified stop condition instructions - removed <promise>COMPLETE</promise> requirement

Sequence Diagram

sequenceDiagram
    participant User
    participant Ralph as ralph.sh
    participant PRD as prd.json
    participant Tool as AI Tool (Amp/Claude/Codex)
    
    User->>Ralph: Start with --tool [amp|claude|codex]
    loop For each iteration (max 10)
        Ralph->>Tool: Execute with prompt.md or CLAUDE.md
        Tool->>PRD: Work on story, update passes=true
        Tool-->>Ralph: Complete iteration
        Ralph->>PRD: Check completion (jq query)
        alt All stories passes=true
            Ralph->>User: Exit: All tasks complete
        else Stories remain
            Ralph->>Ralph: Continue to next iteration
        end
    end
    Ralph->>User: Exit: Max iterations reached
Loading

Copy link

@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.

5 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@NNTin
Copy link
Author

NNTin commented Feb 9, 2026

PS: I just noticed that support for Codex was declined in past PRs. If this is still the case I can remove the Codex reference and just address the vibe loop + stop condition.
Because of the new stop condition the prompt itself does not directly cause codex to stop so my solution is shorter than others. (Running codex "prompt" outputs it directly to stdout so the instruction causes it to immediately stop.)

Please let me know. I think the vibe loop improvement is a good addition.

@NNTin
Copy link
Author

NNTin commented Feb 20, 2026

@snarktank thoughts on the vibe loop improvement? I can remove the codex support if undesired.
relying on the <promise>COMPLETE</promise> signal is unreliable when the agent repeats the instruction.

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.

1 participant