← back to Designer Wallcoverings
DW-Agents/dw-agents/CODEBASE_STRUCTURE_ANALYSIS.md
422 lines
# DW-Agents Codebase Structure - Complete Analysis
## Overview
The DW-Agents system is a multi-agent AI assistant platform for Designer Wallcoverings, using Node.js/Express with TypeScript and Claude AI. The system includes 20+ specialized agents, a shared UI component system, and unified theming infrastructure.
---
## 1. AGENT FILES - COMPLETE LIST
### Core Hub Agents
1. **Master Hub** - `/root/DW-Agents/master-hub.ts` (1019 lines)
- Purpose: Central dashboard for all agents
- Port: 9712 (also at 9893)
- Key: Uses `getUniversalHeader` from shared-ui-components.js
- Status tracking, agent registry, unified control panel
2. **Agents Viewer** - `/root/DW-Agents/agents-viewer.ts` (24413 lines)
- Purpose: Dashboard showing ALL running agents
- Port: 9111
- Features: Real-time status monitoring, quick links, agent statistics
- Authentication: admin2025/Otis
### Operational Agents (In /root/DW-Agents/agent-* directories and root)
**Accounting** (2 locations)
- `/root/DW-Agents/agent-accounting/accounting-agent.ts` (956 lines)
- `/root/DW-Agents/accounting-agent.ts` (1256 lines)
- Port: 9885
- Features: P&L generation, expense tracking, invoice management
**Completed Tasks** (2 locations)
- `/root/DW-Agents/agent-completed-tasks/completed-tasks-agent.ts` (8945 lines)
- `/root/DW-Agents/completed-tasks-agent.ts` (19316 lines)
- Features: Task completion tracking, dashboard
**Digital Samples** (2 locations)
- `/root/DW-Agents/agent-digital-samples/digital-samples-agent.ts` (1137 lines)
- `/root/DW-Agents/digital-samples-agent.ts` (1241 lines)
- Port: 9879
- Features: DIG-series order processing, image resizing, Slack integration
**In-Parallel** (2 locations)
- `/root/DW-Agents/agent-in-parallel/in-parallel-agent.ts` (19092 lines)
- `/root/DW-Agents/in-parallel-agent.ts` (19706 lines)
- Features: Parallel task processing
**Log Monitor**
- `/root/DW-Agents/agent-log-monitor/log-monitor-agent.ts` (30998 lines)
- Port: 7239
- Features: Log analysis, error detection, monitoring dashboard
- Data: detected-issues.json (539KB)
**Marketing** (2 locations)
- `/root/DW-Agents/agent-marketing/marketing-agent.ts` (1506 lines)
- `/root/DW-Agents/marketing-agent.ts` (1838 lines)
- Port: 9881
- Features: Blog post generation, social media, email campaigns
**Needs Attention** (2 locations)
- `/root/DW-Agents/agent-needs-attention/needs-attention-agent.ts` (15267 lines)
- `/root/DW-Agents/needs-attention-agent.ts` (25421 lines)
- Features: Priority task tracking, alerts
**New Client Signup** (multiple versions)
- `/root/DW-Agents/agent-new-client-signup/new-client-signup-agent.ts` (13060 lines)
- `/root/DW-Agents/new-client-signup-agent.ts` (13056 lines)
- Features: Signup workflow automation
**Parallel Processes** (2 locations)
- `/root/DW-Agents/agent-parallel-processes/parallel-processes-agent.ts` (23273 lines)
- `/root/DW-Agents/parallel-processes-agent.ts` (23355 lines)
- Features: Multi-process orchestration
**Purchasing Office** (2 locations)
- `/root/DW-Agents/agent-purchasing-office/purchasing-office-agent.ts` (46105 lines)
- `/root/DW-Agents/purchasing-office-agent.ts` (1539 lines)
- Port: 9880
- Features: Office supplies ordering, Amazon price comparison, chat
**Server Uptime**
- `/root/DW-Agents/server-uptime-agent.ts` (914 lines)
- Features: Server monitoring, uptime tracking
**Task Orchestrator** (2 locations)
- `/root/DW-Agents/agent-task-orchestrator/task-orchestrator-agent.ts` (1810 lines)
- `/root/DW-Agents/task-orchestrator-agent.ts` (1719 lines)
- Port: 9900
- Features: Master task coordination, workflow management
**Today's Highlights** (2 locations)
- `/root/DW-Agents/agent-todays-highlights/todays-highlights-agent.ts` (17630 lines)
- `/root/DW-Agents/todays-highlights-agent.ts` (30679 lines)
- Features: Daily summary dashboard
**Trend Research** (2 locations)
- `/root/DW-Agents/agent-trend-research/trend-research-agent.ts` (1344 lines)
- `/root/DW-Agents/trend-research-agent.ts` (1350 lines)
- Port: 9883
- Features: Market intelligence, trend forecasting
**Zendesk Chat** (2 locations)
- `/root/DW-Agents/agent-zendesk-chat/zendesk-chat-agent.ts` (1459 lines)
- `/root/DW-Agents/zendesk-chat-agent.ts` (1739 lines)
- Port: 9884
- Features: Customer support monitoring, Zendesk integration
**Shopify Store**
- `/root/DW-Agents/agent-shopify-store/shopify-store-agent.ts` (1086 lines)
- Port: 7238
- Features: Store management, product handling
### Executive Dashboard Agents (NEW)
- `/root/DW-Agents/agent-executive-ceo/ceo-dashboard-agent.ts` (21993 lines)
- Port: Not yet configured
- `/root/DW-Agents/agent-executive-cfo/cfo-dashboard-agent.ts` (9970 lines)
- Port: Not yet configured
- `/root/DW-Agents/agent-executive-coo/coo-dashboard-agent.ts` (6966 lines)
- Port: Not yet configured
- `/root/DW-Agents/agent-executive-vp-ops/vp-ops-dashboard-agent.ts` (7102 lines)
- Port: Not yet configured
### Specialized Agents
- **Legal Team**: `/root/DW-Agents/DWLegalTeam/legal-agent.ts` (2447 lines)
- Port: 9878
- Features: Settlement compliance, pattern monitoring
- **UI Manager**: `/root/DW-Agents/agent-ui-manager/ui-manager-agent.ts` (1013 lines)
- Port: 7240
- Purpose: Central UI/UX management system
- Features: Unified design system, theme customization
- **Security Agent**: `/root/DW-Agents/agent-security/security-agent.ts` (24013 lines)
- Features: Security monitoring, issue detection
- Data: security-issues.json
- **Skills Manager**: `/root/DW-Agents/agent-skills-manager/skills-manager-agent.ts` (1242 lines)
- Features: Manages Claude skills/tools
- Data: skills-records.json (3085 bytes)
- **Restart Analyzer**: `/root/DW-Agents/agent-restart-analyzer/restart-analyzer-agent.ts` (13844 lines)
- Features: System restart pattern analysis
---
## 2. WEB VIEWER FILES
### Primary Viewers
1. **Agents Viewer** - `/root/DW-Agents/agents-viewer.ts`
- Port: 9111
- Purpose: Central dashboard showing ALL running agents
- Features: Real-time status, quick links, agent statistics, uptime tracking
### Secondary Viewers (Built into Agent Dashboards)
All agents include HTML dashboards with the structure:
- Login page with authentication
- Main dashboard with data/charts
- Chat interface (universal)
- Refresh controls with countdown timer
### Data Files Used by Viewers
- `/root/DW-Agents/tasks-database.json` (6.5 MB - large task database)
- `/root/DW-Agents/agent-needs-attention/memory.json` (5.2 KB)
- `/root/DW-Agents/agent-log-monitor/detected-issues.json` (539 KB)
- `/root/DW-Agents/agent-security/security-issues.json` (833 bytes)
- `/root/DW-Agents/agent-skills-manager/skills-records.json` (3 KB)
---
## 3. THEME AND STYLING CONFIGURATION
### Existing Theme System
**File**: `/root/DW-Agents/shared-ui-components.js` (320 lines)
**Brand Colors (BRAND_COLORS object)**:
```javascript
{
primary: '#667eea', // Primary purple
secondary: '#764ba2', // Secondary purple
accent: '#4facfe', // Cyan accent
success: '#4CAF50', // Green
warning: '#FFA500', // Orange
danger: '#f44336', // Red
dark: '#2c3e50', // Dark gray
light: '#ecf0f1' // Light gray
}
```
### Design System (in ui-manager-agent.ts)
**File**: `/root/DW-Agents/agent-ui-manager/ui-manager-agent.ts` (lines 37-107)
**DESIGN_SYSTEM object contains**:
- Colors (8 standard colors)
- Fonts (system & monospace)
- Spacing (base 20px, small 10px, large 40px)
- Border radius (5px, 8px, 10px)
- Shadows (small, medium, large)
- Action link styles (base + hover + success variants)
### Components Using Themes
1. **Universal Header** (`getUniversalHeader()`)
- Uses BRAND_COLORS for gradient background
- Chat input styling
- Refresh button with countdown
- Responsive flex layout
2. **Agent Registry** (in multiple agents)
- Each agent has custom color in master-hub.ts
- Port number and icon mapping
- Category grouping
### Color Assignments by Agent (from master-hub.ts)
```
Legal Team: #dc143c (Crimson)
Digital Samples: #4facfe (Cyan)
Purchasing: #667eea (Primary Purple)
Marketing: #f093fb (Pink)
Accounting: #43e97b (Green)
Zendesk Chat: #17a2b8 (Teal)
Trend Research: (not specified)
```
---
## 4. THEME-MANAGER OR THEMING SYSTEM REFERENCES
### Current State
- **NO dedicated "theme-manager" system** currently exists
- Theming is **scattered across multiple files**:
- Color definitions in `shared-ui-components.js`
- Design system in `ui-manager-agent.ts`
- Per-agent colors in `master-hub.ts`
- Inline CSS in individual agent files
### Theming Opportunities
The UI Manager agent (`/root/DW-Agents/agent-ui-manager/ui-manager-agent.ts`) is designed as the central point for:
- Theme customization and distribution
- Style consistency across all agents
- Design system management
- Central navigation hub
However, it currently only shows:
- Agent directory
- Live links
- Theme concepts (not fully implemented)
---
## 5. FILES REQUIRING THEME INFORMATION UPDATES
### CRITICAL - Always Use Universal Components
Files should be updated to ensure consistent theming:
**Category A: Core Infrastructure Files**
1. `/root/DW-Agents/shared-ui-components.js`
- Already contains: BRAND_COLORS, getUniversalHeader(), getAgentEmoji()
- Action: Define comprehensive theme export interface
2. `/root/DW-Agents/agent-ui-manager/ui-manager-agent.ts`
- Already contains: DESIGN_SYSTEM object
- Action: Expand to theme configuration endpoint, API for theme distribution
3. `/root/DW-Agents/master-hub.ts`
- Currently has: Agent colors, registry
- Action: Centralize agent color mapping, reference theme system
**Category B: Agents Using getUniversalHeader** (20+ agents)
All these agents import and use the universal header and need theming support:
1. `/root/DW-Agents/completed-tasks-agent.ts` - Uses getUniversalHeader
2. `/root/DW-Agents/server-uptime-agent.ts` - Uses getUniversalHeader
3. `/root/DW-Agents/agent-accounting/accounting-agent.ts`
4. `/root/DW-Agents/agent-marketing/marketing-agent.ts`
5. `/root/DW-Agents/agent-zendesk-chat/zendesk-chat-agent.ts`
6. `/root/DW-Agents/agent-trend-research/trend-research-agent.ts`
7. `/root/DW-Agents/agent-purchasing-office/purchasing-office-agent.ts`
8. `/root/DW-Agents/agent-digital-samples/digital-samples-agent.ts`
9. `/root/DW-Agents/agent-shopify-store/shopify-store-agent.ts`
10. `/root/DW-Agents/agent-log-monitor/log-monitor-agent.ts`
Plus all duplicate agent files in `/root/DW-Agents/` root directory (same names, different locations).
**Category C: Executive Dashboards** (Need theme setup)
These new agents don't have themes yet:
1. `/root/DW-Agents/agent-executive-ceo/ceo-dashboard-agent.ts` - NEW
2. `/root/DW-Agents/agent-executive-cfo/cfo-dashboard-agent.ts` - NEW
3. `/root/DW-Agents/agent-executive-coo/coo-dashboard-agent.ts` - NEW
4. `/root/DW-Agents/agent-executive-vp-ops/vp-ops-dashboard-agent.ts` - NEW
**Category D: Complex Agents** (Inline styling needs update)
1. `/root/DW-Agents/agent-needs-attention/needs-attention-agent.ts` - Large inline CSS
2. `/root/DW-Agents/agent-legal-team/legal-agent.ts` - 2447 lines, likely complex styling
3. `/root/DW-Agents/agent-task-orchestrator/task-orchestrator-agent.ts` - Master task agent
4. `/root/DW-Agents/agent-in-parallel/in-parallel-agent.ts` - Parallel processing UI
5. `/root/DW-Agents/agent-parallel-processes/parallel-processes-agent.ts` - Process UI
6. `/root/DW-Agents/agent-new-client-signup/new-client-signup-agent.ts` - Form-based agent
**Category E: Configuration Files**
1. `/root/DW-Agents/ecosystem.config.js` (7090 lines)
- Contains PM2 configuration for all agents
- No theme configuration yet (opportunity for theme env vars)
2. `/root/DW-Agents/AGENTS_INDEX.md`
- Documents all agents
- Could include theme/styling notes
3. `/root/DW-Agents/agent-ui-manager/MEMORY.md`
- UI Manager's memory/knowledge base
- Should document theming decisions and patterns
**Category F: Specialized Agent Files**
1. `/root/DW-Agents/agent-skills-manager/skills-manager-agent.ts`
- Manages Claude skills
- Could have theme skill
2. `/root/DW-Agents/agent-restart-analyzer/restart-analyzer-agent.ts`
- System analysis
- Monitoring visualizations need themes
3. `/root/DW-Agents/agent-security/security-agent.ts` (24013 lines)
- Security dashboard
- Critical monitoring UI needs clear theming
**Category G: Viewer/Portal Files**
1. `/root/DW-Agents/agents-viewer.ts` (24413 lines)
- Port 9111
- Central agents dashboard
- Should showcase theme capabilities
---
## 6. MEMORY AND DOCUMENTATION FILES
### Agent Memory Files (Store theme preferences)
```
/root/DW-Agents/agent-accounting/MEMORY.md
/root/DW-Agents/agent-completed-tasks/MEMORY.md
/root/DW-Agents/agent-digital-samples/MEMORY.md
/root/DW-Agents/agent-in-parallel/MEMORY.md
/root/DW-Agents/agent-legal-team/MEMORY.md
/root/DW-Agents/agent-log-monitor/MEMORY.md
/root/DW-Agents/agent-marketing/MEMORY.md
/root/DW-Agents/agent-needs-attention/MEMORY.md
/root/DW-Agents/agent-new-client-signup/MEMORY.md
/root/DW-Agents/agent-parallel-processes/MEMORY.md
/root/DW-Agents/agent-purchasing-office/MEMORY.md
/root/DW-Agents/agent-server-uptime/MEMORY.md
/root/DW-Agents/agent-shopify-store/MEMORY.md
/root/DW-Agents/agent-task-orchestrator/MEMORY.md
/root/DW-Agents/agent-todays-highlights/MEMORY.md
/root/DW-Agents/agent-trend-research/MEMORY.md
/root/DW-Agents/agent-ui-manager/MEMORY.md
/root/DW-Agents/agent-zendesk-chat/MEMORY.md
```
### Documentation Files
- `/root/DW-Agents/README.md` - Main project documentation
- `/root/DW-Agents/AGENTS_INDEX.md` - Agent registry and descriptions
- `/root/DW-Agents/agent-ui-manager/README.md` - UI Manager specific docs
---
## 7. AUTHENTICATION AND SHARED FILES
**Shared Authentication**
- `/root/DW-Agents/shared-auth.ts` - SSO token management
- AUTH_USERNAME: 'admin2025'
- AUTH_PASSWORD: 'Otis' (from agents-viewer.ts)
**Shared Memory System**
- `/root/DW-Agents/shared-memory-system.ts` - AgentMemory class for persistent agent knowledge
**Shared Task Reporter**
- `/root/DW-Agents/shared-task-reporter.ts` - Task reporting utilities
---
## SUMMARY TABLE
| File Category | Count | Purpose | Theme Support |
|---|---|---|---|
| Core Hub Agents | 2 | Master control & viewer | Partial |
| Operational Agents | 18 | Domain-specific tasks | Using shared components |
| Executive Dashboards | 4 | C-level reporting | NEW - no themes |
| Specialized Agents | 4 | Security, skills, restart | No dedicated theming |
| UI Infrastructure | 2 | Shared components & design | Defined but not distributed |
| Configuration | 1 | PM2 ecosystem config | No theme integration |
| Documentation | 3 | Project & agent docs | Theme strategy needed |
| **TOTAL** | **34+** | Complete agent system | **Needs unification** |
---
## KEY FINDINGS
1. **Existing Theme Foundation**:
- BRAND_COLORS defined in shared-ui-components.js
- DESIGN_SYSTEM defined in ui-manager-agent.ts
- Universal header with consistent UI patterns
2. **Theme Distribution Gaps**:
- No centralized theme configuration endpoint
- No theme switching mechanism
- No way for agents to dynamically change their theme
- Agent colors hardcoded in master-hub.ts
3. **Files Needing Theme Updates** (Priority):
- **MUST**: shared-ui-components.js, ui-manager-agent.ts, master-hub.ts
- **HIGH**: All 18 operational agents
- **MEDIUM**: 4 executive dashboards
- **LOW**: Specialized agents (security, restart, skills)
4. **Opportunity**: Build centralized theme-manager system that:
- Exposes theme API endpoint
- Allows theme switching
- Stores preferences in memory/database
- Distributes themes to all agents via API
- Provides theme presets (Material, Bootstrap, Custom)