<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Alexey Krylov</title><description>A personal blog of an engineer and architect. Agents in software development, architecture write-ups and infrastructure of my own. Twenty-odd years of backend and distributed systems behind it.</description><link>https://alexey-krylov.dev</link><language>en</language><item><title>My own panel on a mobile router: one Go binary and 128 MB of memory</title><link>https://alexey-krylov.dev/blog/own-panel-on-a-mobile-router</link><guid isPermaLink="true">https://alexey-krylov.dev/blog/own-panel-on-a-mobile-router</guid><description>What I managed to do with a pocket LTE router, the Huawei E5885. A dependency-free panel in Go, ad blocking, a connection map, operator SMS and counters that lied.</description><pubDate>Sun, 11 Oct 2026 00:00:00 GMT</pubDate><content:encoded>A pocket LTE router, the Huawei E5885, travels with me: in a hotel, an airport or a cafe it shares internet from a SIM card or from someone else&apos;s Wi-Fi. This summer, including a vacation in Turkey, I built my own control panel for it. The result is a mobile router for a developer: I can see who is connected and how much they downloaded, how much is left of the data plan and of the battery, ads are blocked on the router itself, and client connections are drawn on a map, like in Little Snitch.

The code was written by agents under my direction. What to build, what to leave stock and what to give up was my call, and those decisions are recorded in the project documentation.

![Panel overview: system, network, interfaces, clients and storage](/images/panel-na-mobilnom-routere/obzor-en.webp)

## What is inside the box

The firmware on the router is the original one, with root access, not OpenWrt. The CPU is a dual-core ARMv7, but Linux sees one core: the second is taken by the modem. The frequency is no higher than 666 MHz. Out of 256 MB of memory, Linux gets 128.

Writing for it is inconvenient:

- the system partitions are mounted read-only, and the only partition for my own files that is mounted right after boot has about 10 MB free out of 61.5;
- packages do not install: `opkg install` fails, and the package archive has to be unpacked by hand;
- there is no compiler on the router, and no cron either;
- busybox is built in a way that does not resolve names: `ping` by name answers `bad address`.

So the panel is built on a laptop for `GOARCH=arm` and goes to the router as a single file.

## One binary with no dependencies

The panel is built into a single static Go binary, and there is nothing in it besides the standard library. The pages are embedded with `go:embed`, there are no external scripts or fonts, and it opens the same way without internet. Inside are 56 Go files and 38 test files, 17,845 lines without tests. The binary weighs about 8.8 MB.

Port 80 on the router is taken by the stock Huawei panel. I do not disable it: Wi-Fi and modem settings are changed through its API. My panel listens on a separate port, and the settings have a switch that swaps them: mine answers on 80, the stock one moves to 3000. If my process stops, the redirect rules are removed, and port 80 serves the stock panel again.

In the first version those rules had no destination address, and my panel received all transit traffic of the clients to port 80, not only requests to the router itself.

A watchdog looks after the process, a shell loop that runs every 15 seconds. It brings the panel up if it has crashed, and removes the DNS interception if its resolver has stopped listening, otherwise the clients would be left without name resolution.

## The page before login

No password is needed to find out whether the router works. Before login there is a status page: whether there is internet, the operator and signal level, speed, what is left of the data plan and the battery, how many clients are connected.

![Status page before login: internet is up, remaining traffic and battery, number of clients](/images/panel-na-mobilnom-routere/status-en.webp)

The set of fields on it is hardcoded: no client list, no serial numbers, no versions. There is a test for this: one extra field in the response, and it fails. The state snapshot is built on request and kept for 8 seconds, so frequent page refreshes do not load the router.

## Ad blocking and memory

Ads are blocked at the DNS level: a domain from a list gets a &quot;does not exist&quot; answer, and the log shows which list blocked it.

The first version kept 164 thousand domains in a `map`, the process took up to 42 MB, and the system killed it every 35 seconds. A sorted slice of strings with binary search cured that.

Then the lists grew to five and the domains to 450 thousand. In a slice of strings that is 450 thousand objects, which the garbage collector walked on every cycle. The heap has a ceiling of 22 MB, and the collector ran without a break, taking 40% of the CPU at full idle. What helped was laying the domains end to end in one byte block with a numeric index and searching directly in it. The collector has nothing to walk there: the CPU is busy at 2-3%, and the process takes 25 MB instead of 29.6.

The CPU also went into launching external commands. At 666 MHz every busybox call from a Go process is expensive, and when there were fewer polls, the load dropped from 6.5 to 2.4%.

## The connection map

The &quot;Map&quot; tab shows where the clients go: outgoing connections are drawn on a world map and refreshed every three seconds. Traffic is split into 15 categories.

The map needs a GeoIP database, and it weighs 65 MB with 128 MB of memory for everything. The database sits on a microSD card, and my own parser of the format reads it through `mmap`, so it is never loaded into memory in full. The map costs the process about 5 MB.

## SMS and USSD

The operator sends service SMS, and gives the remaining data plan in response to a USSD request. The stock panel can do both, and I moved this into mine. It reads, sends and deletes messages and sends a notification about a new SMS to the phone. After a USSD request it closes the dialog whatever the outcome, otherwise the modem would stay stuck in it. Before sending an SMS the panel asks for confirmation: in roaming it costs money.

![The &quot;Messages&quot; tab: a USSD balance request, incoming operator SMS, the send form](/images/panel-na-mobilnom-routere/soobshcheniya-en.webp)

The stock panel is designed for a single user. The session is bound to the client address and lasts five minutes without activity, and the panel answers frequent logins with an error. Login to it goes through SCRAM, and Huawei has the key and the message in HMAC swapped relative to RFC 5802: an implementation that follows the standard is rejected with the correct password.

## Someone else&apos;s Wi-Fi with a portal

In a hotel the router works as a repeater: it connects to the hotel network and shares it further. Such a network first requires opening a login page, and the clients behind the router do not see that, they just have no internet.

For this case the panel has a &quot;portal&quot; mode. Every two minutes it makes a probe request and tells four cases apart: there is internet, the network requires login, there is no uplink, DNS is spoofed. If the network requires login, the panel shows a link to the page and temporarily sends the clients&apos; DNS queries to the resolver of that network, because only it knows the name of the login page.

![The &quot;Network login&quot; card: the network requires login, a link to the portal page and the probe results](/images/panel-na-mobilnom-routere/vhod-v-set-en.webp)

The mode is built and covered with tests, but I have not tried it in a real hotel.

The repeater itself would not connect to any network at first: the panel process lacked the paths to the system utilities, and the stock service was managing the same interface at the same time. It started working through the stock profile API. There it turned out that the `Order` field sets not the priority but the slot number, while the priority is determined by the order of the blocks in the request.

Switching between the mobile network and Wi-Fi drops the router&apos;s own access point for 10-30 seconds: the firmware rebuilds the radio interfaces. In that time the laptop moves to another known network and does not come back. I now test such things over a cable.

## Counters that lied

Client traffic was first counted by iptables rules. Under load the counter showed 27 KB while 26.6 MB went through the router: it has a hardware accelerator, and the packets bypass netfilter. Now the bytes come from the Wi-Fi driver.

The driver counter is not monotonic, and the first version credited a phone with 125 GB uploaded overnight. Counting by radio frames also overstates the volume: a client downloaded 131.5 MB, and the counter grew by 158.8.

The load at idle stayed around 20. Twenty modem threads constantly hang waiting for I/O and end up in the load average, so the panel subtracts those twenty. And the uptime in the firmware log showed 9583 hours over 125 power-ons: the field turned out to be in minutes.

## A test bench without the router

Editing the layout right on the router is expensive: an ARM build, an upload and a restart for one line of CSS. So the panel has a bench mode. It runs on a laptop and serves API responses from files. A synthetic set lives in the repository, and a snapshot of the live router with real addresses does not get into it. The screenshots in this article were taken on the bench.

The bench helped in another way too. There is one router, and git worktrees do not isolate it. One agent session started from a stale copy of the code, and each of its uploads wiped out the map tab on the router, which another session was building at the same time.

In two months, from July to the end of August, the project collected 91 commits. A pocket router turned into a router that shows what is going on inside it: who is connected, where they go and how much of the data plan is left.</content:encoded><category>infra</category><category>lab</category><category>linux</category><category>monitoring</category><category>networking</category><category>self-hosting</category></item><item><title>Two Home Assistants with nothing between them</title><link>https://alexey-krylov.dev/blog/two-home-assistants-with-nothing-between</link><guid isPermaLink="true">https://alexey-krylov.dev/blog/two-home-assistants-with-nothing-between</guid><description>The apartment and the country house each got their own Home Assistant with no bridge between them. How one vendor account is split into two homes, why the country house stood without devices for twenty-five days, and what layered diagnostics does about it.</description><pubDate>Sun, 11 Oct 2026 00:00:00 GMT</pubDate><content:encoded>I have smart devices in the apartment and in the country house, and the vendor accounts are shared, one for both homes. Each home has its own Home Assistant, and there is nothing between them: no MQTT bridge, no entity mirror, no shared database.

I set them up together with Claude. By then both homes were already described in a [registry](/blog/home-fleet-registry), the same way infrastructure is described in code. I built the smart home the way I am used to building systems: it is a direct consequence of my experience in IT, only with an agent as a pair.

## Why not one for two homes

The country house runs on its own power setup: the grid, an inverter, a generator. It needs to be controlled when something has gone wrong, and on such days the link to the apartment often goes down too. If the Home Assistant in the apartment controlled everything, the country house could not be controlled at the worst moment.

So the country house one runs on the country house server and must work without a link to the apartment, and the apartment one knows nothing about the country house. Two things connect them, and both work without either of them: a link tile to the panel of the neighboring home and an agent that has access to both.

As a bonus, I did not have to touch the firewall. The devices of each home talk to their own Home Assistant in their own network, and nothing has to be opened between the homes.

