Skip to content

Add MapAnalyst agent + spatial awareness + bootstrap playbook #10

@jkbennitt

Description

@jkbennitt

Context

ADR-002 (docs/adr/002-map-analyst-agent.md). Agents place buildings in rivers, create zones on barren soil, and build arbitrary layouts because they have no spatial awareness. Delta is consistently negative (-0.015 to -0.024) across models — this is NOT a model quality problem, it's a data problem.

Three Changes

1. MapAnalyst Agent (7th agent)

Dedicated spatial reasoning agent that runs before the other 6. Reads RIMAPI terrain/ore/plant/zone/room endpoints and produces a structured MapAnalysis with:

  • Colony center position
  • Fertile areas with fertility scores + crop recommendations
  • Recommended build sites on solid ground
  • Ore deposit locations
  • Water features (don't build here)
  • Natural walls (use for defense)
  • Recommended coordinates for: stockpile, growing zone, shelter

Other agents consume this analysis instead of picking random coordinates.

2. Early-Game Bootstrap Playbook

Deterministic plan for ticks 1-5:

  • Tick 1: Stockpile zone near drop pods, work priorities for all colonists
  • Tick 2: Growing zone on fertile soil (Plant_Rice for speed)
  • Tick 3: Shelter walls (5x5 room with door) on solid ground
  • Tick 4: Beds inside shelter
  • Tick 5: Campfire/stove for cooking
  • Tick 6+: LLM takes over for adaptive strategy

3. Pre-processed Map Summary

Compact text summary shared by all agents (~500 tokens):

Colony center: (128, 133). Fertile soil: (100-120, 80-95).
River: x=130-135. Mountain: z>200. Geyser: (145, 90).
Zones: 1 growing (25 cells), 1 stockpile (16 cells).
Rooms: 1 bedroom. No kitchen. No research room.

Plus role-specific deep data for relevant agents.

Files to Create/Modify

  • src/rle/agents/map_analyst.py — NEW: 7th agent
  • src/rle/rimapi/map_summary.py — NEW: terrain analysis + summarization
  • src/rle/orchestration/game_loop.py — Run MapAnalyst before other agents, cache results
  • src/rle/agents/base_role.py — Inject map summary into all agent prompts
  • src/rle/agents/__init__.py — Register 7th agent
  • src/rle/rimapi/schemas.py — Add MapAnalysis model
  • All 6 role agents — Consume MapAnalysis in filter_game_state()
  • Scenario YAMLs — Add bootstrap playbook directives per scenario

Success Criteria

  • Agents place buildings on solid ground, never in water
  • Growing zones on fertile soil, not random locations
  • Shelter built near colony center
  • Delta flips positive on Crashlanded
  • All 3 colonists visibly working in first 3 ticks

Relates to #6, #8

Metadata

Metadata

Assignees

No one assigned

    Labels

    epicLong-term strategic milestone

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions