Metadata-Version: 2.4
Name: superresearch-agent
Version: 0.1.33
Summary: Install Super Research into a chat runtime (Hermes / OpenClaw) with `pipx run superresearch-agent connect` — an account-authed loopback bridge that drives the user's own Super Research from chat.
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: requests>=2.31
Requires-Dist: keyring>=24
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == "dev"
Requires-Dist: ruff==0.16.0; extra == "dev"

# Super Agent — drive Super Research from chat (Hermes / OpenClaw)

Lets a chat runtime (Hermes / OpenClaw) drive **Super Research** as a *headless
session of your account*. You install a small `/sr` skill + a local loopback
bridge, sign in once with Google, and then run / track research from chat —
every run shows up in the web app like a normal chat.

- **Research + device management.** Run / track / fetch research, and switch
  or leave Research Computers from chat — plus find a computer somebody else
  offers publicly and ask its host for access, and, for a computer you host,
  answer the people asking, set whether strangers can find it at all, and rename
  it, see who uses it, remove a person or let the people waiting in, each after
  its card. An access code is entered on the website (Account → Pipeline
  Connection), never in chat; a computer you host is unlinked on its tile in
  Account, where its new access code is shown once.
- **Support logs, on request and never by default.** A Research Computer can
  package the logs of *your* runs for support, and the agent's own log on this
  host can go too — or on its own. Both print what would leave before anything
  does.
- **One agent row per install.** It signs in as you (owner or sharer), and each
  host you connect shows as its own renamable, revokable row in the app's
  *Shared with* popup — a second host adds a row rather than replacing one.
- **No dedicated worker, no separate logins, no identity minting.** It uses your
  account's existing paired devices, on the app's normal Firestore plane.

---

## Install

One command, run in your chat runtime's environment — or grab it from the page at
**https://superresearch.io/skills** (the old `/agent-install` 308-redirects there):

```sh
pipx run --no-cache superresearch-agent connect      # the published package
```

`connect` is a branded, interactive flow — **Detect + choose → Install the skill
→ Run on startup → Sign in** — that finds your runtime (native on this OS, or
inside WSL), copies the `/sr` skill in, offers to keep a background bridge
running on every login, and signs you in. Then, in chat:

```
/reload-skills          # Hermes only, once, so /sr registers
/sr login               # sign in (approve on your phone)
/sr research <topic>    # …and you're running
```

**Install straight from chat.** Hermes / OpenClaw can run the command themselves —
just ask ("install Super Research"), and the agent runs `pipx run
--no-cache superresearch-agent connect`. With no terminal to answer, `connect`
installs the skill and pins the bridge without asking, starts no sign-in and prints
no link: its last line says what comes next — `/reload-skills` (Hermes), then
`/sr login`, whose link the agent relays. (The runtime's
`/skills` marketplace command is terminal-only and doesn't work over a chat
platform — *running the command* does.) The agent-facing companion is
**https://superresearch.io/skills.md** — the page to hand an agent as a link
("Install Super Research from superresearch.io/skills.md"); it tells the agent to
run that one command, register the skill, and sign you in, and nothing else.

The skill itself is also hosted, byte for byte, for a skills hub that installs
from a site's well-known index: `SKILL.md` and `scripts/sr.py` under
https://superresearch.io/.well-known/skills/sr/. That copy is the version on
PyPI: the website's `scripts/sync-agent-skill.mjs` refreshes it from this package
once a new version is published, and its `--check` fails on a copy that drifted
from it any other way.