Both run in containers, each in the smart device segment of its home and under its own address. Devices find each other by broadcast, and broadcast does not cross segments. The configuration is done by scripts through the API, and the apartment has 33 scripts. After them the apartment has 429 entities and 24 automations, the country house 224 and 20.

## One account for two homes

Stock integrations pull in every device of the account and do not ask which home it is in. If nothing is done, one lamp will be toggled by two Home Assistants, and the question &quot;who turned off the light&quot; will have no answer.

Each vendor needed its own solution. From the Yandex smart home, the apartment one takes only devices whose name starts with the Russian word for &quot;apartment&quot;. Tuya has no filter, so each one disables the other home&apos;s devices on its own side. We worked out which device belongs where not by names: Tuya devices announce themselves in their network every few seconds, and it was enough to listen to both networks.

## Twenty-five days of a country house without devices

On October 3 the diagnostics showed 93 unavailable entities in the country house. They had been unavailable since September 8, since a routine restart of Home Assistant. The network, the broker, the containers and the vendor cloud were working, and there was not a single error in the log. There was nothing to notice it with earlier: I had no alerting for such a case.

In the eWeLink app devices are sorted into &quot;homes&quot;, and the integration has an option for which home to take. An empty option means &quot;the current home of the account&quot;. That time the current one was the apartment. The country house Home Assistant received four apartment devices and did not receive its own twenty-five.

The fix took a minute: I pinned the home in the options explicitly, and the devices came back. It is now pinned in both homes, and switching in the app does not affect anything.

## The router that stopped being polled

In the apartment, presence is tracked by the router integration. On September 3 the router failed to answer once, and right after that refused authorization once with the correct password. Home Assistant opened a reauthentication request and stopped polling the router altogether. The integration entry was listed as loaded, the entities were unavailable, and one line remained in the log. Nobody saw this for three weeks, for the same reason as in the country house. Then the same thing happened again after a single timeout, for six more days.

I did not find out why the router refused: it keeps its log in memory. Reloading the integration entry helps, and an automation now does that. Ten minutes without data from the router, and it reloads the entry; if that fails, it retries in half an hour.

The leak sensor is not cured by a reload. After a network failure it began accepting a connection and closing it without an answer, and the only thing that helps is cutting its power. The integration was writing about a thousand errors a week, which is 99% of the log, and I disabled it. The sensor shuts off the water on a leak by itself, without Home Assistant; only the voice and the notification do not work.

## Layered diagnostics

These failures have one thing in common: they are silent. There is no error, the entry is &quot;loaded&quot;, and the devices are gone. A &quot;Home Assistant responds&quot; check does not see that.

So in both homes you can ask &quot;what is going on with the house&quot;. The check goes layer by layer, from the house down to the hardware: the country house has nine of them, from the electrical system and heating to the server and Home Assistant itself, the apartment has eight. A layer answers with one of four words: normal, warning, failure or &quot;no data&quot;. &quot;No data&quot; counts the same as a failure: there is no source, so the layer is not checked.

After the router story the diagnostics got a line about integrations whose entities all disappeared at once. The count is by physical devices, not by entities.

The answer comes by voice, one line per layer, and the full report with numbers goes to a notification. It was the diagnostics that found the country house without devices.

## What Home Assistant does by itself

An event is caught by whoever sees it. The loss of power is detected by the [power monitor](/blog/power-monitor-for-a-country-house), and Home Assistant only voices what arrived [over the event bus](/blog/home-event-bus). It keeps its own thresholds only for appliances that nobody but it knows about.

In the country house that is load shedding. When the house switches to the inverter, Home Assistant turns off the water heater and both stages of the boiler: the battery cannot carry them. When the current at the mains input approaches the limit, it acts in steps:

| Input current | What happens |
|---|---|
| 40 A | announces the current and the margin before cutoff |
| 45 A | turns off the water heater |
| 48 A | turns off the heating cables |
| below 35 A for ten minutes | turns back on what was turned off |

The first threshold is a voice one: a person has a chance to turn off the kettle themselves. The input protection does not touch the boilers at any current: in winter they are the heating of the house.

In the apartment Home Assistant talks more than it acts. It talks about stuffy and dry air and switches nothing by itself. It does not interfere with the water shutoff at all.

## The agent asks for permission

The agent kept its access to both Home Assistants. At home I have my own DevOps engineer who is on call around the clock: an agent on a Mac mini.

In the country house there are rules on the mains input relay, the inverter line, the boilers, the water heater, the heating cables and the boiler room ventilation. A call goes into a queue and waits until I press &quot;approve&quot; or &quot;reject&quot;; if I stay silent for 120 seconds, the call is not executed. There are no rules on reads, otherwise I would have to approve even a look at the boiler state.

The tool that edits the rules themselves is disabled for the agent: it must not change the restrictions that are placed on itself.

Two things are still ahead. The first: for the agent to go through both homes once a week by itself, look for anomalies and propose solutions, instead of waiting for the question &quot;what is going on with the house&quot;. The second: the main thing, for the sake of which everything was split in two, I have not tested yet, namely how the country house works with the link to the apartment cut.</content:encoded><category>infra</category><category>lab</category><category>architecture</category><category>automation</category><category>diagnostics</category><category>self-hosting</category></item><item><title>An autonomous pipeline for Claude Code: from issue to merge</title><link>https://alexey-krylov.dev/blog/agent-factory-without-me</link><guid isPermaLink="true">https://alexey-krylov.dev/blog/agent-factory-without-me</guid><description>A queue of issues, headless sessions in separate worktrees, two gates and a merge into an integration branch. What came out of it and what had to be reworked.</description><pubDate>Fri, 09 Oct 2026 00:00:00 GMT</pubDate><content:encoded>In this post I want to describe a pipeline that takes a task from the tracker and carries it to a merged PR without my involvement. The need came up over the summer, when I was building a personal memory system: the task briefs were written, the architecture was accepted, and there was no time left for the code itself.

I really did not want to sit next to an agent and confirm every action, because that is the same work, only slower. I wanted to file a task and come back to the result.

At first the pipeline lived inside that project. Later it was split out into a separate engine (`git subtree split`, history preserved), and it now works with any repository.

## The idea

The queue is a set of issues in a tracker (mine is a self-hosted Forgejo) with the `factory` label (label and branch names here are placeholders). Each task is executed by a fresh headless Claude Code session in its own git worktree. The deliverable is a PR, followed by two gates and an automatic merge.

```text
issue (#N, label=factory, dependencies closed)
  → worktree, branch factory/issue-N
  → executor session: code, tests, commits, comments in the issue
  → push → PR &quot;closes #N&quot; → verify script (machine gate)
  → reviewer session: approve / request changes
  → fix loop (no more than 2 attempts in total across the gates)
  → merge (squash) into the integration branch → issue closed
```

The pipeline never writes to `main`. I make the final PR from the integration branch myself.

![The pipeline dashboard: finished tasks of the engine itself and the stages each one went through, from plan to merge](/images/fabrika-bez-menya/panel-steps-en.webp)

## What came out of it

The first production run was on 8 July 2026: six tasks went through the full cycle, 6 commits, 56 files, +5792/−100 lines. No tasks were left blocked by the end of the run.

Some notable things from that run:

- the reviewer caught real architectural drift. The executor wrote a core that imported concrete adapters, bypassing the accepted ADR on ports. The PR went back for rework, the fixer introduced the missing port, and the second review approved it;
- an agent filed a sub-issue on its own for a missing piece of environment, and the pipeline executed it in the normal order;
- both blockers were infrastructure ones and took minutes to clear.

## The factory in numbers

A single run proves little, so here are the counters from the factory&apos;s event log for 19 days, from 20 September to 9 October 2026. There are three projects, and one of them is the engine itself.

| Event | Count |
|---|---|
| Tasks merged | 243 |
| Review approved the work | 246 times |
| Review sent the work back for rework | 94 times |
| Machine gate failed | 14 times |
| Task went into a block | 36 times |
| Blocked as of today | 0 |

Two points are worth noting. The review sends work back in more than a quarter of cases, which means the gate is not a formality. Blocks happen regularly, and this is the normal mode of operation: the task waits for my decision instead of being done by guesswork.

## How it works inside

The engine&apos;s main properties as of today:

- the driver is an ordinary bash script that only routes. Everything that requires judgement happens inside the sessions;
- a task&apos;s stage is determined from facts (whether there are commits, a PR, a review) and is not stored separately. Because of that, restarting the driver continues the work instead of starting from scratch;
- when it hits a wall, the pipeline sets the `factory:blocked` label and writes in the issue what has to be done by hand. Only the owner can remove the label;
- if the tracker did not respond (HTTP 000, 5xx, garbage instead of JSON), the driver waits and retries instead of treating the queue as empty;
- sessions are stopped by the process group ID recorded at launch. `pkill claude` is not an option here, because I work with Claude Code by hand on the same machine;
- three interrupted runs in a row count as a crash loop, and the target is no longer brought up automatically.

## How to work with it

To submit a task, create an issue with the `factory` label. A supervisor (a LaunchAgent) walks the repositories once a minute and starts the driver if there is anything in the queue.

Freezing a target and bringing it back:

```bash
pause.sh  --target &lt;path&gt;          # active stages finish, new ones do not start
pause.sh  --target &lt;path&gt; --now    # sessions are interrupted immediately
resume.sh --target &lt;path&gt;          # interrupted sessions continue by their session_id
```

Restarting a single phase of a task:

```bash
rerun.sh --target &lt;path&gt; --issue &lt;N&gt; --stage &lt;executing|verify|review|ci|merge&gt;
```

## The plan gate

For tasks where a misunderstanding is expensive there is the `factory:gate-plan` label. With it the pipeline first writes a plan and waits for `/approve` without occupying an execution slot.

