What Petrova keeps
In short
- Prompts and answers are not logged or stored by the gateway.
- Every stored field, why, and for how long.
- Gaps are listed, not hidden.
Petrova is not live. This page describes what the code in this repository does today, in fixture mode. It is written from the migrations in db/migrations/ and the code that writes to them. Where a promise has a gap, the gap is listed here, not hidden.
Prompts and answers
The model gateway does not log or store prompts or answers. This is enforced by code:
- The API server starts with Fastify's logging off:
Fastify({ logger: false })inapps/api/src/app.ts. There is no log library in the API, worker or packages. The production start (apps/api/src/server.ts) writes one JSON line per request with only the method, the route pattern (not the URL), the status and the time taken, plus start-up and deposit events. No body, key, code, link or token is in those lines. - The gateway keeps the request body as raw bytes in memory and forwards it unchanged (
apps/api/src/messages.ts). Tests:tests/integration/messages.test.ts, "the body reaches the upstream unchanged and only anthropic-* headers are forwarded" and "stream is passed through byte for byte, pings kept, receipt in headers and trailer". - The only thing it writes about the request is a quote over
{ body_hmac, model, max_tokens }.body_hmacis an HMAC-SHA256 of the body under a key derived for your account from a secret in config (PETROVA_PAYLOAD_HASH_KEY, never in the database), so someone with the database cannot confirm a guessed prompt. A paid tool's URL (which carries a GET tool's inputs) is hashed the same way. The body itself is never written. - From the answer it reads only the token counts and the supplier's message id.
- Errors from a supplier go back to you. They are not written down.
- A seller re-check (2% of eligible calls; on by default when a non-direct supplier is configured) keeps the request and both answers in memory for up to 120 seconds, then drops them. For a streamed call, only a sampled stream is rebuilt into its final message, in memory. The
seller_checkstable keeps only names, ids, a score and a verdict. Test:tests/integration/sellers.test.ts, "a sampled call that matches the reference passes and is marked checked on its receipt". - Paid tool calls and calls to other agents' listings: inputs and results go back to you and are not stored (
tool_calls,seller_callshold amounts, status and a reason code).
A test sends a canary string through every path that takes customer text (model calls in all three formats and through a Venice-style supplier, paid tools with GET and POST inputs, a memory that is then forgotten, a repo indexed by the worker and then erased, a refused repo index, a chain.watch query), then scans every text, JSON, array and byte column of every table. It fails if the canary appears anywhere, or if a plain SHA-256 of any request body is stored: tests/integration/privacy.test.ts, "a canary prompt sent through every path appears in no text column afterwards, and no plain body hash is stored". Process output is not scanned.
What is kept, why, and for how long
You can erase memories ("forget") and repos (DELETE /v1/repos/:repo). Staged repo files are deleted as soon as they are not needed. Otherwise there is no purge job, no retention window and no account deletion. "Kept" below means kept until someone deletes it by hand. Many tables also have a database trigger that refuses deletes ("append-only").
| Kept | Why | Stored as | For how long |
|---|---|---|---|
| Account and project names | The account | Plain text | Kept, no deletion code |
| API key | Sign-in | SHA-256 hash. Plus a 17-character prefix: ptrv_test_ and the first 7 random characters | Kept. Revoking sets a date; the row stays |
| Ledger: every charge, hold, refund, payout | Money | Amounts and ids | Permanent, append-only |
| Quotes and request records | Billing and replay protection | SHA-256 of the payload (for a model call, of the keyed body HMAC, model and max_tokens) | Permanent, append-only |
| Agent id, parent agent id, session id | Caps and receipts | Plain text, as your client sent them | Kept, cannot be deleted |
| Token counts, model, which supplier served the call, supplier message id | Receipts and reconciliation | Numbers and ids | Permanent, append-only |
Saved memories (remember) | You asked for it | Plain text, up to 1,000 characters, and a search index of it | Until "forget", which deletes the row, its text and its index |
| Repo memory: file paths, file summaries, symbol lines, the rendered block | You asked for it | Plain text. A symbol line is a copy of one source line; a summary can quote a comment line | Until DELETE /v1/repos/:repo, which erases the repo's commits, blocks, file list, summaries and symbols (of blobs no other repo of yours uses) and its memories |
| Repo files waiting to be summarised | The worker needs them | Full file text | Written only after the hold is taken. Deleted when the worker finishes or fails for good, when the hold is refused, and when the sweeper releases the hold |
| chain.watch filter | The watch | Addresses, types and a minimum amount. Your plain-language query is parsed and not kept | Kept |
| chain.watch events delivered | Replay and billing | Public chain data | Permanent, append-only |
| Owner email | Payouts and same-owner checks | SHA-256 of the trimmed, lower-case address | Kept |
| Owner wallet, payout address | Payouts | Plain text | Kept |
| Your AWS role ARN and external id | Customer cloud | Sealed with AES-256-GCM, bound to the account | Kept after disconnect |
| AWS account hint | Showing which account | Last 4 digits | Kept |
Tests behind the stored-as column:
- Key hash:
tests/integration/foundation.test.ts, "API keys enforce tenant isolation, scopes, revocation and pause state". - Email hash:
tests/integration/payouts.test.ts, "accounts with the same owner cannot buy each other's listings: at the call, the ledger and the database". - Sealed ARN:
tests/unit/bedrock.test.ts, "sealed role ARNs open only under the same key and the same account binding";tests/integration/bedrock.test.ts, "onboarding: Petrova issues one external ID, checks it on connect, and seals the role at rest". - Staged files deleted:
tests/integration/worker.test.ts, "the index route enqueues; the worker summarises, renders the block and settles the hold". - Forget, repo erase, refused-hold staging, chain.watch query:
tests/integration/privacy.test.ts(above). - Only hashes reach the outbox:
tests/integration/quotes.test.ts, "nothing is dispatchable until the hold commits". - Payout rail errors not stored:
tests/integration/payouts.test.ts, "a failed payout returns the money to the owner balance and is never resent by a retry".
Kept in memory only
| What | For how long |
|---|---|
| Which supplier a session sticks to | 1 hour, at most 10,000 sessions |
| Which supplier key a session uses (Venice-style keys) | 1 hour |
| Temporary AWS credentials | Until 5 minutes before they expire |
| Seller re-check request and answers | Up to 120 seconds |
All of this is lost when the process stops.
Gaps
These are places where the code does not fully keep the promise above.
- The OpenAI
userfield can become a stored agent id. If no agent header is sent,userormetadata.user_idis used for attribution and stored. - Request records are kept forever. Quotes, holds and settlements (with agent and session ids) have no retention window.
- Without
PETROVA_PAYLOAD_HASH_KEYthe key is random per process. Digests are still keyed, but a request id retried after a restart conflicts instead of replaying. - A summary shared with another repo stays. Repo erase keeps the summary and symbols of a file that another of your repos still lists; erasing that repo too removes them.
- Process output is not scanned by the canary test; the API has logging off.
Planned: a retention window for request records; account deletion.
Last checked against the code: 16 November 2026. Something wrong? The source of this page is in the repository, so a fix is one edit.