# GPT 5.4 Mini Hard Guardrail

Use this workflow when Adner says a drafting task should be done with GPT 5.4 mini and the result must be attributable to mini before any send step.

## Rule

Do not send, email, or otherwise treat the draft as final until `mini_guardrail.py verify` returns `"ok": true`.

If verification fails, say so plainly and either:
1. wait for the mini child result, or
2. ask Adner whether to proceed without mini attribution.

## Why this exists

A child run can be requested on mini, but that alone is not enough. The actual delivered draft must be captured from the child and verified before the parent can claim the task was done on mini.

## Fast Path Helper

Use the helper when you want the shortest reliable workflow:

```bash
python3 /home/isthekid/.openclaw/workspace/bin/mini_helper.py start <task-slug> --note "Mini-only draft requested"
python3 /home/isthekid/.openclaw/workspace/bin/mini_helper.py receipt <task-slug> <childSessionKey> <runId>
python3 /home/isthekid/.openclaw/workspace/bin/mini_helper.py ready <task-slug> <path-to-exact-child-output>
```

That covers record creation, accepted child receipt, exact draft capture, and verification.

## Workflow

### 1. Initialize the task record

```bash
python3 /home/isthekid/.openclaw/workspace/bin/mini_guardrail.py init \
  --slug <task-slug> \
  --task-kind email-draft \
  --requested-by Adner \
  --require-model gpt-mini \
  --note "Mini-only draft requested"
```

### 2. Spawn the child on mini

Use `sessions_spawn(... model:"gpt-mini" ...)`.

When the tool returns, record the accepted child receipt:

```bash
python3 /home/isthekid/.openclaw/workspace/bin/mini_guardrail.py claim-child \
  --slug <task-slug> \
  --child-session-key <childSessionKey> \
  --run-id <runId> \
  --requested-model gpt-mini \
  --model-applied
```

Only mark `--model-applied` when the spawn result explicitly says `modelApplied: true`.

### 3. Capture the exact child output

Save the exact child-produced draft to a file, then register it:

```bash
python3 /home/isthekid/.openclaw/workspace/bin/mini_guardrail.py capture-draft \
  --slug <task-slug> \
  --draft-file <path-to-exact-child-output> \
  --source child \
  --model gpt-mini \
  --format text
```

If the child returns JSON, store the raw JSON and use `--format json`.

Do not rewrite the draft in the parent and still call it mini. If the parent materially rewrites it first, mini provenance is broken.

### 4. Verify before send

```bash
python3 /home/isthekid/.openclaw/workspace/bin/mini_guardrail.py verify --slug <task-slug>
```

Verification requires all of the following:
- child receipt exists
- child receipt confirms `modelApplied=true`
- requested model matches mini
- captured draft exists
- captured draft source is `child`
- captured draft model matches mini
- captured artifact hash matches the file on disk

### 5. Then send or execute

Only after verification succeeds may the parent send the draft onward.

## Helper Commands

- `mini_helper.py start <slug>` → initialize a mini-only task record
- `mini_helper.py receipt <slug> <childSessionKey> <runId>` → store the accepted child receipt
- `mini_helper.py capture <slug> <draft-file>` → capture exact child output only
- `mini_helper.py ready <slug> <draft-file>` → capture exact child output and verify in one step
- `mini_helper.py verify <slug>` → run verification only
- `mini_helper.py show <slug>` → inspect the saved record

## Storage

Artifacts live here:
- records: `workspace/state/mini_guardrail/records/`
- captured drafts: `workspace/state/mini_guardrail/drafts/`

## Default operating behavior

When Adner says "use mini" for a draft:
- treat it as a provenance requirement, not a preference
- create a guardrail record
- wait for the child result
- verify before sending
- if verification is not complete, do not claim the task was done on mini
