# Factory Module - Pure Production Logic ## Context You are working EXCLUSIVELY on factory production logic. No infrastructure, no networking, no threading. ## Responsibilities - **Assembly lines**: Manage production queues and recipes - **Resource flow**: Input materials → processing → output products - **Efficiency**: Calculate throughput, bottlenecks, optimization - **Automation**: Belt systems, inserters, production planning ## Interface Contract ```cpp // Input JSON examples: { "type": "produce", "recipe": "steel_plate", "quantity": 100, "inputs": {"iron_ore": 200, "coal": 50} } { "type": "optimize", "target_production": {"steel_plate": 50, "copper_wire": 100}, "available_machines": 10 } // Output JSON examples: { "status": "producing", "progress": 0.75, "outputs": {"steel_plate": 75}, "efficiency": 0.85 } ``` ## Build Commands ```bash cd modules/factory/ cmake . # Build from THIS directory make factory-module # Generates factory.so make test-factory # Run isolated tests ./build/factory-module # Test the module ``` ## File Limits - **FactoryModule.cpp**: Max 300 lines - **Pure logic only**: No sockets, threads, or engine dependencies - **JSON in/out**: All communication via JSON messages ## Focus Areas 1. Production algorithms (recipe chains, efficiency) 2. Resource management (inventory, flow optimization) 3. Automation logic (belt routing, machine placement) Claude Code should NEVER leave this directory or reference parent paths!