Agents --> Agent rules

This page is the human-readable form of AGENTS.md and loki://docs/integration. Installing the package is step one, not the end of the job.

Disclaimer for agents

Do not report the integration complete after npm install, lokiplay connect, or the first lokiplay ship. Each game still requires fine-tuning: inspect the real modes, confirm player counts, teams, and scoring with the creator, run the room flow through client.createLobby() and draw its screens in the game’s own theme, tune the reducer or RealtimeProfile, and exercise reconnect and mobile. If a material field is ambiguous, stop and ask.

Hard rules

  1. Install @lokiplay/sdk@0.5.8. Do not import Nakama.
  2. Production multiplayer runs only on a Loki-hosted finished browser build.
  3. Upload game.json, index.html, and static assets. No backends, secrets, ad tags, or localhost.
  4. Never override projectId, player identity, membership, or sequence.
  5. createRoom() / joinRoom({ inviteCode }). No invented room keys.
  6. Run the room flow through client.createLobby() and build every screen in the game’s own theme. The overlay is not that flow.
  7. Loki’s SDK does not add a public lobby screen. Every game builds the room browser, a Create private room control and a Create public room control, a Match control, and a Leaderboard, with loading, empty, joining, full-room, waiting, readiness, and error states. Do not make every room public.
  8. Do not invent game.json fields.
  9. Synchronized vs realtime by state progression, not animation.
  10. Hosted games: createHostedLokiClient({ projectId }) at boot.
  11. Realtime: calibrate; do not copy snapshotHz into tickRate.
  12. Let the SDK own lifecycle. Never leave on hide/offline.
  13. dispatch() only while connected.
  14. For a synchronized room, a control that commits a match action calls dispatch(), and the result is drawn from the snapshot that comes back. Aim, hover, and animation stay local. If the player cannot act, or dispatch() rejects, the control says so.
  15. CSP: no inline script, no remote fonts/CSS, no <form>.
  16. Leave @lokiplay/sdk external in the production build; Loki serves it at /loki/sdk.js. Run lokiplay preview before ship.
  17. validate before ship. Do not claim device testing you did not do.

Workflow

npm install @lokiplay/sdk@0.5.8
LOKI_API_URL=https://api.lokiplay.cc npx lokiplay@0.5.8 login
npx lokiplay@0.5.8 connect --project <uuid>
npx lokiplay@0.5.8 ship

Package install does not need Loki credentials. Login does. Stop on auth or deploy errors.

Machine-readable: MCP, /llms.txt, /llms-full.txt.