Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@tzachbon
Copy link
Owner

@tzachbon tzachbon commented Jan 22, 2026

Summary

  • Removes the ralph-wiggum plugin dependency by inlining loop control logic into the stop-hook
  • Adds comprehensive bats-core test suite (20 tests covering all functional requirements)
  • Adds GitHub Actions CI workflow for automated testing
  • Updates all documentation to reflect v3.0.0 changes

What Changed

Before (v2.x) After (v3.0.0)
Ralph Loop plugin controls loop Internal stop-hook controls loop
/implement invokes /ralph-loop skill /implement writes state + coordinator prompt
/cancel calls /cancel-ralph + deletes state /cancel deletes state files (stops loop)
Requires ralph-wiggum plugin No external dependencies

Breaking Changes

  • ralph-wiggum plugin is no longer required - simpler installation
  • Stop-hook now controls the execution loop internally (~50 lines of bash)
  • Same task format, same verification, same workflow

Test Plan

  • All 20 bats-core tests pass locally
  • ShellCheck passes on stop-watcher.sh
  • All JSON files validate correctly
  • POC integration test passes (blocks incomplete, allows complete, handles stop_hook_active)
  • Documentation updated (README, CLAUDE.md, TROUBLESHOOTING, MIGRATION)
  • GitHub Actions CI runs successfully

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Inlined stop-hook driven execution loop; removed external loop dependency.
  • Tests

    • Added CI workflow and comprehensive tests validating stop-hook/execution loop behaviors.
  • Documentation

    • Updated README, migration guide, troubleshooting, design, requirements, tasks, and reference docs for v3.0.0; revised command docs and usage guidance.
  • Chores

    • Bumped ralph-specum to v3.0.0 and ralph-speckit to v0.3.0; updated plugin marketplace manifests.

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

claude and others added 11 commits January 20, 2026 11:57
- Fix skill path to use ralph-wiggum:ralph-loop consistently
- Add 2-step coordinator prompt approach:
  1. Write prompt to .coordinator-prompt.md file
  2. Invoke skill with args to read the file
- This avoids shell argument parsing issues with multi-line prompts
- Bump version to 0.1.2
- Fix skill invocation path: ralph-loop:ralph-loop (matches specum)
- Fix install command: /plugin install ralph-loop@claude-plugins-official
- Keep error check skill as ralph-wiggum:ralph-loop (matches specum)
- Coordinator prompt file approach already added in previous commit
- Bump version to 0.2.0 (minor)

Key differences from specum (intentional enhancements):
- Richer state file with featureId, name, basePath, globalIteration
- Commit spec files before execution step
- Feature-based paths (.specify/specs/$feature/)
Skills added:
- smart-ralph: Core skill with common arguments (--commit, --no-commit, --quick)
- speckit-workflow: Comprehensive spec-kit process knowledge
- delegation-principle: Coordinator delegation rules
- communication-style: Concise output guidelines

Agents added:
- constitution-architect: Create/update project constitutions
- spec-analyst: Generate feature specifications
- plan-architect: Technical design and architecture
- task-planner: POC-first task breakdown

Also added smart-ralph skill to ralph-specum for consistency.

Bump version to 0.3.0
Fixes CodeRabbit review comments:
- Add `text` language tag to plain text code blocks in:
  - plugins/ralph-speckit/agents/plan-architect.md
  - plugins/ralph-speckit/skills/communication-style/SKILL.md
  - plugins/ralph-speckit/skills/delegation-principle/SKILL.md
  - plugins/ralph-speckit/skills/smart-ralph/SKILL.md
  - plugins/ralph-speckit/skills/speckit-workflow/SKILL.md
  - plugins/ralph-specum/skills/smart-ralph/SKILL.md
  - plugins/ralph-speckit/commands/implement.md

Also resolves merge conflicts from main branch.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
The plugin files were modified but version wasn't bumped,
causing the CI version check to fail.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add stop_hook_active check as FIRST operation to prevent infinite loops (FR-3)
- Add transcript path parsing and ALL_TASKS_COMPLETE detection (FR-2)
- Add globalIteration tracking with maxGlobalIterations safety limit (FR-7, FR-8)
- Add block JSON output {"decision": "block", "reason": "..."} (FR-1)
- Only block when phase = "execution" (FR-4)
- Use atomic temp file + mv pattern for iteration counter updates

This replaces the ralph-wiggum dependency by inlining loop control logic.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Remove "Ralph Loop Dependency Check" section entirely (FR-5)
- Remove "Invoke Ralph Loop" skill invocation section
- Add globalIteration: 1 and maxGlobalIterations: 100 to state init
- Update output to reference stop-hook instead of ralph-loop
- Remove Skill from allowed-tools list
- Keep coordinator prompt intact (executed directly now)

The stop-hook now controls the execution loop internally.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Remove step 1 that invoked ralph-loop:cancel-ralph skill (FR-6)
- Remove Task from allowed-tools list
- Add cleanup of .coordinator-prompt.md file
- Update output to reflect direct state deletion approach
- Note that stop-hook automatically stops when state file removed

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Update Quick Mode section to reference stop-hook instead of ralph-loop
- Remove skill invocation reference in quick mode execution

Co-Authored-By: Claude Opus 4.5 <[email protected]>
POC integration tests pass:
- Stop hook blocks exit when tasks incomplete
- Stop hook allows exit when ALL_TASKS_COMPLETE detected
- Stop hook exits immediately when stop_hook_active=true

All ralph-loop references removed from commands.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add bats-core tests for stop-watcher.sh (20 tests covering all FRs)
- Add GitHub Actions workflow for CI (bats, shellcheck, JSON validation)
- Update documentation (README, CLAUDE.md, TROUBLESHOOTING, MIGRATION)
- Remove all ralph-wiggum/ralph-loop references from ralph-specum
- Bump version to 3.0.0

Breaking changes:
- ralph-wiggum plugin is no longer required
- Stop-hook now controls the execution loop internally

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@coderabbitai
Copy link

coderabbitai bot commented Jan 22, 2026

📝 Walkthrough

