package page→ /base/icons.md
pages/base/icons.md
90 lines, 4.8 KB. As a page.
- ---
- type: Page
- title: "Page icons"
- icon: "🖼️"
- description: "What a page icon is, which pages get which kind (tiers), where the files lie, how an agent makes one and how lenses show it."
- ---
- A page shows a small icon next to its title. In Notion it is an emoji. Here it can also be an SVG that an agent draws for the page. Drawings are not free: they cost tokens, review and bytes in git. So a project decides up front which pages deserve one. That decision is the **tier**.
- ## The fields
- | Field | Where | What |
- |---|---|---|
- | `icon` | any page | one emoji (`"🥕"`) or a path to an SVG (`/assets/icons/carrot.svg`) |
- | `art` | any page | a large picture for cards, a path to an SVG |
- | `icons` | a collection page | `{tier, item, required, max}`: how its records get icons |
- A path starts at the project root (`/assets/icons/x.svg`); a path without the slash is read from the page's folder.
- ## Tiers
- | Tier | The record shows | The record may set | For |
- |---|---|---|---|
- | `none` | nothing | nothing | logs, runs, generated pages |
- | `kind` | the collection's `icons.item` | nothing | many uniform records: tasks, bugs, service pages |
- | `pick` | its own emoji or set icon, else the kind icon | an emoji, or `icon: /assets/icons/set/<name>.svg` | ordinary pages |
- | `bespoke` | its own drawing, else as above | an SVG drawn for it, and `art` | few important pages: the map, packages, principles |
- Where the tier comes from, first match wins:
- 1. The page is listed in `heroes` of [/design/icons.md](/design/icons.md) — `bespoke`.
- 2. The page is a collection page — `collectionTier` (`bespoke`).
- 3. The page is a record of a collection — `icons.tier` of the collection page, or `defaultTier` (`pick`) if it has none.
- 4. Any other page — `looseTier` (`pick`).
- A collection allows `bespoke` for at most `icons.max` distinct files (default `max` in the settings, 100). Reusing one file on several pages counts once. Raising the budget is the owner's decision.
- ```yaml
- # /plants.md
- type: Collection
- itemType: Plant
- icons: {tier: bespoke, max: 40, required: true, item: "🌱"}
- ```
- ## Files
- - Every SVG lies in `/assets/icons/`: one file per drawing, named after the page (`plants/dill.md` → `dill.svg`); on a clash, the collection first (`plants-dill.svg`).
- - Kind icons: `/assets/icons/kinds/<itemType>.svg`. The shared set: `/assets/icons/set/<name>.svg`, uniform icons any `pick` page may use; a set from elsewhere keeps its licence file next to it.
- - Never inline SVG in front matter: it bloats every diff, cannot be shared and breaks short header reads.
- ## The SVG contract
- Square `viewBox` (`0 0 96 96` is usual), `xmlns`, at most 4096 bytes, drawing elements only (`path`, `rect`, `circle`, `ellipse`, `line`, `polyline`, `polygon`, `g`, `defs`, gradients, `clipPath`, `mask`, `use`, `symbol`, `title`, `desc`). No script, event attributes, links out of the file, text, `<style>`, `<image>` or `currentColor`; colours as hex. It reads at 16 px and works on light and dark. The first comment records where it came from: `<!-- icon: page=/plants/dill.md; by=<model>; date=2026-11-28; licence=CC0-1.0 -->`.
- ## The style
- A style package supplies a page `type: IconStyle` under `/design/`:
- ```yaml
- type: IconStyle
- title: "Kit pictures"
- viewBox: "0 0 96 96"
- gradients: false
- palette: {red: "#FF7369", yellow: "#FFDC49", green: "#4DAB9A", blue: "#529CCA", white: "#FFFFFF"}
- rules: ["Flat, no background tile, no outline.", "2–4 colours of the palette."]
- examples: [/assets/icons/carrot.svg]
- ```
- With it, the prompt quotes the style and the check holds the palette. Without it, the contract alone holds.
- ## For agents: when and how
- 1. Making a page? Run `shtuk run icons prompt <page.md>`. It says the tier and what to do.
- 2. `none` or `kind`: add nothing.
- 3. `pick`: write one emoji, or a set icon.
- 4. `bespoke`: draw by the printed prompt, write the file, set `icon:` (or `art:` with `--art`), run `shtuk run icons validate <file>`.
- 5. A new collection: decide its tier and write `icons:` in its page. A kind icon: `shtuk run icons prompt <collection>.md --kind`.
- 6. An SVG from elsewhere: `shtuk run icons sanitize <file> --write`, then validate.
- ## How lenses show it
- Emoji as text, SVG through `<img>` (no script can run), as decoration next to the title. The chain: the record's own `icon` → the collection's `icons.item` → the collection page's `icon` → 📄; with tier `none` nothing. A card with the option `art` shows the large picture instead.
- ## Enforcers of the norms
- | Norm | What it means | Enforcer (check) |
- |---|---|---|
- | [ICN-R01](/norms/rules/icons/ICN-R01.md) | An icon a page refers to exists and is a valid, safe SVG | `valid` |
- | [ICN-R02](/norms/rules/icons/ICN-R02.md) | A page carries only what its tier allows; bespoke files stay in the budget | `budget` |
- | [ICN-R03](/norms/rules/icons/ICN-R03.md) | A collection that requires icons has one on every record | `required` |