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.Rand 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,autoby default. Serve withmode = "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/tomcp-bridge/, and its texts no longer call it gptr Agent outside Biorouter. Biorouter’s extension keeps its name, gptr Agent, and its idgptragent; Claude Code and Codex keep the plugingptr. - The bridge’s Python package is
gptr_mcp_bridge, andGPTR_RSCRIPTnames the Rscript it asks when no session is found (GPTRAGENT_RSCRIPTstill works). Its build can make the bundle under Biorouter’s coming idgptr(toolsgptr__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.gitand.envor 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 asystem()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 statusblocked. A session served withgptr_mcp_serve()withoutmodealso starts inauto, so its client can change objects, and on thecodexroute Codex’s own shell can change files in the project. To approve each change as before, usegptr_config(mode = "manual", .scope = "user");/modeswitches a console, andyoloasks less still. The console prompt ispeter>inautoand names any other mode (peter[manual]>), and the banner names the mode only when it is notauto. - A path’s class no longer drops when R warns while gptr reads it. With
HOMEnaming 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,.gitor.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 carriesgptragent.brxtfor Biorouter. - The same folder is a Claude Code plugin and a Codex plugin named
gptr:claude plugin marketplace add Broccolito/gptrthenclaude plugin install gptr@gptr, orcodex plugin marketplace add Broccolito/gptrthencodex plugin add gptr@gptr. Withgptr_mcp_serve(advertise = TRUE)the agent finds the session by itself and gets the toolssessions,inspectandr, with a skill that tells it to look first and change objects in place. - An outside agent’s R calls are recorded. A served
rorinspectcall 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 andgptr_last() |> peter()continues after it. Whilegptr_doc()binds a document, the call is also written into it as a direct R line, sogptr_export()turns the agent’s work into a runnable R script; aninspectcall 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
.Renvironcannot 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. -
/callsprints this session’s last tool call whole, all its code and what an edit or a write changes,/calls 3the 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-cliandcodexroutes ask your installed CLI which models it offers and which one it starts with: Claude Code through its stream-json control requestsinitializeandget_settings, Codex throughcodex app-server(model/list,config/read), elsecodex 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 ongptr_models(provider = "codex", refresh = TRUE), so a CLI update changes what gptr lists without a gptr release./modelon a CLI route lists those models. -
claude-cli/defaultandcodex/defaultrun the model your CLI starts with (Claude Code’s settingsmodel, Codex’sconfig.tomlmodel), named in/model,/status, the status line, thepeter()banner andgptr_models(), as inclaude-cli/default (claude-opus-5-5). When the CLI cannot say, gptr passes no model flag and the CLI chooses;codex/defaultno 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_providerwith its[model_providers.<id>]table,openai_base_urlandmodel_catalog_jsongo to each run as-coverrides, 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_paramsandauthcommands stay off, as does a URL holding a user name or password. Give a key throughenv_keyorenv_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 (
gptisgpt-6.2-sol,geminiisgemini-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
offturns thinking off where a model allows it (Claude Haiku 5.5, Opus 5, Sonnet 5 and 4.x). Gemini 4 getsxhigh; Grok 4.5 and later, DeepSeek, Ollama and vLLM get their reasoning effort by name; OpenRouter respects mandatory reasoning and budget models and sendscache_controlonly where cache writes are billed. A token-budget thinking level stays within the model’sthinking_budgetrange. - A
bedrock-conversemodel gets Anthropic’s thinking fields when its record saysowner = "anthropic", not when its id containsanthropic.claude. Thesupports_reasoning_effortcompatibility 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>.jsoninfile.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 inautomode. Every record’s path ends inR/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";NULLkeeps 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 forrapply to it. Serve the four earlier tools only withtools = c("r", "read", "edit", "write"). - A client of
gptr_mcp_serve()that is servedrorinspectgets fuller instructions: thertool’s guidelines (never reload data already in memory, assign results, print compact summaries), look withinspectfirst, 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 inmanualmode.
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 sizesxagain 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 ofgptr.protect_sizeandundo.capture_maxno permission or undo decision rests on one. - Each tool call’s input is classified once, not twice: a 25-line
rcall 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 withgptr_config(), for examplegptr_config(undo = list(memory = 4e9), .scope = "user"). Its defaults are those of 1.0.1:capture_max = 1e8,memory = 1e9,disk = 2e9andturns = 20. The optionsgptr.undo.capture_max,gptr.undo.memory,gptr.undo.diskandgptr.undo.turnsare its option layer.gptr.undo_capture_max,gptr.undo_max_bytes,gptr.undo_spill_maxandgptr.undo_turnsare removed, with no aliases;disklimits all of a session’s images on disk, wheregptr.undo_spill_maxlimited 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_rewinddescribes 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.memoryorundo.capture_max). For code whose targets cannot be predicted, the message lists every object overundo.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_callhook rewrites a call into code that writes a file, the file is backed up andgptr_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 theclaudeandcodexcommand-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()andpeter$help()find the installed package’s exported functions and help pages, so an agent can look up setup functions such asgptr_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()gainsscope = "session"(this R process only) andscope = "keyring"(the operating system’s keyring). Questions accept/skipand/cancel. -
/mcp servereturns 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,findandread. - 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 assteer> <text>and a follow-up (Tab, orf) asnext> <text>, at the left edge like thepeter>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, saysrespondingwhile 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
/helpnow 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 addstyped 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 dimNot 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 readingunknown tokensfor 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 withTERM=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 namedjev. A decision model keys an unnamed input asinputand 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 asbackend =is passed as context. -
/skipand/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(),$configand Codex$envno longer show the bearer token in Jupyter or knitr output, or informat()andstr(). An explicitmode =on a resumed chat applies when the console opens, so/mcp serveuses 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.Rmdand.qmdload gptr and keep!lines, so the documents knit; the notebook bound withgptr_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()anddataframe_to_text(), is removed with no aliases. - Instead of
get_response(), usesession = peter("your prompt", model = "openai/gpt-6-sol"), which returns a session object; its answer issession$text, andsession |> peter("next prompt")continues the conversation. The key comes fromOPENAI_API_KEY(or a.envfile read withgptr_env()) instead of theapi_keyargument, instructions that went intosystem_specificationgo into the prompt or the project instructions file.gptr/vignette.Rmd, and answers stream to the console when a person is present instead of throughprint_response. - Instead of
dataframe_to_text(), pass the data frame topeter()as context, for examplepeter("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
modelargument or withgptr_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 withgptr_sessions(),gptr_resume()andgptr_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()andpeter$ls(); shell, Python, SQL and knitr engines are reached throughpeter$sh(),peter$py(),peter$sql()andpeter$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 theclaudecommand-line tool, experimental) and the ChatGPT plan (throughcodex) are supported without keys. Seegptr_providers()andgptr_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 insideif,forandwhile, one element per input. A generative model can emulate them; emulated answers are marked as uncalibrated. - Permission modes
manual(default),edits,autoandplan, rules withgptr_permissions(), and an advisory risk classifier,gptr_risk(). Deny and ask rules also match read-only shell commands, such asr(sh:cat *). A permission question without a person present stops the run with a classed condition. Inautoandyolomode,system(),system2(),shell()andshell.exec()with a command the code computes (system2()’senvincluded) are refused unless an allow rule such asr(fn:system)names the function; the model is pointed topeter$sh(), whose command the rules check when it runs. - gptr asks, in
automode too, before aSys.setenv(),Sys.unsetenv(),withr::local_envvar()orwithr::with_envvar()call, or anos.environwrite inpeter$py()orpeter$knit("python", code)code, that sets or unsetsR_USER_CONFIG_DIR,XDG_CONFIG_HOME,HOME,APPDATAorUSERPROFILE(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 beforereadRenviron()anddotenv::load_dot_env();?gptr_securitylists 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,.qmdand.ipynbdocuments, 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
@fileand the notes of earlier!lines, as#<lines) and, after/modelor/mode, the model and mode a turn ran with, sogptr_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 themodelandmodesettings 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, sosource()does not stop there, and/retrysends 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()andgptr_trust()manage settings and trust. - Checkpoints:
gptr_rewind(),gptr_checkpoints()and/undorestore 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 likepeter()that carriespeter()arguments you fix (such asmode,model,toolsorextensions), 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 withsaveRDS()and load one withgptr_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 owncheck.k(1 to 5) asks for more coaching: withstrategy = "parallel"it runskof each side by side, and when more than one result passes, a blind judge picks one; with"sequential"it runskrounds, 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 ash = 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 noSKILL.mdfile. 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: aneverrule, such asr(category:install), refuses every matching call in every mode, sub-agents included; arequirerule names a call that must happen before peter finishes, such as saving results withwrite.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 (apeter()call from the agent’s code, team members, fan-out children and workers). A nestedpeter$sh(),peter$write()orpeter$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-cliorcodexroute signalsgptr_error_plan_limit, with the time the limit resets when the CLI says it. -
.opts$returnsworks 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_keyattribute (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, andgptr_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.envfiles (including thejev-keyalias) andgptr_scrub()cleans files that captured a key. Model code that reads a registered key, or hands one to a child process through theenvofpeter$sh()orpeter$script(), asks inautomode too. - Token accounting and budgets:
gptr_usage(),gptr_prompt(),gptr_describe()and thebudgetargument. - Background sessions (
background = TRUE) are experimental. - See
?gptr_securityand?gptr_egressfor what gptr does on your behalf and what it sends to model providers, and?gptr_optionsfor every option. - Successful removal of CLI billing variables emits an informational
gptr_message_billing_envcondition with the removed names, never their values. Handlers usemuffleMessage; the notice respectsgptr.quiet. Actual billing refusals remain errors. - The
yolomode (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()orwithr::local_dir()to a directory the code computes, such assetwd(here::here(d)), counts as such a move, inautotoo;here::here()of literal parts and a computed directory R moves back from, as withwithr::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 asq()orreadline(), 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_aheadswaps the two); Up takes back a message not yet delivered, and/commandand!codelines 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
@,!,!!,/andpeter$, 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 withoutenvir =works in an overlay of the caller’s environment; its objects are inres$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.
-
/modelandmodel =accept a provider name alone, such asclaude-cliorcodex-cli(its first model);/modelchecks 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_IDis 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,
/costlists each agent and one total that keeps the known cost when a request’s cost is unknown, and/contextsays the CLI keeps its own transcript. - On the CLI routes,
/undoandgptr_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./undoreports 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. Apeter()call made by the agent’s code withoutmodel =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
aandponly 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 failedrcall 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;/modeland/statusname the model behind a CLI’sdefault. -
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 forgptr_models(refresh = TRUE)or aprovider/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. Acompact_attoo small for the preset is named as the cause, and the hint readstools = "minimal". - An Ollama model refused for missing or outdated discovery names
gptr_models(provider = "ollama", refresh = TRUE)as the remedy, not the internalmodel_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/idon a route the catalog lists no models for yet (before a refresh, for example OpenRouter, Groq, xAI or Azure) says thatgptr_models(refresh = TRUE)downloads them from models.dev. -
gptr_provider()andgptr_spec("model")accept a model’spricesas a list of price records as well as a data frame, asgptr_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/beforeAZURE_OPENAI_ENDPOINTis set, names the variable that sets it (orproviders$<id>$base_urlingptr_config()). - An unnamed list in a higher settings layer, such as a provider’s
modelsset withgptr_config(.scope = "session")oroptions(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 exampleprovidersormodel), naminggptr_trust()and.scope = "session"; settings that only tighten, such asmode = planordenyrules, stay silent (apermissionswrite names only itsallowrules). -
gptr_config(model = opuss)(orsmall_model,system1) warns when the name is not a model gptr knows in this session, as the console’s/modeldoes, 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 nomodeorrecordinto.gptr/settings.json, so a user-levelmode = autoorrecord = "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
modeapplies, sogptr_config(mode = auto)in a trusted project takes effect; an untrusted project only tightens the mode, andcontextandrecordonly tighten in any project. A project cannot selectyolo: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:highsuffix) to a Claude model whose record declarescapabilities = 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 atlow, andthinking = "max"on a model whose levels end athighruns athigh.?gptr_providerdocumentsthinking_levels; a reasoning model declared without it getsofftohigh. - 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 fortools): afteropus = gptr_fake_provider(...),model = opususes the alias and suggests!!opus. -
choices,levels,threshold,min_confidenceanduncertaingiven to a conversational model, also withagents =orparallel =, are refused, naming the argument. Use a decision model such asjev; aftergptr_config(system1 = "emulate:<ref>"),model = jevruns it through a chat model. A decision model refusesagents =andparallel =: it answers every input in one call. - The
uncertain = "stop"error names the uncertain inputs (the first ten) and carries their positions ($index),$namesand$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>), asgptr_prob(x, "probabilities")and choices do. -
choicesgiven as a factor, or.opts = list(output = "factor"), return a plain factor without probabilities, as?peter,?gptr_proband the System 1 vignette say. When elements fail, the factor keepsattr(x, "meta")$errors, which the failure warning points to.