Template Customization
Create and customize prompt templates to match your workflow and project requirements.
Why Customize Templates?
While Ralph's built-in templates work for most projects, customization lets you:
- Add project-specific instructions or quality gates
- Include additional context like code style guidelines
- Modify the prompt structure for your AI agent's preferences
- Inject custom metadata from your tracker
Quick Start: Initialize a Custom Template
The fastest way to get started is copying the built-in template:
This creates .ralph-tui-prompt.hbs in your project root, pre-populated with the current template for your tracker type.
The .hbs extension stands for Handlebars, the templating engine Ralph uses. You can also use .md or any other extension—Ralph just reads the file content.
Template Locations
Ralph supports a hierarchical template system with project-level and global templates.
Project Templates (Recommended)
Create templates in your project's .ralph-tui/templates/ folder:
Templates are automatically detected based on your tracker type. No config changes needed!
Project templates take precedence over global templates. This lets you customize templates per-project while keeping personal defaults elsewhere.
Global Templates
For templates that apply across all your projects, use the global config directory:
Install global templates with:
Custom Path (Explicit Override)
You can also specify an explicit template path:
Or via CLI:
Explicit paths take highest priority and override all other template sources.
Creating a Custom Template
Basic Structure
A minimal template needs the task details and completion signal:
Adding Conditional Sections
Use \{\{#if\}\} blocks to include content only when data exists:
Adding Project-Specific Instructions
Customize the instructions section for your workflow:
Example Templates
Minimal Template
For simple, focused prompts:
Verbose Template with Full Context
This example mirrors the actual built-in templates with all features:
[Date] - {{taskId}}
- What was implemented
- Files changed
- Learnings:
- Patterns discovered
- Gotchas encountered
This template includes compound learning - agents are instructed to study .ralph-tui/progress.md which contains learnings, patterns, and gotchas discovered in previous iterations. This makes each iteration smarter than the last.
Frontend-Focused Template
For UI development with browser verification:
API Development Template
For backend/API work:
Cross-Iteration Progress Tracking
Ralph maintains a progress file (.ralph-tui/progress.md) that summarizes work completed across iterations. Use the recentProgress variable to include this summary in your prompts:
Why Use recentProgress?
Reduces token burn: Instead of sending full iteration logs each time, the agent receives a concise summary of what's been done. This is especially valuable when:
- Working through multi-iteration features
- Agents have their own context/caching that benefits from summary over full logs
- You want to avoid redundant file analysis between iterations
Default behavior: Ralph's built-in templates now include recentProgress to help agents understand context without receiving full iteration history.
How It Works
- After each iteration, Ralph extracts key information to
.ralph-tui/progress.md - On subsequent iterations, the content is available as the
recentProgresstemplate variable - The summary includes completed tasks, key changes, and notes from previous work
The progress file is distinct from iteration logs (.ralph-tui/iterations/). Use recentProgress for context and ralph-tui logs for detailed debugging.
Customizing Progress Content
The progress file is managed by Ralph's engine. To customize what gets included:
- Modify task completion - Ensure tasks include helpful completion notes
- Use task notes - Include relevant context in tracker task notes
- Adjust prompt template - The
recentProgressvariable is read-only; customize the summary by adjusting how tasks are completed
Accessing Raw Task Data
For advanced templates, you can access the raw task and config objects:
The task and config objects expose internal structure that may change between versions. Prefer using the documented template variables when possible.
Testing Your Template
Preview Rendered Output
View how your template renders with a specific task:
Validate Syntax
Handlebars will error on invalid syntax. Common issues:
Next Steps
- Handlebars Reference - Complete syntax and variable reference
- Configuration - Set template paths in config