Reference
One-off repairs: block-one-off-repairs
A gate on pre_tool_use:bash (tama hook block-one-off-repairs) that refuses repairs
made by hand against live machine state, and builds while the build hold stands, and names, in each refusal,
the product command that owns the outcome. Every refusal starts BLOCKED: one-off repair by hand.,
appears as a {"decision":"block","reason":"…"} document on stdout,
and repeats its reason on stderr. The dispatcher ends normally after that decision;
a nonzero exit without a decision is a hook failure, not a policy refusal.
The harness prevents the proposed command from running. An ordinary allowed command
prints nothing; an admitted build may report consumption of its recorded capability.
#Why it exists
Oko's one-off repair detector (oko transcripts one-offs) reads the native harness files
and counts commands that changed live state by hand instead of through a product path: service cycles,
grants minted from the shell, binary copies over installed programs, rows and settings changed by hand,
waits in place of a read. Each fixes one machine once and is gone at the next sync, image refresh or
build.
#Two readings
What a command's structure states is read directly, and holds whether or not a model answers: a
compile while the build hold stands (the program a line runs and the subcommand its toolchain documents as
building, testing or running a suite, and the fleet's own compile commands), an install the register
already says will fail, and a Python run. Everything else a command might do by hand is read by a model,
through Oko's model call, against the operator's rule and the route of each outcome
(block_one_off_repairs/judge-prompt.md): which verb of which launcher, client, store or
watcher does it is not a list anybody can finish, and the verb lists this gate used to carry were the
keyword logic block-keyword-literals refuses. The refusal is the model's sentence naming what
the command does by hand and the route that owns it. A question the judge leaves unanswered refuses the
command with TAMA_HOOK_INFRASTRUCTURE: block-one-off-repairs: review unavailable: … and the judge's
recorded state, as asking a model describes; the build
hold never depends on a judgement.
#Build admission and open records
Whether a build, compile or test may run is not a count Tama makes: the gate
needs the session's own build attestation and asks Oko's one admission
decision, oko admit build --product <product> --session <id>
--json, for each product the command builds. A standing withdrawal
refuses the build quoting the ruling; a standing consent or a recorded
build session capability admits it; where neither decides, Oko
holds it until every open item carries its repair. No build is ever asked of
the operator. How the
build gate decides a build gives the whole decision and its refusals.
Checking whether any defect remains open reads no Git history. The text
gate, stop gate and open-work listing read Oko's open selection directly. Each
consumed field is decoded against Oko's serialized field types; a row that
does not decode refuses with cannot decode Oko's open defect row
<index>: <cause> instead of supplying an empty value, and unknown
fields remain compatible with later Oko additions. A non-array reply or a
record without a nonempty text identity or product is an unavailable register,
not an empty workload.
The repair_history_presence journeys invoke the built
block-text-outside-tool-calls and block-stop-with-open-work
hooks against the actual authenticated Oko register. They require
TAMA_TEST_OKO_EXECUTABLE to name the installed Oko binary and an
existing open defect, retain both executable digests and the real register
response, and reject a dependency-error refusal as proof. The stop case also
requires TAMA_TEST_OKO_SESSION, a real non-executor session without
local pending tracker entries, and TAMA_TEST_OPEN_DEFECT, the full
identity of an actual open defect in that session's scope. Its refusal must
name that defect. Git trace events must show no history command during either
hook. The journeys create no artificial register rows and change no session
roles.
The presence journey also copies an actual open record into an isolated register, corrupts its identity, and invokes the genuine Oko CLI followed by the built text hook. The refusal must name the malformed identity, leave the file unchanged and perform no history scan. Restoring the copied record must restore the ordinary open-work refusal. This is a persisted corruption case, not a replacement Oko executable or a canned CLI response.
#What the model refuses, and the route each refusal names
| What the command does by hand | The route the refusal names |
|---|---|
Cycles a running service or process: restarts, stops, unloads, bootstraps or kills it through any
launcher (launchctl kickstart, systemctl restart, brew services restart,
kill <pid>, pkill) |
stado service restart <NAME>, stado service refresh-image <LABEL> --if-needed;
a unit that must change is redeclared with stado service deploy|update. |
Writes a grant or mints a bearer straight into a vault past Stado (skarbiec grant ensure,
skarbiec token-mint) |
stado credentials token mint and stado credentials token sync for a bearer;
stado service grant sync, stado credentials grant add or
stado release catalog declare-publisher for a grant. |
| Changes rows or a table's shape through a database client, or the keys of a key-value store | The command that owns those rows (oko transcripts reindex, oko tasks …, a
service's own CLI); a change of shape belongs in a migration that ships with the product. |
Writes a machine setting (defaults write, plutil, scutil,
networksetup) |
Declared where the product reads it: stado registry set --path <FIELD> --value <VALUE>,
the product's own command, a browser policy through Weles. |
| Copies or links a built executable over an installed one, or signs one with the ad-hoc identity | oko install, stado product update <PRODUCT> --surface cli,
stado release install-local, stado host reconcile --apply; signing happens in
stado release prepare and stado release submit. |
| Renames, removes, overwrites or changes the mode of a hook's own file | tama enforcement only <hook-id>…, tama adaptive repair <hook-id> --patch-file
<path>, tama hooks release. |
Redirects output into the operator's own state (~/.stado, ~/.oko,
~/.shared-hooks and the like) |
stado credentials token mint for a bearer, stado registry set for a fleet
declaration, the product's own command for its configuration. |
| Makes scratch space outside the repository's ignored build directory | The repository's build directory (.build, rust/target) or
~/.wisent-output. |
| Passes time instead of reading an outcome, blocks on a remote run, polls a build status, or hands a command a guessed number of seconds to give up at | Continue the next open task; read an outcome only when the work in hand needs its value —
stado release status <PRODUCT>, stado release doctor <PRODUCT> --target
<HOST>, oko tasks --session <ID>. |
| Searches a whole tree from the shell (a filter over a pipe is not one) | The harness's own read and search; a product's own command for what it holds. |
Frees one host once where a declaration owns the outcome (stado space reclaim) |
stado space report <HOST> shows what the janitor's cleaners cover; a tree no
cleaner covers is a Stado defect to record and repair. |
Reformats a shared tree (cargo fmt over the checkout) |
The repository's own pre-commit dispatcher formats what is being committed. |
Puts an older version back (stado release restore-local, stado release
rollback, stado product rollback) |
Rollbacks are forbidden: find the failed step in stado product status <PRODUCT> --surface
<SURFACE>, commit and push the forward repair, install the new revision. |
Reads pass: listing, printing, status and logs (launchctl print, kill -0, a
select, defaults read), a filter over a pipe, reading one named file, the product
routes above, writing inside the repository, version control on it, and any --help. A command
that only mentions a restart in quoted text restarts nothing.
#What the structure refuses
| Refused command | The route the refusal names |
|---|---|
A compile, while any open Oko task of any session or any open defect of any product carries no
repair: cargo build|check|test|clippy|run|bench|doc|install, and the dependency resolution that writes the build's lockfile, cargo update|fetch|generate-lockfile; swift build|test|run,
go build|test|install, npm|pnpm|yarn|bun run|build|test|start|dev|install (and
npm ci), npx tsc|vite|next|jest|vitest|playwright|webpack|esbuild,
dotnet build|test|publish, mvn package|install|test, gradle
build|test|assemble, gh run|rerun, xcrun swift|xcodebuild; every invocation of
xcodebuild, make, cmake, ninja, swiftc,
rustc, gcc, g++, clang, clang++ and
tsc; and the fleet's own compiles, stado host build, stado product
cargo|swift|install|update|sync, stado build submit|newest, stado release
submit|prepare|newest. An exact release install (--release-version), a
--dry-run and a --plan compile nothing and pass, and a package manager's run <script> whose
script only runs one repository file through node, loading no builtin that starts a program or
only a test loads, is no compile. |
The gate asks Oko's one admission decision, oko admit build --session <id>, and refuses
with its reason. Code, commit and push the repair of every open item and record it (oko tasks evidence
<task> --commit <revision>, oko defects repaired <id> --revision <revision>);
then build once over all of it. One item is not waited on: an item whose repair an installed hook or command
refuses while the refuser's own repair is pushed, so the build is what unblocks it. Record that with an open
blocker naming the item that waits on the refuser's defect (oko blockers record --blocks '<item>: …'
--waits-on <defect>); oko blockers held lists the items held so. A standing ruling of
the operator decides before the open-work rule; his consent in this conversation, recorded as the Tama session
capability {"tool": "build"}, admits a build that rule holds. There is no build-consent ask, and
the refusal tells the agent never to ask the operator for a build, neither through his window nor
through an Oko ask: what he says in the conversation is read into his rulings, and a build no ruling admits
waits; while the installed Oko cannot answer the admission, the build waits as well. |
stado product install|update|sync of any product other than Stado, run by a Stado whose
revision (stado --version) does not contain a repair Oko records against Stado or against that
product (oko defects repaired <id> --revision stado@<rev>) and that repair was committed no
later than the installed Stado's revision. This applies even to a build the operator consented to: the register
already says how that install would end. The refusal lists each such defect with its revision; a revision that
cannot be compared with the installed Stado refuses too. |
Update Stado first (stado product update stado --surface cli), then install the product. |
A Python module or script handed to any python interpreter, whatever its path or version:
python3 -m <module>, python3 tools/x.py. Python is not used in this workshop. |
Use the product command that does the job. When none exists, that missing command is the product work to build, in the product's own language. |
#Where the refusal comes from
Source: rust/crates/tama-hook-tools/src/ports/block_one_off_repairs/ (mod.rs for the
order, vocabulary.rs for the toolchains' compile structure, judged.rs and
judge-prompt.md for the model's reading); binary:
src/programs/block/ownership/block_one_off_repairs.rs. The journey
cargo test --manifest-path rust/Cargo.toml -p tama-cli --test one_off_repairs_judged runs the built
hook with the judge recorded as not answering and requires a service cycle to pass with the stderr note and
cargo build to be refused by the build hold; with TAMA_TEST_ONE_OFF_JUDGE=1 and
-- --ignored it asks the real judge and requires the service cycle refused with
stado service restart in the reason and a launchctl print passed. The detector that
counts the same shapes after the fact, across every stored transcript, is Oko's transcripts one-offs;
a refusal here is recorded there as refused by hook. Registration is
two commands:
DEVICE_HOOK_EDIT_APPROVED=1 tama hooks declare --file hook-declarations/block-one-off-repairs.json
for the catalogue entry, the registry entry and the reseal, and
DEVICE_HOOK_EDIT_APPROVED=1 tama hooks release for the binary and the installed release.