Skip to content

feat(ralph): implement AFK Ralph pattern with Docker sandbox and YOLO mode#3

Merged
iamladi merged 2 commits intomainfrom
feat/afk-ralph-pattern
Jan 25, 2026
Merged

feat(ralph): implement AFK Ralph pattern with Docker sandbox and YOLO mode#3
iamladi merged 2 commits intomainfrom
feat/afk-ralph-pattern

Conversation

@iamladi
Copy link
Owner

@iamladi iamladi commented Jan 25, 2026

Summary

Implements the full Matt Pocock AFK Ralph pattern across all three workflow orchestration scripts for true autonomous operation.

Changes

  • Docker sandbox mode (USE_SANDBOX=true default) - Runs Claude in isolated Docker container for AFK safety
  • YOLO mode (YOLO_MODE=true default) - Uses --dangerously-skip-permissions to skip prompts
  • Unified run_claude() function - Consistent Claude invocation with jq streaming + output capture
  • Trap handlers - Cleanup on EXIT/SIGINT/SIGTERM (removes temp files, stops sandbox)
  • Signal detection - Replaced custom <phase> XML with standard <promise>COMPLETE|FAILED</promise> pattern
  • For-loop refactors - Cleaner iteration with explicit limits
  • Environment propagation - Parent script passes USE_SANDBOX/YOLO_MODE to child scripts

Files Changed

  • scripts/workflow-ralph.sh - Main orchestrator
  • scripts/ci-ralph.sh - CI failure resolution loop
  • scripts/comments-ralph.sh - PR comment resolution loop

Usage

# Full AFK mode (Docker + YOLO) - default
./workflow-ralph.sh research/my-feature.md

# No sandbox (faster, less safe)
USE_SANDBOX=false ./workflow-ralph.sh research/my-feature.md

# Interactive mode (keep permission prompts)
YOLO_MODE=false ./workflow-ralph.sh research/my-feature.md

Test Plan

  • Verify bash syntax: bash -n scripts/*.sh
  • Test run_claude() function with simple prompt
  • Test Docker sandbox invocation: docker sandbox run --credentials host claude --version
  • Run full workflow with test research file

… mode

Refactor all three Ralph scripts for autonomous AFK operation:

- Add USE_SANDBOX flag for Docker sandbox mode (default: true)
- Add YOLO_MODE flag for --dangerously-skip-permissions (default: true)
- Add unified run_claude() function with jq streaming + capture
- Add trap handlers for cleanup on EXIT/SIGINT/SIGTERM
- Replace custom <phase> signals with standard <promise> pattern
- Convert while loops to for loops with iteration limits
- Pass env vars from parent to child scripts

Scripts can now run completely unattended with safety guarantees.
Validates plugin.json schema, version sync, and shell script syntax on push/PR.
@iamladi iamladi merged commit 0022ecc into main Jan 25, 2026
1 check passed
@iamladi iamladi deleted the feat/afk-ralph-pattern branch January 25, 2026 16:12
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