Skip to content

Resources: what a step, a choice or an executor needs of the machine ​

Generated from docs/standards/resources.md · npm run docs:gen

Code: core/platform/resources.ts (types, parsing, missing, shortText), core/quests/standard.ts (Step.resources, Choice.resources, stepResources, StepView.short, validation), core/runs/executors.ts (ExecutorInfo.resources), server/lib/mode.mjs (machineOf, the probe). Tests: tests/resources.test.ts, tests/onboarding.test.ts, e2e tests/e2e/guide-wake.write.spec.ts. Author guide: docs-site/guides/quests/resources.md.

ts
interface Resources {          // any subset, written like Kubernetes resources
  cpu?: number | string;       // cores: 4, "4", "500m" (half a core); at most 1024
  memory?: number | string;    // total memory: bytes, or "16Gi", "512Mi" (binary), "16G" (decimal)
  disk?: number | string;      // free space on the volume of the player's home
  gpu?: true;                  // a GPU the models can use (Apple Silicon's unified memory counts)
  arch?: Arch[];               // "arm64", "x64"
}
interface Measured { cpu?: number; memory?: number; disk?: number; gpu?: boolean }   // Host.machine (bytes, cores)

Where it is declared ​

  • Step.resources (alta.game/0.2 and later; quest fragments of any version the game reads): on a step not done yet, where the machine has less, evaluate() gives the step short (the reason, English and French). The client shows that line instead of the step's "Do it" or "I did it". The step stays visible (os and host hide a step; resources never does) and is never proven by it.
  • ExecutorInfo.resources, in the closed list of executors: a step that runs it needs it too (stepResources(step, os) keeps the larger value of each resource, and only the processor families both accept). setup.base needs disk: "20Gi", its installer's own preflight (MIN_FREE_GB).
  • Choice.resources: the option is greyed where the machine has less, with the same line (choicesFor). off comes first when both hold. "Wake your Daemon" greys its local model below memory: "16Gi" or disk: "10Gi" (the engine then pulls qwen3:8b, about 5 GB on disk and in memory, next to the local embeddings, OpenClaw and the system; local_model_for_ram in engine/lib/alta_machine.py); the step "Give it a local model" says the same.

The probe (read only) ​

machineOf() in server/lib/mode.mjs, sent in /api/game.host.machine: cpu = os.availableParallelism(), memory = os.totalmem(), disk = free blocks available to the user × block size (fs.statfs of the home: what df shows as available), gpu = true on Apple Silicon, on Linux when /dev/nvidia0 exists, else false. A measure that fails is left out. WORLD_HOST_MACHINE=memory:8Gi,disk:5Gi,cpu:2,gpu:0 replaces what it names (the control plane of a hosted world, the tests). On the demo state only, ?machine= does the same in the client, like ?host=.

Rules ​

  • missing(resources, host) lists what falls short, in the order cpu, memory, disk, gpu, arch. A resource the server did not measure is never short: an older server, a reference host or a demo never refuses on a guess.
  • Memory is compared in whole GB as on the machine's label (a "16 GB" VM that reports 15.6 has 16); disk to a tenth of a GB under 10 GB, else whole GB.
  • shortText(short): one line naming each missing resource and what the machine has, joined with "and": "Needs 16 GB of memory (this machine: 8 GB)." / « Il faut 16 Go de mémoire (cette machine : 8 Go). »; "Needs 20 GB of free disk (this machine: 12 GB)."; "Needs 4 processor cores (this machine: 2 cores)."; "Needs a GPU the models can use (this machine has none)."; "Needs an Apple Silicon (arm64) processor (this machine: x64)."

Validation (checkGame, alta lint) ​

Each problem is <uid>/<step>: [choice <id>: ]resources.<key>: …, rule ids resources.field (not an object, empty, or an unknown resource), resources.cpu, resources.memory, resources.disk, resources.gpu (only true), resources.arch. A choice step one of whose choices has resources is also tried on each reference host as the smallest machine (SMALLEST_MACHINE: one core, 1 GB of memory, no free disk, no GPU): it must leave a choice to pick (choice.none-on-host), and never show "Recommended" on a greyed choice (choice.recommended). resources on a step or a choice needs alta.game/0.2 (game.v2-field). JSON schema: $defs.resources of the game, quests and item schemas.

Alta OS is open source (MIT).