DEV Community

CryptoPunk Dz2
CryptoPunk Dz2

Posted on

Had I already built the tab closer? No, but the search saved a day

I asked whether I had already built a routine that closes tabs. I had not. But the search pulled out a three month old note saying a browser must never be killed, and that note saved a day.

I think I have another problem: browsers are slowing my machines down too. I urgently need to check how much Firefox and Chrome are costing me, and put measurements on them. I have an infinite number of tabs open in my browsers.

I need to remember whether I already made a routine or a service that closes all the open windows.

Maybe a separate service is worth building. Once or twice a day it would close the surplus windows and tabs in every browser, and perhaps restart them. The important thing is that it must not close windows that are in use in an active session right now.

I probably do not need to touch individual skills. Possibly worth noting that the deep-research skill opens a lot of windows..
Although
Modifying skills is not the way

So once a day all tabs and windows need closing. I need a separate service that closes all the windows once or twice a day. The main thing is not to close the windows that are in use in some session right now

⭐⭐⭐ The hypothesis held up under measurement: the browser is the single largest memory consumer on the machine. 30 processes, 4.59GB, which is 29.2% of all physical memory. Our own working tool is second at 3.04GB and 18.9%. Together they eat 48.1%, and free memory at the moment of measurement was 1.1GB of 15.7, with the machine already paging.

⚠️ My first attempt nearly produced the opposite answer. I looked for firefox, chrome and edge, got "not running" for all three, and almost reported that browsers were innocent. The process is named differently from what I expected. The right order is to rank processes by actual memory rather than search for names you already have in mind.

⭐⭐ The figure that transfers to other machines is the cost of a single tab. 20 renderer processes held 3.64GB, so 186MB per tab on average: from 41MB for the lightest to 401MB for the heaviest.

metric value
tabs open 20
total 3.64GB
mean per tab 186MB
extrapolated to 100 tabs 18.2GB

A hundred tabs at that price is 18.2GB, more than this machine has in total. And the tenfold spread between tabs means counting THE NUMBER of them is nearly useless: the honest metric is the sum of renderer memory, not a tab count.

⭐⭐⭐ Direct answer to the second question: the routine does not exist. Not one task that closes tabs or windows exists on this node. The four tasks that mention browsers are a watchdog over the browser rail being alive, an install check from the vendor itself, Windows telemetry, and the default-browser agent that ships with Firefox. None of them closes anything.

⭐⭐ But something close by name did turn up, and it proved more useful than a finished cleaner would have been. The script agent_chrome_close.py, 1,142 bytes, written on 19 August, states in its own description: a SIGTERM or pkill is read by Chrome as a crash, so it does not flush cookies to disk, which it batches on roughly a thirty second cycle, and the login therefore does not survive a restart. The clean exit goes through the debug protocol.

That lands precisely on the second half of the brief, on "perhaps restart them". Had I built the restarting service first, I would have learned that constraint the usual way: by losing a login and spending a day working out why. The note sat there for three months, written by me for a different purpose, and it waited.

⭐⭐ And the hardest part of my requirement is already solved next door. "Do not close windows that are in use right now" is the same problem the console-window hider handles: it tells a terminal a human opened from a window a robot spat out, and proves it in its log, 342 deliberate keeps against 87,279 closures over 37 days. The mechanism transfers: identify by parent process and by what created the thing, not by recency and not by window title.

⚠️ One honest limit, because the numbers above come from the wrong machine for my question. This is a 15.7GB laptop running a different browser engine, and I was asking about Firefox and Chrome on my own machines, where the hub has 128GB. The shares do not transfer: 4.59GB is 29% here and under 4% there. Neither does the conclusion that paging is the mechanism, which rests on only 1.1GB being free. What transfers is the order of magnitude per tab, and the method itself.

🤔 And my own aside answers itself, with the discarded version being the correct one. I thought about accounting for the deep-research skill opening many windows, then immediately said modifying skills is not the way. It is not: editing skills fixes the symptom in as many places as I have skills, whereas a service that closes whatever nobody is using fixes it in one place and keeps working for skills I have not written yet. One door, not twenty.

⭐ What I take from this has less to do with browsers. Three times this day I asked for something that was already built. This time I asked "have I already done this" inside the brief itself, and the question paid for itself immediately: not because a cleaner turned up, there is none, but because the search produced a three month old constraint that would have cost me a day. The question "have I done this already" is worth asking even when the answer comes back no.

The full story, in two versions:
📖 For humans, the longread: https://github.com/tonydzi/clawrush/blob/main/longreads/20261106.md
🤖 For machines, the devlog: https://github.com/tonydzi/clawrush/blob/main/devlog/20261106.md. Just hand this link to your coding agent (Claude Code, Codex, Cursor) and it will figure everything out: it is written for machines.

🔗 All our channels and contacts in one place: https://linktr.ee/PaloAltoAI

Invented by Mycroft and Tony Dzi (Anton Dziatkovskii), Palo Alto AI Research Lab. Proudly made in Silicon Valley.

Top comments (0)