opencodekit 0.18.8 → 0.18.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -18,7 +18,7 @@ var __require = /* @__PURE__ */ createRequire(import.meta.url);
18
18
 
19
19
  //#endregion
20
20
  //#region package.json
21
- var version = "0.18.8";
21
+ var version = "0.18.10";
22
22
 
23
23
  //#endregion
24
24
  //#region src/utils/errors.ts
@@ -6,7 +6,6 @@ steps: 25
6
6
  tools:
7
7
  edit: false
8
8
  write: false
9
- bash: false
10
9
  todowrite: false
11
10
  memory-update: false
12
11
  observation: false
@@ -14,6 +13,14 @@ tools:
14
13
  websearch: false
15
14
  webfetch: false
16
15
  codesearch: false
16
+ permission:
17
+ bash:
18
+ "*": allow
19
+ "rm*": deny
20
+ "git push*": deny
21
+ "git commit*": deny
22
+ "git reset*": deny
23
+ "sudo*": deny
17
24
  ---
18
25
 
19
26
  You are OpenCode, the best coding agent on the planet.
@@ -32,8 +39,14 @@ Find relevant files, symbols, and usage paths quickly for the caller.
32
39
 
33
40
  ## Tools — Use These for Local Code Search
34
41
 
42
+ **Prefer tilth CLI** (`npx -y tilth`) for symbol search and file reading — it combines grep + tree-sitter + cat into one call. See `tilth-cli` skill for full syntax.
43
+
35
44
  | Tool | Use For | Example |
36
45
  |------|---------|--------|
46
+ | `tilth` (symbol) | AST-aware symbol search (definitions + usages) | `npx -y tilth handleAuth --scope src/` |
47
+ | `tilth` (read) | Smart file reading with outline for large files | `npx -y tilth src/auth.ts --section 44-89` |
48
+ | `tilth` (glob) | Find files by pattern with token estimates | `npx -y tilth "*.test.ts" --scope src/` |
49
+ | `tilth` (map) | Codebase structural overview | `npx -y tilth --map --scope src/` |
37
50
  | `grep` | Find text/regex patterns in files | `grep(pattern: "PatchEntry", include: "*.ts")` |
38
51
  | `glob` | Find files by name/pattern | `glob(pattern: "src/**/*.ts")` |
39
52
  | `lsp` (goToDefinition) | Jump to symbol definition | `lsp(operation: "goToDefinition", filePath: "...", line: N, character: N)` |
@@ -42,29 +55,32 @@ Find relevant files, symbols, and usage paths quickly for the caller.
42
55
  | `read` | Read file content | `read(filePath: "src/utils/patch.ts")` |
43
56
 
44
57
  **NEVER** use `websearch`, `webfetch`, or `codesearch` — those search the internet, not your project.
58
+ **NEVER** modify files or run destructive commands — bash is for tilth CLI and read-only operations only.
45
59
 
46
60
  ## Rules
47
61
 
48
62
  - Never modify files — read-only is a hard constraint
63
+ - Bash is enabled **only** for tilth CLI (`npx -y tilth`) — do not use bash for anything else
49
64
  - Return absolute paths in final output
50
65
  - Cite `file:line` evidence whenever possible
51
- - **Always start with `grep` or `glob`** to locate files and symbols — do NOT read directories to browse
66
+ - **Prefer tilth** for symbol search, then fall back to `grep` or `glob`
52
67
  - Use LSP for precise navigation after finding candidate locations
53
68
  - Stop when you can answer with concrete evidence
54
69
 
55
70
  ## Navigation Patterns
56
71
 
57
- 1. **Search first, read second**: `grep` to find where a symbol lives, then `read` only that section
72
+ 1. **tilth first, grep second**: `npx -y tilth <symbol> --scope src/` finds definitions AND usages in one call; fall back to `grep` if tilth is unavailable
58
73
  2. **Don't re-read**: If you already read a file, reference what you learned — don't read it again
