Skip to contents

gptr 1.3.1

A release of gptr’s MCP bridge (the gptr plugin in Claude Code and Codex, gptr Agent in Biorouter); the R package’s code is unchanged from 1.3.0.

  • The bridge’s setup text, r/attach.R and the README no longer say that a session served without a mode is read-only: from gptr 1.3.0 such a session follows your gptr setting, auto by default. Serve with mode = "manual" to let the agent only read.
  • The bridge’s NOTICE and LICENSE credit the Baranzini Lab: made by the Baranzini Lab (Wanjun Gu, UCSF), copyright Baranzini Lab, University of California, San Francisco.
  • The bridge moved from the repository folder gptragent/ to mcp-bridge/, and its texts no longer call it gptr Agent outside Biorouter. Biorouter’s extension keeps its name, gptr Agent, and its id gptragent; Claude Code and Codex keep the plugin gptr.
  • The bridge’s Python package is gptr_mcp_bridge, and GPTR_RSCRIPT names the Rscript it asks when no session is found (GPTRAGENT_RSCRIPT still works). Its build can make the bundle under Biorouter’s coming id gptr (tools gptr__r), which gptr’s releases carry only once Biorouter migrates its installs.

gptr 1.3.0

CRAN release: 2026-11-27

gptr Agent now ships with gptr, as a Biorouter bundle and Claude Code and Codex plugins, and an outside agent’s R calls are recorded, so a served session stays a runnable document. A tool call takes one console row, and the claude-cli and codex routes take their models and their default from the installed CLI; any model id can be written in, and the catalog is refreshed. The permission fix for a missing HOME is a security fix for every earlier 1.x release. Unlike 1.2.0, this release changes what existing users see: the default permission mode is auto, compact_calls is on by default, codex/default runs the model your Codex starts with (no fixed fallback), an alias is the newest model of its family (gpt is gpt-6.2-sol, gemini is gemini-4-neon), and a supports_reasoning_effort setting is ignored. 1.2.0 was not released on CRAN, so its section is new there too.

Permissions

  • The default permission mode is auto: the agent runs R code and changes files and objects without asking. gptr still asks before level-4 actions (deleting the project, protected files such as .git and .env or files outside the project, rm(list = ls()), moving the working directory out of the project, changing gptr’s own configuration) and before reading a registered secret; it still refuses code that would end or pause R and a system() call whose command the code computes, and deny and ask rules apply as before. Where nobody can answer (Rscript, knitr), such an action stops the run with status blocked. A session served with gptr_mcp_serve() without mode also starts in auto, so its client can change objects, and on the codex route Codex’s own shell can change files in the project. To approve each change as before, use gptr_config(mode = "manual", .scope = "user"); /mode switches a console, and yolo asks less still. The console prompt is peter> in auto and names any other mode (peter[manual]>), and the banner names the mode only when it is not auto.
  • A path’s class no longer drops when R warns while gptr reads it. With HOME naming a folder that does not exist (a container, a service account, a CI runner), tools::R_user_dir() warns, and gptr read every literal path as “unknown”: deleting a file outside the project, .git or .env, or writing gptr’s settings, was level 3 instead of 4, so "auto" and "yolo" ran them without asking (gptr 1.0.0 to 1.2.0). Found by an end-to-end test of gptr Agent.
  • Reading a discovery record through a path built from pieces, such as file.path(dir, "serve-4242.json"), is a guarded secret read, as reading it by its literal path is; gptr 1.2.0 read it at level 1, which "auto" runs.

Serving R to local agents

  • gptr Agent, the bridge that lets an agent outside R work in a served session, now lives in gptr’s repository (folder gptragent/, outside the R package) and is released with gptr: its version is gptr’s, and each gptr GitHub release carries gptragent.brxt for Biorouter.
  • The same folder is a Claude Code plugin and a Codex plugin named gptr: claude plugin marketplace add Broccolito/gptr then claude plugin install gptr@gptr, or codex plugin marketplace add Broccolito/gptr then codex plugin add gptr@gptr. With gptr_mcp_serve(advertise = TRUE) the agent finds the session by itself and gets the tools sessions, inspect and r, with a skill that tells it to look first and change objects in place.
  • An outside agent’s R calls are recorded. A served r or inspect call that ran outside a Peter turn is recorded on the server’s session, as Peter’s are (of a call that stopped part-way, the expressions that ran; nothing in plan mode or for a refused call), so it persists with the session and gptr_last() |> peter() continues after it. While gptr_doc() binds a document, the call is also written into it as a direct R line, so gptr_export() turns the agent’s work into a runnable R script; an inspect call is left out unless it changed objects.
  • When no session is advertised, gptr Agent asks R where gptr keeps its cache from a new empty folder, so a project’s .Renviron cannot load a package or add a search folder.

Console

  • A tool call takes one row in the console: the tool, the first non-blank line of its code and (+N more lines) for its other non-blank lines, so a long script no longer fills the screen. An edit’s result is one row with the lines it added and removed, and what R code prints shows at most 5 rows a call, then (+N more lines); what the model receives is unchanged. An approval still shows the whole code it asks about.
  • /calls prints this session’s last tool call whole, all its code and what an edit or a write changes, /calls 3 the last three, including the calls a CLI route makes to gptr’s tools; a sub-agent’s calls and the steps a CLI route runs itself, such as Codex’s shell, are not among them.
  • gptr_config(compact_calls = FALSE) shows every call’s code as it runs and all its output, as before; .scope = "user" keeps that for every session.

