Autonomous plan execution with Claude Code - Go rewrite of ralph.py.
make build # build binary to .bin/ralphex
make test # run tests with coverage
make lint # run golangci-lint
make fmt # format code
make install # install to ~/.local/bincmd/ralphex/ # main entry point, CLI parsing
pkg/config/ # configuration loading, defaults, prompts, agents
pkg/executor/ # claude and codex CLI execution
pkg/git/ # git operations using go-git library
pkg/processor/ # orchestration loop, prompts, signals
pkg/progress/ # timestamped logging with color
docs/plans/ # plan files location
- Use jessevdk/go-flags for CLI parsing
- All comments lowercase except godoc
- Table-driven tests with testify
- 80%+ test coverage target
- Signal-based completion detection (COMPLETED, FAILED, REVIEW_DONE signals)
- Streaming output with timestamps
- Progress logging to files
- Multiple execution modes: full, review-only, codex-only
- Configuration via
~/.config/ralphex/with embedded defaults
- Config location:
~/.config/ralphex/ - Config file format: INI (using gopkg.in/ini.v1)
- Embedded defaults in
pkg/config/defaults/ - Precedence: CLI flags > user config > embedded defaults
- Custom prompts:
~/.config/ralphex/prompts/*.txt - Custom agents:
~/.config/ralphex/agents/*.txt
5 default agents are installed on first run to ~/.config/ralphex/agents/:
implementation.txt- verifies code achieves stated goalsquality.txt- reviews for bugs, security issues, race conditionsdocumentation.txt- checks if docs need updatessimplification.txt- detects over-engineeringtesting.txt- reviews test coverage and quality
Template syntax: Use {{agent:name}} in prompt files to reference agents. Each reference expands to Task tool instructions that tell Claude Code to run that agent.
Customization:
- Edit files in
~/.config/ralphex/agents/to modify agent prompts - Add new
.txtfiles to create custom agents - Delete files and restart ralphex to restore defaults
- Built-in Claude Code agents (like
qa-expert,go-smells-expert) can be referenced directly in prompts
go test ./... # run all tests
go test -cover ./... # with coverageUnit tests mock external calls. After ANY code changes, run e2e test with a toy project to verify actual claude/codex integration and output streaming.
./scripts/prep-toy-test.shThis creates /tmp/ralphex-test with a buggy Go file and a plan to fix it.
cd /tmp/ralphex-test
.bin/ralphex docs/plans/fix-issues.mdExpected behavior:
- Creates branch
fix-issues - Phase 1: executes Task 1, then Task 2
- Phase 2: first Claude review
- Phase 2.5: codex external review
- Phase 3: second Claude review
- Moves plan to
docs/plans/completed/
cd /tmp/ralphex-test
git checkout -b feature-test
# make some changes
echo "// comment" >> main.go
git add -A && git commit -m "add comment"
# run review-only (no plan needed)
go run ~/dev.umputun/ralphex/cmd/ralphex --reviewcd /tmp/ralphex-test
# run codex-only review
go run ~/dev.umputun/ralphex/cmd/ralphex --codex-only# live stream (use actual filename from ralphex output)
tail -f progress-fix-issues.txt
# recent activity
tail -50 progress-*.txtCRITICAL: After ANY code changes to ralphex:
- Run unit tests:
make test - Run linter:
make lint - MUST run end-to-end test with toy project (see above)
- Monitor
tail -f progress-*.txtto verify output streaming works
Unit tests don't verify actual codex/claude integration or output formatting. The toy project test is the only way to verify streaming output works correctly.