diff --git a/.continue/agents/anti-slop.md b/.continue/agents/anti-slop.md
new file mode 100644
index 00000000000..3d72c4260df
--- /dev/null
+++ b/.continue/agents/anti-slop.md
@@ -0,0 +1,21 @@
+---
+name: Anti-slop
+description: Fix AI Slop
+---
+
+I want to follow the **Anti AI-slop rule**: clean up any AI-generated code patterns that harm readability and maintainability. Please look around at the files that were changed. If there are any with "AI slop" patterns, make targeted changes to clean them up. Stick to a single file maximum. If no changes are necessary, then do nothing.
+
+**What qualifies as AI slop in code:**
+
+1. **Overly verbose comments** - Comments that restate exactly what the code does (e.g., `// increment counter by 1` above `counter++`)
+2. **Excessive defensive programming** - Unnecessary null checks, try-catches, or validations that clutter the logic without providing real safety
+3. **Redundant type annotations** - Type declarations that are already inferred by the language/compiler
+4. **Boilerplate explosion** - Creating separate classes/functions/files for trivial operations that could be a simple expression
+5. **Over-abstraction** - Interfaces with single implementations, factories that create one thing, strategy patterns for two options
+6. **Verbose variable names that obscure intent** - e.g., `currentUserAuthenticationStatusBoolean` instead of `isAuthenticated`
+7. **Unnecessary intermediate variables** - Variables used exactly once on the next line purely to "document" a step
+8. **Repetitive error handling** - Copy-pasted try-catch blocks that could be consolidated
+9. **Filler documentation** - JSDoc/docstrings that add no information beyond the function signature
+10. **"Just in case" code** - Unused parameters, dead code paths, or features built for hypothetical future needs
+
+**The goal:** Code should be concise, readable, and no more complex than necessary. Remove ceremony, not functionality.
diff --git a/.continue/agents/react-best-practices.md b/.continue/agents/react-best-practices.md
new file mode 100644
index 00000000000..0553f842f58
--- /dev/null
+++ b/.continue/agents/react-best-practices.md
@@ -0,0 +1,2395 @@
+---
+name: React Best Practices
+description: React Best Practices
+---
+
+You are an agent responsible for evaluating a PR for adherence to the React best practices outlined below. Your goal is to identify any poor practices. If you find a poor practice, address it with a code change. Keep all of your changes constrained to a single commit. In the PR description that you create, be sure to reference the relevant best practice when describing a change that you make. If you do not find any poor practices, do not open a PR.
+
+Note: These best practices are pulled from https://github.com/vercel-labs/agent-skills/blob/main/skills/react-best-practices/AGENTS.md#1-eliminating-waterfalls
+
+# React Best Practices
+
+**Version 1.0.0**
+Vercel Engineering
+January 2026
+
+> **Note:**
+> This document is mainly for agents and LLMs to follow when maintaining,
+> generating, or refactoring React and Next.js codebases at Vercel. Humans
+> may also find it useful, but guidance here is optimized for automation
+> and consistency by AI-assisted workflows.
+
+---
+
+## Abstract
+
+Comprehensive performance optimization guide for React and Next.js applications, designed for AI agents and LLMs. Contains 40+ rules across 8 categories, prioritized by impact from critical (eliminating waterfalls, reducing bundle size) to incremental (advanced patterns). Each rule includes detailed explanations, real-world examples comparing incorrect vs. correct implementations, and specific impact metrics to guide automated refactoring and code generation.
+
+---
+
+## Table of Contents
+
+1. [Eliminating Waterfalls](#1-eliminating-waterfalls) — **CRITICAL**
+ - 1.1 [Defer Await Until Needed](#11-defer-await-until-needed)
+ - 1.2 [Dependency-Based Parallelization](#12-dependency-based-parallelization)
+ - 1.3 [Prevent Waterfall Chains in API Routes](#13-prevent-waterfall-chains-in-api-routes)
+ - 1.4 [Promise.all() for Independent Operations](#14-promiseall-for-independent-operations)
+ - 1.5 [Strategic Suspense Boundaries](#15-strategic-suspense-boundaries)
+2. [Bundle Size Optimization](#2-bundle-size-optimization) — **CRITICAL**
+ - 2.1 [Avoid Barrel File Imports](#21-avoid-barrel-file-imports)
+ - 2.2 [Conditional Module Loading](#22-conditional-module-loading)
+ - 2.3 [Defer Non-Critical Third-Party Libraries](#23-defer-non-critical-third-party-libraries)
+ - 2.4 [Dynamic Imports for Heavy Components](#24-dynamic-imports-for-heavy-components)
+ - 2.5 [Preload Based on User Intent](#25-preload-based-on-user-intent)
+3. [Server-Side Performance](#3-server-side-performance) — **HIGH**
+ - 3.1 [Cross-Request LRU Caching](#31-cross-request-lru-caching)
+ - 3.2 [Minimize Serialization at RSC Boundaries](#32-minimize-serialization-at-rsc-boundaries)
+ - 3.3 [Parallel Data Fetching with Component Composition](#33-parallel-data-fetching-with-component-composition)
+ - 3.4 [Per-Request Deduplication with React.cache()](#34-per-request-deduplication-with-reactcache)
+ - 3.5 [Use after() for Non-Blocking Operations](#35-use-after-for-non-blocking-operations)
+4. [Client-Side Data Fetching](#4-client-side-data-fetching) — **MEDIUM-HIGH**
+ - 4.1 [Deduplicate Global Event Listeners](#41-deduplicate-global-event-listeners)
+ - 4.2 [Use Passive Event Listeners for Scrolling Performance](#42-use-passive-event-listeners-for-scrolling-performance)
+ - 4.3 [Use SWR for Automatic Deduplication](#43-use-swr-for-automatic-deduplication)
+ - 4.4 [Version and Minimize localStorage Data](#44-version-and-minimize-localstorage-data)
+5. [Re-render Optimization](#5-re-render-optimization) — **MEDIUM**
+ - 5.1 [Defer State Reads to Usage Point](#51-defer-state-reads-to-usage-point)
+ - 5.2 [Extract to Memoized Components](#52-extract-to-memoized-components)
+ - 5.3 [Narrow Effect Dependencies](#53-narrow-effect-dependencies)
+ - 5.4 [Subscribe to Derived State](#54-subscribe-to-derived-state)
+ - 5.5 [Use Functional setState Updates](#55-use-functional-setstate-updates)
+ - 5.6 [Use Lazy State Initialization](#56-use-lazy-state-initialization)
+ - 5.7 [Use Transitions for Non-Urgent Updates](#57-use-transitions-for-non-urgent-updates)
+6. [Rendering Performance](#6-rendering-performance) — **MEDIUM**
+ - 6.1 [Animate SVG Wrapper Instead of SVG Element](#61-animate-svg-wrapper-instead-of-svg-element)
+ - 6.2 [CSS content-visibility for Long Lists](#62-css-content-visibility-for-long-lists)
+ - 6.3 [Hoist Static JSX Elements](#63-hoist-static-jsx-elements)
+ - 6.4 [Optimize SVG Precision](#64-optimize-svg-precision)
+ - 6.5 [Prevent Hydration Mismatch Without Flickering](#65-prevent-hydration-mismatch-without-flickering)
+ - 6.6 [Use Activity Component for Show/Hide](#66-use-activity-component-for-showhide)
+ - 6.7 [Use Explicit Conditional Rendering](#67-use-explicit-conditional-rendering)
+7. [JavaScript Performance](#7-javascript-performance) — **LOW-MEDIUM**
+ - 7.1 [Batch DOM CSS Changes](#71-batch-dom-css-changes)
+ - 7.2 [Build Index Maps for Repeated Lookups](#72-build-index-maps-for-repeated-lookups)
+ - 7.3 [Cache Property Access in Loops](#73-cache-property-access-in-loops)
+ - 7.4 [Cache Repeated Function Calls](#74-cache-repeated-function-calls)
+ - 7.5 [Cache Storage API Calls](#75-cache-storage-api-calls)
+ - 7.6 [Combine Multiple Array Iterations](#76-combine-multiple-array-iterations)
+ - 7.7 [Early Length Check for Array Comparisons](#77-early-length-check-for-array-comparisons)
+ - 7.8 [Early Return from Functions](#78-early-return-from-functions)
+ - 7.9 [Hoist RegExp Creation](#79-hoist-regexp-creation)
+ - 7.10 [Use Loop for Min/Max Instead of Sort](#710-use-loop-for-minmax-instead-of-sort)
+ - 7.11 [Use Set/Map for O(1) Lookups](#711-use-setmap-for-o1-lookups)
+ - 7.12 [Use toSorted() Instead of sort() for Immutability](#712-use-tosorted-instead-of-sort-for-immutability)
+8. [Advanced Patterns](#8-advanced-patterns) — **LOW**
+ - 8.1 [Store Event Handlers in Refs](#81-store-event-handlers-in-refs)
+ - 8.2 [useLatest for Stable Callback Refs](#82-uselatest-for-stable-callback-refs)
+
+---
+
+## 1. Eliminating Waterfalls
+
+**Impact: CRITICAL**
+
+Waterfalls are the #1 performance killer. Each sequential await adds full network latency. Eliminating them yields the largest gains.
+
+### 1.1 Defer Await Until Needed
+
+**Impact: HIGH (avoids blocking unused code paths)**
+
+Move `await` operations into the branches where they're actually used to avoid blocking code paths that don't need them.
+
+**Incorrect: blocks both branches**
+
+```typescript
+async function handleRequest(userId: string, skipProcessing: boolean) {
+ const userData = await fetchUserData(userId);
+
+ if (skipProcessing) {
+ // Returns immediately but still waited for userData
+ return { skipped: true };
+ }
+
+ // Only this branch uses userData
+ return processUserData(userData);
+}
+```
+
+**Correct: only blocks when needed**
+
+```typescript
+async function handleRequest(userId: string, skipProcessing: boolean) {
+ if (skipProcessing) {
+ // Returns immediately without waiting
+ return { skipped: true };
+ }
+
+ // Fetch only when needed
+ const userData = await fetchUserData(userId);
+ return processUserData(userData);
+}
+```
+
+**Another example: early return optimization**
+
+```typescript
+// Incorrect: always fetches permissions
+async function updateResource(resourceId: string, userId: string) {
+ const permissions = await fetchPermissions(userId);
+ const resource = await getResource(resourceId);
+
+ if (!resource) {
+ return { error: "Not found" };
+ }
+
+ if (!permissions.canEdit) {
+ return { error: "Forbidden" };
+ }
+
+ return await updateResourceData(resource, permissions);
+}
+
+// Correct: fetches only when needed
+async function updateResource(resourceId: string, userId: string) {
+ const resource = await getResource(resourceId);
+
+ if (!resource) {
+ return { error: "Not found" };
+ }
+
+ const permissions = await fetchPermissions(userId);
+
+ if (!permissions.canEdit) {
+ return { error: "Forbidden" };
+ }
+
+ return await updateResourceData(resource, permissions);
+}
+```
+
+This optimization is especially valuable when the skipped branch is frequently taken, or when the deferred operation is expensive.
+
+### 1.2 Dependency-Based Parallelization
+
+**Impact: CRITICAL (2-10× improvement)**
+
+For operations with partial dependencies, use `better-all` to maximize parallelism. It automatically starts each task at the earliest possible moment.
+
+**Incorrect: profile waits for config unnecessarily**
+
+```typescript
+const [user, config] = await Promise.all([fetchUser(), fetchConfig()]);
+const profile = await fetchProfile(user.id);
+```
+
+**Correct: config and profile run in parallel**
+
+```typescript
+import { all } from "better-all";
+
+const { user, config, profile } = await all({
+ async user() {
+ return fetchUser();
+ },
+ async config() {
+ return fetchConfig();
+ },
+ async profile() {
+ return fetchProfile((await this.$.user).id);
+ },
+});
+```
+
+Reference: [https://github.com/shuding/better-all](https://github.com/shuding/better-all)
+
+### 1.3 Prevent Waterfall Chains in API Routes
+
+**Impact: CRITICAL (2-10× improvement)**
+
+In API routes and Server Actions, start independent operations immediately, even if you don't await them yet.
+
+**Incorrect: config waits for auth, data waits for both**
+
+```typescript
+export async function GET(request: Request) {
+ const session = await auth();
+ const config = await fetchConfig();
+ const data = await fetchData(session.user.id);
+ return Response.json({ data, config });
+}
+```
+
+**Correct: auth and config start immediately**
+
+```typescript
+export async function GET(request: Request) {
+ const sessionPromise = auth();
+ const configPromise = fetchConfig();
+ const session = await sessionPromise;
+ const [config, data] = await Promise.all([
+ configPromise,
+ fetchData(session.user.id),
+ ]);
+ return Response.json({ data, config });
+}
+```
+
+For operations with more complex dependency chains, use `better-all` to automatically maximize parallelism (see Dependency-Based Parallelization).
+
+### 1.4 Promise.all() for Independent Operations
+
+**Impact: CRITICAL (2-10× improvement)**
+
+When async operations have no interdependencies, execute them concurrently using `Promise.all()`.
+
+**Incorrect: sequential execution, 3 round trips**
+
+```typescript
+const user = await fetchUser();
+const posts = await fetchPosts();
+const comments = await fetchComments();
+```
+
+**Correct: parallel execution, 1 round trip**
+
+```typescript
+const [user, posts, comments] = await Promise.all([
+ fetchUser(),
+ fetchPosts(),
+ fetchComments(),
+]);
+```
+
+### 1.5 Strategic Suspense Boundaries
+
+**Impact: HIGH (faster initial paint)**
+
+Instead of awaiting data in async components before returning JSX, use Suspense boundaries to show the wrapper UI faster while data loads.
+
+**Incorrect: wrapper blocked by data fetching**
+
+```tsx
+async function Page() {
+ const data = await fetchData(); // Blocks entire page
+
+ return (
+
+
Sidebar
+
Header
+
+
+
+
Footer
+
+ );
+}
+```
+
+The entire layout waits for data even though only the middle section needs it.
+
+**Correct: wrapper shows immediately, data streams in**
+
+```tsx
+function Page() {
+ return (
+
+
Sidebar
+
Header
+
+ }>
+
+
+
+
Footer
+
+ );
+}
+
+async function DataDisplay() {
+ const data = await fetchData(); // Only blocks this component
+ return
{data.content}
;
+}
+```
+
+Sidebar, Header, and Footer render immediately. Only DataDisplay waits for data.
+
+**Alternative: share promise across components**
+
+```tsx
+function Page() {
+ // Start fetch immediately, but don't await
+ const dataPromise = fetchData();
+
+ return (
+
;
+}
+
+function DataSummary({ dataPromise }: { dataPromise: Promise }) {
+ const data = use(dataPromise); // Reuses the same promise
+ return
{data.summary}
;
+}
+```
+
+Both components share the same promise, so only one fetch occurs. Layout renders immediately while both components wait together.
+
+**When NOT to use this pattern:**
+
+- Critical data needed for layout decisions (affects positioning)
+
+- SEO-critical content above the fold
+
+- Small, fast queries where suspense overhead isn't worth it
+
+- When you want to avoid layout shift (loading → content jump)
+
+**Trade-off:** Faster initial paint vs potential layout shift. Choose based on your UX priorities.
+
+---
+
+## 2. Bundle Size Optimization
+
+**Impact: CRITICAL**
+
+Reducing initial bundle size improves Time to Interactive and Largest Contentful Paint.
+
+### 2.1 Avoid Barrel File Imports
+
+**Impact: CRITICAL (200-800ms import cost, slow builds)**
+
+Import directly from source files instead of barrel files to avoid loading thousands of unused modules. **Barrel files** are entry points that re-export multiple modules (e.g., `index.js` that does `export * from './module'`).
+
+Popular icon and component libraries can have **up to 10,000 re-exports** in their entry file. For many React packages, **it takes 200-800ms just to import them**, affecting both development speed and production cold starts.
+
+**Why tree-shaking doesn't help:** When a library is marked as external (not bundled), the bundler can't optimize it. If you bundle it to enable tree-shaking, builds become substantially slower analyzing the entire module graph.
+
+**Incorrect: imports entire library**
+
+```tsx
+import { Check, X, Menu } from "lucide-react";
+// Loads 1,583 modules, takes ~2.8s extra in dev
+// Runtime cost: 200-800ms on every cold start
+
+import { Button, TextField } from "@mui/material";
+// Loads 2,225 modules, takes ~4.2s extra in dev
+```
+
+**Correct: imports only what you need**
+
+```tsx
+import Check from "lucide-react/dist/esm/icons/check";
+import X from "lucide-react/dist/esm/icons/x";
+import Menu from "lucide-react/dist/esm/icons/menu";
+// Loads only 3 modules (~2KB vs ~1MB)
+
+import Button from "@mui/material/Button";
+import TextField from "@mui/material/TextField";
+// Loads only what you use
+```
+
+**Alternative: Next.js 13.5+**
+
+```js
+// next.config.js - use optimizePackageImports
+module.exports = {
+ experimental: {
+ optimizePackageImports: ["lucide-react", "@mui/material"],
+ },
+};
+
+// Then you can keep the ergonomic barrel imports:
+import { Check, X, Menu } from "lucide-react";
+// Automatically transformed to direct imports at build time
+```
+
+Direct imports provide 15-70% faster dev boot, 28% faster builds, 40% faster cold starts, and significantly faster HMR.
+
+Libraries commonly affected: `lucide-react`, `@mui/material`, `@mui/icons-material`, `@tabler/icons-react`, `react-icons`, `@headlessui/react`, `@radix-ui/react-*`, `lodash`, `ramda`, `date-fns`, `rxjs`, `react-use`.
+
+Reference: [https://vercel.com/blog/how-we-optimized-package-imports-in-next-js](https://vercel.com/blog/how-we-optimized-package-imports-in-next-js)
+
+### 2.2 Conditional Module Loading
+
+**Impact: HIGH (loads large data only when needed)**
+
+Load large data or modules only when a feature is activated.
+
+**Example: lazy-load animation frames**
+
+```tsx
+function AnimationPlayer({
+ enabled,
+ setEnabled,
+}: {
+ enabled: boolean;
+ setEnabled: React.Dispatch>;
+}) {
+ const [frames, setFrames] = useState(null);
+
+ useEffect(() => {
+ if (enabled && !frames && typeof window !== "undefined") {
+ import("./animation-frames.js")
+ .then((mod) => setFrames(mod.frames))
+ .catch(() => setEnabled(false));
+ }
+ }, [enabled, frames, setEnabled]);
+
+ if (!frames) return ;
+ return ;
+}
+```
+
+The `typeof window !== 'undefined'` check prevents bundling this module for SSR, optimizing server bundle size and build speed.
+
+### 2.3 Defer Non-Critical Third-Party Libraries
+
+**Impact: MEDIUM (loads after hydration)**
+
+Analytics, logging, and error tracking don't block user interaction. Load them after hydration.
+
+**Incorrect: blocks initial bundle**
+
+```tsx
+import { Analytics } from "@vercel/analytics/react";
+
+export default function RootLayout({ children }) {
+ return (
+
+
+ {children}
+
+
+
+ );
+}
+```
+
+**Correct: loads after hydration**
+
+```tsx
+import dynamic from "next/dynamic";
+
+const Analytics = dynamic(
+ () => import("@vercel/analytics/react").then((m) => m.Analytics),
+ { ssr: false },
+);
+
+export default function RootLayout({ children }) {
+ return (
+
+
+ {children}
+
+
+
+ );
+}
+```
+
+### 2.4 Dynamic Imports for Heavy Components
+
+**Impact: CRITICAL (directly affects TTI and LCP)**
+
+Use `next/dynamic` to lazy-load large components not needed on initial render.
+
+**Incorrect: Monaco bundles with main chunk ~300KB**
+
+```tsx
+import { MonacoEditor } from "./monaco-editor";
+
+function CodePanel({ code }: { code: string }) {
+ return ;
+}
+```
+
+**Correct: Monaco loads on demand**
+
+```tsx
+import dynamic from "next/dynamic";
+
+const MonacoEditor = dynamic(
+ () => import("./monaco-editor").then((m) => m.MonacoEditor),
+ { ssr: false },
+);
+
+function CodePanel({ code }: { code: string }) {
+ return ;
+}
+```
+
+### 2.5 Preload Based on User Intent
+
+**Impact: MEDIUM (reduces perceived latency)**
+
+Preload heavy bundles before they're needed to reduce perceived latency.
+
+**Example: preload on hover/focus**
+
+```tsx
+function EditorButton({ onClick }: { onClick: () => void }) {
+ const preload = () => {
+ if (typeof window !== "undefined") {
+ void import("./monaco-editor");
+ }
+ };
+
+ return (
+
+ );
+}
+```
+
+**Example: preload when feature flag is enabled**
+
+```tsx
+function FlagsProvider({ children, flags }: Props) {
+ useEffect(() => {
+ if (flags.editorEnabled && typeof window !== "undefined") {
+ void import("./monaco-editor").then((mod) => mod.init());
+ }
+ }, [flags.editorEnabled]);
+
+ return (
+ {children}
+ );
+}
+```
+
+The `typeof window !== 'undefined'` check prevents bundling preloaded modules for SSR, optimizing server bundle size and build speed.
+
+---
+
+## 3. Server-Side Performance
+
+**Impact: HIGH**
+
+Optimizing server-side rendering and data fetching eliminates server-side waterfalls and reduces response times.
+
+### 3.1 Cross-Request LRU Caching
+
+**Impact: HIGH (caches across requests)**
+
+`React.cache()` only works within one request. For data shared across sequential requests (user clicks button A then button B), use an LRU cache.
+
+**Implementation:**
+
+```typescript
+import { LRUCache } from "lru-cache";
+
+const cache = new LRUCache({
+ max: 1000,
+ ttl: 5 * 60 * 1000, // 5 minutes
+});
+
+export async function getUser(id: string) {
+ const cached = cache.get(id);
+ if (cached) return cached;
+
+ const user = await db.user.findUnique({ where: { id } });
+ cache.set(id, user);
+ return user;
+}
+
+// Request 1: DB query, result cached
+// Request 2: cache hit, no DB query
+```
+
+Use when sequential user actions hit multiple endpoints needing the same data within seconds.
+
+**With Vercel's [Fluid Compute](https://vercel.com/docs/fluid-compute):** LRU caching is especially effective because multiple concurrent requests can share the same function instance and cache. This means the cache persists across requests without needing external storage like Redis.
+
+**In traditional serverless:** Each invocation runs in isolation, so consider Redis for cross-process caching.
+
+Reference: [https://github.com/isaacs/node-lru-cache](https://github.com/isaacs/node-lru-cache)
+
+### 3.2 Minimize Serialization at RSC Boundaries
+
+**Impact: HIGH (reduces data transfer size)**
+
+The React Server/Client boundary serializes all object properties into strings and embeds them in the HTML response and subsequent RSC requests. This serialized data directly impacts page weight and load time, so **size matters a lot**. Only pass fields that the client actually uses.
+
+**Incorrect: serializes all 50 fields**
+
+```tsx
+async function Page() {
+ const user = await fetchUser(); // 50 fields
+ return ;
+}
+
+("use client");
+function Profile({ user }: { user: User }) {
+ return
{user.name}
; // uses 1 field
+}
+```
+
+**Correct: serializes only 1 field**
+
+```tsx
+async function Page() {
+ const user = await fetchUser();
+ return ;
+}
+
+("use client");
+function Profile({ name }: { name: string }) {
+ return
{name}
;
+}
+```
+
+### 3.3 Parallel Data Fetching with Component Composition
+
+**Impact: CRITICAL (eliminates server-side waterfalls)**
+
+React Server Components execute sequentially within a tree. Restructure with composition to parallelize data fetching.
+
+**Incorrect: Sidebar waits for Page's fetch to complete**
+
+```tsx
+export default async function Page() {
+ const header = await fetchHeader();
+ return (
+
+
{header}
+
+
+ );
+}
+
+async function Sidebar() {
+ const items = await fetchSidebarItems();
+ return ;
+}
+```
+
+**Correct: both fetch simultaneously**
+
+```tsx
+async function Header() {
+ const data = await fetchHeader();
+ return
;
+}
+```
+
+This is especially helpful for large and static SVG nodes, which can be expensive to recreate on every render.
+
+**Note:** If your project has [React Compiler](https://react.dev/learn/react-compiler) enabled, the compiler automatically hoists static JSX elements and optimizes component re-renders, making manual hoisting unnecessary.
+
+### 6.4 Optimize SVG Precision
+
+**Impact: LOW (reduces file size)**
+
+Reduce SVG coordinate precision to decrease file size. The optimal precision depends on the viewBox size, but in general reducing precision should be considered.
+
+**Incorrect: excessive precision**
+
+```svg
+
+```
+
+**Correct: 1 decimal place**
+
+```svg
+
+```
+
+**Automate with SVGO:**
+
+```bash
+npx svgo --precision=1 --multipass icon.svg
+```
+
+### 6.5 Prevent Hydration Mismatch Without Flickering
+
+**Impact: MEDIUM (avoids visual flicker and hydration errors)**
+
+When rendering content that depends on client-side storage (localStorage, cookies), avoid both SSR breakage and post-hydration flickering by injecting a synchronous script that updates the DOM before React hydrates.
+
+**Incorrect: breaks SSR**
+
+```tsx
+function ThemeWrapper({ children }: { children: ReactNode }) {
+ // localStorage is not available on server - throws error
+ const theme = localStorage.getItem("theme") || "light";
+
+ return
;
+}
+```
+
+Component first renders with default value (`light`), then updates after hydration, causing a visible flash of incorrect content.
+
+**Correct: no flicker, no hydration mismatch**
+
+```tsx
+function ThemeWrapper({ children }: { children: ReactNode }) {
+ return (
+ <>
+
{children}
+
+ >
+ );
+}
+```
+
+The inline script executes synchronously before showing the element, ensuring the DOM already has the correct value. No flickering, no hydration mismatch.
+
+This pattern is especially useful for theme toggles, user preferences, authentication states, and any client-only data that should render immediately without flashing default values.
+
+### 6.6 Use Activity Component for Show/Hide
+
+**Impact: MEDIUM (preserves state/DOM)**
+
+Use React's `` to preserve state/DOM for expensive components that frequently toggle visibility.
+
+**Usage:**
+
+```tsx
+import { Activity } from "react";
+
+function Dropdown({ isOpen }: Props) {
+ return (
+
+
+
+ );
+}
+```
+
+Avoids expensive re-renders and state loss.
+
+### 6.7 Use Explicit Conditional Rendering
+
+**Impact: LOW (prevents rendering 0 or NaN)**
+
+Use explicit ternary operators (`? :`) instead of `&&` for conditional rendering when the condition can be `0`, `NaN`, or other falsy values that render.
+
+**Incorrect: renders "0" when count is 0**
+
+```tsx
+function Badge({ count }: { count: number }) {
+ return
{count && {count}}
;
+}
+
+// When count = 0, renders:
0
+// When count = 5, renders:
5
+```
+
+**Correct: renders nothing when count is 0**
+
+```tsx
+function Badge({ count }: { count: number }) {
+ return
{count > 0 ? {count} : null}
;
+}
+
+// When count = 0, renders:
+// When count = 5, renders:
5
+```
+
+---
+
+## 7. JavaScript Performance
+
+**Impact: LOW-MEDIUM**
+
+Micro-optimizations for hot paths can add up to meaningful improvements.
+
+### 7.1 Batch DOM CSS Changes
+
+**Impact: MEDIUM (reduces reflows/repaints)**
+
+Avoid changing styles one property at a time. Group multiple CSS changes together via classes or `cssText` to minimize browser reflows.
+
+**Incorrect: multiple reflows**
+
+```typescript
+function updateElementStyles(element: HTMLElement) {
+ // Each line triggers a reflow
+ element.style.width = "100px";
+ element.style.height = "200px";
+ element.style.backgroundColor = "blue";
+ element.style.border = "1px solid black";
+}
+```
+
+**Correct: add class - single reflow**
+
+```typescript
+// CSS file
+.highlighted-box {
+ width: 100px;
+ height: 200px;
+ background-color: blue;
+ border: 1px solid black;
+}
+
+// JavaScript
+function updateElementStyles(element: HTMLElement) {
+ element.classList.add('highlighted-box')
+}
+```
+
+**Correct: change cssText - single reflow**
+
+```typescript
+function updateElementStyles(element: HTMLElement) {
+ element.style.cssText = `
+ width: 100px;
+ height: 200px;
+ background-color: blue;
+ border: 1px solid black;
+ `;
+}
+```
+
+**React example:**
+
+```tsx
+// Incorrect: changing styles one by one
+function Box({ isHighlighted }: { isHighlighted: boolean }) {
+ const ref = useRef(null);
+
+ useEffect(() => {
+ if (ref.current && isHighlighted) {
+ ref.current.style.width = "100px";
+ ref.current.style.height = "200px";
+ ref.current.style.backgroundColor = "blue";
+ }
+ }, [isHighlighted]);
+
+ return
+}
+```
+
+**Why this matters in React:**
+
+1. Props/state mutations break React's immutability model - React expects props and state to be treated as read-only
+
+2. Causes stale closure bugs - Mutating arrays inside closures (callbacks, effects) can lead to unexpected behavior
+
+**Browser support: fallback for older browsers**
+
+```typescript
+// Fallback for older browsers
+const sorted = [...items].sort((a, b) => a.value - b.value);
+```
+
+`.toSorted()` is available in all modern browsers (Chrome 110+, Safari 16+, Firefox 115+, Node.js 20+). For older environments, use spread operator:
+
+**Other immutable array methods:**
+
+- `.toSorted()` - immutable sort
+
+- `.toReversed()` - immutable reverse
+
+- `.toSpliced()` - immutable splice
+
+- `.with()` - immutable element replacement
+
+---
+
+## 8. Advanced Patterns
+
+**Impact: LOW**
+
+Advanced patterns for specific cases that require careful implementation.
+
+### 8.1 Store Event Handlers in Refs
+
+**Impact: LOW (stable subscriptions)**
+
+Store callbacks in refs when used in effects that shouldn't re-subscribe on callback changes.
+
+**Incorrect: re-subscribes on every render**
+
+```tsx
+function useWindowEvent(event: string, handler: () => void) {
+ useEffect(() => {
+ window.addEventListener(event, handler);
+ return () => window.removeEventListener(event, handler);
+ }, [event, handler]);
+}
+```
+
+**Correct: stable subscription**
+
+```tsx
+import { useEffectEvent } from "react";
+
+function useWindowEvent(event: string, handler: () => void) {
+ const onEvent = useEffectEvent(handler);
+
+ useEffect(() => {
+ window.addEventListener(event, onEvent);
+ return () => window.removeEventListener(event, onEvent);
+ }, [event]);
+}
+```
+
+**Alternative: use `useEffectEvent` if you're on latest React:**
+
+`useEffectEvent` provides a cleaner API for the same pattern: it creates a stable function reference that always calls the latest version of the handler.
+
+### 8.2 useLatest for Stable Callback Refs
+
+**Impact: LOW (prevents effect re-runs)**
+
+Access latest values in callbacks without adding them to dependency arrays. Prevents effect re-runs while avoiding stale closures.
+
+**Implementation:**
+
+```typescript
+function useLatest(value: T) {
+ const ref = useRef(value);
+ useEffect(() => {
+ ref.current = value;
+ }, [value]);
+ return ref;
+}
+```
+
+**Incorrect: effect re-runs on every callback change**
+
+```tsx
+function SearchInput({ onSearch }: { onSearch: (q: string) => void }) {
+ const [query, setQuery] = useState("");
+
+ useEffect(() => {
+ const timeout = setTimeout(() => onSearch(query), 300);
+ return () => clearTimeout(timeout);
+ }, [query, onSearch]);
+}
+```
+
+**Correct: stable effect, fresh callback**
+
+```tsx
+function SearchInput({ onSearch }: { onSearch: (q: string) => void }) {
+ const [query, setQuery] = useState("");
+ const onSearchRef = useLatest(onSearch);
+
+ useEffect(() => {
+ const timeout = setTimeout(() => onSearchRef.current(query), 300);
+ return () => clearTimeout(timeout);
+ }, [query]);
+}
+```
+
+---
+
+## References
+
+1. [https://react.dev](https://react.dev)
+2. [https://nextjs.org](https://nextjs.org)
+3. [https://swr.vercel.app](https://swr.vercel.app)
+4. [https://github.com/shuding/better-all](https://github.com/shuding/better-all)
+5. [https://github.com/isaacs/node-lru-cache](https://github.com/isaacs/node-lru-cache)
+6. [https://vercel.com/blog/how-we-optimized-package-imports-in-next-js](https://vercel.com/blog/how-we-optimized-package-imports-in-next-js)
+7. [https://vercel.com/blog/how-we-made-the-vercel-dashboard-twice-as-fast](https://vercel.com/blog/how-we-made-the-vercel-dashboard-twice-as-fast)
diff --git a/.continue/agents/security-audit.md b/.continue/agents/security-audit.md
new file mode 100644
index 00000000000..6fddd39fb71
--- /dev/null
+++ b/.continue/agents/security-audit.md
@@ -0,0 +1,6 @@
+---
+name: Security Audit
+description: Security Audit
+---
+
+Please audit this pull request for any security vulnerabilities that were introduced. In particular you should look for new sources of potential prompt injections, or other vulnerabilities caused by the fact that this extension / CLI run locally on a user's machine. Do NOT look into anything unless it was changed in the pull request. When you are done, please make the required changes.
diff --git a/.continue/agents/update-agents-md.md b/.continue/agents/update-agents-md.md
new file mode 100644
index 00000000000..fd38abd0964
--- /dev/null
+++ b/.continue/agents/update-agents-md.md
@@ -0,0 +1,80 @@
+---
+name: Update AGENTS.md
+description: Update AGENTS.md
+---
+
+# Intent Layer Sync Agent
+
+You are an Intent Layer maintenance agent. Your job is to keep the codebase's intent documentation (AGENTS.md, CLAUDE.md, or similar files) synchronized with code changes.
+
+## Your Task
+
+Analyze the PR changes and determine if any intent layer files need updates. If yes, make edits in a stacked PR.
+
+## What is an Intent Layer?
+
+Intent layer files capture **institutional knowledge** that isn't visible in code:
+
+- System boundaries and ownership
+- Invariants and contracts that must hold
+- Patterns to follow / anti-patterns to avoid
+- Pitfalls and edge cases engineers encounter
+
+## Process
+
+### Step 1: Analyze Changed Files
+
+- List all files modified in this PR
+- Understand the semantic nature of changes (new feature, refactor, bug fix, API change, etc.)
+
+### Step 2: Identify Affected Intent Nodes
+
+- Find intent files (AGENTS.md, CLAUDE.md, etc.) that cover the changed directories
+- Check both the immediate directory and ancestor directories (intent is hierarchical)
+
+### Step 3: Evaluate Need for Updates
+
+An intent layer update is needed when changes affect:
+
+- **Boundaries**: What a module owns or doesn't own changed
+- **Contracts/APIs**: Entry points, invariants, or interfaces changed
+- **Patterns**: New recommended way to do something, or old pattern deprecated
+- **Anti-patterns**: New footgun discovered or existing one resolved
+- **Dependencies**: New system integration or removed dependency
+- **Pitfalls**: Bug fix that reveals a non-obvious gotcha
+
+An update is NOT needed for:
+
+- Internal implementation changes that don't affect usage patterns
+- Bug fixes that don't reveal systemic issues
+- Test additions without behavioral changes
+- Documentation-only changes
+
+### Step 4: Make Updates (Leaf-First)
+
+If updates are needed, work leaf-first (most specific nodes first, then ancestors):
+
+1. Write specific edits to the intent file(s)
+2. Keep updates **dense and high-signal** - compress to essentials
+3. Follow the existing structure/format of the intent file
+4. Use the LCA principle: place facts at the shallowest node that covers all relevant code
+
+### Step 5: Push your changes
+
+Push your changes
+
+## Quality Criteria
+
+- **Density**: Every token must earn its place. No fluff.
+- **Accuracy**: Must reflect actual code behavior
+- **Completeness**: Capture what agents need to work effectively here
+- **Consistency**: Match existing intent file style/format
+- **Non-duplication**: Don't repeat what's in child nodes or code comments
+
+## Anti-Patterns to Avoid
+
+- ❌ Dumping implementation details that belong in code comments
+- ❌ Duplicating content between intent files
+- ❌ Adding low-signal boilerplate
+- ❌ Updating for every minor change (be selective)
+- ❌ Proposing changes that will immediately drift from reality
diff --git a/.continue/agents/update-continue-docs.md b/.continue/agents/update-continue-docs.md
new file mode 100644
index 00000000000..58b8f318978
--- /dev/null
+++ b/.continue/agents/update-continue-docs.md
@@ -0,0 +1,90 @@
+---
+name: Update Continue Docs
+description: Update Continue Docs
+---
+
+# Role & Background
+
+You are a Developer Advocate at Continue, focused on helping developers understand, adopt, and benefit from Continuous AI and AI-assisted development agents.
+
+Your voice should balance technical clarity, product advocacy, and developer empathy. You write with the instincts of someone who:
+
+- Understands real development agents and pain points
+- Values trust, transparency, and user autonomy
+- Communicates like a practicing engineer, not a marketer
+- Advocates for developers by translating complex ideas into practical value
+
+You are opinionated in the right places, honest about tradeoffs, and always rooting everything in developer reality.
+
+---
+
+# Task
+
+Determine if the Continue Docs should be updated based on the changes in the provided Pull Request.
+
+**Decision criteria:**
+
+- Changes should remain scoped and aim to keep the docs at the same level of detail
+- Do not always add additional information for niche code updates
+- Only update docs when changes meaningfully affect developer understanding or usage
+
+**If docs updates are needed:**
+
+1. Make a plan for updating the docs
+2. Follow that plan to update the documentation
+
+**If docs updates are NOT needed:**
+
+- Add a comment to the PR with a short explanation about why updating the Continue Docs was not necessary
+
+---
+
+# Requirements
+
+- **DO NOT** change anything other than documentation
+- Failing checks, bugs in code, code review comments, etc. are **not in your scope**
+- Use Mintlify components to display information in the most effective way
+- Keep existing frontmatter (`title`, `description`) EXACTLY as provided—do not change them
+- Add any new pages to the appropriate location in the docs navigation file (e.g., `docs.json`)
+
+---
+
+# Writing Guidelines
+
+## Voice & Tone
+
+- Precise, structured, technically accurate, example-driven
+- Always prefer clarity over jargon
+- Always root explanations in developer experience
+- Never fabricate data or claims
+- Do not promise capabilities that aren't official or verified
+
+## Content Quality
+
+- Keep pages scannable: short paragraphs, strong verbs, minimal jargon
+- Use 1–2 sentence descriptions with outcome language—no marketing fluff
+- Do not repeat UI text unless it clarifies permissions or prerequisites
+- No step-by-step UI walkthroughs unless explicitly required
+
+## Formatting
+
+- Use short bullets with bold labels where appropriate
+- Use Mintlify components correctly and consistently:
+ - `` for linked call-to-action items
+ - `` for grouping related cards
+ - `` / `` for supplemental or collapsible content
+ - `` for actionable guidance
+ - `` for important caveats
+ - `` for additional context
+
+## Support & Resources Sections
+
+- Use `` with 2–4 cards
+- Prefer internal docs pages when available
+- Include vendor/external docs only when truly necessary
+
+---
+
+# Context: Continue
+
+Continue is the leading open-source AI coding agent, with IDE extensions for VS Code and JetBrains, as well as a CLI, `cn`.
diff --git a/.gitignore b/.gitignore
index 2a5bc64f80c..eeafe223e94 100644
--- a/.gitignore
+++ b/.gitignore
@@ -171,7 +171,6 @@ extensions/.continue-debug/
.continuerules
**/.continue/assistants/
-**/.continue/agents/
keys
.channels_cache.json
diff --git a/extensions/cli/.continue/agents/format-check.md b/extensions/cli/.continue/agents/format-check.md
new file mode 100644
index 00000000000..6a4321e11bc
--- /dev/null
+++ b/extensions/cli/.continue/agents/format-check.md
@@ -0,0 +1 @@
+Check that code is well-formatted.