The plan is published as a comment in the issue, in two views:

```text
&lt;!-- autopilot:plan v=3 base=2 --&gt;
## What changed in response to the comments on v2
- [n1] addressed: the gate is moved before the transaction is opened
- [n2] rejected: no cache is needed, the reference table is read once per request

&lt;!-- autopilot:view=product --&gt;
…the translator&apos;s retelling…

&lt;!-- autopilot:view=arch --&gt;
…the planner&apos;s architectural plan…
```

The architectural view is written by `planner`, which sees the brief. The product view is written by `plan-translator`, which sees only the text of the architectural plan. I compare the retelling with my intent: if they diverge, the plan does not express the intent.

It is worth noting how the translator&apos;s &quot;blindness&quot; is implemented. An instruction in the prompt is not enough here, so its session is started with `--strict-mcp-config` and no MCP servers at all, with its working directory in an empty temporary folder. It simply has nothing to read the issue with.

The gate has no state in `state.json`: the driver computes everything it needs from the issue comments.

## Taking over an agent&apos;s session

Sometimes an agent gets stuck, and it is easier to finish the task myself without losing its context. For that the editor extension has a five-step scenario:

1. the target is paused;
2. the `factory/issue-N` branch is fetched into a local worktree;
3. the agent&apos;s session file is downloaded to the place where Claude Code looks for the sessions of that directory;
4. I continue the same conversation in the editor;
5. the &quot;Return the task to the factory&quot; button pushes my commits and restarts the verify phase.

To make the fifth step safe, the driver catches up with the branch on origin before it starts working (`merge --ff-only`). If my commits and the agent&apos;s commits have diverged, the task goes into a block with the reason stated.

## Problems along the way

- a tracker read error was taken for an empty queue, and this was fixed in a separate task;
- when a phase was restarted on a blocked task, the pipeline would have unblocked itself, so the label is now removed only by the owner;
- the model subscription window is shared across all projects. For that reason there is a single driver for the whole factory, and each project has a daily task cap and a brake.

## Downsides

- the result is no better than the brief. A task without a verifiable definition of done passes the gates only formally;
- the reviewer catches deviations only from decisions that have been written down;
- a noticeable amount of tooling has grown around the engine: a dashboard, an editor extension, Telegram notifications. The extension package has 930 tests, but I still have not walked through some of the features by hand in a live window.

The right use case is tasks with a clear boundary in a project where the architectural decisions are already written down. The pipeline is not suited to searching for the decision itself.

The engine&apos;s repository lives in my home git for now. Once I publish it, I will add a link here.</content:encoded><category>agents</category><category>lab</category><category>agents</category><category>automation</category><category>claude-code</category><category>git</category></item><item><title>A console for the agent factory: a menu bar item and an editor extension</title><link>https://alexey-krylov.dev/blog/agent-factory-console</link><guid isPermaLink="true">https://alexey-krylov.dev/blog/agent-factory-console</guid><description>How to watch an agent pipeline without opening the tracker. What the menu bar shows, what moved into the editor and why neither of them stores anything.</description><pubDate>Thu, 08 Oct 2026 00:00:00 GMT</pubDate><content:encoded>[The pipeline that carries a task from issue to merge](/blog/agent-factory-without-me) works without me, but I still have to watch it: tasks wait for plan approval, get blocked, leave manual steps behind. The tracker shows only the current label of a task, and I need the whole picture: what is waiting on me, what the agents are doing right now and where the pipeline is stuck.

Two tools grew out of this need: a bar in the macOS menu bar and an editor extension. The code lives in the factory repository, and for now it is a home project.

## Why neither of them stores anything

They know nothing and store nothing themselves, they take everything from the factory backend. The state of a task is computed from facts in the tracker, and there must be no second copy of it, otherwise one day it will diverge from the first. Groups, tags and task order are also shared between the bar and the extension: a task marked in one looks the same in the other.

So both are tied to a single factory and are useless without its backend. A console like this is needed when the pipeline already exists and has to be watched every day; setting up a separate backend for its sake is not worth it.

## The bar in the menu bar

The bar title has two numbers: how many tasks are in progress and how many are waiting on me. It turns red only in the second case. The menu is split by urgency, not by project:

```text
🤖 2/4
├── Waiting on you (4)      plan awaiting approval, blocker, task from an agent
├── Do by hand (2)          PR merged, a manual step is left
├── In progress (2)         what the agent is doing this minute
├── Recently closed (4)
└── Outside the queue (2)   tracker tasks that were not handed to the factory
```

Each task shows the whole chain of phases with the time spent in each one, not only the current label. A task that has been waiting on me for more than a day turns red.

The state is shown by an icon at the start of the row, and it is an emoji: system symbols in a dropdown menu are drawn in one colour, their colour is ignored.

## The editor extension

The bar is good for noticing, but to figure things out I had to open a browser. So everything that requires reading moved into the editor: the ticket, the plan and the PR changes open in tabs.

![The factory panel in the browser: backlog, queue and finished tasks, with a task waiting for a decision at the top](/images/pult-fabriki-agentov/panel-doska-en.webp)

The task list is split into the same sections as in the bar. A task row is no taller than five lines, and in the compact view about two and a half times more tasks fit on the screen. The row carries the PR number, coloured by build state, and a counter of review returns: how many times the agent redid the work.

The work usually goes like this. The bar shows that there are tasks waiting on me. I open the plan in the editor and write remarks right on its lines, then there are two buttons: &quot;approve&quot; and &quot;rework from notes&quot;. A blocked task shows the PR changes and the reason for the block, and a button removes the block. The queue order is changed by dragging rows. By default a double click opens a row, a single click only selects it.

While the agent is working, the editor shows its live log: text, tool calls, errors. The files it is editing right now are marked, and if I get into such a file, the extension warns me. A task can be created from code: a selection or a marked comment turns into a brief with a link to the lines. I can take over an agent session: continue its dialogue myself and then return the task to the factory.

The console is there too: a daily cap of tasks per project, pause, stop and the state of the model subscription window.

## What doesn&apos;t work and what isn&apos;t verified

The editor did not see the factory, although the browser opened it. It turned out that on macOS the editor must have a separate permission for local network access. Now the extension suggests this itself when it sees such an error. Dragging a task into the chat with an agent may not get through in new versions of the editor; next to it there is a menu item that does the same thing.

A notification arrives once, in the window of the project the task belongs to. If the project is not open in any editor window, it will not arrive anywhere.

There are many tests (930 for the extension and 742 for the bar), but I never went through some of the features by hand in a live window. Tests and a sandbox do not replace that.

Two things are enough for every day: the bar shows that a task is waiting for me, and I read and reply in the editor. I do not have to open the tracker for that.</content:encoded><category>agents</category><category>lab</category><category>agents</category><category>automation</category><category>claude-code</category><category>macos</category></item><item><title>From a script for myself to a product: five months of claude-agents-bar</title><link>https://alexey-krylov.dev/blog/from-script-to-product</link><guid isPermaLink="true">https://alexey-krylov.dev/blog/from-script-to-product</guid><description>What I had to add to a working script so that a stranger could install it. An installer, diagnostics, 21 recorded decisions and 16 releases.</description><pubDate>Tue, 06 Oct 2026 00:00:00 GMT</pubDate><content:encoded>The first version of `claude-agents-bar` was a single file: a menu bar icon that shows the state of Claude Code sessions (I already [wrote](/blog/claude-agents-bar) about it). When I decided to publish it, it turned out that the gap between &quot;works for me&quot; and &quot;anyone can install it&quot; holds noticeably more work than the script itself.

## What the project has now

In five months, from May to October 2026, there were 16 releases. As of today the project has:

