--- id: plugin-system/the-platform-still-knows-email-s-on-disk title: "The platform still knows email's on-disk vocabulary, deliberately, and it is untested by anything" theme: plugin-system status: open created: 2026-08-13 date_source: stated order: 3 --- **The platform still knows email's on-disk vocabulary, deliberately, and it is untested by anything.** `findEmailAccountName` in `data-path.ts` reads `DATA_PATH//email_accounts/*/emails.db` and picks the newest by mtime. Two core callers use it: `user-instance.ts` (`OFFICER_EMAIL_DB`, for the agent's `email_db` MCP tool) and `chat/websocket.ts` (`resolveEmailCwd`, for a chat opened against a mailbox). `ChatPanelWrapper.tsx` hardcodes `workspace.id === 'email'` to trigger the second. This traded a CODE dependency for a CONVENTION, which was the right trade at the time — the code dependency is what put `officer-agent` into a restart loop on 2026-08-13 (`fbb6d6c7`). But the convention has no enforcement on either side: if the plugin ever renames `emails.db`, moves to one database per folder, or nests differently, core silently points the agent at a path that does not exist. No import breaks, no type fails, no test covers it. The tool just goes quiet. The clean version needs two things the platform does not have: a way for a plugin to ship an MCP tool, and a way for a plugin to declare a chat context. Until both exist this stays — but it should be a decision someone re-takes, not one that is inherited.