Safe Script Handoff
When an AI agent writes a script and a person runs it against live systems, the person is the last check, and people get tired. This draft makes that check small and hard to get wrong: every script is an approved template plus a few plain values, a runner proves both before anything happens, nothing changes until the person types what's on the screen, and every run leaves a record.
1Goals
- Safe when tired: running a script by mistake, or running the wrong one, changes nothing.
- Checked by a machine, confirmed by a person: the runner does the comparing; the person reads one plain sentence and types one word.
- Hard to tamper with: a script whose code differs from what was approved, by a single byte, does not run.
- On the record: every approval and every run can be traced later.
Not a goal: judging whether a change is a good idea. That is still the person's review; this draft only makes sure the reviewed thing is the thing that runs.
2Who does what
| Role | Who | Can | Cannot |
|---|---|---|---|
| Author | An AI agent (or a person) on the Ai side | Fill in values for an approved template; propose a new template | Approve templates; run scripts on live systems |
| Approver | A person on the Hi side | Add a template to the approved list; move the pin | Be the author of the template being approved, once a second person is available |
| Operator | A person on the Hi side | Run scripts through the runner | Skip the runner |
In a one-person team, the approver and the operator are the same person. The author MUST still be someone else, or an AI agent.
3The shape of a script
A script has exactly two sections, in this order, with fixed markers:
#!/usr/bin/env bash
# --- PARAMS ---
ID=go56
TEMPLATE=promote
TEMPLATE_VERSION=1
REPO=alpq
FROM=dev
TO=master
EXPIRES=2026-11-18
# --- TEMPLATE ---
...the approved template, byte for byte...
- The PARAMS section holds only
NAME=valuelines and comments. - The TEMPLATE section is an approved template, unchanged. Its hash is the SHA-256 of its bytes, from the line after the marker to the end of the file, with Unix line endings.
- Content the script places somewhere (a web page, a configuration file) travels as separate files next to it, each named in PARAMS with its own SHA-256. Content is data: the template copies it and never runs it.
4Values, not code
- Each template declares the values it accepts: their names, and for each one either a fixed list (
FROMis one ofdev) or a narrow pattern (IDmatchesgo[0-9]+). - The runner MUST read PARAMS with its own parser and MUST NOT run it as shell.
- A value MUST NOT contain
$, a backtick, quotes,;,|,&,<,>, a backslash or a line break, whatever the template's pattern allows. - A name the template doesn't declare, or a declared name that's missing, stops the run.
- Every script also carries
EXPIRES, a date (section 9).
5Approved templates
The list of approved templates lives in a version-controlled repository that authors cannot write to. Each entry gives:
{ "template": "promote", "version": 1,
"sha256": "9f2c...e41a",
"title": "Promote a reviewed branch to production",
"mode": "apply", "production": true,
"params": { "ID": "go[0-9]+", "REPO": ["alpq", "miqr"],
"FROM": ["dev"], "TO": ["master"] },
"approved": "2026-11-12", "by": "BT" }
- Every approval is one commit, so the repository's history is the approval history.
- Any change to a template's code gives it a new hash and a new version, approved again.
- The runner is itself a template on the list, so a changed runner doesn't run either.
6The pin
The runner doesn't trust the repository's latest commit. A separate parameter store holds the pin: the commit of the approved list that is in force, and a version number. The runner reads the pin, fetches the approved list at exactly that commit, and checks against it.
- A commit to the repository has no effect until the pin moves to it.
- Moving the pin to a commit that isn't in the repository fails.
- Both changes need the approver's own sign-in, and the parameter store keeps the pin's past versions.
7Delivery
Scripts reach the Hi side through a repository, never through chat or email.
- The author pushes each script to its own branch on the Ai side (one branch per script ID), holding only the values and any content files with their hashes.
- The runner fetches that branch and works on a private copy. The copy is also kept on the Hi side with the run log, so the Hi side has its own record of what crossed.
- After the run, the runner commits the output back onto the script's branch. That is a report crossing from Hi to Ai, so outputs MUST NOT hold secrets or personal data.
- Code changes take the same road: a template whose values name a known repository pair carries a reviewed branch to its preview, and another promotes it.
8Running a script
- The operator runs the runner with the script number:
go55 56runs scriptgo56. - The runner fetches the script and its content files into a fresh folder and works only on that copy, so nothing can change between the check and the run.
- ScriptCheck: it reads the pin, fetches the approved list, and checks the template hash, the values, every content file's hash, the expiry and the template's approval date, using trusted time (section 9). Any mismatch stops it, with one plain line saying which. ScriptCheck is the Hi gate for scripts in the Bridge: verification, testing and security checks in one.
- It shows one sentence built from the approved title and the values, for example: go56: promote alpq dev to master (production), template cc-promote@1, approved 2026-11-11 by BT.
- It runs the template in plan mode first: it shows what would change and changes nothing.
- To apply, the operator types the script's ID as shown (
go56); a template marked production asks forPROMOTE go56. Anything else cancels. The apply uses the same checked copy, in the same run. - Fatigue guard: the runner refuses to apply during set quiet hours and after a set number of applies in one session, unless the operator types an override. Plan mode always runs.
9Trusted time and expiry
Old scripts are a quiet risk: a script reviewed in May and run in August meets a different system. So scripts expire, and the clock that decides is not one the author or the operator's machine can move.
- Trusted time: the runner reads the
Dateheader (RFC 9110) from two outside servers it already talks to, such as the parameter store and the repository host, over HTTPS. They MUST agree within 2 minutes; if either is missing or they disagree, the runner refuses. The local clock is never used for a decision. The list of clocks lives in the approved list. - Expiry:
EXPIRESMUST NOT be past and MUST NOT be more than 7 days ahead. - First seen: the runner also refuses a script more than 7 days after it first saw that exact content, a clock on the Hi side the author can't backdate. A report-back commit doesn't reset it, because it counts the script's content, not its branch.
- Template review: a template approved more than a year ago is refused until the approver reads it again and re-approves it.
10The run log
Every run, planned or applied, passed or refused, appends one line to a log kept apart from the approvals (a separate branch of the same repository works):
{"t":"2026-11-12T14:03:11Z","id":"go56","template":"promote","version":1,
"sha256":"9f2c...e41a","pin":"3b7e1c0","mode":"apply","result":"ok"}
The author reads the log to learn what happened, instead of asking the operator.
Signed time: every apply and every approval SHOULD carry an RFC 3161 time stamp from a public time-stamp authority over a record that holds the output's SHA-256, so anyone can later prove when it happened and that the record wasn't changed, without trusting the operator. A missing authority MUST NOT block a run; the log says the stamp is missing.
11What a template never does
- Delete anything permanently. Removal is a person's job, outside any script.
- Create or change sign-ins, roles, permissions or secrets, unless the template exists only for that and says so in its title.
- Download code and run it, or build code from values (
evaland the like). - Print secrets, or ask the operator to paste one.
12How GOVW applies it
GOVW Foundation's runner is called Go55, the Bridge FastPass: the operator types go55 and a script number, reads one sentence and the plan, and types the script's ID. Typed alone, go55 only prints how it works and a link here. Kai, GOVW's AI agent, writes the scripts; GOVW's Director of Technology approves templates and runs scripts from the cloud provider's console shell. The first real run took 4.3 seconds, with the checks at 2.3, and the first approval carries a public time stamp. Three templates are approved so far: promote a reviewed branch, put content files on a preview branch, and hand reviewed code to its preview.
13Open questions
- Should approvals be signed commits, so the approved list shows who approved each entry without trusting the repository host?
- Should a plan's output be hashed and required at apply time, so the apply does exactly what the plan showed?
14References
- Terraform plan, the plan-then-apply pattern
- in-toto, checking that each step of a supply chain was done as approved
- SLSA, Supply-chain Levels for Software Artifacts
- NIST SP 800-218, Secure Software Development Framework
- AWS Systems Manager Parameter Store, versioned parameters
- RFC 3161, Time-Stamp Protocol
- RFC 9110, section 6.6.1, the HTTP
Dateheader
Credit where it's due: plan-then-apply, allowlisted scripts and approved hashes each have long histories. This draft puts them together for one situation: an AI agent writing, a tired person running. Corrections and earlier work are welcome at security@govw.org.