Docs / How it works
Local admin app (the agent's own interface)
Status: built (app/apps/admin and app/apps/server; screens Overview, Mail (home), Messengers (Chats, Settings), Activity, Knowledge, Settings (Sending, Checks, Mail, Agent, Connections, This Mac), Help; Client planned). Next.js (decision 0015). English UI only.
What
A small local web app (Next.js + React) on the owner's Mac. It shows what the agent did and holds the owner's decisions, nothing else (decision 0025): the drafts the agent left unsent in Mail, each with its reason and checks; what the agent did with every client, one group per session; the project's standing. The owner reads, then sends one draft at a time (or the Checked drafts of one batch with Send all Checked, one at a time on the server, P85b: 14-bulk-send-interface.md), skips, holds, marks done, flags a client or stops sending. Preparing (choosing clients, a brief, enrolling in follow-ups, sorting) is a phrase in a session; the admin has no form for it and shows the result. The agent may also change the app's own screens while the owner uses it (live edit); the dev server's hot reload shows the change at once.
Agents reach Mail and Notion through their own connectors (mail-mcp for Apple Mail, the session's Notion connector); the hub gives them local tools (draft_write's record and client_record (hub mcp), hub sequences, the knowledge MCP, the hub MCP with draft_write for Mail drafts, the guard) and the database; the admin shows the state those leave.
It replaces a hosted helper app and, over time, the screens of a hosted back office that the agent now covers.
Why local
- No hosting, no auth layer, no deploy chain: one owner, one Mac.
- The agent can read and edit the code of the app it serves; a hosted app cannot be changed that way.
- Data stays on the Mac: mail in Apple Mail, working state in
data/app.dbandstate/underHUB_HOME, Notion through its MCP.
Components
Base: coss ui (https://coss.com/ui), built on Base UI + Tailwind v4, shadcn-like registry plus a
particle catalogue of ready patterns. Skills coss and coss-particles are installed globally
(~/.agents/skills, symlinked to Claude Code). Rules from the skill that bind us:
- use existing primitives and particles first; do not invent APIs, check the docs;
- Drawer replaces Sheet; Hub's own rule is stricter: no dialogs or sheets for primary work, use inline disclosure;
- Tailwind v4 and
@base-ui/reactrequired. - The copies and the product primitives live in the package
app/packages/ui(@hub/ui), imported by subpath (@hub/ui/button,@hub/ui/product/action-button,@hub/ui/cn) with the tokens in@hub/ui/styles.css; the admin keeps only what knows its routes, hooks and API. Rules:app/@rules/architecture-and-ownership.mdrule 15.
The core workspace also has app/apps/storybook (@hub/storybook) as the
visual theatre for these shared surfaces. It runs Storybook 10.6.8 (the
current stable release recorded for this workspace), composes public @hub/ui
subpaths with local fixtures, and never imports admin features, generated
clients, project data or runtime sessions. The baseline stories include the
agent panel (AgentPanelFrame, the terminal view, resize dock and dictation
control), the shared Mail/Messenger conversation frame, the visual Markdown
editor, list/detail shells, identity and filter controls, tooltips, themes and
the main page/product surfaces.
Use pnpm storybook for the interactive theatre, pnpm storybook:typecheck
for its TypeScript boundary and pnpm storybook:build for the production
artifact. A new reusable product surface is not complete until its named
light/dark, narrow and interaction states are represented there; Storybook is
an adopter and contract, not a second place to implement UI.
Messenger settings have one compact project-level policy (language and global instruction; the response mode and provider were deleted, P119 C2). Per-chat reply mode, language, pre-analysis and instruction controls are advanced exceptions under linked chats (the follow-up rule is gone since migration 0040); nothing delivers in the background, and every Messenger response is an unsent draft until the owner's Send, or decision 0046's owner word, passes the guarded send door (P112 S2). Decision 0048's autopilot (P139 A5) is the one exception, in chats the owner switched on: the stock Switch (through SettingSwitch) "Autopilot" in a linked chat's conversation header and on its line under Linked chats, with a state line under the header's facts ("Autopilot · answering", "Autopilot · dry run", "Autopilot · paused:
Shape
reforms-hub/app/: Next.js (App Router) + React + coss; real paths, with the project as the first segment when the instance has two or more (/<project>/mail/42; one project:/mail/42), declared insrc/routes(one table ofdefineRouterows) and typed by the framework's typed routes. The pages are a client of a thin local server (Hono, on 127.0.0.1 only): the browser calls/api/...on its own origin and Next forwards it. The app holds no database handle, no secret (Settings ▸ Connections and Messengers ▸ Settings may send a Notion or Telegram token to the server for storage and never receives or keeps one: decision 0020; mail has no key: decision 0026) and no Server Action; aproxy.tsrefuses a foreign Host or Origin.- Screens (P70: six sections, seven since P71 M3, eight since P144, declared once in
src/routes/table.ts): Overview (every instance, address/overview: with two or more projects one sentence and one table row per project first, then on every instance "Needs you": each part of the Hub that is broken or needs a look, with what is wrong, the fix line and one link, or one line "Everything works", and the full parts table folded under "All parts"; read fromGET /api/scheme; links only, no control but a part's local Open: P87, "Apple Mail is not running" with Open Mail, the owner's click through the P61 door, the Hub never opening Mail itself; P133, P129 verdict 11: "Agent stopped", a refusal of the agent's tool only the owner can fix (Mail not running, Mail not allowed, Notion unavailable, the session unable) with the refusal registry's fix line, fromowner_fixes, until the tool's next successful call or 24 hours), Mail (Drafts until P96, the home of every instance, chordg e; P99 one conversation per client: it lists people, not drafts, one row per client with mail (a draft, a message the server's read-only Mail reader kept,apps/server/src/mail/inbound.ts, or an owed row the agent escalated), newest activity first, each with one state word derived from the Hub's rows (@hub/dbconversations: Wrote you, Draft ready, On hold, Waiting for them, Done); its views are the sidebar's children Needs you (the default), Waiting, All, Leads and Sent, the header line naming the view on screen (a phone keeps it as the View menu), and the filter button beside the search holds Follow-ups, Not by email and, with two or more brands, the brands (?brand=, P134);/mail/c/<client id>opens the whole correspondence across threads (threads by the mail headers only, the thread with the newest message last: P140), a divider per thread with its subject, brand and our From, read from Mail on open through AppleScript (apps/server/src/mail/conversation.ts, about a second; never stored, the bodies read on demand and kept in the server's memory; the Hub's own rows when Mail cannot be read), and at the bottom the one open draft as the unsent message, the card body with the Mail text, the checks, Checked, Send, Skip, Hold, Done and Undo; a person who wrote with no draft has Prepare reply, No reply needed, Spam and Delete (P147 3n: their newest message to Mail's Junk or Trash, recoverable there; keys!and#/Backspace; Spam is the primary and the row carries a "Phishing?" chip when the mail pass or the agent judged it phishing or junk; a selection's Spam N and Delete N move the picked people's mail); leads are Mail ▸ Leads (/mail/leads, P134; decision 0044): every lead of a view (New, Not now, Spam, Replied: P138, a segmented control in the list header with counts,?view=), grouped by day, each row its name, brand, time, the website or first site and chips of country, segment and volume, a dot when it arrived after the last visit, beside the open lead's card (/mail/leads/<page>): the agent's read, the checks before a reply (a mistyped domain, a client with the address or company, the forms one address sent), Prepare reply, Write on WhatsApp (opens the chat only), Not now, Spam and ⋯ (Open), then the form itself, never folded, its technical lines last; keys R, N, S, J/K, Enter; P147: on top of Needs you and Leads, "Send all ready (N)" opens the day's pass replies as one sheet with one Send N, then Mail ▸ Sent, whose top shows the run (its rows, Stop) and, after it, "10 sent, 1 not sent (reason)" with Send again (the sheet with only those; what did not go out is read from the database, so it stays after a restart, and nothing ever resumes by itself), while the other lists keep one line "Sending 3 of 11 · Open" (21-leads.md "The daily passes"); a selection's Send N opens the same sheet with only those drafts; another batch whose drafts wait is one line on top of Needs you, "3 drafts from „“ · Review all", and ?batch=is its own list with Send all Checked; Mail ▸ Sent (/mail/sent, P147) lists the mail that went out, newest first, from the send log with its full text (mail only, owner 2026-11-25: a messenger send stays in its chat and in Activity); the draft's Edit sits beside Send, and a click on the text starts editing too; one status line on top of the list with the new leads and "Mail read N min ago · Check now"), Messengers (P71 M3, decision 0036 point 6,/messengers, per project: what the messengers owe, a review queue and not a chat client; Chats is one page for both channels (P84c: the channel a filter, All · Telegram · WhatsApp,?channel=, only with both accounts connected), its View menu To do (the linked chats that wait, a draft or the client wrote last, then the fresh unlinked chats nobody decided on), Linked (every linked chat), Not linked (P102: every unlinked chat the autolink remembers, of any age) and Hidden (the chats the owner said are not clients, by name while the server's memory knows them); every row carries its channel as a Telegram or WhatsApp mark (@hub/ui/product/conversation/channel-icons, theme-following) and ONE state menu (P102): Linked to X (Change client…, which moves the chat and keeps its stored messages and sets the old client's open draft aside, with Undo; Unlink…, asked once in place with "its N stored messages and its draft are deleted, linking again reloads the last 30 days"; Hide: not a client…; the rules), Not linked (Link to a client…, Create client…, Hide), Hidden (Link to a client…, Unhide); "Link a chat…" in the list's ⋯ (P138: the header is one line, the View menu, the search, the filter button with the link state and its counts, ⋯) starts from a client and lists each account's chats marked for it; a linked row has who it is and its rules in one line, the newest stored message and the agent's open draft in full with Send (P71 M4: the send door's dry run, the confirm in place with who, the account and the exact text, then the apply; a refusal lists every reason in words), Edit in place and Skip with Undo, or the line that says why there is no draft; it reads onlymessenger_draftsand the linked chats, Mail drafts stay in Mail; P84: with no linked chat it says, naming both accounts, that only linked chats are read and why none shows (autolink on or off, how many Notion clients carry a phone), then on To do (P84c) only the unlinked chats that wrote in the last 14 days, under one group heading "Not linked · N" (P138; the rule in its tooltip, the agent's proposed hides as Hide all… on its line): each its name, channel and "wrote 2 h ago", a suggested client inline with Link (a phone or username that matched two clients, a client with no email, or one while autolink is off), Link to a client (P100: by name, email,@usernameor phone, the server's copy and Notion live, each hit with its email under the name, and Create client «name» in Notion with a typed email; the toast says "Linked · N messages of the last 30 days loaded" and what was written to the Notion card, with Undo) and Hide ("not a client", a toast with Undo), all in the row's state menu, and the in-memory count of unlinked chats that wrote since the server started as one muted line; with unlinked rows below, "No linked chats yet" is one line; a chat the Hub linked by itself says why on its rules row (Unlink, Hide and Change client are on Chats, from the row's state menu); a chat with the pre-analysis on has one more muted line, its counts by reason (P71 M-P, "Pre-analysis: hid 3 of 12 (2 closing, 1 automated)"), and a newest message the pre-analysis hid owes no reply; Messengers ▸ Settings/messengers/settings: the owner's Telegram account (the connect form, one step per call of M1's routes, under the sentence that it is his own personal account and can be banned; its state; Disconnect confirmed in place), WhatsApp (P71 M5: the same risk sentence for his own number, Connect, and only on that click the QR code to scan, drawn from the module rows the server sends, a new one about every 20 s; then the number's state; Disconnect confirmed in place, which also unlinks the device on the phone), the Telegram bot's token (moved from Connections), every linked chat's rules (reply mode, follow-ups and their days, reply language, the pre-analysis switch, off by default (P71 M-P: its note says what it does, or "Needs an OpenRouter key" and that nothing runs; the chat's counts by reason under it), and his instruction up to 4 000 characters) and the send guards' numbers (first contact never, 30 a day, 20 s apart, Stop sending stops every channel; enforced by the send door since M4)), Watch (P144, decision 0052,/watch, chordg w, per project: what the public Telegram groups a project watches talk about, read from its own watch storedata/watch/<slug>.db; drawn in the nav only while a project of the instance has awatch.md(GET /api/watch); its header holds the views as one row of tabs (a segmented control that scrolls in its own strip on a phone; owner 2026-11-25, it replaced a drawer) Triggers (each trigger with its moments, average intensity, strong ones and a strip by day), Topics (with each group's last mood), Moments (the quotes with their trigger, intensity, group, author and Open in Telegram, narrowed by?trigger=or?group=), People (read only: public group members are not clients and are never contacted from the Hub), Groups (access in words, messages per day, moments per 100 messages, cost, last read, and Join on a group that must be joined to be read: the one write, through a door, asking Telegram to add the owner's account; nothing is posted) and Trend, and beside them the period (7, 30 or 90 days,?days=); one line on top says whether the watcher reads (Off by default:on: yesin watch.md), the lens, the month's spend against the lens budget and the next analysis, and under it, while a change towatch.mdorlens.jsonwas refused or waits for a restart, one notice that says why (P153); 31-watch.md), Activity (P73, decision 0037: what the agent decided, one timeline newest first under a heading per local day, "Today", "Yesterday", "18 Nov", and no session and no detail pane; one row per client decision with the outcome ("Drafted", "Updated the draft", "Skipped", "Escalated", "Flagged", "Changed the watch" for a watch list or lens taken while running, P153, and "Removed an offer" when the guard took a vendor's instructions out of a tool reply, one per session and tool, P154) and the reason in it; the same client with the same outcome in a row on one day folded into one line with its count and time range, the entries under the count; a reason code read as a short phrase with the agent's words muted under it, the skill only when the event names one; the newest 100, then Show older;?client=narrows it to one client ("Mark Effect only", Show all), which the draft card's history opens; its View menu: All (since P87 with every send too, "Sent" and how it went), Needs you, Drafts, Skipped by outcome with the server's counts, then Sends, the send history with Cancel on a queued send; messenger sends too since P71 M4, "Anna on Telegram" with the text; then Errors (P137,?kind=errors), the ops log's warn and error lines of the last day for the whole Hub, newest first, each its part as a link to the page that fixes it and its action id, which Overview's Recent errors links to), Knowledge (/knowledge, per project: every entry of the knowledge base as a table under a heading per topic (P74: the folder, else the category, the brand on top only when brands differ), with Open folder in the header and each entry's Open), Settings (/settings, opening on Sending; one place for what is set rarely, grouped by what it governs, one pane per question and nothing folded (P75): Sending, controls only: the one Stop sending, who drafts may go to and autosend read only with what the owner's./run.sh send policy setcommand does and the command; Checks/settings/checks, the safety rules, one sentence that names a rule set off and every rule in view, grouped "Blocks Send" then "Warns", a switch each, the words and days inline; Mail/settings/mail, the project's accounts as Apple Mail knows them and its filters as one row with the phrase that changes them under it, then Booking (P155: the project's booking link and each brand's, from the project facts'bookingsection, with the phrase and thehub project setup --booking/--brand-bookingline that change them), read only; Agent/settings/agent, one group per agent CLI (owner, 2026-11-20: nothing of one read as the other's): on top one sentence for both CLIs' checks, "Settings apply to the next agent session" and Refresh; then Claude Code (P55: Model, Sonnet or Opus; Advisor, a switch, off by default; Advisor model, Fable or Opus, only while the advisor is on; each with a one-line hint; then Connectors, P62: one plain line per Google connector the project attaches, service, name, account and what the session may do, or "None" with the phrase, no control); then Codex (one line: its own default model, no advisor, no Google connectors); then Tools (P75): the checks of both CLIs in one table, each row naming its CLI, by default the rows that need a fix or a look with their fix lines, a View menu ("Needs a look", "All",?filter=all) over the same table, and with nothing to look at one line "All N checks pass"; Connections/settings/connections, no project in it, the Notion token (the Telegram bot's is on Messengers ▸ Settings since P71 M3): where each key stands, the last test's result (nothing before the first), Test, and write-only set, replace and remove; This Mac/settings/mac, no project in it, the switch "Start the Hub after a restart" with one status line, P67, and the core version with Check now and the update command, P68, or one quiet line whilecore/is a local checkout), and Help (/help, no project, P63 patch B: one line for the?shortcuts, then what to say to the agent (a table of phrases, the skills README's Example column word for word,@hub/contract/help, withXshown as the project's name), the tips for Claude Code, Codex and the Hub (@hub/contract/tips, the list the dock's tips button shows per tab), where the project's files live (project.md, the project folder, Workflows and today's agent log, each with its Open), and last "How it works": the Hub's main blocks in five lanes (In, Agent, Reads, Hub, Out) and what passes between them, then three cuts (a mail reply, a messenger message, what a session is given), drawn by Mermaid from the fixed model@hub/contract/scheme-model(P81, decision 0042; Mermaid is loaded only on this page). The live parts ofGET /api/schemeonly colour it: a dot on a block with a checked part (its word as the dot's title) and one line under the drawing naming the blocks that need a look; a drawing scales down to its card and takes the first form that fits with labels of 12 px or more, else the same model as a list. The phrases are English, the owner may say them in any language. Overview's All parts stays the text alternative, linked under it). Settings' panes are reached by the section menu, a column beside the page at every width, compact below 960px of the layout's own width (owner 2026-11-25: no drawer, no tabs), each tab with its page's dot; the sidebar, open or rail, and the phone bar draw parents only (P75). The phone bar is Overview, Mail, Activity, Settings and More (Messengers, Watch when shown, Knowledge, Help). Messengers' two pages are reached the same way, by its sub-nav. Planned: Client (profile and correspondence chain). Which screens exist and why:app/@rules/README.mdrule 8a; what a screen may show, and where an Open or a setting sits (the principle of correspondence):app/@rules/admin-principles.mdrules 9 and 12. - One shell for all of them: a sidebar with the brand header on top (the instance's
namefromconfig/config.json, fallback "Hub", and itslogofile, else a monogram), the project switcher under it only with two or more projects, the sections with their counts and a dot on the section that fixes the worst fact, and in the footer the core version line (P68:core v0.12.11, the words "update available" for a patch, the words and the nav's dot for an update recommended or required; it links to Settings ▸ This Mac (P70), whose Core version block shows the pin, the newest tag, the level and its reason, the newer tags' subject lines, whether dependencies change or the database migrates, when it was checked, Check now and the instance's command with a copy button; Overview has a Core part with the level as its standing, the reason and the command as its fix, linking to This Mac, since Overview holds no control;/healthkeeps the server's own facts, off the nav) and the theme switcher (Light, Dark, System); 224 px from 1280 px, a 56 px icon rail from 640 px, a bottom tab bar on a phone. A screen with a subject (Mail) is a list (360 px, 400 px from 1440 px) and its detail side by side from 768 px of its own pane (P88: so at a 1280 px window with the terminal docked at its default 400 px), and two screens with a Back control below it. There is no top bar and no status footer; each screen has one header line. Pages and lists fill the pane; only running text keeps a reading measure (about 70 characters). Every address is a real path; with two or more projects the project is its first segment (app/@rules/routes-and-url-state.mdrule 10); the open draft is the path (/mail/42), the view and the search are the query, so Back, reload and a shared link restore the screen. - The review card has one shape: who and why, what the draft was based on, the checks (only when there are some), the draft, then one action bar. The bar shows ONE primary button for the state the draft is in (Send, Send to Marta, Resume, Open the draft in Mail) or none (queued, sent, done, skipped); at most two secondaries; the rest is in the More menu; the "I read the checks" switch gates Send. Flags (Follow up, VIP, Do not contact) are in the Client menu in the header, never near Send, and Do not contact asks first. The 15 states and their buttons (no
batchstate since P85: a batch draft is a Mail draft like any other) (among themfollow_up, a step of a follow-up sequence: Open the draft in Mail as the primary, Stop the sequence in the header; 23-sequences.md) are the table inapp/apps/admin/src/features/review/card/card-state.ts(research 16 section 7), held by a unit test and bye2e/y-card-states.spec.ts. - Who it goes from, and Open the draft in Mail (P58). Under the addressing line the card shows
From <from> → To <to> · they wrote to <address>, From and To from the card's own Mail read (true after an edit in Mail), the address from the draft row. "they wrote to" is context, never a warning: a reply goes from the address the client wrote to when the project's Mail account can send as it, else from the account that received the mail (replyFrom,@hub/projects), and the second case is the design (a brand address such as info@carapis.com forwards into hello@reforms.ai; owner, 2026-11-20). Open the draft in Mail links the Mail draft's own Message-ID (messageIdon the Mail read, registry actionmail.openDraft); when Mail does not hold exactly one draft for it, the button is Open their message (mail.openMessage, the inbound bymailRef), so it is never dead. With the draft link shown, the More menu carries Open their message.hub open mail.openDraft --draft <id>does the same from the owner's terminal. Whethermessage://of a draft opens Mail's compose window or a viewer with an Edit step is measured with the owner present (P58 R1 live check). - Every reversible move says so: Done, Skip and Hold (one draft, or a selection) raise a toast with Undo, and
Uundoes the last one. The keys (J K Enter Esc C X Shift+A R D S H U 1 2 3 T /,gplus a letter between screens) are listed by the?popover; a typing field, a menu or a dialog switches them off. - The client's history (
tin a card) lists what the hub knows about that client: the agent's recorded decisions, the sends, and messenger messages (Telegram), with "Open their message" (the card's More menu) for the full mail thread; the hub reads no mail history itself (decision 0026). - Marks (tags such as "follow up", "do not contact") live in the admin database (
marks,packages/db/src/schema.ts); nothing copies them to Notion. - Live editing: the agent changes files under
app/; the owner sees the result without a rebuild (Next dev, Turbopack). Guard: the app runs from a git branch; every agent edit is a commit, so a bad one is one revert (app/@rules/live-edit.md).
One source per fact (decision 0009)
Notion is the one place for client records; Mail is the one place for the text of a draft. The admin database holds only what exists nowhere else.
| Data | Lives in | Admin database |
|---|---|---|
| Client profile, leads, tasks, documents (reports are documents, decision 0022) | Notion (the agent writes it through the connector) | only the key: a clients row (project, email, name, replies owed, last contact, updated_at), made when the agent records a draft for that client. Nothing is copied in bulk; there is no sync |
| Draft text | Mail (an unsent draft the person edits and sends) | no copy: drafts.body is empty for a recorded draft (an optional 240-character preview at most); mail_ref points at the message |
| Draft review state ("I read the checks", done, hold, skipped), marks, batches, sequence enrolments, follow-up plans and sweeps (decision 0050), the agent's run log | admin database only | yes |
| Project facts, filters, knowledge | files under <projects folder>/<slug>/ (<HUB_HOME>/projects; see 08-local-app-stack.md) |
an index rebuilt from them |
A session reports each unsent draft it leaves with draft_write's record (hub mcp, P129 A3; one JSON answer,
0 only when it says "ok":true). The command writes straight to the database (no server needed), makes the client row if
it is missing, and keeps one open draft per client: the same mailRef again updates it, another one marks the old draft
skipped and inserts the new one. It never deletes a client (marks and the log hang on that row) and never writes sent.
Sent detection (14) finds a recorded draft in the project's Sent mailbox in Apple Mail once the person has sent it from Mail, by its own recorded Message-ID only. A reply in its thread that is not the Hub's (a teammate on a shared mailbox), or another person's Notion Last sent by newer than the client's last message, is one line on the open card ("… · your draft may be out of date", P90); it never changes the draft.
Because Notion owns the client record, the admin has no company or deal-value column, no "High value" filter and no {company} placeholder.
Manual reply editor
When a client has written and no unsent draft exists, Mail shows the owner's Markdown editor alongside the conversation. It has formatting actions and a live preview, keeps the saved value as Markdown/plain text, and supports Cmd/Ctrl+Enter and Escape. Saving calls POST /api/projects/:slug/clients/:id/draft, which writes one unsent draft through the same Mail writer as agent drafts; it never sends. Prepare reply remains the optional agent path, and the send door remains a separate owner confirmation.
The routes behind the screens
Everything the server answers here is local: the database, the project folders and the server's own loops, read in the request. No route reads Mail or Notion to show a number, so no number carries a freshness stamp.
A refusal is { error, code } (@hub/contract/errors). Every refusal the Hub states is a HubError (@hub/config/errors, P126 E1) whose kind gives the status: invalid 400, not_found 404, wrong_state 409, unavailable and busy 503, forbidden 403, upstream 502 (wire code server). The server's onError answers it, so a route catches only to add words (a Telegram or WhatsApp failure is named, Mail's slow save is explained) or a header (retry-after on a second core check, 429). A repository's invalid is 400 and its unknown_project 404.
| Route | What it does | Cost |
|---|---|---|
GET /api/overview |
One row per project (status word, to review, sent today) with its standing (statusDto: level, the worst fact as one sentence, at most one place that fixes it, reply owed, last triage), a sentence that counts projects, and the health snapshot. With one project the admin shows the standing as the Mail status line; with two or more, as the Overview table |
milliseconds |
GET /api/projects/:slug/inbound, GET …/inbound/:id, GET …/inbound/:id/text, POST …/inbound/check, POST …/inbound/:id/dismiss, POST …/inbound/undismiss, POST …/mail/inbound/:id/move |
P96 Inbox: the clients who wrote and have no draft (at most 30, the total, the reader's state); one message's state from the Hub's record (P98: open or not, their drafts, the draft that answers it, other messages; refreshed by the live topics, so a draft the agent records turns the open card into "Draft ready" at once) and, as its own read, the client's text from Mail now (read only, on open and on focus); Check now (one read pass, awaited); No reply needed and its Undo; Spam and Delete (P147 3n, `{to: junk | trash}, the admin's Origin only, never refused for who sent it). The reader also records the Message-ID Mail gave a mail the Hub sent (send_log.sent_message_id, drafts.sent_message_id`), so a reply to it matches its thread. |
GET /api/projects/:slug/conversations, GET …/clients/:id/conversation, GET …/clients/:id/conversation/mail, GET …/clients/:id/conversation/text?m= |
P99: the list of people (one row per client, its state word, its open draft; view needs_you, waiting, all or sequences; search, batch, paged), one conversation's header and unsent message from SQLite, the history read from Mail now (their messages by sender contains, ours from Sent narrowed by the thread subjects; threads by References, else the subject without Re:; the last 30 messages, earlier the rest; source: hub with the reason when Mail cannot be read) and one body read on demand |
SQLite; the history about 1 s of AppleScript per open (spike of 2026-11-21: 0.9 s for 13 messages on saas, 1.1 s on realty), the body one read, then the server's memory |
POST …/clients/:id/conversation/refresh |
P140 R5: the conversation header's Refresh (stock ActionButton, "Refreshed" for 2 s). One Mail reader pass and the Sent pass, the client's cached Mail locations and bodies forgotten, the client's linked WhatsApp chats refilled (Telegram has no per-chat catch-up, so none is faked); answers { ok, ms, mailRead, chats, stored } and writes one ops line conversation refreshed. Inbox's Check now also refreshes the open conversation (it touches mail, inbox, sends and messengers) and writes mail checked by hand |
|
GET /api/activity |
P73: the agent's client decisions as one timeline, newest first, 100 a page (view all, needs_you, drafts or skipped; client; before, the previous page's next): one row per decision (who, what happened: drafted, updated the draft, skipped, escalated or flagged, the agent's reason, the draft it points at, the skill the event names), the counts per view and the narrowed client. Runs are not read: a run is not a session |
milliseconds |
GET /api/projects/:slug/follow-ups, POST …/follow-ups/sweep, PUT …/follow-ups/:clientId |
P142 (decision 0050): the follow-up plans with their derived state and the sweep line (Overview's "Follow-ups today", Activity ▸ Follow-ups at ?kind=follow-ups), Run follow-ups now (at most 3 a day, joins a running sweep), and the owner's Change date, Stop or Resume (exact admin Origin, Sec-Fetch-Site: same-origin, no ticket). Live topic follow-ups: 30-follow-ups.md |
|
GET /api/watch, GET /api/projects/:slug/watch, POST …/watch/groups/:username/join |
P144 (decision 0052): the projects that watch public groups (the nav draws Watch only when one does), one project's Watch page (?days=, ?trigger=, ?group=; 404 without a watch.md, 503 with the reason while its list or lens is broken), and Join (exact admin Origin, Sec-Fetch-Site: same-origin, loopback Host). Live topic watch: 31-watch.md |
|
GET /api/instance, GET /api/instance/logo |
The brand header's name and whether a logo exists; the logo file itself (404 when none), so the browser never learns a path | milliseconds |
GET /api/connections |
The Notion token and the Telegram bot, derived per request from state/secrets/*, the projects' settings and the in-memory test results, and each project's mail accounts with whether Apple Mail has them. No value: a row says where a key stands, never what it is |
milliseconds |
PUT /api/connections/:id/secret |
Body { value } (a Notion or Telegram token). Checks the shape, writes the file (temp and rename, mode 600), forgets the old test result, returns the row. 400 for a key that cannot be one, 409 where a key cannot be set. Nothing returns the value |
milliseconds |
POST /api/connections/:id/remove |
Deletes the key file and returns the row. 409 for a key set by an environment variable or a row with no file | milliseconds |
GET /api/instance/autostart, POST /api/instance/autostart {enabled} |
Settings ▸ This Mac (P67, decision 0033): the instance's LaunchAgent (installed, on, loaded, running, started by launchd or by hand, the last start, the start guard, whether mail-mcp answers) and the switch: Off is launchctl disable plus state/autostart/off, On is launchctl enable (and bootstrap when not loaded); never bootout, kill or kickstart, never a plist write; the label is the server's; the POST is the exact admin origin's; live topic autostart; HUB_LAUNCHCTL=fake (needs HUB_DB) for e2e |
milliseconds (two launchctl calls) |
GET /api/instance/core, POST /api/instance/core/check |
The core update notice (P68, decision 0034): the server's cached answer from state/core-update.json (pin, newest tag, level and reason, the newer tags' subjects, the facts, the command, checkedAt, error); GET never runs git. The POST runs one check now (git ls-remote of the core's origin, one fetch --tags when a newer tag is missing) and answers 429 within a minute of the last; the check bumps the live topic core. Under the fake Mailer no timer runs and a check reaches no origin (the offline answer) |
GET milliseconds; POST about 1 s, up to 15 s offline |
GET /api/projects/:slug/knowledge?filter=&q= |
The Knowledge table (P70, @hub/contract/knowledge): every entry of the project's knowledge index, one row each (the Open key knowledge:<path>, title, audiences, brands, category, kind, valid until and a status computed on the project's local day: expired, not approved, expires within 14 days, approved), filtered by view (all, attention, expired, unapproved) and by title on the server, with every view's count; at most 500 rows. Read from knowledge_docs only, no file read and no body: whether the index matches the files is the project overview's consistent. 404 for an unknown project. |
|
GET /api/scheme |
The Hub's parts and how each stands (P63 O1, @hub/contract/scheme): the core, the CLIs, the Notion token and a set Telegram bot, and per project its mailboxes, mail-mcp, the Hub tools, the guard, the knowledge base, the mail filters, the setup, the Notion databases and the send door, each ok, warn, fail or unknown ("Not checked here") with the source's own fix line and the page that fixes it ({ nodes } only since API 29, P81: the drawing's links are the contract's fixed model, never the server's). It runs no check: the Agent tools rows and the CLIs come from the server's caches (none cached: unknown, "Run the check on Settings ▸ Agent"; Agent sessions, kind session, is every row no other part covers, such as the Notion connector's sign-in), Mail's account list is waited for at most 0.4 s |
milliseconds |
GET /api/projects/:slug/agent-tools, POST .../agent-tools/refresh |
Settings ▸ Agent's Agent tools (P70; the Agents page in P63, on Connections before): the last agentChecks rows of both CLIs for the project (computed on the first GET) and capabilities (P62: the attached connectors, from the resolver that writes the session files), and a rerun (each MCP server asked once per CLI) (24-terminal.md) |
milliseconds; refresh about 10 seconds |
GET /api/terminal, POST /api/terminal/sessions, POST /api/terminal/ensure, DELETE /api/terminal/sessions/:id, POST /api/terminal/sessions/:id/drops, POST /api/terminal/tickets, upgrade /terminal |
The embedded terminal, always on (decision 0032); a file dropped on a tab is copied under state/drops/ and its path pasted (P76, decision 0041, multipart, 10 files and 20 MiB); the state carries what the CLI detector found (P57) and problem when no tab can start (P66: the starts then answer 503 terminal_unavailable with the fix), ensure starts the best ready CLI when the column opens; the socket goes straight to the API port with the admin's exact origin and a single-use ticket (24-terminal.md) |
milliseconds; the first ensure after a server start up to about 2 seconds (the CLIs' own --version and sign-in), never more than 8 |
POST /api/focus |
The shared focus (P51, P72 decision 0038): this tab's route id and its title from the route table, and refs (<kind>:<id>): the subject (what the address or the open card names), the row he is on, the selection, the rows on screen with the list's total, the view and search, and the outcome of the agent's last highlight; exact admin Origin and Sec-Fetch-Site: same-origin, strict body; kept in memory and in state/focus.json (schema: 2, ids only) for hub focus and hub mcp (24-terminal.md). No GET |
milliseconds |
GET /api/pointer |
The agent's pointer (P72): what highlight in hub mcp wrote to state/pointer.json (up to 5 refs, a note, 30 s), each ref's title resolved inside the pointer's project, or {pointer: null}. Read on the live topic pointer; the admin never writes it |
milliseconds |
POST /api/local/:action |
The local Open actions (P61) of the registry @hub/contract/local whose transport is server: finder.open (a folder key: project, knowledge, workflows), finder.reveal (any key, selected in Finder), file.open (project.md, knowledge:<entry>, log:<YYYY-MM-DD>; only .md .txt .csv .json .jsonl). The body is a project and a KEY, never a path: @hub/projects/local-open resolves it inside the key's own root (a knowledge entry must be in the project's index; a link, a bundle folder, .. and anything outside is refused) and runs /usr/bin/open with an argv array. Exact admin Origin and Sec-Fetch-Site: same-origin (the focus door), strict body; one open per action and key per 500 ms (429); 501 off macOS and for agent.openInDesktop (declared, not offered: owner item 7); an href id is 404 (the browser opens message:, mailto: and notion: links itself). The reply is {ok, opened: "<label>"}; no reply holds a path. GET /api/instance carries localOpen |
milliseconds |
GET /api/projects/:slug/drafts/:id/mail, PUT the same, POST .../mail/restore |
The open draft as Mail holds it (decision 0013: read live, never stored): the thread decides (P65): the one draft of the project's accounts whose In-Reply-To is the mailRef and whose To holds the client, whoever last edited it; two or more are shown without a hash, naming which one the Hub wrote (its mail_versions record), unless they are all the Hub's: the read first adopts the Hub's own late saves (P65 S5: matched by hash to mail_writes and mail_versions), keeps Mail's newest version and moves the Hub's older ones to Trash, then reads again; others of the same subject are named (aside) and never touched; Mail holding no draft at all is gone, with the newest version the Hub recorded in Trash (found by its Message-ID) for Restore. The card shows exactly the Mail text: nothing of the Hub's is in it (decision 0031). A read that shows another text than the one Checked was bound to turns Checked off. PUT {text, hash} is the owner's Save (P56 S1) and restore writes the Trash copy again (P56 S0): both through the agent's one writer (reviseDraft), each recorded as a Mail version, the send ticket's door (exact admin Origin, Sec-Fetch-Site: same-origin), Checked off, live topic mail; a Save over a hash Mail no longer holds is 409 |
one or two osascript calls (about 0.3 s a read; a write several seconds) |
GET /api/messengers/telegram-user, POST /api/messengers/telegram-user/login/{start,code,password,cancel}, POST /api/messengers/telegram-user/:account/disconnect |
The Telegram user account (P71 M1, decision 0036): the supervisor's state (also telegramUser in /api/health: one row per account, running, error or parked with logged_out, banned or flood_wait and its fix line; a parked account is a Telegram part that is broken on Overview, never reconnected by itself, not even after a restart). The login is one call per step: {apiId, apiHash, phone} asks Telegram for the code, then {flow, code}, then {flow, password} when the account has 2FA; the values stay in server memory for the flow (10 min) and are never logged or returned; only the final session is written, to state/secrets/sessions/telegram_user-<id>/session (mode 600), and the account connects. Disconnect stops it and removes that folder. Every POST is the exact admin Origin's with Sec-Fetch-Site: same-origin; 409 without one messenger project. Messengers ▸ Settings drives them (P71 M3) |
milliseconds; a login step is one Telegram call (about 1 s) |
GET /api/messengers/whatsapp, POST /api/messengers/whatsapp/connect, POST /api/messengers/whatsapp/connect/{state,cancel}, POST /api/messengers/whatsapp/:account/disconnect, POST /api/projects/:slug/messengers/whatsapp/:account/{dialogs,link} |
WhatsApp as a linked device (P71 M5, decision 0036): the supervisor's state (also whatsapp in /api/health, the same rows as the Telegram accounts; the account is the number's digits; 401 parks as logged_out, 403 as banned). Connect opens a pairing only on the owner's click; {flow} reads its state every 2 s: waiting, qr with the code as module rows (0/1, never the QR string), done with the number and his WhatsApp name, or failed with the sentence (an expired code: press Connect again); nothing is written before the phone scans; then Baileys' creds and keys go to state/secrets/sessions/whatsapp-<number>/ (files 600, folder 700) and the number connects. The picker lists the private chats seen since the connection opened (memory only, never a text of an unlinked chat); Link writes the whatsapp identifier, allows the chat and imports what the phone answers to a history request (15 s at most). Disconnect logs the device out on WhatsApp's side and removes the folder. Every POST is the exact admin Origin's with Sec-Fetch-Site: same-origin |
milliseconds; Connect opens a socket to WhatsApp (about 1 s); a link waits up to 15 s for the phone |
POST /api/projects/:slug/messengers/telegram-user/:account/dialogs {clientId}, POST .../link {clientId, chatId, title?} |
The link picker (0036 point 3): the account's newest 200 private chats with people, read on demand and never stored, each suggested when its Telegram id or phone equals one of the client's identifiers (never linked for him) and linked when already allowed. Link writes client_identifiers (kind telegram), allows the chat on telegram_user, imports its last 30 days through the one ingest and answers how many were stored; it mints a HumanActor behind the same gate (0036 point 7). A chat that is not linked leaves no row anywhere. Nothing here sends |
picker about 1 s; link one history read |
GET /api/projects/:slug/messengers/chats?filter= (waiting, all), PUT .../messengers/drafts/:id/text {text}, POST .../drafts/:id/skip, POST .../drafts/:id/restore, PUT .../messengers/chats/:id/rules, GET .../messengers/clients?q= |
The Messengers section (P71 M3, @hub/contract/messenger-panel): the project's linked chats, waiting first, each with its client (by client_identifiers), rules, newest stored message, owed and the agent's open draft, with both views' counts; the owner's Edit of a draft that still waits (reviseDraft), Skip (discarded) and its Undo (back to draft); one chat's rules through setChatRules (the bounds of @hub/config/chat-rules, checked again); the link picker's client lookup (two or more characters, at most 8, never every client). Every write is the exact admin Origin's with Sec-Fetch-Site: same-origin, since an instruction steers the agent and a draft's text is what Send will carry. Nothing here sends |
milliseconds |
POST /api/projects/:slug/messengers/autolink/{state,preview,records,link,create,hide,unhide}, POST .../messengers/chats/:id/{unlink,never} |
Chats link themselves (P84, decision 0036 point 3 as amended 2026-11-20, apps/server/src/messengers/autolink/autolink.ts): state is the project's messengers.autolink, the Notion client directory's state (read only into memory, never stored) and, from memory only, the unlinked dialogs the accounts saw since the server started (name, why not linked, the matching records) and their count; preview is the dry run, counts only per account (dialogs, linked, unique, ambiguous, no email, unique by Relationship), nothing written and no name, number or text in the reply; records finds up to 8 Notion records by two or more characters of a name, email, Telegram username or phone, in memory and by one live read-only Notion query (P100; hits are put into memory; live and liveError say whether Notion answered); link {channel, account, chatId, key} links a seen dialog to a record (the client row from its email and name, a HumanActor behind the gate, 30 days imported) and fills the record's empty Telegram or WhatsApp with the chat's username or number (P100, never a filled one; the reply's notion says what was done); create {channel, account, chatId, name, email} (P100) makes one Clients page in Notion (Name, Email, Relationship Lead, the chat's username or number), or links to the page that already has that email, then links the chat (a 409 with the fix when Insert content is refused); unlink removes the identifier, the chat, its messages and drafts; never does the same and stores the chat's HMAC in messenger_link_refusals. hide (Hide: not a client, P84c) stores an unlinked chat's HMAC there too, and unhide removes it. Every route is the exact admin Origin's with Sec-Fetch-Site: same-origin. Nothing here sends |
milliseconds; preview reads the dialog lists (about 1 s); link one history read |
POST /api/projects/:slug/messengers/drafts/:id/send {apply:false} or {apply:true, confirm:{chatId,text}, ticket} |
The send door for one messenger draft (P71 M4, decision 0036 point 7, packages/messengers/src/door.ts, P126 D1): the dry run answers the chat, the account, who and the exact text, or 409 wrong_state with every refusal in words (the draft no longer waits; no inbound message in the chat; not linked; the account not connected; Stop sending; draft.recipients: test and no telegram:<id> entry in allow_list; 30 sends in 24 h or one under 20 s ago on the account); the apply needs a ticket from POST /api/sends/tickets with kind: "messenger", refuses a text or chat that changed since the dry run, writes its send_log row first (channel, messenger_draft_id; the cap and spacing checked again in the same write), sends once and never retries; a failure is recorded and the draft waits again |
a second (the send) |
POST /api/projects/:slug/batches/:id/send, POST /api/sends/batch-tickets, GET /api/ops/errors |
Send all Checked of one batch (P85b: dry run, one ticket for the confirmed drafts and text hashes, the run on the server with progress and Stop): 14-bulk-send-interface.md; Overview's Recent errors from the ops log (P86): 28-ops-log.md | a send per draft, 20 s apart; the errors read milliseconds |
POST /api/sends/tickets |
A single-use ticket for one draft's Send (60 s), only for the admin's exact origin with Sec-Fetch-Site: same-origin; the apply of the send route needs it (P49 S12) |
milliseconds |
GET /api/live |
The live stream (P50, below): text/event-stream of tiny frames that name what changed (hello, change {seq, changes: [{topic, project}]}, reset), never the data; resume by Last-Event-ID or ?since=; a : ping every 15 s; at most 16 streams (then 503). Read-only, same Host guards, no CORS header |
open while a page is |
POST /api/connections/:id/test |
One read-only probe of one connection (Notion users/me, Telegram getMe). At least 30 seconds between two probes of the same connection; the result is kept in memory for an hour. 404 unknown id, 409 when the connection has nothing to test |
seconds |
The standing of a project is a pure function of local facts (for example Stop sending, a failing Sent loop or doctor check, held suspicious mail, failed or stuck sends, the project still a draft, sends limited to the test list, the fake Mailer, the auto-send cap, expired knowledge, never triaged), so the status line and the Overview read one source and a model writes no sentence. The worst fact wins and is said once ("Sending is stopped", "Test mode: sends go to the test list only", "All clear"); test mode is a setting the owner chose, so it is level clear: said when nothing worse is, never a dot or a "Needs you" item (UX pass 2026-11-20), while expired knowledge is attention. next names the one page that fixes it (P70: Settings ▸ Sending for sending, the cap and test mode; Overview for what is fixed by a phrase in a session, a failing setup check, a draft project; Knowledge for expired entries; the other Settings panes for their parts), and that page carries a dot in the nav (a child's dot also lights its parent, and a parent in the phone's More lights More); an Agent tools row that needs a fix or a look puts the dot on Settings ▸ Agent, and every part Overview lists under "Needs you" lights the page it links to, so a dot and its item always come together. The to-review count belongs to the nav and the View menu and is never repeated in the line. Paused and archived projects raise nothing.
The Notion token is optional for setup (hub setup asks for nothing; hub setup --automation, ./run.sh token notion or Settings ▸ Connections store it in state/secrets/notion-token, or in the file a project names in its settings; a project that names its own file never falls back to the shared one). It is read by the project doctor's database check, notion-dump and backups; the admin's home shows no Notion count.
What the Overview never carries: a client's name, address, subject or body, a deal value, a Notion property or a Notion page id of a record. The schemas have no field for them and refuse a stray one.
Live updates (P50, decision 0028 in the owner's plan repo)
While the agent works (in the terminal column or another window) the screens update by themselves, within about a second, with no reload:
- What changed is written by the database itself. Migration 0019 gives every table three triggers (insert, update, delete) that bump one counter (
live_seq) and record(table, project, counter)inlive_versions, inside the writer's own transaction, whoever writes: the server,draft_write's record in a terminal, a migration,sqlite3by hand. A rolled-back write records nothing. The table holds one row per table and project, so it never needs pruning and every counter stays a resume point. What is not a row is watched by the server and bumped through the same path (bumpTopic): the pollers' state (health), the Connections files (connections, so ahub tokenin a terminal shows at once) and, per project, the agent session log's day files (agent-log, P59: a watch with one signature per project folder ofstate/log, every 500 ms; the.cursor/folder is not compared), the LaunchAgent (autostart, P67:state/autostart/starts.jsonl, the off file and the switch, every second; not its log), and the core update check (core, P68: a finished check or a changedstate/core-update.json, every second). A new table needs its triggers in its migration;packages/db/test/live.test.tsfails without them, and the server'sRecord<LiveTable, LiveTopic>failstsc. - The server tails it. Every 200 ms it reads the counter (one page); when it moved, it reads the changed rows, maps each table to one of 13 topics (
@hub/contract/live), waits 100 ms to merge a burst, and sends one frame onGET /api/live. A client still busy with the last frame gets oneresetinstead of a queue. - The admin invalidates, it is never pushed data. One tab per browser holds the Web Lock
hub-liveand opens the EventSource (HTTP/1.1 allows about six connections per origin across all tabs); it passes every frame to the other tabs over aBroadcastChannel. Each tab invalidates the query keys of the frame's topics (TOPIC_KEYSinapps/admin/src/lib/cache/keys.ts, the one key factory), so only what changed is read again, through the normal API and its contract parse. A hidden tab only marks its queries stale; its focus refetch catches up. A row change never reads Mail (decision 0013): the open draft's text in Mail is read on open, on focus and on the one Mail topic,mail, whichdraft_writebumps after it wrote a draft of the project (P53), so a revision by the agent shows on the open card within about a second plus the Mail read. When the agent re-recorded the draft under an open card, the card also says "Changed by the agent since you opened it" with Reload. When Mail holds more than one draft of the thread, the card shows the one the Hub recorded (else the newest) and names every Mail id, saying which one the Hub wrote, so the owner keeps one; that text has no hash, so it cannot be Checked and the send refuses it. The address names the card on screen: a wide pane replaces a bare/mailwith the first row's/mail/<id>(routes rule 9). New Activity rows at the top of the timeline are announced in a polite live region ("2 new"). - The agent activity feed (P59, P73). No feed rows in the sidebar since P73 (decision 0037): they repeated Activity's draft writes and the strip's dot. What stays is the signal, read from
GET /api/projects/:slug/agent-feed(the tail of the session log: 25-agent-log.md), refetched on the topicagent-log: the terminal strip's dot (and the phone's terminal button) takes the attention colour while the agent waits on the owner, until he opens the column; one tone per turn that ended (attention, ready, problem; synthesised by@hub/ui/sound, muted by the speaker switch in the footer; only the tab holding Web Lockhub-sound, after a click in it, plays, and that tab refetches the feed even when hidden). - The fallback is the pulse. The Mail status line says "Live" while the stream is up and "Reconnecting, data may be old" after 5 s without it. While it is down, the page polls
GET /api/pulseevery 10 s as before P50 and refetches every list when the database file moved; a stream the server cut (a restart: the/apirewrite answers 500) is opened again after 1, 2, then 5 s, resuming after the last frame the page applied. The Activity and Overview timers are gone. - Through the
/apirewrite. The stream goes through Next's rewrite like every call, soproxy.tsand the Host guard apply unchanged and no ticket is needed (a cross-origin page cannot read a same-origin stream without CORS).Cache-Control: no-cache, no-transformis load-bearing: without it Next gzips the proxied stream and holds every frame (measured in the L0 spike: 0 frames in 8 s; with it 1 to 4 ms per frame, and a stream with only 15 s pings stayed open past 165 s under the 120 sproxyTimeout).
What a screen shows by default
Each screen opens on what the next decision needs and keeps the rest one step away (app/@rules/admin-principles.md). Mail has one View menu with counts (DRAFT_VIEWS, app/apps/admin/src/routes/search.ts; the view is ?filter=; P99): Needs you (needs_you, the address default: Wrote you and Draft ready), Waiting (waiting), All, then the filters Follow-ups (sequences, the open steps of a follow-up sequence, 23-sequences.md) and Not by email; Hold, Sent and Finished are words and chips on a row, and the batches read-only (?batch=). Above the list sits one status line, never a paragraph or an accordion. A row is three lines (name and time, the subject on the full width, a line of chips); selecting turns the list's header line into "N selected · Skip · Hold · Clear" in place, so nothing moves. The list footer "N of N loaded" shows only when there is more to load. A failing setup check is a "Needs you" item on Overview, named with its detail; passing checks are not listed (hub project doctor <slug> lists them all). An Open lives on the thing it opens (P70, app/@rules/admin-principles.md rule 12): Knowledge's header has Open folder and each entry row its Open; the files no screen lists (project.md, the project folder, Workflows, today's agent log) are on Help; off macOS (localOpen false) none of them renders. A mechanical cap holds the first viewport to 36 tab stops and the first draft on a phone to 200 px down (app/@rules/ui-specifications.md rule 4a).
Rules
- The agent only creates drafts. The app sends only when a person confirms one draft (decision 0011,
16section 3B): Send on a ready draft whose checks the person read ("I read the checks", bound to the Mail text they saw), with the exact mail shown first, through the one routePOST /api/projects/:slug/drafts/:id/send, whose apply needs the page's single-use ticket. Bulk = many drafts, never sent in bulk. - The terminal column (always there; when no tab can start it says why and the fix, P66) runs Claude Code, Codex or the owner's shell for the project in the URL; opened, it starts the best ready CLI by itself (P57: Claude Code first, one line when it fell back); it is a viewing preference, never URL state (24-terminal.md): the active tab in
localStorage, the open state and width in thehub_shellcookie beside the sidebar's pin and the last breakpoint, which the shell layout reads on the server so a cold load is laid out as the last page ended, the column at its width while the terminal read loads (P128 X8). A file dropped on the open tab is copied into the instance and its path pasted into the input line (P76); a file dropped anywhere else in the admin does nothing, it never opens in the tab. - Bind to 127.0.0.1 (
next dev -H 127.0.0.1: without the flag Next listens on every address); no remote access in the first version. Next has no DNS-rebinding guard of its own, sosrc/proxy.tsrefuses any Host that is not a loopback name and any write whose Origin is not; the API repeats the check. - The tab publishes what it shows (P51, P72): every route its id and its own title, and refs, through one channel (
lib/focus.ts): rows carrydata-agent-ref(agentRef(ref); drafts, Activity's lines (the draft a line names, else its client: P73), Knowledge's entries, Overview's projects), a record a screen opens that its address does not name goes throughuseFocusSubject, picked rows throughuseFocusSelection, and two observers on#mainadd the row he clicked or arrowed to (never hover) and the rows on screen. A new screen needs nothing else; a new ref kind adds one resolver in@hub/agent/focus. The agent reads it as "this entry", "this client" throughhub mcpand the prompt hook; nothing of it is URL state, and only refs leave the browser (24-terminal.md). - The agent may point, never act (P72, decision 0038): its
highlightdraws a ring and "Agent:" on up to five rows for 30 s ( @hub/ui/product/spotlight,features/focus/pointer.tsx), announced politely, scrolled into view once and never while he types; Escape, a click or a route change removes it. A row on another screen is offered in the dock header ("Agent points at … · Show"); only his click navigates. - Open and Reveal (P61) show a fact in the program that holds it (Mail, Notion, Finder, the file's own app) and change nothing in the Hub. One registry declares them (
@hub/contract/local); Mail and Notion are plain links, a file or folder goes throughPOST /api/local/:actionwith a key.hub openis the owner's terminal form; the agent is denied it and a bareopen(app/@rules/admin-principles.mdrule 1). - English only, per the owner.
Not built
The Client screen (profile and correspondence chain).
Open questions for the owner
- Mobile access to the app (phone on the same network) needed, or desktop only?
Update this page when the architecture changes.