rrotor

Programs

A program is a git repo with a manifest and Python functions, deployed to your rrotor by commit and run in a sandbox, with secrets, schedules, a SQLite database and approvals.

What a program is

A git repo (a folder with its own git init is enough); a version is a commit.

glyphh.jsonThe manifest
program.pyThe functions; load and end are optional hooks, never functions
requirements.lockOptional: Python dependencies pinned with hashes, binary wheels only, installed at deploy, never at run
files/Optional: seed files, copied into the program’s folder on its first deploy
tests/Its own tests, with rrotor.testing (no sandbox needed)

With the plugin, ask Claude for what you want run (“each morning, post yesterday’s sales to the ledger”): it agrees with you the hosts it may reach, the steps that need your approval and the secrets it reads, writes it, tests it, commits and deploys it.

The manifest

{
  "name": "daily_sales",
  "description": "A day's sales, added up, converted to euros, and written to its ledger once approved",
  "python": "3.13",
  "functions": {
    "start": {
      "description": "Read a day's export, add it up, write the total to the ledger (asks approval first)",
      "inputs": { "type": "object", "properties": { "day": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" } }, "additionalProperties": false },
      "approvals": ["write"],
      "writes": true
    },
    "summary": { "description": "The ledger", "inputs": { "type": "object", "additionalProperties": false }, "writes": false }
  },
  "hosts": ["api.frankfurter.dev"],
  "secrets": [],
  "databases": ["sqlite"],
  "limits": { "seconds": 60, "memory_mb": 256 },
  "schedules": [{ "function": "start", "cron": "15 6 * * *", "tz": "UTC", "name": "each_morning" }]
}
KeyWhat
nameMatches ^[a-z][a-z0-9_]{0,62}$; the program’s name on the runtime
kindprogram (the default) or cli (CLIs)
description, pythonFree text; python must be 3.13
versionOptional, 1 or more
functionsAt least one, each with description, inputs (a JSON Schema the call is checked against, E_INPUTS), approvals (every step that may ask the person) and writes
hostsThe only hosts a run may reach, HTTPS on 443 (*.example.com allowed). Everything else is blocked
secretsThe secret names it reads, ^[A-Z][A-Z0-9_]{0,63}$
databases["sqlite"]: a SQLite database in its data folder, ctx.db
datatrue: a persistent folder outside git, ctx.data
limitsseconds (1 to 3600, default 300) and memory_mb (64 to 8192, default 512) per run
schedulesFunctions the runtime calls by itself: {function, cron, tz?, input?, name?}
graphread or write: the rrotor’s graph as ctx.graph (Pipelines and the graph)

A deploy refuses (E_MANIFEST, saying where and why) a manifest with an unknown key, a bad value, or a function program.py does not define, read from its syntax tree: no program code runs outside the sandbox.

program.py

from rrotor import Ctx, Result

RATES = "https://api.frankfurter.dev/v1/latest"


def start(ctx: Ctx, inputs: dict) -> Result:
    day = inputs.get("day") or ctx.yesterday()
    export = ctx.files / "sales" / f"{day}.csv"
    if not export.is_file():
        return Result.failed("read", f"There is no sales export for {day}.")
    total = add_up(export)
    rate = ctx.checkpoint(f"rate:{day}", lambda: ctx.http.get(RATES, params={"from": "USD", "to": "EUR"}).json()["rates"]["EUR"])
    if not ctx.ask_approval("write", f"Write {day}'s total, ${total}, to the ledger?"):
        return Result.done({"day": day, "total_usd": str(total), "written": False})
    with ctx.db:                                         # committed at the block's end
        ctx.db.execute("create table if not exists ledger (day text primary key, total_usd text)")
        ctx.db.execute("insert or replace into ledger values (?, ?)", (day, str(total)))
    ctx.log("written", day=day)
    return Result.done({"day": day, "total_usd": str(total), "written": True})
  • A function is def name(ctx, inputs) -> Result, answering Result.done(data), Result.failed(step, reason), Result.needs_input(prompt, schema=None, options=None) or Result.needs_approval(step, prompt). A crash is a failed Result with the error and the step, never an exception to the caller.
  • ctx.http (HTTPS to the declared hosts; any library works too, as HTTPS_PROXY is set), ctx.files (its folder), ctx.data, ctx.db, ctx.secrets, ctx.log(message, **detail), ctx.today(), ctx.yesterday(), ctx.caller (claude or schedule), ctx.clearance.
  • The rrotor package is in the sandbox already: never install it or list it in requirements.lock.
  • Tests use rrotor.testing.Harness: inputs, answers, a folder, an http that answers what the test says, secrets={...} and database=<a file>.

Approvals and inputs

  • ctx.ask_approval(step, prompt) makes the run wait with needs_approval; it returns True once approved, False if declined. A step not named in the function’s approvals fails the run (E_STEP_UNDECLARED).
  • A continue (program_continue with {"approved": true} or false, or the value for an input) calls the same function again with the same inputs. Wrap anything done once, a fetch or a charge, in ctx.checkpoint(key, fn).
  • Approvals are the person’s: Claude shows the prompt word for word and continues only with what you said. A waiting run expires after 15 minutes; approvals lists every one waiting.

Secrets

  • The manifest declares the name ("secrets": ["ANALYTICS_KEY"]); you set the value on the runtime, never in the repo and never in the chat: Claude shows you a form (secrets_form) and what you type goes straight to the vault (or PUT /v1/programs/{name}/secrets/{secret} yourself). The program reads ctx.secrets["ANALYTICS_KEY"].
  • Values are encrypted at rest (AES-256-GCM) with the runtime’s own key, made on first use and never sent anywhere. Listing answers each name, whether it is declared and whether it is set: never a value.
  • Only a run gets a value. A declared secret not set stops the run before it loads (E_SECRET_MISSING, naming it), so Claude knows what to ask you for. A value a program prints or logs is masked as [secret].
  • Secrets go from you to the runtime, never through Glyphh.

Schedules

"schedules": [
  { "function": "start", "cron": "15 6 * * *" },
  { "function": "summary", "cron": "0 9 * * MON-FRI", "tz": "Europe/Amsterdam", "input": {}, "name": "weekdays" }
]
  • Five-field cron, or @hourly, @daily, @weekly, @monthly and the like; tz an IANA zone, default UTC; input checked against the function’s schema at deploy. Two schedules of one function need names.
  • The runtime fires them itself, with no Claude and no server involved, as normal runs with ctx.caller schedule. An approval waits like any other run’s.
  • A schedule whose last run has not ended is skipped that time, and the skip is kept. Fires missed while rrotor was down are not made up.
  • schedules_list shows each one’s next and last run; schedule_pause and schedule_resume keep across restarts and new versions.

SQLite

"databases": ["sqlite"] gives the program ctx.db, the standard library’s sqlite3.Connection on db.sqlite3 in its data folder, opened on first use and closed when the run ends: with ctx.db: commits, and what is not committed is rolled back. A program that does not declare it gets E_DATABASE_UNDECLARED.

Deploy

A folder on this machineCommit, then the rrotor skill’s deploy (or the SDK’s deploy(path)): a git bundle of that commit, nothing else of the machine
program_deploy{repo, commit, token?}: repo is owner/name on GitHub, commit the full 40-character SHA, token for a private repo
POST /v1/programs/deploy{repo, commit, token?} or {bundle, commit}, a git bundle in base64 up to 64 MB

rrotor fetches exactly that commit, checks its SHA and the manifest, makes a venv from requirements.lock (no package’s setup runs outside the sandbox) and makes the version active. Versions are kept, so a new deploy rolls back like any commit.

Call

program_call     {"program": "daily_sales", "function": "start", "inputs": {"day": "2026-10-30"}}
→ {"run_id": "…", "status": "needs_approval", "step": "write", "prompt": "Write 2026-10-30's total, $1240.00, to the ledger?"}

program_continue {"run_id": "…", "answer": {"approved": true}}
→ {"run_id": "…", "status": "done", "data": {"day": "2026-10-30", "total_usd": "1240.00", "written": true}}
  • function defaults to start. One run can take many calls: each continue resumes it while it waits.
  • A run ends done, failed, expired or cancelled; the program’s end hook always runs. Past limits.seconds it fails E_LIMIT_SECONDS.
  • run_status and run_log read any run; seconds count time running, not waiting.