Models

  • The claude-cli and codex routes ask your installed CLI which models it offers and which one it starts with: Claude Code through its stream-json control requests initialize and get_settings, Codex through codex app-server (model/list, config/read), else codex debug models. No prompt is sent and no tokens are spent; Claude Code’s probe loads your settings, so your SessionStart hooks run. gptr asks once per R session and CLI version, and on gptr_models(provider = "codex", refresh = TRUE), so a CLI update changes what gptr lists without a gptr release. /model on a CLI route lists those models.
  • claude-cli/default and codex/default run the model your CLI starts with (Claude Code’s settings model, Codex’s config.toml model), named in /model, /status, the status line, the peter() banner and gptr_models(), as in claude-cli/default (claude-opus-5-5). When the CLI cannot say, gptr passes no model flag and the CLI chooses; codex/default no longer falls back to a fixed model.
  • Any model id can be written in, on every route and provider: peter(model = "codex/<id>"), /model claude-cli/<id>, "openrouter/<id>", "lmstudio/<id>". An id the catalog or the CLI does not list is sent as written with one notice, with tool calls on a remote route (none on a local server), text input, no thinking level and unknown limits and price. A name alone that is neither a catalog id nor an alias is refused with suggestions, never swapped for a similar model.
  • Codex runs keep your own model provider while gptr’s isolation stays on: model_provider with its [model_providers.<id>] table, openai_base_url and model_catalog_json go to each run as -c overrides, so a Codex set up for Ollama, LM Studio or a router works in gptr. Only the table’s documented settings without credentials or commands go on the command line; tokens, http_headers, query_params and auth commands stay off, as does a URL holding a user name or password. Give a key through env_key or env_http_headers: gptr passes the environment variables they name to Codex.
  • The offline catalog is models.dev (MIT) of 2026-11-26 with gptr’s reviewed corrections; it lists Gemini 4, Fable 5.2, Haiku 5.5, GPT-6.2 and Grok 4.x. gptr matches no model name: an alias is the newest active model of its models.dev family (gpt is gpt-6.2-sol, gemini is gemini-4-neon), and the default, small and System 1 models are reviewed catalog data (claude-sonnet-5-5, gpt-6.2-sol, gemini-4-hydrogen; claude-haiku-5-5, gpt-6-luna, gemini-3.5-flash-lite; typesafe/jev-latest). model = "openai" runs OpenAI’s default.
  • Provider listings report more: reasoning efforts (OpenRouter, Anthropic, xAI), mandatory reasoning and expiry (OpenRouter), lifecycle (Anthropic), limits (Cerebras, vLLM, llama.cpp) and Ollama’s thinking levels. LM Studio is listed from its own API, with tools, vision and context.
  • Requests follow the model’s data, not its name. Anthropic requests use API version 2026-10-21 and no longer send a temperature. Thinking off turns thinking off where a model allows it (Claude Haiku 5.5, Opus 5, Sonnet 5 and 4.x). Gemini 4 gets xhigh; Grok 4.5 and later, DeepSeek, Ollama and vLLM get their reasoning effort by name; OpenRouter respects mandatory reasoning and budget models and sends cache_control only where cache writes are billed. A token-budget thinking level stays within the model’s thinking_budget range.
  • A bedrock-converse model gets Anthropic’s thinking fields when its record says owner = "anthropic", not when its id contains anthropic.claude. The supports_reasoning_effort compatibility switch is removed; a value in your settings is ignored.

gptr 1.2.0

Agents on the same computer can find a served R session by themselves and work in it with a read-only tool. Everything is additive: a server started as before behaves as before, apart from also offering inspect.

Serving R to local agents

  • gptr_mcp_serve(advertise = TRUE), or a label (advertise = "cohort study"), writes a discovery record so a local client, such as Biorouter’s gptr Agent extension, finds the session without your copying its address and token: serve-<pid>.json in file.path(tools::R_user_dir("gptr", "cache"), "mcp-serve"), readable only by you on Unix (mode 0600 in a folder of mode 0700). It holds the address and token, R’s process id, the working folder, the label, the mode, the served tools and the R, gptr and front-end versions. gptr removes it when the server stops, when gptr is unloaded and when R exits, and its next load removes the records of R processes that are gone. Printing the server’s handle names the record and never shows the token. Advertising a running server writes its record.
  • Reading a discovery record is a guarded secret read, like reading gptr’s auth.json, so a served client cannot read another session’s token, even in auto mode. Every record’s path ends in R/gptr/mcp-serve/serve-<pid>.json, so other tools that keep credential files away from agents can match it.
  • gptr_mcp_serve(mode = ) chooses the served session’s permission mode: "plan", "manual", "edits" or "auto"; NULL keeps the configured default. A running server refuses another mode, as it refuses another port.
  • The server offers inspect: R code that runs only when gptr classifies it at risk level 0, in every mode, and is refused without running otherwise. It is annotated read-only, so a client can run it without asking you, and your rules for r apply to it. Serve the four earlier tools only with tools = c("r", "read", "edit", "write").
  • A client of gptr_mcp_serve() that is served r or inspect gets fuller instructions: the r tool’s guidelines (never reload data already in memory, assign results, print compact summaries), look with inspect first, change objects in place, a new R process does not have them, and relay a refusal rather than rewording the code. gptr’s own Claude Code and Codex routes keep their short instructions.