- a one-command install through Homebrew and a manual path for those who don&apos;t have it;
- the `setup`, `teardown` and `doctor` commands;
- 21 recorded architecture decisions;
- 696 tests;
- 8 interface languages;
- a [project page](https://alexey-krylov.github.io/ClaudeAgentsBar/) with screenshots and a live example of the menu;
- documentation on configuration and on troubleshooting.

![The project page: the heading, the install command and a live example of the menu](/images/ot-skripta-do-produkta/stranica-proekta.webp)

The script that solved my own problem was short of a product by an installer, diagnostics and recorded decisions. The rest can be added as requests come in.

## An installer that doesn&apos;t break other people&apos;s setup

The tool plugs into the Claude Code settings, and a person already has their own hooks there. A naive install would overwrite them, so the installer appends its entries to the existing ones, but first saves a timestamped backup. Running the install again is safe, and `teardown` removes what it added.

For me this is the main requirement for an install: assume a machine that already has someone else&apos;s settings on it.

## Diagnostics instead of correspondence

The first thing that happens after publishing: it doesn&apos;t work for someone, and they don&apos;t know why. There are many possibilities: a required utility is missing, the Python is the wrong one, the hook isn&apos;t registered, the state file isn&apos;t being updated. The `doctor` command checks all of this itself and says what is missing.

## Decisions worth recording

There are 21 recorded architecture decisions. One of them: a plugin for an existing application instead of a program of my own. I run the project alone, and rebuilding and signing an application on every change would eat time I don&apos;t have anyway.

Another: locking the state file by creating a directory. The usual locking utility isn&apos;t installed on a clean macOS, and the file has three writers: the session hook, the subagent hook and the plugin itself.

The third is about links when installing through Homebrew. At first they pointed into the directory of a specific version, and that directory disappears on upgrade. I fixed this in June with a separate decision.

I record them so that a couple of months later I can see why it was done this way and which options have already been rejected.

## Small improvements

Some of the improvements don&apos;t look serious, but they came out of daily use:

- a compact mode for laptops where the icon hides behind the screen notch;
- custom sounds and quiet hours for notifications;
- a repeated notification if a session is waiting for permission and nobody has answered it (the interval doubles: 10, 30, 70, 150 minutes);
- a warning when the session context is more than 80% full.

## Weak spots

- the plugin will need maintenance: every Claude Code update can change something in the format of the files it relies on;
- I can&apos;t check all the translations into eight languages myself;
- there are many tests, but they check the logic, not how the menu looks on a particular screen;
- I don&apos;t know how many people use it.

It turned out the way it looked at the start: the installer, the diagnostics and the written-down decisions took more work than the menu bar icon itself.</content:encoded><category>agents</category><category>lab</category><category>agents</category><category>claude-code</category><category>product</category><category>tooling</category></item><item><title>A gateway for local models: device tokens instead of ssh tunnels</title><link>https://alexey-krylov.dev/blog/gateway-for-local-models</link><guid isPermaLink="true">https://alexey-krylov.dev/blog/gateway-for-local-models</guid><description>An OpenAI-compatible gateway in front of mlx_lm and Ollama on a Mac mini - a token per device, a round-robin queue and the right to switch models.</description><pubDate>Sun, 04 Oct 2026 00:00:00 GMT</pubDate><content:encoded>My local language models run on a Mac mini with 48 GB of memory: a large one for the home bot (the `mlx_lm` server) and `bge-m3` for semantic search (Ollama). Model servers can&apos;t check who is calling them, so they listen only on localhost.

Before, two clients reached them, both through ssh tunnels: the bot from a Raspberry Pi and the editor extension from a laptop. For two machines with an ssh key this works, but for a phone or a third-party app this path is closed.

## One service in front of the model servers

Now a small gateway stands in front of the model servers: one service that listens on the network, checks the device token and runs a queue.

```text
phone, laptop, bot  ──►  one name on the network  ──►  gateway  ──►  mlx_lm (bot model)
(each has its token)             (Caddy)                         └──►  Ollama (bge-m3)
```

To the outside the gateway exposes an OpenAI-compatible API at `/v1`: for almost any app it is enough to set the address and the key. The code lives in a home repository for now.

## What the gateway can do

- chat with streaming, text completion, embeddings, a list of models;
- a token per device: the database holds only a fingerprint, the token can&apos;t be recovered from the database;
- adding a device with a QR code: the token, the connection link and the QR are shown once;
- revoking and reissuing a token;
- device rights: which models are visible, how many requests at once, whether it may switch the model on the server;
- a round-robin queue: one request at a time goes to a model, devices are served in turn;
- per-device accounting: when it called, how many requests and tokens;
- the gateway does not store the texts of requests and responses and does not write them to the log.

## Adding a device

A device is added in the admin panel or from a terminal on the node itself:

```bash
npm run device:create -- --name &lt;name&gt; [--allow-model-switch] [--model &lt;model&gt;]... [--max-parallel &lt;number&gt;]
```

By default a device sees all models, can&apos;t switch them and holds up to 4 parallel requests. The command prints the connection link, and the token is shown once.

On the client side you set the `API base URL` (the gateway address with the `/v1` path) and the `API key`. Whether the gateway is working is visible at `/healthz`. The client gets 401 if the token is revoked or wrong, and 403 if the device is not allowed the model or the model switch.

## The &quot;model switch&quot; right

A model server keeps one large model in memory. If a device asks for another one, the server unloads the bot model and loads the requested one, which takes about 40 seconds. The bot&apos;s next request brings its model back, another 20 seconds or so, and the bot is silent all that time.

Two large models don&apos;t fit into 48 GB at the same time. The day before the rollout I tried keeping a second one alongside: GPU memory ran out, and the bot model went down for 20 minutes.

So the right is off by default. A device without it sees only the bot model and does not get in the bot&apos;s way. The right is given only where another model is really needed, and the bot itself does not need it.

## What was verified at rollout

I tested with a separate device, which I then revoked:

| Check | Result |
|---|---|
| A short request to the bot model | response in 0.5 s |
| Streaming | first chunk after ~150 ms |
| `bge-m3` embeddings | a vector of length 1024 |
| A request for another model without the switch right | 403, the bot model is not unloaded |
| A request after the token is revoked | 401 |
| Gateway log | no tokens and no request texts |

## What is not finished

There is no backup of the database, and it is postponed deliberately. Losing `gateway.sqlite` means that all devices will have to be issued again.

The &quot;Backends&quot; page judges a server by its list of models and can show &quot;available&quot; when generation does not actually work. Then I have to look at the log of the model server itself. This is a defect.

Old clients still go through tunnels past the gateway, and their requests do not get into the queue.

For a single laptop a tunnel is simpler. The gateway is needed when there are more than two clients or one of them has no ssh.</content:encoded><category>agents</category><category>lab</category><category>architecture</category><category>local-models</category><category>self-hosting</category></item><item><title>Eidos: a family bot that answers only with what has been verified</title><link>https://alexey-krylov.dev/blog/family-bot-eidos</link><guid isPermaLink="true">https://alexey-krylov.dev/blog/family-bot-eidos</guid><description>Three kinds of questions with different levels of trust in the answer, knowledge from a shared wiki instead of a search over everything, and why actions in the physical world are designed but switched off.</description><pubDate>Sat, 26 Sep 2026 00:00:00 GMT</pubDate><content:encoded>Eidos is a family bot in Telegram. People in the household ask it whose birthday is when, or what is going on with the power at the country house, and it answers from documents in the home wiki and from monitor readings.

A bot for the family is not a new idea. But an ordinary chatbot built on a language model happily answers everything, including what it does not know, and for the question &quot;how do I start the generator&quot; that is not acceptable. In that case Eidos says &quot;no verified answer&quot;.

## Knowledge, observation, action

Questions to the bot fall into three kinds. They differ in where the answer comes from, how the bot refuses and what a mistake costs:

| | Knowledge | Observation | Action |
|---|---|---|---|
| Example | &quot;whose birthday is when&quot; | &quot;what is going on with the internet at the country house&quot; | &quot;reboot the router&quot; |
| Source | documents that were shared with the bot | monitors and hardware, right now | the same, but with consequences |
| Form of refusal | &quot;no verified answer&quot; | &quot;could not check&quot; | &quot;not allowed&quot; |
| Cost of a mistake | said too much | misled someone | did something in the physical world |

The three kinds also have different permissions, so they must not be mixed. The bot determines which kind a question belongs to before it starts answering.

## Where the knowledge comes from

The bot itself collects nothing. The documents live in the home wiki, the bot has its own account there, and it sees exactly the documents that were shared with it. What the bot knows is decided by permissions in the wiki, not by the bot&apos;s code: to teach it something new, I only need to write a document and press &quot;share&quot;.

The bot is deliberately not connected to my personal memory system with its archive of everything: a compromised family bot must not be able to reach its data, its code or its secrets.

## What the bot can do now

The bot has been running since the end of September 2026, and this is what it can do:

- answer from documents. The code checks the numbers and dates in the answer against the text that was found, and birthdays are served without the model at all;
- report on the power at the country house to the family group on its own, and answer a question about it. The events come from the electricity monitor I wrote about earlier;
- remind about birthdays in the morning;
- pull new documents from the wiki once a minute;
- switch to free chat on a separate command. There the bot answers from the model&apos;s general knowledge and remembers nothing.

The bot selects power events by event key, not by text. I edit the notification texts in the monitor&apos;s panel, and selection by words would break on the very first edit.

## The model: from a Raspberry Pi to a Mac mini

The bot runs on a Raspberry Pi 4, and at first I tried to run the model right on it. The system prompt of the agent platform takes 22,088 tokens, processing ran at 7.5 tokens per second, generation at 3.8, and one answer took about 16 minutes. With a short prompt the same model answered in 4 seconds, so the whole path from the messenger to the model worked, and the limit was the memory bandwidth of the board itself.

The model moved to a Mac mini, while the bot itself, its schedules and its wiki access stayed on the Raspberry Pi. The bot and the model ended up on different machines, and after a network drop the connection between them did not recover. I had to separately configure fast reset of dead connections.

Through an external model, the question &quot;what is going on with the internet at the country house&quot; gets an answer only when there is internet. That is one of the arguments for having my own model on the home network.

## Actions are switched off

No tool with a side effect is connected to the bot yet, but this part is being designed in advance: if the bot can say that the internet is down, the next thing the family says will be &quot;well, reboot it&quot;. Who can call what, and with what confirmation, has to be decided on paper, not under the pressure of such a request.

## What the bot cannot do

- the bot answers more narrowly than people expect from it. &quot;No verified answer&quot; sounds worse than a confident fabrication, and that takes getting used to;
- knowledge depends on whether the document has been written. What is not in the wiki, the bot does not know;
- of observation, only one scenario works so far, the power at the country house. The rest is on the drawing board;
- everything rests on the home machine with the model. If it is off, the bot does not answer.

A bot like this suits a small group of people and knowledge that someone is personally responsible for. It is not suitable for an open chat with arbitrary questions.</content:encoded><category>agents</category><category>lab</category><category>agents</category><category>architecture</category><category>local-models</category><category>self-hosting</category></item><item><title>A home event bus: why have one when notifications already exist</title><link>https://alexey-krylov.dev/blog/home-event-bus</link><guid isPermaLink="true">https://alexey-krylov.dev/blog/home-event-bus</guid><description>One stream of events for the phone, voice and the bot. Why an event describes a fact, not a text, and how the broker died for twelve days unnoticed.</description><pubDate>Tue, 22 Sep 2026 00:00:00 GMT</pubDate><content:encoded>The power monitor at the country house, which I have already written about, sends notifications to the phone, and for a long time that was enough.

Then I wanted more: for the house to announce a power outage by voice, for the family bot to write about it in the shared chat, and for the home automation to be able to react to it. Every new recipient required a separate integration with every source, and so the house got a shared event bus.

## An event describes a fact

A source publishes an event once, and recipients subscribe to what they need. The transport is an ordinary MQTT broker.

More important than the broker was the decision about what counts as an event. An event describes a fact: what happened, to what, and how urgent it is. The wording for a human is produced by the recipient.

Simplified, an event looks like this:

```json
{&quot;key&quot;: &quot;msg_on_inverter&quot;, &quot;priority&quot;: &quot;high&quot;}
```

I did not arrive at this form right away. At first the router sent Russian text, and it arrived as spaces: the router loses Cyrillic. Now the router sends only machine fields, and the recipient assembles the text. In substance this turned out to be more correct than the original version.

## Who publishes and who listens

Two publish right now: the power monitor and the router. The monitor has 25 kinds of events and a separate topic with the current state, which the broker retains for new subscribers. The router sends events about the state of the communication links.

The home automation listens, and it has a single point of voice output. The priority is set by the source, the automation only routes:

| Priority | What happens |
|---|---|
| urgent | by voice, loudly, twice, even during quiet hours |
| high | by voice once, silent at night |
| the rest | not spoken by voice |

The decision &quot;whether to wake the house&quot; is made by the one who knows the substance of the event, not by the one who speaks it.

## Why the old notifications stayed

It would seem that once there is a broker, a separate service for phone notifications is not needed. But these channels fail in different ways.

In a long power outage the server with the broker will shut down when the battery is drained, while the monitor runs on the router with its own UPS and keeps running. The notification channel has a queue of undelivered messages, the bus does not. On the other hand, the broker is local and survives a break in the link between the home and the country house, and the notification service does not. The channels complement each other, and I did not remove either one.

For the same reason the detection itself stayed in the monitor. It was tempting to move it into the home automation, but that gets updated, restarted and dies together with the house.

## My own client and a place for the broker

The power monitor has a &quot;zero external dependencies&quot; principle, so a ready-made library did not fit. One-way publishing is done by a small module on the standard library.

There turned out to be exactly one place for the broker in the network. Both the monitor from the trusted segment and the automation from the untrusted one have to reach it, and the router does not let traffic through in the opposite direction.

## Twelve days of silence

At the beginning of September the owner of the broker&apos;s files changed. The password file became unreadable for the broker, but the broker kept working on the already open file until it was restarted.

After the restart it went into a crash loop, and two days later it stopped completely. This was found twelve days later: the router&apos;s log was packed with messages about an unreachable broker. Nobody was watching the broker, and its absence did not show itself in any way.

Since then the broker runs as the user who owns its files, and monitoring got a check of the broker itself. I never found out who changed the owner of the files: in time it coincided with work on quotas on the server.

## Downsides

- the broker became one more component that has to be watched;
- there is no queue of undelivered messages. A recipient that was switched off will miss the event, only the current state will remain;
- events are not encrypted, the bus is designed for a home network;
- the list of event kinds lives in the source&apos;s code. A new recipient has to look into it.

While there is one recipient, the phone, ordinary notifications are enough. The bus became necessary when voice and the bot were added to the phone.</content:encoded><category>infra</category><category>lab</category><category>architecture</category><category>events</category><category>monitoring</category><category>self-hosting</category></item><item><title>A registry of the home fleet: what goes down together with this service</title><link>https://alexey-krylov.dev/blog/home-fleet-registry</link><guid isPermaLink="true">https://alexey-krylov.dev/blog/home-fleet-registry</guid><description>121 documentation files described every node, but the dependency graph was not assembled anywhere. How a machine-readable registry appeared, and the three checks that keep it from lying.</description><pubDate>Sun, 30 Aug 2026 00:00:00 GMT</pubDate><content:encoded>By the end of the summer I had accumulated 121 documentation files for the home and the country house. Every node was described in detail: what runs on it, what pitfalls there were, how to fix it.

But this documentation answered simple questions only by rereading:

- what goes down together with this service;
- which ports are already taken on this node;
- where this tool is deployed and under what name.

That is how the registry appeared, which answers such questions right away.

## Structure apart from prose

The registry takes the structure of the setup out of the prose: sites, nodes, services, ports, names, dependencies, hardware. History and repair procedures stay in the prose.

I took the model from the data center world, where equipment inventory has long been a solved problem:

```text
registry/
  sites/&lt;site&gt;/nodes/         nodes: we run things on them and manage them ourselves
  sites/&lt;site&gt;/devices/       devices: on the network, but not managed by us
  sites/&lt;site&gt;/power/         utility hardware without a network
  networks.yaml               segments and names
```

Only nodes have services. A TV or a vacuum cleaner has, instead of services, what it is controlled by, and a distribution board or a generator has what it consists of.

The main rule: one fact is written in one place. Structure in the registry, prose in the documentation.

## What is generated from the registry

From the registry I generate a &quot;what lives where&quot; summary, a dependency diagram with a &quot;what goes down together&quot; table, and a single page with search across the whole fleet.

The page opens with a double click and works without a network: it is needed most often when something is already down. Typing a port, a name or a piece of a title is enough. A click on a service shows what it depends on and what will fall together with it.

## Three checks

A registry filled in by hand drifts away from reality over time. So three checks hold it in place:

| Check | What is compared with what | When |
|---|---|---|
| first | the registry and the configuration repositories | automatically, before every commit |
| second | the registry and what is actually running on the nodes | by hand, periodically |
| third | the service tables in the node documentation | generated from the registry |

The first check does not let me commit a new service or name that is missing from the registry, so the registry is updated in the same change, not &quot;later&quot;.

The second one is safe by design. It reaches the nodes through a proxy on which all modifying requests are forbidden: it is physically unable to start or stop anything.

## What the first run found

The very first run of the second check found five containers on the home server that were not in any documentation file, this blog among them.

This is what it was all done for: the documentation and the live nodes drift apart silently. A container is started, it works, and nobody remembers it until the first incident.

## Where the registry is incomplete

The routers did not make it into the live check: containers on them are visible over a different protocol, and for now I compare the list by hand. Some of the services that were found are still without a description. They are in the table, but what they are and what they are for is not written anywhere.

Names turned up that lead nowhere: there is an entry in the documentation, but no such name on the network, and the other way round. Household devices had to be entered in groups based on the router&apos;s records, and for some of them I do not know the exact models.

## What the registry costs

- it is one more repository that has to be maintained;
- the first check gets in the way. Quickly fixing something and committing no longer works, the registry comes first;
- the second check is run by hand, and so it is easy to forget about;
- the registry describes structure, not state. It does not know whether a service is alive, monitoring is there for that.

Keeping a registry makes sense when there are many nodes and they are on different sites: then it quickly answers the question &quot;what goes down together with this&quot;. For a single server one file is enough.</content:encoded><category>infra</category><category>lab</category><category>architecture</category><category>automation</category><category>documentation</category><category>self-hosting</category></item><item><title>A power monitor for a country house: grid, inverter, generator</title><link>https://alexey-krylov.dev/blog/power-monitor-for-a-country-house</link><guid isPermaLink="true">https://alexey-krylov.dev/blog/power-monitor-for-a-country-house</guid><description>How to find out that the house has lost power, what it is running on right now and how long the battery will last, when half of the sensors go dark together with the house.</description><pubDate>Sat, 22 Aug 2026 00:00:00 GMT</pubDate><content:encoded>The power at my country house goes out from time to time. The house then switches to the inverter, and when the battery runs down, I have to start the generator. I needed to know that the power is out, what the house is running on right now and how much longer the battery will hold. A power monitor now keeps track of that.

![Dashboard overview: grid state, main feed load, yearly totals and a map of outages by day](/images/monitor-sveta-na-dache/obzor-god-en.webp)

## A relay on the main feed instead of a sensor

The catch is that the sensor that should report a grid failure is itself powered from that grid. That became the signal: there is a smart relay in the distribution board, powered from the incoming line, and the monitor simply checks whether it responds. If the relay does not respond, there is no power on the main feed. The monitor itself runs on the router, which has its own UPS, so it survives the outage and sees it.

At first I could not read measurements from the relay: its local protocol is encrypted with a key from the vendor&apos;s cloud. Outage tracking did not need that anyway, reachability was enough.

## Three sources without a single sensor on the generator

Nothing monitors my generator, but I still managed to detect when it is running. What helped was an access point that is powered from a wall socket, not from the UPS.

| Grid | Inverter | Access point | Source |
|---|---|---|---|
| up | does not matter | does not matter | normal |
| down | responds | does not matter | on inverter |
| down | silent | responds | on generator |
| down | silent | silent | blackout |

A notification goes out on every transition, and when the grid comes back a summary arrives: how long the house stayed on each source.

## What the monitor has grown

The monitor caught its first real outage on the day of the rollout, July 24, 2026. After that it gradually grew features. An outage log appeared with a timeline of phases: when the grid went down, when we moved to the generator, when everything came back. The monitor accumulates generator engine hours and reminds me about the oil change when fewer than 30 hours are left before it, and for every outage it estimates the fuel burned.

![Outage card: time on the inverter, on the generator and without power, fuel consumption, a power chart and a timeline of sources](/images/monitor-sveta-na-dache/kartochka-otklyucheniya-en.webp)

To see real volts, amps and kilowatt-hours, I had to reflash the inverter relay and put a meter with open firmware on the main feed. The forecast of how long the battery will last and the main feed protection both rest on these measurements.

## How long the battery will last

Battery capacity cannot be described by a single number: by my measurements it delivers 2.63 kWh at a 600 W load and only 2.27 kWh at 1150 W. So the forecast is calculated for the current load. The monitor takes all &quot;from full charge to cutoff&quot; sessions, builds a dependency from them and gets roughly this picture:

- 500 W: 5.3 hours;
- 1 kW: 2.3 hours;
- 3.5 kW: 38 minutes.

![Dashboard block with the forecast: how long the battery will last at different loads](/images/monitor-sveta-na-dache/prognoz-batarei-en.webp)

It is also a measurement of battery health: degradation shows up in the trend of these sessions.

## Main feed protection

The house hangs on a 50 A main breaker. If it trips, that means a request to the grid company and a house without power until the crew arrives. So my meter on the main feed breaks the circuit earlier, at 53 A, and then restoring power becomes a button in the dashboard.

![Main feed load in the dashboard: present current, share of the breaker rating and the cutoff threshold](/images/monitor-sveta-na-dache/nagruzka-vvoda-en.webp)

The threshold is set by current, not by power: the breaker trips on current, while the voltage on the main feed drifts from 202 to 243 V, and a threshold in watts is off by ten percent. It is set above the breaker rating on purpose. The thermal release holds 56.5 A for an hour and longer, so the breaker will not notice 53 A, and the pump&apos;s inrush currents will not cut the main feed.

The cutoff is done by the meter, not by the monitor. It survives a crash of the container, the router and Wi-Fi. There is no automatic restore: with the load still connected it would produce a cycle of switching on and off. A cutoff must not end up in the outage log. Its numbers are needed for reconciliation with the supplier, so cutoffs are recorded separately.

## The monitor&apos;s mistakes and one mistake by the agent

Devices on the country house Wi-Fi silently disappear for minutes while still powered. A failure is now accepted only after three failed probes one minute apart, while a return is recorded quickly: a false &quot;the power is back&quot; is harmless.

Because of the same Wi-Fi, an outage could start straight from the generator. The relay is silent, the inverter is silent, the access point is alive: formally that is &quot;on generator&quot;. In reality the generator is started by hand a couple of hours later, and the radio took down two devices at once. Such a start now waits 10 minutes.

The first version had a check based on the server&apos;s network cable, and it lied: the inverter powers the whole house together with the switch, so the cable always showed &quot;power is present&quot;. I had to cut it out.

Capacity was calculated in two places, and one of the functions did not discard junk measurements: a one-minute session of 0.02 kWh got into the calculation, and &quot;0 minutes left&quot; went out in a notification with a live battery. The voltage sag threshold was hardcoded as 198 V, and the monitor missed real sags down to 202 V.

After a trial trip of the cutoff the meter disappeared from the network. The agent concluded that the meter is powered downstream of its own relay and that the cutoff is pointless, cancelled the task and wrote that into the documentation. I objected: since the meter could be switched back on, that theory is wrong. The check took one command: the meter&apos;s uptime had not reset, power had not been lost, and it had disappeared because of Wi-Fi. The cutoff was enabled the same day.

## What the monitor does not see

There is no perfect detection by reachability: the log has a &quot;false alarm&quot; button, and it is needed. If the meter goes silent because of Wi-Fi, the monitor will see the same thing as with a grid failure. There is no measuring device on the generator phase, and the voltage in the house during that time is unknown.

A monitor like this is for a house with backup power, where it matters to know the source and the remaining charge, not only the fact of an outage. How its events spread across the house, to the phone, to voice and to the family bot, I will describe in the next article.</content:encoded><category>infra</category><category>lab</category><category>diagnostics</category><category>monitoring</category><category>power</category><category>self-hosting</category></item><item><title>Where a network anomaly detector should live</title><link>https://alexey-krylov.dev/blog/where-the-anomaly-detector-belongs</link><guid isPermaLink="true">https://alexey-krylov.dev/blog/where-the-anomaly-detector-belongs</guid><description>A script on the router or logic in a flow collector that is already running - how the plan shrank by half and what a run over the history showed.</description><pubDate>Sat, 22 Aug 2026 00:00:00 GMT</pubDate><content:encoded>After the story with the set-top box that held 5051 connections, I needed alerts about anomalous device behaviour in my home network. The first plan for the detector turned out to be twice as complex as it needed to be.

## A plan built around a RouterOS script

The task in the tracker carried a requirement: the detector is written as a RouterOS script. The argument sounded convincing: the detector should run inside the thing being watched, not inside the watcher.

The agent accepted this requirement and built a plan around it:

- a new firewall rule;
- a script of about 300 lines that parses conntrack on its own;
- state between runs kept in the comments of address-list entries;
- a day of dry run to calibrate the thresholds.

The plan would have worked, but it redid something I already had.

## A flow collector instead of a script

By that time both sites had a flow collector running. It keeps a permanent session with the router over the binary API, refreshes the &quot;who talks to whom&quot; map every 10 seconds, and stores the history in SQLite.

I asked the agent what would happen if we gave this to the collector. Parsing conntrack with a script would have been a second, worse copy of the same work, and it would have loaded the router exactly at the moment of an incident. I gave the detectors to the collector.

## What moving it to the collector gave me

The plan shrank by about half, but the savings were not the main result:

- the thresholds are picked from history. The collector had 48 hours of flows, and I ran the same detector code over them in `-backtest` mode. I could see what would have fired and on whom before turning anything on;
- the alert text now has the country, the ASN and the domain of the target. A script on the router would not have had this data at all;
- no changes to the production firewall were needed at all. Rollout is `docker compose`, rollback is the previous image;
- one of the planned detectors turned out to be pointless. On the history, the &quot;wide scan&quot; could not tell scanning from an ordinary P2P client, and the threshold from the task could not be reproduced.

I consider the last point the most useful one. On the router this would have surfaced only after a week of false alerts. Now, if the history is already there, a new detector is first run over it, and the report gets numbers: over 48 hours it would have fired N times, and here is on whom.

## The price of the move

- the detector sees the network with a delay of up to 10 seconds;
- the collector became a critical component, before that its failure cost only an empty map;
- 48 hours of history do not cover weekly cycles, so the thresholds will have to be rechecked.

If the collector goes down, the network is left unattended. But covering that is cheaper than moving the logic to the router: an Uptime Kuma monitor watches the collectors themselves. If a collector goes silent, a separate alert arrives.

## What I now ask before adding a new watchdog

1. Who already collects the data I need?
2. What will the watched system pay for doing the computation itself, especially at the moment of an incident?
3. How do I cover the failure of the watcher?

This time the answers were these. The flow collector was already gathering the data. Doing the computation itself would have cost the router load exactly at the moment of an incident. And a separate monitor watches the collector.</content:encoded><category>infra</category><category>lab</category><category>diagnostics</category><category>mikrotik</category><category>monitoring</category><category>networking</category></item><item><title>Segmenting a home network on MikroTik without VLANs</title><link>https://alexey-krylov.dev/blog/service-moves-to-the-viewer</link><guid isPermaLink="true">https://alexey-krylov.dev/blog/service-moves-to-the-viewer</guid><description>A second subnet on the same bridge, trusted devices by list, and services with their own address in the segment of the people who use them.</description><pubDate>Fri, 21 Aug 2026 00:00:00 GMT</pubDate><content:encoded>In this post I want to describe how I split my home network into trusted and untrusted devices without setting up VLANs. The need itself came up after an incident at the country house: one TV box was holding 5051 connections, and it became clear that any device in the subnet counted as &quot;one of ours&quot; on my network.

The TV, the smart speaker, the robot vacuum and the cat&apos;s water fountain had the same access to the home server and to the router&apos;s admin interface as my laptop.

VLANs were the first option I considered, and I rejected it because it brings switch reconfiguration and new SSIDs with it. A second subnet requires neither.

## The idea

Isolation is done at L3: a second subnet on the same bridge. The switch, the access points and the SSIDs are left untouched, only the addresses change.

![Two segments on one router bridge](/images/service-moves-to-the-viewer/segments.svg)

- `10.0.1.0/24` - trusted: computers, phones, the server, the printer. Static leases only, there is no pool;
- `10.0.2.0/24` - untrusted: TVs, speakers, lamps, family members&apos; devices, guests. The DHCP pool lives here as well.

The addresses here and below are placeholders. An unfamiliar device ends up in the untrusted segment on its own, because free addresses exist only there. Becoming trusted requires an explicit static lease.

There is still only one DHCP server: RouterOS does not allow two of them on the same interface. The segment is determined by the lease address.

## What came out of it

The trusted list is filled by DHCP itself. A lease has an `address-lists` parameter, and the address is added to the list at the moment it is handed out:

```text
/ip dhcp-server lease set [find address=10.0.1.50] address-lists=trusted-devices
```

Then come five filter rules, all restricted to `in-interface=bridge`:

- a limit on concurrent connections for an untrusted device, and a trace in a separate list for an hour;
- the actual drop of connections above the limit;
- an allow rule for a short list of addresses in the trusted subnet;
- a drop of everything else from the untrusted segment into the protected networks;
- a drop of the router&apos;s own admin ports.

The key one looks like this:

```text
add chain=forward in-interface=bridge src-address-list=!trusted-devices \
    dst-address-list=protected-nets connection-state=new action=drop
```

In addition, there is a mandatory setting without which the router itself will tell an untrusted client to reach its neighbour on the bridge directly, past the filter:

```text
/ip settings set send-redirects=no
```

Two points about the rules themselves are worth noting.

The threshold of 500 was not found on the first try. At the country house it was initially set to 200, and within the first 20 minutes a phone and a laptop belonging to family members tripped it. Even so, 500 is still ten times lower than the number that started all this.

The `connection-state=new` condition on the drop rule is mandatory. Without it the rule cuts the reply packets of connections that a trusted host initiated: monitoring checks, a stream from the server to the TV.

## Services for untrusted devices

One catch remained: the TV needs the media server, and the media server lives on the server in the trusted subnet.

I considered opening a port on the server to untrusted devices a bad solution: behind port 80 there is a reverse proxy with all the internal sites, and separation by the `Host` header does not count as protection.

I decided to move the services themselves. A container gets its own address in `10.0.2.0/24`: a Docker network in macvlan mode on top of the server&apos;s network card, with the address issued by the router&apos;s DHCP for the MAC pinned to the container.

The viewer and the service end up in the same subnet, `forward` takes no part in their communication at all, and the `trusted-allowed-for-untrusted` list still contains a single printer.

This is how the media server, the photo archive, music, the wiki and several more services moved. Later this blog moved there too.

## Problems along the way

Almost all of them looked the same: the rule is correct and there is no traffic.

- the server did not get onto the trusted list. Its address is configured in the OS itself, it does not request one over DHCP, and its lease on the router had been sitting in `waiting` since 2024. I had to add the only static entry in the list. The check is simple: if a device is present in `/ip arp print` while its lease is `waiting`, the address is set on the device;
- the container-level `mac_address` is ignored in Docker 29, and only the `networks.&lt;network&gt;.mac_address` form works. It also works only in a Compose file without a `version:` line;
- BBR. While the service lived in `network_mode: host`, it inherited `tcp_congestion_control=bbr` from the host. In its own netns the default is `cubic`. It was BBR that once raised a single video stream between home and the country house from 10 to 76 Mbit/s, so the `sysctls` line in the stack is mandatory;
- port publishing. Docker attaches a container&apos;s networks in alphabetical order and puts the port mapping on the first of them. If `lan` comes first, the port on the host silently does not open, although `docker ps` shows it as published. The network&apos;s `priority` parameter does not change this order;
- `set address=` on an active lease erases its `dhcp-option-set`. I caught it by eye in `print detail`, and now I set the option set on the next line;
- device discovery. I wrote in the documentation that mDNS would not travel between segments, and I was wrong: 17 devices answered a query, five of them from the neighbouring subnet, because L2 is shared. At the same time, the app of one of the speakers discards a foreign subnet by itself, and the speaker had to be returned to the trusted devices.

## Downsides

The downsides of this approach are the following:

- there is no isolation within a single L2, neighbours in a subnet talk through the switch, past the router;
- `trusted-allowed-for-untrusted` opens a whole address rather than a port;
- the migration window is up to 30 minutes, until the devices renew their leases.

The right use case for this solution is protection against household appliances with someone else&apos;s firmware that scan the network by the usual rules. It will not protect against a person who is deliberately aiming at the network.

I rolled it out in stages: each stage is a separate `.rsc` file imported as a single transaction, with its own rollback file. I did the acceptance from the devices themselves rather than from the rules, because half of the problems in the list above are not visible in the rules.

I hope someone finds this useful.</content:encoded><category>infra</category><category>lab</category><category>docker</category><category>mikrotik</category><category>networking</category><category>self-hosting</category></item><item><title>Home backup power: a review of my own setup</title><link>https://alexey-krylov.dev/blog/home-backup-power-review</link><guid isPermaLink="true">https://alexey-krylov.dev/blog/home-backup-power-review</guid><description>Grid, inverter and generator in one cascade. What turned up when I drew the diagram of the setup for the first time and walked through it asking about failures.</description><pubDate>Fri, 24 Jul 2026 00:00:00 GMT</pubDate><content:encoded>The backup power setup in my country house worked fine: when the grid goes down, the house switches to an inverter with a battery, and after that to a petrol generator. But there was neither a diagram nor wire labelling in the cabinet.

One day I sat down and reviewed this setup the same way I would review someone else&apos;s system at work: with priorities, failures and the question &quot;what happens if&quot;.

## A cascade of two transfer switches

The setup is built as a cascade of two automatic transfer switches:

```text
GRID ─────────┐
              ├─ switch 1 ─┐
INVERTER ─────┘            ├─ switch 2 ── distribution board, whole house
GENERATOR ─────────────────┘
```

The priority is: grid, then inverter, then generator.

1. the grid is up: both switches sit on the first input, the house is powered from the grid;
2. the grid is down: the smart relay brings up the inverter on its own, without the cloud, and the first switch moves over to it;
3. on a timer the load should move to the generator, if its autostart is allowed;
4. if autostart is not allowed, the inverter runs until the battery is drained.

The battery charges only from the grid. It does not charge from the generator.

## Where the setup fails

On paper the design looked neat, until I walked through it asking about failures.

**In practice there is no automatic generator takeover.** The transfer timer is turned up to the maximum, and the generator is not set to autostart. This was done deliberately, to save fuel. The consequence is unpleasant: in a long outage the battery drains to zero, and the house goes dark.

At that point autostart is no longer possible: the start circuit is powered from the same drained battery. The generator can only be started by hand, with its own starter.

**Autonomy is short and depends heavily on the load.** The backup carries the whole house, there is no load separation. The inverter holds up to 5.5 kW, but by the datasheet estimate the battery lasts 20-25 minutes at that load.

| Load | Datasheet estimate |
|---|---|
| 500 W | about 4 hours |
| 2 kW | about an hour |
| 5.5 kW | 20-25 minutes |

The autonomy numbers in this review come from the datasheet, and that is its weak spot. The real ones appeared later, when I installed a monitor that watches the grid, the inverter and the generator. They turned out better than the estimate: at 500 W the battery holds 5.3 hours. There is a [separate article](/blog/power-monitor-for-a-country-house) about that.

**There is no fuse on the DC side.** This is the main finding of the review. The cables between the battery and the inverter are thick, there are no questions about the cross-section, but there is no separate fuse between them. The only protection is the electronics of the battery itself.

## Overload and short circuit

It is easy to reassure yourself here. There is overload protection, and in two stages: a relay with a power threshold and the inverter&apos;s own protection. But both sit on the section from the inverter to the house.

A short-circuit current on the cable between the battery and the inverter physically bypasses them. A lithium iron phosphate battery of this size delivers thousands of amps in a short circuit, and the battery electronics may not react in time.

A fuse on the battery positive does not duplicate anything: it covers the only section that has no protection at all.

## What else turned up

- traces of heating on the power terminal block of one of the switches. It needs to be retightened and inspected;
- a failure of the smart relay means a failure of the whole inverter stage. The upside is that it brings up the inverter locally and does not depend on the internet;
- the generator&apos;s starter battery drains over months of sitting idle. Then manual start will not work either;
- there is no explicit interlock between the two switches, only a mechanical one inside each;
- the cabinet has neither wire labelling nor a diagram on the door;
- one marking on a breaker matched the model name of the inverter. I lost time before I understood that it is the catalogue number of the breaker itself.

Something good turned up too: protection against electric shock also works in autonomous mode. The residual current devices trip both on the inverter and on the generator, because the neutral is grounded in both modes.

You can walk through any system the same way, if someone else built it and it &quot;just works&quot;. The question &quot;what happens if&quot; is better asked before the first long outage.</content:encoded><category>analysis</category><category>lab</category><category>architecture</category><category>diagnostics</category><category>power</category></item><item><title>Raspberry Pi 5: the &quot;reboots&quot; that never happened</title><link>https://alexey-krylov.dev/blog/reboots-that-never-happened</link><guid isPermaLink="true">https://alexey-krylov.dev/blog/reboots-that-never-happened</guid><description>The journal showed the server rebooting, and the culprit turned out to be a clock without a battery. Plus one real outage and noise from Docker.</description><pubDate>Tue, 21 Jul 2026 00:00:00 GMT</pubDate><content:encoded>A small server on a Raspberry Pi 5 that sits at my country house started behaving strangely not long ago: judging by the journal, it was rebooting, and it was unclear when. The power supply was the first suspect, and it turned out to have nothing to do with it.

## Checking the power

Before changing anything, I looked at what the system knows about itself:

```bash
uptime                                    # more than a day
cat /sys/class/net/end0/carrier_changes   # 1
vcgencmd get_throttled                    # throttled=0x0
```

- `uptime` is more than a day - the server did not reboot;
- `carrier_changes=1` - the link came up once at boot and never went down;
- `throttled=0x0` - not a single voltage drop since boot. The line shows 5.03 V, the temperature is 54 °C;
- there are no receive or transmit errors on the interface, and no OOM or kernel panic in the journal either.

Power, the cable and overheating were ruled out right away. The question that remained was where the reboots in the journal came from.

## Where the reboots in the journal come from

The Raspberry Pi 5 has an RTC, but the battery is not included, and my J5 connector was empty. In `dmesg` at startup it looks like this: `rpi-rtc` sets the system time to 1970-01-01, then systemd notices that the time is earlier than the build date and moves the clock forward.

Next, `fake-hwclock` sets the last saved time, and chrony gets the exact time from the network and applies it in one step (`makestep 1 3`). The step can be several days. The time in the journal goes out of order, and `journalctl --list-boots` draws several &quot;boots&quot; instead of one.

You can tell such phantoms apart by one sign: two boot-ids with the same timestamp, where the start of the second equals the end of the first plus one second.

I watched this live: at the start of the investigation the server showed July 8, and a few minutes later it was already the 12th-13th, and `uptime` had not reset.

## A battery for the RTC

First I tried to get by in software and enabled `systemd-time-wait-sync.service`, so that the other services would wait for time synchronization. It did not work: the service waits for a mark from `systemd-timesyncd`, and on this server chrony keeps the time. It hung in `activating` forever, and I had to disable it.

The official battery for the RTC is the Panasonic ML2020. After installing it, `dmesg` shows the correct time at startup, and there are no more phantom boots in the journal.

The ML2020 is rechargeable, and charging has to be enabled separately in `/boot/firmware/config.txt`:

```ini
dtparam=rtc_bbat_vchg=3000000
```

Without this line the battery will run down in a few months, and everything will come back. Charging may be enabled only for rechargeable cells (ML2020, LIR2032). It must not be done with an ordinary CR2032.

## The real outage

One real connectivity outage did turn up after all. Over a day, the watchdog on the server recorded four `no response from ping` lines: one episode of about a minute. Another one, about five minutes long, I caught myself.

The server&apos;s own journal is empty at those moments: `end0` did not go down, the lease was not lost, the settings did not change. The router was answering me, but it had no ARP entry for the server.

The most likely cause is the router itself: one of its scripts spends about 45 seconds iterating linearly over a large address list. It is the router that needs fixing, the server is the victim here.

## Noise in the journal

One of the containers got in the way of the investigation a lot. It crashed six times a day, and the Docker network plugin recreated a virtual interface for it 93 times.

In `networkd` this looks like a solid stream of `Lost carrier` and `Gained carrier`, and next to a complaint about connectivity drops it reads as confirmation of it. These messages have nothing to do with the server&apos;s uplink: all of them are about the container&apos;s virtual interfaces.

## The causes, summed up

- phantom boots - an RTC without a battery;
- a rare real outage - an overloaded router;
- noise in the journal - a crashing container.

None of them has anything to do with the power, which is where I started.

Now, when I hear the complaint &quot;it keeps rebooting&quot;, the first thing I look at is the three values from the first check, and only then do I touch the hardware. It takes less than a minute :)</content:encoded><category>analysis</category><category>lab</category><category>diagnostics</category><category>linux</category><category>raspberry-pi</category><category>self-hosting</category></item><item><title>claude-agents-bar: every Claude Code session, in the menu bar</title><link>https://alexey-krylov.dev/blog/claude-agents-bar</link><guid isPermaLink="true">https://alexey-krylov.dev/blog/claude-agents-bar</guid><description>A SwiftBar plugin that shows which Claude Code sessions are working, waiting on you, or done - built on hooks and JSONL transcripts alone.</description><pubDate>Sun, 17 May 2026 00:00:00 GMT</pubDate><content:encoded>VSCode has basically become my operating system. Most of the day runs through it: agents working on stuff in the background, MCP servers I&apos;m switching between, the same codebase under analysis from a couple of angles at once. Idling on a slow session isn&apos;t really a thing anymore - I just keep two or three going at the same time. That&apos;s the shape of the day.

