CRITICAL: Universe Map Module System Disconnect
Analysis of architectural mismatch between universe-map implementation and production module system
🚨 CRITICAL: Universe Map Module System Disconnect
Status: Architecture mismatch identified - immediate attention required
Impact: HIGH - universe-map does not integrate with production module system
Date Identified: November 11, 2025
📊 Executive Summary
The @universe-map library has been implemented with a completely separate, incompatible module system that does not align with our production BrowserModuleContract architecture defined by the gograb-modules team.
Current State
What universe-map does:
- Stores simple JSON "module" objects in IndexedDB
- Has its own
UniversalModuleService - Creates placeholder modules with just
{id, name, type, universeId} - No lifecycle, no routes, no components, no real functionality
What it SHOULD do:
- Integrate with
@modularity-lib(real module installation) - Work with
BrowserModuleContractmodules (production system) - Generate/scaffold real modules with manifests, routes, components
- Coordinate with Module Registry Service
🔍 The Disconnect
Per modules-monorepo-instructions.md
Production Module System (gograb-modules foundation):
@Injectable({ providedIn: 'root' })
@ModuleDecorator({
id: 'my-module',
version: '1.0.0'
})
export class MyModule implements BrowserModuleContract {
readonly manifest: ModuleManifest = {
id: 'my-module',
name: 'My Module',
routes: [
{
path: 'my-route',
loadComponent: () => import('./my.component')
}
],
navigation: {
items: [...]
},
publicActions: {
'my-action': (params) => { ... }
},
embeddableComponents: {
'my-widget': MyWidgetComponent
}
};
configure(config: ModuleConfig): Observable<void> { ... }
initialize(): Observable<void> { ... }
start(): Observable<void> { ... }
stop(): Observable<void> { ... }
destroy(): Observable<void> { ... }
}
Key Characteristics:
- Auto-discovered via
@ModuleDecorator - Registered in
ModuleRegistryService - Full lifecycle management
- Routes dynamically injected
- Can communicate via public actions
- Can embed components
- Enterprise-ready (multi-tenant, observable)
Current universe-map Implementation
What it's doing (WRONG):
// UniversalModuleService.install()
const module = {
id: `mod_${timestamp}_${random}`,
name: `${type}-${timestamp}`,
type: type, // 'galaxy', 'world', 'page', etc.
universeId: universeId,
route: `/${name}`,
config: {},
parentId: parentId
};
// Store in IndexedDB
await this.storage.put(`universe:${universeId}:modules:${module.id}`, module);
What's missing:
- ❌ No class implementing
BrowserModuleContract - ❌ No
ModuleManifestwith routes, actions, components - ❌ No lifecycle hooks (configure, initialize, start, stop, destroy)
- ❌ No registration with
ModuleRegistryService - ❌ No integration with Module Discovery
- ❌ No real functionality - just JSON metadata
- ❌ Not recognized by the actual module system
🎯 What universe-map SHOULD Be
Correct Architecture
universe-map is NOT a module runtime - it's a visual structure editor for platform architecture.
Its role should be:
Visualize Hierarchy
- Show Universe → Galaxies → Worlds → Pages structure
- Display relationships and nesting
- Provide drag-drop organization
Generate Structure
- Create folder/file scaffolding
- Generate route configuration
- Set up module templates
Integrate with Real Module System
- Call
@modularity-libfor actual module installation - Work with
ModuleRegistryService - Trigger module generation via
@gograb-ai
- Call
Visual Planning Tool
- Help users plan their platform architecture
- Show what modules exist and where
- Allow reorganization and refactoring
Correct Flow
When user drops "Galaxy" from library:
// 1. User drags "Galaxy" module type
onModuleDrop(event: { moduleType: 'galaxy', position: {x, y} }) {
// 2. Open module creation wizard
this.openModuleCreationWizard({
type: 'galaxy',
suggestedName: 'my-galaxy',
parent: currentUniverse
});
}
// 3. User fills in module details (name, description, etc.)
// 4. Generate actual module using @modularity-lib
createRealModule(details: ModuleDetails) {
return this.modularityService.installModule({
manifest: {
id: details.id,
name: details.name,
version: '1.0.0',
routes: this.generateRoutes(details),
navigation: this.generateNav(details)
},
template: 'galaxy-template', // From MODULE-TEMPLATES-SYSTEM
destination: `modules/${details.id}/`
});
}
// 5. Module is now:
// - A real Angular library
// - Registered with ModuleRegistryService
// - Has routes, components, lifecycle
// - Can be enhanced by AI
// - Can communicate with other modules
🐛 Current Bug: Layout Mode Stuck
Why canvas is empty:
Console logs show:
🎯 Layout detected in current scope: layout-1762817343669
🔧 Layout mode: true
🌌 [universe level] Visual editor showing: 18 modules
Problem: There's a layout module that triggers Layout Zone Renderer mode. When in layout mode, the canvas shows zones instead of module cards.
Immediate Fix:
// In browser console:
const storage = window.__ggStorage__;
await storage.remove('universe:universe_1762790858234:modules:mod_1762817343669_dj9t6l0bw');
location.reload();
Root Cause: The layout zone system was implemented but isn't properly integrated with the visual editor UX. Users accidentally create layout modules and get stuck.
📋 Required Changes
Phase 1: Stop the Bleeding (Immediate)
Disable Layout Module Creation
- Remove "Layout" from module library for now
- Or add warning: "Advanced feature - creates zone-based layout"
Add "Exit Layout Mode" Button
- Detect when layout mode is active
- Show clear button: "Switch to Free-Form Mode"
- Temporarily hide layout module or delete it
Show Module Cards Even in Layout Mode
- Update
LayoutZoneRendererComponentto render actual module cards - Not just placeholder text
- Update
Phase 2: Architecture Realignment (Critical)
Integrate with @modularity-lib
// Replace UniversalModuleService with ModularityService import { ModularityService } from '@modularity-lib'; // Use real module installation this.modularityService.installModule(manifest, options);Remove Fake Module System
- Delete
UniversalModuleService.install()(creates fake modules) - Delete
UniversalModuletype (conflicts with real modules) - Use
BrowserModuleContractmodules only
- Delete
Add Module Generation Wizard
- Visual form for module creation
- Integrates with
@gograb-aifor AI-assisted generation - Uses
MODULE-TEMPLATES-SYSTEMfor scaffolding - Creates real modules with full manifests
Connect to Module Registry
// Query real modules from registry this.moduleRegistry.getAllModules().subscribe(modules => { // Show modules that exist in this universe/galaxy this.displayModules(modules.filter(m => m.scope === currentScope)); });
Phase 3: Enhanced Features (Future)
AI-Powered Generation
- "Create module from description"
- Uses
@gograb-ai+@prompt-system - Generates complete module with routes, components, logic
Visual Module Editor
- Click module → Edit manifest
- Add/remove routes visually
- Configure public actions
- Design embeddable components
Module Marketplace
- Browse available module templates
- Install from community
- Share custom modules
🔄 Migration Strategy
For Existing "Modules" in universe-map
Problem: There are 22 "fake modules" in storage that aren't real modules.
Options:
Option A: Convert to Metadata (Recommended)
- Keep existing data as "structure metadata"
- Use it to track organization/hierarchy
- Don't treat them as real modules
- Add real module creation flow separately
Option B: Retroactive Generation
- Scan existing fake modules
- Generate real module scaffolding for each
- Dangerous - might create 22 empty modules
Option C: Fresh Start
- Archive existing data
- Start fresh with proper module system
- Users recreate structure using real modules
Recommended Approach
Rename current system to
StructureMetadata- It's organizational info, not real modules
- Keep it for hierarchy visualization
- Don't confuse with Module System
Add parallel real module tracking
- Query actual modules from
ModuleRegistry - Show which real modules exist
- Link structure metadata to real modules
- Query actual modules from
Provide migration path
- Show users: "You have 18 structure items"
- Button: "Convert to real modules"
- Launches wizard for each item
📚 References
Documentation to Follow
modules-monorepo-instructions.md (attached)
- Defines production module system
- Explains BrowserModuleContract
- Shows gograb-modules as source of truth
MODULE-TEMPLATES-SYSTEM.md
- Templates for scaffolding new modules
- Integration with universe-map (planned)
gograb-modules/modules/module-creation-guide.md
- Step-by-step module creation
- Reference implementations
- Best practices
Existing Systems to Integrate With
@modularity-lib
ModularityService- Real module installationModuleRegistryService- Module discoveryBrowserBootstrapperService- Lifecycle management
@gograb-ai
- AI-powered module generation
- Component generation
- Logic flow creation
@prompt-system
- Guides AI for module generation
- Ensures quality and consistency
- Provides templates and patterns
✅ Success Criteria
universe-map is correctly aligned when:
- ✅ Uses real modules - No fake module objects in storage
- ✅ Integrates with ModuleRegistry - Queries actual registered modules
- ✅ Creates proper scaffolding - Generated modules have full manifests
- ✅ Lifecycle management - Modules can initialize, start, stop
- ✅ Route injection works - Modules' routes appear in app
- ✅ AI integration - Can generate modules via gograb-ai
- ✅ Template system - Uses MODULE-TEMPLATES-SYSTEM
- ✅ Visual organization - Still provides drag-drop hierarchy planning
🎯 Action Items
Immediate (This Session)
- Document the disconnect
- Fix layout mode stuck issue (delete problematic layout module)
- Add "Exit Layout Mode" UI
- Disable layout module creation temporarily
Short-term (Next Session)
- Refactor universe-map to use @modularity-lib
- Replace UniversalModuleService with ModularityService
- Add module creation wizard
- Connect to ModuleRegistryService
Long-term (Future)
- Implement AI-powered module generation
- Add visual module editor
- Create module marketplace
- Full integration with gograb-modules patterns
Critical Note: The current universe-map implementation is not compatible with our production module system. This is a high-priority architectural issue that needs resolution before universe-map can be considered production-ready.
Date: November 11, 2025
Priority: 🚨 CRITICAL
Status: Documented - Fix Required
Owner: Editor Team