Permissions

  • geterrmessage() reads at level 0, so an agent can read the last error in manual mode.

gptr 1.1.0

CRAN release: 2026-11-19

Tool calls spend less time in gptr itself. Every permission rule, guard, checkpoint and secret check stays; each is paid once per call or per version of an object, at a cost that does not grow with the data. Times below are medians against 1.0.1 with a fake provider on one Mac (arm64, R 4.6.1) under a load average of 70-500, so they are approximate; the large-object numbers use a workspace shaped like task T03 of the gptr-bench benchmark, a list of 300 tables.

Faster tool calls

  • On the gptr-bench T03 replays, run back to back on one Mac against 1.0.1, the time gptr adds around a tool call fell from 1.9-2.1 s to 0.03 s (minimal replay, installed builds), and around the MCP route’s second and third requests at 300 tables from 2.6-2.8 s to 0.4-0.6 s (MCP profile, source builds).
  • The size of an object is computed once per version of it and shared by the permission gate, the checkpoints and the workspace summary, which each computed it before. Around the T03 workspace’s second and third requests gptr now adds 0.67-0.75 s, against 5.0-5.7 s; the request that creates the list takes 1.8 s instead of 4.7 s, and a call that adds one element to it 0.56 s instead of 5.8 s, in a non-interactive session. peter(x, ...) no longer sizes x again for each request. Code you run at the console, in a notebook cell or in a knitr chunk between requests may change an object in place, so the next permission check measures the objects it overwrites again.
  • Sizing an object reads at most 12.5 million strings; longer character data is sampled and the size is shown as an estimate (about 3.4 GB) in the workspace summary, object descriptions and the permission question about overwriting it. Objects with fewer strings keep their exact sizes. A vector of 50 million strings is sized in 1.7 s instead of 10.6-14 s. An estimate is at or above the true size on average, and at the defaults of gptr.protect_size and undo.capture_max no permission or undo decision rests on one.
  • Each tool call’s input is classified once, not twice: a 25-line r call takes 123 ms instead of 142 ms, 110 ms instead of 132 ms over MCP.
  • gptr.checkpoint_scan_budget (0.25 s) now limits the project scan time of a whole request. While it lasts, every writing call scans the project before and after it, as before; past it, calls back up the files they name and one scan at the end of the request records the rest. A ten-call request in a project of 600 entries scans 3 times instead of 20 (0.62 s instead of 4.1-4.7 s). Past the budget, an edit you make to a project file while the request runs is recorded as part of it, so undoing the request reverts that edit too, as in large projects before. A slow scan no longer switches the whole session to one scan per turn.
  • A project scan checks each folder’s entries in one pass: 1,231 linked input files take 0.04 s instead of 0.21-0.26 s, and 1,231 regular files 0.19-0.21 s instead of 0.36 s.
  • A call in a workspace of 1,000 objects costs 141-152 ms more than in an empty one (was 285 ms), and in one of 10,000 objects 1.7-1.8 s more (was 3.9 s).
  • A request reuses the encoding of the messages it sent before, and the agent loop no longer waits 5 ms after each step: at about 300 messages a turn takes 151 ms of gptr’s time instead of 350 ms.
  • The Codex route starts gptr’s relay with only the base package attached: 0.13 s instead of 0.33 s per request. A coaching session’s Codex hook starts the same way: 0.25 s instead of 0.5 s per Codex tool call.

Undo of large objects

  • Undo keeps an object’s old value by reference and writes nothing before a call. The 2.8 s an interactive session spent saving the T03 list to disk before a call that edits it in place is gone; the edit itself copies only what it touches: a whole vector or matrix, one column of a data frame.
  • The memory and disk limits hold after every call, not only at the end of a turn. Images written to disk count against undo.disk, which caps them per session, and a restore reads the file as a stream, needing the object’s size in memory instead of twice it.
  • The four undo options are now one setting, undo, changed like any other with gptr_config(), for example gptr_config(undo = list(memory = 4e9), .scope = "user"). Its defaults are those of 1.0.1: capture_max = 1e8, memory = 1e9, disk = 2e9 and turns = 20. The options gptr.undo.capture_max, gptr.undo.memory, gptr.undo.disk and gptr.undo.turns are its option layer. gptr.undo_capture_max, gptr.undo_max_bytes, gptr.undo_spill_max and gptr.undo_turns are removed, with no aliases; disk limits all of a session’s images on disk, where gptr.undo_spill_max limited one.

