AD SPACE AVAILABLE · BRAND PARTNERS WELCOME

How to Configure Raycast AI Dynamic Placeholders and Arguments for Adaptive Context-Aware Commands

Zosha Barry · 365Finds Editorial
Indexed 88,650 Wiki articles

Put 365 Wiki to work with your AI

Copy the prompt below, paste it into the AI you already use, then ask your question.

Download full Skill

Try it with the prompt first. If you use 365 Wiki often, install the full 365Wiki Skill so you do not have to paste it again. No regular AI? Gemini or Microsoft Copilot on the web will work.

365Wiki Skill

Static prompts are the fastest way to turn an AI launcher into a glorified web chat box. If you have to highlight text, switch windows, paste it into an AI prompt, manually type repetitive context, and copy the result back, you are suffering from workflow friction.

Power users configure Raycast AI commands with dynamic placeholders ({selection}, {clipboard}, {browser-tab}) and system arguments ({argument}) to create adaptive, context-aware command pipelines. These allow a single keyboard shortcut to inspect your frontmost editor, query your active browser tab, pull recent clipboard buffers, prompt for optional inline variables, and replace the highlighted text in place—all without leaving your current application.

At 365Finds, our operational judgment is clear: Never build static AI prompts for repeatable desktop tasks. If a command requires manual window switching or copy-pasting, it is under-engineered. Raycast AI provides one of the cleanest desktop parametric prompt systems available, but maximizing its utility requires knowing how to combine context extraction, runtime arguments, and modifier chaining.


1. The Core Context Ingestion Placeholders

Raycast AI pulls runtime environmental data directly into prompt templates using curly brace tags. When the command executes, the launcher resolves these placeholders before transmitting the prompt payload to the underlying large language model.

PlaceholderContext SourceKey Attributes & SyntaxBest Desktop Workflow
{selection}Frontmost active applicationGrabs highlighted text; in AI Chat, falls back to the previous messageIn-place code refactoring, grammar fixes, text translation
{clipboard}System clipboard bufferSupports history offsets: {clipboard offset=1}, {clipboard offset=2}Multi-source comparison, log analysis, secondary context injection
{browser-tab}Focused browser tabRequires Raycast Browser Extension; formats: markdown (default), text, html; supports CSS selectorScraped documentation analysis, Jira/GitHub ticket synthesis, web summarization

Deep Dive: Multi-Buffer Operations with {clipboard offset=N}

Most users only know about {clipboard}, which pulls the immediate clipboard content. Power users enable Clipboard History in Raycast and utilize offsets to feed multiple copied fragments into a single prompt:

This unlocks multi-buffer AI workflows without opening a full chat window: copy an API schema, copy an error stack trace, select your local code, and trigger a command that contrasts all three simultaneously.

Deep Dive: Targeted Web Extraction with {browser-tab selector="..."}

Extracting an entire webpage via {browser-tab} often blows up the model's context window with noisy navigation bars, footers, and tracking scripts. Raycast solves this by supporting CSS selectors:


2. Interactive Runtime Arguments: {argument}

Dynamic placeholders pull automatic context, but complex commands often require runtime human intent. Raycast AI supports up to 3 distinct arguments per command, rendered directly inside the launcher search bar.

Named Arguments for Consistency

By default, each standalone {argument} creates a generic text field. Adding the name attribute assigns an identifier and an intuitive placeholder label in the search input:

Translate the following text into {argument name="Target Language"}:
{selection}

If you use the same argument name more than once inside a prompt template, Raycast asks for the input once and reuses that identical string across every matching placeholder.

Default Values: Eliminating Micro-Friction

By default, an argument without a fallback is strictly mandatory: Raycast will block command execution until you type something. For power users, mandatory prompts introduce micro-friction.

Adding the default attribute makes the argument optional:

Review this pull request title and description.
Tone: {argument name="Style" default="constructive and direct"}
Code: {selection}

365Finds Best Practice: Set default values on every argument where a standard choice covers 80% of your daily work. When the launcher opens, hitting Enter immediately executes the command with your proven default, while typing overrides it on demand.

Constrained Choices with options

Free-form text input creates typing fatigue and inconsistent model outputs. Raycast allows you to constrain arguments to a curated dropdown list using the options attribute:

Refactor this function prioritizing {argument name="Goal" options="readability, runtime performance, memory efficiency, unit test coverage" default="readability"}:
{selection}

When you trigger this command, Raycast turns the search bar into an autocompleting selector, letting you toggle between architectural trade-offs using your arrow keys in less than a second.


3. Modifier Chaining and Prompt Escaping

Feeding raw desktop context into LLMs without sanitization often causes prompt injection, JSON corruption, or broken output formatting. Raycast AI provides a pipe syntax (|) to modify placeholder output before prompt assembly.

