diff --git a/docs/requirements/072-queue-controls-tab.md b/docs/requirements/072-queue-controls-tab.md new file mode 100644 index 0000000..137a968 --- /dev/null +++ b/docs/requirements/072-queue-controls-tab.md @@ -0,0 +1,79 @@ +# 072 - Queue Controls Tab + +## User Story + +As the operator, I want the queue's learnings and settings in the hub, +editable with my passkey, so that I tune budgets and caps without editing +the queue's config file by hand. + +## Decisions (operator-confirmed 2026-11-27; do not re-litigate) + +1. **Own tab** (operator): a Controls tab "Queue" beside Rules and + Schedules. Rejected: a section in the Rules page (the page grows long). +2. **Learnings read-only**: per kind runs, RAM and CPU share, slot limit, + light flag and caps; per signature the learned rows; the last 20 history + rows. `queue.py learned --json` delivers them and the hub runs it + read-only. +3. **Settings editable** (operator: with passkey): `budget_percent`, + `ram_cap_percent` per kind, `slots` and `load_limits`. Changes are + staged; one passkey assertion signs the batch; the host runner runs + `queue.py config set ` by argv, and queue.py checks every + value as its config check already does. Rejected: the hub writes the + config file itself (it runs in a container without host write access); + read-only only (operator wants to edit). +4. **No CPU cap per kind**: the operator picked the override (073) for a + job the CPU budget holds. Rejected: `cpu_cap_percent`; throttling jobs + through systemd scopes; booking CPU softly. + +## Approach + +```mermaid +flowchart TD + subgraph P["๐Ÿงญ 0 ยท Preparation"] + P1["๐Ÿ“‹ Write requirement"] --> P2{"โœ… Operator approves?"} + P2 -- "โœ๏ธ corrections" --> P1 + end + P2 -- "๐Ÿค– yes" --> A1 + subgraph A["๐Ÿงฎ A ยท queue.py"] + A1["๐Ÿ“ค learned --json"] --> A2["โœ๏ธ config set with the config check"] + A2 --> A3{"๐Ÿงช Unit tests green?"} + A3 -- "๐Ÿ”ด no: fix" --> A1 + end + A3 -- "๐ŸŸข yes" --> B1 + subgraph B["๐Ÿ—‚๏ธ B ยท Hub tab"] + B1["๐Ÿ“Š Learnings table"] --> B2["๐Ÿ” Staged settings, one signature"] + B2 --> B3{"๐Ÿงช Integration and E2E green?"} + 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 + +### queue.py + +- [ ] `queue.py learned --json` prints kinds, signatures, budget, caps, + load limits, slots and the last 20 history rows, and writes nothing. +- [ ] `queue.py config set ` refuses a bad value with exit 2 + and leaves the config file byte-identical; a good value changes only + its key. + +### Hub + +- [ ] The Queue tab shows the learnings table and the current settings. +- [ ] Staging two changes asks for one passkey assertion; the runner applies + both by argv; the tab shows the new values after the next poll. +- [ ] The hub never writes the config file itself. + +### Tests + +- Unit: + - [ ] `learned --json` and `config set` over fixture histories and + configs. +- Integration: + - [ ] The signed queue job through the HTTP handler and the runner's argv. +- E2E: + - [ ] `tests/e2e/test_queue_tab_e2e.py`: table, staging, one signature, + screenshots at 1920, 1366 and 390. diff --git a/docs/requirements/073-queue-override.md b/docs/requirements/073-queue-override.md new file mode 100644 index 0000000..0652788 --- /dev/null +++ b/docs/requirements/073-queue-override.md @@ -0,0 +1,72 @@ +# 073 - Queue Override + +## User Story + +As the operator, I want to start one waiting queue job at once from the +hub, so that a gate does not wait on a budget I accept to exceed. + +## Decisions (operator-confirmed 2026-11-27; do not re-litigate) + +1. **Budget only** (operator): the override skips `budget_percent`, slot + limits, reservations and rank; the live guard (`load_limits` CPU and + memory) and the free-disk check stay. Rejected: skipping everything (out + of memory, full disk); a warning step before the start (one more click). +2. **One job, one signature**: a "Start now" button on every waiting job in + the Queue tab (072) and on its Kanban card; the passkey signs the job + id; the host runner runs `queue.py override ` by argv. +3. **Honest learning**: `queue.py override ` marks the entry + `{"override": {"ts": }}`; the next grant pass grants it ahead of + rank while the live guard allows; its history row records + `override: true`. + +## Approach + +```mermaid +flowchart TD + subgraph P["๐Ÿงญ 0 ยท Preparation"] + P1["๐Ÿ“‹ Write requirement"] --> P2{"โœ… Operator approves?"} + P2 -- "โœ๏ธ corrections" --> P1 + end + P2 -- "๐Ÿค– yes" --> A1 + subgraph A["โฉ A ยท queue.py"] + A1["๐Ÿท๏ธ override marks the entry"] --> A2["๐Ÿšฆ Grant pass skips budget, keeps live guard"] + A2 --> A3{"๐Ÿงช Unit tests green?"} + A3 -- "๐Ÿ”ด no: fix" --> A1 + end + A3 -- "๐ŸŸข yes" --> B1 + subgraph B["๐Ÿ–ฑ๏ธ B ยท Hub"] + B1["๐Ÿ” Start now, signed"] --> B2{"๐Ÿงช Integration and E2E green?"} + B2 -- "๐Ÿ”ด no: fix" --> B1 + B2 -- "๐ŸŸข yes" --> BF{"๐Ÿ’ฌ Operator feedback?"} + BF -- "โœ๏ธ changes" --> B1 + end + BF -- "๐Ÿ‘ fits" --> D1["๐Ÿ Review, commit with operator OK, hand-over"] +``` + +## Acceptance Criteria + +### Queue + +- [ ] An overridden queued entry is granted on the next pass although the + budget would hold it. +- [ ] With CPU busy at or above `load_limits.cpu_percent` it still waits, + and its reason names the live guard. +- [ ] `queue.py override` of an unknown or running id exits 2 and changes + nothing. +- [ ] The job's history row carries `override: true`. + +### Hub + +- [ ] "Start now" signs once; the card shows the job granted within one + poll. + +### Tests + +- Unit: + - [ ] The grant pass with and without override, and the live guard. +- Integration: + - [ ] The signed override job through the HTTP handler and the runner's + argv. +- E2E: + - [ ] `tests/e2e/test_queue_override_e2e.py`: "Start now" on a waiting + fixture job, screenshots at 1920, 1366 and 390. diff --git a/docs/requirements/074-running-on-the-board.md b/docs/requirements/074-running-on-the-board.md new file mode 100644 index 0000000..31337b0 --- /dev/null +++ b/docs/requirements/074-running-on-the-board.md @@ -0,0 +1,69 @@ +# 074 - Running on the Board + +## User Story + +As the operator, I want to see at a glance on the Kanban board what runs +right now and what kind of work it is. + +## Decisions (operator-confirmed 2026-11-27; do not re-litigate) + +1. **Three marks, all shown, told apart** (operator): + - queue job active: icon `bi-cpu`, accent tone, job kind and runtime; + - agent working: icon `bi-person-workspace`, ok tone, agent and since + when; + - hub job running: icon `bi-terminal`, info tone, the command's head. + + Sources: the active entries of `queue.json`, the presence heartbeats of + the task's R or worker within the last 5 minutes, and `runner-job.json`. +2. **Card look** (operator: highlighted, gently pulsing, not intrusive): a + 2 px border in the mark's tone and a slow glow pulse of 3 s that + animates opacity only, never size; several marks show several chips and + the border takes the first in the order above; with + `prefers-reduced-motion` the border stays static. +3. **Filter**: a board chip "Running" shows only marked cards. + +## Approach + +```mermaid +flowchart TD + subgraph P["๐Ÿงญ 0 ยท Preparation"] + P1["๐Ÿ“‹ Write requirement"] --> P2{"โœ… Operator approves?"} + P2 -- "โœ๏ธ corrections" --> P1 + end + P2 -- "๐Ÿค– yes" --> A1 + subgraph A["๐ŸŸข A ยท Marks"] + A1["๐Ÿงฎ Kanban.marks from queue, presence, runner"] --> A2["๐ŸŽจ Border, chips, glow"] + A2 --> A3{"๐Ÿงช Unit and E2E green?"} + A3 -- "๐Ÿ”ด no: fix" --> A1 + A3 -- "๐ŸŸข yes" --> AF{"๐Ÿ’ฌ Operator feedback on screenshots?"} + AF -- "โœ๏ธ changes" --> A2 + end + AF -- "๐Ÿ‘ fits" --> D1["๐Ÿ Review, commit with operator OK, hand-over"] +``` + +## Acceptance Criteria + +### Marks + +- [ ] A task with an active queue job shows the cpu chip with kind and + runtime and the accent border. +- [ ] A task whose worker beat 2 minutes ago shows the agent chip; one that + beat 10 minutes ago shows none. +- [ ] `runner-job.json` naming the task's row shows the terminal chip. +- [ ] The "Running" chip hides every unmarked card. + +### Motion + +- [ ] The glow animates only `opacity` over 3 s; `prefers-reduced-motion` + stops it. + +### Tests + +- Unit: + - [ ] `Kanban.marks` over fixtures of all three sources. +- Integration: + - [ ] The state payload carries the presence and runner sources the board + reads. +- E2E: + - [ ] `tests/e2e/test_board_running_e2e.py`: chips, border, filter, + screenshots at 1920, 1366 and 390. diff --git a/docs/requirements/075-stale-task-prune.md b/docs/requirements/075-stale-task-prune.md new file mode 100644 index 0000000..9bc4475 --- /dev/null +++ b/docs/requirements/075-stale-task-prune.md @@ -0,0 +1,82 @@ +# 075 - Stale Task Prune + +## User Story + +As the operator, I want to prune stale tasks in one step, with the agents +able to object, so that the board stays clean. + +## Decisions (operator-confirmed 2026-11-27; do not re-litigate) + +1. **Stale** = an open task without a register change for N days and + without a running mark (074); N starts at `Plan.STALE_DAYS` (3) and is + set in the dialog (operator). +2. **Prune dialog** (operator): a checklist of the stale tasks, the days + field and the answer deadline on the analog dial, 10 minutes to start + with. The undo dial of `page-dial.js` is refactored into one dial + component that both use. +3. **Announcement** (operator): on Prune one passkey assertion signs the + list and the deadline, and the hub sends a Sรฉcuritรฉ radio message to all + that names every task and the deadline. +4. **Objection**: an agent keeps a task before the deadline with + `rasci.py keep `; any register change of the task counts as + keeping it. +5. **Prune to stopped** (operator: option 1): at the deadline the runner + sets every task nobody kept to stopped + (`rasci.py set --status stopped`); the register archive takes it + after 7 days. Rejected: `rasci.py rm` (deleted for good). + +## Approach + +```mermaid +flowchart TD + subgraph P["๐Ÿงญ 0 ยท Preparation"] + P1["๐Ÿ“‹ Write requirement"] --> P2{"โœ… Operator approves?"} + P2 -- "โœ๏ธ corrections" --> P1 + end + P2 -- "๐Ÿค– yes" --> A1 + subgraph A["๐Ÿ•ฐ๏ธ A ยท Dial"] + A1["โ™ป๏ธ One dial component for undo and prune"] --> A2{"๐Ÿงช Undo tests still green?"} + A2 -- "๐Ÿ”ด no: fix" --> A1 + end + A2 -- "๐ŸŸข yes" --> B1 + subgraph B["๐Ÿงน B ยท Prune"] + B1["๐Ÿ“‹ Dialog, signed list and deadline"] --> B2["๐Ÿ“ข Sรฉcuritรฉ message"] + B2 --> B3["โฑ๏ธ Deadline: stop the unkept tasks"] + B3 --> B4{"๐Ÿงช Unit, integration and E2E green?"} + 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 + +### Dialog + +- [ ] The dialog lists exactly the stale tasks for the chosen N. +- [ ] The deadline sits on the analog dial, and the dial counts down until + it. + +### Prune + +- [ ] The Sรฉcuritรฉ row names every task and the deadline. +- [ ] A task kept before the deadline stays open; every other listed task + is stopped at the deadline. +- [ ] A task that was not in the signed list is never changed. + +### Dial + +- [ ] The undo dial and the prune dial are one component, and the undo + tests pass unchanged. + +### Tests + +- Unit: + - [ ] Stale selection, `rasci.py keep` and the deadline apply. +- Integration: + - [ ] The signed prune job through the HTTP handler and the runner's + argv. +- E2E: + - [ ] `tests/e2e/test_stale_prune_e2e.py`: dialog, dial, countdown, + screenshots at 1920, 1366 and 390. diff --git a/docs/requirements/076-release-cut.md b/docs/requirements/076-release-cut.md new file mode 100644 index 0000000..603895d --- /dev/null +++ b/docs/requirements/076-release-cut.md @@ -0,0 +1,119 @@ +# 076 - Release Cut + +## User Story + +As the operator, I want one skill that audits a release range, writes the +changelog and hands me the signed release, so that nothing ships unaudited +and a release costs me one passkey click. + +## Decisions (operator-confirmed 2026-11-27; do not re-litigate) + +1. **Name and reach** (operator): `kvb-release-cut`, beside `kvb-release` + (the announcement), `kvb-release-changelog` and the other `kvb-release-*` + skills; it goes through to the signed release row. Rejected: + `kvb-code-release` (a release is no code edit and would split the + family); stopping at the message. +2. **Audit lives in Quality** (operator): the deep audit is Quality's + `kvb-quality-audit` (Quality requirement 011), which pins Cloudflare's + `security-audit` skill (MIT) at a commit, since upstream has no tags, + keeps its output outside the repository's tracked tree and runs target + code only sandboxed. This skill only orchestrates. Rejected: the + audit in this repository (022: analysis lives once in Quality); release + orchestration in Quality (it drives the register, operator rows and the + hub). +3. **Before every release** (operator): the audit covers the range from the + newest `vX.Y.Z` tag to HEAD. Pushes keep the cheaper 064 review. + Rejected: on every push (a multi-agent audit per push); on demand only + (no gate). +4. **MEDUSA seeds, the audit verifies** (operator): the MEDUSA scan of the + range runs first and hands its findings to the audit's validation phase + as candidates. A `rejected` verdict with its source trace becomes the + acceptance row of `kvb-check-security`, so false positives need no + manual skeptic round. The audit hunts its own logic and trust holes in + parallel. Rejected: both side by side (the manual round stays); the + audit replacing MEDUSA (loses its secret and CVE rules). +5. **Attestation**: the result is stored for the exact HEAD tree, as the + 064 stamp is. The skill calls Quality's + `audit --repo --range ..HEAD --out --budget + [--profile quick|standard|deep]` and reads + `/attestation-.json`; a release needs its verdict `pass` (or + `skipped` for a documentation-only range) for the HEAD tree. Exit 1 + (`blocked`) stops the skill. A `needs_validation` critical or high finding + blocks like a confirmed one (operator pick in Quality requirement 011: + fail closed). +6. **Cost first** (operator: as cheap and efficient as possible): + - only files the range changes, plus the trust-boundary neighbours the + audit's reconnaissance names; + - MEDUSA from its per-file cache (010) and the 064 review memory, so + reviewed blobs are not scanned again; + - an unchanged tree reuses its attestation; a range of documentation + only skips the audit and says so; + - subagent models per `kvb-org-perform`; heavy phases through + `queue.py hold`; + - the run reports its tokens and minutes (`kvb-check-efficiency`). +7. **Release row** (operator): after a green attestation the skill runs + `kvb-release-changelog` for the message and bump and adds one hub row + `pkgmgr release -m ` with `--dir` set to the checkout to + release, for the operator's passkey; the host runner runs it where GPG + is. Then it offers `kvb-release` for the announcement. +8. **pkgmgr guards the tree** (PKGMGR, fix/release-cwd in package-manager): + pkgmgr releases the git top level of its working directory and refuses + before touching a file when that checkout has tracked changes. The skill + requires a pkgmgr version with that fix and runs no zero-change check of + its own. Rejected: a `kvb-pkgmgr-release` wrapper (the trap belongs fixed + where it lives). + +## Approach + +```mermaid +flowchart TD + subgraph P["๐Ÿงญ 0 ยท Preparation"] + P1["๐Ÿ“‹ Write requirement"] --> P2{"โœ… Operator approves?"} + P2 -- "โœ๏ธ corrections" --> P1 + end + P2 -- "๐Ÿค– yes" --> A1 + subgraph A["๐Ÿ›ก๏ธ A ยท Audit attestation"] + A1["๐Ÿ”Ž MEDUSA seeds over the range"] --> A2["๐Ÿงช kvb-quality-audit verifies and hunts"] + A2 --> A3{"โœ… 0 confirmed critical or high?"} + A3 -- "๐Ÿ”ด no: fix, commit, rerun" --> A1 + end + A3 -- "๐ŸŸข yes" --> B1 + subgraph B["๐Ÿท๏ธ B ยท Release"] + B1["๐Ÿ“ kvb-release-changelog message and bump"] --> B2{"๐Ÿงน pkgmgr has the tree guard?"} + B2 -- "๐Ÿ”ด no: update pkgmgr" --> B1 + B2 -- "๐ŸŸข yes" --> B3["๐Ÿ” Hub row pkgmgr release, passkey"] + B3 --> BF{"๐Ÿ’ฌ Operator signs?"} + end + BF -- "๐Ÿ‘ signed" --> D1["๐Ÿ“ฃ Offer kvb-release, hand-over"] +``` + +## Acceptance Criteria + +### Attestation + +- [ ] Without a green attestation for the HEAD tree the skill adds no + release row and names the missing piece. +- [ ] A MEDUSA finding the audit rejects lands as an acceptance row with the + audit's source trace; a confirmed one blocks the release. +- [ ] An unchanged tree reuses its attestation without a new audit run. +- [ ] A range of documentation only skips the audit and says so. + +### Release + +- [ ] Against a pkgmgr without the fix/release-cwd change the skill stops + before the row and names the missing version. +- [ ] The row carries `--dir `, `pkgmgr release -m + ` with the message from `kvb-release-changelog`, and the + attested tree hash. +- [ ] The run prints its tokens and minutes. + +### Tests + +- Unit: + - [ ] Attestation lookup, reuse, the documentation-only skip and the + zero-change check over fixture repositories. +- Integration: + - [ ] A fake audit and a fake MEDUSA through the skill's script: rejected + findings become acceptance rows; a confirmed one blocks. +- E2E: + - n/a: the release row is an operator row; the hub's row E2E covers it. diff --git a/docs/requirements/077-greyed-card-stamp.md b/docs/requirements/077-greyed-card-stamp.md new file mode 100644 index 0000000..4fb62b7 --- /dev/null +++ b/docs/requirements/077-greyed-card-stamp.md @@ -0,0 +1,62 @@ +# 077 - Stamp on Greyed Cards + +## User Story + +As the operator, I want every greyed Match card to carry a fixed stamp that +names why it is greyed, so that I see the reason without hovering. + +## Decisions (operator-confirmed 2026-11-27; do not re-litigate) + +1. **One stamp per reason** (operator): `RUNNING` in the info tone while the + hub runner runs the row, `QUEUED` in the warn tone while it waits in the + runner, `STALE` in the muted tone for a stale card. The hub sends + `blocked_kind` (`running` or `queued`) next to the `blocked` text of + `blocked_reasons()` in `kvb_orchestrator/jobs.py`, so the page never + parses prose. +2. **Look** (operator: like the later and accept stamps, only fixed): the + stamp of `style-match.css` for `ACCEPT`, `REJECT` and `LATER` (4 px + border, rounded, bold caps, slight rotation), fixed in the card's centre, + always at full opacity, never following a swipe. The stamp keeps its + colour while the card stays greyscale: the `grayscale` filter moves from + the card to its children. The tooltip and the hourglass line stay. +3. **Scope**: the front card of Match. Peek tabs keep their tooltip. + Rejected: Inbox and Stream rows (rows, not cards). + +## Approach + +```mermaid +flowchart TD + subgraph P["๐Ÿงญ 0 ยท Preparation"] + P1["๐Ÿ“‹ Write requirement"] --> P2{"โœ… Operator approves?"} + P2 -- "โœ๏ธ corrections" --> P1 + end + P2 -- "๐Ÿค– yes" --> A1 + subgraph A["๐Ÿท๏ธ A ยท Stamp"] + A1["๐Ÿงฎ blocked_kind in the payload"] --> A2["๐ŸŽจ data-stamp and CSS stamp"] + A2 --> A3{"๐Ÿงช Unit, integration and E2E green?"} + A3 -- "๐Ÿ”ด no: fix" --> A1 + A3 -- "๐ŸŸข yes" --> AF{"๐Ÿ’ฌ Operator feedback on screenshots?"} + AF -- "โœ๏ธ changes" --> A2 + end + AF -- "๐Ÿ‘ fits" --> D1["๐Ÿ Review, commit with operator OK, hand-over"] +``` + +## Acceptance Criteria + +### Stamp + +- [ ] A front card whose row the runner runs shows `RUNNING`, a queued one + `QUEUED`, a stale one `STALE`. +- [ ] The stamp's computed colour is not grey and its opacity is 1. +- [ ] A swipe gesture on a greyed card neither moves nor hides the stamp. +- [ ] A card that is not greyed shows no fixed stamp. + +### Tests + +- Unit: + - [ ] `blocked_reasons` returns the kind for a running and a queued job. +- Integration: + - [ ] The Match state payload carries `blocked_kind` for a blocked card. +- E2E: + - [ ] `tests/e2e/test_match_stamp_e2e.py`: all three stamps, colour and + opacity probe, screenshots at 1920, 1366 and 390. diff --git a/docs/requirements/078-commit-tree-diff.md b/docs/requirements/078-commit-tree-diff.md new file mode 100644 index 0000000..5b622bf --- /dev/null +++ b/docs/requirements/078-commit-tree-diff.md @@ -0,0 +1,60 @@ +# 078 - Diff on Commit-Tree Cards + +## User Story + +As the operator, I want an ask card for `git commit-tree` to show the diff +from its parent to its tree, so that I never approve a commit blind. + +## Decisions (operator-confirmed 2026-11-27; do not re-litigate) + +1. **Source**: the runner's existing preview, which already computes diffs + for merge rows, also covers `git commit-tree -p ` asks. It + runs `git diff ` read-only in the ask's working directory. + Rejected: the hub reading the repository itself (the container has no + access to host repositories). +2. **Look** (operator: hide and show again): the same collapsible code box + with the eye toggle as on commit cards, open by default. + +## Approach + +```mermaid +flowchart TD + subgraph P["๐Ÿงญ 0 ยท Preparation"] + P1["๐Ÿ“‹ Write requirement"] --> P2{"โœ… Operator approves?"} + P2 -- "โœ๏ธ corrections" --> P1 + end + P2 -- "๐Ÿค– yes" --> A1 + subgraph A["๐ŸŒณ A ยท Commit-tree diff"] + A1["๐Ÿ”Ž Parse commit-tree argv"] --> A2["๐Ÿงฎ Runner preview: diff parent..tree"] + A2 --> A3["๐ŸŽจ Collapsible code box on the card"] + A3 --> A4{"๐Ÿงช Unit, integration and E2E green?"} + A4 -- "๐Ÿ”ด no: fix" --> A1 + A4 -- "๐ŸŸข yes" --> AF{"๐Ÿ’ฌ Operator feedback on screenshots?"} + AF -- "โœ๏ธ changes" --> A3 + end + AF -- "๐Ÿ‘ fits" --> D1["๐Ÿ Review, commit with operator OK, hand-over"] +``` + +## Acceptance Criteria + +### Diff + +- [ ] A commit-tree ask with a resolvable parent and tree shows every changed + file with its hunks. +- [ ] The eye toggle hides and shows the diff; it starts open. +- [ ] An unresolvable tree or parent shows its git error line instead of the + diff. +- [ ] The preview runs no git command that writes (no `commit-tree`, no + `update-ref`). + +### Tests + +- Unit: + - [ ] Parsing a commit-tree argv yields tree and parent; an argv without + `-p` yields none. +- Integration: + - [ ] The runner preview delivers the files of a commit-tree ask in a + scratch repository. +- E2E: + - [ ] `tests/e2e/test_commit_tree_diff_e2e.py`: diff shown, toggle, error + line, screenshots at 1920, 1366 and 390. diff --git a/docs/requirements/079-paths-open-in-vscode.md b/docs/requirements/079-paths-open-in-vscode.md new file mode 100644 index 0000000..e9f55c9 --- /dev/null +++ b/docs/requirements/079-paths-open-in-vscode.md @@ -0,0 +1,57 @@ +# 079 - Paths Open in VS Code + +## User Story + +As the operator, I want to click folder and file names on cards and have them +open in VS Code, so that I inspect a change without typing its path. + +## Decisions (operator-confirmed 2026-11-27; do not re-litigate) + +1. **`vscode://file/`** (operator): a file opens in VS Code, a + folder opens as a window. Rejected: a file viewer in the hub (new trust + boundary, the container would read host files); a browser extension + (effort); a runner `xdg-open` (a signature per click). +2. **Where**: the folder chip, the worktree chip, and the file head of every + diff (worktree plus relative path). +3. **Copy**: right-click copies the full path, as left-click does today. + +## Approach + +```mermaid +flowchart TD + subgraph P["๐Ÿงญ 0 ยท Preparation"] + P1["๐Ÿ“‹ Write requirement"] --> P2{"โœ… Operator approves?"} + P2 -- "โœ๏ธ corrections" --> P1 + end + P2 -- "๐Ÿค– yes" --> A1 + subgraph A["๐Ÿ”— A ยท Path links"] + A1["๐Ÿงฉ Link builder"] --> A2["๐Ÿท๏ธ Chips and diff heads as links"] + A2 --> A3["๐Ÿ“‹ Right-click copies"] + A3 --> A4{"๐Ÿงช Unit and E2E green?"} + A4 -- "๐Ÿ”ด no: fix" --> A1 + A4 -- "๐ŸŸข yes" --> AF{"๐Ÿ’ฌ Operator feedback on screenshots?"} + AF -- "โœ๏ธ changes" --> A2 + end + AF -- "๐Ÿ‘ fits" --> D1["๐Ÿ Review, commit with operator OK, hand-over"] +``` + +## Acceptance Criteria + +### Links + +- [ ] The `href` of the folder chip is exactly `vscode://file/`. +- [ ] The worktree chip links the same way to its worktree. +- [ ] A diff file head links to `/`. +- [ ] Right-click on a link copies the full path and opens no context menu. +- [ ] A relative or empty path renders as text without a link. + +### Tests + +- Unit: + - [ ] The link builder (node): absolute path, characters needing encoding, + relative and empty path. +- Integration: + - n/a: page only, no hub or runner change. +- E2E: + - [ ] `tests/e2e/test_path_links_e2e.py`: hrefs and right-click copy, + screenshots at 1920, 1366 and 390. diff --git a/docs/requirements/080-expired-cards-stay.md b/docs/requirements/080-expired-cards-stay.md new file mode 100644 index 0000000..10b5fd7 --- /dev/null +++ b/docs/requirements/080-expired-cards-stay.md @@ -0,0 +1,79 @@ +# 080 - Expired Cards Stay + +## User Story + +As the operator, I want expired asks and decisions to stay greyed out with a +stamp, so that I see what went unanswered and can still answer it. + +## Decisions (operator-confirmed 2026-11-27; do not re-litigate) + +1. **Kept**: an expired ask or decision stays a Match card until the operator + denies it, greyed out, with the `EXPIRED` stamp of 077. Hovering the stamp + shows a tooltip naming since when the card is expired (operator). +2. **Only Deny**: Accept is disabled, because the tool call has already gone + back to the terminal. Deny goes through the release card like every + rejection. The agent gets "expired before the operator decided" by radio, + plus the operator's feedback text. +3. **Only unrun asks, 24 h** (operator): the hub keys each ask by session, + tool and a digest of the tool input (the PermissionRequest hook input + carries no `tool_use_id`); an async PostToolUse hook reports each call + that ran, and a matching pending ask created before it closes as answered + in the terminal and leaves Match. Only an + expired ask whose call never ran stays, at most 24 h after its expiry. + Rejected: a fixed 1 h window (shows asks already answered in the + terminal); every expired ask until denied (2239 undecided asks on + 2026-11-27 would flood the deck). + +## Approach + +```mermaid +flowchart TD + subgraph P["๐Ÿงญ 0 ยท Preparation"] + P1["๐Ÿ“‹ Write requirement"] --> P2{"โœ… Operator approves?"} + P2 -- "โœ๏ธ corrections" --> P1 + end + P2 -- "๐Ÿค– yes" --> A1 + subgraph A["โŒ› A ยท Expired cards"] + A1["๐Ÿ—‚๏ธ Keep expired asks in /api/match"] --> A2["๐Ÿท๏ธ EXPIRED stamp with since-when tooltip"] + A2 --> A3["๐Ÿšซ Accept off, Deny via release card"] + A3 --> A4["๐Ÿ“ป Radio note plus feedback"] + A4 --> A5{"๐Ÿงช Unit, integration and E2E green?"} + A5 -- "๐Ÿ”ด no: fix" --> A1 + A5 -- "๐ŸŸข yes" --> AF{"๐Ÿ’ฌ Operator feedback on screenshots?"} + AF -- "โœ๏ธ changes" --> A2 + end + AF -- "๐Ÿ‘ fits" --> D1["๐Ÿ Review, commit with operator OK, hand-over"] +``` + +## Acceptance Criteria + +### Card + +- [ ] An ask or decision past its `expires` is still in `/api/match` with + `blocked_kind: "expired"` and its `expires` time. +- [ ] The card shows the `EXPIRED` stamp; hovering it shows a tooltip with + the expiry time and how long ago it was. +- [ ] Accept is disabled on the card; Reject works. +- [ ] An expired ask whose call ran afterwards (same session, tool and input + digest) is closed as answered in the terminal and is not in + `/api/match`. +- [ ] An expired ask more than 24 h past its `expires` is not in + `/api/match`. + +### Release + +- [ ] After the release, the agent's radio holds "expired before the + operator decided" and the feedback text. +- [ ] After the release, the card is gone from `/api/match`. + +### Tests + +- Unit: + - [ ] The expired filter keeps an expired ask with `blocked_kind: + "expired"` and drops a decided one. +- Integration: + - [ ] A denied expired card goes through the release and posts the radio + note. +- E2E: + - [ ] `tests/e2e/test_match_expired_e2e.py`: stamp, tooltip text, Accept + disabled, Deny, screenshots at 1920, 1366 and 390. diff --git a/docs/requirements/081-match-refresh-hourglass.md b/docs/requirements/081-match-refresh-hourglass.md new file mode 100644 index 0000000..7465c66 --- /dev/null +++ b/docs/requirements/081-match-refresh-hourglass.md @@ -0,0 +1,62 @@ +# 081 - Match Refresh Hourglass + +## User Story + +As the operator, I want to see when Match fetches its cards next, so that I +know whether an empty deck is current. + +## Decisions (operator-confirmed 2026-11-27; do not re-litigate) + +1. **Interval stays 2 s** (operator): it costs no tokens, only a request from + the browser to the hub. +2. **Hourglass** (operator): small in the Match head, large in the empty + deck. It flips fast after every fetch, and small sand grains run during + the interval. Rejected: an analog clock that jumps. +3. **Clicks**: right-click sets the interval with the generic dial of 075 (1 + to 60 s, stored in the hub settings); left-click fetches at once. +4. **Reduced motion**: `prefers-reduced-motion` shows a still hourglass. + +## Approach + +```mermaid +flowchart TD + subgraph P["๐Ÿงญ 0 ยท Preparation"] + P1["๐Ÿ“‹ Write requirement"] --> P2{"โœ… Operator approves?"} + P2 -- "โœ๏ธ corrections" --> P1 + end + P2 -- "๐Ÿค– yes" --> A1 + subgraph A["โณ A ยท Hourglass"] + A1["โฑ๏ธ Refresh timer with interval setting"] --> A2["โณ Hourglass flip and sand grains"] + A2 --> A3["๐Ÿ–ฑ๏ธ Left-click fetch, right-click dial"] + A3 --> A4{"๐Ÿงช Unit, integration and E2E green?"} + A4 -- "๐Ÿ”ด no: fix" --> A1 + A4 -- "๐ŸŸข yes" --> AF{"๐Ÿ’ฌ Operator feedback on screenshots?"} + AF -- "โœ๏ธ changes" --> A2 + end + AF -- "๐Ÿ‘ fits" --> D1["๐Ÿ Review, commit with operator OK, hand-over"] +``` + +## Acceptance Criteria + +### Refresh + +- [ ] With the default, Match fetches `/api/match` once every 2 s ยฑ0.3 s. +- [ ] A left-click on the hourglass fetches at once and restarts the cycle. +- [ ] An interval of 10 s set by right-click survives a reload. + +### Look + +- [ ] After a fetch, the hourglass has flipped within 1 s. +- [ ] The empty deck shows the large hourglass, the head the small one. +- [ ] Under `prefers-reduced-motion: reduce` no animation runs. + +### Tests + +- Unit: + - [ ] The timer arithmetic (node): next fetch time, restart on click, + interval bounds 1 and 60 s. +- Integration: + - [ ] The interval is stored in and read from the hub settings. +- E2E: + - [ ] `tests/e2e/test_match_hourglass_e2e.py`: fetch rate, left-click, + right-click dial, reduced motion, screenshots at 1920, 1366 and 390. diff --git a/docs/requirements/082-field-attachments.md b/docs/requirements/082-field-attachments.md new file mode 100644 index 0000000..6c3a530 --- /dev/null +++ b/docs/requirements/082-field-attachments.md @@ -0,0 +1,79 @@ +# 082 - Attachments in Every Text Field + +## User Story + +As the operator, I want to attach files in every hub text field, by pasting a +screenshot with Ctrl+V, dropping a file or clicking a paperclip, so that +agents get my screenshots without a detour. + +## Decisions (operator-confirmed 2026-11-27; do not re-litigate) + +1. **Path line in the text** (operator): the file goes through + `/api/uploads`, and the line `๐Ÿ“Ž ` lands at the cursor. The + signed text carries the path; the signature format stays. Rejected: a + list of uploads in the signed radio message (changes + `signing.message_item` and every message consumer). +2. **One hook**: the `micFrame` sweep of `page-mic.js` already frames every + text field; it also wires paste and drop there. A textarea additionally + gets a ๐Ÿ“Ž button in its footer next to the mic and one chip per + attachment: a thumbnail for an image, a file icon otherwise, and โœ• + removes chip and line. +3. **Placeholder**: `๐Ÿ“Ž uploading โ€ฆ` stands at the cursor until the + upload answers; then it becomes the path line, or the error text on a + failure (over 50 MiB, hub unreachable). A pasted image without a name is + named `paste-.png`. +4. **Plain text stays plain**: Ctrl+V of text pastes as before; only files + upload. + +## Approach + +```mermaid +flowchart TD + subgraph P["๐Ÿงญ 0 ยท Preparation"] + P1["๐Ÿ“‹ Write requirement"] --> P2{"โœ… Operator approves?"} + P2 -- "โœ๏ธ corrections" --> P1 + end + P2 -- "๐Ÿค– yes" --> A1 + subgraph A["๐Ÿ“Ž A ยท Attachments"] + A1["๐Ÿ“‹ Paste and drop hook in the mic sweep"] --> A2["๐Ÿ“Ž Paperclip button and chips"] + A2 --> A3["โณ Placeholder and errors"] + A3 --> A4{"๐Ÿงช Unit, integration and E2E green?"} + A4 -- "๐Ÿ”ด no: fix" --> A1 + A4 -- "๐ŸŸข yes" --> AF{"๐Ÿ’ฌ Operator feedback on screenshots?"} + AF -- "โœ๏ธ changes" --> A2 + end + AF -- "๐Ÿ‘ fits" --> D1["๐Ÿ Review, commit with operator OK, hand-over"] +``` + +## Acceptance Criteria + +### Attach + +- [ ] Ctrl+V of an image in the reject feedback inserts + `๐Ÿ“Ž /paste-.png`, and the file exists below + `uploads//`. +- [ ] Dropping a file on the composer, the accept notes or a decision's + Other field inserts its path line. +- [ ] The ๐Ÿ“Ž button opens the file picker; the chosen file's line lands at + the cursor. +- [ ] Ctrl+V of plain text uploads nothing. + +### Chips and errors + +- [ ] Every attachment of a textarea shows a chip: a thumbnail for an image, + a file icon otherwise. +- [ ] โœ• on a chip removes the chip and its line from the text. +- [ ] A failed upload replaces the placeholder with the error text and + inserts no path. + +### Tests + +- Unit: + - [ ] Path line, name of a pasted image and placeholder swap (node). +- Integration: + - [ ] `/api/uploads` stores a PNG body and returns the host path the line + names. +- E2E: + - [ ] `tests/e2e/test_field_attachments_e2e.py`: synthetic paste, drop and + picker in the reject feedback and the composer, chip โœ•, an upload + over the limit, screenshots at 1920, 1366 and 390. diff --git a/docs/requirements/083-self-tuning-queue.md b/docs/requirements/083-self-tuning-queue.md new file mode 100644 index 0000000..f46edc5 --- /dev/null +++ b/docs/requirements/083-self-tuning-queue.md @@ -0,0 +1,84 @@ +# 083 - Self-Tuning Queue Admission + +## User Story + +As the operator, I want the queue to keep the average CPU and RAM load +between its lower and upper limit on its own, so that no job waits while the +host idles and no job tips the host over. + +## Decisions (operator-confirmed 2026-11-27; do not re-litigate) + +1. **Static band as the base**: a job is granted while the load sits below + the lower limit and its learned footprint keeps the load at or below the + upper limit; smaller jobs backfill around a waiting head job without + starving it. It lands first. +2. **AIMD target** (operator): a target between the lower and the upper + limit. Plus 2 points per poll while the 10-minute average stays below the + lower limit and no memory pressure (PSI) shows; on a load above the upper + limit, rising PSI or swap-out it drops at once to the middle between the + lower limit and its value. One grant per settle window (one load sample + window). +3. **Learned sizes** (operator): per command the p95 peak RAM footprint + instead of the mean, times a margin learned from the error of past + predictions. CPU keeps the median (operator 2026-11-27): a neighbour's + CPU spike must not lift a booking, and CPU overload only slows. +4. **One limits file**: lower and upper limit, STOP and MAYDAY per CPU, RAM, + swap, disk and PSI in one file in the council directory; queue, watch and + hub read it, the live target sits next to it. Per metric lower < upper < + STOP < MAYDAY. +5. **Rejected**: a forecasting scheduler (high effort for little over AIMD); + hard cgroup memory caps per job (a job above its cap is killed). + +## Approach + +```mermaid +flowchart TD + subgraph P["๐Ÿงญ 0 ยท Preparation"] + P1["๐Ÿ“‹ Write requirement"] --> P2{"โœ… Operator approves?"} + P2 -- "โœ๏ธ corrections" --> P1 + end + P2 -- "๐Ÿค– yes" --> A1 + subgraph A["๐Ÿ“ A ยท Static band"] + A1["๐Ÿงฎ Band admission and backfill"] --> A2{"๐Ÿงช Tests green?"} + A2 -- "๐Ÿ”ด no: fix" --> A1 + end + A2 -- "๐ŸŸข yes" --> B1 + subgraph B["๐ŸŽ›๏ธ B ยท Self-tuning"] + B1["๐Ÿ—‚๏ธ Limits file for queue, watch and hub"] --> B2["๐Ÿ“ˆ AIMD target with PSI back-off"] + B2 --> B3["๐Ÿ“ p95 sizes with learned margin"] + B3 --> B4{"๐Ÿงช Tests green?"} + B4 -- "๐Ÿ”ด no: fix" --> B1 + B4 -- "๐ŸŸข yes" --> BF{"๐Ÿ’ฌ Operator feedback on queue list output?"} + BF -- "โœ๏ธ changes" --> B2 + end + BF -- "๐Ÿ‘ fits" --> D1["๐Ÿ Review, commit with operator OK, hand-over"] +``` + +## Acceptance Criteria + +### Admission + +- [ ] Over a simulated load series the target rises by 2 per poll below the + lower limit and falls to the middle after one poll above the upper + limit or with rising PSI. +- [ ] At most one grant per settle window. +- [ ] A grant is refused when used plus the job's p95 footprint times its + margin would exceed the target. +- [ ] The margin grows after a job used more than predicted and shrinks + after one used less. +- [ ] `queue.py list` names the target and each waiting job's reason. + +### Limits file + +- [ ] Queue and watch read their limits from the limits file. +- [ ] A file that breaks lower < upper < STOP < MAYDAY is refused and the + previous limits stay in force. + +### Tests + +- Unit: + - [ ] Target steps, margin update and order check. +- Integration: + - [ ] One queue pass over a load series grants and refuses as above. +- E2E: + - n/a: no page; the board side is requirement 084. diff --git a/docs/requirements/084-resource-limits-board.md b/docs/requirements/084-resource-limits-board.md new file mode 100644 index 0000000..a4ca3d2 --- /dev/null +++ b/docs/requirements/084-resource-limits-board.md @@ -0,0 +1,70 @@ +# 084 - Limits on the Resources Board + +## User Story + +As the operator, I want to see and set the load limits right on the hardware +charts, so that I steer the queue and the alarms without config files. + +## Decisions (operator-confirmed 2026-11-27; do not re-litigate) + +1. **Lines** (operator): every hardware chart (CPU, RAM, swap, disk, PSI) + shows labelled lines for the lower and upper limit, STOP and MAYDAY from + the limits file of 083, plus a thin line for the live target. Rejected: + dragging the lines (accidental moves, poor on touch). +2. **Click a line, get a dial**: a click opens the generic dial of 075 for + exactly that value. +3. **Profiles**: a switch Calm (band 50 to 70), Balanced (70 to 90) and Max + (80 to 95) sets all limits at once; a Limits sheet lists every value in + one table, each with its dial. +4. **Passkey to loosen** (operator): a tighter value applies at once; a + looser one (higher upper limit, STOP or MAYDAY, or a looser profile) + needs the passkey signature. + +## Approach + +```mermaid +flowchart TD + subgraph P["๐Ÿงญ 0 ยท Preparation"] + P1["๐Ÿ“‹ Write requirement"] --> P2{"โœ… Operator approves?"} + P2 -- "โœ๏ธ corrections" --> P1 + end + P2 -- "๐Ÿค– yes" --> A1 + subgraph A["๐Ÿ“Š A ยท Limits board"] + A1["๐Ÿ“ Lines and live target on the charts"] --> A2["๐ŸŽš๏ธ Click a line, dial"] + A2 --> A3["๐Ÿ—‚๏ธ Profiles and Limits sheet"] + A3 --> A4["๐Ÿ”‘ Passkey to loosen"] + A4 --> A5{"๐Ÿงช Unit, integration and E2E green?"} + A5 -- "๐Ÿ”ด no: fix" --> A1 + A5 -- "๐ŸŸข yes" --> AF{"๐Ÿ’ฌ Operator feedback on screenshots?"} + AF -- "โœ๏ธ changes" --> A1 + end + AF -- "๐Ÿ‘ fits" --> D1["๐Ÿ Review, commit with operator OK, hand-over"] +``` + +## Acceptance Criteria + +### Lines and dial + +- [ ] Every hardware chart shows its four limit lines and the target line, + each with a label and a tooltip carrying its value. +- [ ] A click on a line opens the dial; a tighter value is saved without a + signature and lands in the limits file of 083. +- [ ] A value that breaks lower < upper < STOP < MAYDAY shows an error and + is not saved. + +### Profiles and passkey + +- [ ] A profile switch moves every line. +- [ ] A looser value or profile asks for the passkey; a cancel keeps the old + value. + +### Tests + +- Unit: + - [ ] Order check and the tighter-or-looser classification (node). +- Integration: + - [ ] The hub endpoint refuses a looser value without a passkey proof and + accepts it with one. +- E2E: + - [ ] `tests/e2e/test_resource_limits_e2e.py`: lines, dial, profile switch, + passkey path, screenshots at 1920, 1366 and 390. diff --git a/docs/requirements/README.md b/docs/requirements/README.md index b722e0c..e2aaa91 100644 --- a/docs/requirements/README.md +++ b/docs/requirements/README.md @@ -75,3 +75,16 @@ skill defines the format. - [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) +- [072 - Queue Controls Tab](072-queue-controls-tab.md) +- [073 - Queue Override](073-queue-override.md) +- [074 - Running on the Board](074-running-on-the-board.md) +- [075 - Stale Task Prune](075-stale-task-prune.md) +- [076 - Release Cut](076-release-cut.md) +- [077 - Stamp on Greyed Cards](077-greyed-card-stamp.md) +- [078 - Diff on Commit-Tree Cards](078-commit-tree-diff.md) +- [079 - Paths Open in VS Code](079-paths-open-in-vscode.md) +- [080 - Expired Cards Stay](080-expired-cards-stay.md) +- [081 - Match Refresh Hourglass](081-match-refresh-hourglass.md) +- [082 - Attachments in Every Text Field](082-field-attachments.md) +- [083 - Self-Tuning Queue Admission](083-self-tuning-queue.md) +- [084 - Limits on the Resources Board](084-resource-limits-board.md)