Bug fixes

  • An object you change after a turn, by assigning it again or editing it in place, is a conflict at the next undo or redo: your value is kept and reported unless force = TRUE. Undo used to overwrite an in-place edit of a value it had restored from disk or from a copy. ?gptr_rewind describes the edits it cannot see.
  • gptr_checkpoints() counts an object as restorable only while its image is still kept, and each “cannot be undone” message names the limit to raise (undo.memory or undo.capture_max). For code whose targets cannot be predicted, the message lists every object over undo.capture_max, since such code may change any of them.
  • Calls served over MCP or to a command-line route (Claude Code, Codex) are gated and checkpointed with the risk of their final input: after a tool_call hook rewrites a call into code that writes a file, the file is backed up and gptr_rewind() removes it. A served tool whose risk function fails or returns no level is treated as level 3, as on the native route.

gptr 1.0.1

gptr 1.0.0 is on CRAN: install.packages("gptr"). The development version installs with pak::pak("Broccolito/gptr").

New features

  • gptr_models(provider = "codex", refresh = TRUE) lists the models a provider or the claude and codex command-line tools advertise, after consent and under the replay guard. Listings run only when you ask, say when they were checked, and keep the earlier entries when a refresh fails. The console footer separates the model you selected from the model the provider reports.
  • Sub-agents resolve model aliases before a backend is chosen and inherit their parent’s model unless the call or the agent names another; API providers, Claude Code and Codex share one selection path. An agent can run typed System 1 decisions in bounded parallel batches from its R code; each answer is charged to the session that asked and to its budget.
  • The terminal console shows sub-agents while they work: completed, active and pending counts, each child’s model, and its tool and retry progress. Direct team and fan-out calls return visibly, so their reports print.
  • peter$search() and peter$help() find the installed package’s exported functions and help pages, so an agent can look up setup functions such as gptr_mcp_add(); peter$help("gptr::name", source = TRUE) returns a function’s definition.
  • Assisted setup can ask for a credential with hidden input, showing where it goes and how it is stored; the value never reaches the model, and you can skip or cancel. gptr_login() gains scope = "session" (this R process only) and scope = "keyring" (the operating system’s keyring). Questions accept /skip and /cancel.
  • /mcp serve returns from the chat to R’s prompt while the MCP server keeps serving; gptr_last() |> peter() resumes the chat.

Bug fixes

  • Automatic file checkpoints no longer inventory and copy a whole working directory before the first response. A scan runs for at most two seconds, inspects at most 2,000 entries and backs up at most 256 files within the existing byte limits; a scan that stops early is reported once per folder. The files Peter’s tools name are still backed up before they change, on every route; other changes to unvisited files (computed paths in R code, shell commands, a CLI’s own edits) cannot be undone automatically. Turns that only run R code on objects or only answer in text rewind fully. Folder discovery remains available on demand through ls, find and read.
  • Interrupting an MCP request while its initial message is being sent now sends cancellation, including when progress arrives before the send completes.
  • What you send while Peter works stays in the console’s transcript. A steer (Enter, or the pause menu’s s) is written at once as steer> <text> and a follow-up (Tab, or f) as next> <text>, at the left edge like the peter> prompt. It used to show only on the bottom row, which disappears while R code runs and when the terminal scrolls, and reached the transcript only when the agent took it, marked like an answer. Keys typed while R code runs in this R process are read when it returns, each Enter, Up and Tab in turn; keys typed before the run starts become the draft, never an answer. The bottom row shows from the prompt’s Enter, says responding while the answer streams and counts what is queued (1 steer queued). Answers to a question are read two columns in, under it, so an answer no longer looks like a message to the agent.
  • Typing does not steer in RStudio, R.app or Windows’ Rterm, so their banner and /help now say how to: esc, then s, to steer (Rterm: ctrl-c, then s, to steer); in RStudio and Rterm the bottom row says it too and adds typed lines run after this answer.
  • A question asked while the bottom row is shown, such as a provider consent, no longer leaves copies of that row in RStudio’s console or draws it between the question and its answer.
  • In the console, gptr’s yes/no questions, such as consent to send session context to a provider, are asked as console questions (? <question>, its keys, the answer read under it), and a declined send prints a dim Not sent: notice instead of an error.
  • Token totals count a request whose provider reported no usage apart (13.9k tokens + 1 request of unknown tokens) instead of reading unknown tokens for the whole session.
  • A tool call’s header shows a path inside the project relative to it and shortens a long path or command in the middle, keeping the file name.
  • A Ctrl-C pressed just as an answer ends no longer leaves peter() or turns the terminal’s echo off (seen with TERM=dumb); the console stays and keeps its session.
  • MCP clients no longer stall while gptr waits for a child process, and a served tool cannot run inside another served tool’s wait.
  • Plugin setup rejects a marketplace root, and a bundle without usable resources, with a diagnostic that names the fix; an invalid configured plugin path is reported instead of being skipped silently.
  • Help pages for callbacks, custom backends, inferred tool schemas, images, approvals and side effects now match the implementation; project-scoped MCP servers need an initialized workspace (gptr_init()).
  • citation("gptr") and the site’s citation page cite the CRAN release with its DOI, 10.32614/CRAN.package.gptr.
  • model = "codex" uses the shipped Codex default again: a model the Codex CLI advertises but a ChatGPT login refuses is no longer picked as the default. Codex errors show their message, not raw JSON.
  • System 1 guidance writes the model as a string (model = "jev"), so agents no longer look for an object named jev. A decision model keys an unnamed input as input and a named one by its name, so renaming a variable reuses cached answers. Answers that 1.0.0 recorded for an unnamed input need one live run (replay = "auto") before they replay.
  • Rejected or unsent System 1 requests cost a known zero, a worker’s decisions are charged at the System 1 model’s price, and peter() warns when an agent option such as backend = is passed as context.
  • /skip and /cancel (in any case) typed at a hidden credential prompt skip or cancel instead of being stored, gptr_login() reports what it stored and where, and a session login reaches worker sub-agents and coaching runs.
  • Client snippets of gptr_mcp_serve(), $config and Codex $env no longer show the bearer token in Jupyter or knitr output, or in format() and str(). An explicit mode = on a resumed chat applies when the console opens, so /mcp serve uses it; in plan mode the server answers read-only R calls and refuses writes.
  • Notebooks run unattended (jupyter nbconvert --execute, papermill) no longer wait for an answer to a gptr question; console recordings into .Rmd and .qmd load gptr and keep ! lines, so the documents knit; the notebook bound with gptr_doc() is the one recorded.
  • Lines of R output reach the model whole instead of being cut at 400 characters; assignments inside local() and reading a trust decision are no longer flagged as risky.
  • peter$search() keeps callable members, skills and tools ahead of help pages, and a bare plugin name is no longer blocked by a folder of the same name.