59
- 3. **Follow the chain**: definition → usages → callers via LSP findReferences
60
- 4. **Target ≤3 tool calls per symbol**: grep → read section → done
74
+ 3. **Follow the chain**: definition → usages → callers via tilth symbol search or LSP findReferences
75
+ 4. **Target ≤3 tool calls per symbol**: tilth search → read section → done
61
76
 
62
77
  ## Workflow
63
78
 
64
- 1. `grep` or `glob` to discover candidate files
65
- 2. `lsp` goToDefinition/findReferences for precise symbol navigation
66
- 3. `read` only the relevant sections (use offset/limit)
67
- 4. Return findings with file:line evidence
79
+ 1. `npx -y tilth <symbol> --scope src/` or `grep`/`glob` to discover symbols and files
80
+ 2. `npx -y tilth <file> --section <range>` or `read` for targeted file sections
81
+ 3. `lsp` goToDefinition/findReferences for precise cross-file navigation when needed
82
+ 4. `npx -y tilth --map --scope <dir>` for structural overview of unfamiliar areas
83
+ 5. Return findings with file:line evidence
68
84
 
69
85
  ## Output
70
86
 
@@ -74,6 +90,7 @@ Find relevant files, symbols, and usage paths quickly for the caller.
74
90
 
75
91
  ## Failure Handling
76
92
 
93
+ - If tilth is unavailable, fall back to `grep` + `glob` + targeted `read`
77
94
  - If LSP is unavailable, fall back to `grep` + targeted `read`
78
95
  - If results are ambiguous, list assumptions and best candidate paths
79
96
  - Never guess — mark uncertainty explicitly
@@ -147,12 +147,14 @@ Before claiming task done:
147
147
 
148
148
  ## Workflow
149
149
 
150
- 1. Read relevant files
150
+ 1. Read relevant files (prefer `npx -y tilth <symbol> --scope src/` for fast symbol lookup)
151
151
  2. Confirm scope is small and clear
152
152
  3. Make surgical edits
153
153
  4. Run validation (lint/typecheck/tests as applicable)
154
154
  5. Report changed files with `file:line` references
155
155
 
156
+ **Code navigation:** Use tilth CLI for AST-aware search when available — see `tilth-cli` skill for syntax. Prefer `npx -y tilth <symbol> --scope <dir>` over grep for symbol definitions.
157
+
156
158
  ## Progress Updates
157
159
 
158
160
  - For multi-step work, provide brief milestone updates
@@ -381,12 +381,14 @@ When planning under constraint:
381
381
 
382
382
  ## Workflow
383
383
 
384
- 1. **Ground**: Read bead artifacts (`prd.md`, `plan.md` if present)
384
+ 1. **Ground**: Read bead artifacts (`prd.md`, `plan.md` if present); use `npx -y tilth --map --scope src/` for codebase overview
385
385
  2. **Calibrate**: Understand goal, constraints, and success criteria
386
- 3. **Transform**: Launch parallel research (`task` subagents) when uncertainty remains; decompose into phases/tasks with explicit dependencies
386
+ 3. **Transform**: Launch parallel research (`task` subagents) when uncertainty remains; use `npx -y tilth <symbol> --scope src/` for fast codebase discovery; decompose into phases/tasks with explicit dependencies
387
387
  4. **Release**: Write actionable plan with exact file paths, commands, and verification
388
388
  5. **Reset**: End with a concrete next command (`/ship <id>`, `/start <child-id>`, etc.)
389
389
 
390
+ **Code navigation:** Use tilth CLI for AST-aware search and `--map` for structural overview — see `tilth-cli` skill.
391
+
390
392
  ## Output
391
393
 
392
394
  - Keep plan steps small and executable
@@ -193,11 +193,13 @@ return <div>No messages</div> // State exists but not used
193
193
 
194
194
  ## Workflow
195
195
 
