ralph CLAUDE.md

ralph CLAUDE.md is an instructions file for coding agents from kylemclaren/ralph. It costs 656 tokens per session, scanned A, original, MIT.

A repository guide for ralph, an autonomous coding loop that repeatedly runs AI coding agents until the tasks in a product requirements document are complete.

In plain words
What is it for?
Use it when building, testing, linting, installing, or modifying ralph and its agent-execution loop.
Why use it?
It explains the project’s build, test, lint, installation, and internal architecture conventions so work follows the existing workflow.

Instructions file

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/kylemclaren/ralph/claude-md
Clone the repo
git clone --depth 1 https://github.com/kylemclaren/ralph

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for ralph CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/kylemclaren/ralph/claude-md.svg)](https://agentmods.dev/instructions/kylemclaren/ralph/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/kylemclaren/ralph/claude-md"><img src="https://agentmods.dev/badge/instructions/kylemclaren/ralph/claude-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 656 This file is loaded in full into every session.
When invoked 656 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00656 $0.00656
Opus 5 $0.00328 $0.00328
Sonnet 5 $0.00131 $0.00131
Haiku 4.5 $0.00066 $0.00066

Measured 5d ago against content hash 1c4bb4a53853, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

ralph CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

CLAUDE.md · 61 lines

How it starts

The opening of the file, as written. The whole thing — 61 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Build & Development Commands

mise run build      # Build ralph binary
mise run test       # Run all tests
mise run lint       # Run golangci-lint
mise run install    # Install to GOPATH/bin

# Run a single test
go test -v -run TestName ./internal/prd/

# Run tests for a specific package
go test -v ./internal/agent/

Architecture

Ralph is an autonomous AI coding loop that repeatedly runs AI coding agents (Claude Code, Amp, OpenCode, Codex) until all tasks in a PRD are complete. Each iteration is a fresh context window with memory persisting via git and text files.

Core Loop (internal/loop/loop.go)

The main execution loop that:

  1. Loads PRD, progress log, and prompt template
  2. Finds highest priority pending story
  3. Renders the prompt with current state
  4. Executes the configured AI agent
  5. Checks for completion marker (<promise>COMPLETE</promise>)
  6. Repeats until all stories pass or max iterations reached

Key Packages

  • internal/agent - Agent abstraction for executing AI tools. Handles command building, timeout, environment variables, and output capture. Agents receive prompts via -p flag.

  • internal/prd - PRD (Product Requirements Document) management. UserStories have ID, title, acceptance criteria, priority, and passes boolean. NextStory() returns highest priority pending story.

  • internal/config - Configuration via Viper. Supports ralph.yaml file, RALPH_ env vars, and CLI flags. Config precedence: flags > env > file.

  • internal/hooks - Lifecycle hooks (onStart, onIteration, onComplete, onFailure) that run shell commands at key points.

  • internal/prompt - Go text/template rendering for agent prompts. TemplateData includes PRD JSON, progress content, and story counts.

  • internal/claudecode - Environment variable bridge. Sets RALPH_* env vars so Claude Code hooks can access Ralph state (iteration, story ID, etc.).

Read the full file on GitHub · 61 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 61 lines · 656 tokens per session scan A 1c4bb4a53853

Subscribe to this mod's changes

ralph CLAUDE.md is an instructions file published in the GitHub repository kylemclaren/ralph (10 stars, last pushed 7mo ago), licensed MIT. It adds 656 tokens to every session, about $0.0033 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.