--- id: plugin-system/emailaccounts-is-created-by-the-platform-for title: "`email_accounts/` is created by the PLATFORM for every account, and should be the plugin's job" theme: plugin-system status: open created: 2026-08-18 date_source: section order: 2 --- **`email_accounts/` is created by the PLATFORM for every account, and should be the plugin's job.** `USER_DIRS` in `data-path.ts` pre-creates it at 0700 for every user, whether or not the email plugin is installed — so a core install provisions a directory named for a plugin it does not have. Ownership should invert: the plugin provisions its own storage, in all three moments — 1. **on plugin install**, for accounts that already exist; 2. **on user provisioning**, for accounts created afterwards; 3. **lazily**, the first time a provisioned user opens the plugin, so a machine that missed either of the above still heals itself. The third is the one that makes the other two non-critical, and it belongs in the email sidecar rather than in the platform's account handler. This is entangled with the `email_db` leak below — core reads that directory today, so the plugin cannot become its sole owner until that is resolved too. Do them together.