gptr 1.0.0

CRAN release: 2026-11-01

gptr 1.0.0 is a complete rewrite: it runs language model agents in an existing R session, where generated code can inspect and modify objects already in memory.

Breaking changes

  • The 0.7.0 interface, get_response() and dataframe_to_text(), is removed with no aliases.
  • Instead of get_response(), use session = peter("your prompt", model = "openai/gpt-6-sol"), which returns a session object; its answer is session$text, and session |> peter("next prompt") continues the conversation. The key comes from OPENAI_API_KEY (or a .env file read with gptr_env()) instead of the api_key argument, instructions that went into system_specification go into the prompt or the project instructions file .gptr/vignette.Rmd, and answers stream to the console when a person is present instead of through print_response.
  • Instead of dataframe_to_text(), pass the data frame to peter() as context, for example peter("Which variables are correlated?", mtcars): gptr describes the object compactly and the model computes on it in your session.
  • Providers and models are chosen with the model argument or with gptr_config().
  • ‘RCurl’ is no longer used; HTTP is handled by ‘curl’.
  • R 4.2.0 or later is required.
  • Remote providers require a one-time egress acknowledgment even with context = "none". That setting still omits workspace and attached-object descriptions, while retaining project instructions and environment details. Unattended runs need saved provider consent; offline providers and local loopback routes remain exempt, with Ollama exempt only while its local-only inference is on.
  • Require cli >= 3.6.2 and processx >= 3.8.6, matching the APIs and process-startup behavior used by the package.
  • gptr is now licensed under the Apache License 2.0; gptr 0.7.0 was MIT-licensed. Third-party notices are in inst/COPYRIGHTS.

