PullMD Part 1: Ctrl+A and the Junk Context
I’m sitting in front of a long Reddit thread where someone describes pretty much the problem I’m working on. So, as always: Ctrl+A, Ctrl+C, over into the chat. On the phone it’s even more awkward. Select everything, copy, paste. “Share with Claude” doesn’t work on Reddit, because Reddit blocks AI services.
The result is usually fine. The way to get there is still pretty stupid.
If you just share the link with the language model instead, it first has to fight its way through the whole page: navigation, cookie banners, ads, recommendations and the rest of the page junk.
And a large part of the text I paste in myself is often exactly that stuff too. The actual post sits somewhere in between. So the model has to work through a lot of irrelevant content before it even gets to what I actually care about.
That costs tokens, takes longer and bloats the context for no reason. I don’t want the chatbot to analyse Reddit. I want it to just read the thread.
None of this is a groundbreaking insight, of course. It just started to annoy me that I kept repeating the same pointless motions. And at some point it was once too often.
The Brief Hope: Cloudflare Delivers Markdown
Cloudflare recently introduced a markdown service: URL in, clean markdown out. Without navigation, ads and the whole rest of the page.
Naturally I tried it right away. A few Wikipedia articles, a tech blog – the result really did look good. Clean markdown, hardly any ballast, exactly what I had been looking for.
You simply request the page with the text/markdown Accept header – roughly: “Oh, by the way, I’ll take markdown too, if you have any.”
curl "https://developers.cloudflare.com/fundamentals/reference/markdown-for-agents/" \
-H "Accept: text/markdown"
The catch: it only works for pages that actively support the service and use Cloudflare at all. It doesn’t work on Reddit, and it doesn’t work on a lot of the sites you stumble across day to day either.
For a moment I considered building a skill for it: fetch supported pages through Cloudflare, handle the rest some other way. But a tool that fails on a large part of my actual sources doesn’t solve my problem. It only makes it a bit smaller in a few places.
Building It Myself – But Small at First
That pretty much settled it: if there is nothing ready-made that works reliably, I’ll build it myself.
Not right away as a universal web scraper for half the internet, but only for Reddit at first. That’s where it bothers me most often, and there is a pleasantly simple way in: append .json to a Reddit URL and Reddit returns the raw data of the post and its comments. Without an API key, OAuth or app registration.
That route has worked for years and was exactly right for a first prototype.
On Android the service should be installable as a PWA and support the Web Share Target API. Then I could just hit “Share” in the Reddit app and send the link straight to my service. No selecting, no copying, no extra browser tab.
Before letting any code be written, I wanted to think the concept through properly. So first some philosophising about it with Claude on claude.ai, to pin down architecture and requirements. After that, Claude Code was to start with a specification that was as complete as possible.
The Concept Chat of March 2
The chat opened right away with a typo from my phone’s autocorrect. It had turned “Reddit” into “Tresor”, the German word for vault.
Claude replied to “Tresor Posts”:
Good idea, let’s think this through! I assume “Tresor” was autocorrect and you mean Reddit posts – right?
That was quite fitting. The model understood what I meant despite the mistake, because the rest of the context was unambiguous. That’s really what it always comes down to: not throwing as much text as possible at the model, but giving it the best possible context.
One of the first architecture questions was whether there should be one way in or two:
- The actual core is an HTTP endpoint. CLI tools, Claude Code, n8n or other automations can use it.
- On top of that sits a small web interface as a PWA. It’s mainly meant for Android and takes links in through the share menu.
Both paths end up at the same endpoint. The processing stays identical, only the way it’s used differs.
We deliberately wanted to do without the official Reddit API. Access has become needlessly awkward by now, and for a service this small it isn’t required at all.
Instead, a two-step strategy took shape:
- First the
.jsonroute, with a normal, realistic user agent. - If Reddit blocks that, HTML scraping via
old.reddit.comas a fallback.
Old Reddit is considerably easier to parse than today’s interface. Above all it needs no headless browser, which would have made the whole project heavier and more maintenance-hungry straight away.
A decision was made on the comment format too, one I liked immediately: nested comments are indented by two spaces each, rather than rendered as ever longer markdown blockquote chains.
Across several levels, blockquotes quickly look like this:
> > > > Reply to a reply to a reply
By the time you paste that into a chat it is barely readable any more. With plain indentation the structure stays visible, without the actual content disappearing behind a wall of > characters.
The project’s first codename came out of this chat as well. I built under that name for the next few weeks. Later it had to go again for trademark reasons – more on that in Part 8.
At the end the service still needed a subdomain. My home network follows a fixed naming scheme, so I simply asked Claude to pick a fitting name for it.
Web Share Target API – What It Does
Through the Web Share Target API, an installed PWA can register itself in the Android share menu.
The important word here is installed. Opening the page in the browser or saving it as a normal bookmark is not enough. The PWA has to be installed via “Install app” or “Add to home screen”.
It also has to be reachable over HTTPS. Since Traefik sits in front of it here as a reverse proxy anyway, that was no extra effort.
The manifest entry needed for it is fairly manageable:
"share_target": {
"action": "/share",
"method": "GET",
"params": {
"url": "link"
}
}
After that the PWA shows up in the Android share menu next to WhatsApp, Signal and the other apps.
If I share a Reddit link with it, the interface opens and the link is already filled in. That is exactly what I wanted: to use my own URL service on Android without having to build a native app for it.
The Specification
At the end of the chat there was a complete specification:
- File structure
- API endpoints
- Parameters and return formats
- PWA manifest
- Docker Compose file
- Traefik labels
- Sample output with indented comments
The open architecture questions were settled with that. Not a line of code yet – exactly as it was meant to be.
The chat was supposed to plan the project, not start producing half-finished files along the way. The actual building was to be Claude Code’s job, with the specification as its brief.
That same evening at 21:53 it began.
Part 1 of 15 in the PullMD series.