@google_search or @youtube_search.
What are search macros?
Macros simplify navigation by handling URL construction and query encoding:encodeURIComponent() calls and URL structure knowledge.
Why macros exist
From practical experience building AI browser agents:- Avoid encoding bugs: LLMs frequently forget to encode special characters (spaces, &, #, etc.)
- Site-specific URL structures: Each site has different query param names (
q=,search_query=,keywords=) - API format changes: When Reddit switches from HTML to JSON, only the macro needs updating
- Prompt brevity: Shorter tool calls = more context for reasoning
Macros are optional - you can always use the
url parameter directly if you prefer full control.Complete macro list
From lib/macros.js:1-16, here are all 14 supported macros:Usage in navigate endpoint
From server.js:872-934, the navigate endpoint accepts bothurl and macro:
macro and url are provided, macro is used and url serves as fallback.
Real expansion examples
Google search
Input:YouTube search
Input:Amazon search
Input:Wikipedia search
Input:LinkedIn search
Input:Reddit JSON behavior
Reddit macros return JSON instead of HTML, enabling direct parsing without snapshot/scraping.
@reddit_search
From lib/macros.js:5:@reddit_subreddit
From lib/macros.js:6:Implementation details
Macro expansion function
From lib/macros.js:18-21:- Returns
nullif macro doesn’t exist (triggers fallback tourlparameter) - Query defaults to empty string if undefined
- Uses native
encodeURIComponent()for safety
Available macros lookup
From lib/macros.js:23-25:Special characters handling
Macros automatically handle special characters:Spaces
Ampersands
Unicode
Quotes
Error handling
Unknown macro
If macro doesn’t exist:url parameter. If no url provided, returns error: “url or macro required”.
Empty query
From lib/macros.js:2:Workflow examples
Multi-site research
E-commerce price comparison
Social media monitoring
Adding custom macros
To add a new macro:- Edit
lib/macros.js:
- Restart server:
- Use new macro:
Performance notes
Macro expansion cost
Macro expansion is synchronous and lightweight:Reddit JSON performance
JSON responses are typically faster than HTML:- Smaller payload (25 posts ≈ 50KB JSON vs 500KB+ HTML)
- No need to wait for page hydration
- Direct parsing without accessibility tree traversal