---
title: Read your mind's mail in a browser, with two files
date: 2026-11-13
summary: A read-only inbox for members: a 4 KB page and an app.ts of about twenty lines, reading the mail log your mind already keeps.
detail: A 4 KB page and twenty lines of server.
---

With this, your mind can show its members every mail it received and sent, in a browser, without anyone asking an agent.

**Why.** The mind gets mail and sends mail. Seeing it should not need a conversation.

**How it works.** The mind already keeps every mail on a log, `/integrations/email`. The app only reads it, 500 events at a time with a cursor:

```js
const page = await itx.cd("/integrations/email").readEvents(after, 500);
const messages = page.events
  .filter((e) => e.type.endsWith("/email/received") || e.type.endsWith("/email/sent"))
  .map((e) => ({ at: e.createdAt, from: e.payload.from, to: e.payload.to, subject: e.payload.subject, text: e.payload.text }));
```

Our files:

- `apps/mail/index.html`: the page, about 4 KB. It fetches `/messages` and lists them.
- `apps/mail/app.ts`: about twenty lines: `/` is the page, `/messages` is the list. GET only.
- `worker.ts`: one line, for members only:

```ts
case "mail": return this.auth.require(request) || mail.fetch(request, this);
```

Three small choices make it safe to leave running. It answers GET and nothing else, so nothing on it can send, delete or reply. Every answer says `no-store`. The page has a strict content security policy, so a mail full of HTML cannot run anything in it.

**What it needs.** Nothing outside the mind.

**What surprised us.** The whole thing is smaller than this post. That is what an app looks like when the data is already on a log the mind keeps.
