RUO Supabase Mutation Handoff Audit
Use this skill automatically whenever a RUO Peptides / PeptraLabs Supabase mutation is proposed. It converts the requested change into a validated instruction set for Hermes, the sole Supabase mutation owner.
This skill is a pre-handoff audit layer. It never authorizes Codex, Claude Code, Genie, or another non-Hermes agent to execute a mutation. Always apply ruo-supabase-guardrails first; if the two skills conflict, the stricter read-only rule wins.
Enforcement Boundary
This skill enforces behavior at the agent workflow and skill-selection layer. It does not revoke credentials or create a database trigger. Technical separation requires non-Hermes runtimes to lack write-capable credentials and to use only read-only or Hermes-mediated access.
Quick Rule
A mutation request can produce only one of these preparing-agent outcomes:
READ_ONLY_NO_HANDOFF_REQUIRED
DRAFT_AWAITING_PAFI_APPROVAL
HANDOFF_BLOCKED
HANDOFF_READY
HANDOFF_READY means the instruction set is complete enough to deliver to Hermes. It does not authorize the preparing agent to execute anything.
Mutation Surfaces
Classify every request:
| Surface |
Examples |
Required review |
data_row |
insert/update/upsert/delete rows |
exact table, IDs/filter, values, expected count, read-back |
financial_stock |
payments, expenses, treasury, restocks, stock movements, SKU state, customer credit |
financial audit controller, stock/account invariants, stale-output checks |
schema_config |
columns, constraints, triggers, migrations, settings contracts |
compatibility, backfill, rollback, regression plan |
rls_policy |
RLS, policies, grants, service-role exposure |
least privilege, read/write blast radius, regression plan |
storage |
bucket/object upload/delete, visibility rules |
object scope, retention, public/private exposure, rollback |
rpc_function |
RPC, Edge Function, cron, trigger code |
input validation, idempotency, timeout/failure behavior, dry-run |
runtime_secret_config |
Supabase URLs/keys and agent/runtime access |
no secret values, ownership, least privilege, restart/read-back |
dashboard_sync |
dashboard state written back to Supabase |
source snapshot, generated diff, no silent mutation |
Read-only selects, exports, checksums, diffs, and schema inspection return READ_ONLY_NO_HANDOFF_REQUIRED.
Hermes Supabase Mutation Instruction Set
The packet is a typed inter-agent contract:
contract_version: hermes-supabase-instruction.v1
instruction_set_id: stable unique reference
execution_owner: Hermes-main
executor: hermes
executor_profile: default
codex_direct_write_forbidden: true
approval_explicit: true
approval_source: exact chat/thread/channel/message or approval artifact
approval_timestamp: ISO timestamp
operation: insert/update/upsert/delete/migration/config/storage/rpc/rls/runtime_config/dashboard_sync
surface: one mutation surface from the table above
objects: exact tables, rows, buckets, policies, functions, config objects, or artifacts
scope: exact IDs or precise filters
expected_count: exact number of rows/objects expected to change
payload_summary: redacted business description
mutation_steps: ordered operations containing object, operation, scope, and intended values
preflight_diff: observed current state versus intended state
required_markers: Pafi-authorized plus Hermes owner attribution
idempotency: approval ID, unique reference, checksum, or duplicate-detection rule
rollback: precise undo or compensating plan
domain_invariants: applicable money/stock/account/config/compliance checks
post_write_verification: exact read-back queries/checks and expected result
artifact_sync: required follow-up surfaces or explicit no-sync reason
return_contract: structured execution evidence Hermes must return
Packets must not contain credentials, secret values, or unnecessary raw PII. Secret references are owner-managed handles, never values.
If Pafi has not approved the exact business mutation, prepare a non-executable draft with approval_explicit: false and return DRAFT_AWAITING_PAFI_APPROVAL. Do not send it to Hermes as executable.
Mandatory Executor Checks
The deterministic validator must block unless:
contract_version is hermes-supabase-instruction.v1;
execution_owner is Hermes-main and executor_profile is default;
executor is exactly hermes;
codex_direct_write_forbidden is exactly true;
- exact Pafi approval exists for the requested mutation;
- scope and
expected_count are precise;
mutation_steps are non-empty and target only the declared objects;
- rollback, idempotency, invariants, read-back, and return evidence are specified; and
- the packet contains no likely secret value.
Any actor_path or marker that says Codex/API/Pafi agent will execute is a policy violation. The validator blocks all known legacy direct-API actor paths, preparing-agent performer markers, and API-only approval markers.
Audit Workflow
Classify the request as read-only or mutation.
Load guardrails and confirm the preparing runtime is read-only.
Preflight read-only state using the narrowest technically read-only path. If unavailable, instruct Hermes to perform the preflight.
Apply domain controls such as ruo-financial-audit-controller for money, stock, balance, cost, or published-audit changes.
Assemble the instruction set without secrets or unnecessary PII.
Run deterministic validation:
python3 scripts/validate_mutation_packet.py packet.json
Block or draft missing approval, unclear scope, contradictory source authority, missing invariants, or unsafe credentials.
Deliver only HANDOFF_READY packets to Hermes through the configured cross-agent channel. If Hermes is unavailable, return a ready-to-send packet and report the delivery failure.
Wait for Hermes evidence. Do not infer success from delivery or acceptance.
Independently verify read-only when possible. A mismatch creates a new Hermes instruction set; the preparing agent never repairs it directly.
Hermes Return Contract
Hermes must return a structured result containing:
instruction_set_id
execution_owner: Hermes-main
executor: hermes
executor_profile: default
status: executed_verified/executed_rolled_back/blocked/failed
started_at
completed_at
affected_objects
affected_ids_or_filters
affected_count
redacted_before_after
audit_actor_and_markers
idempotency_result
post_write_readback
domain_invariant_results
rollback_status
artifact_sync_status
exceptions
The preparing agent may report HERMES_EXECUTION_REPORTED only from this evidence. It may report INDEPENDENTLY_VERIFIED only after its own read-only check.
Domain Constraints
- Airtable remains frozen legacy evidence; new RUO operational state belongs in Supabase only through Hermes.
- Account and finance instructions must use the RUO account-ledger contract and full propagation matrix.
- Stock instructions must respect location ownership: Bucharest/main uses
skus.stock_qty; Ibiza/other locations use location_stock.qty; v_stock_by_location composes both.
- Financial, stock, SKU, participant balance, customer credit, restock, pricing-control, batch/COA, and proof/reference changes require the financial audit controller or equivalent invariant checks.
- Runtime/config instructions must preserve read-only credentials for every non-Hermes agent.
Output Contract
For read-only:
Mode: READ_ONLY_NO_HANDOFF_REQUIRED
Reason: ...
Supabase writes performed: none
For an unapproved draft:
Mode: DRAFT_AWAITING_PAFI_APPROVAL
Instruction set: ...
Hermes delivery: not executable
Supabase writes performed: none
For a blocked handoff:
Mode: HANDOFF_BLOCKED
Surface: ...
Missing/failed checks: ...
Supabase writes performed: none
For a validated handoff:
Mode: HANDOFF_READY
Executor: Hermes
Instruction set ID: ...
Approval/surface/objects/scope: ...
Expected diff: ...
Rollback/idempotency/invariants: ...
Required Hermes return evidence: ...
Supabase writes performed by preparing agent: none
For Hermes evidence:
Mode: HERMES_EXECUTION_REPORTED
Hermes status/read-back/invariants: ...
Independent verification: verified/not_run/exception
Residual exceptions: ...
Supabase writes performed by preparing agent: none
Bundled Helper
scripts/validate_mutation_packet.py validates instruction-set structure only. It never contacts Supabase, dispatches Hermes, or authorizes execution.
Expected helper statuses:
READ_ONLY_NO_HANDOFF_REQUIRED
DRAFT_AWAITING_PAFI_APPROVAL
HANDOFF_READY
BLOCKED
Test Cases
- Read-only schema inspection returns
READ_ONLY_NO_HANDOFF_REQUIRED; a packet labeled read-only that also contains mutation intent returns BLOCKED.
- A complete packet with
executor=hermes returns HANDOFF_READY.
- A complete packet with
executor=codex, a legacy API-only actor path, or codex_direct_write_forbidden=false returns BLOCKED.
- A packet without exact approval returns
DRAFT_AWAITING_PAFI_APPROVAL only when all non-approval fields are complete; otherwise it is BLOCKED.
- A financial/stock packet without money/stock/account invariants returns
BLOCKED.
- A schema/config packet without compatibility and rollback checks returns
BLOCKED.
When to Use vs Alternatives
- This skill: prepare and validate a Hermes handoff for any RUO Supabase mutation.
- ruo-supabase-guardrails: always use first for the read-only credential and executor boundary.
- ruo-financial-audit-controller: use for money, stock, balances, costs, and published audit propagation.
- audit-pro: use when changing this skill, its procedure, or its validator; not for every mutation request.
1---2name: ruo-supabase-mutation-audit3description: Convert every proposed RUO Peptides/PeptraLabs Supabase mutation into a validated Hermes-main/default instruction set while keeping Codex read-only. Use after ruo-supabase-guardrails for data, schema/config/RLS/storage/RPC, dashboard sync, runtime access, or migration changes. ANTI-PATTERN: Never treat HANDOFF_READY as permission for Codex to execute a Supabase mutation.4---56<!-- GENERATED by forgebuild portable-skill v0.1.1; runtime=codex; core_sha256=4b936ec9164da6812c35e9e564c939beb5dd9c1a4c134cdf73e883a0c8633795; target_sha256=1bdfb46ea76251bae3285c6b76b55a3ab26ef0f8aa4099fcf9e530d5b0483045; do not hand edit -->78# RUO Supabase Mutation Handoff Audit910Use this skill automatically whenever a RUO Peptides / PeptraLabs Supabase mutation is proposed. It converts the requested change into a validated instruction set for Hermes, the sole Supabase mutation owner.1112This skill is a pre-handoff audit layer. It never authorizes Codex, Claude Code, Genie, or another non-Hermes agent to execute a mutation. Always apply `ruo-supabase-guardrails` first; if the two skills conflict, the stricter read-only rule wins.1314## Enforcement Boundary1516This skill enforces behavior at the agent workflow and skill-selection layer. It does not revoke credentials or create a database trigger. Technical separation requires non-Hermes runtimes to lack write-capable credentials and to use only read-only or Hermes-mediated access.1718## Quick Rule1920A mutation request can produce only one of these preparing-agent outcomes:2122- `READ_ONLY_NO_HANDOFF_REQUIRED`23- `DRAFT_AWAITING_PAFI_APPROVAL`24- `HANDOFF_BLOCKED`25- `HANDOFF_READY`2627`HANDOFF_READY` means the instruction set is complete enough to deliver to Hermes. It does not authorize the preparing agent to execute anything.2829## Mutation Surfaces3031Classify every request:3233| Surface | Examples | Required review |34|---|---|---|35| `data_row` | insert/update/upsert/delete rows | exact table, IDs/filter, values, expected count, read-back |36| `financial_stock` | payments, expenses, treasury, restocks, stock movements, SKU state, customer credit | financial audit controller, stock/account invariants, stale-output checks |37| `schema_config` | columns, constraints, triggers, migrations, settings contracts | compatibility, backfill, rollback, regression plan |38| `rls_policy` | RLS, policies, grants, service-role exposure | least privilege, read/write blast radius, regression plan |39| `storage` | bucket/object upload/delete, visibility rules | object scope, retention, public/private exposure, rollback |40| `rpc_function` | RPC, Edge Function, cron, trigger code | input validation, idempotency, timeout/failure behavior, dry-run |41| `runtime_secret_config` | Supabase URLs/keys and agent/runtime access | no secret values, ownership, least privilege, restart/read-back |42| `dashboard_sync` | dashboard state written back to Supabase | source snapshot, generated diff, no silent mutation |4344Read-only selects, exports, checksums, diffs, and schema inspection return `READ_ONLY_NO_HANDOFF_REQUIRED`.4546## Hermes Supabase Mutation Instruction Set4748The packet is a typed inter-agent contract:4950```text51contract_version: hermes-supabase-instruction.v152instruction_set_id: stable unique reference53execution_owner: Hermes-main54executor: hermes55executor_profile: default56codex_direct_write_forbidden: true57approval_explicit: true58approval_source: exact chat/thread/channel/message or approval artifact59approval_timestamp: ISO timestamp60operation: insert/update/upsert/delete/migration/config/storage/rpc/rls/runtime_config/dashboard_sync61surface: one mutation surface from the table above62objects: exact tables, rows, buckets, policies, functions, config objects, or artifacts63scope: exact IDs or precise filters64expected_count: exact number of rows/objects expected to change65payload_summary: redacted business description66mutation_steps: ordered operations containing object, operation, scope, and intended values67preflight_diff: observed current state versus intended state68required_markers: Pafi-authorized plus Hermes owner attribution69idempotency: approval ID, unique reference, checksum, or duplicate-detection rule70rollback: precise undo or compensating plan71domain_invariants: applicable money/stock/account/config/compliance checks72post_write_verification: exact read-back queries/checks and expected result73artifact_sync: required follow-up surfaces or explicit no-sync reason74return_contract: structured execution evidence Hermes must return75```7677Packets must not contain credentials, secret values, or unnecessary raw PII. Secret references are owner-managed handles, never values.7879If Pafi has not approved the exact business mutation, prepare a non-executable draft with `approval_explicit: false` and return `DRAFT_AWAITING_PAFI_APPROVAL`. Do not send it to Hermes as executable.8081## Mandatory Executor Checks8283The deterministic validator must block unless:8485- `contract_version` is `hermes-supabase-instruction.v1`;86- `execution_owner` is `Hermes-main` and `executor_profile` is `default`;87- `executor` is exactly `hermes`;88- `codex_direct_write_forbidden` is exactly `true`;89- exact Pafi approval exists for the requested mutation;90- scope and `expected_count` are precise;91- `mutation_steps` are non-empty and target only the declared objects;92- rollback, idempotency, invariants, read-back, and return evidence are specified; and93- the packet contains no likely secret value.9495Any `actor_path` or marker that says Codex/API/Pafi agent will execute is a policy violation. The validator blocks all known legacy direct-API actor paths, preparing-agent performer markers, and API-only approval markers.9697## Audit Workflow98991. **Classify** the request as read-only or mutation.1002. **Load guardrails** and confirm the preparing runtime is read-only.1013. **Preflight read-only state** using the narrowest technically read-only path. If unavailable, instruct Hermes to perform the preflight.1024. **Apply domain controls** such as `ruo-financial-audit-controller` for money, stock, balance, cost, or published-audit changes.1035. **Assemble the instruction set** without secrets or unnecessary PII.1046. **Run deterministic validation**:105106 ```bash107 python3 scripts/validate_mutation_packet.py packet.json108 ```1091107. **Block or draft** missing approval, unclear scope, contradictory source authority, missing invariants, or unsafe credentials.1118. **Deliver only `HANDOFF_READY` packets to Hermes** through the configured cross-agent channel. If Hermes is unavailable, return a ready-to-send packet and report the delivery failure.1129. **Wait for Hermes evidence**. Do not infer success from delivery or acceptance.11310. **Independently verify read-only** when possible. A mismatch creates a new Hermes instruction set; the preparing agent never repairs it directly.114115## Hermes Return Contract116117Hermes must return a structured result containing:118119```text120instruction_set_id121execution_owner: Hermes-main122executor: hermes123executor_profile: default124status: executed_verified/executed_rolled_back/blocked/failed125started_at126completed_at127affected_objects128affected_ids_or_filters129affected_count130redacted_before_after131audit_actor_and_markers132idempotency_result133post_write_readback134domain_invariant_results135rollback_status136artifact_sync_status137exceptions138```139140The preparing agent may report `HERMES_EXECUTION_REPORTED` only from this evidence. It may report `INDEPENDENTLY_VERIFIED` only after its own read-only check.141142## Domain Constraints143144- Airtable remains frozen legacy evidence; new RUO operational state belongs in Supabase only through Hermes.145- Account and finance instructions must use the RUO account-ledger contract and full propagation matrix.146- Stock instructions must respect location ownership: Bucharest/main uses `skus.stock_qty`; Ibiza/other locations use `location_stock.qty`; `v_stock_by_location` composes both.147- Financial, stock, SKU, participant balance, customer credit, restock, pricing-control, batch/COA, and proof/reference changes require the financial audit controller or equivalent invariant checks.148- Runtime/config instructions must preserve read-only credentials for every non-Hermes agent.149150## Output Contract151152For read-only:153154```text155Mode: READ_ONLY_NO_HANDOFF_REQUIRED156Reason: ...157Supabase writes performed: none158```159160For an unapproved draft:161162```text163Mode: DRAFT_AWAITING_PAFI_APPROVAL164Instruction set: ...165Hermes delivery: not executable166Supabase writes performed: none167```168169For a blocked handoff:170171```text172Mode: HANDOFF_BLOCKED173Surface: ...174Missing/failed checks: ...175Supabase writes performed: none176```177178For a validated handoff:179180```text181Mode: HANDOFF_READY182Executor: Hermes183Instruction set ID: ...184Approval/surface/objects/scope: ...185Expected diff: ...186Rollback/idempotency/invariants: ...187Required Hermes return evidence: ...188Supabase writes performed by preparing agent: none189```190191For Hermes evidence:192193```text194Mode: HERMES_EXECUTION_REPORTED195Hermes status/read-back/invariants: ...196Independent verification: verified/not_run/exception197Residual exceptions: ...198Supabase writes performed by preparing agent: none199```200201## Bundled Helper202203`scripts/validate_mutation_packet.py` validates instruction-set structure only. It never contacts Supabase, dispatches Hermes, or authorizes execution.204205Expected helper statuses:206207- `READ_ONLY_NO_HANDOFF_REQUIRED`208- `DRAFT_AWAITING_PAFI_APPROVAL`209- `HANDOFF_READY`210- `BLOCKED`211212## Test Cases2132141. Read-only schema inspection returns `READ_ONLY_NO_HANDOFF_REQUIRED`; a packet labeled read-only that also contains mutation intent returns `BLOCKED`.2152. A complete packet with `executor=hermes` returns `HANDOFF_READY`.2163. A complete packet with `executor=codex`, a legacy API-only actor path, or `codex_direct_write_forbidden=false` returns `BLOCKED`.2174. A packet without exact approval returns `DRAFT_AWAITING_PAFI_APPROVAL` only when all non-approval fields are complete; otherwise it is `BLOCKED`.2185. A financial/stock packet without money/stock/account invariants returns `BLOCKED`.2196. A schema/config packet without compatibility and rollback checks returns `BLOCKED`.220221## When to Use vs Alternatives222223- **This skill**: prepare and validate a Hermes handoff for any RUO Supabase mutation.224- **ruo-supabase-guardrails**: always use first for the read-only credential and executor boundary.225- **ruo-financial-audit-controller**: use for money, stock, balances, costs, and published audit propagation.226- **audit-pro**: use when changing this skill, its procedure, or its validator; not for every mutation request.