For an introduction to trajectories and how they work, see Trajectories 101. This page focuses specifically on custom cache detection prompts that give you full control over trajectory validation.
The Problem
During trajectory replay, the system compares current screen states against cached screenshots to determine if it can safely reuse recorded actions. However, the default cache detection logic might not always know:- Which UI elements are critical vs. cosmetic for a specific step
- What minor differences are acceptable (e.g., timestamps, dynamic content)
- Special conditions that should invalidate the cache
- Context about why a particular screen state was captured
- Reject valid matches due to irrelevant differences (false negatives)
- Accept invalid matches by missing critical changes (false positives)
- Require human review to understand failures
The Solution
Custom Cache Detection Prompts give you full control over the validation logic. When you set a custom prompt:- Full Override: Your prompt completely replaces the default cache detection logic
- Step-specific: Each trajectory step can have its own custom prompt
- Human-written: Provide exact validation criteria that automated systems can’t infer
- Direct Control: You define exactly what constitutes a cache hit vs miss
How It Works
During Cache Detection
When comparing screen states with a custom prompt:- Capture: System takes a screenshot of the current state (Desktop #2)
- Load Cache: Retrieves the cached screenshot from the trajectory (Desktop #1)
- Your Prompt: The system receives ONLY your custom prompt (no default logic)
- Decision: The system evaluates and returns cache hit or cache miss
In the Trajectory Editor
You can add or edit custom prompts in the trajectory viewer:- Navigate to a trajectory in the Workflows section
- Expand any step to view details
- Find the “Custom Cache Detection Prompt (Overrides)” field in the Pre-check Snapshot
- Add your prompt with explicit hit/miss criteria
- Save changes to update the trajectory
Example Use Cases
Since your custom prompt completely overrides the default logic, you must be explicit about what defines a cache hit vs miss.Validating Critical Elements
Checking Layout Structure
Focus Area Validation
Conditional States
Form Validation
Best Practices
Always Define Both Outcomes
Since you’re overriding all default logic, explicitly state both when it’s a cache hit and when it’s a cache miss. Good: “Cache hit if the dialog is visible. Cache miss if it’s not visible or obscured.” Less Good: “The dialog should be visible”Be Specific About What to Check
Good: “Cache hit if three buttons are arranged horizontally at the bottom of the form.” Less Good: “Check the buttons are correct”Explicitly State What to Ignore
Good: “Ignore timestamps, ‘Last Updated’ labels, and dynamic content. Focus only on the form structure.” Less Good: Assuming the system knows what to ignoreConsider Parameter Variations
Good: “The username field will contain different values based on parameters - ignore the actual text, just verify the field exists.” Less Good: “Username should be John”Handle Edge Cases
Good: “Cache hit if either the success modal OR the results table is visible. Cache miss if neither is present.” Less Good: “Something might be wrong”Keep It Clear
Aim for clear, unambiguous criteria. Remember: your prompt is the ONLY guidance the system receives for this step.When to Use Custom Prompts
Consider adding a custom prompt when:- A step frequently has false positives or negatives
- The validation criteria are subtle or nuanced
- Dynamic content makes default comparison unreliable
- You’ve observed specific failure patterns
- The step is critical to workflow success
- You need precise control over what defines a match
Technical Details
Data Storage
Custom prompts are stored in thepre_check_snapshot object of each trajectory step: