You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All counter and state-file writes use atomic_write <file> <value> — write to a temp path, fsync, then mv -f into place. A SIGTERM between write and truncate cannot leave a zero-byte counter. set -o pipefail is enabled so jq/grep pipelines fail loudly.
Hook Resilience (TAP-538)
on-stop.sh self-heals a corrupt .circuit_breaker_state — if the JSON is invalid, the hook reinitializes to {state: CLOSED} and emits a WARN: line instead of crashing the loop. ralph-doctor compares project hooks against ~/.ralph/templates/hooks/ and warns on drift.
Linear Backend Fail-Loud (TAP-536)
When RALPH_TASK_SOURCE=linear, any API/network/parse error causes the count/task functions to print nothing to stdout and return non-zero. Callers distinguish "exit non-zero" (unknown — abstain) from "exit 0 + value" (real result). A transient outage cannot trip a false plan_complete exit.
Command Injection Guards (TAP-534/533)
sed/eval patterns in ralph_loop.sh sanitized against injection via untrusted task content.
Common Recipes
# Quick start
ralph-setup my-project &&cd my-project && ralph --monitor
# Fast iteration with live output
ralph --live --timeout 5
# Conservative rate limiting
ralph --calls 20 --timeout 30
# Preview without API calls
ralph --dry-run
# SDK mode with a specific model
ralph --sdk --sdk-model claude-opus-4-7
# GitHub issue workflow
ralph --issue 42 --live
# Linear task backend
RALPH_TASK_SOURCE=linear RALPH_LINEAR_PROJECT="My Project" ralph --live
# Optimize fix_plan.md task order# (runs automatically at session start unless RALPH_NO_OPTIMIZE=true)
ralph # auto-optimizes on start# Check health and hook drift
ralph-doctor
# Upgrade project hooks to latest templates
ralph-upgrade-project
ralph-upgrade-project
Propagates updated runtime files (hooks, agent definitions, template merges) from the global Ralph install (~/.ralph/) into existing managed projects. Does not re-run ralph-enable or touch task state. Use this after running ralph-upgrade (which updates the global install) to sync your projects.
Usage
ralph-upgrade-project /path/to/project # upgrade one project
ralph-upgrade-project --all # discover and upgrade all projects
ralph-upgrade-project --dry-run /path # preview without changes
ralph-upgrade-project --all --yes # skip confirmation
ralph-upgrade-project --all --search-dir /c/cursor # custom discovery root
Three-tier upgrade policy
Tier
Files
Behavior
Tier 1 (always overwrite)
Hook scripts in .ralph/hooks/, agent definitions in .claude/agents/
Replaced with latest template
Tier 2 (merge only)
.ralphrc, .claude/settings.json
Appends missing sections and hooks; preserves your overrides