Reads an .R, .Rmd, .qmd or .ipynb document and lists its gptr blocks with their
status: fresh (the owning call's prompt matches), stale (the prompt changed, or no call
owns the block), user-edited (the body no longer matches its sha) or undone (made inert
by a rewind). Interpolated values are only known when the call runs, so they are not checked
here, nor are the answer caches: a fresh System 1 block replays from its cached answers, which
outside a .gptr/ workspace last only for the R session that made them (gptr_init() keeps
them). It reads the document; the only write is that blocks an Rscript run queued before it
was killed are applied first (never over your edits).
Value
A gptr_blocks data frame with columns id, lines, prompt, status, model,
date, tokens, cost, session. cost is in USD: 0 for a known free route (a local
model), NA when unknown or not recorded.
Examples
f = tempfile(fileext = ".R")
writeLines(c('peter("add one")',
"# >>> gptr:7f3a21 model=fake/fake-1 date=2026-09-29 prompt=3b1c9a0e77d2",
"x = 1 + 1", "# <<< gptr:7f3a21"), f)
gptr_blocks(f)
#> id status lines prompt model date tokens cost session
#> 1 7f3a21 stale 2-4 add one fake/fake-1 2026-09-29 NA NA NA
#>
#> # 1 row