TLDR: Don't strip the quoted chain. Don't dump it. Fold it. The message thread is your context — but only the reader head needs to be readable on arrival.

The Problem Was the Whole Chain

I built the /email view inside Apollo (my AI agent cockpit — a local dashboard that surfaces my busiest signals) and wired it up to my inbox.

It worked.

It also looked terrible.

The reader was raw white-space:pre-wrap, so every email rendered as a wall of text — > markers, blank-line craters, Superhuman's (my email client) mangled link parentheticals. A three-message thread looked like someone had copy-pasted it out of a 2003 mailing list.

You couldn't read it. You could only tolerate it.

Two Obvious Fixes — Both Wrong

The naive move is to strip the quoted chain entirely.

That's clean! It's also how you lose all the context that makes the head message make sense. Someone replies "that works for me" and you have zero idea what "that" is.

The other naive move is exactly what I already had: dump the whole thing verbatim and let the reader figure it out.

Also wrong. Just in a different direction.

What Actually Worked

I wrote clean_email_body() in apollo/util.py (commit 17f3b65).

The real message renders as <p> paragraphs — actual readable prose. The quoted chain and signature fold behind a collapsed amber <details> toggle. It's there when you need it. It's out of the way when you don't.

I also added a conservative _demangle() pass — repairs the spaced-out emails and domains Superhuman mangles in plain-text (u s e r @ ... type garbage), and drops the duplicate ( url ) parentheticals that showed up after every link.

The result: you open an email card and you read the actual message. If you want the thread history, you tap the toggle. Context on demand, not context as noise.

The Gotcha I Almost Shipped

Here's the thing I nearly broke on the way to the fix.

The dual-pane .reader-body in Apollo is shared — both /email and /slack route through the same render_action_card builder to the same DOM element.

If I hadn't scoped clean_email_body() to EMAIL SOURCE ONLY, I would have tried to run quoted-chain folding logic on Slack messages that have no quoted chain structure at all. It would have silently mangled the Slack reader.

The fix is wired at the apollo/views/rows.py acard builder, checked against the source type before rendering. One wrong assumption about your shared pane and you're debugging two broken readers instead of shipping one good one.

Why This Matters to Me

I spend a lot of time in email.

And for a while I was building a reader that technically showed me my email without actually making it readable. The context was there — it just wasn't usable.

Folding is the right abstraction. Show the head. Hide the tail. Let the user pull the chain when they need it, not every single time.

If you're building any kind of message reader — email, Slack, SMS, doesn't matter — that's the pattern I'd wire in from day one.

P.S. One bonus discovery: Superhuman deep-links are deterministic — https://mail.superhuman.com/<accountEmail>/thread/<gmailThreadId>#app. I assumed they'd be opaque server-minted tokens. Three pasted samples proved me wrong instantly. Lesson: grab one real artifact before you assume anything isn't constructable.