mirror of
https://github.com/radareorg/r2ai.git
synced 2026-11-07 06:25:57 -10:00
R2AI Prompts
This directory contains predefined prompt files for the r2ai plugin.
Format
Each prompt is stored in a .r2ai.md file with YAML-style frontmatter and a markdown body.
Example:
---
description: 'Explain the current function'
author: pancake
command: r2ai -d
if-empty: exit
---
Explain the purpose of this function in one or two short sentences.
Supported keys:
title: The title of the promptauthor: The author of the promptdescription: A brief descriptioncommand: Commands to execute before sending the prompt, separated by;(required)requires: Requirements for the prompt (e.g., "analysis" to ensure binary analysis)if-empty: Alternative prompt or message if the command output is emptyif-command: Additional commands to run if the main command produces outputmodel: Model override for this promptprovider: Provider override for this prompt
Legacy .r2ai.txt files using Title:, Command:, Prompt: or Query: are still accepted.
Variable Substitution
In the markdown body, you can use:
${VAR}: Replaced with the value of the environment variableVAR$(cmd): Replaced with the output of the r2 commandcmd
Usage
r2ai -q: List all available promptsr2ai -qj: List all available prompts in JSONr2ai -q name: Run the prompt namednamer2ai -q name extra text: Run the prompt with additional text appended
Conditionals
if-empty: If the command output is empty, use this as the prompt insteadif-command: If the command produces output, run these additional commands and append their output
Future Features
- Support for r2js scripts
- More advanced conditionals