fyi

For Your Information - R Package Introspection for LLMs

Last updated: 2026-02-06

For Your Information - R package introspection for LLMs.

Inspiration

fyi was inspired by btw, Posit’s excellent toolkit for giving LLMs context about R packages.

Both packages solve the same problem (helping LLMs understand R packages) but use different mechanisms:

Aspectbtwfyi
MechanismMCP tools (runtime calls)Static files (pre-generated)
How it worksLLM calls a tool, server returns docsLLM reads files from disk
Best forChat interfaces with tool callingCLI agents with file access
Dependenciespandoc, S7, cli, etc.Base R only

Tools vs Skills

Tools (btw’s approach): Functions the LLM can invoke at runtime. The LLM sends a request to an MCP server, which executes code and returns results. Powerful but requires a running server.

1User: "How does speech() work?"
2LLM: [calls btw_tool_docs_help_page("speech", "ttsapi")]
3Server: [fetches Rd, converts, returns markdown]
4LLM: "Here's how it works..."

Skills (fyi’s approach): Instructions that teach the LLM to read pre-generated files. No server needed - just static files on disk.

1User: "How does speech() work?"
2LLM: [reads ~/.fyi/ttsapi/man-md/speech.md]
3LLM: "Here's how it works..."

fyi is designed for CLI-based agents like Claude Code that can read files directly. If you’re building a chat interface with MCP tool calling, check out btw!

What it does

fyi provides everything an LLM needs to understand an R package:

  • Exported functions - Public API with argument signatures
  • Internal functions - Non-exported functions (accessed via :::), often the real workhorses
  • Option names - Extracted from getOption() and options() calls in source code
  • Full documentation - Help pages as markdown, ready for LLM consumption

Output is structured markdown optimized for LLM consumption (19-29% more token-efficient than Rd2txt).

Installation

1# From GitHub
2remotes::install_github("cornball-ai/fyi")

Quick Start

1library(fyi)
2
3# Generate docs for any package to ~/.fyi/
4fyi_cache("dplyr")
5
6# Now you have:
7#   ~/.fyi/dplyr/fyi.md        - Summary (exports, internals, options)
8#   ~/.fyi/dplyr/man-md/*.md   - Individual doc files

For large packages, use filtering:

1# torch has 700+ exports - filter to what you need
2fyi_cache("torch", pattern = "^nn_")  # Just neural network modules
3fyi_cache("torch", max_exports = 100, max_internals = 0)  # Limit counts

Usage

Unified Cache (~/.fyi/)

All package docs live in ~/.fyi/<package>/ for uniformity:

1# Generate cache for any package
2fyi_cache("ggplot2")
3
4# Force regeneration after package updates
5fyi_cache("mypackage", force = TRUE)

Interactive Exploration

 1# Print to console
 2fyi("sttapi")
 3fyi("sttapi", docs = TRUE)  # Include full documentation
 4
 5# Individual pieces
 6fyi_exports("sttapi")
 7fyi_internals("sttapi")
 8fyi_options("sttapi")
 9fyi_help("transcribe", "sttapi")
10fyi_docs("sttapi")

Filtering for Large Packages

1# Pattern filter
2fyi("torch", pattern = "^nn_")
3fyi_cache("torch", pattern = "^optim_")
4
5# Limit counts
6fyi("torch", max_exports = 50, max_internals = 0, max_topics = 50)
7
8# Filter summary, keep all doc files
9fyi_cache("torch", pattern = "^nn_", docs_pattern = NULL)

Example Output

 1# fyi: sttapi
 2
 3## Exported Functions (sttapi::)
 4
 5| Function | Arguments |
 6|----------|-----------|
 7| `set_stt_base` | url |
 8| `set_stt_key` | key |
 9| `stt_health` |  |
10| `transcribe` | file, model, language, response_format, backend |
11
12## Internal Functions (sttapi:::)
13
14| Function | Arguments |
15|----------|-----------|
16| `.check_api_health` | base_url |
17| `.normalize_segments` | segments |
18...
19
20## Options (sttapi)
21
22| Option | File | Type |
23|--------|------|------|
24| `sttapi.api_base` | internal_backend.R | get |
25| `sttapi.api_key` | internal_backend.R | get |
26...
27
28## Documentation Topics (4)
29
30For details, read `man-md/<topic>.md` or use `fyi_help("topic", "pkg")`.
31
32Topics: `set_stt_base`, `set_stt_key`, `stt_health`, `transcribe`

Function Reference

FunctionPurpose
fyi_cache(pkg)Generate docs to ~/.fyi/pkg/ (main entry point)
fyi(pkg)Print package overview to console
fyi_exports(pkg)List exported functions
fyi_internals(pkg)List internal functions
fyi_options(pkg)List package options
fyi_help(topic, pkg)Single help topic as markdown
fyi_help_topics(pkg)List all help topics
fyi_docs(pkg)All documentation as markdown
use_fyi_md(pkg)Write fyi.md to custom path
use_fyi_docs(pkg)Write man-md/*.md to custom path

Why “fyi”?

btw (“by the way”) gives you the polite intro. fyi (“for your information”) gives you the full briefing.

License

MIT

Reference

See Function Reference for complete API documentation.

Functions