196
- 1. Read changed files and nearby context
196
+ 1. Read changed files and nearby context (prefer `npx -y tilth <symbol> --scope src/` for fast cross-file tracing)
197
197
  2. Identify and validate findings by severity (P0, P1, P2, P3)
198
198
  3. For each finding: explain why, when it happens, and impact
199
199
  4. If no qualifying findings exist, say so explicitly
200
200
 
201
+ **Code navigation:** Use tilth CLI for AST-aware symbol search when tracing cross-file dependencies — see `tilth-cli` skill. Prefer `npx -y tilth <symbol> --scope <dir>` over grep for understanding call chains.
202
+
201
203
  ## Output
202
204
 
203
205
  Structure:
@@ -0,0 +1,146 @@
1
+ ---
2
+ description: Audit changed UI files for AI slop patterns and design-system violations
3
+ argument-hint: "[path|auto] [--staged] [--since=<ref>] [--full-report]"
4
+ agent: vision
5
+ model: proxypal/gemini-3-pro-preview
6
+ ---
7
+
8
+ # UI Slop Check: $ARGUMENTS
9
+
10
+ Run a focused anti-slop audit against changed UI files using the frontend-design taxonomy.
11
+
12
+ ## Load Skills
13
+
14
+ ```typescript
15
+ skill({ name: "frontend-design" }); // Anti-pattern taxonomy + design references
16
+ skill({ name: "visual-analysis" }); // Structured visual/code analysis workflow
17
+ skill({ name: "accessibility-audit" }); // Keyboard/focus/contrast checks
18
+ ```
19
+
20
+ ## Parse Arguments
21
+
22
+ | Argument | Default | Description |
23
+ | --------------- | ------- | -------------------------------------------------- | ----------------------------------------------------------- |
24
+ | `[path | auto]` | `auto` | Specific file/dir to audit, or auto-detect changed UI files |
25
+ | `--staged` | false | Audit staged changes only (`git diff --cached`) |
26
+ | `--since=<ref>` | `HEAD` | Compare against ref (`main`, `HEAD~1`, commit SHA) |
27
+ | `--full-report` | false | Include all categories even when no issues found |
28
+
29
+ ## Phase 1: Resolve Target Files
30
+
31
+ If `[path]` is provided:
32
+
33
+ - Audit that path directly
34
+
35
+ If `auto`:
36
+
37
+ ```bash
38
+ # unstaged + staged by default
39
+ git diff --name-only $SINCE_REF -- \
40
+ '*.tsx' '*.jsx' '*.css' '*.scss' '*.sass' '*.less' '*.html' '*.mdx'
41
+ ```
42
+
43
+ If `--staged`:
44
+
45
+ ```bash
46
+ git diff --cached --name-only -- \
47
+ '*.tsx' '*.jsx' '*.css' '*.scss' '*.sass' '*.less' '*.html' '*.mdx'
48
+ ```
49
+
50
+ Prioritize files under:
51
+
52
+ - `src/components/**`
53
+ - `src/app/**`
54
+ - `src/pages/**`
55
+ - `app/**`
56
+ - `components/**`
57
+
58
+ If no UI files changed, return: **PASS (no changed UI files)**.
59
+
60
+ ## Phase 2: Run AI Slop Checklist
61
+
62
+ Evaluate each target file (or rendered screenshot if provided) against these checks.
63
+
64
+ ### A) Typography
65
+
66
+ - Banned default aesthetics (Inter/Roboto/Arial/Open Sans as dominant display voice)
67
+ - Body text uses `rem/em`, not fixed `px`
68
+ - Clear hierarchy (size/weight/spacing), not color-only hierarchy
69
+ - Body line length near readable measure (around 65ch when applicable)
70
+
71
+ ### B) Color and Theming
72
+
73
+ - No AI default palette tropes (purple-blue gradient defaults, neon-on-dark clichés)
74
+ - No pure `#000` / `#fff` as dominant surfaces
75
+ - Gray text is not placed on saturated backgrounds
76
+ - Semantic tokens are used (not random per-component hardcoded colors)
77
+ - Dark mode is adapted, not simple inversion
78
+
79
+ ### C) Layout and Spatial Rhythm
80
+
81
+ - No cards-inside-cards without strong information architecture reason
82
+ - No repetitive cookie-cutter card blocks with identical structure
83
+ - Spacing rhythm is consistent (4pt-style cadence), not arbitrary jumps
84
+ - Uses `gap`/layout primitives cleanly; avoids margin hacks when possible
85
+
86
+ ### D) Motion and Interaction
87
+
88
+ - No bounce/elastic gimmick motion for product UI
89
+ - Animations use transform/opacity (avoid layout-thrashing properties)
90
+ - Reduced motion support exists for meaningful motion
91
+ - States exist: hover, focus-visible, active, disabled, loading/error where relevant
92
+
93
+ ### E) UX Writing
94
+
95
+ - Buttons are verb + object (e.g. "Save changes")
96
+ - Error copy includes what happened + why + how to fix
97
+ - Empty states include guidance + next action
98
+ - Terminology is consistent (avoid mixed synonyms for same action)
99
+
100
+ ### F) Accessibility Safety Nets
101
+
102
+ - Keyboard-visible focus treatment (`:focus-visible`)
103
+ - Contrast baseline expectations (WCAG AA)
104
+ - Touch targets reasonable (44x44 context where applicable)
105
+
106
+ ## Phase 3: Severity and Scoring
107
+
108
+ Group findings by severity:
109
+
110
+ - **Critical**: accessibility failures, broken interaction states, unreadable contrast
111
+ - **Warning**: strong AI fingerprint/slop patterns, inconsistent design system usage
112
+ - **Info**: polish/consistency opportunities
113
+
114
+ Score each category 1-10 and include evidence (`file:line` for code audits).
115
+
116
+ ## Phase 4: Output
117
+
118
+ Return:
119
+
120
+ 1. **Result**: PASS / NEEDS WORK
121
+ 2. **Audited files** (list)
122
+ 3. **Category scores**
123
+ 4. **Findings by severity** with actionable fixes
124
+ 5. **Fast remediation plan** (top 3 fixes first)
125
+
126
+ If `--full-report` is false, omit empty categories.
127
+
128
+ ## Record Findings
129
+
130
+ ```typescript
131
+ observation({
132
+ type: "warning",
133
+ title: "UI Slop Check: [scope]",
134
+ narrative: "Detected [count] critical, [count] warning slop issues in changed UI files.",
135
+ concepts: "ui, design, anti-patterns, frontend",
136
+ confidence: "high",
137
+ });
138
+ ```
139
+
140
+ ## Related Commands
141
+
142
+ | Need | Command |
143
+ | ---------------------------------------- | ------------ |
144
+ | Design from scratch | `/design` |
145
+ | Full UI review (single screen/component) | `/ui-review` |
146
+ | Implementation work | `/start` |
Binary file
@@ -11,7 +11,7 @@
11
11
  "type-check": "tsc --noEmit"
