Trail's rules for agents
The rules for building with the theme, always in force: read them first
Every path here starts at the app's root (with a src/ folder, put src/ before it); write imports ('@/…') as components.json aliases them.
Always loaded (also goop/trail/AGENTS.md): never reread it. Before your first screen read only what the README's "Start here" names, in its order, then write that screen.
With Goop's tools connected, call goop_plan_page (a new app: goop_plan_app) before any file or command: it plans the page and says what your plan allows; write goop/plan.md from it alone.
"node goop/agent/lookup.mjs find <need>" names a part or recipe; "… part <a> <b>…" prints several in one call ("--full": all); skip any your files use or a recipe shows. Never open a source.
Never break
- Import the theme's unit for every part it has; never redraw one by hand.
- Every colour, size, corner and type size comes from the look sheet or the theme's tokens; write no literal value.
- Where the theme has no unit or value, leave it out and say so; never invent one.
- Never change the theme's colours, corners, spacing, fonts or motion or restyle it to look "distinctive"; never edit tune.css or any other theme file.
- The one theme file you edit: '@/lib/goop/trail/sample-brand' (your brand's name, tile letter, web address).
- Every size, gap and inset is a whole pixel; only hairline borders and rings are 0.5 px.
Before you write a page
Goop's plan file is plan.md in the folder that holds Goop's installed stylesheets (contract.css): src/goop/plan.md in an app with a src/ folder, else ./goop/plan.md beside package.json.
Without Goop's tools, first write the app's job and its objects (what each has: dates from and to, a stage, a parent, a booking slot) as the first two lines of goop/plan.md.
Then run "node goop/agent/start.mjs --app <type> --plan" (no type: the types), take the type whose line fits the job, and run it without --plan.
For a page no app type or screen recipe covers, before choosing its layout: read goop/trail/agent/layout-chooser.md
Then a line a page in goop/plan.md: its job, role and arrangement from what the start printed (else the chooser), the product fact that picked it (Client: RecordPage profile, subject: person).
Pick by the product, never by the page before; where two arrangements fit a page equally, take the one the app uses least.
Before you write a page no screen recipe covers, open the file of its kind: goop/trail/agent/kinds/<kind>.md (settings, list, detail, split, empty).
Every page starts from AppFrame ('@/components/goop/patterns/app-frame'): the navigation in its rail, the top bar in its panel's header, the page inside PageBody.
A page takes its widths from a layout component, never its own: AppFrame fills the window; PageBody, PageColumns or a template sets how wide the content is.
The one exception is a page shown before sign-in (signing in, a first-run setup): it skips AppFrame and centres its own column, a spacing token wide.
Before a page is done, run "node goop/agent/review.mjs check <url> <file>" for all screens at once (url, file, url…): lint, then light and dark on one sheet; it starts and stops the dev server.
The app's index.html (beside package.json; Next.js writes its own) needs <meta name="viewport" content="width=device-width, initial-scale=1"> in <head>, or phones show pages shrunk.
A fresh Vite app's TypeScript lib is ES2020: no .at, replaceAll or formatRange unless the app raises "lib".
Check your screen
- Never --all; own screenshots: the full page at desktop width and 375 px, half scale.
- Look at all at once, against the recipe or kind file, not pixel by pixel; fix all you saw, re-check only changed screens; two rounds at most.
- Stop any dev server you started before you finish.
Rules
- [compose.restyle] Compose, never restyle: add no class for what a part already sets (height, padding, colours: its page says which).
- [create.flow] Create a new item with CreateDialog (title first, property chips, ⌘↵) or, in a list or table, CreateRow in place; a Dialog is only for a short confirm.
- [depth.layers] A name previews in HoverCard, a row opens in RecordPeek, a record is a page; a delete asks in AlertDialog or a held DestructiveButton; what can be undone runs at once with toast.undo.
- [domain.chips] Options carry counts (TabsTrigger count; status/owner filters are Selects: goop/trail/docs/screen-list.md); a record's status and assignee are chips (shape="chip"), never plain words.
- [field.height] A field is a step taller than a Button (28/32/36 px against 24/28/32): in one row, a field at sm sits level with a Button at md, md with lg.
- [frame.look] Default frame: every page takes AppFrame's default look (inset panel, hairline edge, largest corner); variant="divider" (flush, square) is an option, one frame per app.
- [icon.glyph] An element slot (a mark) takes a pack icon: <Glyph icon="star" box={{ w: 14, h: 14 }} /> (12, 14 or 16) from '@/lib/goop/trail/glyph'.
- [icon.names] An icon prop takes an icon's name (icon="plus"; "node goop/agent/lookup.mjs icons <word>" finds one), never an element; a name the theme lacks draws a ring: pick the nearest.
- [ink.paired] Text on a coloured fill uses the theme's paired ink: INK from '@/lib/goop/trail/ink' on a hue, the fill's -foreground token otherwise; never pick one by eye.
- [locale.one] Pick the app's one locale (a BCP 47 tag) and currency (an ISO 4217 code, "EUR"); pass the same locale and currency to every part that takes them, and set <html lang> to it.
- [motion.recipes] Your lists, folds, chips and glyph swaps move with '@/lib/goop/trail/motion-recipes' (useRowGlide, usePickGlide, useFold, Presence, useFlip, useGlyphSwap; goop/trail/docs/motion.md)
- [recipes.first] A part goes in its slot, never hand-nested; a help desk reply is Composer modes, a note ChatMessage variant="note".
- [row.actions] A row, card, file or event has one action list, drawn three ways: its "…" DropdownMenu, a right-click ContextMenu, a TableSelectionBar for ticked rows; text fields keep the browser's.
- [screen.account] Signing in, the signed-in person, profile and sign out: goop/trail/docs/screen-account.md.
- [screen.board] A board of items by stage: copy goop/trail/docs/screen-board.md.
- [screen.chat] An assistant chat (answers streaming with their sources, stop, retry): copy goop/trail/docs/screen-chat.md.
- [screen.flow] A flow in steps (booking, checkout, setup): copy goop/trail/docs/screen-flow.md.
- [screen.schedule] A week of bookings by person or room is WeekBoard (goop/trail/docs/screen-schedule.md); it has no drag: a booking moves by its form.
- [screen.sidebar] Pick the sidebar's shape in goop/trail/docs/recipe-sidebars.md; the frame draws it from its props (switcher, search, sections, collapsible, counts: goop/trail/docs/screen-frame.md).
- [screen.start] Without Goop's tools, a new app starts with "node goop/agent/start.mjs <screen>…" (README "Start here"): edit only the lines it prints; never read a recipe it wrote.
- [screen.states] Loading, failed, first-run, filtered, not-found and no-access states: copy goop/trail/docs/screen-states.md.
- [tap.targets] On a touch screen every control is a 44 px tap target with no prop; your own row round a small control takes touch:min-h-control-touch; typed words are 16 px on phones.
- [toast.mount] Mount <Toaster /> once in the app's root (App.tsx or the root layout, beside the screens), never per page: toast() shows nothing without it.
- [ui.names] An outline card's content goes in CardContent, a tile's words in CardText; CardFooter is a grey line, not a bar; danger is DestructiveButton, icon-only IconButton.
- [width.steps] A width you set is a spacing step (w-N is N×4 px: w-40 160 px, w-64 256 px) or a size token (w-pane-xs 200 px, w-pane-sm 300 px); a filter row's controls need none.
Before making a component the theme lacks: read goop/trail/agent/new-component.md
Import the theme's unit for every part it has; never redraw one by hand.