<!-- GENERATED by npm run build from the workspace (project.md, personas/, journeys/, data/, docs/changes.md, prototype/); do not edit -->
# Building Pipeup: rules for the team and its agents

Read this first. The requirements and criteria are in `requirements.json` beside this file (and in full prose in `../functional-spec.md`); fill in `checklist.md` and return it with your evidence. Every design value is in `../tokens.json`.

## The contract

Build Pipeup on the stack you choose. This specification says what it must do and how to check it; the design workspace beside it says how it looks and behaves. Read them in this order.

1. **The contract:** the functional requirements and their acceptance criteria (what to validate), the success criteria and what is out of scope: `requirements.json` and `../functional-spec.md`.
2. **The screens:** each step in `requirements.json` names its screen's files: its guidance (`journeys/<journey>/screens/<step>.md`: purpose, content, interactions and states) and its mock (`<step>.html`, built from the design system). Each journey's steps and flow are in `journeys/<journey>/journey.md`.
3. **The design system:** the tokens in `design-system/foundations/<foundation>/foundation.css`, with when to use each in `foundation.md` (Color, Density, Icons, Layout, Motion, Navigation, Philosophy, Radius, Typography); the components in `design-system/components/<basic|composite>/<component>/component.md` (when to use, variants, anatomy, accessibility, interaction), each shown in `specimen.html`. Every value in every theme and preset is in `docs/tokens.json`, in plain units (colours in sRGB, sizes in points, durations in milliseconds, easing as curves) and in the W3C design-tokens format: take every colour, size and timing from it, never from the mocks' CSS. The screens use: Avatar (`design-system/components/basic/cmp-avatar/component.md`), Browser chrome (`design-system/components/basic/cmp-browser-chrome/component.md`), Button (`design-system/components/basic/cmp-button/component.md`), Card (`design-system/components/basic/cmp-card/component.md`), Chip (`design-system/components/basic/cmp-chip/component.md`), Code block (`design-system/components/basic/cmp-code-block/component.md`, with its Contract), Comment card (`design-system/components/composite/cmp-comment-card/component.md`), Comment control (`design-system/components/basic/cmp-comment-control/component.md`), Comments panel (`design-system/components/composite/cmp-comments-panel/component.md`), Dialog (`design-system/components/basic/cmp-dialog/component.md`, with its Contract), Highlight (`design-system/components/basic/cmp-highlight/component.md`), Icon button (`design-system/components/basic/cmp-icon-button/component.md`), Inline alert (`design-system/components/basic/cmp-inline-alert/component.md`), Key (`design-system/components/basic/cmp-kbd/component.md`), Naming bar (`design-system/components/composite/cmp-naming-bar/component.md`), Pin (`design-system/components/basic/cmp-pin/component.md`), Popover menu (`design-system/components/composite/cmp-popover-menu/component.md`, with its Contract), Slide (`design-system/components/basic/cmp-slide/component.md`), Switch (`design-system/components/basic/cmp-switch/component.md`), Text field (`design-system/components/basic/cmp-text-field/component.md`). A component's Contract describes its behaviour in terms any platform builds the same way (parts, states, inputs, events, geometry with units and axes, and looks); on a platform other than the web, build it from the Contract, not from the markup.
4. **The reference pictures:** `docs/references/` holds a picture of every screen state and every component variant and state, as the design renders it (light and dark). They define what "looks as designed" means: compare your screens with them, state by state. A picture's frame is the screen's content only: whatever your platform's window adds (a title bar, a toolbar) is outside it. Beside each picture, a `.json` file of the same name holds its layout as data: the frame's size, and for each named element (a screen's parts, a component's reference points) its position and size in points and its text and background colours. Check your screens against them automatically, without looking at pictures; for a component whose view changes (a camera, a zoom, a turn), its points at the default view and at each end of each range say where your build must draw them.
5. **The stand-ins:** the mocks cannot draw some parts as the product looks on its platform (a 3D model, a material and its light, a video, a sound, a platform's own control). Where a mock shows one, it shows only a stand-in (its place, size, colour and state), and so do its reference pictures: never copy a stand-in, and never take its picture as the look; build the look from where each line says it is defined.
   - Comment on any page in Safari: Turn Pipeup on in Safari (screen; its pictures `docs/references/screens/jny-comment-in-safari/turn-on-in-safari--*` show the stand-in):
     - The drawing: the mock shows a dashed box naming the scene. Look: it moves as the website's hero does (the Extensions pane with the pointer ticking Pipeup's row; or a page where a sentence is picked, a comment typed and sent, and its mark stays), and holds its last moment when the Mac asks for reduced motion.
   - Comment on any page in Safari: Answer Safari's one question (screen; its pictures `docs/references/screens/jny-comment-in-safari/allow-once--*` show the stand-in):
     - Safari's permission popover: the mock shows it as a dialog in the window's popover place, under Pipeup's toolbar button, with Safari's three answers. Look: Safari's own popover, in Safari's look, pointing at Pipeup's toolbar button; its title is Safari's. [NEEDS CLARIFICATION: Safari's exact title on the sheet. Proposed: “Pipeup” would like to access this website].
   - Review a document: Drop a pin on an exact spot (screen; its pictures `docs/references/screens/jny-review-a-document/drop-a-pin--*` show the stand-in):
     - The pin: the mock shows the mock draws it in its own row under "The path", in flow. Look: in the product the pin's point sits at the exact spot Maya Option-clicked, kept as a fraction of the width and height of the element it is on (here the heading's row), so it stays put when the window is resized; cmp-pin's page says how it looks.
   - Review a slide deck: Drop a pin on a slide (screen; its pictures `docs/references/screens/jny-review-a-slide-deck/pin-on-a-slide--*` show the stand-in):
     - The pin: the mock shows the mock draws it at the slide's top-right corner, on the slide's pin layer. Look: in the product its point is at the exact spot Maya Option-clicked, kept as a fraction of the slide's width and height, so it keeps its place when the slide is resized (cmp-pin).
   - Review on a phone: Tap a block and type (screen; its pictures `docs/references/screens/jny-review-on-a-phone/tap-to-comment--*` show the stand-in):
     - The on-screen keyboard: the mock shows the mock cannot draw it; the box sits below the paragraph as it would above the keyboard. Look: the box and its buttons stay in the part of the screen the keyboard leaves, below what the comment is about when it fits, above it otherwise.
