🚀 INTELLIGENT CODE GENERATOR PROJECT - COMPLETE CONTEXT
PROJECT OVERVIEW:
We are building an Intelligent Code Generation System that automatically generates complete, deployable enterprise applications from user functional requirements. This is part of a larger automated development pipeline.
CURRENT ARCHITECTURE FLOW:
Webhook (User Features) → Requirement-Processor → n8n Code Node → Tech-Stack-Selector → **CODE-GENERATOR** (What we're building next)
EXISTING WORKING COMPONENTS:
1. REQUIREMENT-PROCESSOR:

Status: ✅ WORKING
Input: User functional requirements via webhook
Output: Structured feature list with 86+ enterprise features
Technology: Python FastAPI service
Port: 8001

2. TECH-STACK-SELECTOR:

Status: ✅ WORKING
Input: Feature list from requirement-processor
Output: Structured JSON with technology recommendations
Technology: Python FastAPI with Claude integration
Port: 8002
Key Feature: Returns structured JSON with specific technology choices

3. SAMPLE WORKING OUTPUT:
json{
  "technology_recommendations": {
    "frontend": {
      "framework": "Next.js with React 18",
      "libraries": ["Redux Toolkit", "Socket.io-client", "Material UI"]
    },
    "backend": {
      "framework": "NestJS", 
      "language": "TypeScript",
      "libraries": ["Socket.io", "Passport.js", "Winston"]
    },
    "database": {
      "primary": "PostgreSQL with TimescaleDB",
      "secondary": ["Redis", "Elasticsearch"]
    }
  }
}
CODE-GENERATOR REQUIREMENTS (What we need to build):
CORE FUNCTIONALITY:

Input:

Feature list (86+ features like "real_time_collaboration", "document_editing", etc.)
Technology stack choice (from tech-stack-selector)


Output:

Complete working code files on user's local system
Frontend code in chosen technology (React, Angular, Vue, Blazor, etc.)
Backend code in chosen technology (Node.js, Java, Python, .NET, Go, etc.)
Database schemas and configurations
Working application structure



CRITICAL REQUIREMENTS:
A) TECHNOLOGY AGNOSTIC:

Must work with ANY technology stack Claude chooses:

Frontend: React, Vue, Angular, Blazor, Flutter, etc.
Backend: Node.js, Java Spring, Python Django, .NET Core, Go, PHP Laravel, etc.
Database: PostgreSQL, MongoDB, MySQL, Oracle, SQL Server, etc.


Code-generator does NOT choose technologies - it uses EXACTLY what tech-stack-selector specifies

B) CONTEXT MEMORY (MOST CRITICAL):

Problem: Claude has token limitations (~200K tokens)
Challenge: Generating 100+ features could exceed token limits
Solution Needed: Persistent context management system that ensures Claude NEVER forgets what it has built
Requirements:

Remember all generated APIs, components, database schemas
Maintain consistency across all generated code
Handle stop/resume scenarios
Prevent breaking existing code when adding new features



C) INCREMENTAL GENERATION:

Generate code in intelligent batches (5-10 features at a time)
Add files incrementally as features are implemented
Merge/overwrite existing files intelligently
Maintain code consistency across all sessions

D) LOCAL FILE GENERATION:

Write code files directly to user's local file system
Create proper project structure (frontend/, backend/, database/, etc.)
Generate deployment configurations (Docker, etc.)

PROPOSED ARCHITECTURE:
1. CONTEXT MANAGEMENT:
python# HYBRID APPROACH:
# 1. Central Context Database (on our service) - for Claude's memory
# 2. Local Project Context (user's system) - for progress tracking

class ProjectContextManager:
    def __init__(self, project_id):
        self.central_db = CentralContextService()  # Our database
        self.local_context = LocalProjectContext()  # User's .generation-context.json
        
    def get_current_context(self):
        # Combines both contexts for Claude
        # Ensures Claude remembers everything built so far
        
    def update_context(self, new_code, completed_features):
        # Updates both central and local context
        # Never loses memory
2. UNIVERSAL CODE GENERATION:
pythonclass UniversalCodeGenerator:
    def generate_code(self, features, tech_stack_choice, existing_context):
        """
        Generates code in ANY technology stack:
        - Java Spring + Angular + Oracle
        - Python Django + React + PostgreSQL  
        - .NET Core + Blazor + SQL Server
        - Node.js + Vue + MongoDB
        - etc.
        """
        
        claude_prompt = f"""
        EXACT TECHNOLOGIES TO USE:
        - Frontend: {tech_stack_choice.frontend.framework}
        - Backend: {tech_stack_choice.backend.framework}
        - Language: {tech_stack_choice.backend.language}
        
        EXISTING CONTEXT (what's already built):
        {existing_context}
        
        NEW FEATURES TO IMPLEMENT:
        {features}
        
        Generate production-ready code that integrates with existing context.
        """
3. PROGRESS TRACKING:
generated-project/
├── .generation-context.json           # Progress tracking
├── .generation-dashboard/             # HTML dashboard
├── frontend/                          # Generated frontend code
├── backend/                           # Generated backend code  
├── database/                          # Generated schemas
└── docs/                             # Generated documentation
CURRENT STATUS:

✅ Requirement-processor: Working and deployed
✅ Tech-stack-selector: Working and deployed, returns structured JSON
✅ n8n workflow: Working end-to-end
🔨 NEXT TO BUILD: Universal Code Generator with context memory

KEY TECHNICAL CHALLENGES TO SOLVE:

Context Persistence: Ensure Claude never forgets across token-limited sessions
Technology Agnostic Generation: Generate code in ANY language/framework
Incremental File Management: Add/modify files without breaking existing code
Local File System Integration: Write code directly to user's system
Progress Tracking: Real-time dashboards showing completion status

INTEGRATION POINT:
The code-generator will be an extension of the current n8n workflow, receiving the structured output from tech-stack-selector and generating complete applications on the user's local system.

Copy this entire context to new Claude sessions to continue development from this exact point. 🚀