New features

  • peter() is the single entry point. Without a prompt it opens a chat in the console; with a prompt it runs the agent loop and returns the session. The pipe steers one session: peter("...") |> peter("...") adds turns to the same object. gptr_fork() is the only way to branch. Sessions are saved in the project’s .gptr/ workspace (without one, until R exits) and resumed with gptr_sessions(), gptr_resume() and gptr_last().
  • With no default model, the interactive console offers Claude Code CLI or Codex CLI setup, or API instructions; gptr_providers(check_login = TRUE) shows CLI sign-in status.
  • The agent evaluates R code in the environment you pass (by default the caller’s frame), so objects it creates stay in your workspace. It reads, writes and edits files, and searches them with peter$grep(), peter$find() and peter$ls(); shell, Python, SQL and knitr engines are reached through peter$sh(), peter$py(), peter$sql() and peter$knit().
  • Providers are implemented in R: Anthropic, OpenAI, Google Gemini, OpenAI-compatible endpoints and local Ollama servers, with streaming, tool calls, images, reasoning controls, prompt caching (not yet through api = "bedrock-converse") and cost accounting where the model supports them. The Claude plan (through the claude command-line tool, experimental) and the ChatGPT plan (through codex) are supported without keys. See gptr_providers() and gptr_models().
  • System 1 decisions: with a typed decision model, TypeSafe AI’s Jev or Clef and Clef Flash on a local Ollama server (0.35.1 or later), peter() returns logical, choice or score vectors with their probabilities (gptr_prob()) that work inside if, for and while, one element per input. A generative model can emulate them; emulated answers are marked as uncalibrated.
  • Permission modes manual (default), edits, auto and plan, rules with gptr_permissions(), and an advisory risk classifier, gptr_risk(). Deny and ask rules also match read-only shell commands, such as r(sh:cat *). A permission question without a person present stops the run with a classed condition. In auto and yolo mode, system(), system2(), shell() and shell.exec() with a command the code computes (system2()’s env included) are refused unless an allow rule such as r(fn:system) names the function; the model is pointed to peter$sh(), whose command the rules check when it runs.
  • gptr asks, in auto mode too, before a Sys.setenv(), Sys.unsetenv(), withr::local_envvar() or withr::with_envvar() call, or an os.environ write in peter$py() or peter$knit("python", code) code, that sets or unsets R_USER_CONFIG_DIR, XDG_CONFIG_HOME, HOME, APPDATA or USERPROFILE (the last two matter on Windows; gptr asks on every system), which move its configuration folder or your home, as it does for a provider key. It also asks before such an R call with a name it cannot read, and before readRenviron() and dotenv::load_dot_env(); ?gptr_security lists the changes it does not read.
  • Scripts and notebooks are the history: code the agent ran is recorded below each peter() call in .R, .Rmd, .qmd and .ipynb documents, also what a call ran before it failed, and replays without model calls (gptr_doc(), gptr_source(), gptr_blocks(), gptr_cache()); gptr_source(model =) asks a recorded analysis again with another model. A console transcript also records a run that was aborted or stopped by an error, marked ## Run: <status>.
  • A console transcript records what each prompt was sent with (the head of each @file and the notes of earlier ! lines, as #< lines) and, after /model or /mode, the model and mode a turn ran with, so gptr_source(replay = "live") sends each turn again with what it was sent with and asks it on that model and in that mode (a turn that names none is asked with those its session has from the turns before, else with the model and mode settings of the session that re-asks); code the model wrote is never sent again as your context or your steer. A ! line that uses an object of an undone turn is turned off (#~) and back on after /redo, so source() does not stop there, and /retry sends a turn’s ! notes again when that turn is the latest message sent. gptr_export() turns such a transcript into an ordinary R script.
  • gptr_init() creates a .gptr/ project workspace with the project instructions file .gptr/vignette.Rmd; gptr_config() and gptr_trust() manage settings and trust.
  • Checkpoints: gptr_rewind(), gptr_checkpoints() and /undo restore objects, files and the conversation.
  • Sub-agents, teams and fan-outs (agents =, parallel =, gptr_parallel()), across providers.
  • Skills, prompt templates, agent files, extensions and plugins in R packages, all on one versioned extension API (gptr_register(), gptr_spec() and the spec constructors).
  • gptr_tailor() makes a harness: a function you call exactly like peter() that carries peter() arguments you fix (such as mode, model, tools or extensions), your own hard rules, and coaching: a note added to peter’s instructions, skills peter can open, a review that asks peter to check its work before it stops, and rules. It calls no model. Share a harness with saveRDS() and load one with gptr_tailor(readRDS(file)); dir = writes it out as files to read.
  • gptr_coach() improves a harness’s coaching by running your task: the harness does the task, two coaches propose new coaching, each proposal does the task, a third coach combines them, and the result does the task once more. Code keeps the new coaching only when that last run ended normally, delivered what the first one did, took no riskier kind of action and passed your own check. k (1 to 5) asks for more coaching: with strategy = "parallel" it runs k of each side by side, and when more than one result passes, a blind judge picks one; with "sequential" it runs k rounds, each building on the one before. Every session runs unattended in its own R process with copies of your objects. It works on API keys and on Claude Code and Codex plans (on a plan, at most two sessions at once, and it stops at a plan limit). A call such as h = gptr_coach(...) in a script or notebook is recorded as the coaching it produced and replays without a model, a key or any process.
  • A skill can carry its own text: gptr_spec("skill", name, description = ..., text = ...) needs no SKILL.md file. A skill registered for a call, by an extension or a harness, stays in that session.
  • Hard rules as data, in gptr_tailor(peter, rules = list(never = ..., require = ...)) and in coaching: a never rule, such as r(category:install), refuses every matching call in every mode, sub-agents included; a require rule names a call that must happen before peter finishes, such as saving results with write.csv(), and gptr reminds peter at most twice and reports a requirement still missing. Rules read the code before it runs, so a name or path the code computes can slip past them.
  • Your own policies bind sub-agents: a policy you pass with extensions = also applies to every session the run starts (a peter() call from the agent’s code, team members, fan-out children and workers). A nested peter$sh(), peter$write() or peter$edit() whose command or path the agent’s code computes meets every deny and ask rule, and the strictest answer wins.
  • A weekly or model-family limit on a Claude or ChatGPT plan is not retried, and reaching any plan limit on the claude-cli or codex route signals gptr_error_plan_limit, with the time the limit resets when the CLI says it.
  • .opts$returns works on Claude Code (claude-cli): gptr asks for the reply’s shape at the end of the prompt and checks the reply itself.
  • An extension factory with a gptr_key attribute (a string) loads once per session, so passing it again when you continue the session does not load it twice.
  • MCP: a client for both protocol eras (gptr_mcp(), gptr_mcp_add()) that exposes server tools as R functions, and gptr_mcp_serve(), which serves the live session to other agents. A project’s own servers, also those in the project files of Claude Code, Codex, Cursor, VS Code and Pi, start only in a trusted project.
  • Artifacts are Shiny apps launched in the background from the live session (gptr_artifacts()).
  • Secrets are kept in a private vault and redacted everywhere; gptr_login() signs in to providers and MCP servers, gptr_env() loads .env files (including the jev-key alias) and gptr_scrub() cleans files that captured a key. Model code that reads a registered key, or hands one to a child process through the env of peter$sh() or peter$script(), asks in auto mode too.
  • Token accounting and budgets: gptr_usage(), gptr_prompt(), gptr_describe() and the budget argument.
  • Background sessions (background = TRUE) are experimental.
  • See ?gptr_security and ?gptr_egress for what gptr does on your behalf and what it sends to model providers, and ?gptr_options for every option.
  • Successful removal of CLI billing variables emits an informational gptr_message_billing_env condition with the removed names, never their values. Handlers use muffleMessage; the notice respects gptr.quiet. Actual billing refusals remain errors.
  • The yolo mode (mode = "yolo", /mode yolo) runs actions without approval, including package installs, writes anywhere and gptr’s own configuration functions. A person is still asked before deleting files outside the project or protected files, moving the working directory out of the project, rm(list = ls()), options(gptr.*) and sending a secret over the network; a one-time notice says so. setwd() or withr::local_dir() to a directory the code computes, such as setwd(here::here(d)), counts as such a move, in auto too; here::here() of literal parts and a computed directory R moves back from, as with withr::with_dir(), do not. The classifier reads code; it is not a sandbox. In every mode, model code that would end or hang the R session, such as q() or readline(), is refused without a question.
  • In a terminal, what you type while the agent works is a draft on the bottom row: Enter sends it as a steer, which the agent reads at its next step, and Tab as a follow-up, the next prompt (setting type_ahead swaps the two); Up takes back a message not yet delivered, and /command and !code lines wait for the next prompt. A paste is one draft, however busy the session, in a terminal that supports bracketed paste. A question waits for typing to pause and keeps the draft. On the CLI routes a steer is sent after the CLI’s answer. In RStudio and R.app (Esc) and Positron (Ctrl-C) the pause menu steers.
  • A line typed or pasted before a question (an approval, a choice or a yes/no confirmation) never answers it. In a macOS terminal (CRAN’s R) a block pasted at the peter> prompt is sent as one message, pasted fences and """ blocks are read at once, a block pasted at an approval or a choice is kept in the console history, not read as the answer, and one pasted at the pause menu’s steer or follow-up question is the whole message; a last pasted line without a newline waits for Enter at the next prompt, so a two-line paste without a final newline answers a question with its first line. Elsewhere a block pasted at a prompt or a question arrives one line at a time, as typed lines do.
  • R in the Terminal tab of RStudio or Positron is treated as a terminal (completion, pause menu, interrupt key). Tab completes only after @, !, !!, / and peter$, never in plain text, and never offers a name that holds a line break or another control character.
  • The console keeps answers, tool calls, notices and prompts in a two-column margin with one blank line between them, aligns Markdown tables, keeps nested lists and highlights R code. Code blocks in answers are shown as Markdown fences that copy and run as written.
  • A sub-agent’s approval prompt reaches the console even while the parent’s R code runs and names the sub-agent; an invalid answer is explained. Fan-outs, teams and gptr_parallel() print one line when each sub-agent starts and ends.
  • A peter() call made by the agent’s own code without envir = works in an overlay of the caller’s environment; its objects are in res$envir.
  • Object sizes are honest: S7 objects such as ggplot2 plots are not sized by object.size(), code the agent runs keeps no parse data, and values returned by sub-agents stay small.
  • Codex reaches the session through a base-R stdio relay, without ‘httpuv’, ‘later’ or ‘openssl’, and both CLI routes get the session’s full tool set. Codex reasoning and commands show as progress lines and Claude Code’s calls of gptr’s tools as tool lines while they run. Codex’s own shell runs within Codex’s sandbox, outside gptr’s permission gate.
  • /model and model = accept a provider name alone, such as claude-cli or codex-cli (its first model); /model checks the name before the first prompt. A model declared without tool calls says once that the session’s tools are not sent.
  • Amazon Bedrock’s Converse API with AWS access keys: api = "bedrock-converse" signs requests with Signature Version 4 in R. Region and endpoint are provider-record data (compat = list(region = ...), base_url), so a SigV4 gateway is configuration; see ?gptr_provider. AWS_ACCESS_KEY_ID is handled as a secret.
  • On the Claude Code and Codex CLI routes, cost and tokens count each turn’s increase of the CLI’s running totals instead of the totals themselves. The status line counts the run’s requests and adds what its sub-agents cost, /cost lists each agent and one total that keeps the known cost when a request’s cost is unknown, and /context says the CLI keeps its own transcript.
  • On the CLI routes, /undo and gptr_rewind() restore what the agent’s served calls changed, and a rewind or compaction starts a fresh CLI conversation. Automatic compaction does not run there, since the CLI keeps its own context. /undo reports each item once, by its outcome.
  • Multi-panel plots such as par(mfrow = c(1, 2)) keep every panel and knitr chunks keep their figures; plots of calls served to the CLI routes are drawn on your device.
  • A fan-out child gets its own element as .x; parallel = with .opts$context = "none" is an error. A peter() call made by the agent’s code without model = uses the running session’s model, and the egress question names the sub-agent that asks. Assignments in a sub-agent’s overlay are not reported as overwriting your objects.
  • The delete guard also covers a path held in a variable assigned from literals, as in p = normalizePath("../x.txt"); file.remove(p).
  • Console layout: the approval prompt lists at most five flagged calls, one per line, and offers a and p only when it has a rule to suggest (typed anyway, they say why, such as an ask rule that asks every time); result lines and errors wrap in the margin, and a failed r call still lists its objects; sub-agent failures give their reason and count, and repeated nested prompts are numbered; command output and long prompts stay in the margin; Codex commands show without their shell wrapper and Codex messages without a held last word; a cut code block says so inside its fence; wide pipe tables stream verbatim; /model and /status name the model behind a CLI’s default.
  • gptr_models(refresh = TRUE) reads each models.dev price tier once, so models with a 200k-token price tier resolve and a 272k tier gains no premium from 200k tokens.
  • A model alias with no model in the catalog is an unknown model, not a guess: offline, model = "gemini" (Google’s newest Gemini Pro) asks for gptr_models(refresh = TRUE) or a provider/id.
  • Models whose catalog gives the whole context window as their output limit (common after gptr_models(refresh = TRUE), for example MiniMax-M3 and gpt-oss-120b) are not refused as too small: gptr reserves and requests at most half the window for output. A compact_at too small for the preset is named as the cause, and the hint reads tools = "minimal".
  • An Ollama model refused for missing or outdated discovery names gptr_models(provider = "ollama", refresh = TRUE) as the remedy, not the internal model_prepare().
  • peter(model = "ollama/<model>") asks the Ollama server about that model before its first request in each R session, as System 1 calls do, so a saved default Ollama model works in a new session.
  • An unknown provider/id on a route the catalog lists no models for yet (before a refresh, for example OpenRouter, Groq, xAI or Azure) says that gptr_models(refresh = TRUE) downloads them from models.dev.
  • gptr_provider() and gptr_spec("model") accept a model’s prices as a list of price records as well as a data frame, as gptr_config(providers =) does, and check the table when the spec is built, naming the field.
  • A provider without a valid base URL, such as azure/ before AZURE_OPENAI_ENDPOINT is set, names the variable that sets it (or providers$<id>$base_url in gptr_config()).
  • An unnamed list in a higher settings layer, such as a provider’s models set with gptr_config(.scope = "session") or options(gptr.providers =), replaces the one in a lower layer (for example the user file); named lists merge.
  • gptr_config() warns when it saves a setting to a project that is not trusted and so does not apply it (for example providers or model), naming gptr_trust() and .scope = "session"; settings that only tighten, such as mode = plan or deny rules, stay silent (a permissions write names only its allow rules).
  • gptr_config(model = opuss) (or small_model, system1) warns when the name is not a model gptr knows in this session, as the console’s /model does, with the reason and how to undo it; the value is still saved, since a provider registered later or a catalog refresh can make it valid.
  • gptr_init() writes no mode or record into .gptr/settings.json, so a user-level mode = auto or record = "auto" applies in every initialized project. In a project made by a development build from GitHub, delete "mode": "manual" and "record": "ask" from that file to let your user settings apply.
  • A trusted project’s mode applies, so gptr_config(mode = auto) in a trusted project takes effect; an untrusted project only tightens the mode, and context and record only tighten in any project. A project cannot select yolo: gptr_config(mode = yolo) at project scope is refused, naming .scope = "user" and "session".
  • Providers declared with api = "bedrock-converse" send thinking levels (.opts = list(thinking =) or a :high suffix) to a Claude model whose record declares capabilities = list(adaptive_thinking = TRUE, effort = TRUE) (Claude 4.6 and later; see ?gptr_provider). Any other model, an undeclared Claude record included, runs without thinking and says so once.
  • A string that is not one of an argument’s choices, such as .opts = list(thinking = "ultra"), is reported as such (“the string given is not one of them”, with “Did you mean” when it differs from a choice only in case).
  • A thinking level the model does not offer becomes the nearest one it has, and gptr says so once per model and level: for example "opus:off" runs at low, and thinking = "max" on a model whose levels end at high runs at high. ?gptr_provider documents thinking_levels; a reasoning model declared without it gets off to high.
  • A known name, such as a model alias or a built-in tool, wins over a variable of the same name, and gptr says so when the variable holds a character value or a spec the argument takes (a provider or router for model, a tool for tools): after opus = gptr_fake_provider(...), model = opus uses the alias and suggests !!opus.
  • choices, levels, threshold, min_confidence and uncertain given to a conversational model, also with agents = or parallel =, are refused, naming the argument. Use a decision model such as jev; after gptr_config(system1 = "emulate:<ref>"), model = jev runs it through a chat model. A decision model refuses agents = and parallel =: it answers every input in one call.
  • The uncertain = "stop" error names the uncertain inputs (the first ten) and carries their positions ($index), $names and $confidence, the confidence the band tests, every answer ($value) and $prob.
  • as.data.frame() of a System 1 score names its probability columns by level (p_<level>), as gptr_prob(x, "probabilities") and choices do.
  • choices given as a factor, or .opts = list(output = "factor"), return a plain factor without probabilities, as ?peter, ?gptr_prob and the System 1 vignette say. When elements fail, the factor keeps attr(x, "meta")$errors, which the failure warning points to.

gptr 0.7.0

CRAN release: 2025-04-05

  • Last release of the 0.x interface, get_response() and dataframe_to_text() for the OpenAI ‘ChatGPT’ API (released 2025-04-05, after 0.5.0 and 0.6.0 in May 2024).