#3068·clawhub

perf: measure and reduce the shared route entry bundle

Author: vyctorbrzezowskiCreated Jul 13, 2026Updated Sep 18, 2026
LabelsenhancementP3clawsweeper:no-new-fix-prclawsweeper:needs-maintainer-reviewclawsweeper:needs-product-decisionissue-rating: 🌊 off-meta tidepoolimpact:other

Summary

ClawHub's initial route closure contains a large shared preload set across pages that do not render most of that UI. Before a broad route-module refactor, run a small measured extraction to prove which cross-route imports materially contribute to the entry bundle.

Related umbrella: #2925. The /plugins catalog loader work in #3062 is separate and out of scope.

Measured evidence

A clean production build on current main showed, across six representative routes:

  • 73–75 modulepreloads;
  • 518–532 KB compressed preload bytes;
  • approximately 2.04 MB decoded;
  • the home route still loaded 75 modulepreloads.

Source tracing found route-to-route imports that combine loader/head contracts with heavy UI, including skill detail, plugin detail, security audit, Markdown/Shiki, dialogs, and a legacy redirect importing SkillDetailPage.

Enabling global loader splitting was tested and rejected: home HTML fell from 194,191 to 129,952 bytes, but modulepreloads increased from 75 to 96 and compressed preload bytes increased from 531,700 to 540,810.

Proposed investigation

  1. Remove UI imports from the legacy $owner/$slug redirect path.
  2. Extract loader/head/data contracts for one skill or plugin route into a module with no React/UI imports.
  3. Measure the exact manifest closure before and after.
  4. Expand to sibling routes only if the small A/B produces a material net reduction without a navigation waterfall.

Non-goals

  • Enabling global loader splitting.
  • Moving every route into a new feature architecture before the first A/B.
  • Adding a bundle budget before an accepted target is known.
  • Treating all .output assets as initial JavaScript.

Acceptance criteria

  • Report route-by-route preload count, compressed bytes, decoded bytes, and the changed module closure.
  • Canonical and legacy redirects preserve SSR, metadata, and hydration behavior.
  • Detail-route navigation does not add a new request waterfall.
  • If the first extraction does not materially improve the measured closure, stop and document the no-go result instead of continuing the refactor.
  • Add a build budget only after a proven reduction establishes a defensible threshold.

Validation

  • Clean baseline/candidate builds using the same SHA and environment.
  • Manifest-based measurement plus cold browser navigation for home, browse, detail, redirect, and dashboard routes.
  • Existing route, redirect, metadata, hydration, static, unit, and type/build gates.