{"id":27942915,"url":"https://github.com/posit-dev/btw","last_synced_at":"2026-03-17T00:03:43.202Z","repository":{"id":278777893,"uuid":"928613190","full_name":"posit-dev/btw","owner":"posit-dev","description":"Describe R Stuff to Large Language Models","archived":false,"fork":false,"pushed_at":"2025-05-06T16:32:11.000Z","size":2413,"stargazers_count":26,"open_issues_count":9,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-07T11:58:48.692Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://posit-dev.github.io/btw/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/posit-dev.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":".github/SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-02-06T23:25:06.000Z","updated_at":"2025-05-06T15:32:35.000Z","dependencies_parsed_at":"2025-03-08T01:21:39.636Z","dependency_job_id":"88eba5cd-03bc-4df0-b0b5-817800ab368c","html_url":"https://github.com/posit-dev/btw","commit_stats":null,"previous_names":["simonpcouch/btw"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posit-dev%2Fbtw","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posit-dev%2Fbtw/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posit-dev%2Fbtw/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posit-dev%2Fbtw/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/posit-dev","download_url":"https://codeload.github.com/posit-dev/btw/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252873975,"owners_count":21817711,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-07T11:58:52.930Z","updated_at":"2026-03-17T00:03:43.196Z","avatar_url":"https://github.com/posit-dev.png","language":"R","readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n# btw \u003ca href=\"https://posit-dev.github.io/btw/\"\u003e\u003cimg src=\"man/figures/logo.png\" align=\"right\" height=\"138\" alt=\"btw website\" /\u003e\u003c/a\u003e\n\n\u003e A complete toolkit for connecting R and LLMs\n\n\u003c!-- badges: start --\u003e\n[![CRAN status](https://www.r-pkg.org/badges/version/btw)](https://CRAN.R-project.org/package=btw)\n[![R-universe version](https://posit-dev.r-universe.dev/btw/badges/version)](https://posit-dev.r-universe.dev/btw)\n[![R-CMD-check](https://github.com/posit-dev/btw/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/posit-dev/btw/actions/workflows/R-CMD-check.yaml)\n[![Codecov test coverage](https://codecov.io/gh/posit-dev/btw/graph/badge.svg)](https://app.codecov.io/gh/posit-dev/btw)\n\u003c!-- badges: end --\u003e\n\n## Overview\n\nbtw helps R users work with Large Language Models, whether you're pasting context into ChatGPT, chatting with an AI assistant in your IDE, or building LLM-powered applications.\n\nThe challenge: LLMs need context about your R environment to be helpful—your data structures, the packages you're using, relevant documentation.\n\nbtw provides a flexible toolkit that works across different workflows:\n\n- **Copy-paste to external LLMs:** Quickly gather context from your R session and copy it to your clipboard for pasting into ChatGPT, Claude, or any other chat interface.\n- **Interactive chat in R:** Launch a full-featured AI assistant directly in your IDE that can explore your environment, read documentation, and help you write code.\n- **Build LLM-powered tools:** Integrate btw's capabilities into your own applications, whether you're creating custom chat interfaces or connecting R to coding agents.\n\n## Quick Start\n\n### Copy-paste workflow\n\nUse `btw()` to gather context from your R session and copy it to your clipboard:\n\n```{r eval = FALSE}\nlibrary(btw)\n\n# Describe a data frame\nbtw(mtcars)\n\n# Include package or function documentation\nbtw(\"{dplyr}\", ?dplyr::across)\n\n# Combine multiple pieces of context\nbtw(mtcars, \"{dplyr}\", \"How do I calculate the mean mpg by cylinder?\")\n```\n\nThe context is copied to your clipboard, ready to paste into ChatGPT, Claude, or any LLM chat interface.\n\n### Interactive chat in your IDE\n\nLaunch a chat interface with `btw_app()`:\n\n```{r eval = FALSE}\nbtw_app()\n```\n\n\u003cimg src=\"man/figures/btw-app.png\" alt=\"Screenshot of btw_app() in action. In the sidebar, there is a list of tools that can be toggled on and off, and in the main panel a chat interface. In the chat we can see several tool calls have been made to read files in the current project.\"\u003e\n\nFor persistent project context, create a `btw.md` file with `use_btw_md()`.\nThis creates a project-specific configuration file where you can define your preferred LLM provider, model, and custom instructions that apply to all conversations in your project.\n\n### Building with btw\n\nbtw supercharges [ellmer](https://ellmer.tidyverse.org/)!\nUse `btw_client()` for a pre-configured chat client, the same client used by `btw_app()`.\n\n```{r eval = FALSE}\n# Uses provider, model, tools and instructions from btw.md\nchat \u003c- btw_client()\nchat$chat(\"Help me write documentation for...\")\n```\n\nOr use `btw_tools()` to get a list of tools you can register with any ellmer chat client.\n\n```{r eval = FALSE}\nlibrary(ellmer)\n\nchat \u003c- chat_anthropic()  # or chat_openai(), chat_ollama(), etc.\nchat$register_tools(btw_tools())\n\nchat$chat(\"What data frames are in my environment?\")\n```\n\nPick and choose which tools you use with friendly group names\n\n```{r eval = FALSE}\n# Only provide documentation and file tools\nchat$register_tools(btw_tools(c(\"docs\", \"files\")))\n```\n\nor expose btw tools to external coding agents via the [Model Context Protocol](https://modelcontextprotocol.io/) using [mcptools](https://posit-dev.github.io/mcptools/).\n\n```{r eval = FALSE}\n# Run as a background process or in a separate R session\nbtw_mcp_server()\n```\n\nYou can [configure the MCP server](https://posit-dev.github.io/btw/reference/mcp.html) in Claude Desktop, Continue, or other MCP-compatible tools to give them access to your R environment.\n\n## Installation\n\nYou can install btw from CRAN:\n\n```r\ninstall.packages(\"btw\")\n```\n\nTo install the latest development version, you can install from [posit-dev.r-universe.dev](https://posit-dev.r-universe.dev/):\n\n```r\n# install.packages(\"pak\")\n\npak::repo_add(\"https://posit-dev.r-universe.dev\")\npak::pak(\"btw\")\n```\n\nOr you can install the development version from [GitHub](https://github.com/posit-dev/btw):\n\n```r\n# install.packages(\"pak\")\npak::pak(\"posit-dev/btw\")\n```\n\n## Learn More\n\n- 🌐 [Package website](https://posit-dev.github.io/btw/)\n- 📚 [Function reference](https://posit-dev.github.io/btw/reference/)\n- 💻 [GitHub repository](https://github.com/posit-dev/btw)\n\nFor questions or issues, please [open an issue on GitHub](https://github.com/posit-dev/btw/issues).\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposit-dev%2Fbtw","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fposit-dev%2Fbtw","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposit-dev%2Fbtw/lists"}