M24: attention reasons and actions #38

Open
opened 2026-10-02 04:07:04 +00:00 by jhgaylor · 0 comments
Owner

Depends on: #36 (classification only; the rest can start now)
Blocks: #40

Swarm track. Attention says what happened, not just "needs you", so the client can explain it, bundle it with others and act on it.


Today Attention is idle | working | needs_input | done, plus an Ask for question cards. Keep those states, and add a reason to every non-idle one.

  • Reasons:
    • ask: an open Ask (agent blocks, and Claude Code through its hook), with its headline;
    • failed: a command that ran longer than a few seconds ended with a non-zero exit (from shell integration's CommandEnd);
    • exited: a pane's program died with a non-zero code, mainly servers and Rerun/Hook policies (from Exit), or machine_gone;
    • input: the pane waits on a prompt. That covers bell and Notify, plus prompt detection for [sudo] password, [y/N] and (y/n), and "Enter passphrase", when output stops on that line;
    • done: a long command finished while nobody was looking (today's done), with its duration.
  • Each reason carries since_ms, a one-line headline, the command and exit code where there is one, and a bundle key:
    • failed and exited bundle by machine;
    • ask bundles by project and agent;
    • input never bundles.
  • Actions, with one route for them all (POST /api/attention/act) taking one pane or a list:
    • allow and deny: answer an ask (wrapping /api/panes/{id}/ask);
    • rerun: run the last command again (the "Run again" menu item);
    • restart: restart the pane's program under its policy;
    • send: type an answer (y, Enter), for input;
    • dismiss: today's PaneOp::Attention.
  • Everywhere:
    • illogical attention --json lists the reasons;
    • illogical events streams changes;
    • push notifications show the headline and offer the reason's actions;
    • dismissing on one client clears the reason on every other.
  • Done when:
    • a failing cargo test, a dying npm run dev, a sudo prompt, a Claude Code question and a 10-minute build each show the right reason and headline in illogical attention;
    • "rerun all" on three failed panes reruns all three;
    • the phone's push for a failure has a working Run again button.
**Depends on:** #36 (classification only; the rest can start now) **Blocks:** #40 *Swarm track. Attention says what happened, not just "needs you", so the client can explain it, bundle it with others and act on it.* -------- Today `Attention` is `idle | working | needs_input | done`, plus an `Ask` for question cards. Keep those states, and add a **reason** to every non-idle one. - **Reasons:** - `ask`: an open `Ask` (agent blocks, and Claude Code through its hook), with its headline; - `failed`: a command that ran longer than a few seconds ended with a non-zero exit (from shell integration's `CommandEnd`); - `exited`: a pane's program died with a non-zero code, mainly servers and `Rerun`/`Hook` policies (from `Exit`), or `machine_gone`; - `input`: the pane waits on a prompt. That covers bell and `Notify`, plus prompt detection for `[sudo] password`, `[y/N]` and `(y/n)`, and "Enter passphrase", when output stops on that line; - `done`: a long command finished while nobody was looking (today's `done`), with its duration. - **Each reason carries** `since_ms`, a one-line `headline`, the command and exit code where there is one, and a **bundle key**: - `failed` and `exited` bundle by machine; - `ask` bundles by project and agent; - `input` never bundles. - **Actions,** with one route for them all (`POST /api/attention/act`) taking one pane or a list: - `allow` and `deny`: answer an `ask` (wrapping `/api/panes/{id}/ask`); - `rerun`: run the last command again (the "Run again" menu item); - `restart`: restart the pane's program under its policy; - `send`: type an answer (`y`, Enter), for `input`; - `dismiss`: today's `PaneOp::Attention`. - **Everywhere:** - `illogical attention --json` lists the reasons; - `illogical events` streams changes; - push notifications show the headline and offer the reason's actions; - dismissing on one client clears the reason on every other. - **Done when:** - a failing `cargo test`, a dying `npm run dev`, a `sudo` prompt, a Claude Code question and a 10-minute build each show the right reason and headline in `illogical attention`; - "rerun all" on three failed panes reruns all three; - the phone's push for a failure has a working Run again button.
Sign in to join this conversation.
No description provided.