<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Agents and tooling - Alexey Krylov</title><description>Claude Code, MCP, loop engineering, tools around development.</description><link>https://alexey-krylov.dev</link><language>en</language><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>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>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>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>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>lab</category><category>agents</category><category>architecture</category><category>local-models</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>lab</category><category>agents</category><category>claude-code</category><category>macos</category><category>tooling</category></item></channel></rss>