bg-tasks
Session'ın arka plandaki shell task'larını status line'da gösteren ve /bg-tasks pane'inden birini durduran bir Claude Code Mod'u. Modelin çalışır bıraktığı bir dev server ya da bir watcher, bitene kadar gözünüzün önünde kalır.
Ne yapar
Mod Bash tool'unu hook'lar.
backgroundTaskIddönen bir çağrı listeye girer: modelinrun_in_backgroundile başlattığı ya da sizin Ctrl+B ile arka plana aldığınız bir task.Bir task şu durumlarda listeden çıkar:
- bildirimi geldiğinde (
<task-notification>, bir<task-id>verunningdışında bir status ile), - model onu TaskStop tool'u ile durdurduğunda,
- siz pane'de durdurduğunuzda.
- bildirimi geldiğinde (
Status line sayıyı, en eski task'ın yaşını ve komutunu gösterir, 30 saniyede bir yeniden çizilir:
bg-tasks: 2 running · oldest 12m (npm run dev)Çalışan task yokken satır da yoktur.
/bg-taskstask başına bir satır taşıyan bir pane açar, en eskisi üstte:age who command [ stop ] 12m model npm run dev [ stop ] 3m you tail -f logs/app.logBir satırda Enter, o task'ı engine'in TaskStop tool'u ile durdurur; onay sizin tuşunuzdur. Pane
stopped: npm run devder, ya da sebebiylenot stopped: ...der ve task o zaman listede kalır.sidebar açıkken liste oraya gider: aynı satırları taşıyan bir section ve task başına bir
[ stop ... ]butonu; status line boş kalır. Bir basış/bg-tasks stop <id>komutunu çalıştırır, yani task aynı yolla durur. Sidebar kapalıyken ya da o mod kurulu değilken her şey yukarıdaki gibidir.Kendi kendine biten bir task, sidebar'ın stream'ine bir yeşil kayıt da yazar, böylece pane biteni tutar, üstündeki liste yalnız hâlâ çalışanı tutar:
bg-tasks: task finished sleep 600 · finished after 12mSizin durdurduğunuz bir task böyle bir kayıt yazmaz; pane zaten
stopped: <task>demiştir. Sidebar kapalıyken hiçbir şey yazılmaz, çünkü engine'in kendi task bildirimi bitişi zaten haber verir.
Canlı testte model arka planda sleep 900 başlattı. Status line 1 running · oldest <1m (sleep 900) gösterdi. Pane'de satırına basmak process'i durdurdu, status line ve engine'in 1 shell alt bilgisi kayboldu.
Komut
/bg-tasks pane'i açar ya da kapatır
/bg-tasks list task'ları id'leriyle metin olarak yazar
/bg-tasks stop <id> o task'ı durdurur; sidebar butonunun çalıştırdığı komut
/bg-tasks on | off varsayılan on; off listeyi temizler
Ad /bg değil, çünkü engine /bg adını kendi /background komutuna ayırıyor.
Kurulum
claude plugin marketplace add KilimcininKorOglu/claude-code-mods
claude plugin install bg-tasks@kilimcininkoroglu-mods
Function hook'lar early access. Flag olmadan hiçbir şey yüklenmez. Flag'i kalıcı yapmak için ~/.claude/settings.json dosyasına ekleyin:
{ "env": { "CLAUDE_CODE_ENABLE_FUNCTION_HOOKS": "1" } }
Kurulumdan sonra
- Claude Code'u yeniden başlatın.
Nereye uzanır
Claude Code 2.1.278 üzerinde claude plugin validate ile doğrulandı:
❯ ./register.tsx hooks: session.start, command.run{command=bg-tasks}, tool.call{tool=Bash}, tool.call{tool=TaskStop}, prompt.submit{origin has {kind=task-notification}}, ui.render{component=Pane}
❯ ./register.tsx calls: $.clock.every, $.clock.now, $.command.register, $.sidebar.clear (via offSidebar), $.sidebar.set (via toFinished, toSidebar), $.store.get, $.store.set (via runCommand), $.tool.call (via stopTask), $.ui.close (via togglePane), $.ui.invalidate (via changed), $.ui.open (via togglePane), $.ui.panes (via togglePane), $.ui.resolve, $.ui.status (via showStatus)
Reach L2, bir tool çağırır.
1. Okur: her Bash çağrısının komutunu ve sonucunu; task bildirimlerinin metnini; her TaskStop çağrısının task id'sini
2. Çalıştırır: engine'in TaskStop tool'unu, yalnız pane'deki tuşunuzla ya da sidebar butonuna basışınızla
3. Gönderir: modele hiçbir şey; status line ve pane yalnız sizin için çizilir
4. Saklar: $.store içinde on/off ayarını; task listesi session boyunca bellekte kalır
5. Düşman girdi: bir task id'si TaskStop'a yalnız engine'in kendi Bash sonuçlarının kurduğu listeden gider; bildirim metninde sadece id aranır
Sınırlar
- Yalnız mod yüklüyken başlayan task'lar listelenir. Bir resume'dan,
/reload-pluginsya da bir güncellemeden sonra daha önce başlamış task'lar bilinmez. - Subagent'lar, workflow'lar ve monitor'ler listelenmez, yalnız arka plan shell'leri listelenir.
- Bildirim olmadan biten bir task (session meşguldü ve bildirim hâlâ kuyrukta) bildirim gelene kadar listede kalır.
Geliştirme
make install # eslint, typescript-eslint, typescript
make lint # complexity limiti 10, üstünde build'i düşürür
make typecheck # /plugin-types ile üretilen .claude/types/ gerekir
make validate
make test # claude plugin test
bg-tasks
A Claude Code Mod that shows the background shell tasks of the session on the status line, and stops one from the /bg-tasks pane. A dev server or a watcher the model left running stays in sight until it ends.
What it does
The mod hooks the Bash tool. A call that returns a
backgroundTaskIdis listed: one the model started withrun_in_background, or one you moved to the background with Ctrl+B.A task leaves the list when:
- its notification arrives (
<task-notification>with a<task-id>and a status other thanrunning), - the model stops it with the TaskStop tool,
- you stop it in the pane.
- its notification arrives (
The status line shows the count, the age of the oldest task and its command, redrawn every 30 seconds:
bg-tasks: 2 running · oldest 12m (npm run dev)With no task running there is no line.
/bg-tasksopens a pane with one row per task, the oldest first:age who command [ stop ] 12m model npm run dev [ stop ] 3m you tail -f logs/app.logEnter on a row stops that task through the engine's TaskStop tool, with your press as the consent. The pane says
stopped: npm run dev, ornot stopped: ...with the reason, and the task stays listed then.While the sidebar is open, the list goes there instead: one section with the same rows and a
[ stop ... ]button per task, and the status line stays empty. A press runs/bg-tasks stop <id>, which stops that task the same way. With the sidebar closed, or without that mod installed, everything is as above.A task that ends by itself also writes one green entry into the sidebar's stream, so the pane keeps what finished while the list above it holds only what still runs:
bg-tasks: task finished sleep 600 · finished after 12mA task you stopped writes no such entry; the pane already says
stopped: <task>. With the sidebar closed nothing is written, because the engine's own task notification already reports the end.
In the live check the model started sleep 900 in the background. The status line showed 1 running · oldest <1m (sleep 900). A press on its row in the pane stopped the process, and the status line and the engine's 1 shell footer went away.
Command
/bg-tasks opens or closes the pane
/bg-tasks list the tasks as text, with their ids
/bg-tasks stop <id> stops that task; what a sidebar button runs
/bg-tasks on | off on by default; off clears the list
The name is not /bg, because the engine keeps /bg for its built-in /background.
Install
claude plugin marketplace add KilimcininKorOglu/claude-code-mods
claude plugin install bg-tasks@kilimcininkoroglu-mods
Function hooks are early access. Nothing loads without the flag. To keep it on, add this to ~/.claude/settings.json:
{ "env": { "CLAUDE_CODE_ENABLE_FUNCTION_HOOKS": "1" } }
After installing
- Restart Claude Code.
What it can reach
Validated with claude plugin validate on Claude Code 2.1.278:
❯ ./register.tsx hooks: session.start, command.run{command=bg-tasks}, tool.call{tool=Bash}, tool.call{tool=TaskStop}, prompt.submit{origin has {kind=task-notification}}, ui.render{component=Pane}
❯ ./register.tsx calls: $.clock.every, $.clock.now, $.command.register, $.sidebar.clear (via offSidebar), $.sidebar.set (via toFinished, toSidebar), $.store.get, $.store.set (via runCommand), $.tool.call (via stopTask), $.ui.close (via togglePane), $.ui.invalidate (via changed), $.ui.open (via togglePane), $.ui.panes (via togglePane), $.ui.resolve, $.ui.status (via showStatus)
Reach L2, calls a tool.
1. Reads: the command and the result of each Bash call; the text of task notifications; the task id of each TaskStop call
2. Runs: the engine's TaskStop tool, only on your press in the pane or on the sidebar's button
3. Sends: nothing to the model; the status line and the pane are drawn for you only
4. Persists: in $.store, the on/off setting; the task list lives in memory for the session
5. Hostile input: a task id reaches TaskStop only from the list the engine's own Bash results built; notification text is only matched for ids
Limits
- Only tasks that start while the mod is loaded are listed. After a resume, a
/reload-pluginsor an update, tasks started earlier are not known. - Subagents, workflows and monitors are not listed, only background shells.
- A task that ends without a notification (the session was busy and the notification is still queued) stays listed until the notification arrives.
Development
make install # eslint, typescript-eslint, typescript
make lint # complexity limit 10, fails the build above it
make typecheck # needs .claude/types/ from /plugin-types
make validate
make test # claude plugin test