Data Retention and Deletion (Draft)
Company: [COMPANY LEGAL NAME] Address: [ADDRESS] Contact: [SUPPORT EMAIL] Governing law: [GOVERNING LAW] Last updated: 4 December 2026
This schedule describes what the current LaneTruth code actually keeps and deletes. The product was previously called FreightAudit AI; this draft uses the name LaneTruth. It is not legal advice. Where the code has no rule, this document says "to be decided by founder". A qualified lawyer must review the schedule against tax, accounting, employment, and data-protection obligations before publication.
1. Summary
- Account deletion is self-service and requires the account password.
- Account deletion removes the account row and the user-scoped rows listed in Section 3.
- Original upload files are not stored; only parsed inputs are saved when the user saves an audit.
- Saved audit payloads are encrypted with AES-256-GCM in production.
- On the production host (Fly.io), daily SQLite backups on the volume are kept for 14 days (
BACKUP_KEEP_DAYS=14) and Fly volume snapshots are kept for 14 days; encrypted off-host copies are kept by the operator (retention to be decided by founder). Deleted data can remain in older backups until they rotate out. - The optional AI cache has no built-in expiry and is not deleted by account deletion. This is a gap the founder must decide on and fix.
- Stripe may retain billing records after account deletion. Deleting an owner account cancels live Stripe subscriptions first (immediately, no further renewals); the Stripe customer record is kept by Stripe.
- Some global tables (Stripe event ids, carrier deadline rules) are not linked to a user and are not removed by account deletion.
2. Retention schedule
| Data | Where stored | What it contains | Retention in the current code | Deleted on account deletion? |
|---|---|---|---|---|
| Account record | users table | Email (sealed when the data key is set), scrypt password hash, created time, verification status/timestamps, email lookup HMAC, case-study consent and timestamps | Until the user deletes the account | Yes (the user row is deleted) |
| Sessions | sessions table | Keyed hash of the session token, user id, expiry, last-seen time | Absolute lifetime 30 days; idle lifetime 7 days; expired sessions are removed when encountered. No scheduled pruning job. | Yes |
| Verification and reset tokens | user_tokens table | Hash of the one-time token, kind, created/expiry, used time | Verification token 24 hours; reset token 1 hour; single use. Expired rows are not pruned by a scheduled job. | Yes |
| Saved audits | audits table | Name, timestamps, basis, line count, totals, currency rollup, encrypted compact payload, content hash, free-audit flag | Until the user deletes the audit or the account. No automatic expiry. | Yes |
| Audit payload contents | Inside the encrypted audits.payload | Parsed invoice lines, rate contract, optional supporting shipment/credit/applied-credit records, and findings metadata | Same as the saved audit. No separate expiry. | Yes, with the audit row |
| Savings events | savings_events table | User id, audit id, finding id, carrier, error type, amount, currency, timestamp | Until account deletion. No automatic expiry. | Yes |
| Disputes and dispute events | disputes, dispute_events tables | Carrier, finding, amounts, status, deadlines, notes, event history | Until account deletion. No automatic expiry. | Yes |
| Onboarding state | onboarding_state table | Company name, country, currency, carriers, selected carrier, export method, first-audit JSON, plan | Until account deletion | Yes |
| LLM usage counters | llm_usage table | Token counts, scope, cached flag, account id, timestamp | Until account deletion. No automatic expiry. | Yes |
| Subscription state | subscriptions table | Status, plan, trial end, Stripe customer id, period end, cancellation flag, past-due time | Until account deletion, subject to legal/tax retention | Yes, but Stripe's own records remain |
| Stripe event ids | stripe_events, stripe_subscription_state tables | Event id, type, received time, status; subscription id and last event time | No pruning rule in the code. Global, not linked to a user. | No |
| Email outbox | outbox table | Recipient address, subject, body, template, status, provider id, redacted error, timestamps | Kept for delivery, audit, and retry. No automatic expiry. Failed rows are explicitly retained. | Yes, rows matching the account email are deleted |
| Optional AI cache | data/llm-cache.json (or LLM_CACHE_DIR), plus a temporary fallback under the OS temp directory | Cached model input/output text, keyed by a hash; sealed when the data key is set | No TTL or eviction in the code. Persists until an operator deletes the file. | No. This cache is not user-scoped and is not cleared by account deletion. |
| Backups | Operator-chosen backup directory | Full SQLite snapshot | Newest 7 kept by default when npm run backup runs. Rotation frequency depends on the operator; there is no built-in scheduler. | Not immediately. Deleted rows remain until older snapshots rotate out. |
| Application logs | Host / process logs | Request metadata and redacted errors. Invoice file content is designed not to be logged. | Host-dependent. To be decided by founder. | Not automatically |
| Support correspondence | Email mailbox / operator tooling | Emails, addresses, attachments the user sends to support | To be decided by founder. | Not automatically |
| Audit event table | audit_events table | Event kind and detail | Table exists but no writer was found in the current code. To be decided by founder if it is used. | No user linkage; not deleted |
| Carrier deadline rules | carrier_deadline_rules table | Public carrier, finding type, day window, source URL, effective date | Reference data, not personal data. Kept while the rule is needed. | Not applicable |
| Case-study consent record | users columns | Opt-in flag, consent time, withdrawal time | Until account deletion | Yes |
3. What account deletion does
The self-service flow in lib/auth/delete-account.ts verifies the password, then deletes, in one transaction:
dispute_eventsfor the user;disputesfor the user;savings_eventsfor the user;auditsfor the user;onboarding_statefor the user;llm_usagefor the account;user_tokensfor the user;sessionsfor the user;subscriptionsfor the user;outboxrows whose recipient email matches the account email; and- the
usersrow.
Since 4 Dec 2026 the deletion flow for a company owner first cancels every live Stripe subscription for the account's Stripe customer (immediate cancellation). If Stripe cannot be reached the deletion is aborted. The Stripe customer itself is not deleted (Stripe keeps it for invoices, refunds and tax). Deletion also removes the company workspace, its members' access, open invitations, the activity log and the account's support tickets. The code does not clear the optional AI cache, the global Stripe event tables, application logs, or backups.
4. Deletion limits and caveats
- Stripe: owner-account deletion cancels live subscriptions immediately. Stripe may retain billing records for tax, accounting, fraud, and dispute purposes.
- Backups: a deleted account can remain in an older snapshot until that snapshot is rotated out. Restoring a backup would restore the deleted rows unless a fresh deletion is run. Backup encryption and access controls depend on the host and are to be confirmed.
- AI cache: cached model text is not linked to an account and is not removed on deletion. The founder must decide whether to add per-account keys, a TTL, or a deletion hook. Until then, do not tell customers that account deletion erases all derived AI text.
- Provider records: the email provider, hosting provider, and payment provider may keep their own logs and records under their policies.
- Legal holds: data may be retained longer where law, a court order, or a tax/accounting rule requires it.
5. To be decided by founder
The following have no rule in the current code and must be decided before launch:
- Retention period for saved audits and supporting records after the customer stops using the service.
- Retention period for the optional AI cache, and whether to delete cache entries on account deletion.
- Whether to prune expired sessions and one-time tokens on a schedule.
- Retention period for the email outbox (especially failed rows) and whether to redact bodies after delivery.
- Retention period for application and host logs.
- Retention period for support correspondence.
- Backup schedule, encryption, off-site storage, and whether deleted accounts are purged from backups on a defined cycle.
- Whether
audit_eventsis used and, if so, its retention. - Whether to prune global Stripe event tables.
- Any tax, accounting, or statutory retention period that overrides the defaults above.
6. Customer-facing wording (draft)
You can delete saved audits from your account page. You can delete your account through the self-service flow, which requires your password. Deleting your account removes the account and the user-scoped records described in our Retention Policy. It does not cancel an active Stripe subscription. Some records may remain in backups, payment-provider records, or legal archives for the periods described in this policy.
[LAWYER TO REVIEW AND ALIGN WITH THE PRIVACY POLICY AND TERMS.]
Recent changes (4 December 2026)
These changes took effect on 4 December 2026:
- Company workspaces. One company per subscription, with roles owner / admin / member / viewer. Owners and admins invite people with a single-use link valid for 7 days (max 25 people). Viewers are read-only. The company's data belongs to the owner account; removing a member signs them out immediately.
- Activity log. Security-relevant actions (invitations, role changes, exports, deletions, AI setting changes, support requests) are logged per company with the acting user and time. Details are encrypted; no invoice contents are logged. Kept until the company is deleted ([RETENTION PERIOD - FOUNDER DECISION]).
- AI opt-in. AI help (DeepSeek) is off by default and must be switched on by a company owner or admin.
- Support tickets. The in-app support form stores the requester's email, name, company, subject and message, all encrypted at rest. There is no public support mailbox yet ([SUPPORT EMAIL]).
- Encryption scope. Saved-audit names and money totals are now encrypted together with the audit payload (AES-256-GCM, application level). The Fly.io volume is reported encrypted at rest.
- Large files. CSV and Excel invoice files are parsed in the user's browser and are not uploaded; files up to 200 MB (CSV) / 50 MB (Excel) are read in parts on the user's computer. PDFs and images (max 8 MB) are processed in server memory and not stored.
- Account deletion. Owner deletion cancels live Stripe subscriptions immediately before deleting data; if cancellation fails nothing is deleted.
- Subscription, cancellation and refund terms are in SUBSCRIPTION-TERMS-DRAFT.md, CANCELLATION-POLICY-DRAFT.md and REFUND-POLICY-DRAFT.md.