Repository navigation
Description
Problem
The data model is correct: Recipe (template) → Room/Activity (instance) with recipeId. But the routing layer completely ignores this and hardcodes everything.
Previous sessions built a parallel routing system instead of using the recipe system that was already there. Now there are two competing systems that must be kept in sync manually, plus 72+ switch statements on content type strings scattered across the codebase.
The Damage
Parallel System 1: Hardcoded Registry
ContentTypeRegistry.FALLBACK_REGISTRY— 18 hardcoded content types mapping string → widget + panel configLayoutTypes.DEFAULT_LAYOUTS— 5 more hardcoded layouts for sidebar compositionContentTabsWidget.TYPE_ICONS— 18 hardcoded icon mappingsContentTypeunion type in UserStateEntity — hardcoded string union that must be extended for each new typeRoutingService.resolve()— switch statement routing content types to entity resolversPositronicRAGContext— switch statement for widget-specific context extraction
Parallel System 2: Recipe JSON (the correct one)
- 24 recipe JSON files in
system/recipes/that define layout, pipeline, RAG, strategy RecipeEntityin the database with proper fieldsActivityUILayouttype that supports full panel composition- Already has
main,left,right,bottompanel configs
The Result
- Adding a new content type requires editing 4+ files
- Recipe layouts and registry layouts can drift apart
- No dynamic discovery — everything is hardcoded strings
- Compression Principle violation: content type definitions duplicated across 6+ locations
Files Affected
Primary targets (kill or gut):
src/widgets/main/shared/ContentTypeRegistry.ts— the 18-entry FALLBACK_REGISTRYsrc/system/layout/LayoutTypes.ts— DEFAULT_LAYOUTS hardcoded mapsrc/widgets/content-tabs/ContentTabsWidget.ts— TYPE_ICONS hardcoded mapsrc/system/data/entities/UserStateEntity.ts—ContentTypeunion type
Switch statements to eliminate (72+ occurrences):
src/system/routing/RoutingService.ts— switch on contentType in resolve()src/system/state/PositronicRAGContext.ts— switch for widget highlightssrc/system/core/client/shared/services/ContentService.ts— hardcoded type list
Target Architecture
One ID, one lookup. ContentService.open(uniqueId) resolves to a recipe, and the recipe defines everything:
User clicks "Training Dashboard"
→ ContentService.open('training-dashboard') // ONE arg
→ Lookup recipe by uniqueId
→ Recipe defines: widget, layout, right panel, icon, display name, pipeline, RAG
→ No registry, no switch statements, no hardcoded types
What recipes already support (just unused by routing):
layout.main— primary widget(s)layout.left/layout.right/layout.bottom— panel compositiondisplayName— tab titlepipeline— command sequence for AI behaviorragTemplate— context building rulesstrategy— response decision criteriatags— for discovery/search
What recipes need added:
icon— emoji/icon for tab display (currently hardcoded in TYPE_ICONS)pathPrefix— URL routing (currently hardcoded in registry)requiresEntity— whether uniqueId/entityId is needed (currently hardcoded)
Implementation Strategy
- Extend recipe schema with icon, pathPrefix, requiresEntity
- Make RecipeLayoutService the single lookup — all routing goes through it
- Kill FALLBACK_REGISTRY — migrate each entry to a recipe JSON
- Kill DEFAULT_LAYOUTS — sidebar config moves into recipes
- Kill TYPE_ICONS — icon comes from recipe
- Kill ContentType union — replace with
string(recipe uniqueId) - Replace switch statements with recipe-driven lookup (72+ sites)
- RoutingService.resolve() — use recipe metadata instead of switch
Scope
This is a large refactor but mechanically straightforward — the data model and recipe system are already correct. The work is eliminating the parallel hardcoded system and making the existing recipe system the single source of truth.
Related Issues
- Enforce maximum lint/clippy strictness across TypeScript and Rust #361 (lint strictness) — similar codebase-wide cleanup pattern
- Training & Grid widgets (Grid transport module: Tailscale + Reticulum adapters #358) — blocked from proper integration until this is fixed
Activity
Training & Grid widgets, job persistence, grid/send fix, event infras…
joelteply commentedon Mar 27, 2026
Addressed in PR #567 (branch
fix/generated-content-types):Eliminated:
New:
generator/generate-content-types.ts— reads all 27 recipe JSON files, generates TypeScript types, configs, icons, entityTypeentityType: "room" | "user" | "activity"— routing uses this, not content type namesRemaining:
Adding a content type: create recipe JSON, run generator. Zero code changes needed.
Fix: room selection uses recipeId as contentType, not hardcoded 'chat'
Gap analysis: #362 content routing PARTIAL — room selection uses reci…
joelteply commentedon Mar 30, 2026
Content routing fixed: generator reads new widgets[] format (#598), generated config checked before async recipe service (#597). Live, factory, grid, logs all route correctly. ContentTypeRegistry still exists but works. Full removal tracked separately.
test(runtime): module-wiring audit — every ServiceModule registers or…
fix(probes): wire the debug/probes live stream — the router was insta…
fix(cognition): a citizen's own lived turns become curriculum — produ…
guard(hygiene): unwired public machinery can never increase — the "bu…
fix(swe+ci): harness stops eating unattempted instances, GPU platform…