- bash 4.0+ (macOS ships with 3.2 — use
brew install bash) - jq for JSON processing
- bats-core for testing:
brew install bats-coreornpm install -g bats - perl (optional, for completion promise matching in stop-hook)
# Run all tests
bats tests/
# Run a specific test file
bats tests/test_skill_selector.bats
bats tests/test_tdd_gate.bats
bats tests/test_verification_gate.bats
bats tests/test_stop_hook.bats
# Run with verbose output
bats --verbose-run tests/Super-Ralph has a 3-layer architecture:
Located in standalone/:
| File | Purpose |
|---|---|
super_ralph_loop.sh |
Main autonomous loop with rate limiting, execution engine |
lib/gate_utils.sh |
Shared pattern matching and JSON building utilities |
lib/skill_selector.sh |
Task classification engine |
lib/tdd_gate.sh |
TDD compliance enforcement |
lib/verification_gate.sh |
Completion claim validator |
lib/session_manager.sh |
Claude session persistence and expiry |
lib/tmux_utils.sh |
Multi-pane tmux monitoring sessions |
lib/exit_detector.sh |
Graceful exit detection and config validation |
lib/logging.sh |
Shared colored logging and file output |
install.sh |
Global installation script |
Located in plugins/super-ralph/:
| Directory | Purpose |
|---|---|
hooks/ |
Stop hook for self-referential loop |
commands/ |
Claude Code slash commands |
skills/ |
14 methodology skills (sr- prefixed) |
scripts/ |
Setup automation |
Located in docs/:
| File | Purpose |
|---|---|
ralph-integration-guide.md |
Architecture and setup options |
ralph-skill-hooks.md |
Skill selection decision tables |
README.claude-code.md |
Claude Code platform docs |
README.codex.md |
Codex platform docs |
README.opencode.md |
OpenCode platform docs |
- Create
standalone/lib/your_gate.sh - Source
gate_utils.shfor shared utilities:GATE_UTILS_DIR="$(dirname "${BASH_SOURCE[0]}")" source "$GATE_UTILS_DIR/gate_utils.sh"
- Define pattern arrays and use
count_pattern_matches/collect_pattern_details - Add tests in
tests/test_your_gate.bats - Source the gate in
super_ralph_loop.sh
- Create
plugins/super-ralph/skills/sr-your-skill/SKILL.md - Add YAML frontmatter with metadata
- Register in
plugins/super-ralph/.claude-plugin/plugin.jsonif needed - Update the skill routing table in
using-super-ralphcommand
- Use
set -u(notset -e) in hooks to handle errors explicitly - Use
jq --argfor safe JSON string interpolation (never"$var"inside jq) - Use
10#$varfor arithmetic with zero-padded numbers (prevents octal) - Always
|| trueafter grep in variable assignments that might not match - Export functions that need to be available in subshells
- Use
BASH_SOURCE[0]for reliable script directory detection
- Write bats tests for all gate libraries and hook scripts
- Use
setup()/teardown()for test isolation - Use
$BATS_TMPDIRfor temporary files - Test both success and failure paths
- Test edge cases: empty input, missing files, corrupted state