Skip to content

Recipe: AI builders

This content is not available in your language yet.

For Lovable, Bolt, v0, Replit, Cursor and Claude Code. Copy a prompt, paste it into the tool, then check the result.

  1. Install the package. In Cursor, Claude Code and Replit, run npm install @geometer/trust. In Lovable and Bolt, ask the tool to add the dependency @geometer/trust. Until the package is published, your Geometer contact gives you the install command.
  2. Tell the tool to read the rules. The package ships AGENTS.md (also in for-ai-assistants.md). Cursor and Claude Code read AGENTS.md by themselves. In the others, paste the rules into the chat or add them to the project’s knowledge or instructions.
  3. Paste one prompt below. One mode per prompt.

Prompt: Vault (saved data only the user can read)

Section titled “Prompt: Vault (saved data only the user can read)”
Add Geometer Trust Vault to this app. Read the package's AGENTS.md first and follow every rule.
- Use @geometer/trust/vault. Keep the stack: React, Vite and Supabase.
- Create a table trust_keys (app text not null, user_id uuid not null references auth.users, key_file text not null, updated_at timestamptz default now(), primary key (app, user_id)) with row-level security so each user can read, insert and update only their own row.
- After sign-in, call openVault({ app: "<my app name>", user: <supabase user id>, keyStore: supabaseKeyStore(supabase, { app: "<my app name>", user: <user id> }), unlock: "passkey", onRecoveryCode }).
- Show the recovery code once in a screen that makes the user confirm they wrote it down. Do not store it.
- Encrypt the "<column name>" column of the "<table name>" table: make the row id with vault.newId() first, then vault.encrypt(text, { table: "<table name>", id, field: "<column name>" }) before every insert or update, and vault.decrypt(...) after every read. Never decrypt on the server.
- For exact-match lookups, add a text column "<column name>_key" that stores vault.searchKey(value.trim().toLowerCase(), { table: "<table name>", field: "<column name>" }), and query it with eq(). Never use LIKE or full-text search on the encrypted column.
- Add a short note on the screen: "Only you can read this. If you lose your passkey and your recovery code, nobody can recover it."

Prompt: Sealed AI (a chat only the user can read)

Section titled “Prompt: Sealed AI (a chat only the user can read)”
Add a private chat with Geometer Trust Sealed AI. Read the package's AGENTS.md first and follow every rule.
- Use @geometer/trust/sealed-ai in the browser and @geometer/trust/sealed-ai/server for the server route.
- Server route: <for Lovable or Bolt: a Supabase Edge Function named sealed-ai that imports sealedRoute from "npm:@geometer/trust/sealed-ai/server" and calls Deno.serve(handler), with allowedOrigins: [the app's origin, read from an APP_ORIGIN secret] because the function address is another origin than the app> <for Next.js: app/api/trust/sealed-ai/[...path]/route.ts exporting GET and POST>. It uses sealedRoute({ provider: "tinfoil", apiKey: <secret SEALED_AI_KEY>, authorize }). authorize is required: it must verify the signed-in user (for Supabase, the access token that the browser sends as the client's apiKey; for Next.js, the session). Never write authorize: () => true. For Supabase, set the browser client's apiKey to the user's access token. Put SEALED_AI_KEY in the server's secrets. Never in the browser, never in a VITE_ or NEXT_PUBLIC_ variable.
- Browser: new OpenAI({ baseURL: <the route address>, apiKey: <"not-used" for Next.js, or the user's access token for Supabase>, dangerouslyAllowBrowser: true, fetch: sealedFetch() }). Use an open model that Tinfoil offers.
- Create the AI client with maxRetries: 0 and read errors with findTrustError(err), which finds the Trust error the client wrapped. If a call fails with a sealed-ai/... error, show the error message. Do not retry as another mode or as a plain call.
- Add a short note on the screen: "Nobody but you can read this chat. The app's code on your device is still trusted."

Prompt: Masked AI (GPT, Claude or Gemini with names and numbers hidden)

Section titled “Prompt: Masked AI (GPT, Claude or Gemini with names and numbers hidden)”
Add Geometer Trust Masked AI to the chat feature. Read the package's AGENTS.md first and follow every rule.
- Use @geometer/trust/masked-ai in the browser and @geometer/trust/masked-ai/server for the server route.
- Server route: <for Lovable or Bolt: a Supabase Edge Function named masked-ai that imports maskedRoute from "npm:@geometer/trust/masked-ai/server" and calls Deno.serve(handler), with allowedOrigins: [the app's origin, read from an APP_ORIGIN secret] because the function address is another origin than the app> <for Next.js: app/api/trust/masked-ai/[...path]/route.ts exporting GET and POST>. It uses maskedRoute({ provider: "openai", apiKey: <secret OPENAI_API_KEY>, authorize }). authorize is required: it must verify the signed-in user (for Supabase, the access token that the browser sends as the client's apiKey; for Next.js, the session). Never write authorize: () => true. For Supabase, set the browser client's apiKey to the user's access token. Move the AI key out of the browser into the server's secrets. Never leave an AI key in browser code or a VITE_ or NEXT_PUBLIC_ variable.
- Browser: new OpenAI({ baseURL: <the route address>, apiKey: <"not-used" for Next.js, or the user's access token for Supabase>, dangerouslyAllowBrowser: true, fetch: maskedFetch({ alsoMask: <the customer and company names this app knows> }) }).
- Create the AI client with maxRetries: 0 and read errors with findTrustError(err), which finds the Trust error the client wrapped. Show its message.
- Add a short note on the screen: "Names, numbers and secrets are hidden before sending. The AI company can read the rest."
- Do not call this encryption.

Use this if your tool put an AI key in the browser code.

This app calls an AI provider directly from the browser with a key in client code. Move that call behind a server route that holds the key, using Geometer Trust Masked AI (see the package's AGENTS.md). Remove the key from all client code and from every VITE_ or NEXT_PUBLIC_ variable, and tell me to rotate the old key. The route must pass a real authorize check (the signed-in user), never () => true.

Then rotate the old key at the provider. A key that was in the browser is no longer secret.

Check How
No AI key in the browser Search the project for the key. It must appear only in the server route’s secrets.
Data is scrambled Open the table. The encrypted column holds unreadable text.
Placeholders leave the device Network tab: the chat request holds placeholders (Masked AI).
Recovery code is shown Sign in as a new user. A code appears once.
Routes check the user Call the route signed out. It answers 401 (<mode>/not-authorized).
One mode per call The code never calls two modes for one request.
Tool Note
Lovable, Bolt Their default is Supabase. Use Vite and Supabase Edge Functions.
v0 Makes Next.js. Use Next.js and Supabase.
Replit Use the Next.js recipe, or the Vite one with a Supabase function.
Cursor, Claude Code They read AGENTS.md themselves. Start from the prompt that matches your mode.