6. **The icons and assets:** artwork the product draws as it is, never redrawn or replaced: the design's own icons, drawn from `design-system/foundations/fdn-icons/outline.svg` and `design-system/foundations/fdn-icons/solid.svg` (one set per icon preset; each step below lists the icons its screen shows, and each component its own). An icon or asset from anywhere else (another icon set, a system symbol, a placeholder) is a defect under Only what is designed.
7. **The reference prototype:** `prototype/` and its proofs (`prototype/proofs.json`, the last run in `prototype/proofs/report.json`) show the requirements can be met. It is a reference, not the product to ship, and not a choice of how to build it.

When they disagree, the requirements and acceptance criteria win, then a screen's guidance, then its mock; the prototype never overrides them.

Which source is the truth for what:

- **Behaviour:** the requirements and acceptance criteria; each criterion's "Set up" says how to reach its Given.
- **A component's behaviour and geometry:** its Contract (parts, states, inputs, events, geometry, looks, the names that cross to other components, who holds the focus, and how a view changes).
- **Text:** the mocks, as they are written, and each screen's Wording for text that depends on the data.
- **Every value** (colour, size, timing): `docs/tokens.json`.
- **Looks:** the reference pictures in `docs/references/` and the layout beside each; for a part a mock shows only as a stand-in, where its stand-in line says the look is defined, never the picture.
- **Artwork:** the icon sets and the assets.

No fact you need is only in a mock's code or in the prototype. If you find one there, it is a gap in this design: say so in your feedback (below), and do not take it from the code.

### Done means

It is done when you can show it, not when you say so. Deliver this evidence, in this order:

1. **A working slice first:** the first journey, Add Pipeup to a page, from launch to its end, by pointer and by keyboard, on the real platform, shown in pictures before any other journey is built.
2. **Every acceptance criterion as an automated check** named after its id. The run's report lists every id as passed or failed, and counts 88, as many as this specification; a run that counts fewer is not done.
3. **Every screen state beside its reference picture:** a picture of each state the screens design, set beside its picture in `docs/references/screens/`, in each appearance the Platform names.
4. **Every journey played** from start to end, by pointer and by keyboard.
5. **The success criteria measured**, as each one says.

