Rishi Usage Guide

Rishi is an AI-powered coding agent designed specifically for R users. This comprehensive guide will help you make the most of Rishi's capabilities and integrate it effectively into your workflow.

Installation

Install Rishi from GitHub and launch it as a RStudio Addin:

# Install from GitHub
remotes::install_github("Omkar-Waingankar/rishi", subdir = "addin")

# Launch the Addin
rishi:::rishiAddin()

You'll need an API key from either Anthropic or OpenAI. Configure your keys in Rishi's settings when you first launch it.

Core Features

Available Models

Rishi supports multiple AI providers:

  • Anthropic: Claude 4.5 Sonnet, Claude 4 Sonnet, Claude 3.7 Sonnet
  • OpenAI: GPT-5, GPT-4o, GPT-4o-mini

Switch between models using the dropdown in the chat interface based on your task requirements and API availability.

Context Integration

Unlike generic AI chatbots, Rishi understands your RStudio environment. You can provide context in several ways:

  • Active Tab: Include the currently open file in RStudio to give Rishi direct visibility into the code you're working on
  • Current Plot: Share your active plot from the Plots pane for feedback, improvements, or explanations
  • Images: Upload screenshots, diagrams, or data visualizations (up to 5MB each, max 3 images) to provide visual context

Access these options through the context dropdown in the input area at the bottom of the chat interface.

Available Tools

Rishi can interact with your R environment through several tools:

  • File Operations: List, read, create, and edit files in your working directory
  • Console Execution: Run R code directly in your RStudio console
  • R Help: Access R documentation and help files to guarantee code correctness

Rishi automatically selects the appropriate tools based on your requests. You don't need to manually invoke them.

Common Use Cases

Exploratory Data Analysis

Ask Rishi to help you explore a new dataset:

"I just loaded a dataset called customer_data. Can you help me understand its structure and identify any interesting patterns?"

Rishi can examine your data, generate summary statistics, create visualizations, and suggest next steps for analysis.

Debugging Console Errors

When you encounter cryptic error messages:

"I'm getting an error 'object of type 'closure' is not subsettable' when running my analysis. Can you help me figure out what's wrong?"

Rishi can identify the problematic code, explain the error, and suggest fixes.

Visualization Refinement

Get help polishing your plots:

"Can you help me improve this plot? I want better colors, clearer labels, and a more professional look."

Use the "Current Plot" context option to share your visualization, and Rishi will suggest improvements with ready-to-run ggplot2 code.

Learning New Packages

Ramp up quickly on unfamiliar packages:

"I need to use the tidymodels package for the first time. Can you show me how to build a simple linear regression model?"

Rishi can dive into the package documentation and provide specific guidance with code examples tailored to your use case.

Code Refactoring

Improve existing code:

"This function works but it's slow and hard to read. Can you help me refactor it to be more efficient and maintainable?"

Include your active tab as context so Rishi can see the full code and provide specific refactoring suggestions.

Best Practices

Use Version Control (Git)

Important: Always use Git or another version control system with Rishi. This protects you from accidental changes:

  • Rishi can create and modify files in your working directory
  • While Rishi is generally careful, mistakes can happen
  • Git allows you to easily review changes and revert if needed
  • Commit your work frequently when using AI assistance
# Initialize git if you haven't already
git init
git add .
git commit -m "Initial commit before using Rishi"

Set a Working Directory

Rishi requires a working directory to be set in RStudio. This safety feature prevents Rishi from accessing arbitrary locations on your computer. Either:

  • Open an R project (.Rproj file), or
  • Use setwd() to set your working directory explicitly

Provide Clear Context

The more context you provide, the better Rishi's responses:

  • Describe what you're trying to accomplish, not just what you want the code to do
  • Include relevant active tabs when asking about specific code
  • Share plots when asking for visualization improvements
  • Mention any constraints or preferences (e.g., "using tidyverse style")

Manage Your API Keys

Rishi uses your own API keys, giving you control over costs and usage:

  • Monitor your API usage through your provider's dashboard
  • Set spending limits on your API accounts to avoid surprises
  • Use less expensive models (GPT-4o-mini, Claude 3.7 Sonnet) for simpler tasks
  • Your keys are stored locally and never sent to external servers (except the AI providers)

Tips for Effective Prompts

Be Specific

Less effective:

"Make a plot"

More effective:

"Create a scatter plot of price vs. mileage from the cars dataset, colored by manufacturer, with a smoothed trend line"

Mention Your Preferences

Less effective:

"Clean this data"

More effective:

"Clean this data using tidyverse functions. Remove rows with missing values in the 'price' column and convert 'date' to Date format"

Ask for Explanations

Less effective:

"Use a linear mixed model"

More effective:

"Can you explain why you chose to use a linear mixed model here instead of a standard linear regression?"

Getting Help

If you encounter issues or have questions:

  • Check the GitHub Issues for known problems and solutions
  • Open a new issue with detailed information about your problem
  • Connect with the maintainer on LinkedIn

Privacy and Security

Rishi is designed with privacy in mind:

  • All processing happens locally on your machine
  • The messages you send are never used for training AI models
  • Your code and data are never stored on external servers
  • You control your own API keys and usage
  • Rishi is fully open-source and auditable

However, be aware that content you send to AI providers may be subject to their terms of service and privacy policies. Review the policies for Anthropic and OpenAI if you have concerns.