warfactoryracine/modules/economy/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.7 KiB

Economy Module - Pure Market Logic

Context

You are working EXCLUSIVELY on economic simulation logic. No infrastructure, no networking, no threading.

Responsibilities

  • Market simulation: Supply/demand, pricing dynamics
  • Trading: Buy/sell orders, market makers, price discovery
  • Economic indicators: Inflation, growth, market health
  • Resource valuation: Dynamic pricing based on scarcity/abundance

Interface Contract

// Input JSON examples:
{
  "type": "market_update",
  "item": "steel_plate",
  "supply": 1000,
  "demand": 800
}

{
  "type": "trade",
  "action": "buy",
  "item": "copper_ore",
  "quantity": 50,
  "max_price": 2.5
}

// Output JSON examples:
{
  "status": "trade_executed",
  "item": "copper_ore",
  "quantity": 50,
  "price": 2.3,
  "total_cost": 115.0
}

{
  "market_data": {
    "steel_plate": {"price": 5.2, "trend": "rising"},
    "copper_ore": {"price": 2.3, "trend": "stable"}
  }
}

Build Commands

cd modules/economy/
cmake .                    # Build from THIS directory
make economy-module        # Generates economy.so
make test-economy         # Run isolated tests
./build/economy-module    # Test the module

File Limits

  • EconomyModule.cpp: Max 300 lines
  • Pure logic only: No sockets, threads, or engine dependencies
  • JSON in/out: All communication via JSON messages

Focus Areas

  1. Market algorithms (supply/demand curves, price elasticity)
  2. Trading mechanics (order books, market makers)
  3. Economic modeling (inflation, economic cycles)

Claude Code should NEVER leave this directory or reference parent paths!