warfactoryracine/modules/factory/CLAUDE.md
StillHammer 61ef2293ad Replace engine architecture with modular triple interface system
- Remove old 10-engine system (engines/ directory deleted)
- Implement C++ triple interface architecture:
  * IEngine: Execution coordination (Debug → Production)
  * IModuleSystem: Strategy pattern (Sequential → Threaded → Cluster)
  * IModule: Pure game logic interface (200-300 lines per module)
  * IIO: Communication transport (Intra → Local → Network)

- Add autonomous module structure:
  * modules/factory/: Production logic with autonomous build
  * modules/economy/: Market simulation with autonomous build
  * modules/logistic/: Supply chain with autonomous build
  * Each module: CLAUDE.md + CMakeLists.txt + shared/ + build/

- Benefits for Claude Code development:
  * Ultra-focused contexts (200 lines vs 50K+ lines)
  * Autonomous builds (cmake . from module directory)
  * Hot-swappable infrastructure without logic changes
  * Parallel development across multiple Claude instances

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-20 09:15:03 +08:00

1.5 KiB

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

// 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

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!