Essential Modifiers

  1. trim: Strips leading and trailing whitespace and empty newlines from your selection. Essential when grabbing terminal output or code blocks where rogue whitespace confuses formatting instructions.
    • Syntax: {selection | trim}
  2. json-stringify: Escapes double quotes, backslashes, and line breaks. Mandatory when building commands that instruct the LLM to output valid JSON or when passing code containing unescaped quote marks into structured schemas.
    • Syntax: {selection | json-stringify}
  3. raw: Raycast AI automatically wraps {selection} and {clipboard} placeholders in """ (triple double quotes) to delimit user context from system instructions. While helpful for basic text, this automatic delimiter can break strict code transformations, diff generation, or inline variable interpolations. Use raw to disable this behavior.
    • Syntax: {selection | raw}
  4. lowercase / uppercase: Enforces canonical casing for prompt instructions and enum tokens.
    • Syntax: {argument name="Format" options="json, yaml" | lowercase}
  5. percent-encode: Encodes special characters. Primarily used when passing dynamic outputs into web links or URLs.

Modifier Chaining

You can pipe multiple modifiers sequentially:

{clipboard offset=1 | trim | json-stringify}

This sequence strips accidental indentation, escapes syntax characters, and ensures the payload integrates cleanly into your prompt template.


4. Output Behavior and Model Routing

A well-crafted prompt template is only half the battle; how Raycast surfaces the response determines your execution speed. In the Create AI Command configuration screen, set the following options deliberately:

Output Behavior: Replace Selection vs. Open in Raycast

Model Routing and Reasoning Effort

Raycast AI allows assigning specific models per command:


5. Production Recipes for Power Users

Here are three tested, high-velocity command templates demonstrating contextual multi-input chaining.

Recipe 1: Contextual Code Differential & Regression Reviewer

You are a Staff Software Engineer conducting a strict code review.

### Goal
Audit the selected local implementation against the upstream requirements/logs stored in my clipboard buffer.

### Review Focus
{argument name="Focus Area" options="security vulnerabilities, performance regressions, edge-case coverage, API contract compatibility" default="security vulnerabilities"}

### Upstream Specification / Error Log (Clipboard)
{clipboard | trim}

### Selected Implementation Under Review
{selection | trim}

### Output Requirements
1. Identify explicit regressions or deviations between the code and specification.
2. Provide concrete, corrected code blocks for any critical flaws found.
3. Be concise and prioritize high-severity findings.

Recipe 2: Web-Aware Technical Documentation & Issue Drafter

Create a structured bug report or engineering task based on the active browser tab and selected logs.

### Task Type
{argument name="Issue Type" options="Bug Report, Feature Request, Tech Debt Task" default="Bug Report"}

### Web Context (Active Tab Body)
{browser-tab selector="main" format="markdown"}

### Local Terminal / Error Context (Selected Text)
{selection | trim}

### Output Format
- Title: [Type] Clear summary
- Environment & Context: Extracted from browser tab
- Reproduction / Stack Trace: Cleaned version of selection
- Suggested Resolution: Clear bullet points

Recipe 3: Zero-Friction In-Place Refactoring Pipeline

Refactor the following code snippet. Return ONLY the replacement code with no surrounding explanation, conversational filler, or Markdown code fence delimiters.

### Target Language / Paradigm
{argument name="Language/Framework" default="idiomatic modern code"}

### Primary Objective
{argument name="Optimization" options="readability, performance, typing accuracy, async conversion" default="readability"}

### Code to Refactor
{selection | trim | raw}

6. Institutional Evaluation: Where AI Commands Hit Their Limits

At 365Finds, we advocate pushing declarative AI commands to their full potential before writing heavy custom extensions. However, power users must recognize the architectural boundary:

  1. The 3-Argument Hard Limit: Raycast AI strictly limits each command to three {argument} placeholders. If a workflow demands multi-step configuration forms or dynamic dependent dropdowns, do not force it into an AI Command. Build a native Raycast Extension using the React/TypeScript SDK instead.
  2. Read-Only Context: Placeholders can extract active application selections, clipboard state, and browser content, but they cannot execute shell scripts, write directly to arbitrary filesystem paths, or query external REST APIs without user-triggered paste actions. When file system orchestration or CLI execution is needed, pair your AI Command with Raycast Script Commands or Model Context Protocol (MCP) servers.
  3. Clipboard History Dependency: Using {clipboard offset=N} requires Raycast's Clipboard History feature to remain active and unpaused. If you purge your clipboard history frequently or disable it in sensitive enterprise environments, offset placeholders will fail or return empty buffers.

By leveraging {selection | raw}, parameterized {argument} dropdowns, and multi-offset clipboard ingestion, you transform Raycast AI into an instantaneous, context-aware command center that eliminates desktop task switching.


References