docs(requirements): add the hub requirements 066 to 070

From the brainstorm picks of 2026-11-27: 066 radio composer with a
segmented footer that fills the widget, 067 rules page list first with
a match count, 068 schedules page that edits every cron and timer
through the host reconciler, 069 account usage bar with count,
calibration, switchable forecast and reset at the reset date, 070
usage explorer with full attribution, estimated cost, cache hit rate
and per-turn context.

🎯 Fix: 95 %
💥 Break: 1 %
💸 Tokens: 100 %
⏱️ Velocity: 100 %
🛡️ Security: 100 %
🏆 Score: 94
🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 %

Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kevin Veen-BirkenbachandClaude Opus 5.5 committed 2026-11-27 10:52:19 +00:00
1 parent 9403e17e97
commit 83a0ab504b
6 files changed
+439

No files matched your search

@@ -0,0 +1,74 @@
# 066 - Radio Composer Footer
## User Story
As the operator, I want the radio composer's buttons in one calm, flush footer
strip, so that panel and widget look harmonious and the widget uses its whole
width.
## Decisions (operator-confirmed 2026-11-27; do not re-litigate)
1. **Segmented footer** (operator): the bottom row is one strip flush with the
composer's bottom edge: Record │ mic │ PTT │ ▾ │ MAYDAY, cells separated
only by 1 px vertical dividers, one height, Record taking the bottom-left
corner radius, MAYDAY the bottom-right. Rejected: controls inside the field
(MAYDAY less visible); two joined pill groups (still separate pills).
2. **Flowing transitions**: hover, active and focus change only background and
colour over 150 ms; no border, size or shadow jumps; recording pulses the
Record dot.
3. **Text field**: grows with its text up to 6 lines, then scrolls; no native
resize handle or spin arrows.
4. **Widget full width** (operator): in widget mode the composer has no inner
margin or second card frame; its edges are the widget's edges.
5. **One component**: the Speak panel and the widget render the same footer;
below 480 px width the cell labels collapse to icons and nothing wraps.
## Approach
```mermaid
flowchart TD
subgraph P["🧭 0 · Preparation"]
P1["📋 Write requirement"] --> P2{"✅ Operator approves?"}
P2 -- "✏️ corrections" --> P1
end
P2 -- "🤖 yes" --> A1
subgraph A["🎛️ A · Footer"]
A1["🧩 Segmented strip, dividers, corners"] --> A2["📐 Widget full width, field growth"]
A2 --> A3{"🧪 E2E green at 1920, 1366, 390?"}
A3 -- "🔴 no: fix" --> A1
A3 -- "🟢 yes" --> AF{"💬 Operator feedback on screenshots?"}
AF -- "✏️ changes" --> A1
end
AF -- "👍 fits" --> D1["🏁 Review, commit with operator OK, hand-over"]
```
## Acceptance Criteria
### Footer
- [ ] The five cells' bounding boxes share top and bottom (±1 px) and touch
with gap 0, in panel and widget.
- [ ] The Record cell's bottom-left and the MAYDAY cell's bottom-right radius
equal the composer's radius.
- [ ] Between neighbouring cells exactly one 1 px divider shows; no cell has
its own outer border.
- [ ] Every cell's `transition` covers `background-color` and `color` at
150 ms, and no `border-width`, `padding` or `box-shadow` changes on
hover or focus.
### Field and widget
- [ ] Typing 3 lines grows the field without a scrollbar; 8 lines show a
scrollbar at 6 lines' height; `resize` is `none`.
- [ ] In widget mode the composer's width equals the widget body's width
(±1 px).
- [ ] At 390 px the labels are hidden, the icons stay, and the footer is one
line.
### Tests
- Unit: n/a: layout only, no logic.
- Integration: n/a: no server change.
- E2E:
- [ ] `tests/e2e/test_radio_composer_e2e.py`: the geometry checks above in
panel and widget, screenshots at 1920, 1366 and 390.
@@ -0,0 +1,81 @@
# 067 - Rules Page Overview
## User Story
As the operator, I want the rules page to show my rules as a clear list with
how often each one would have matched, so that I see at a glance what is
granted automatically.
## Decisions (operator-confirmed 2026-11-27; do not re-litigate)
1. **List first** (operator): the rules are grouped Ask, Review and Decision,
collapsible, with counts in the headers. Each row holds: on switch, tool
(Ask), pattern, directory, applies-to, an expiry chip (days left, red under
2 days), match count, delete. Rejected: tabs per kind (hides the
overview); only reordering (stays cluttered).
2. **New rule in a sheet**: a "+ New rule" button opens the existing form in a
sheet; the signing flow is unchanged.
3. **Match count** (operator): each rule shows "N of the last 50 asks"; the
sheet shows the live count for the draft while typing. The hub computes it
with its existing rule matcher over the last 50 ask records; it is
read-only and grants nothing.
4. **Firewall below**: settings, patterns, groups and sets stay, as sections
collapsed by default under the list.
## Approach
```mermaid
flowchart TD
subgraph P["🧭 0 · Preparation"]
P1["📋 Write requirement"] --> P2{"✅ Operator approves?"}
P2 -- "✏️ corrections" --> P1
end
P2 -- "🤖 yes" --> A1
subgraph A["🔢 A · Match count"]
A1["🧮 Matcher over last 50 asks"] --> A2{"🧪 Unit and integration green?"}
A2 -- "🔴 no: fix" --> A1
end
A2 -- "🟢 yes" --> B1
subgraph B["📋 B · Page"]
B1["🗂️ Grouped list, chips, switches"] --> B2["➕ New-rule sheet with live count"]
B2 --> B3{"🧪 E2E green at 1920, 1366, 390?"}
B3 -- "🔴 no: fix" --> B1
B3 -- "🟢 yes" --> BF{"💬 Operator feedback on screenshots?"}
BF -- "✏️ changes" --> B1
end
BF -- "👍 fits" --> D1["🏁 Review, commit with operator OK, hand-over"]
```
## Acceptance Criteria
### Match count
- [ ] `POST /api/rules/match` with a draft rule answers `{matched, of}`, with
`of` at most 50, counting the last asks the matcher would grant; a bad
draft answers 400.
- [ ] Every stored rule in the rules payload carries `matched`; a fixture
with 3 matching asks of 5 shows 3.
- [ ] The match call writes nothing (the state dir lists the same files
before and after).
### Page
- [ ] The page shows three group headers with their counts; collapsing one
hides its rows.
- [ ] A row shows switch, pattern, expiry chip and match count; a rule
expiring tomorrow has the red chip.
- [ ] "+ New rule" opens a sheet; changing the pattern updates the live
count; creating it adds the row without a reload.
- [ ] Firewall sections are collapsed when the page opens.
### Tests
- Unit:
- [ ] The matcher count over a fixture of asks in
`tests/test_hub_rules_match.py`.
- Integration:
- [ ] `/api/rules/match` and `matched` in the payload through the HTTP
handler.
- E2E:
- [ ] `tests/e2e/test_rules_page_e2e.py`: groups, chip, sheet with live
count, screenshots at 1920, 1366 and 390.
+96
View File
@@ -0,0 +1,96 @@
# 068 - Schedules Editor
## User Story
As the operator, I want every timer and cron on my host listed in one simple
table that I can edit in place, so that I switch off or retime anything
without a terminal.
## Decisions (operator-confirmed 2026-11-27; do not re-litigate)
1. **One table, all sources** (operator): Skills (the first-party rows), Hub
(`kvb-orchestrator-*`), Claude (durable tasks in each project's
`.claude/scheduled_tasks.json` under the host's repositories) and System
(other `systemctl --user` timers). Columns: Source, Name, Schedule, Next,
Last, On. One filter chip per source. Root timers are out of scope (no root
on the host).
2. **Edits through the host reconciler** (operator): the page writes the
desired state to `schedules.json`, and the existing reconciler applies it:
a systemd drop-in `schedule.conf` plus enable or disable for timers, an
edited or removed entry for Claude tasks. Rejected: each edit as a runner
row (slower); system timers read-only (less function).
3. **Passkey for foreign rows** (operator): changing a System row or a Claude
task needs a passkey signature; Skills and Hub rows need none.
4. **Schedule input**: timers take daily times (`17:00, 21:30`) or a raw
`OnCalendar` expression, which the reconciler validates with
`systemd-analyze calendar` and reports invalid ones as a row error. Claude
tasks take a 5-field cron, validated by the hub.
5. **Never destructive**: the hub never deletes a unit file; "Reset" removes
only its drop-in.
6. **Simpler**: one table, inline edit on click, hints only in tooltips; the
reconciler's last run shows once in the header.
## Approach
```mermaid
flowchart TD
subgraph P["🧭 0 · Preparation"]
P1["📋 Write requirement"] --> P2{"✅ Operator approves?"}
P2 -- "✏️ corrections" --> P1
end
P2 -- "🤖 yes" --> A1
subgraph A["🖥️ A · Host reconciler"]
A1["🔎 List Claude tasks and user timers"] --> A2["🛠️ Apply overrides: drop-in, enable, cron edit"]
A2 --> A3{"🧪 Unit and integration green?"}
A3 -- "🔴 no: fix" --> A1
end
A3 -- "🟢 yes" --> B1
subgraph B["📅 B · Hub page"]
B1["📋 One table, source chips"] --> B2["✏️ Inline edit, passkey for foreign"]
B2 --> B3{"🧪 E2E green at 1920, 1366, 390?"}
B3 -- "🔴 no: fix" --> B1
B3 -- "🟢 yes" --> BF{"💬 Operator feedback on screenshots?"}
BF -- "✏️ changes" --> B1
end
BF -- "👍 fits" --> D1["🏁 Review, commit with operator OK, hand-over"]
```
## Acceptance Criteria
### Reconciler
- [ ] On a fixture host the view lists rows of all four sources with
`source`, `schedule`, `next`, `last` and `on`.
- [ ] An override with times for a System timer writes
`<unit>.d/schedule.conf` and calls `daemon-reload`; "Reset" removes the
file.
- [ ] An invalid `OnCalendar` keeps the old schedule and shows the row's
error.
- [ ] A Claude task override changes its cron in `scheduled_tasks.json` and
keeps every other key byte for byte.
### Hub
- [ ] Saving a System or Claude row without a valid passkey proof answers 403
and stores nothing; with one, 200.
- [ ] A Skills row saves without a proof.
- [ ] A bad cron answers 400 naming the field.
### Page
- [ ] The source chips filter the table; clicking a schedule cell turns it
into a field, and Enter saves.
- [ ] A foreign row's save opens the passkey prompt.
### Tests
- Unit:
- [ ] Reconciler listing and override application on fixture files in
`tests/test_schedules.py`.
- Integration:
- [ ] `/api/schedules` overrides with and without a proof through the
handler.
- E2E:
- [ ] `tests/e2e/test_schedules_e2e.py`: chips, inline edit, the passkey
prompt for a foreign row (virtual authenticator), screenshots at
1920, 1366 and 390.
@@ -0,0 +1,85 @@
# 069 - Account Usage Bar
## User Story
As the operator, I want a usage bar per account that I can correct by
dragging and that resets itself on the reset date, so that I see how much of
each plan is left.
## Decisions (operator-confirmed 2026-11-27; do not re-litigate)
1. **Bar per account** (operator): fill = tokens used since the last reset
divided by the limit; an account without a limit shows no bar, only its
count.
2. **Calibrate by drag** (operator): dragging the handle sets the share to
what the provider shows. The hub stores `{share, at}` per account id in
`account-calibration.json` (state dir, mode 0600), and the bar shows
calibration plus the tokens counted since `at`. Keyboard: arrows move 1 %,
PageUp and PageDown 10 %. Rejected: manual only (loses the count).
3. **Auto reset**: at the account's reset moment the calibration is dropped
and the count starts at zero.
4. **Flowing colour** (operator): the fill colour follows the share
continuously: 0 % green, 50 % yellow, 75 % orange, 100 % red, interpolated
in OKLCH without steps.
5. **Forecast switchable** (operator): an "Auto forecast" toggle in the
Accounts head, stored in the hub settings. When on, a marker shows the
share expected at the reset time from the rate of the last 24 h, with the
tooltip "100 % at <day time>" when that comes before the reset.
## Approach
```mermaid
flowchart TD
subgraph P["🧭 0 · Preparation"]
P1["📋 Write requirement"] --> P2{"✅ Operator approves?"}
P2 -- "✏️ corrections" --> P1
end
P2 -- "🤖 yes" --> A1
subgraph A["🗄️ A · Server"]
A1["💾 Calibration store, reset drop"] --> A2{"🧪 Unit and integration green?"}
A2 -- "🔴 no: fix" --> A1
end
A2 -- "🟢 yes" --> B1
subgraph B["📊 B · Bar"]
B1["🎨 Gradient bar, drag, keys"] --> B2["🔮 Forecast marker, toggle"]
B2 --> B3{"🧪 E2E green at 1920, 1366, 390?"}
B3 -- "🔴 no: fix" --> B1
B3 -- "🟢 yes" --> BF{"💬 Operator feedback on screenshots?"}
BF -- "✏️ changes" --> B1
end
BF -- "👍 fits" --> D1["🏁 Review, commit with operator OK, hand-over"]
```
## Acceptance Criteria
### Server
- [ ] `POST /api/accounts/<id>/calibrate {share}` with 0 to 100 stores
`{share, at}` and answers it; an unknown id answers 404, a share outside
0 to 100 answers 400.
- [ ] `GET /api/accounts` carries each account's calibration; after the reset
moment it is gone.
- [ ] `account-calibration.json` has mode 0600.
### Bar
- [ ] An account with a limit shows a bar whose width matches the share
(±1 %); one without a limit shows none.
- [ ] The fill colour at 0, 50, 75 and 100 % equals green, yellow, orange and
red; at 60 % it lies between yellow and orange.
- [ ] Dragging to 40 % and reloading shows 40 % plus the tokens counted
since.
- [ ] ArrowRight moves the handle by 1 %, PageUp by 10 %.
- [ ] With the forecast on, the marker shows; off, it is absent; the toggle
survives a reload.
### Tests
- Unit:
- [ ] Calibration validation and reset drop in `tests/test_hub_accounts.py`.
- [ ] The colour function at the stops (node).
- Integration:
- [ ] The calibrate route and the payload through the handler.
- E2E:
- [ ] `tests/e2e/test_resources_accounts_e2e.py`: drag, keys, forecast
toggle, screenshots at 1920, 1366 and 390.
+98
View File
@@ -0,0 +1,98 @@
# 070 - Usage Explorer
## User Story
As the operator, I want a Resources view that breaks token use down by skill,
tool, subagent, repository, model, agent and account, with cost and cache
figures, so that I can find what costs the most and cut it.
## Decisions (operator-confirmed 2026-11-27; do not re-litigate)
1. **Attribution in the sampler** (operator): the host sampler
(`orchestrator/client/resources.py`) tags each assistant message's usage
with:
- `skill`: the last Skill call earlier in the same session, `""` before
any;
- `tool`: the tool_use names in that message, `""` for text;
- `subagent`: the agent type of a sidechain transcript, `""` for the main
thread;
- `repo`: the base name of the session's git top-level;
- plus `model`, `agent` and `account` as today.
Rows stay hourly, keyed by every dimension. Rejected: reusing the reports
only (no skill dimension).
2. **Usage view** (operator): a new Resources panel. Group by one dimension
(skill, tool, subagent, repo, model, agent, account, hour, day); filter by
period and by any dimension's value; columns input, output, cache read,
cache write, total, share, est. $, cache hit rate; sortable; clicking a row
filters to it.
3. **Cost estimate** (operator): one price file per model family (input,
output, cache read and cache write per million tokens, with its date); the
column is labelled "est."; an unknown model shows "–".
4. **Context per turn** (operator, "everything capturable"): per agent and
day, the median and p90 context per turn (input plus cache read) and the
number of compactions, from the same scan.
5. **Bounded**: per hour at most 50 values per dimension; the rest fold into
`(other)`. Retention as the existing token rows.
6. **Host only, names and counts only**: no prompt or tool input text is
stored.
## Approach
```mermaid
flowchart TD
subgraph P["🧭 0 · Preparation"]
P1["📋 Write requirement"] --> P2{"✅ Operator approves?"}
P2 -- "✏️ corrections" --> P1
end
P2 -- "🤖 yes" --> A1
subgraph A["🔬 A · Sampler"]
A1["🏷️ Skill, tool, subagent, repo tags"] --> A2["📏 Context per turn, compactions"]
A2 --> A3{"🧪 Unit and integration green?"}
A3 -- "🔴 no: fix" --> A1
end
A3 -- "🟢 yes" --> B1
subgraph B["📊 B · Usage view"]
B1["🧮 Group, filter, sort API"] --> B2["💲 Est. cost, cache hit rate"]
B2 --> B3["🖥️ Panel with drill-down"]
B3 --> B4{"🧪 E2E green at 1920, 1366, 390?"}
B4 -- "🔴 no: fix" --> B1
B4 -- "🟢 yes" --> BF{"💬 Operator feedback on screenshots?"}
BF -- "✏️ changes" --> B1
end
BF -- "👍 fits" --> D1["🏁 Review, commit with operator OK, hand-over"]
```
## Acceptance Criteria
### Sampler
- [ ] A fixture transcript with a Skill call followed by two assistant
messages tags both with that skill; the messages before it carry `""`.
- [ ] A message with two tool_use blocks counts under each tool name once.
- [ ] A sidechain transcript's tokens carry its agent type; the main thread's
carry `""`.
- [ ] A 51st skill value within one hour lands in `(other)`.
- [ ] No row holds prompt text: a fixture's secret marker string appears in
no output file.
### API and view
- [ ] `GET /api/usage?group=skill&since=<t>` answers rows with the eight
columns; totals equal the sum of the token rows.
- [ ] Est. $ for a fixture model equals the hand-computed price; an unknown
model gives null.
- [ ] Cache hit rate = cache read / (input + cache read) per row.
- [ ] The panel's group select, period select and row click filter as
described; sorting by est. $ orders descending.
### Tests
- Unit:
- [ ] Tagging, folding, price and hit-rate arithmetic in
`tests/test_usage.py`.
- Integration:
- [ ] `/api/usage` through the handler on fixture token rows.
- E2E:
- [ ] `tests/e2e/test_resources_usage_e2e.py`: group switch, drill-down,
screenshots at 1920, 1366 and 390.
+5
View File
@@ -69,4 +69,9 @@ skill defines the format.
- [063 - One Commit Block](063-one-commit-block.md)
- [064 - Code Review](064-code-review.md)
- [065 - Accounts Spreadsheet Round Trip](065-accounts-round-trip.md)
- [066 - Radio Composer Footer](066-radio-composer-footer.md)
- [067 - Rules Page Overview](067-rules-page-overview.md)
- [068 - Schedules Editor](068-schedules-editor.md)
- [069 - Account Usage Bar](069-account-usage-bar.md)
- [070 - Usage Explorer](070-usage-explorer.md)
- [071 - Token and Velocity Diet](071-token-velocity-diet.md)