12
12
  },
13
13
  "dependencies": {
14
- "@opencode-ai/plugin": "1.2.24"
14
+ "@opencode-ai/plugin": "1.2.27"
15
15
  },
16
16
  "devDependencies": {
17
17
  "@types/node": "^25.3.0",
@@ -110,10 +110,14 @@ function compressMessage(msg: TransformMessage): TransformMessage {
110
110
  * Keeps first and last sentence, truncates middle.
111
111
  */
112
112
  function createSummary(text: string, role: string): string {
113
- const maxChars = 200;
113
+ const maxChars = 500;
114
114
 
115
115
  if (text.length <= maxChars) return text;
116
116
 
117
+ // For very large messages (>5000 chars), be more aggressive
118
+ const isLarge = text.length > 5000;
119
+ const effectiveMax = isLarge ? 300 : maxChars;
120
+
117
121
  // Split into sentences
118
122
  const sentences = text
119
123
  .split(/(?<=[.!?])\s+|\n+/)
@@ -121,16 +125,16 @@ function createSummary(text: string, role: string): string {
121
125
  .filter((s) => s.length > 0);
122
126
 
123
127
  if (sentences.length <= 2) {
124
- return `${text.slice(0, maxChars)}...`;
128
+ return `${text.slice(0, effectiveMax)}...`;
125
129
  }
126
130
 
127
131
  const first = sentences[0];
128
132
  const last = sentences[sentences.length - 1];
129
133
 
130
- const summary = `[compressed ${role} message] ${first} [...${sentences.length - 2} more sentences...] ${last}`;
134
+ const summary = `[compressed ${role}] ${first} [...${sentences.length - 2} sentences...] ${last}`;
131
135
 
132
- return summary.length > maxChars * 2
133
- ? `${summary.slice(0, maxChars * 2)}...`
136
+ return summary.length > effectiveMax
137
+ ? `${summary.slice(0, effectiveMax)}...`
134
138
  : summary;
135
139
  }
136
140
 
@@ -38,7 +38,7 @@ export const MEMORY_CONFIG = {
38
38
  },
39
39
  context: {
40
40
  enabled: true,
41
- maxContextTokens: 100_000,
41
+ maxContextTokens: 80_000,
42
42
  protectedMessages: 5,
43
43
  },
44
44
  fts: {
@@ -90,13 +90,24 @@ export function createHooks(deps: HookDeps) {
90
90
  }
91
91
  }
92
92
 
93
- // --- Session error: warn user ---
93
+ // --- Session error: show actual error details ---
94
94
  if (event.type === "session.error") {
95
- await showToast(
96
- "Session Error",
97
- "Save important learnings with observation tool",
98
- "warning",
99
- );
95
+ const props = event.properties as Record<string, unknown> | undefined;
96
+ const errorMsg = props?.error
97
+ ? String(props.error).slice(0, 120)
98
+ : props?.message
99
+ ? String(props.message).slice(0, 120)
100
+ : "Unknown error";
101
+
102
+ // Classify: match the specific AI SDK error pattern
103
+ const isTokenOverflow =
104
+ /token.{0,20}(exceed|limit)/i.test(errorMsg) ||
105
+ errorMsg.includes("context_length_exceeded");
106
+ const guidance = isTokenOverflow
107
+ ? "Context too large — use /compact or start a new session"
108
+ : "Save important learnings with observation tool";
109
+
110
+ await showToast("Session Error", `${guidance} (${errorMsg})`, "warning");
100
111
  }
101
112
  },
102
113
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: frontend-design
3
3
  description: Create distinctive, production-grade frontend interfaces. Use when building web components, pages, or applications with React-based frameworks. Includes Tailwind CSS v4, shadcn/ui components, Motion animations, and visual design philosophy for avoiding generic AI aesthetics.
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  tags: [ui, design]
6
6
  dependencies: []
7
7
  ---
@@ -21,7 +21,6 @@ dependencies: []
21
21
 
22
22
  - Backend-only tasks or minimal UI with no visual design requirements.
23
23
 
24
-
25
24
  ## Reference Documentation
26
25
 
27
26
  ### Tailwind CSS v4.1
@@ -46,7 +45,7 @@ Search: `Field`, `InputGroup`, `Spinner`, `ButtonGroup`, `next-themes`
46
45
 
47
46
  ### Animation (Motion + Tailwind)
48
47
 
49
- - `./references/animation/motion-core.md` - Core API, variants, gestures, layout animations
48
+ - `./references/animation/motion-core.md` - Timing system, easing constants, performance rules, reduced motion, core patterns
50
49
  - `./references/animation/motion-advanced.md` - AnimatePresence, scroll, orchestration, TypeScript
51
50
 
52
51
  **Stack**:
@@ -64,6 +63,15 @@ Search: `Field`, `InputGroup`, `Spinner`, `ButtonGroup`, `next-themes`
64
63
 
65
64
  For sophisticated compositions: posters, brand materials, design systems.
66
65
 
66
+ ### Design Systems (Deep Guides)
67
+
68
+ - `./references/design/color-system.md` - OKLCH, semantic tokens, dark mode architecture
69
+ - `./references/design/typography-rules.md` - Fluid type, modular scale, OpenType features
70
+ - `./references/design/interaction.md` - State models, focus, dialogs/popovers, loading patterns
71
+ - `./references/design/ux-writing.md` - Button copy, error structure, empty states, i18n
72
+
73
+ Search: `AI Slop Test`, `tinted neutrals`, `focus-visible`, `verb + object`, `65ch`
74
+
67
75
  ## Design Thinking
68
76
 
69
77
  Before coding, commit to BOLD aesthetic direction:
@@ -74,23 +82,60 @@ Before coding, commit to BOLD aesthetic direction:
74
82
 
75
83
  Bold maximalism and refined minimalism both work. Key is intentionality.
76
84
 
77
- ## Anti-Patterns (NEVER)
85
+ ## Anti-Patterns (AI Fingerprints — NEVER)
86
+
87
+ These patterns immediately signal "AI made this." Avoid them all.
88
+
89
+ ### Typography
90
+
91
+ - **Banned fonts**: Inter, Roboto, Arial, Open Sans, Lato, Montserrat, Space Grotesk, system-ui as display font
92
+ - Monospace used as "developer aesthetic" shorthand
93
+ - Big icons centered above every heading
94
+ - Using `px` for body text (use `rem`/`em` to respect user settings)
95
+
96
+ ### Color
78
97
 
79
- - Overused fonts: Inter, Roboto, Arial, system fonts, Space Grotesk
80
- - Cliched colors: purple gradients on white
81
- - Predictable layouts and component patterns
82
- - Cookie-cutter design lacking character
83
- - Generic AI-generated aesthetics
98
+ - **AI palette**: Cyan-on-dark, purple-to-blue gradients, neon accents on dark backgrounds
99
+ - Gray text on colored backgrounds (use darker shade of background color instead)
100
+ - Pure `#000` or `#fff` (always tint — pure black/white don't exist in nature)
101
+ - Gradient text on headings or metrics
102
+ - `rgba()` / heavy alpha transparency as primary palette (design smell — define explicit colors)
103
+
104
+ ### Layout
105
+
106
+ - Cards nested inside cards (use typography, spacing, dividers for hierarchy within a card)
107
+ - Identical card grids (icon + heading + text repeated 3-6 times)
108
+ - Hero metric template (big number + small label + gradient accent)
109
+ - Center-aligning everything
110
+ - Same spacing everywhere (no visual rhythm)
111
+
112
+ ### Visual
113
+
114
+ - Glassmorphism used decoratively (blur cards, glow borders)
115
+ - Thick colored border on one side of rounded rectangles
116
+ - Sparklines as decoration (not connected to real data)
117
+ - Generic drop shadows on everything
118
+ - Rounded rectangles as the only shape language
119
+
120
+ ### Motion
121
+
122
+ - Bounce or elastic easing (real objects decelerate smoothly)
123
+ - Animating `height`, `width`, `padding`, `margin` (causes layout recalculation)
124
+ - Default `ease` (compromise that's rarely optimal — use exponential easing)
125
+ - Missing `prefers-reduced-motion` handling
126
+
127
+ > **The AI Slop Test**: If you showed this interface to someone and said "AI made this," would they believe you immediately? If yes, that's the problem.
84
128
 
85
129
  ## Best Practices
86
130
 
87
- 1. **Accessibility First**: Radix primitives, focus states, semantic HTML
88
- 2. **Mobile-First**: Start mobile, layer responsive variants
89
- 3. **Design Tokens**: Use `@theme` for spacing, colors, typography
90
- 4. **Dark Mode**: Apply dark variants to all themed elements
91
- 5. **Performance**: Automatic CSS purging, avoid dynamic class names
92
- 6. **TypeScript**: Full type safety
93
- 7. **Expert Craftsmanship**: Every detail matters
131
+ 1. **Accessibility First**: Radix primitives, `:focus-visible` (not `:focus`), semantic HTML, 44px touch targets
132
+ 2. **Mobile-First**: Start mobile, layer responsive variants with `min-width` queries
133
+ 3. **Design Tokens**: Two-layer system — primitives (`--blue-500`) + semantic (`--color-primary: var(--blue-500)`); dark mode redefines semantic layer only
134
+ 4. **Dark Mode**: Not inverted light mode lighter surfaces create depth (no shadows); desaturate accents; base at `oklch(15-18% …)`
135
+ 5. **Container Queries**: Use `@container` for component layout, viewport queries for page layout
136
+ 6. **Performance**: `transform` + `opacity` only for animations; CSS purging; avoid dynamic class names
137
+ 7. **TypeScript**: Full type safety
138
+ 8. **Expert Craftsmanship**: Every detail matters — squint test for hierarchy validation
94
139
 
95
140
  ## Core Stack Summary
96
141
 
@@ -102,63 +147,88 @@ Bold maximalism and refined minimalism both work. Key is intentionality.
102
147
 
103
148
  ## Typography
104
149
 
105
- Choose beautiful, unique fonts. Pair distinctive display with refined body:
150
+ Consult `./references/design/typography-rules.md` for full fluid type system
151
+
152
+ Choose distinctive fonts. Pair display with body:
153
+
154
+ - **Preferred**: Instrument Sans, Plus Jakarta Sans, Outfit, Onest, Figtree, Urbanist (sans); Fraunces, Newsreader (editorial)
155
+ - **Fluid sizing**: `clamp(1rem, 0.5rem + 2vw, 1.5rem)` — never fixed `px` for body
156
+ - **Modular scale**: Pick one ratio (1.25 major third, 1.333 perfect fourth) — 5 sizes max
157
+ - **Measure**: `max-width: 65ch` for body text
158
+ - **OpenType**: `tabular-nums` for data, `diagonal-fractions` for recipes, `all-small-caps` for abbreviations
106
159
 
107
160
  ```css
108
161
  @theme {
109
- --font-display: "Playfair Display", serif;
110
- --font-body: "Source Sans 3", sans-serif;
162
+ --font-display: "Fraunces", serif;
163
+ --font-body: "Instrument Sans", sans-serif;
111
164
  }
112
165
  ```
113
166
 
114
167
  ## Color
115
168
 
116
- Use OKLCH for vivid colors. Dominant colors with sharp accents:
169
+ Consult `./references/design/color-system.md` for OKLCH deep guide
170
+
171
+ Use OKLCH for perceptually uniform colors. Two-layer token system:
117
172
 
118
173
  ```css
119
174
  @theme {
120
- --color-primary-500: oklch(0.55 0.22 264);
121
- --color-accent: oklch(0.75 0.18 45);
175
+ /* Primitives */
176
+ --blue-500: oklch(0.55 0.22 264);
177
+ --amber-400: oklch(0.75 0.18 80);
178
+ /* Semantic (redefine these for dark mode) */
179
+ --color-primary: var(--blue-500);
180
+ --color-accent: var(--amber-400);
181
+ /* Tinted neutrals — chroma 0.01 for subconscious brand cohesion */
182
+ --color-surface: oklch(0.97 0.01 264);
183
+ --color-surface-dark: oklch(0.16 0.01 264);
122
184
  }
123
185
  ```
124
186
 
125
187
  ## Motion
126
188
 
127
- **Primary**: Motion for React animations. **Fallback**: CSS `@starting-style` for simple enter/exit.
189
+ Consult `./references/animation/motion-core.md` for Motion API
190
+
191
+ **Timing**: 100-150ms instant feedback | 200-300ms state changes | 300-500ms layout | exit = 75% of enter
192
+
193
+ **Easing**: Exponential only — `cubic-bezier(0.16, 1, 0.3, 1)` for entrances. Never `ease`, never bounce/elastic.
194
+
195
+ **Performance**: Only animate `transform` and `opacity`. Height expand → `grid-template-rows: 0fr → 1fr`.
196
+
197
+ **Accessibility**: `prefers-reduced-motion` is mandatory (affects ~35% of adults over 40). Swap spatial animations for crossfades.
128
198
 
129
199
  ```tsx
130
200
  import { motion, AnimatePresence } from 'motion/react';
131
201
 
132
- // Basic animation
133
- <motion.div initial={{ opacity: 0 }} animate={{ opacity: 1 }} />
202
+ <motion.div initial={{ opacity: 0, y: 12 }} animate={{ opacity: 1, y: 0 }}
203
+ transition={{ duration: 0.3, ease: [0.16, 1, 0.3, 1] }} />
134
204
 
135
- // Exit animations
136
205
  <AnimatePresence>
137
- {show && <motion.div exit={{ opacity: 0 }} />}
206
+ {show && <motion.div exit={{ opacity: 0 }} transition={{ duration: 0.2 }} />}
138
207
  </AnimatePresence>
208
+ ```
139
209
 
140
- // Layout animations
141
- <motion.div layout />
210
+ CSS stagger: `animation-delay: calc(var(--i, 0) * 50ms)` — cap total at 500ms.
142
211
 
143
- // Gestures
144
- <motion.button whileHover={{ scale: 1.05 }} whileTap={{ scale: 0.95 }} />
145
- ```
212
+ ## Spatial Composition
146
213
 
147
- CSS fallback (no JS):
214
+ - **4pt spacing system**: 4, 8, 12, 16, 24, 32, 48, 64, 96px — not 8pt (too coarse at small gaps)
215
+ - **`gap` over margins** for sibling spacing (eliminates margin collapse)
216
+ - **Self-adjusting grids**: `repeat(auto-fit, minmax(280px, 1fr))` — responsive without breakpoints
217
+ - **Container queries** for components: `container-type: inline-size` on wrapper, `@container` on children
218
+ - **Optical text alignment**: `margin-left: -0.05em` for text that appears indented due to letterform whitespace
219
+ - Asymmetry, overlap, diagonal flow, grid-breaking elements. Generous negative space OR controlled density.
148
220
 
149
- ```css
150
- dialog[open] {
151
- opacity: 1;
152
- @starting-style {
153
- opacity: 0;
154
- transform: scale(0.95);
155
- }
156
- }
157
- ```
221
+ ## Interaction
158
222
 
159
- ## Spatial Composition
223
+ Consult `./references/design/interaction.md`
224
+
225
+ Design all 8 states: Default, Hover, Focus, Active, Disabled, Loading, Error, Success. Use `:focus-visible` not `:focus`. Native `<dialog>` + `inert` for modals. Popover API for tooltips/dropdowns. Skeleton screens over spinners. Undo over confirmation dialogs.
226
+
227
+ ## UX Writing
228
+
229
+ → Consult `./references/design/ux-writing.md`
160
230
 
161
- Unexpected layouts. Asymmetry. Overlap. Diagonal flow. Grid-breaking elements. Generous negative space OR controlled density.
231
+ Button labels: specific verb + object ("Save changes" not "OK"). Error formula: What happened + Why + How to fix. Empty states are onboarding opportunities. Plan for 30% text expansion (i18n).
162
232
 
163
233
  ## Backgrounds
164
234