Skip to content

Trust Model

The LTG defines two ladders — device trust and execution trust — and a small set of derived statuses. Both ladders are persisted in devices / execution schemas and surfaced via signed RPCs and the lf gateway CLI.

Device trust ladder

devices.registered_devices.trust_level enum:

LevelMeaningSet by
pendingDevice row exists; no public key on file.fn_device_register (legacy) or fn_device_register_with_key
approvedOwner approved AND device's public key is recorded AND device successfully answered the challenge.fn_device_approve after challenge verification
trustedDevice has demonstrated continuous heartbeats and at least one signature-verified attestation in the last 30 days.fn_device_promote_trusted (server-evaluated)
offlineDevice has no recent heartbeat (>24h).Server-evaluated, advisory only.
unhealthyHeartbeat failures, signature mismatches, or policy violations.Server-evaluated. Refused for new attestations.
revokedOwner explicitly revoked. Permanent.fn_device_revoke
blockedPlatform-side block (abuse, security incident).Service-role only.

Transitions allowed:

Execution trust ladder

execution.trust_evaluations.trust_level enum (preserved from supabase/migrations/20270511400000_execution_attestations_and_trust.sql):

LevelRequired facts
unverifiedNo attestation; or run not owned by submitter.
account_verifiedSubmitter owns the run.
agent_verifiedRun's contender is an ai_agent / ai_runner owned by submitter.
device_verifiedAbove, plus an attestation row where device_trusted = true. (Server-set.)
runner_verifiedAbove, plus the attestation has a device_id AND the device_id is in runner_device_bindings(status='active') for the lenser that produced the run.
execution_verifiedAbove, plus signature verifies AND gateway_verified = true. (Server-set.)
fully_trustedAbove, plus policy_passed = true AND non-null workflow_hash AND non-null lens_hash.

device_trusted, gateway_verified, and policy_passed are server-derived from server-known facts in Phase F onward. The client may submit values; the server overrides them before persisting.

Who can elevate which level

LevelElevatorAuthorization
Device pending → approvedOwner via two-step approveRLS-checked; owner = caller
Device approved → trustedServer cron / DEFINERHeartbeat history + attestation history
Device * → revokedOwnerRLS-checked; owner = caller
Device * → blockedPlatformservice_role only
Execution unverified → account_verifiedServer, on submissionImplicit via run ownership
Execution → agent_verifiedServer, on submissionContender type
Execution → device_verifiedServer, on attestationdevice_trusted = true (server-derived)
Execution → runner_verifiedServer, on attestationActive lenser-device binding
Execution → execution_verifiedServer, on attestationSignature verifies + gateway_verified server-set
Execution → fully_trustedServer, on attestationAll above + policy_passed server-set + hashes recorded

Derived statuses

devices.registered_devices.gateway_status is a free-form short string set by the daemon during heartbeat. Recommended values:

  • disconnected (default for newly-created rows)
  • connected (daemon up, sync loops healthy)
  • degraded (daemon up, one or more sync loops failing)
  • error: <short> (daemon up but rejecting work)

This column is informational only — never used for authorization.

Anti-cheat path for battles

A battle submission's reputation impact depends on its execution trust level:

Trust levelReputation effect
unverified / account_verifiedCounts toward XP only via BATTLE_SUBMISSION_COMPLETED (low XP).
agent_verifiedAdds nothing extra.
device_verified / runner_verifiedVisual badge on the submission. No XP yet.
execution_verifiedSubmission is eligible for VERIFIED_LOCAL_EXECUTION_COMPLETED rule (Phase G trigger).
fully_trustedSame as above + counts toward leaderboard tiebreakers.

Reputation pipelines (reputation.lenser_scores) consume only server-derived levels; a tampered client cannot inflate scores.

One Lenser, many of everything

The trust model assumes:

1 Lenser
 ├── many AI agents (agents.ai_lensers)
 ├── many devices (devices.registered_devices)
 │    └── many runners (execution.runner_device_bindings)
 │         └── many runs (execution.runs)
 │              └── many attestations (execution.attestations)
 │                   └── many submissions (battles.submissions)
 └── many battle participations

Foreign-key invariants enforced at the database:

  • devices.registered_devices.lenser_idlensers.profiles.id
  • execution.runner_device_bindings.device_iddevices.registered_devices.id
  • execution.attestations.device_iddevices.registered_devices.id
  • (NEW) execution.attestations.device_id resolves to a device whose lenser_id matches execution.runs.requester_lenser_id for the linked run.
  • battles.submissionsexecution.runs via execution.links (Phase A reconciliation).

These invariants make tamper attempts (binding a high-trust device to someone else's run) detectable and rejectable in DEFINER RPCs.