Return the evidence in one folder, with your feedback on the design (Your feedback, below): `checklist.md` filled in, one piece of evidence per line, as `checklist.md` (keep its Version column as it is: it says which version of each item you built); the report of the automated checks as `report.xml` (JUnit), `report.json` (each id with `passed` or `failed`) or `report.txt` (one line per id with passed or failed); and your pictures in `pictures/`, each named as its reference picture is (`pictures/<journey>/<step>--<state>--<frame>--<theme>.png`).

### Your feedback on the design

Tell us where this design failed you, so the next build gets it right the first time. Never change the design yourself: build it as designed, or ask when the work depends on it.

- **As you go, `feedback.md`:** one line each time the design did not say, two parts of the design disagree, it cannot be built as designed on the platform, a state, asset or text is missing or it works as designed but feels wrong: `- <gap|conflict|infeasible|missing|friction> · <the design item: a requirement, criterion, screen, component, token, asset or picture>: <what happened>. Did: <what you did>. Propose: <the change to the design>`.
- **At each checkpoint** (the working slice, each journey, done), `retrospective.md`, with three parts, each a list of `- <the design item>: <what happened>. Cost: <the work redone, or the choice that would have been different>. Prevent: <the fact that would have prevented it, written as a requirement, not a technology>`: `## Left out or unclear` (what the design left out or said so it could be read two ways), `## Stated but missed` (what the design stated but you missed, and what would have made it hard to miss), `## Our own mistakes` (your own mistakes, which do not change the design).

Return both with your evidence. The owner accepts, rejects or defers each item; an accepted one changes the design, and the next reply says what changed.

### Only what is designed

Build only what the requirements, the screens and the components design. A control, screen, text or behaviour that is not designed is a defect, not an improvement. When something seems missing, write it down as a question with a proposed answer and ask; the work that depends on it waits.