Which means at any given moment there are a few Claude Code sessions open. One on the main branch, one or two in worktrees, sometimes a long background one on a refactor. The one waiting on me is almost never the one in focus. The built-in sidebar (same `anthropic.claude-code` extension under VSCode, VSCodium, Cursor) only sees the workspace it lives in. ⌘-Tab between windows looking for the yellow dot works for two sessions and falls apart by the fourth. So I built a menu-bar widget that answers one thing: which session needs me right now. No focus stealing, no floating panel.

Most of the noise around Claude Code right now is about autonomous fleets: orchestrators, self-directed pipelines, swarms eating backlogs. My day-to-day is smaller. Three or four sessions, a couple I&apos;m actively pairing with, the rest doing their thing. What I needed wasn&apos;t orchestration. It was a way to glance at the menu bar and see which of the things already on my screen wants me.

It&apos;s called `claude-agents-bar`. A SwiftBar plugin (Python, stdlib only, 3.9-compatible because that&apos;s what `/usr/bin/python3` is on Sequoia), a bash hook that writes session events to a TSV, a small CLI with `setup` / `teardown` / `doctor`, and per-row action scripts. Started as a single file. Grew into a package once I started relying on it daily, which forced me to write tests and an ADR tree so I could remember why I&apos;d made certain decisions a month later.

