Skip to content

Phase K Step 3: Build-order signature + auto-theme #225

Description

@aberson

Build step 3 of 5 — Phase K (umbrella #215)

Build doc: documentation/plans/phase-k-build-plan.md §4 Step K.3

What to build

extract_build_order_signature(game_id) -> list[tuple[str, int]] — returns the first 5 minutes of unit/structure production as [(unit_name, count), ...] ranked by frequency. Read from transitions or decision_audit.json.

Auto-theme function: infer_themes(signature) -> list[str] with 3-5 hardcoded rules:

  • ≥3 Stargate-tech in first 5 minskytoss
  • ≥2 Robo-techtech-rush (Immortals/Colossus path)
  • Cannons before 2nd basedefensive
  • ≤1 base in first 5 min, ≥10 Zealotscheese-rush
  • (default) → ground

Existing context

  • Game-level data lives in bots/<version>/data/training.db (transitions table) and bots/<version>/data/decision_audit.json.
  • Use whichever is faster to query for unit-production-events. Transitions table likely; one query per game_id.
  • 5-minute cutoff: convert from game_loops via bots.v0.config.GAME_STEP_LOOPS (existing).

Files to modify/create

  • src/orchestrator/build_order_signature.py — NEW. Pure function reading from training.db.
  • src/orchestrator/auto_theme.py — NEW. Pure function over the signature output.
  • tests/test_build_order_signature.py — NEW. Fixture-based.
  • tests/test_auto_theme.py — NEW. 5 hand-crafted signatures.

Done when

  • Signature extraction tests pass on a fixture game ID (synthetic transitions).
  • Auto-theme produces sensible labels on 5 hand-crafted signatures.
  • uv run mypy src --strict + uv run ruff check clean.

Flags

--reviewers code --isolation worktree

Depends on

K.2.

Produces

Two new modules + their tests.


Synced from build doc by /repo-sync

Metadata

Metadata

Assignees

No one assigned

    Labels

    bot-versioningBot ring-fence, versioning, and self-play workenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions