A Toolkit for Connecting R and Large Language Models
Overview
A complete toolkit for connecting 'R' environments with Large Language Models (LLMs). Provides utilities for describing 'R' objects, package documentation, and workspace state in plain text formats optimized for LLM consumption. Supports multiple workflows: interactive copy-paste to external chat interfaces, programmatic tool registration with 'ellmer' chat clients, batteries-included chat applications via 'shinychat', and exposure to external coding agents through the Model Context Protocol. Project configuration files enable stable, repeatable conversations with project-specific context and preferred LLM settings.
New features
- Added
btw cran versions <packages...>to look up CRAN release dates and versions, and versioned NEWS throughbtw(),btw_this(), the btw docs tools, andbtw docs news. Usebtw("@news dplyr v1.1.4")to paste a specific release's NEWS into a chat, orbtw("@news dplyr")for the full file (#213). btw docsandbtw pkg srccommands now auto-load an in-development package found in the current directory (or itspkg-r/,R/subfolder) withpkgload::load_all()before running, so results reflect uncommitted local changes. Pass--no-devto disable this and use the installed package instead (#212).- btw now supports shinychat >= 0.5.0 (#215):
btw_app()uses shinychat's newpage_chat()layout, with the tool selection menu and the system prompt editor in offcanvas panels. When shinychat 0.4.x is installed,btw_app()falls back to the legacy sidebar layout and warns, suggesting you upgrade to shinychat 0.5.0.- Conversations are kept in a chat history. Past chats appear in the app's history drawer, so you can revisit a previous conversation at any time. When duckdb is installed, btw stores this history in a shared database in btw's user cache directory, with one history per project, so your chats are still there the next time you open the app in the same project. Without duckdb, conversations are not saved between sessions. btw prints a note that suggests installing duckdb.
- btw's
@commands are also available as/btw-*slash commands, e.g./btw-help dplyr::across,/btw-news dplyr v1.1.4, or/btw-url https://example.com. A slash command stages its context as an attachment on the chat input and shows a toast while it runs. Nothing is sent to the model until you submit your next message. If a command fails,btw_app()restores your input text and shows an error toast. - Skills are registered as slash commands under their own names, e.g.
/skill-creator. Running a skill submits its instructions with your message to the model. /newand/clearstart a new chat. If chat history is enabled,btw_app()first saves the current conversation with shinychat's history-awarechat$new_chat()(posit-dev/shinychat#399), so the conversation isn't dropped from the history. The token and cost counters follow the active conversation and restore their totals when you load an old chat from the history.- Subagent reports use shinychat 0.5.0's HTML display protocol (
contents_html()), with the full subagent conversation in a styled disclosure.btw_app()escapes untrusted markdown in subagent reports and in error toasts. - Tool results survive shinychat's conversation history serialization, so chats with tool results can be saved and restored. btw collapses multi-element character values to a single string, returns data frame results as JSON, and drops unserializable objects from run-R results.
- Two new functions make the skill features reusable outside
btw_app().btw_skill_prompt()renders a skill's<skill>block, including its name, description, location, and optional compatibility and allowed-tools metadata.btw_skills_register_slash_commands()registers skills as slash commands on any shinychatchat_server().
Show all changes in 1.5.0Hide the rest of the changes in 1.5.0
Bug fixes
btw --versionnow works without a subcommand. Previously, Rapp's required top-level switch caused the CLI to print usage and exit before the version flag was ever checked.
Other changes
- Local conversation history and project code-search indexes now use RSQLite, replacing DuckDB. Persistent data is stored in btw's user cache and separated by project; install RSQLite to enable this storage.
- btw now requires ellmer (>= 0.4.2). The
set_model()compatibility shim was removed, andclient_get_models()now delegates to ellmer'smodels_list()generic, replacing a bespoke per-provider dispatch table (#214). - btw no longer reads the legacy user skills directory used by btw <= 1.2.0 (
skills/undertools::R_user_dir("btw", "config")) (#204).
From NEWS.md in the release
Install
Health
- OK13 OK2026-09-29
- ERROR12 OK, 1 ERROR2026-09-25
- OK13 OK2026-09-11
- ERROR12 OK, 1 ERROR2026-09-09
- OK13 OK2026-09-04
Show 12 earlier changesHide 12 earlier changes
- ERROR12 OK, 1 ERROR2026-08-06
- OK13 OK2026-08-05
- NOTE12 OK, 1 NOTE2026-08-01
- OK13 OK2026-07-04
- ERROR12 OK, 1 ERROR2026-07-03
- OK13 OK2026-06-11
- ERROR12 OK, 1 ERROR2026-06-08
- OK13 OK2026-06-06
- NOTE12 OK, 1 NOTE2026-06-05
- OK13 OK2026-05-24
- ERROR12 OK, 1 ERROR2026-05-14
- OK14 OK2026-03-10
Documentation
- Help pages
- 58 (2 internal)includes a package overview page
- Examples that run
- 93%37 run in a plain check (16 of them under a condition) · 1 never run · 2 hold no code
- Exported functions with examples
- 70%
- Documented parameters
- 98%
- Return-value docs
- 98%
- Help pages citing references
- 0%
Downloads
Repository
- PRs merged (all time)
- 98%
- Median days to close, 50 most recently updated closed issues
- 7
- Median days to close, 50 most recently updated closed PRs
- 0
Stars over time
Forks over time
Releases over time
Issues over time
PRs over time
Commits over time
Commit identities over time
15 development-tooling and community-health practices detected across 8 families in the upstream repository
Checks run against github.com/posit-dev/btw on 2026-10-11.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
GitHub Pages site last deployed 2026-10-06 · The repository has a site deploy workflow
pkgdown site last built 2026-09-09
Show all practicesHide 4 practices
This repository shows signs of AI coding tools.
- Claude Codefirst seen 2025-10-15Named in .Rbuildignore: .claudeNamed in .gitignore: .claude, .claude/skillsCommits: at least 5 crediting it in the message
- GitHub Copilotfirst seen 2025-12-08Pull request: opened by its own accountCommits: 1 by its own account
- Gemini CLIfirst seen on or before 2026-07-18Config: a file or ignore line, not recorded which
Dependencies
Code & Tests
People & History
Pick two releases to compare their code metrics.
- 1.5.0Latest2026-09-09 · current release · diff ↗ ·
added 3 exports
btw_skill_prompt, btw_skills_register_slash_commands, btw_tool_cran_versions - 1.4.02026-08-05 · diff ↗
- 1.3.0
- RR 4.6.0 released · 2026-04-24
- 1.2.12026-03-23 · diff ↗
- 1.2.02026-03-16 · diff ↗ ·
added 20 exports
btw_agent_tool, btw_skill_install_github, btw_skill_install_package, btw_task, btw_task_create_skill, btw_tool_agent_subagent, btw_tool_cran_package, btw_tool_cran_search, btw_tool_files_edit, btw_tool_files_list, btw_tool_files_read, btw_tool_files_replace, btw_tool_files_search, btw_tool_files_write, btw_tool_pkg_load_all, btw_tool_sessioninfo_is_package_installed, btw_tool_sessioninfo_package, btw_tool_sessioninfo_platform, btw_tool_skill, install_btw_cli - 1.1.02025-12-23 · diff ↗ ·
added 5 exports
btw_tool_pkg_check, btw_tool_pkg_coverage, btw_tool_pkg_document, btw_tool_pkg_test, btw_tool_run_r - 1.0.02025-11-04
- RR 4.5.0 released · 2025-04-11
Package metadata
- First published
- 2025-11-04
- Total releases
- 7 / 1 yrs
- License
- MIT + file LICENSE OSI
- Minimum R
- ≥ 4.2.0
- Download size
- 905 KB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("btw")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-19, which the citation names so these numbers can be found later. More on citing and the projects behind them.