Docs / instances
Sandbox instances
Source: docs/instances.md
A project is a resolved gamecomposer.yml manifest. An instance is one independent run of that project; each service in the instance has one Kiri container. The stable identity is (project, instance, service, manifest, template). Keep this identity and the kitty ls --json record shape stable for desktop, SDK, and downstream tooling.
Identity and container names
projectis the 12-character hexadecimal id derived from the resolved manifest path. Two manifests at different paths are separate projects, even if their names match.instanceis 1–16 lowercase letters or digits. Omitted means"1".up --newallocates the smallest free positive integer (1,2,3, …); instance IDs are read from Kiri before allocation.serviceis the manifest service name.- The default instance preserves the legacy container name
gc-<project>-<service>. Other instances usegc-<project>_<instance>-<service>. The underscore cannot occur in project or instance IDs, preventing collisions with service names.
Every container carries these labels: gamecomposer.managed, gamecomposer.project, gamecomposer.instance, gamecomposer.service, gamecomposer.manifest, gamecomposer.name, and gamecomposer.template (plus the existing configuration fingerprint label). Labels are the source of truth for listing. Older managed containers without instance/manifest labels are reported as instance "1" with manifest: null.
Storage and ports
Instance 1 retains the declared save and writable paths for compatibility. Other instances store them under <project>/.gamecomposer/instances/<id>/<declared-path>, so copies do not share save files. .gamecomposer/ is ignored by Git.
The runtime requests a loopback-only published port with --publish 127.0.0.1::<containerPort>. Kiri assigns a free host port to every container; the runtime reports that actual port and URL. A manifest's declared output port is the container port, not a host port. Kiri requires a publishable network mode for published ports; in particular, network: none cannot publish a local browser player.
CLI
kitty --file gamecomposer.yml up nes # default instance 1
kitty --file gamecomposer.yml --new up nes # allocate another instance
kitty --file gamecomposer.yml -i 2 down # remove only instance 2
kitty ls # all managed containers
kitty ls --json # stable JSON records
Only up includes transitive depends_on services. status, logs, stop, and down target exactly the selected services and instance. ls is global and reads current container state from Kiri, so the result survives CLI and desktop restarts.
Two concurrent --new requests may both observe the same smallest free ID before either has created its containers. The desktop disables New instance while an allocation is pending for that project. Independent concurrent CLI allocations are not serialized.
ls --json record
One object is returned per managed container:
| Field | Type | Meaning |
|---|---|---|
container |
string | Kiri container name |
id |
string | Short container ID (up to 12 hex characters) |
project |
string | 12-hex manifest-path project ID |
instance |
string | Instance ID; legacy containers default to "1" |
service |
string | Manifest service name |
manifest |
string or null |
Absolute manifest path; legacy records use null |
name |
string or null |
Manifest name |
template |
string or null |
Template directory ID, or null when not a template |
state |
string | Kiri state text |
running |
boolean | Whether Kiri reports the container running |
url |
string or null |
Loopback player URL when running and published |
hostPort |
number or null |
Kiri-assigned host port |
containerPort |
number or null |
Published container port |
image |
string | Image reference |
created |
string or null |
Kiri creation timestamp |
The SDK equivalent is InstanceRecord in sdk/src/lifecycle.ts; Python's gamecomposer.instances.record produces the same shape. The runtime list function gamecomposer.instances.list_instances and kitty ls are backed by Kiri, not process-local state.

