with one click
ralphi-init
Scans a project and sets up ralphi loop configuration. Use when asked to initialize ralphi, set up a ralphi project, configure a project for AI-driven development, or run /ralphi-init.
Menu
Scans a project and sets up ralphi loop configuration. Use when asked to initialize ralphi, set up a ralphi project, configure a project for AI-driven development, or run /ralphi-init.
Executing a single iteration of the ralph autonomous coding loop. Use when ralph invokes the agent to implement the next user story from the PRD.
Converts PRD markdown files to .ralphi/prd.json format for the Ralph autonomous agent loop. Use when asked to convert a PRD, create .ralphi/prd.json, or turn a PRD into Ralph format.
Generates structured Product Requirements Documents from feature descriptions. Use when asked to create a PRD, write requirements, plan a feature, or draft a spec.
| name | ralphi-init |
| description | Scans a project and sets up ralphi loop configuration. Use when asked to initialize ralphi, set up a ralphi project, configure a project for AI-driven development, or run /ralphi-init. |
Agentically scan a project to detect its language, framework, commands, and conventions, then generate all configuration needed for the ralphi loop.
| File | Purpose |
|---|---|
.ralphi/config.yaml | Ralph loop configuration (commands, rules, engine) |
AGENTS.md | Project conventions for the AI engine |
prek.toml or .git/hooks/pre-commit | Pre-commit hook running ralphi check |
.gitignore updates | Ignore ralph working files |
Follow these steps in order. Be conversational — confirm findings with the user before writing files.
Read these files to understand the project (skip any that don't exist):
Project overview:
README.md, README.rst, README.txt, or similarPackage manifests (detect language):
package.json → Node.js / TypeScript / JavaScriptCargo.toml → Rustgo.mod → Gopyproject.toml, setup.py, requirements.txt → PythonGemfile → Rubypom.xml → Java (Maven)build.gradle, build.gradle.kts → Java/Kotlin (Gradle)Build and quality configs:
tsconfig.json, .eslintrc*, vitest.config.*, jest.config.*ruff.toml, mypy.ini, .flake8golangci.yml, .golangci.ymlclippy.toml, rustfmt.toml.prettierrc*, .editorconfigCI configuration:
.github/workflows/ directory listing.gitlab-ci.ymlExisting agent guidance:
AGENTS.mdCLAUDE.md, claude.md.cursorrules, .windsurfrulesDirectory structure:
src/ listing (if it exists)If no package manifest is found, ask the user: "I couldn't detect a package manifest. What language and framework is this project using?"
Based on the package manifest, detect the commands for test, lint, build, and typecheck.
Read package.json and examine the scripts section:
check:all, check, validate, ci). Read what it actually runs — if it combines test + lint + build, prefer it.test, test:unit, test:alllint, lint:fix, lint:checkbuild, compiletypecheck, type-check, tsc, or if none exists and TypeScript is present, use npx tsc --noEmittest that runs echo "no tests" is not a real test command.Read pyproject.toml for tool configurations:
pytest (if pytest is in dependencies or [tool.pytest] exists)ruff check . (if ruff configured), else flake8 .mypy . (if mypy is in dependencies or [tool.mypy] exists)black . or ruff format .go test ./...golangci-lint run (if .golangci.yml exists)go build ./...cargo testcargo clippycargo buildcargo fmt --checkbundle exec rspec or bundle exec rails testbundle exec rubocopmvn test, mvn package./gradlew test, ./gradlew buildshellcheck <script-files>Analyze the codebase to discover conventions:
AGENTS.md if present. If CLAUDE.md or other agent guidance files exist, extract useful rules but keep AGENTS.md as the canonical source.strict: true in tsconfig? Is mypy in strict mode?Compile 3-8 concise rules. Each rule should be a single actionable sentence.
Use the ralphi_ask_user_question tool to gather confirmation and preferences interactively. For example:
{
"questions": [
{
"id": "extra_rules",
"prompt": "Any additional project conventions to enforce?",
"type": "multi",
"options": ["Strict TypeScript", "No default exports", "Prefer named imports"],
"allowOther": true
}
]
}
Also show the user what was detected in a clear format:
## Detected Configuration
**Project:** my-project
**Language:** TypeScript
**Framework:** Next.js
### Commands
✓ test: npm run test
✓ lint: npm run lint
✓ build: npm run build
✓ typecheck: npm run type-check
### Proposed Rules
1. Use vitest for testing
2. Follow existing patterns in src/
3. Use strict TypeScript (strict: true)
Ask the user to confirm or edit commands and rules before proceeding.
.ralphi/config.yamlCreate the config file with this structure:
# ralphi configuration
# Auto-generated — edit as needed
project:
name: "project-name"
language: "TypeScript"
framework: "Next.js"
commands:
test: "npm run test"
lint: "npm run lint"
build: "npm run build"
typecheck: "npm run type-check"
rules:
- "use vitest for testing"
- "follow existing patterns"
boundaries:
never_touch:
- "*.lock"
- ".env*"
engine: "pi"
max_retries: 3
Notes:
project.name should be the directory name (kebab-case)framework if one was detectedengine is always pi (ralphi is a Pi-native extension)boundaries.never_touch always includes *.lock and .env*AGENTS.md (canonical)Use AGENTS.md as the canonical guidance file for the project.
Before writing: Check if AGENTS.md already exists. If it does, show the user the existing content and ask whether to overwrite, merge, or skip.
Always write/merge content into AGENTS.md.
The file should contain:
Keep it concise and practical. This file is read by AI agents, not humans — focus on actionable instructions, not prose.
Example structure:
# Project Name
Brief description of what this project does.
## Commands
After ANY code change, run:
\`\`\`bash
npm run check:all
\`\`\`
Individual commands:
- `npm run test` — Run tests
- `npm run lint` — Lint code
- `npm run build` — Build (includes type checking)
## Conventions
- Use vitest for testing
- Follow existing patterns in src/
- ...
## Directory Structure
\`\`\`
project/
├── src/ # Source code
├── tests/ # Test files
└── ...
\`\`\`
The pre-commit hook should run ralphi check, which executes the quality commands from the config.
Option A — prek (preferred):
Generate prek.toml at the project root:
[[repos]]
repo = "local"
hooks = [
{
id = "ralphi-check",
name = "ralphi check",
language = "system",
entry = "ralphi check",
always_run = true,
pass_filenames = false,
},
]
Then check if prek is available by running command -v prek. If available, run prek install.
Option B — Direct git hook (fallback):
If prek is not available, create .git/hooks/pre-commit:
#!/usr/bin/env bash
set -euo pipefail
ralphi check
Make it executable with chmod +x .git/hooks/pre-commit.
Important: If .git/hooks/pre-commit already exists, ask the user before overwriting.
.gitignoreAppend the following entries to .gitignore if they're not already present:
# ralphi
.ralphi/*
!.ralphi/config.yaml
Read the existing .gitignore first and only add entries that are missing. Do not duplicate entries.
ralphi check is the command that runs quality checks from the config. It is called by the pre-commit hook to ensure code quality before commits.