Walkthrough

This PR inlines stop-hook loop control into stop-watcher.sh, removes the external Ralph Loop dependency, bumps plugin versions (ralph-specum → 3.0.0, ralph-speckit → 0.3.0), adds CI and tests, and updates docs/commands and the state schema for a self-contained execution loop.

Changes

Cohort / File(s) Summary
Plugin Manifests & Marketplace
/.claude-plugin/marketplace.json, plugins/ralph-specum/.claude-plugin/plugin.json
Bumped ralph-specum to 3.0.0 (description adds "No external dependencies."); bumped ralph-speckit to 0.3.0.
CI & Tests
.github/workflows/test.yml, plugins/ralph-specum/tests/stop-watcher.bats
New GitHub Actions workflow (bats, shellcheck, JSON lint) and an extensive Bats test suite validating stop-watcher loop-control, iteration limits, phase gating, transcript parsing, and cleanup.
Hook Implementation
plugins/ralph-specum/hooks/scripts/stop-watcher.sh
Rewritten to inline loop-control: phase gating, globalIteration/maxGlobalIterations, transcript ALL_TASKS_COMPLETE detection, atomic iteration increments, block/continuation JSON output, and cleanup of state/temp files; adds STOP_HOOK_ACTIVE gate and local config toggle.
Plugin Commands (docs & behavior)
plugins/ralph-specum/commands/implement.md, plugins/ralph-specum/commands/start.md, plugins/ralph-specum/commands/cancel.md
Removed external Ralph Loop checks; implement.md writes coordinator prompt and initializes globalIteration state; start.md documents stop-hook-driven quick mode and delegation rules; cancel.md simplifies cleanup to removing state and coordinator prompt files and updates front-matter allowed-tools.
Shared Skill & Protocols
plugins/ralph-specum/skills/smart-ralph/SKILL.md
Introduced formal State File JSON schema (adds globalIteration, maxGlobalIterations), renamed integration docs to "Execution Loop", and defined explicit Task/Coordinator signals (TASK_COMPLETE, ALL_TASKS_COMPLETE) with error/retry semantics.
Core Docs & Migration
README.md, CLAUDE.md, MIGRATION.md, TROUBLESHOOTING.md
Removed references to external Ralph Loop/ralph-wiggum, updated terminology to stop-hook/execution loop, rewrote migration steps to v3.0.0, and updated troubleshooting and command examples to the new flow.
Design & Specs
specs/ralph-integration-research/*
Added research, requirements, design, and task plans describing the inline stop-hook algorithm, state schema, acceptance criteria, and CI/testing strategy.
Removed/Refactored Docs
plugins/ralph-specum/skills/smart-ralph/references/ralph-loop-integration.md
Deleted old Ralph Loop integration doc (removed external integration guidance).

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant impl as implement.md
    participant state as .ralph-state.json
    participant coord as .coordinator-prompt.md
    participant stop as stop-watcher.sh
    participant executor as Task Executor
    participant trans as transcript

    User->>impl: /ralph-specum:implement
    impl->>state: Initialize state (globalIteration=0, maxGlobalIterations,...)
    impl->>coord: Write coordinator prompt to file
    impl->>User: Start execution (phase: execution)

    Note over executor,trans: Execution phase — tasks delegated to subagents
    executor->>trans: Append task outputs

    User->>stop: Exit session attempt triggers hook
    stop->>state: Read state (phase, iterations)
    stop->>trans: Scan transcript for ALL_TASKS_COMPLETE

    alt ALL_TASKS_COMPLETE detected
        stop->>state: Delete state file
        stop->>stop: Cleanup temp progress files
        stop->>User: Allow exit (no block)
    else More tasks remain
        stop->>state: Atomically increment globalIteration
        stop->>stop: Emit JSON block decision + inject continuation prompt
        stop->>User: Block exit (session remains open)
    end
Loading
sequenceDiagram
    actor User
    participant cancel as cancel.md
    participant state as .ralph-state.json
    participant coord as .coordinator-prompt.md
    participant files as Temp Files (.progress-task-*)

    User->>cancel: /ralph-specum:cancel
    cancel->>state: rm -f ./specs/$spec/.ralph-state.json
    cancel->>coord: rm -f ./specs/$spec/.coordinator-prompt.md
    cancel->>files: Ensure removal of orphaned temp files
    cancel->>User: Return: stopped (stop-hook no longer blocks)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

Poem

🐰 I nibbled at loops and stitched them tight,
Now stop-watcher hums through day and night,
State counts hops and prompts dance in tune,
No extra plugins—just a clever boon.
🥕 Hop on, spec; the loop ends soon.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately and concisely summarizes the main change: removing the ralph-wiggum dependency and releasing v3.0.0.

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


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

Copy link

@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: 8

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
plugins/ralph-speckit/commands/implement.md (2)

11-19: CRITICAL: Ralph Loop dependency check contradicts PR objectives.

The PR explicitly states it removes the ralph-wiggum plugin dependency in v3.0.0, with a breaking change that "ralph-wiggum plugin is no longer required." However, this section still checks for the Ralph Loop plugin and errors if it's not found, stating on line 19: "This is a hard dependency. The command cannot function without Ralph Loop."

This directly contradicts the PR objectives and creates a blocking issue.

If the intent is to remove the Ralph Loop dependency (as stated in PR objectives), this entire section (lines 11-19) should be deleted.


76-95: CRITICAL: Still invoking ralph-loop skill after claiming to remove it.

Lines 76-95 describe invoking the Ralph Loop via the Skill tool (ralph-loop:ralph-loop), but the PR objectives state this dependency is being removed. The AI summary for this file claims: "Updated flow to remove direct Ralph Loop invocation and replace with a two-step coordinator-prompt approach."

However, the actual code still invokes ralph-loop:ralph-loop on lines 86-92.

This is a critical inconsistency that blocks the PR's stated goal of removing the ralph-wiggum/ralph-loop dependency.

Expected behavior based on PR objectives:
The stop-hook (stop-watcher.sh) should handle loop control internally, and this section should only write the coordinator prompt file and let the stop-hook manage execution, NOT invoke an external ralph-loop skill.

🤖 Fix all issues with AI agents
In `@plugins/ralph-specum/hooks/scripts/stop-watcher.sh`:
- Around line 84-89: The atomic update currently runs jq ".globalIteration =
$NEW_ITER" "$STATE_FILE" > "$STATE_FILE.tmp" and then blindly mv
"$STATE_FILE.tmp" "$STATE_FILE", which can clobber STATE_FILE if jq fails;
change the block around NEW_ITER/STATE_FILE to only move the temp when jq
succeeds (e.g., run jq and check its exit status or use an if ...; then mv ...;
else remove the tmp and handle the error), referencing NEW_ITER, STATE_FILE and
"$STATE_FILE.tmp" so the temp is only swapped into place on a successful jq run.

In `@plugins/ralph-specum/skills/smart-ralph/SKILL.md`:
- Around line 67-76: Update the common state structure documentation in SKILL.md
to include the new fields "globalIteration" and "maxGlobalIterations" (used for
loop control in v3.0.0); describe their types (number), default values/starting
behavior, and how they interact with existing fields like "taskIteration" and
"maxTaskIterations" and with the "phase" lifecycle so readers know these are
global loop counters controlling overall iterations across tasks.

In `@plugins/ralph-specum/tests/stop-watcher.bats`:
- Around line 368-388: The test "cleans up orphaned temp progress files on
completion" currently only checks exit status but never verifies the orphaned
temp file was removed; update the test (after run_hook and status check) to
assert that "$TEST_DIR/specs/test-spec/.progress-task-1.md" no longer exists
(e.g. verify absence with a -f check or equivalent helper) or, if cleanup isn't
implemented yet, mark the test as skipped (use the test framework's skip
mechanism) so the suite doesn't falsely pass; refer to the test name and the
temp file path when making the change.

In `@specs/ralph-integration-research/design.md`:
- Around line 220-227: The block JSON currently references the relative filename
".coordinator-prompt.md" which is incorrect; update the string in the JSON
emitted by the stop-hook to use the full path
"./specs/$SPEC_NAME/.coordinator-prompt.md" (keeping TASK_INDEX, TOTAL_TASKS and
SPEC_NAME variables intact) so the agent can locate the coordinator instructions
when the hook blocks (modify the JSON line that contains
".coordinator-prompt.md" to "./specs/$SPEC_NAME/.coordinator-prompt.md").

In `@specs/ralph-integration-research/research.md`:
- Around line 272-280: The Markdown tables (e.g., the table under the
"**prd.json Structure**" heading and the other tables referenced at lines
319-326, 353-361, 362-369) are missing surrounding blank lines and trigger
MD058; fix by adding a single blank line immediately before and after each
affected table so each table is separated from surrounding paragraphs and
headers, ensuring the table rows and pipe syntax remain unchanged.
- Around line 109-112: The fenced code blocks in research.md containing the flow
lines (e.g., "/implement -> writes coordinator prompt -> invokes
ralph-loop:ralph-loop skill", "ralph-loop:ralph-loop -> creates
.claude/ralph-loop.local.md -> stop-hook blocks exits", "/cancel -> invokes
ralph-loop:cancel-ralph -> cleans up both state files") and the Before/After
block (labels "Before (with ralph-loop)" and "After (inlined)") need explicit
language identifiers to satisfy MD040; update those triple-backtick fences to
use a language like text (```text) or bash as appropriate so the blocks are
marked (e.g., the flow lines should be ```text and the Before/After explanatory
block should be ```text).
- Around line 380-392: The Markdown table fails MD056 because the literal pipes
in the "Error handling" row (the string "|| true") are being parsed as column
separators; fix this by escaping the pipes (e.g., replace "|| true" with "\|\|
true") or by wrapping the value in inline code/backticks (e.g., "`|| true`") in
that Error handling row so the table column count is preserved and the MD linter
passes.

In `@specs/ralph-integration-research/tasks.md`:
- Around line 179-188: Update Task 4.1 to reference the actual workflow filename
added in the PR: change all mentions of `.github/workflows/test-hooks.yml` to
`.github/workflows/test.yml` (including the "Files:" line and the "Verify"
check); ensure the trigger, bats installation, and `--tap` execution
requirements remain the same and update the verification command to `test -f
.github/workflows/test.yml && grep -q "bats" .github/workflows/test.yml` so
documentation matches the repository state.
🧹 Nitpick comments (9)
plugins/ralph-speckit/commands/implement.md (1)

477-477: Update termination wording to reflect stop-hook control.

Line 477 states "This signal terminates the Ralph Loop loop." If the PR is removing the Ralph Loop dependency and moving to internal stop-hook control, this wording should be updated.

Suggested revision
-This signal terminates the Ralph Loop loop.
+This signal tells the stop-hook to end the execution loop.
.github/workflows/test.yml (1)

54-72: Install jq explicitly in lint-json for reproducibility.

lint-json assumes jq exists on the runner; installing it avoids failures if the base image changes.

♻️ Suggested update
   lint-json:
     name: Lint JSON
     runs-on: ubuntu-latest

     steps:
       - name: Checkout
         uses: actions/checkout@v4

+      - name: Install jq
+        run: |
+          sudo apt-get update
+          sudo apt-get install -y jq
+
       - name: Validate plugin.json
         run: |
           jq empty plugins/ralph-specum/.claude-plugin/plugin.json
plugins/ralph-specum/tests/stop-watcher.bats (1)

27-31: Potential issue: run_hook doesn't capture stderr.

The helper pipes input to the script but doesn't capture stderr. If stop-watcher.sh writes errors to stderr, they won't be visible in test output, making debugging harder.

Consider capturing stderr for better diagnostics
 # Helper to run stop-watcher with test input
 run_hook() {
     local input="$1"
-    echo "$input" | "$STOP_WATCHER"
+    echo "$input" | "$STOP_WATCHER" 2>&1
 }
specs/ralph-integration-research/requirements.md (1)

121-129: Minor clarification needed in Out of Scope section.

Line 128 states "Migration tooling for existing users (v2.0 users already have ralph-loop)" but since v3.0 removes ralph-loop, existing v2.0 users will need to transition. The migration guide in MIGRATION.md addresses this, but this out-of-scope item could be clearer.

Consider rewording for clarity
-- Migration tooling for existing users (v2.0 users already have ralph-loop)
+- Automated migration tooling (manual steps documented in MIGRATION.md)
specs/ralph-integration-research/design.md (1)

515-516: Consider adding language identifiers to code blocks.

The code blocks on lines 515 and 533 are missing language specifiers. While these contain pseudo-formulas rather than executable code, you could use a generic identifier like text or plaintext to satisfy the linter.

♻️ Proposed fix
 ### Prioritization Formula
 
-```
+```text
 Priority Score = (Dep_Weight × Unblocks_Count)
                + (Risk_Weight × Uncertainty_Score)
                + (Value_Weight × Impact_Score)

And similarly for line 533:

```diff
 ### Scoring Algorithm
 
-```
+```text
 1. Build dependency graph from task descriptions
 2. For each task:
    a. Count tasks it unblocks (Unblocks_Count)

Also applies to: 533-534

plugins/ralph-specum/commands/implement.md (3)

45-49: Clarify stop-hook behavior in comment.

The comment on line 49 says "The stop-hook will inject this prompt when blocking exit," but the stop-hook actually injects a message that references the file path (see design.md line 225). The agent must read the file themselves. Consider clarifying to: "The stop-hook will reference this file path when blocking exit, instructing the agent to read and follow these instructions."

♻️ Proposed clarification
 Write the ENTIRE coordinator prompt (from section below) to `./specs/$spec/.coordinator-prompt.md`.
 
-This file contains the full instructions for task execution. The stop-hook will inject this prompt when blocking exit.
+This file contains the full instructions for task execution. The stop-hook will reference this file path when blocking exit, instructing the agent to read and follow these instructions.

72-79: Update state schema documentation to include new fields.

The state schema example on lines 72-79 is missing the newly added globalIteration and maxGlobalIterations fields (initialized on lines 40-41). While the coordinator doesn't directly use these fields (they're for stop-hook iteration tracking), the documentation should reflect the complete state file structure for accuracy.

♻️ Proposed update to match complete schema
 ```json
 {
   "phase": "execution",
   "taskIndex": <current task index, 0-based>,
   "totalTasks": <total task count>,
   "taskIteration": <retry count for current task>,
-  "maxTaskIterations": <max retries>
+  "maxTaskIterations": <max retries>,
+  "globalIteration": <current global iteration>,
+  "maxGlobalIterations": <max global iterations before forced stop>
 }

Add a note below the schema:

```markdown
Note: `globalIteration` and `maxGlobalIterations` are managed by the stop-hook for loop safety and are not directly used by the coordinator.

426-438: Consider adding language specifier for output message block.

The code block starting on line 426 is missing a language specifier, which triggers a markdown linter warning. You can add text or markdown to satisfy the linter:

♻️ Proposed fix
 ## Output on Start
 
-```
+```text
 Starting execution for '$spec'
plugins/ralph-specum/skills/smart-ralph/SKILL.md (1)

108-110: Clarify the coordinator prompt file path.

The path <spec-path>/.coordinator-prompt.md uses a placeholder. For better clarity, consider specifying the actual path pattern (e.g., .specify/specs/<feature-name>/.coordinator-prompt.md) to help users understand where to find or debug coordinator prompt files.

📝 Suggested clarification
 ### Coordinator Prompt File
 
 Write coordinator prompt to file for stop-hook injection:
 - Stop-hook injects continuation prompt referencing this file
 - Enables complex multi-line coordinator instructions
-- Path: `<spec-path>/.coordinator-prompt.md`
+- Path: `.specify/specs/<feature-name>/.coordinator-prompt.md`

Comment on lines 368 to 388
@test "cleans up orphaned temp progress files on completion" {
create_state "execution" 5 5 1 100

# Create an old temp file
touch -t 202501010000 "$TEST_DIR/specs/test-spec/.progress-task-1.md"

local transcript
transcript=$(create_transcript "ALL_TASKS_COMPLETE")

local input
input=$(cat << EOF
{"cwd": "$TEST_DIR", "transcript_path": "$transcript"}
EOF
)

run run_hook "$input"
[ "$status" -eq 0 ]

# Old temp file should be deleted (if system supports mtime check)
# Note: This test may be flaky depending on system time handling
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Test lacks meaningful assertion for cleanup behavior.

The test documents that it "may be flaky" but more importantly, there's no assertion verifying that the orphaned temp file was actually deleted. The test only checks the exit status.

Add an actual assertion or skip the test
     run run_hook "$input"
     [ "$status" -eq 0 ]

-    # Old temp file should be deleted (if system supports mtime check)
-    # Note: This test may be flaky depending on system time handling
+    # Verify cleanup occurred - if system doesn't support mtime check, skip
+    if [ -f "$TEST_DIR/specs/test-spec/.progress-task-1.md" ]; then
+        skip "System doesn't support mtime-based cleanup or cleanup not implemented"
+    fi
 }

Alternatively, if the cleanup feature isn't fully implemented yet, consider marking the test with skip until it's ready.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@test "cleans up orphaned temp progress files on completion" {
create_state "execution" 5 5 1 100
# Create an old temp file
touch -t 202501010000 "$TEST_DIR/specs/test-spec/.progress-task-1.md"
local transcript
transcript=$(create_transcript "ALL_TASKS_COMPLETE")
local input
input=$(cat << EOF
{"cwd": "$TEST_DIR", "transcript_path": "$transcript"}
EOF
)
run run_hook "$input"
[ "$status" -eq 0 ]
# Old temp file should be deleted (if system supports mtime check)
# Note: This test may be flaky depending on system time handling
}
`@test` "cleans up orphaned temp progress files on completion" {
create_state "execution" 5 5 1 100
# Create an old temp file
touch -t 202501010000 "$TEST_DIR/specs/test-spec/.progress-task-1.md"
local transcript
transcript=$(create_transcript "ALL_TASKS_COMPLETE")
local input
input=$(cat << EOF
{"cwd": "$TEST_DIR", "transcript_path": "$transcript"}
EOF
)
run run_hook "$input"
[ "$status" -eq 0 ]
# Verify cleanup occurred - if system doesn't support mtime check, skip
if [ -f "$TEST_DIR/specs/test-spec/.progress-task-1.md" ]; then
skip "System doesn't support mtime-based cleanup or cleanup not implemented"
fi
}
🤖 Prompt for AI Agents
In `@plugins/ralph-specum/tests/stop-watcher.bats` around lines 368 - 388, The
test "cleans up orphaned temp progress files on completion" currently only
checks exit status but never verifies the orphaned temp file was removed; update
the test (after run_hook and status check) to assert that
"$TEST_DIR/specs/test-spec/.progress-task-1.md" no longer exists (e.g. verify
absence with a -f check or equivalent helper) or, if cleanup isn't implemented
yet, mark the test as skipped (use the test framework's skip mechanism) so the
suite doesn't falsely pass; refer to the test name and the temp file path when
making the change.

Comment on lines 220 to 227
# 11. Block and inject continuation prompt (FR-1)
TASK_INDEX=$(jq -r '.taskIndex // 0' "$STATE_FILE")
TOTAL_TASKS=$(jq -r '.totalTasks // 0' "$STATE_FILE")

cat << EOF
{"decision": "block", "reason": "Continue executing tasks for spec '$SPEC_NAME'. Read ./specs/$SPEC_NAME/.ralph-state.json for current state (task $((TASK_INDEX + 1))/$TOTAL_TASKS). Follow coordinator instructions from .coordinator-prompt.md."}
EOF
exit 0
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Fix incorrect coordinator prompt file path.

The block JSON on line 225 references .coordinator-prompt.md, but the correct path should be ./specs/$SPEC_NAME/.coordinator-prompt.md (matching the path used in implement.md lines 47, 53, 440). Without the full path, the agent won't be able to locate the coordinator instructions when the stop-hook blocks and continues the loop.

🐛 Proposed fix for the coordinator prompt path
 # 11. Block and inject continuation prompt (FR-1)
 TASK_INDEX=$(jq -r '.taskIndex // 0' "$STATE_FILE")
 TOTAL_TASKS=$(jq -r '.totalTasks // 0' "$STATE_FILE")
 
 cat << EOF
-{"decision": "block", "reason": "Continue executing tasks for spec '$SPEC_NAME'. Read ./specs/$SPEC_NAME/.ralph-state.json for current state (task $((TASK_INDEX + 1))/$TOTAL_TASKS). Follow coordinator instructions from .coordinator-prompt.md."}
+{"decision": "block", "reason": "Continue executing tasks for spec '$SPEC_NAME'. Read ./specs/$SPEC_NAME/.ralph-state.json for current state (task $((TASK_INDEX + 1))/$TOTAL_TASKS). Follow coordinator instructions from ./specs/$SPEC_NAME/.coordinator-prompt.md."}
 EOF
 exit 0
🤖 Prompt for AI Agents
In `@specs/ralph-integration-research/design.md` around lines 220 - 227, The block
JSON currently references the relative filename ".coordinator-prompt.md" which
is incorrect; update the string in the JSON emitted by the stop-hook to use the
full path "./specs/$SPEC_NAME/.coordinator-prompt.md" (keeping TASK_INDEX,
TOTAL_TASKS and SPEC_NAME variables intact) so the agent can locate the
coordinator instructions when the hook blocks (modify the JSON line that
contains ".coordinator-prompt.md" to
"./specs/$SPEC_NAME/.coordinator-prompt.md").

Comment on lines 109 to 112
```
/implement -> writes coordinator prompt -> invokes ralph-loop:ralph-loop skill
ralph-loop:ralph-loop -> creates .claude/ralph-loop.local.md -> stop-hook blocks exits
/cancel -> invokes ralph-loop:cancel-ralph -> cleans up both state files
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add languages to fenced code blocks (MD040).

markdownlint flags these fences without language identifiers; add text or bash as appropriate.

✏️ Suggested fix
-```
+```text
 /implement -> writes coordinator prompt -> invokes ralph-loop:ralph-loop skill
 ralph-loop:ralph-loop -> creates .claude/ralph-loop.local.md -> stop-hook blocks exits
 /cancel -> invokes ralph-loop:cancel-ralph -> cleans up both state files

```diff
-```
+```text
 Before (with ralph-loop):
   /implement -> invokes ralph-loop:ralph-loop
   ralph-loop:ralph-loop -> stop-hook blocks exits

 After (inlined):
   /implement -> writes coordinator prompt to context
   stop-hook.sh (own) -> blocks exits until ALL_TASKS_COMPLETE
</details>



Also applies to: 162-170

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 markdownlint-cli2 (0.18.1)</summary>

109-109: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

</details>

</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

In @specs/ralph-integration-research/research.md around lines 109 - 112, The
fenced code blocks in research.md containing the flow lines (e.g., "/implement
-> writes coordinator prompt -> invokes ralph-loop:ralph-loop skill",
"ralph-loop:ralph-loop -> creates .claude/ralph-loop.local.md -> stop-hook
blocks exits", "/cancel -> invokes ralph-loop:cancel-ralph -> cleans up both
state files") and the Before/After block (labels "Before (with ralph-loop)" and
"After (inlined)") need explicit language identifiers to satisfy MD040; update
those triple-backtick fences to use a language like text (text) or bash as appropriate so the blocks are marked (e.g., the flow lines should be text and
the Before/After explanatory block should be ```text).


</details>

<!-- fingerprinting:phantom:poseidon:eagle -->

<!-- This is an auto-generated comment by CodeRabbit -->

Comment on lines 272 to 280
**prd.json Structure**:
| Field | Type | Purpose |
|-------|------|---------|
| `id` | string | Unique identifier |
| `title` | string | Task description |
| `passes` | boolean | Completion status |

**Priority Re-evaluation**: None. Ralph does NOT re-evaluate priorities between iterations. After completion, it marks `passes: true` and proceeds to next incomplete task in array order.

Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add blank lines around tables (MD058).

Several tables here aren’t surrounded by blank lines, which triggers markdownlint. Add a blank line before and after each affected table.

Also applies to: 319-326, 353-361, 362-369

🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

273-273: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)

🤖 Prompt for AI Agents
In `@specs/ralph-integration-research/research.md` around lines 272 - 280, The
Markdown tables (e.g., the table under the "**prd.json Structure**" heading and
the other tables referenced at lines 319-326, 353-361, 362-369) are missing
surrounding blank lines and trigger MD058; fix by adding a single blank line
immediately before and after each affected table so each table is separated from
surrounding paragraphs and headers, ensuring the table rows and pipe syntax
remain unchanged.

Comment on lines 380 to 392
### 6. Gaps Between Ralph's Autonomy and ralph-specum

| Capability | snarktank/ralph | ralph-specum Current | Gap |
|------------|-----------------|---------------------|-----|
| Context freshness | True fresh (new instance per iteration) | Task tool provides fresh context | **Parity** |
| Coordinator context | External bash = no accumulation | Coordinator accumulates in-session | **Gap** |
| Task selection | Sequential by array position | Sequential by taskIndex | **Parity** |
| Priority re-eval | None | None | **Parity** |
| Learnings persistence | progress.txt append-only | .progress.md Learnings section | **Parity** |
| Quality gates | typecheck, tests | 4-layer verification | **ralph-specum stronger** |
| State tracking | prd.json (passes field) | tasks.md [x] checkmarks | **Parity** |
| Error handling | Minimal (|| true) | maxTaskIterations + contradiction detection | **ralph-specum stronger** |
| Todo/focus pattern | Not used | Not used | **Gap** (could adopt) |
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Escape literal pipes in table cells to fix column count (MD056).

The || in the “Error handling” row is parsed as extra columns. Escape the pipes or wrap them in code.

✏️ Suggested fix
-| Error handling | Minimal (|| true) | maxTaskIterations + contradiction detection | **ralph-specum stronger** |
+| Error handling | Minimal (`||` true) | maxTaskIterations + contradiction detection | **ralph-specum stronger** |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
### 6. Gaps Between Ralph's Autonomy and ralph-specum
| Capability | snarktank/ralph | ralph-specum Current | Gap |
|------------|-----------------|---------------------|-----|
| Context freshness | True fresh (new instance per iteration) | Task tool provides fresh context | **Parity** |
| Coordinator context | External bash = no accumulation | Coordinator accumulates in-session | **Gap** |
| Task selection | Sequential by array position | Sequential by taskIndex | **Parity** |
| Priority re-eval | None | None | **Parity** |
| Learnings persistence | progress.txt append-only | .progress.md Learnings section | **Parity** |
| Quality gates | typecheck, tests | 4-layer verification | **ralph-specum stronger** |
| State tracking | prd.json (passes field) | tasks.md [x] checkmarks | **Parity** |
| Error handling | Minimal (|| true) | maxTaskIterations + contradiction detection | **ralph-specum stronger** |
| Todo/focus pattern | Not used | Not used | **Gap** (could adopt) |
### 6. Gaps Between Ralph's Autonomy and ralph-specum
| Capability | snarktank/ralph | ralph-specum Current | Gap |
|------------|-----------------|---------------------|-----|
| Context freshness | True fresh (new instance per iteration) | Task tool provides fresh context | **Parity** |
| Coordinator context | External bash = no accumulation | Coordinator accumulates in-session | **Gap** |
| Task selection | Sequential by array position | Sequential by taskIndex | **Parity** |
| Priority re-eval | None | None | **Parity** |
| Learnings persistence | progress.txt append-only | .progress.md Learnings section | **Parity** |
| Quality gates | typecheck, tests | 4-layer verification | **ralph-specum stronger** |
| State tracking | prd.json (passes field) | tasks.md [x] checkmarks | **Parity** |
| Error handling | Minimal (`||` true) | maxTaskIterations + contradiction detection | **ralph-specum stronger** |
| Todo/focus pattern | Not used | Not used | **Gap** (could adopt) |
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

391-391: Table column count
Expected: 4; Actual: 6; Too many cells, extra data will be missing

(MD056, table-column-count)

🤖 Prompt for AI Agents
In `@specs/ralph-integration-research/research.md` around lines 380 - 392, The
Markdown table fails MD056 because the literal pipes in the "Error handling" row
(the string "|| true") are being parsed as column separators; fix this by
escaping the pipes (e.g., replace "|| true" with "\|\| true") or by wrapping the
value in inline code/backticks (e.g., "`|| true`") in that Error handling row so
the table column count is preserved and the MD linter passes.

Comment on lines 179 to 188
- [ ] 4.1 Create GitHub Actions workflow for bats tests
- **Do**:
1. Create `.github/workflows/test-hooks.yml`
2. Configure trigger for push to main and PRs affecting hooks/tests
3. Add step to install bats-core via apt-get
4. Add step to run tests with `--tap` output
5. Follow conventions from existing workflows (ubuntu-latest, actions/checkout@v4)
- **Files**: `.github/workflows/test-hooks.yml`
- **Done when**: Workflow file exists with correct triggers and bats execution
- **Verify**: `test -f .github/workflows/test-hooks.yml && grep -q "bats" .github/workflows/test-hooks.yml`
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Align workflow filename in Task 4.1 with the actual CI file.

Task 4.1 points to .github/workflows/test-hooks.yml, but this PR adds .github/workflows/test.yml. Update the task text so future readers don’t chase a non-existent file.

🤖 Prompt for AI Agents
In `@specs/ralph-integration-research/tasks.md` around lines 179 - 188, Update
Task 4.1 to reference the actual workflow filename added in the PR: change all
mentions of `.github/workflows/test-hooks.yml` to `.github/workflows/test.yml`
(including the "Files:" line and the "Verify" check); ensure the trigger, bats
installation, and `--tap` execution requirements remain the same and update the
verification command to `test -f .github/workflows/test.yml && grep -q "bats"
.github/workflows/test.yml` so documentation matches the repository state.

tzachbon and others added 2 commits January 22, 2026 21:50
Resolve conflicts keeping v3.0.0 changes:
- Keep v3.0.0 version numbers
- Keep stop-hook based execution loop (removed ralph-loop dependency)
- Keep updated documentation reflecting no external dependencies

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Fix SC2002 shellcheck warning (useless cat)
- Guard atomic jq update to prevent state corruption on failure
- Document globalIteration/maxGlobalIterations fields in SKILL.md
- Add skip assertion for mtime-dependent cleanup test
- Fix coordinator prompt path in design.md
- Fix markdown lint issues (code block langs, table spacing, pipe escaping)
- Update tasks.md to reference correct workflow filename (test.yml)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Copy link

@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: 3

🤖 Fix all issues with AI agents
In `@plugins/ralph-specum/hooks/scripts/stop-watcher.sh`:
- Around line 14-22: The script currently calls jq to set STOP_HOOK_ACTIVE from
INPUT before verifying jq is installed; move the jq availability check (command
-v jq >/dev/null 2>&1 || exit 0) to run before any use of jq, then parse
STOP_HOOK_ACTIVE from INPUT with jq only after that check; ensure the CRITICAL
first-check behavior (exiting immediately if STOP_HOOK_ACTIVE is true) is
preserved by keeping the STOP_HOOK_ACTIVE assignment and the if [
"$STOP_HOOK_ACTIVE" = "true" ] ... exit 0 logic immediately after the jq
availability check so the script still prevents infinite loops.

In `@specs/ralph-integration-research/design.md`:
- Around line 621-624: The document's CI/CD "Workflow File" section incorrectly
names the workflow as `test-hooks.yml` while the actual file is `test.yml`;
update the referenced filename in that section so all occurrences of
`test-hooks.yml` are replaced with `test.yml` (search for the "Workflow File"
heading and any CI/CD references), ensuring the section title and example path
reflect `/.github/workflows/test.yml` consistently.
- Line 154: The design doc references the wrong CI workflow filename; update the
reference `.github/workflows/test-hooks.yml` in the design.md content to match
the actual workflow created in this PR `.github/workflows/test.yml` (or
alternatively rename the workflow file to `test-hooks.yml` to match the doc) so
the documentation and implementation are consistent.
♻️ Duplicate comments (1)
specs/ralph-integration-research/research.md (1)

109-114: Add language identifiers to fenced code blocks.

The code blocks at lines 110-114 and 163-171 lack language identifiers, which triggers markdownlint MD040. Adding text as the language identifier improves rendering consistency.

🧹 Nitpick comments (3)
plugins/ralph-specum/hooks/scripts/stop-watcher.sh (1)

88-93: Orphaned temp files not cleaned on max iterations path.

When max iterations is reached (lines 88-93), the state file is deleted but orphaned .progress-task-*.md files are not cleaned up, unlike the completion path (line 83). Consider adding the same cleanup for consistency.

♻️ Proposed fix
 # Safety limit check (FR-7, FR-8)
 if [ "$GLOBAL_ITER" -ge "$MAX_ITER" ]; then
     echo "[ralph-specum] Max iterations ($MAX_ITER) reached for: $SPEC_NAME" >&2
     rm -f "$STATE_FILE" 2>/dev/null || true
+    # Cleanup orphaned temp progress files
+    find "$CWD/specs/$SPEC_NAME" -name ".progress-task-*.md" -mmin +60 -delete 2>/dev/null || true
     exit 0
 fi
specs/ralph-integration-research/tasks.md (1)

233-240: Consider adding jq availability documentation.

The notes section mentions "Consider adding jq availability warning in implement.md" as a production TODO. Given that the stop-hook silently exits when jq is unavailable (line 22 of stop-watcher.sh), documenting this dependency in user-facing docs would help users understand why execution might not block as expected.

Would you like me to draft the jq availability warning text for implement.md?

specs/ralph-integration-research/design.md (1)

216-218: Design pseudocode differs from final implementation.

The atomic update in the design pseudocode (lines 216-218) doesn't include the jq exit-status guard that was added to the actual implementation following a previous review. Consider updating the design doc to reflect the final, safer implementation pattern for future reference.

📝 Suggested update to match implementation
 # 10. Update iteration counter
-jq ".globalIteration = $((GLOBAL_ITER + 1))" "$STATE_FILE" > "$STATE_FILE.tmp"
-mv "$STATE_FILE.tmp" "$STATE_FILE"
+if jq ".globalIteration = $((GLOBAL_ITER + 1))" "$STATE_FILE" > "$STATE_FILE.tmp" 2>/dev/null; then
+    mv "$STATE_FILE.tmp" "$STATE_FILE"
+else
+    rm -f "$STATE_FILE.tmp"
+fi

Comment on lines +14 to 22
# CRITICAL: Prevent infinite loops (FR-3)
# Must be the FIRST check - if we're already in a hook, exit immediately
STOP_HOOK_ACTIVE=$(echo "$INPUT" | jq -r '.stop_hook_active // false' 2>/dev/null)
if [ "$STOP_HOOK_ACTIVE" = "true" ]; then
exit 0
fi

# Bail out cleanly if jq is unavailable
command -v jq >/dev/null 2>&1 || exit 0
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

jq is used before its availability is checked.

Line 16 uses jq to parse stop_hook_active, but the jq availability check happens on line 22. If jq is not installed, this will produce an error before the graceful fallback can trigger.

🐛 Proposed fix to reorder checks
 # Read hook input from stdin
 INPUT=$(cat)

+# Bail out cleanly if jq is unavailable
+command -v jq >/dev/null 2>&1 || exit 0
+
 # CRITICAL: Prevent infinite loops (FR-3)
 # Must be the FIRST check - if we're already in a hook, exit immediately
 STOP_HOOK_ACTIVE=$(echo "$INPUT" | jq -r '.stop_hook_active // false' 2>/dev/null)
 if [ "$STOP_HOOK_ACTIVE" = "true" ]; then
     exit 0
 fi
-
-# Bail out cleanly if jq is unavailable
-command -v jq >/dev/null 2>&1 || exit 0
🤖 Prompt for AI Agents
In `@plugins/ralph-specum/hooks/scripts/stop-watcher.sh` around lines 14 - 22, The
script currently calls jq to set STOP_HOOK_ACTIVE from INPUT before verifying jq
is installed; move the jq availability check (command -v jq >/dev/null 2>&1 ||
exit 0) to run before any use of jq, then parse STOP_HOOK_ACTIVE from INPUT with
jq only after that check; ensure the CRITICAL first-check behavior (exiting
immediately if STOP_HOOK_ACTIVE is true) is preserved by keeping the
STOP_HOOK_ACTIVE assignment and the if [ "$STOP_HOOK_ACTIVE" = "true" ] ... exit
0 logic immediately after the jq availability check so the script still prevents
infinite loops.

| `plugins/ralph-specum/README.md` | Modify | Remove ralph-wiggum dependency docs |
| `CLAUDE.md` | Modify | Update dependency reference |
| `plugins/ralph-specum/tests/stop-watcher.bats` | Create | bats-core unit tests for stop hook |
| `.github/workflows/test-hooks.yml` | Create | CI workflow for bats-core tests |
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Workflow filename mismatch with actual CI file.

The design document references .github/workflows/test-hooks.yml, but the actual workflow file created in this PR is .github/workflows/test.yml. Consider updating for consistency with the implementation.

📝 Suggested fix
-| `.github/workflows/test-hooks.yml` | Create | CI workflow for bats-core tests |
+| `.github/workflows/test.yml` | Create | CI workflow for bats-core tests |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| `.github/workflows/test-hooks.yml` | Create | CI workflow for bats-core tests |
| `.github/workflows/test.yml` | Create | CI workflow for bats-core tests |
🧰 Tools
🪛 LanguageTool

[uncategorized] ~154-~154: The official name of this software platform is spelled with a capital “H”.
Context: ... bats-core unit tests for stop hook | | .github/workflows/test-hooks.yml | Create | CI...

(GITHUB)

🤖 Prompt for AI Agents
In `@specs/ralph-integration-research/design.md` at line 154, The design doc
references the wrong CI workflow filename; update the reference
`.github/workflows/test-hooks.yml` in the design.md content to match the actual
workflow created in this PR `.github/workflows/test.yml` (or alternatively
rename the workflow file to `test-hooks.yml` to match the doc) so the
documentation and implementation are consistent.

Comment on lines +621 to +624
### Workflow File

`.github/workflows/test-hooks.yml`

Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Same workflow filename inconsistency.

The CI/CD section also references test-hooks.yml instead of the actual test.yml filename.

📝 Suggested fix
 ### Workflow File

-`.github/workflows/test-hooks.yml`
+`.github/workflows/test.yml`
🤖 Prompt for AI Agents
In `@specs/ralph-integration-research/design.md` around lines 621 - 624, The
document's CI/CD "Workflow File" section incorrectly names the workflow as
`test-hooks.yml` while the actual file is `test.yml`; update the referenced
filename in that section so all occurrences of `test-hooks.yml` are replaced
with `test.yml` (search for the "Workflow File" heading and any CI/CD
references), ensuring the section title and example path reflect
`/.github/workflows/test.yml` consistently.

tzachbon and others added 2 commits January 25, 2026 12:10
Resolve merge conflicts keeping V3.0.0 changes:
- Maintain v3.0.0 version numbers in marketplace.json and plugin.json
- Keep stop-hook based execution loop (no ralph-wiggum dependency)
- Preserve updated documentation for V3.0.0
- Remove obsolete ralph-loop dependency references

Conflicts resolved:
- .claude-plugin/marketplace.json
- plugins/ralph-specum/.claude-plugin/plugin.json
- CLAUDE.md
- MIGRATION.md
- README.md
- TROUBLESHOOTING.md
- plugins/ralph-specum/commands/cancel.md
- plugins/ralph-specum/hooks/scripts/stop-watcher.sh

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Copy link

@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: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
plugins/ralph-specum/commands/implement.md (1)

32-42: Preserve globalIteration and maxGlobalIterations in state updates.

The stop-hook correctly increments globalIteration and persists it (see stop-watcher.sh lines 68–97), but the State Update instructions (section 8) omit these fields from the documented state structure. If the coordinator writes state without them, they will be lost on the next iteration, breaking the safety limit.

Update the state structure at lines 348–377 to include:

"globalIteration": <preserve current value>,
"maxGlobalIterations": <preserve current value>

Also applies to: 348–377

Note: Remember to bump plugin version in both plugin.json and marketplace.json per coding guidelines.

🧹 Nitpick comments (1)
plugins/ralph-specum/commands/implement.md (1)

230-236: Parallel Task tool calls should not concurrently edit tasks.md.

The parallel execution section still instructs each Task tool call to mark tasks in tasks.md, which risks conflicts and lost updates when multiple tasks run concurrently. Prefer having the coordinator update tasks.md after all parallel tasks finish, and keep per-task output isolated to temp progress files.

♻️ Suggested doc tweak to avoid concurrent edits
- For each task index in parallelGroup.taskIndices, create a Task tool call with:
- - Unique progressFile: `.progress-task-$taskIndex.md`
- - Full task block from tasks.md
- - Same instructions as sequential but writing to temp progress file
+ For each task index in parallelGroup.taskIndices, create a Task tool call with:
+ - Unique progressFile: `.progress-task-$taskIndex.md`
+ - Full task block from tasks.md
+ - Same instructions as sequential but writing to temp progress file
+ - DO NOT edit tasks.md in parallel tasks; coordinator will apply checkmarks after merge

Based on learnings, ensure task progress persists correctly and task checkmarks are applied deterministically.

Also applies to: 257-267

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.

3 participants