fleet-preflight¶
The fleet-wide pre-action check (Jira FLT-306). Every teammate, on every harness and PC, asks it before a risky action. It answers with a closed-set verdict and writes one audit line per call.
Proceed | Warn:<Code> | Block:<Code>
Written after 2026-10-27, when Clahadore sent Andrew to pay a GCP $30 activation while Chrome was signed in to the wrong Google account. Andrew: "certain things should be deterministic", and "jev as a pre action check for a lot of things".
Two layers¶
- Deterministic rules (
RuleEngine, C#, no model). A ruleBlockis final. Nothing downstream can lower it, and Jev is not even called. - Joffrey (Jev) (
JevScorer,jev-latest, fleet key~/.fleet-secrets/jev.json) scores the judgment cases the rules leave open, for Money/Identity, Destructive, Landing and Outward. It is an advisory shadow auditor (FLT-294): it can raiseProceedtoWarn, but it can neverBlockand never lower a rule verdict. Thresholds: P(block) >= 0.5 givesWarn:JevFlaggedBlock; P(warn)+P(block) >= 0.6 givesWarn:JevFlaggedWarn; a risk score >= 2.5 of 3 givesWarn:JevHighRisk. Jev failure, timeout or shape drift givesWarn:JevUnavailable, never a silentProceed. - Budget: the fleet key is $25/month and TypeSafe has no per-key cap, so each PC enforces
$6.25/month client-side (
~/.fleet-preflight/jev-ledger.json). A corrupt ledger counts as exhausted. A real call costs about $0.00003.
Action classes and rules¶
| Class | Verbs | Blocks when |
|---|---|---|
| MoneyIdentity | pay, billing-link, purchase, refund, subscribe, iam-grant, oauth-grant | owner missing; observed identity missing, not read at the producer, older than 10 min, or different from the owner; no rollback; spend with no amount or over $100 |
| BrowserDesktop | open-tab, navigate, reuse-tab, click, type, close-tab, send-andrew-to, launch-browser, desktop-input | acting on a tab this session did not open; launching a browser process; sending Andrew somewhere without a producer-read identity match. Desktop input is Warn |
| Destructive | delete, force-push, reset-hard, drop-database, kill-process, reboot, shutdown, uninstall, empty-trash | reboot or shutdown, always; kill by name, or a PID not proven yours; protected paths (docker_data.vhdx, .git, .fleet-secrets, drive roots, profile, .ssh); force-push to main/master/release; reset --hard on a dirty or unknown tree; non-disposable db drop or uninstall; irreversible with no rollback |
| Landing | merge, land, ff-push | no sha; any required seat not approved on the exact sha and not covered by a valid waiver; suite not green on that sha; invalid waiver (no approver or reason, expired, lifetime over 24h, scope not the sha or ticket); open evidence-backed High/Critical (no waiver covers it) |
| Outward | send-email, send-message, publish, post, dns-change, nameserver-change, deploy-prod | no user: approval evidence; more than one recipient; sender identity mismatch; DNS or deploy with no rollback; deploy with no ci: evidence |
| Secrets | write-file, edit-env, log, prompt | a secret value anywhere in args, summary, target, rollback or evidence (any class); hand-editing a .env (templates like .env.example are fine) |
The full truth table is tests/FleetPreflight.Tests/RuleTableTests.cs. One test fails if any
rule code is not exercised by a row.
Interface¶
fleet-preflight check --file preflight.json # or pipe JSON on stdin; --no-jev for rules only
fleet-preflight own-pid 4321 --proof "Start-Process -PassThru dotnet test" --agent Clahadore
fleet-preflight jev-budget
fleet-preflight hook-pretool | hook-posttool # Claude Code hook entry points
Exit codes: 0 Proceed, 10 Warn, 20 Block, 2 usage. A landing check that returns Proceed
writes a receipt (~/.fleet-preflight/landing-ok/<sha>); the hook looks for it before a push to
a protected branch.
Preflight JSON (unknown fields are rejected, not ignored):
{
"actionClass": "MoneyIdentity",
"verb": "pay",
"target": "GCP billing activation, project nifty-condition-503506-j1",
"owner": "andrewjonesdev1@gmail.com",
"observedIdentity": "andrewjonesdev1@gmail.com",
"identitySource": { "kind": "Producer", "detail": "chrome://settings/people", "observedAtUtc": "2026-10-27T21:59:00Z" },
"reversible": false,
"rollback": "refund in GCP billing within 30 days",
"amountUsd": 30,
"evidence": ["user:chat 2026-10-27 activate billing"],
"agent": "Clahadore"
}
Class-specific facts: browser {tabOwner, tabId}, process {pid, imageName, spawnedByAgent,
spawnProof, byName}, landing {sha, ticket, targetBranch, requiredSeats, approvals, suiteGreenSha,
waivers, findings}, repo {hasUncommittedChanges, branch}, plus disposable.
Audit: ~/.fleet-preflight/audit.jsonl, one JSON line per call (verdict, all hits, Jev model,
request id and probabilities, sha256 of the preflight). Raw args are never written, and a target
holding a secret is written as [redacted:secret].
Harness adapters¶
Claude Code is wired by the hook. The others call the CLI; see docs/adapters.md.
powershell -NoProfile -File install.ps1 -WireClaudeHook # publish to C:\Tools\fleet-preflight + wire hooks
Threat model¶
This check guards against an honest but error-prone agent, the kind behind the 2026-10-27
wrong-account payment, the reused tabs and the killed login. It does not guard against an agent
that sets out to defeat it. A preflight is the agent's own structured report.
observedIdentity, disposable, user: evidence and seat approvals are claims the rules check
for consistency, and they are not attestations. Where the check can see a fact for itself, it
does: the hook reads the command, the git state, the tab ledger and the process tree. Where it
can't, it says so with a Warn. Turning self-reported landing facts into harness-signed ones
(council-code-review emitting the landing preflight) is follow-up work.
Fail-closed behavior¶
- A malformed preflight is a Block. That covers unknown fields, integer enums and null collections.
- A rule that throws, or a regex that times out, gives
Block:InternalError. - An unreadable hook event, or any hook exception, gives a deny.
- An unreadable tab or PID ledger means "not owned", so the action blocks.
- A Jev failure, out-of-range value or unknown choice gives
Warn:JevUnavailable, never Proceed.
Redirect targets¶
A ProtectedPath deny names the flagged target. How a shell redirect target is judged:
- Literal path: checked against the protected list, resolved against the directory at that point.
- Variable or substitution assigned in the same command (
> "$G/x"): denied. The value is not checked, so write the literal path in the redirect. - Plain climb (
> ../x): resolved from every directory the shell could be in at that point: the session cwd and eachcdso far, since acdcan be skipped. It is denied if any of them lands on a protected path, or if a directory is unknowable:cdto a variable or a directory that does not exist yet, a loop or function beside acd,source,eval, an alias, or acdin any other spelling. Globs,~,:, and trailing dots or spaces are not plain, so they are denied too. Add-Typehere-string body (PowerShell): C#, so it is not scanned for shell redirects. It still gets the secret scan, and a redirect after the closing"@is still checked.
Resolution is lexical: a symlink or junction is not followed (FLT-390 item 2).
Known limits (stated, not hidden)¶
- Hook coverage. The hook matches every tool (
.*), and the classifier returns no decision for tools outside the six classes. - Unseen chat. The hook can't see chat, so it can't prove Andrew approved an outward send.
Sends, deploys and merges through the hook get
Warn(surfaced to Andrew), not a rule verdict. Multiple recipients and secrets stillBlock. - Hook errors. If the hook binary is missing or Claude Code times it out, Claude Code treats
that as non-blocking. Keep the binary installed (
install.ps1records its sha256). - Tab ids.
hook-posttoolrecords the firstTab ID: 123/"tabId": 123in thetabs_create_mcpresponse text. That format has not been pinned to a captured response. If parsing misses, the tab stays unowned, and the miss fails closed as a falseBlock. The response format is now pinned byFixtures/tab-batch-2026-11-07(verbatim capture). - browser_batch. Each entry in
actions[]is judged as if sent alone: every nestedtabIdmust be owned, or the whole batch blocks. An empty or unreadable batch, a nested batch, or a tab action after aselect_browser/switch_browserinside the same batch blocks. - Per-device tabs. Chrome tab ids are per browser, so ownership is keyed by device
(
TabLedger). An approved switch (select_browser,switch_browser, or a batch holding one) is pending until its PostToolUse: nothing is owned or recorded meanwhile. A confirmedselect_browsersettles on its deviceId; anything else settles on a fresh unknown device. Every switch moves an epoch. Switch completions and creates are matched to their PreToolUse bytool_use_id: a completion that matches no switch in flight (late, expired) settles on an unknown device, and after a switch atabs_create_mcpis recorded only if its own id was noted in the current epoch (an id-less create is never recorded after a switch). So a tab created around a switch is never recorded under the wrong device. Overlapping switches settle on an unknown device. There is no timeout (elapsed time does not prove a switch stopped): a switch with no PostToolUse or PostToolUseFailure (denied, hook lost) stays pending until its agent's turn ends (Stop/UserPromptSubmitfor the main thread,SubagentStopwith the matchingagent_idfor a subagent), then settles on an unknown device. Tabs made before the first switch stop counting after it; open a new tab on the new device. A session that never switches behaves exactly as before. That PreToolUse and PostToolUse carry the sametool_use_idis not stated in the hook docs: if it ever differs, every create after a switch blocks (fails closed). Smoke-check after install. Atabs_create_mcpinside abrowser_batchblocks: its tab id never reaches PostToolUse, so the tab could not be used. Create tabs with a standalonetabs_create_mcp. Needsinstall.ps1 -WireClaudeHook: without the wider PostToolUse matcher every switch stays pending until the turn ends (with no turn hooks either: until a new session). Known limit: an action approved just before a parallel switch can still run after it (check then use). Hooks cannot hold a tool call; keep Chrome calls sequential around a switch. - PID registration.
own-pidaccepts a PID only when it descends from the same shell or harness as the caller (Windows Toolhelp snapshot;pselsewhere). Register in the same command that spawns the process. - Shell reading is best-effort. The hook is not a shell parser. It handles:
- splitting on
;&&|||&and newlines - quotes and escapes (backslash in Bash, backtick in PowerShell)
$( ),( )and Bash backtick bodies- prefixes such as
sudo,env,VAR=,$p =,nohup,xargsandtimeout - path-qualified verbs
cmd /c,pwsh -Command,-EncodedCommand,bash -c,wsl -e,ssh hostandiexpayloads
It does not expand braces (./{.git,x}), variables (rm -rf $dir), aliases or functions.
Dynamic-code sinks require static literal operands; runtime-built code is denied with DynamicCode.
An unterminated quote or more than 64 segments is a deny.
- Jev calibration. Jev was warn-biased on its first two live calls: both warn, with
P(block) about 0.33 each time. Treat Jev Warns as a shadow signal and tune the thresholds from
the audit log.