Interactively adapt the Ralph Matsuo template to the current repository by filling project docs, rules, roadmap, and ralph.toml in one setup pass
Arguments: $ARGUMENTS
Get the current repository from "template copied" to "ready for the first PRD" in one guided setup pass.
CLAUDE.md, docs/architecture.md, or docs/roadmap.md are not project-specific yetRead these first:
README.mdCLAUDE.mddocs/architecture.mddocs/roadmap.mddocs/references/ (if it exists)docs/ubiquitous/ (if it exists)ralph.toml.claude/rules/*.mdInspect root task-runner or manifest files only as needed, such as:
package.jsonMakefilejustfilepyproject.tomlCargo.tomlgo.modAssume the repository already contains the Ralph template structure unless the files clearly show otherwise.
If the user wants the bundled GitHub automation, prefer copying these template units as-is:
.claude/scripts/ralph/docs/prds/_template/.github/CLAUDE.mdralph.tomlIf .github/ is missing, ask whether GitHub automation should be enabled now or deferred.
Ask concise questions and only ask what cannot be inferred from the repo.
Start by asking which language the user wants for ongoing conversation.
Persist that choice in .claude/rules/language.md before asking the rest of the setup questions.
After the user selects the language, continue the rest of the setup conversation, summaries, and next-step guidance in that language.
Cover these areas:
test_primarytest_integrationIf $ARGUMENTS already contains useful constraints, reuse them instead of re-asking.
Rewrite template wording so it matches the current repository:
CLAUDE.mddocs/architecture.mddocs/roadmap.mdRules:
ralph.toml as the canonical command registryReview .claude/rules/*.md and change only the files that need repo-specific conventions.
Do not rewrite the rules wholesale if the current defaults are still acceptable.
Treat .claude/rules/language.md as the source of truth for conversation language after the user picks it.
ralph.tomlCreate or update ralph.toml as part of the same setup flow.
Use the same selection rules as /ralph-registry-setup:
"N/A" when a role does not applytest_primary or test_integrationtest_primary pointed at the smallest practical automated test level for the repo, not lint or unrelated validation, unless the user explicitly accepts that limitationtest_integration as "N/A" only when broader tests do not apply; if requirements call for integration coverage but tooling is missing, report the gap instead of pretending setup is completeIf command choices are ambiguous, ask the user before writing them.
Ask the user:
Do you want to set up a self-hosted EC2 runner for GitHub Actions?
- Yes: Provisions an EC2 instance via AWS CDK for Claude Code OAuth-based runners (requires AWS account and Claude Max/Pro subscription)
- No: Uses GitHub-hosted
ubuntu-latestrunners withANTHROPIC_API_KEYsecret
Check prerequisites:
aws --version is available. If not, show installation instructions and stop.aws sts get-caller-identity succeeds. If not, show credential configuration instructions and stop.node and npm are available.Bootstrap CDK (if this is the first CDK deployment in the account/region):
cd infra && npx cdk bootstrapDeploy the stack:
cd infra && bash scripts/deploy.shinfra/cdk-outputs.json to extract the Instance ID and SSM command.Display post-deployment instructions for the user to complete manually:
EC2 instance has been provisioned. Complete the following steps:
1. Connect via Session Manager:
aws ssm start-session --target <instance-id>
2. Switch to the runner user:
sudo su - runner
3. Authenticate Claude Code (OAuth):
claude
(Open the displayed URL in your local browser to complete authentication)
4. Verify Claude works:
claude -p "1+1 を数値だけで答えてください。"
5. Authenticate GitHub CLI:
gh auth login -w
6. Register GitHub Actions self-hosted runner:
cd ~/actions-runner
(Get the latest commands from: Settings > Actions > Runners > New self-hosted runner > Linux)
./config.sh --url https://github.com/<owner>/<repo> --token <token> --labels self-hosted,linux,ec2,claude,ralph
7. Start the runner as a service:
sudo ./svc.sh install runner
sudo ./svc.sh start
sudo ./svc.sh status
To destroy the EC2 instance later:
cd infra && bash scripts/destroy.sh
Ensure workflow files use self-hosted labels:
.github/workflows/ralph.yml and .github/workflows/prd-create.yml use runs-on: [self-hosted, linux, ec2, claude, ralph].Ensure .github/workflows/runner-healthcheck.yml exists for periodic runner validation.
Inform the user:
ANTHROPIC_API_KEY repository secret is NOT needed when using OAuth.ANTHROPIC_API_KEY is set, it may conflict — recommend removing it.Update workflow files:
runs-on in .github/workflows/ralph.yml from the self-hosted label list to ubuntu-latest.runs-on in .github/workflows/prd-create.yml (all jobs) from the self-hosted label list to ubuntu-latest.Remove or skip healthcheck workflow:
.github/workflows/runner-healthcheck.yml exists, remove it (GitHub-hosted runners do not need healthchecks).Inform the user:
ANTHROPIC_API_KEY must be configured as a repository secret for Claude Code CLI to work in Actions.Summarize:
ralph.toml mappings"N/A"ubuntu-latest)
ANTHROPIC_API_KEY secret must be configured/prd-create, /spec-create, or /catchup