**No Research Computer yet?** The agent orchestrates from chat; the research
pipeline runs on a paired computer. Set one up at
**https://superresearch.io/install** — that computer then shows an 8-character
**access code**; enter it (or one a computer's host gave you) in Account →
Pipeline Connection, https://superresearch.io/account — never in chat.
The setup asks its own questions on that computer — among them, in a step of its
own, whether other people may **find** that machine, which defaults to *no* — and
the agent answers none of them; `device-visibility` is how that one changes
afterwards. (Or ask to use somebody else's machine instead — see **Computers
other people offer**.) To make the machine the chat itself runs on the Research
Computer, say **"install Super Research here"** (`/sr install`); its reply opens
with the same page.

### An organisation's own site (`connect --site`)

An organisation that runs its own copy of Super Research gives its people the
site's address once:

```sh
pipx run --no-cache superresearch-agent connect --site https://research.example.org
```

`connect --site` reads the site's public settings from
`<site>/__/firebase/init.json` (never following a redirect), saves them in this
agent's `~/.super-agent/prefs.json` under `site`, and from then on every command
and the bridge use that site and its Google project: the sign-in (its window opens
on the project's own `authDomain` from that file), the website and Firestore
calls, and every address the agent tells you — the install, connect and account
pages, its replies in chat, and the installed SKILL.md (rewritten in the
installed copy only). It is the back end's `superresearch --pair --site`, with the
same refusals in the same words: plain `http://` (except this computer itself), an
address that redirects somewhere else, a site that does not answer with its
settings, a look-alike that names DG's own project anywhere but
https://superresearch.io, and a `SUPER_AGENT_*` variable that disagrees with the
site (each is named — remove it, then run `connect` again). An agent signed in to
another site is refused until `superresearch-agent logout`. A running bridge is
restarted onto the new site. When the chat runtime lives in WSL, the site is
passed into the distro's `connect` and saved there, next to its bridge.

`connect` without `--site` (and the self-update's reconnect) keeps the saved
site; `disconnect` and `logout` keep it too. `connect --site
https://superresearch.io` forgets it, so the agent is DG's again with DG's
built-in values. With no saved site nothing changes: every value is DG's, byte
for byte. Environment variables (`SUPER_AGENT_FE_BASE`, `SUPER_AGENT_PROJECT_ID`,
…) still win over a saved site, for development; `serve` and `doctor` say when a
saved site was ignored, and why.

---

## Use it from chat (`/sr`)

The runtime registers the skill as one slash command — **`/sr`** — and the action
follows it (natural phrasing works too: "research the EV market", "send me the
podcast"):

```
/sr login                        sign in (account session)      ·   /sr logout
/sr research <topic>             start a run   (--no-video · --no-email · --device <id> ·
                                 --on/--off <part> · --length short|default|long)
/sr status [title]               a run's progress + permanent share links
/sr updates                      runs you started from chat (newest 20, any status) + their links
/sr waiting                      what waits on you: every research's open alerts and the pauses it can
                                 resume, then what waits on you on the computers you host (reads only)
/sr list                         every research on the account, any status
/sr podcast [title]              the run's audio, sent as a native voice message
/sr video [title]                its video: the YouTube link, else a link that plays it (shared after a yes)
/sr pause [title]                hold a run (resumable)         ·   /sr resume [title]
/sr retry [title]                resume a run waiting on a decision / error (a start that never
                                 reached its computer, or --start: the research's own page to start it;
                                 --part video|doc: the video's or the Doc's own Retry)
/sr use-api [title]              an alert's other buttons: Use API (paid) · continue-chat · type-it-myself
                                 (the next message is the brief: brief "<text>") · go-on-without <agent>
                                 · stop --alert (each is the alert's own button: no second question)
/sr skip [phases|agents] [--run title]
                                 trim phases (brief/podcast/video/report) or P2 research
                                 agents (chatgpt/gemini/claude) — the turn-off card first;
                                 bare = clear the blocker
/sr part on|off <part> [--run title]  turn the brief, an agent, NotebookLM, the video or the
                                 email on or off (card first; the video on says its price)
/sr stop [title]                 gracefully stop a run (keeps results + chat)
/sr cancel [title]               take a research still waiting out of the queue (card first; never a stop)
/sr rename <title> <new name>    rename a research (shows its card; acts on yes)
/sr archive <title>              archive a finished research  ·  /sr restore <title>  (each shows its card)
/sr delete <title>               delete a research for good — messages, documents, podcasts (red card first)
/sr run-on <title> <computer>    a start that never reached its computer, run on another online one (card first)
/sr add-context <title> <words>  add to the brief of a research still in Phase 0–1 (card first)
/sr analytics [title]            how a research was made: its analytics page and numbers (opens only for its account)
/sr analytics --view overview|agents|timeline   the Analytics page's numbers for your account
/sr docs [title]                 a research's documents, in the website's order
/sr read <doc> [title]           read one: brief · chatgpt · gemini · claude · super-research · summary
                                 · consolidated (first 8,000 characters, then its page link)
/sr sources [title]              the source pages each agent saved, by agent
/sr events [title] [--limit N]   what happened in a research, oldest first (20 by default, at most 50)
/sr transcript [title]           its podcast's transcript (the players' one, else the podcast's own)
/sr archive-docs [title]         archive every document of a research  ·  /sr delete-docs [title]  delete them all (cards first)
/sr delete-doc <doc> [title]     delete one document for good  ·  /sr restore-doc <doc> [title]  bring an archived one back
                                 (the Super Research document takes its Summary; cards first)
/sr podcast-archive [title]      archive a research's podcast  ·  /sr podcast-restore [title]  bring it back
/sr podcast-delete [title]       delete a podcast for good, with its files (cards first; --audio ID when it has several)
/sr transcribe [title]           transcribe its podcast and keep the transcript with it  ·  /sr album-art [title]  new
                                 album art in your own style (each its card first; --audio ID when it has several)
/sr share <doc|podcast|video> [title]  a new link anyone can open to one document, the newest podcast or the
                                 video (red card first; Revoke All Share Links takes them back)
/sr video-delete [title]         delete its video kept in Super Research; its YouTube video stays (red card first)
/sr make-video [title]           make a video of a finished research's podcast later: its one question and price
                                 first ("about $N", at the research's own video quality, else the one an admin
                                 held it at, else your Settings' — Audio's is Standard's); its one retry too
/sr cancel-video [title]         cancel a video made later, while it is made or once it failed (card first;
                                 never the research's own Phase 4 video — its Stop stops that)
/sr video-quality <audio|standard|ultra>  the video quality of every new research from then on (card first;
                                 one already started keeps its own; Audio puts the podcast on YouTube over its
                                 album art, free); --run <title>: that research's own quality alone, Settings
                                 as they are (its own card)
/sr clear-all <podcasts|videos>  Manage Data's Clear All Podcasts (their videos go too) or Clear All Videos
                                 (red card first; then the page's own line, "Cleared 3 podcasts")
/sr clear-all <researches|chats|documents>  Manage Data's Clear All Researches, Chats or Documents (red card
                                 first; chats also clears Chat with Super Research's History, through the
                                 website's own route)
/sr revoke-share-links           Manage Data's Revoke All Share Links (red card first)
/sr reset-analytics              Manage Data's Reset Analytics: every research's agent stats and phase timing
/sr own-channel [off|visibility <v>|on]  your own YouTube channel (call 24): read it (on or off, the channel,
                                 its Visibility); turn it off or set new uploads' Visibility (card first); on = Settings
/sr archives                     Manage Archives: archived researches, chats, documents and podcasts (restore/delete each by its card)
/sr drive-disconnect             stop making report Docs in your own Google Drive (card first; the Docs there stay)
/sr settings [notifications|fallback|autopick]  your Settings as the page draws them, every notification pill;
                                 fallback = "Use the API when an agent is stuck": its line and an admin's flip;
                                 autopick = Auto-pick a free computer's row and what it does
/sr setting <key> <value>        change one setting (card first): theme, startPage, agentClaude, skipBrief, autoPick,
                                 autoFallbackApi (red, paid), skipVideo, storePodcasts … ; a notification's
                                 channel: setting notifications on|off --category <c> --channel inApp|push|email.
                                 A switch an admin has off for everyone (Auto-pick, the API fallback) reads Off
                                 and changes nothing. setting podcastLength <short|default|long> --run <title>:
                                 that research alone, while it is queued or running; Settings stay as they are
/sr name "<new>"                 Account → Profile's Name, the one people sharing a computer see (card first)
/sr report-email <address>       where Phase 5 sends the report (a red card first); --resend: its link again
/sr analytics-opt-in on|off      Privacy → Add my research to DG Analytics (card first; red when it goes on)
/sr notifications                what is in the notification bell, newest first (reads only; an admin's notices
                                 are /admin's own bell's, never listed, counted, opened, marked read or cleared)
/sr notifications-read           the bell's Mark all read (card first); notifications-clear: Clear (red card)
/sr notification-open <title>    one notification's page as a link, marked read (a New public computer row
                                 offers its ask by name instead, or Join for one that lets anyone in)
/sr sessions                     where you're signed in: every browser Settings → Security lists (reads only)
/sr session-signout "<device>"   sign one device out of your account (card first; "Chrome on macOS", "my iPhone")
/sr signout-everywhere           Sign out everywhere: every device, and this agent too (a red card first)
/sr agents                       your connected chat agents, by name and runtime, as Shared with lists them (reads only)
/sr agent-rename <name|this> "<new>"  rename a connected chat agent (card first; "this" is this agent, whose new
                                 name it keeps across a sign-out)
/sr agent-disconnect <name>      disconnect a connected chat agent (a red card first; this agent signs out at once)
/sr host-alerts [computer]       what waits on you on the computers you host (answers: host-answer)
/sr host-answer <verb> [--computer name] [--person name|me] [--alert words]
                                 retry · use api · skip · stop · keep going · resume
/sr devices                      list devices  ·  device-use <name> (the website's default
                                 computer, the selected one; its card first)  ·  device-remove <name> (leave a
                                 computer shared with you, card first; one you host: its tile)
/sr devices-public               computers other people offer   ·   device-ask <name|id>
/sr device-requests              who's asking for yours, and what you're waiting on
/sr device-approve [person]      ·   device-deny [person]   ·   device-visibility public|private [name]
/sr device-allow-all yes|no [name]   anyone who asks joins at once (yes also makes it public; the people already waiting join too only with the count its question showed)
/sr device-rename <name> <new name>   rename a computer you host (shows its card; acts on yes)
/sr device-leave <name>          stop using a computer shared with you (card first; a host is sent to its tile)
/sr device-reset <name>          hard reset the backend on a computer you host (red card first)
/sr device-people <name>         who uses a computer you host (names only)
/sr device-revoke <name> <person>    remove a person from a computer you host (red card first)
/sr device-let-in <name>         let the people waiting in, while Allow all is on (red card names the count)
/sr worker-add [name]            add a worker to a computer you host (its card first; then the computer's answer)  ·  worker-remove [name] (the last one, a red card first)
/sr worker-signin done|cancel|try-again [name]   the reply right after a “Sign in on …” line
/sr worker-rest [name] N [--note …]  rest a free worker (its card first; the last awake one asks “Pause …?”)  ·  worker-wake [name] N
/sr worker-move [name] N [--note …]  move a busy worker's run to the queue (its red card first; the computer's answer 20 s on)
/sr computer [name]               what's on a computer you host: its workers, the + and the hold, each person's run (alias workers-on)
/sr run-press <name> [person] [reply] [--run ID]   someone else's run there: its card, then the press they reply with
/sr startup [name] on|off         On StartUp: the command to run on that computer (or to ask its host for)  ·  startup-check [name] on|off (what the computer says)
/sr computer-keys                on the research computer itself: its API keys, set or not, where, and which key a research uses (never a value)  ·  computer-add-key (how — never through chat)  ·  computer-remove-key <provider> (its red card first)
/sr computer-settings [NAME=value]   its host settings (never `--dev`); NAME=value sets one, its card first  ·  computer-remove-setting <NAME> (its red card first)
/sr computer-workers [N]         its workers and what its memory suits; N keeps N, its card first (adding one worker anywhere is worker-add)
/sr page <kind> [name]           the website page for a step done there: a computer's tile, Shared with or lost access code, a research's brainstorm, read aloud or document, Settings → About, uploads to your own YouTube channel, or Podcasts (the player's queue, chapters and Settings)
/sr send-logs                    package logs for support — prints the plan, sends nothing
```

A bare `/sr` is the welcome + help. **Every account action needs `/sr login`
first** — the agent operates as an authorized session on your account, so it's
signed in before it can list devices, start research, or pair.

Nothing has to match a row: anything the runtime can't place goes to the client's
own `do "<the message, verbatim>"`, which resolves the intent **in code** — so a
plain sentence runs the right command (or asks the one missing thing) rather than
falling back to the chat runtime's own tools.

**Long waits.** A few commands wait longer than a chat runtime's terminal tool
waits by default — Hermes cuts a command at 180 seconds unless the call asks for
more, up to 600 — so SKILL.md's row for each of them asks for a terminal
`timeout` that covers that command's whole wait, its yes line included (`do`,
which may run any of them, asks 420). A change that is still landing is never
cut off and read as a failure.

**An incognito research is the website's.** It keeps nothing — not even in a
chat — so this chat never starts one: "research EV batteries incognito", "start
an incognito research on EV batteries" or `sr.py research "EV batteries
incognito"` answers with the website's *New incognito research* page, where the
topic is typed, and starts nothing. "Incognito" that belongs to the topic
("research Chrome's incognito mode", "how to browse incognito") starts the
research as usual.

**A run's name.** A research you start from chat is saved with your whole topic
as its title. When the Research Computer picks it up, it gives the research its
one short name — up to five words, made by the app's own namer, or the topic's
first five words if the namer can't answer — and rewrites the chat's opening line
in the app to match; the NotebookLM notebook and the podcast carry the same name.
A name you set yourself in the app is never replaced. `status`, `list` and
`updates` show that name, and a `[title]` you type still matches words of the
topic too. (This happens on the computer and came after backend 0.1.14, so a
computer on 0.1.14 or older leaves the topic as the title.)

**Which computer a run goes to** is one decision, made in one place, and the
sign-in auto-start uses the identical ladder: the selected computer → the sole
computer on the account → the sole one that's **online** → otherwise it asks.
The selected computer is the **website's** (`activeDeviceId` in your settings —
the sidebar's pick, which `device-use` sets too); the agent keeps no pick of its
own, and an old one left in `prefs.json` is removed unread when the bridge
starts. With nothing selected, the rungs choose as the website does: among the
computers you own or have picked before, while one of them can run — a computer
only shared with you is chosen on its own only when none of yours can.
**Online** rests on the machine's own heartbeat, read from the server-stamped
copy where there is one — one clock for the writer and the reader — and falling
back, permanently, to the older machine-clock stamp for a computer that hasn't
upgraded. Two disagreeing clocks are how a switched-off computer reads online,
which is the one thing this rung must not get wrong.

**When that computer is busy**, a new research with no computer named asks the
website's router where to start (`POST /api/runs/pick-computer`, what the
website's own start asks), and starts on a free computer in your list when it
answers one — never off your own computer onto someone else's, and never at all
while *Auto-pick a free computer* is off, yours or for everyone (the route
decides that itself). The reply then says which computer was busy and where it
went. As the website's start does, it does not ask when the selected computer
reads offline or there is no second computer the research could go to. A
computer you name, an incognito research and a Retry are never moved;
an answer that is not used is given back, and a router that does not answer
within 5 seconds (or an older website without it) leaves the research where it
was going. Your selection does not move with it.

**A computer named in the words** is a named start: "research EV batteries on my
Studio PC" starts there, as `--device` does, and the router is never asked. Only
"on", at the end of the words, names a computer — one of yours by its whole name,
hostname or id; after "my" only one you own, and a shared computer whose name is
one plain word never by that word alone. Words after "on" that name no computer of
yours, and any "with …" or "using …" ending ("research how to pair AirPods with
my Mac"), stay in the topic; options said before such an ending ("…with a short
podcast using my Studio PC") are read as options only when the ending names one
of your computers. Two computers for the same words get the picker's question,
and nothing starts.

Two refusals are deliberate. A computer part-way through being set up again is
named and refused rather than quietly swapped for another — your research running
somewhere you didn't choose is the same broken promise with a surprise on top —
and it keeps your selection, because the machine is still yours. An account with
no computer at all routes to the empty state below, never to "pick one from an
empty list".

### What arrives in chat on its own

Almost nothing, and that is the design. A **streaming watchdog** — armed by the
client itself for the chat you're in (`arm-stream`), and scoped to the runs *you*
started from chat — posts unprompted for exactly four things about runs: **one**
completion message per run, carrying every phase's permanent, non-revocable Super
Research link, plus "the results have been emailed" only when that run's email phase
was on; a run that **needs you** (a sign-in, a verification, a snag, an error), with
how to answer it from chat; a run that was stopped or cancelled, from either
surface; and a run the computer's host **moved back to the queue** (with their note,
once per move), then one line when it runs again. It also carries the one-shot notes the bridge parks for that chat — a
sign-in, a public computer's owner saying yes, a support bundle landing (or still
not, after half an hour), a Resume the computer did not take up, and a computer's
answer to a worker change asked from that chat when it comes after the reply.
And when someone else's research computer becomes public,
it says so once each time, in the website's words ("New public computer — Lab Mac
is open to everyone. Ask to use it from Public computers."), with the website chat's
ask card for that computer in the same message ("Ask to use “Lab Mac”?" and what
asking means) — or, for a computer that lets anyone in, its join card ("Join “Lab
Mac”?"); a yes runs `device-ask`, and nothing is asked without one. The
website's server keeps count of what was said, so a computer that goes private and
public again is said again; the bridge keeps no list of its own. The yes asks for
the computer the notice was about, even when another public computer has the same
name: the bridge remembers, in memory and for a day, which computer each notice it
handed out named — only to resolve that yes, never to decide what is said — and
the id is never shown. Only the watcher's own read takes any of these notes, and a
read a web page makes your browser send (a `Sec-Fetch-Site` other than `none` or
`same-origin`) is refused before anything is read, so another site cannot use them
up. Where the chat runtime can compute cron expressions it
ticks on every minute boundary, otherwise every minute from its last run; on Hermes
the bridge can also run it immediately (`push.py`). A sign-out leaves it in place,
silent until the next sign-in; only `agent disconnect` removes it. It never
prints anything but the message itself — its own record is
`~/.super-agent/watcher.log`.

It deliberately does **not** narrate phase by phase — progress and the links so
far are what `/sr status` is for — and it prints nothing at all when there's
nothing new, so the chat is never spammed. The revocable platform links
(NotebookLM / YouTube / the final Doc) are never pushed, because they don't open
for someone who isn't signed in. If its ticking stops, the next `status` /
`updates` you ask for re-arms it rather than letting the chat go quiet for good.

### Computers other people offer

Being **findable** is discovery, not access. `device-visibility public` lists a
computer you own for other signed-in people, who can then *ask* for it; you
approve each person by hand, and `device-visibility private` takes it off the
list again (an access code still lets someone in without asking you, and anyone
who already joined keeps access — remove people in the web app (Shared with)). From the
other side, `devices-public` browses what's on offer and `device-ask` puts you in
that owner's queue, and nothing happens on their machine until they say yes.
The owner sees your name and email.

**Allow all** is the one exception, and it is about access. `device-allow-all
yes` (confirmed first) lets anyone signed in join a public computer you own at
once — up to 25 people. They run research on your AI accounts and can see your
email, who else is on it, and what's running on it. People you removed stay out.
It makes the computer public too if it wasn't; `device-visibility public
--allow-all` is the same step. `device-allow-all no` goes back to approving each
person (the computer stays public); going private switches it off as well.
Neither removes anybody: anyone who already joined keeps access — remove people
in the web app (Shared with).

On the other side, a public row marked *joins at once* lets `device-ask` in
straight away: the reply says you're in, says whether your research now goes
to it — only when none of your own computers can take it — and starts a held
research topic — nothing arrives later. The join saves nothing: while a computer
of yours can run, an unnamed research goes there, so it never moves off a
computer of your own and you are not asked "which computer?" afterwards.
A computer of yours part-way through a Reset counts too: until the re-pair an
unnamed research is refused by name, and it comes back to it once the re-pair
is done.
The owner sees your name and email.

**Where that setting starts is not here.** The machine's own `--pair` asks it
during setup, in a step of its own, and on a new pair the answer defaults to
*no*. `--pair` again on a computer that is already linked carries on with that
same computer, and there the default is what the computer is now, so Enter keeps
it public or private. A computer paired before that question existed carries no
answer at all and reads **private**, like every other absent one. Afterwards
three surfaces change it, all three writing the same single field on that
machine's row — `device-visibility` from chat, the owner's toggle on the app's
Account page, and `superresearch --visibility public|private` on the machine
itself (bare `--visibility` prints where it stands and changes nothing). A
carry-on `--pair` is a fourth: it asks the question again and writes the answer
to that same field.

`device-requests` prints **both halves** of the queue and never sums them: people
waiting on your computers first, then what you're waiting on from other people.
`device-approve` / `device-deny` answer the first half — a **no** blocks that
person asking again for a week, and handing them the access code is still a way
back if you change your mind. From chat a yes or a no is for one person at a
time, and it names them: "let Sam use my mac" (or "let my friend Sam use my
mac") asks about Sam by name, and a waiting person is found by whole words of
their name, never a piece of one. A group, or one of your own people said
without a name ("my team", "my wife"), names nobody: the chat says it answers one
person at a time, and answers nobody until you name them.

Once you're in, **starting a run tells that machine's owner** — the same notice
their browser sends when a run is submitted from the web app, now sent by the
agent too, so a run you fire from chat is no quieter than one fired from a tab.
It can name you because the agent is signed in as *you*, not as a machine. On a
computer you own there's nobody to tell, and no notice goes out.

⚠ These verbs take their arguments differently on the two surfaces, on purpose.
In **chat** the person and the machine are optional — with one person waiting or
one computer owned, the client picks; with several it prints the queue rather
than guessing. In the **terminal** everything is named by **id**
(`agent device approve <deviceId> <requesterUid>`, `agent device visibility
<deviceId> public|private [--allow-all]`, `agent device allow-all <deviceId>
yes|no`), because a queue row's label is a snapshot taken the
day somebody asked and falls back to a word shared by everyone the app couldn't
look up. `agent device requests` prints the whole command for each row.

**Organizations are not set from chat.** No command here makes, joins or changes
one: organizations are set on the computer with `superresearch --org on`, and by
admins in /admin, and asked about one ("let my org use my mac", "is my mac in an
org?") the chat says just that and runs nothing. A computer in an organization
is "Hosted by" its organization's host label, where one stands, for the people
using it — else by its host's own name — wherever the agent says who hosts it.

An account with **no** computer is not a dead end. Every screen that reports it
renders the one empty state — there's no computer here · "Add a computer: set one
up at https://superresearch.io/install." · "If someone gave you an access code, or
once your computer shows one, enter it in Account → Pipeline Connection:" with
https://superresearch.io/account on its own line · or ask to use somebody
else's — and the full ones **list** the public computers on offer, because "ask
for a public one" with no list is advice rather than a next step. The install
link sits inside the add line rather than after the list: a relay that condenses
the screen keeps that sentence and drops a trailing paragraph.

### Sending logs to support

`send-logs` is **always two steps**. The bare command prints exactly what would
leave that computer — which runs, how big, who can read them — and sends nothing;
only an explicit confirm sends (`--confirm` from chat, a `y` at the prompt, or
`-y` in the terminal). What comes back is an 8-character **support code** to
quote.

- **Your runs, and nothing else.** The Research Computer decides what matches the
  person asking, so on a shared machine this never hands over somebody else's
  research. The plan numbers every run; `--runs` takes those numbers or the run
  names, and `--runs all` is everything listed. On a computer whose backend is
  newer than 0.1.14 a run is one research, however many times it ran there (a browser
  restart, a move to the queue and a Retry all write into the same folder), so
  one number sends the whole of it.
- **`--machine`** adds that computer's *own* logs — its pairing and sign-in
  records and its raw activity trail, which cover every run it has ever done for
  everyone who uses it. **Owner only**; anybody else is refused.
- **`--agent-log`** (and `--runs 0`, the number the plan prints for it) adds the
  log from the agent on **this** host — a connection and sign-in record, not
  research content. There is **no ownership gate** on it, it covers everyone who
  signed in through this agent, and the rotated copies go too. It can also travel
  **alone**: `--agent-log --none` sends that file and nothing else, under a
  support code of its own, with **no Research Computer involved** — which is the
  point, since the two commonest reasons to be sending it are having no computer
  paired and not being able to reach the one you have. Deleted automatically 30
  days after it arrives.
- **`--status <CODE>`** reports on a code instead of sending. **`--device`** aims
  at a computer other than the selected one — by **name or id** from chat, by
  **id** in the terminal (the same asymmetry as the device verbs above).

Terminal-only extras: `--list` (show what's held, send nothing — it never
uploads, even with `--runs 0 -y`), `-y`, `--wait <seconds>` (default 180) and
`--no-wait`. ⚠ `--no-wait` cannot carry the agent log up beside a bundle — the
plan says so before you agree, and hands you the follow-up command.

### Versions + updates (from chat)

```
/sr version        the SKILL version only, with a "⬆ newer available" nudge when a newer
                   one is published (also surfaced on the welcome). The backend's version
                   lives in the app's Settings → About — chat never states it
/sr update         update the SKILL (this chat's scripts + bridge; alias: /sr update-skill)
/sr install        install the backend on this host (turn this PC into a research host)
```

`update` (alias `update-skill`) updates **only the skill** and replies "already up
to date" when nothing newer is published. Natural language ("upgrade") routes here
too. A newer published skill is also said once per version, at the end of your
next reply — never as a post of its own, and not after a `version` or `update`
that has just said it. The agent no longer updates the **backend** — a "update Super Research / the
backend" request is redirected: run `superresearch --update` on the Research
computer (idempotent), or update from the app (Settings → About → Check → Update).

In the **terminal**, `agent version` prints both lines — this package (with its
own "⬆ available" nudge) and the backend's version when Super Research is
installed on the same machine. `/sr version` additionally flags a **stale
chat-side copy**: the runtime executes its own copy of the `/sr` scripts, and
only `connect` / `update` redeploys them, so upgrading the package on the host
alone leaves chat running old behaviour.

---

## Reachability — the bridge runs WITH the runtime

The bridge binds **loopback only**, so it can only be reached by a runtime on its
*own* machine — which is why `connect` co-locates them:

- **Co-located** (runtime native on the same OS — Win+Win / Linux+Linux /
  macOS+macOS) → shares loopback, **zero setup**.
- **WSL runtime** → `connect` detects it and runs the install **inside WSL** (the
  bridge then shares WSL's loopback with the runtime) — no Windows↔WSL
  networking, no `.wslconfig`. Each side-effecting step still waits for your Y.
- **Different machine** → can't reach a loopback-only bridge → **unsupported by
  design** (exposing the bridge on the network would break its security model).

---

## Keep it always-up / tear it down

```sh
agent resurrect    # pin to login + start now, windowless (Scheduled Task / systemd --user / launchd)
agent restart      # cycle the background bridge onto the code on disk (after an upgrade) — keeps the pin
agent retire       # stop the background bridge + remove the logon pin
agent serve        # run the bridge in THIS terminal (foreground) instead
agent stop         # stop the running bridge
agent disconnect   # FULL teardown — remove the skill from the runtime AND sign out,
                   #   then offer to stop the background bridge + unpin it (yes by default;
                   #   from chat or with --yes it just does). The app's "Revoke" is a pure
                   #   sign-out and KEEPS the skill + bridge, so this is the only full teardown
```

The account session persists (the selected computer is the website's), so a
restart resumes without re-login.

> **`agent <cmd>` shorthand** — equivalently:
> `superresearch agent <cmd>` (installed backend; delegates to `pipx run
> superresearch-agent <cmd>`), `pipx run superresearch-agent <cmd>` (standalone),
> or `python research.py agent <cmd>` (from a backend source checkout). Pick
> whichever matches how things are set up.

---

## Sign-in

`agent login` (and `/sr login`) default to the **web app**
(`https://superresearch.io/connect`) — the same page everywhere — brokering an
approve-on-your-phone flow that makes only **outbound** calls (no localhost
needed). `agent login --local` is the host-local Google page
(`http://localhost:9876/login`), a fallback for when the web app's sign-in start
fails. It is not independent of the web app: its Google window opens on
`superresearch.io` too, so it cannot help while that site is down.

```sh
agent login --remote --runtime hermes
#  Log in here: https://superresearch.io/connect?runtime=hermes&code=WDJB-MJHT
#  Or, if the link won't open (for example on another device): go to https://superresearch.io/connect and enter this connection code: WDJB-MJHT
#  Either way, check the page shows the same connection code, then tap Authenticate.
#  ✓ Connected as you@…
```

**You don't have to come back and say you signed in.** The bridge parks a
one-shot "✓ Signed in" note — in memory *and* on disk, so it survives the process
that minted it — and the chat watchdog posts it proactively. A research you asked
for while signed out is routed by the **same ladder** as a fired run (above), and
names no computer, so it asks the website's router where to start as one does;
that note can name the computer it started on, ask which of several should take
it, or show the no-computer screen — instead of asking you to repeat the topic.

In chat, a plain sign-in is **"✓ Signed in as &lt;your email&gt;."** and nothing about
computers — the watcher's note, `login-done` and a plain "am I signed in?" alike.
The no-computer screen appears only when a research you asked for while signed out
has nowhere to run. A chat reply takes the parked note (`POST /signin/ack`) so the
watcher does not say it after the reply: `login-done` takes it with its news and
relays that news; `status-account` and `login` take only a plain note and leave one
that carries news for the watcher. If the watcher speaks first, your next "done"
is still answered with the sign-in line. Asking to log in while already signed in
says so and starts nothing; to switch accounts, log out first.

`agent serve` writes a durable, rotating operational log to
`~/.super-agent/bridge.log` (request + run-lifecycle lines; never a token);
add `-v` / `--verbose` for DEBUG. Neither a flag nor an env var reaches a
**pinned** bridge — the launcher starts it with a fixed `serve` and none of your
shell's environment — so use `agent verbose on|off`, which writes a pref read at
bridge start (`agent restart` picks it up; on a WSL runtime the command is
delegated into the distro, where that pref file lives). `agent doctor` prints
where the log is, whether anything is in it, and how to send it — and it prints
that row **before** the bridge check, because a bridge that won't start is
exactly when you need the file.

---

## Developing (from a backend source checkout)

You don't need the published package to hack on it. Run the agent through the
backend's **`agent` front door** — it never imports the agent package, it just
fronts it, so the agent stays an isolated sub-package + process:

```sh
cd <the backend checkout>
python research.py agent <command>      # connect / serve / login / status / doctor / device /
                                        # research / watch / send-logs / verbose / restart / …
python research.py agent --help         # full command list
python research.py agent                # bare → smart entry: status if set up, else connect
```

Standalone `agent` command + the test suite:

```sh
cd <the backend checkout>/agent
pip install .[dev]      # standalone `agent` entry point + pytest + ruff
python -m facade <cmd>  # or run module-style without installing
python -m pytest        # the test suite
ruff check .
```

The suite never reaches the network — a test that tries fails, naming the host —
and never touches this machine: each test gets its own `~/.super-agent` prefs,
`~/.super-research`, `watcher.log` and login pins, and the programs that read or
change the machine (WSL, Task Scheduler, the registry, PowerShell, the process
table, `superresearch`, pipx and uv installs, service managers) are refused
unless a test fakes them. The tests that hold the agent to the website read a
website checkout: `SR_WEB_REPO` when it is set (a path that is not one fails),
else the `dg-research` folder beside this checkout (for a worktree, beside its
main checkout). On Windows, run it with Git's `bin` and `usr\bin` first on PATH:
a bare `bash` there is WSL's launcher. `TESTMATRIX.md` maps the files to what
they cover.

The agent's only runtime deps (`requests`, `keyring`) already ship in the
backend's `requirements.txt`. Requires **Python 3.11+** (the chat-side scripts
run on the chat runtime's own Python, standard library only).

---

## The "nothing breaks" contract

A **separate process** that never touches the existing app:

- No import of, or write to, the back end (`research.py`) or the website's code.
  ⚠ One door is named: on the research computer itself, for its host, chat runs
  that computer's own `superresearch` CLI to read its keys, host settings and
  workers, and to change one after its card (`backend_cli.py`: an allow-list of
  argument shapes, never a shell, never `--login`, `--add-key`, `--pair`,
  `--unpair`, `--update` or `--org`, and never a key's value).
- Its own secret-store namespace (`super-agent`, `~/.super-agent`) — **never** the
  device daemon's `super-research` keystore. The account refresh token and the
  device refresh token are different Firebase users; isolating them means a
  refresh here can't disturb a paired device.
- Writes only what a normal account client may write, every write gated by the
  Firestore rules. ⚠ The authoritative list is **not** prose — a hand-kept one
  here was wrong twice — it's the path allowlist in
  `tests/test_app_plane_unchanged.py`, read out of `firestore_rest.py`, which
  fails when a write escapes your own tree or a device you're a member of. (A
  path isn't the whole permission, which is why two more tests sit beside it:
  one pins the device-command *action* this client may ask for, one pins the
  single field name it may PATCH.) No keystore change, no queue / claim /
  pipeline change. The one rules addition is an owner-only match block for
  `users/{uid}/agentSessions/{id}` — a verbatim mirror of the existing
  `users/{uid}/sessions` block, because rules v2 doesn't inherit the parent
  `users/{uid}` allow into subcollections.
- **It never writes membership.** Pairing, unlinking, leaving, removing a person,
  letting the people waiting in and answering an access request all forward to
  `/api/devices/*` and are authorised there against your own session; this
  package holds no admin credential and can grant itself nothing. ⚠
  `device-visibility` and `device-allow-all` are the device verbs that do *not*
  forward — no web route for them exists — so they PATCH `devices/{id}` directly
  with literal update masks (`visibility`, `allowAll`, or both in one patch when
  Allow all goes on), on the owner's own token; a computer's rename (`name`) and a
  worker's rest, wake or move (`restingWorkerIds`, `restNote`) PATCH it the same
  way, as the website's own pages write them. The rules examine `visibility`'s
  **value** — one of only two fields on the document where they do
  (`visibility`, and `joinPolicy`, the rename the rules already admit and
  nothing writes yet) — and the collection is `allow create: if false` for every
  client, so a wrong id fails rather than minting a machine. It **reads** both
  names, the old one first, because `visibility` is still what the app and the
  machines act on; a document carrying neither reads as *private*.
- **It never publishes a device row whole, either.** The device list arrives
  from the app with every field on it — including, on a machine whose access
  code was never rotated, that code in plaintext, which is the credential that
  claims the machine. So every surface that leaves this process (your devices,
  the public browse list, and the two halves of the request queue, which are two
  different lists) is a named key-set, and the exact keys are pinned by test.

---

## Layout

```
facade/
  config.py          public Firebase config + bridge host/port/store + FE base
  store.py           secure session store (keyring + 0600 file fallback)
  prefs.py           non-secret prefs (runtime, install id, the saved site, an old selected
                     device to remove, verbose switch, the parked one-shot notes, a held topic)
  site.py            `connect --site`: an organisation's own site, checked and saved
  session.py         AccountSession — refresh-token / custom-token → ID-token
  firestore_rest.py  minimal Firestore REST (researches/devices, upsert, enqueue, cancel,
                     agentSessions, the device `visibility` / `allowAll` / `name` / rest
                     PATCHes, and every other write, each its own typed method)
  devicelogin.py     remote-login device-flow client (→ the SR web app broker)
  branding.py        the CLI's branded screens — a self-contained mirror of the backend's
                     `--pair` look; imports nothing from the app
  selfupdate.py      PyPI version notices + skill self-update (agent reconnect-from-latest,
                     --no-cache) + disconnect cache-wipe — detached; backend updates are
                     NOT the agent's job (that's `superresearch --update` / the app)
  logsetup.py        rotating-file + console logging (--verbose)
  runview.py         flatten links.{kind} → ordered events; terminal-status set
  connect.py         install the skill into a chat runtime (+ WSL hand-off)
  autostart.py       windowless logon autostart (schtasks / systemd --user / launchd)
  bridge.py          loopback HTTP server (/login, /login/remote/*, /devices,
                     /devices/public, /devices/requests, /device/{select,pair,remove,
                     ask,decide,visibility}, /research, /updates, /waiting, /signin/ack,
                     /logs/{runs,send,bundle,agent-log}, /version, /agent-install,
                     /install-backend, the /chat/<area>/<verb> card routes, …)
  cardproto.py       the one card pattern: a change's card first, then a yes that names it
  chat_*.py          the chat features by area — research, starts, things (documents, podcasts),
                     media, video, data (Manage Data), settings, account, bell, sessions,
                     agents, computers, host (alerts on computers you host), workers,
                     local (this computer's own CLI), own channel, alerts, reads, waiting
  backend_cli.py     the one runner of this computer's own `superresearch` (an allow-list)
  webwords.py        the website's own words, held verbatim in one place (+ runwords.py,
                     videowords.py, settings_rules.py, runrules.py, manage_data.py,
                     workers.py, analytics.py: the website's rules, ported; pagelinks.py:
                     its page addresses)
  public_notices.py  a new public computer's notice, said once, with its ask or join card
  safetext.py        another person's text made safe for this chat (+ secret_shapes.py: a
                     pasted key refused; privatelinks.py: private addresses kept out)
  worker_followups.py  a worker change's late answer, said once to the chat that asked
  push.py            instant delivery: runs a chat's sr-stream watcher NOW through
                     `hermes cron run` (never on a handler thread; one run per job;
                     re-checked before every spawn; a no-op without Hermes)
  web/login.html     Firebase Web SDK Google sign-in (TOTP MFA aware)
  skill/             the chat-runtime bundle — SKILL.md + scripts/sr.py (the chat client)
                     + sr_attention_poll.py (the streaming watchdog) + sr_update_notice.py
                     (retired: prints nothing, and removes its old daily cron row)
  cli.py             the `agent` command
```
