EACI Development Journal · Security

How Do You Delete an AI Companion Account Completely Under RLS?

Account deletion is a coordinated server operation, not a series of browser deletes. User-owned rows must be removed under policies that do not leave hidden history behind.

Security ~10 min issue-tagged
Issue this fixes

An account can own auth identity, profile data, cloud history, memory records, usage state, and other rows protected by row-level security. Deleting only the auth user can orphan records; deleting from the browser can be interrupted halfway.

The operation needs an authenticated server boundary, a known table inventory, and an order compatible with foreign keys. A success response should mean every required store completed.

What was actually going wrong

Client-side deletion assumed the signed-in user had permission to remove every dependent record and then its own auth identity.

What I tried

What finally worked

A privileged deletion function verifies the caller, removes user-owned data in a defined sequence, and deletes the auth identity last.

Why it worked

One trusted operation can cross RLS boundaries intentionally and report partial failure instead of hiding it.

What I learned

Complete deletion requires a data inventory before it requires a button.

Where EACI uses this today

Main account controls can request deletion across account history and associated service data.

This journal covers real engineering on EACI Companion / The Veil. Companions include Caelum, Chad, Natalia, Atreus, Luna, Roxy, and Cael. Journal articles stay family-safe in content. See Privacy and Ethics.