## Where the sidebar stops working

The Claude Code sidebar is fine for telling you what the current session is doing. It can&apos;t tell you that two windows over there&apos;s a session blocked on a permission prompt, or that the one in the other Space finished an hour ago and you&apos;ve already forgotten about it.

Things I tried before writing this:

- **⌘-Tab cycling.** Fine for two sessions. The yellow-dot signal lives inside each window, so past three you&apos;re focusing every one of them just to check.
- **Floating panel apps.** Pull focus, take screen space. The point of running things in parallel is that I don&apos;t want to look at any of them most of the time.
- **OS notifications.** Interruptive and ephemeral. By the time I look up, I&apos;ve lost the bit of state I needed.

A menu-bar widget was the smallest thing that fit: a counter you can read at a glance, plus a dropdown when you want detail. No daemon.

## What it shows

In the menu bar:

```
◐ 🟡1 🟢2 🔵1
```

- 🟡 - sessions that need attention right now (working, or waiting on a permission prompt).
- 🟢 - sessions that just finished, you haven&apos;t seen them yet.
- 🔵 - sessions you&apos;ve acknowledged but are still in active follow-up.

When nothing is urgent, the icon goes dim and the title stops drawing your eye.

The dropdown lists every session that touched disk in the last few hours, ordered by urgency. Each row shows the session&apos;s first user prompt as a title, the colour, and time since the last event. Clicking opens the project folder in your editor (VSCode by default; VSCodium and Cursor by setting `editor_url_scheme`). Past 80% context usage the row picks up an inline `⚠ {pct}%` warning, red past 90%. Useful for catching a session that&apos;s about to auto-compact before you give it another task.