Before building a step, read its guidance and its mock (each frame's mock when it has several), the Contracts of the components it lists, its Wording and stand-ins, its icons and assets, and its reference pictures and their layouts. Each criterion's Set up says how to reach its Given; a criterion with none starts on its step's screen.

## A map of the design

Where each journey's screens are and what each uses. It maps the design, not the code: the stack and the structure are yours to choose.

### Add Pipeup to a page
`journeys/jny-add-pipeup-to-a-page/journey.md` · for Tom Adeyemi

- **Add the script tag and the key** (`add-the-script`): `journeys/jny-add-pipeup-to-a-page/screens/add-the-script.md`, `journeys/jny-add-pipeup-to-a-page/screens/add-the-script.html` · uses Button, Code block
- **Run the check** (`check-the-page`): `journeys/jny-add-pipeup-to-a-page/screens/check-the-page.md`, `journeys/jny-add-pipeup-to-a-page/screens/check-the-page.html` · uses Code block

### Collect feedback from several reviewers
`journeys/jny-collect-feedback/journey.md` · for Tom Adeyemi

- **See every reviewer's comments on the page** (`see-everyones-comments`): `journeys/jny-collect-feedback/screens/see-everyones-comments.md`, `journeys/jny-collect-feedback/screens/see-everyones-comments.html` · uses Avatar, Button, Comment card, Comment control, Highlight, Icon button, Pin, Text field
- **Hand the comments to an agent** (`hand-to-agent`): `journeys/jny-collect-feedback/screens/hand-to-agent.md`, `journeys/jny-collect-feedback/screens/hand-to-agent.html` · uses Avatar, Button, Comment card, Comment control, Highlight, Icon button, Inline alert, Key, Pin, Popover menu

### Come back to a page later
`journeys/jny-come-back-later/journey.md` · for Maya Lindqvist

- **Reopen the page with its comments** (`reopen-page`): `journeys/jny-come-back-later/screens/reopen-page.md`, `journeys/jny-come-back-later/screens/reopen-page.html` · uses Avatar, Button, Comment card, Comment control, Highlight, Icon button, Pin, Popover menu
- **Hide the comments to read** (`hide-comments`): `journeys/jny-come-back-later/screens/hide-comments.md`, `journeys/jny-come-back-later/screens/hide-comments.html` · uses Comment control
- **Find a thread whose words were cut** (`content-gone`): `journeys/jny-come-back-later/screens/content-gone.md`, `journeys/jny-come-back-later/screens/content-gone.html` · uses Avatar, Button, Chip, Comment card, Comments panel, Highlight, Icon button, Inline alert, Key, Pin, Popover menu, Switch, Text field

### Comment on any page in Safari
`journeys/jny-comment-in-safari/journey.md` · for Maya Lindqvist

- **Turn Pipeup on in Safari** (`turn-on-in-safari`): `journeys/jny-comment-in-safari/screens/turn-on-in-safari.md`, `journeys/jny-comment-in-safari/screens/turn-on-in-safari.html` · uses Button, Card
- **Press Pipeup in the toolbar** (`press-pipeup`): `journeys/jny-comment-in-safari/screens/press-pipeup.md`, `journeys/jny-comment-in-safari/screens/press-pipeup.html` · uses Browser chrome, Button, Popover menu
- **Answer Safari's one question** (`allow-once`): `journeys/jny-comment-in-safari/screens/allow-once.md`, `journeys/jny-comment-in-safari/screens/allow-once.html` · uses Browser chrome, Button, Dialog, Inline alert, Naming bar
- **Write the first comment** (`first-comment`): `journeys/jny-comment-in-safari/screens/first-comment.md`, `journeys/jny-comment-in-safari/screens/first-comment.html` · uses Avatar, Browser chrome, Button, Comment card, Highlight, Icon button, Inline alert, Naming bar, Text field
- **Copy or save from the toolbar menu** (`the-menu`): `journeys/jny-comment-in-safari/screens/the-menu.md`, `journeys/jny-comment-in-safari/screens/the-menu.html` · uses Browser chrome, Button, Highlight, Key, Popover menu
- **A page with Pipeup built in** (`built-in-page`): `journeys/jny-comment-in-safari/screens/built-in-page.md`, `journeys/jny-comment-in-safari/screens/built-in-page.html` · uses Browser chrome, Comment control, Popover menu

### Go through every comment
`journeys/jny-go-through-every-comment/journey.md` · for Maya Lindqvist

- **See every comment in one place** (`all-comments`): `journeys/jny-go-through-every-comment/screens/all-comments.md`, `journeys/jny-go-through-every-comment/screens/all-comments.html` · uses Avatar, Button, Chip, Comment card, Comments panel, Highlight, Icon button, Key, Pin, Popover menu, Switch, Text field
- **Bring resolved threads back** (`show-resolved`): `journeys/jny-go-through-every-comment/screens/show-resolved.md`, `journeys/jny-go-through-every-comment/screens/show-resolved.html` · uses Avatar, Button, Chip, Comment card, Comments panel, Highlight, Icon button, Key, Pin, Popover menu, Switch

### Manage a thread
`journeys/jny-manage-a-thread/journey.md` · for Maya Lindqvist

- **Reply, react, or change your mind** (`answer-a-thread`): `journeys/jny-manage-a-thread/screens/answer-a-thread.md`, `journeys/jny-manage-a-thread/screens/answer-a-thread.html` · uses Avatar, Button, Chip, Comment card, Comment control, Icon button, Popover menu, Text field
- **Delete a comment, asked once more** (`delete-a-thread`): `journeys/jny-manage-a-thread/screens/delete-a-thread.md`, `journeys/jny-manage-a-thread/screens/delete-a-thread.html` · uses Avatar, Button, Comment card, Comment control, Dialog, Icon button, Popover menu, Text field
- **Resolve a thread, and bring it back** (`resolve-a-thread`): `journeys/jny-manage-a-thread/screens/resolve-a-thread.md`, `journeys/jny-manage-a-thread/screens/resolve-a-thread.html` · uses Avatar, Button, Comment card, Comment control, Highlight, Icon button, Inline alert, Pin, Popover menu

### Review a document
`journeys/jny-review-a-document/journey.md` · for Maya Lindqvist

- **Open the page** (`open-page`): `journeys/jny-review-a-document/screens/open-page.md`, `journeys/jny-review-a-document/screens/open-page.html` · uses Comment control
- **Pick a block to comment on** (`pick-a-block`): `journeys/jny-review-a-document/screens/pick-a-block.md`, `journeys/jny-review-a-document/screens/pick-a-block.html` · uses Comment control, Icon button, Inline alert, Naming bar
- **Write the comment** (`write-comment`): `journeys/jny-review-a-document/screens/write-comment.md`, `journeys/jny-review-a-document/screens/write-comment.html` · uses Avatar, Button, Comment card, Comment control, Icon button, Naming bar, Text field
- **Read it back beside the text** (`read-thread`): `journeys/jny-review-a-document/screens/read-thread.md`, `journeys/jny-review-a-document/screens/read-thread.html` · uses Avatar, Comment card, Comment control, Icon button, Text field
- **Comment on a few words** (`select-words`): `journeys/jny-review-a-document/screens/select-words.md`, `journeys/jny-review-a-document/screens/select-words.html` · uses Avatar, Button, Comment card, Comment control, Highlight, Icon button, Text field
- **Drop a pin on an exact spot** (`drop-a-pin`): `journeys/jny-review-a-document/screens/drop-a-pin.md`, `journeys/jny-review-a-document/screens/drop-a-pin.html` · uses Avatar, Button, Comment card, Comment control, Highlight, Icon button, Pin, Text field
- **Copy every comment as Markdown** (`copy-for-ai`): `journeys/jny-review-a-document/screens/copy-for-ai.md`, `journeys/jny-review-a-document/screens/copy-for-ai.html` · uses Avatar, Button, Comment card, Comment control, Highlight, Icon button, Inline alert, Key, Pin, Popover menu
- **The clipboard is blocked** (`clipboard-blocked`): `journeys/jny-review-a-document/screens/clipboard-blocked.md`, `journeys/jny-review-a-document/screens/clipboard-blocked.html` · uses Code block, Comment control, Highlight, Inline alert, Key, Pin
- **Undo a cancelled comment** (`undo-a-cancel`): `journeys/jny-review-a-document/screens/undo-a-cancel.md`, `journeys/jny-review-a-document/screens/undo-a-cancel.html` · uses Avatar, Button, Comment card, Comment control, Icon button, Inline alert, Naming bar, Text field

### Review a slide deck
`journeys/jny-review-a-slide-deck/journey.md` · for Maya Lindqvist

- **Open the deck** (`open-deck`): `journeys/jny-review-a-slide-deck/screens/open-deck.md`, `journeys/jny-review-a-slide-deck/screens/open-deck.html` · uses Comment control, Icon button, Slide
- **Drop a pin on a slide** (`pin-on-a-slide`): `journeys/jny-review-a-slide-deck/screens/pin-on-a-slide.md`, `journeys/jny-review-a-slide-deck/screens/pin-on-a-slide.html` · uses Avatar, Button, Comment card, Comment control, Icon button, Naming bar, Pin, Slide, Text field
- **Turn to the next slide** (`turn-the-slide`): `journeys/jny-review-a-slide-deck/screens/turn-the-slide.md`, `journeys/jny-review-a-slide-deck/screens/turn-the-slide.html` · uses Comment control, Icon button, Slide
- **See every comment grouped by slide** (`comments-by-slide`): `journeys/jny-review-a-slide-deck/screens/comments-by-slide.md`, `journeys/jny-review-a-slide-deck/screens/comments-by-slide.html` · uses Avatar, Button, Chip, Comment card, Comments panel, Icon button, Key, Pin, Popover menu, Slide, Switch, Text field

### Review on a phone
`journeys/jny-review-on-a-phone/journey.md` · for Maya Lindqvist

- **Open the page on a phone** (`open-on-phone`): `journeys/jny-review-on-a-phone/screens/open-on-phone.md`, `journeys/jny-review-on-a-phone/screens/open-on-phone.html` · uses Comment control
- **Tap a block and type** (`tap-to-comment`): `journeys/jny-review-on-a-phone/screens/tap-to-comment.md`, `journeys/jny-review-on-a-phone/screens/tap-to-comment.html` · uses Avatar, Button, Comment card, Comment control, Icon button, Naming bar, Text field
- **See every comment full width** (`all-comments-on-phone`): `journeys/jny-review-on-a-phone/screens/all-comments-on-phone.md`, `journeys/jny-review-on-a-phone/screens/all-comments-on-phone.html` · uses Avatar, Button, Chip, Comment card, Comments panel, Highlight, Icon button, Key, Pin, Popover menu, Switch, Text field

### Say who you are
`journeys/jny-say-who-you-are/journey.md` · for Maya Lindqvist

- **Add your name** (`add-your-name`): `journeys/jny-say-who-you-are/screens/add-your-name.md`, `journeys/jny-say-who-you-are/screens/add-your-name.html` · uses Avatar, Button, Comment card, Comment control, Highlight, Icon button, Key, Pin, Popover menu, Text field
