M23: pane summaries (activity, kind, project, previews) #37

Closed
opened 2026-10-02 04:07:04 +00:00 by jhgaylor · 4 comments
Owner

Depends on: #36
Blocks: #39, #40

Swarm track. Each daemon gets a cheap, live summary of all its panes, enough to draw hundreds of them without attaching to any.

S16 (#36) found that today's whole-State broadcasts already cost 6.6 MB/s per client and 15–20% of a core at 500 panes with 50 busy, in the ordinary tab view too. So the deltas here become how every client gets updates, not an extra mode for the swarm.


  • More per pane in PaneInfo (and PaneSummary, illogical ls --json):
    • activity: a cumulative output byte counter and last_output_ms in the pane's Status, set under the lock State::output already takes for every chunk. The mux turns the counter into bytes per second when it builds a summary, so idle panes need no timer (S16);
    • project: the git root of the cwd and its name, worked out when the cwd changes (cached, never a git per frame). Outside a repo it's empty, which S16 found is most panes (97 of 105 real commands), so clients need a fallback such as the cwd's top directory;
    • kind: a classification (shell, build, test, agent, server, logs, editor) from the foreground process's /proc argv first, then the shell integration's command text, with blocks keeping their BlockType. That order got 52 of 54 labelled commands right in S16 and catches aliases (c for claude);
    • title: the OSC 0/2 title, when the program sets one.
  • Delta updates for every client: a full snapshot on connect, then field-level deltas batched once a second. S16 measured 4.6 KB/s (0.44 KB/s compressed) at 500 panes with 50 busy, against 6.6 MB/s today.
    • Layout changes (tabs, splits, sessions) still arrive at once; only per-pane fields are batched.
    • Summaries leave out epoch, policy and integration; a client that needs them reads the pane.
    • A client can also subscribe to summaries only (no pane output), as the swarm and the fleet (#39) do.
    • Pane open and close events arrive in order with the deltas.
  • Previews on demand: the client names the panes it is drawing big enough to read, and the daemon sends their last N rendered lines at up to 1 Hz.
    • The list changes as you zoom and pan; anything not on it gets nothing.
    • This uses the same rendering as /api/panes/{id}/capture. S16: 50 panes at 1 Hz cost 0.8% of a core and 2.2 KB/s.
  • Parked panes (M9) stay parked: summary and activity don't wake them (reading the counter doesn't touch the pane's thread), and a preview reads the parked snapshot. M9's PTY parking keeps the counter current (#10).
  • Access (M12): a viewer gets summaries only for the sessions they can see.
  • Done when:
    • geek with 500 panes keeps a client current at under 5% of one core and under 20 KB/s while 10% of panes are busy (today: 14.7% and 6.6 MB/s), rerun with S16's summary.py;
    • illogical ls --json shows kind, project and activity for every pane;
    • a test checks that project and kind are right for a fixture of real commands (cargo test, npm run dev, claude, nvim, tail -f, journalctl -f).
**Depends on:** #36 **Blocks:** #39, #40 *Swarm track. Each daemon gets a cheap, live summary of all its panes, enough to draw hundreds of them without attaching to any.* *S16 (#36) found that today's whole-`State` broadcasts already cost 6.6 MB/s per client and 15–20% of a core at 500 panes with 50 busy, in the ordinary tab view too. So the deltas here become how every client gets updates, not an extra mode for the swarm.* -------- - **More per pane** in `PaneInfo` (and `PaneSummary`, `illogical ls --json`): - `activity`: a cumulative output byte counter and `last_output_ms` in the pane's `Status`, set under the lock `State::output` already takes for every chunk. The mux turns the counter into bytes per second when it builds a summary, so idle panes need no timer (S16); - `project`: the git root of the cwd and its name, worked out when the cwd changes (cached, never a `git` per frame). Outside a repo it's empty, which S16 found is most panes (97 of 105 real commands), so clients need a fallback such as the cwd's top directory; - `kind`: a classification (shell, build, test, agent, server, logs, editor) from the foreground process's `/proc` argv first, then the shell integration's command text, with blocks keeping their `BlockType`. That order got 52 of 54 labelled commands right in S16 and catches aliases (`c` for `claude`); - `title`: the OSC 0/2 title, when the program sets one. - **Delta updates for every client:** a full snapshot on connect, then field-level deltas batched once a second. S16 measured 4.6 KB/s (0.44 KB/s compressed) at 500 panes with 50 busy, against 6.6 MB/s today. - Layout changes (tabs, splits, sessions) still arrive at once; only per-pane fields are batched. - Summaries leave out `epoch`, `policy` and `integration`; a client that needs them reads the pane. - A client can also subscribe to summaries only (no pane output), as the swarm and the fleet (#39) do. - Pane open and close events arrive in order with the deltas. - **Previews on demand:** the client names the panes it is drawing big enough to read, and the daemon sends their last N rendered lines at up to 1 Hz. - The list changes as you zoom and pan; anything not on it gets nothing. - This uses the same rendering as `/api/panes/{id}/capture`. S16: 50 panes at 1 Hz cost 0.8% of a core and 2.2 KB/s. - **Parked panes (M9) stay parked:** summary and activity don't wake them (reading the counter doesn't touch the pane's thread), and a preview reads the parked snapshot. M9's PTY parking keeps the counter current (#10). - **Access (M12):** a viewer gets summaries only for the sessions they can see. - **Done when:** - geek with 500 panes keeps a client current at under 5% of one core and under 20 KB/s while 10% of panes are busy (today: 14.7% and 6.6 MB/s), rerun with S16's `summary.py`; - `illogical ls --json` shows kind, project and activity for every pane; - a test checks that project and kind are right for a fixture of real commands (`cargo test`, `npm run dev`, `claude`, `nvim`, `tail -f`, `journalctl -f`).
Author
Owner

Part of the Swarm MVP (#44). The MVP cut of this ticket is listed there; anything not on that list is after the MVP.

Part of the Swarm MVP (#44). The MVP cut of this ticket is listed there; anything not on that list is after the MVP.
Author
Owner

From S16:

  • Make the delta subscription the normal path for every client, not just the swarm. Whole-State broadcasts are 6.6 MB/s and 15–20% of a core at 500 panes, even in the tab view.
  • Activity is a cumulative byte counter plus last_output_ms, kept under State::output's existing lock. The mux turns it into a rate.
  • Classify kind from /proc argv before the typed text: 52 of 54 right, and it catches aliases.
  • Leave epoch, policy and integration out of summaries.
  • Previews cost 0.8% of a core for 50 panes at 1 Hz. Go.
From S16: - Make the delta subscription the normal path for every client, not just the swarm. Whole-State broadcasts are 6.6 MB/s and 15–20% of a core at 500 panes, even in the tab view. - Activity is a cumulative byte counter plus last_output_ms, kept under State::output's existing lock. The mux turns it into a rate. - Classify kind from /proc argv before the typed text: 52 of 54 right, and it catches aliases. - Leave epoch, policy and integration out of summaries. - Previews cost 0.8% of a core for 50 panes at 1 Hz. Go.
Author
Owner

Done 2026-10-02, cut to the MVP (#44). Merged in 70003e2.

What landed:

  • PaneInfo gains kind (shell, build, test, agent, server, logs or editor), project ({root, name}), activity ({bps, last_ms}) and title. illogical ls --json shows them.
    • kind comes from the foreground process's argv first, then the typed text, then the pane's own process, so an alias like c reads as the claude it runs. It uses S16's heuristic.
    • project is found by walking up for .git, with no git process, and cached per directory.
    • activity is a running byte count and last-output time, kept under State::output's existing lock. The mux works out the rate once a second, so idle panes need no timer and parked panes aren't woken.
  • Deltas are how every client gets updates.
    • The hello, layout changes and grant changes are still whole States. Everything else is a delta with only the fields that changed.
    • Attention, questions, reasons and drivers arrive within 40 ms. Directories, commands and activity come at a 1 s tick. Only changed panes are rebuilt.
  • subscribe {summary: true} gives summaries only, for the swarm and the fleet: no epoch, policy or integration, and nothing attached. The web client's new Client(base, e2e, true) makes no terminals.
  • Role filtering: each person sees only the sessions they have a role on, and someone else's private pane is blanked.

Measured at S16's load, 500 panes with 50 busy (spikes/s16-swarm/m23.py, release build on geek):

daemon CPU to each client deflate
before (S16) 14.7% 6.6 MB/s 390 KB/s
M23, 1 client 2.5% 5.3 KB/s 0.48 KB/s
M23, 5 clients 3.1% 5.3 KB/s each 0.48 KB/s

Tests:

  • classify.rs: S16's labelled fixture plus this repo's commands.
  • crates/daemon/tests/summaries.rs: kind, project and activity in ls --json for real processes (cargo test, npm run dev, claude behind the alias c, nvim, tail -f, journalctl -f). It also checks that 40 panes with 4 busy send no whole State and stay under 20 KB/s.
  • e2e/summaries.spec.ts.
  • The rest of the Playwright suite passes. It also caught a real bug, now fixed: the prompt and rename inputs lost what was typed whenever the page re-rendered.

Not covered (after the MVP):

  • On-demand previews. Hover uses /api/panes/{id}/capture.
  • A layout change still sends a whole State (243 KB at 500 panes).
  • An OSC title split across two reads is picked up at the next one.
  • M9's PTY parking must keep updating the byte count.

What's left for the swarm: #39 connects a summaries-only client to each host. #40 needs a client-side fallback group, from cwd, for panes outside git. #47 needs each pane's session owner to group by person.

**Done 2026-10-02, cut to the MVP (#44).** Merged in 70003e2. **What landed:** - `PaneInfo` gains `kind` (shell, build, test, agent, server, logs or editor), `project` (`{root, name}`), `activity` (`{bps, last_ms}`) and `title`. `illogical ls --json` shows them. - **kind** comes from the foreground process's argv first, then the typed text, then the pane's own process, so an alias like `c` reads as the `claude` it runs. It uses S16's heuristic. - **project** is found by walking up for `.git`, with no git process, and cached per directory. - **activity** is a running byte count and last-output time, kept under `State::output`'s existing lock. The mux works out the rate once a second, so idle panes need no timer and parked panes aren't woken. - **Deltas are how every client gets updates.** - The hello, layout changes and grant changes are still whole `State`s. Everything else is a `delta` with only the fields that changed. - Attention, questions, reasons and drivers arrive within 40 ms. Directories, commands and activity come at a 1 s tick. Only changed panes are rebuilt. - **`subscribe {summary: true}`** gives summaries only, for the swarm and the fleet: no epoch, policy or integration, and nothing attached. The web client's `new Client(base, e2e, true)` makes no terminals. - **Role filtering:** each person sees only the sessions they have a role on, and someone else's private pane is blanked. **Measured** at S16's load, 500 panes with 50 busy (`spikes/s16-swarm/m23.py`, release build on geek): | | daemon CPU | to each client | deflate | |---|---|---|---| | before (S16) | 14.7% | 6.6 MB/s | 390 KB/s | | M23, 1 client | **2.5%** | **5.3 KB/s** | 0.48 KB/s | | M23, 5 clients | 3.1% | 5.3 KB/s each | 0.48 KB/s | **Tests:** - `classify.rs`: S16's labelled fixture plus this repo's commands. - `crates/daemon/tests/summaries.rs`: kind, project and activity in `ls --json` for real processes (`cargo test`, `npm run dev`, `claude` behind the alias `c`, `nvim`, `tail -f`, `journalctl -f`). It also checks that 40 panes with 4 busy send no whole `State` and stay under 20 KB/s. - `e2e/summaries.spec.ts`. - The rest of the Playwright suite passes. It also caught a real bug, now fixed: the prompt and rename inputs lost what was typed whenever the page re-rendered. **Not covered (after the MVP):** - On-demand previews. Hover uses `/api/panes/{id}/capture`. - A layout change still sends a whole `State` (243 KB at 500 panes). - An OSC title split across two reads is picked up at the next one. - M9's PTY parking must keep updating the byte count. **What's left for the swarm:** #39 connects a summaries-only client to each host. #40 needs a client-side fallback group, from `cwd`, for panes outside git. #47 needs each pane's session owner to group by person.
Author
Owner

Done: merged to main in 70003e2 (Merge M23), cut to the swarm MVP scope (#44).

Done: merged to main in 70003e2 (Merge M23), cut to the swarm MVP scope (#44).
Commenting is not possible because the repository is archived.
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jhgaylor/illogical#37
No description provided.