Skip to content

Commit 4a09544

Browse files
Kasper Jungeclaude
authored andcommitted
docs: add prompt resolution priority chain to How It Works so users understand the full prompt flow
The How It Works page explained prompt *assembly* (contexts, instructions, check failures) but didn't explain prompt *resolution* — how ralphify decides which prompt to use when multiple sources are available (-p flag, named prompts, --prompt-file, ralph.toml, fallback PROMPT.md). Added a priority chain table between the assembly diagram and the context resolution section. Also fixed the project detection order in cli.md to match the actual code (package.json is checked before pyproject.toml). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent e8cd507 commit 4a09544

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

docs/cli.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ ralph init --force # Overwrite existing files
117117
|---|---|---|---|
118118
| `--force` | `-f` | off | Overwrite existing `ralph.toml` and `PROMPT.md` |
119119

120-
During init, ralphify detects your project type by looking for manifest files (`pyproject.toml`, `package.json`, `Cargo.toml`, `go.mod`). The detected type is displayed but doesn't currently change the generated configuration — all project types get the same defaults.
120+
During init, ralphify detects your project type by looking for manifest files (`package.json`, `pyproject.toml`, `Cargo.toml`, `go.mod`). The detected type is displayed but doesn't currently change the generated configuration — all project types get the same defaults.
121121

122122
### `ralph run`
123123

docs/how-it-works.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,18 @@ flowchart LR
8888
style I fill:#00897b,color:#fff
8989
```
9090

91+
But first — where does the prompt come from? Ralphify resolves the prompt source using a priority chain. The first match wins:
92+
93+
| Priority | Source | How to use |
94+
|---|---|---|
95+
| 1 | `-p` flag | `ralph run -p "Fix the login bug"` — inline ad-hoc text |
96+
| 2 | Positional name | `ralph run docs` — looks up `.ralph/prompts/docs/PROMPT.md` |
97+
| 3 | `-f` / `--prompt-file` flag | `ralph run -f path/to/prompt.md` — explicit file path |
98+
| 4 | `ralph.toml` `prompt` field | Can be a [named prompt](primitives.md#prompts) or a file path |
99+
| 5 | Fallback | `PROMPT.md` in the project root |
100+
101+
Once the prompt text is loaded, the three assembly layers run in order:
102+
91103
### 1. Context resolution
92104

93105
For each enabled context, ralphify runs its command (if it has one) and combines the static content with the command output. Then it resolves placeholders in the prompt:

0 commit comments

Comments
 (0)