Screeps Ant Swarm

July 7, 2026 · View on GitHub

TypeScript Screeps bot and reusable framework packages for a swarm-style, multi-room empire. The repository is an npm-workspaces monorepo: framework packages own reusable behavior, while packages/screeps-bot composes and deploys the runtime bundle.

Quick start

nvm use
npm ci
npm run verify

Node.js 24 is the supported local, CI, and deploy baseline.

Repository layout

packages/screeps-bot/                  Runtime composition, config, Rollup bundle, deploy adapter
packages/@ralphschuler/screeps-core/   Core primitives, logging, events, alliance safety
packages/@ralphschuler/screeps-*       Framework packages: cache, kernel, memory, roles, etc.
packages/screeps-{spawn,economy,...}/  Additional framework packages
packages/screeps-server/               Dockerized private-server validation harness
packages/screepsmod-testing/           In-game private-server assertions/mod
docs/                                  Architecture, testing, deployment, operations, strategy docs
ROADMAP.md                             Swarm strategy and architecture source of truth

Common commands

CommandPurpose
npm run check-versionsVerify Node/npm baseline.
npm run sync:deps:checkCheck shared framework dependency sync.
npm run buildBuild framework packages and bot bundle.
npm run typecheckTypecheck workspaces with configured scripts.
npm run lint:allLint bot and core framework packages.
npm test / npm run test:unitRun main bot tests.
npm run test:allRun every workspace test script.
npm run test:server:smokeRun Dockerized private-server smoke validation.
npm run build:docsBuild wiki documentation output.
npm run verifyMain local quality gate.
npm run push / npm run deployBuild and upload to Screeps when credentials are configured.

Architecture rule: framework first

Shared behavior belongs in framework packages, not in the runtime bot package.

  • Roles/state machines → @ralphschuler/screeps-roles
  • Spawn planning/queues → @ralphschuler/screeps-spawn
  • Economy/market/terminal/link logic → @ralphschuler/screeps-economy
  • Defense/towers/safe mode/threat scoring → @ralphschuler/screeps-defense
  • Memory schema/migrations → @ralphschuler/screeps-memory
  • Cache/TTL utilities → @ralphschuler/screeps-cache
  • Pathfinding/route helpers → @ralphschuler/screeps-pathfinding
  • Room blueprint/stamp planning → @ralphschuler/screeps-layouts
  • Runtime wiring/config/deploy only → packages/screeps-bot

Permanent ally safety is mandatory: never target or attack TooAngel or TedRoastBeef.

Deploy

Configure Screeps credentials through environment variables or the package .env flow, then run:

npm run deploy:preflight
SCREEPS_HOSTNAME=screeps.com SCREEPS_BRANCH=main npm run push

npm run build is safe build-only mode. npm run deploy:preflight runs deploy-gate validation without secrets. npm run push sets DEPLOY=true and uploads the bundle only when SCREEPS_HOSTNAME and SCREEPS_BRANCH are explicit; if they are missing, it fails closed and prints the exact command to run.

Documentation

Start with:

Contributing

See CONTRIBUTING.md. Keep changes small, tested, and framework-first. Do not commit credentials, Screeps tokens, private server secrets, Memory dumps, or generated sensitive artifacts.