The per-row submenu has mark-as-read, forget, delete, and reveal in Finder. On hover the row shows git branch and context %. The hover tooltip on the context line shows the session&apos;s last `tool_use` (`Read: main.py`, `Bash: pytest …`), so you can see what it&apos;s doing without clicking in.

![The dropdown with sessions grouped by colour and the per-row submenu: forget, delete, reveal in Finder, git branch and context usage](/images/claude-agents-bar/menu-default.webp)

A Tools submenu adds bulk actions (acknowledge all, forget all) plus a summary of what happened today.

System notifications cover the transitions that matter: a session finishing a long task, a permission prompt waiting on you. Each message is a short phrase pulled from the locale files - plain JSON, straightforward to edit if you want different wording. I&apos;ve tuned mine more than once. Low-stakes customization, but unexpectedly satisfying to get right.

## How it works

Polling, 5-second tick. The plugin reads two things from disk:

1. `~/.claude/projects/*/*.jsonl`: the transcripts Claude Code already writes. That&apos;s the source of the session title and the project path.
2. `~/.claude/agent-state.tsv`: a sidecar that the Claude Code hook (`hooks/agent-state.sh`, bash) updates on each session event (`SessionStart`, `PreToolUse`, `Stop`, and so on).

Both files are append-only. The plugin rebuilds the menu from disk every tick and exits. State that has to survive across ticks (which sessions you&apos;ve acknowledged or forgotten) lives in three more sidecar files of the same shape.

So there&apos;s no daemon and nothing to keep alive between ticks. If the plugin crashes, SwiftBar respawns it on the next 5 seconds.

## Hooks and JSONL are the whole API

One thing I want to flag specifically: this tool only exists because Anthropic shipped a few primitives I could lean on. Worth being concrete about which ones.

The hook system is a small set of events you register in `~/.claude/settings.json`: session lifecycle (`SessionStart`, `Stop`), tool lifecycle (`PreToolUse`, `PostToolUse`), permission gates. Each event runs a shell command and gets the relevant context on stdin. That&apos;s the entire surface, no plugin framework above it.

Three consequences for anyone extending Claude Code from the outside:

- **You can integrate sideways.** Nothing of mine runs inside Claude Code. A bash one-liner writes a TSV row; an unrelated Python script reads it. Two processes that don&apos;t know each other exist.
- **JSONL transcripts are stable enough to consume.** I read session titles and `cwd` straight off them. No scraping, no private API.
- **`settings.json` is just JSON,** so my installer does an additive `jq` merge with a timestamped backup and preserves whatever hooks the user already had. That wouldn&apos;t fly if hooks lived behind a config registry.

The pattern works because hooks are events on stdin and state is files on disk. I expect more sideways tooling around Claude Code over the next year; this is one early example.

## Limits

Things it doesn&apos;t do:

- Sessions that were already running when you installed the hooks won&apos;t have live state. They appear in the list (from JSONL mtime) but sit at `idle` until they emit their next event. I tried backfilling from transcripts and the guesses were wrong often enough that I pulled it out.
- macOS hides menu-bar items behind the notch before it hides the system tray, so on smaller MacBooks the icon can vanish. There&apos;s a `compact: true` flag that drops about 30 px by swapping emoji counters for narrow ANSI bullets, but it&apos;s a workaround.
- Remote sessions aren&apos;t surfaced. The plugin reads your local `~/.claude/`. If you run Claude Code on a dev box, you&apos;d have to mount that directory.

![Compact mode: narrow bullets in the menu bar instead of emoji counters](/images/claude-agents-bar/menu-compact.webp)

## Install

```bash
brew install --cask swiftbar               # if not already installed
brew install alexey-krylov/claude-agents-bar/claude-agents-bar
claude-agents-bar setup
```

`setup` symlinks the plugin into SwiftBar&apos;s plugins directory, drops the hook script into `~/.claude/hooks/`, and merges (with a timestamped backup) the hook entries into `~/.claude/settings.json`. Idempotent, safe to re-run.

If something doesn&apos;t show up, `claude-agents-bar doctor` will tell you what&apos;s missing (jq, python3, SwiftBar.app, hook registration, sidecar freshness, editor app).

Screenshots and a live demo of the dropdown are on the [project page](https://alexey-krylov.github.io/ClaudeAgentsBar/). This post first appeared on [Medium](https://medium.com/@aleksey.krylov/claude-agents-bar-every-claude-code-session-in-the-menu-bar-fabd2dd716bf).

---

A long time ago I wrote Java integration posts on Habr - Guice with Spring Data, with Axon, some CLI tooling. This is the same instinct, scratching a tooling itch and writing it up.

Three months of daily use and I barely notice it&apos;s there - which is the point. The sessions that used to sit blocked while I worked on something else now surface in seconds. The notification that fires when an agent is waiting has started to feel less like a system alert and more like part of the conversation - the hooks are talking, the day has a rhythm. That kind of friction reduction is hard to measure and easy to feel. If the shape of your day looks anything like mine, hopefully it&apos;s worth an hour of your time.</content:encoded><category>agents</category><category>lab</category><category>agents</category><category>claude-code</category><category>macos</category><category>tooling</category></item></channel></rss>