PlayPets developer guide
Overview and audience
- PlayPets is a desktop companion: friends live in a painted yard window and step out onto the desktop to play.
- It stays open all day. Connect an AI to a friend to chat with it; friends react while a coding agent works.
- A Tauri v2 app: the page is web code with no build tool (
src/), and the backend is Rust (src-tauri/). - Runs on macOS, Windows and Linux.
| Reader | Where to read |
|---|---|
| People who change the code, build integrations or handle releases | This guide |
| People who use the app | The user guide on the site and the repository README |
| Contributors (PRs, check order) | CONTRIBUTING |
| AI agents and review bots | AGENTS.md, a short version of these rules |
- The site also shows these documents, unchanged, under its "Developers" tab.
Getting started
New here? Read in this order.
- Get the tests passing and start the app: Set up a development environment and run the app.
- Read the diagram and data flow in Architecture: PlayPets app. Find the component that owns the part you want to change.
- Read the standard for the area you change (the standards table under Area map).
- Page changes almost always touch Page code structure and Multilingual strings.
- Backend changes almost always touch Backend locks and threads.
- Run the checks in the order CONTRIBUTING gives, then open a PR.
- Add one line to
CHANGELOG.mdfor any change users can see.
Key concepts
- One app, two windows:
- The yard window (the main window) and a transparent desktop window on each monitor that has a friend on it, kept a minute after the last one leaves.
- Both windows draw only the state the backend holds.
- Commands and notifications:
- The page calls the backend through a single
window.playPets.<command>(). - On a state change, the backend sends the new state (
change) to the yard window, and the part the desktop draws to each desktop window. - Things that happen once are sent as events (
event), to the windows that act on them.
- The page calls the backend through a single
- Pets and friends:
- A pet is a character file:
pet.jsonplus a sprite sheet, in the Codex pet format. - A friend is a pet invited into the yard, with a name, a personality, a size and an AI connection.
- A pet is a character file:
- AI connection:
- Not needed for ordinary movement, games, gardening and collecting.
- It lets a friend hold an AI conversation.
- Claude Code and Codex use their signed-in CLIs.
- Those CLIs draw on subscription allowances and any paid extra usage. A CLI signed in with an API key can incur separate charges.
- Ollama, OpenAI, xAI (Grok) and OpenAI-compatible servers use HTTP.
- Local models have no hosted inference fees.
- Remote services bill through their provider.
- API keys saved by PlayPets live only in the OS secure storage.
- Agent integration:
playpets hook …orplaypets mcpruns the app executable in CLI mode, with no window.- CLI mode sends status to the running app through a local HTTP bridge.
- Node.js is not needed.
- Strings tables:
- Text people read lives in two tables: one for the page, one for the backend.
- Languages: Korean, English, Japanese and Simplified Chinese.
- Code uses only keys.
- Lock rule and page redraws:
- The backend never waits on the main thread while holding the state lock.
- The page redraws frequently only while something moves.
- Together they prevent freezes and battery drain.
Area map
Pick a document by what you want to know.
| What you want to know | Document |
|---|---|
| Getting the repo, running tests and starting the app for the first time | Set up a development environment and run the app |
| Root settings, directory ownership, generated files and common maintenance commands | Repository layout and tooling |
| How the app is built and what calls what | Architecture: PlayPets app |
| How coding agents reach the app; CLI, HTTP and MCP specs | Architecture: coding agent integration |
| Adding a backend command the page can call | Add a backend command the page calls |
| Adding, hiding or reordering community discovery links | Add or change a discovery site |
| Adding a selectable indoor or outdoor place | Add a place for friends |
| Adding a fish, a bug, a flower or a gift, a drawing or an effect, or changing the scenery | Add to the yard |
| Planning richer bundled-companion actions while preserving imported pet sheets | Companion action design |
| Reproducing seasonal, game, collection and audio review fixtures | Visual review |
| Setting up once: the updater key, the GitHub repository, secrets, the Homebrew tap, winget, signing accounts | Set up the repository, keys and store accounts |
| Store identity, MSIX submission preparation, Apple certificates and notarization | Prepare Microsoft Store and Apple signing |
| Releasing a new version and distribution channels | Release a new version |
| Changing the site (intro, user guide, version pages) | Edit and check the website |
| Changing the site address | Change the site address |
| Adding a language the app speaks | Add a language |
| Where to look first when stuck | Troubleshooting guide |
Read the standard for an area before you change it.
| Area | Standard |
|---|---|
| Page modules, styles | Standard: Page code structure |
| Backend concurrency | Standard: Backend locks and threads |
| Strings and translation | Standard: Multilingual strings |
| Draw loops, animation, overlay | Standard: Page and backend performance |
| Tests | Standard: Testing |
| Branches, commits, what never goes in, history | Standard: Commits, branches and history |
| Signing keys, tokens, certificates | Standard: Managing signing keys and secrets |
| Pet files | Standard: Pet file format |
| README, guides and the site's user guide | Standard: Writing docs |
Procedures for outages and incidents.
| Situation | Procedure |
|---|---|
| Updater signing key lost or leaked | The updater signing key is lost or leaked |
Deep dives and reference
Decision records: why the structure is the way it is. The standards cite them as their basis.
- Hold twelve of every kind in the yard
- Let the scene, not the date, call up the yard's moments
- Make the yard livelier on the current renderer before reaching for a game engine
- Write release notes for each reader, with one user page per version for every system
- Track the Linux GTK advisories without hiding them
- Keep releases compact and let GitHub define publication state
- Keep Linux publication gated on the stable Tauri GTK migration
- Keep source art and optimize accepted exports
- Consolidate the October design reports into topic records before the first publication
- "Real-app E2E runs a scenario script inside the app"
- "The backend is split into folders by role, and main.rs only wires things up"
- "Never wait on the main thread while holding the app state lock"
- "Page modules run nothing on import and do not import each other in cycles"
- "The version lives only in package.json, and a version tag creates a draft release"
- "Strings live in two per-language tables, one for the page and one for the backend, and agent status is sent as codes"
- "The page draws often only when something moves, and drawing loops run on timers"
- "GitHub releases are the source, auto-update, winget and a Homebrew tap point at those files, and code signing turns on with secrets"
- "Publish the introduction, user guide, per-version pages and developer docs as one VitePress site on GitHub Pages"
- "Pet pictures in chat (images that fit the moment) are on hold"
- "Lead with "a yard where your pets talk to each other", and treat Codex pet compatibility and hook reactions as the price of entry"
First public release
- Remaining publication steps: the first public release hand-off.
- Local checks and signed upgrade testing are separate gates.
Design records and research
Records are dated and never rewritten. When two disagree, the later one holds. The five records of 2026-10-11 and 2026-10-12 consolidate that period's design work (decision).
- Winter decorations (2026-11-21): the little Christmas tree redrawn in gold and cream, and ten more winter-lights gifts after Santa, with where a lit gift's light is.
- Lively friends (2026-11-19): a standing friend's idle rhythm, turning to look, and the small physics of a walk, a lift and a landing.
- Tree moments (2026-11-15): the friends who visit a red plum in bloom and the fruit a grown fruit tree drops for friends to pick up.
- Agent workspaces (2026-11-11): what a friend does for each coding-agent state in every place, and the garden workshop built around desks, an approval spot by the bell and a rest corner.
- The website (2026-10-12): four languages and their parity, the world-first landing, the companion gallery, the creator studio, release pages and captures.
- In-app creation studio proposal (2026-10-17): unimplemented, with a follow-up on the current web KIT and SKILL handoff. The maintained workflow is in Edit and check the website.
- A winter to share (2026-11-09): things to do with friends in winter, the snowman, decorating the Christmas tree and Christmas night.
- Flower viewing (2026-11-09): friends gathering under a blossoming tree in spring.
- Gifts from friends (2026-10-29): a gift follows what the person and a friend did together, not time passing.
- Discovery pockets and quiet updates (2026-10-19): short play actions near the yard and update checks that never steal focus.
- Quiet yard navigation and updates (2026-10-19): the dock's entry points, kept apart from friend management and preferences.
- Friend-led discovery and growing trees (2026-10-19): asking a friend to explore or garden without an AI, and the friend menu.
- Environmental discoveries and a calm collection pace (2026-10-19): where and when to dig, with no energy meter or streak.
- Calm collection information (2026-10-19): a readable album in place of spontaneous seed pickup.
- One hundred small discoveries (2026-10-19): the album's ordinary nature, seasonal colour and everyday objects.
- Replaceable backgrounds and four places (2026-10-13): background packs of your own and the built-in places they sit beside.
- Places: Woodland and Window studio (2026-10-11): the place registry, capabilities, floor geometry and fit, authored lighting, weather behind window panes and switching places. Follow-ups: four places, the garden workshop, and the sky-less room drawing removed.
- Companions and pet identity (2026-10-11): the historical companion catalog and compatibility contract. The current four-pet cast and accepted artwork: Companion artwork.
- Art direction and the art pipeline (2026-10-11): the sculpted cozy-game look, depth cues, raster layers and the procedural fallback, specimen art, accepting new art, the brand and where sources live.
- Product direction (2026-10-11): companions who talk to you and each other, claims kept precise, interface commitments and the bar for the first release.
- Stronger agent integration, community import, personality and activity memory: the design as of 2026-09-29. Some file paths have changed since.
- A yard that grows with you: the garden, gifts, fishing and bugs, the album and closeness, with their rules.
- A painted yard: how the backdrop is painted after hand-painted animation backgrounds.
- Where things live in the window: one place for each kind of thing, one name per switch.
- Yard sounds: the soundscape and its cues, made with Web Audio, and when they play.
- Yard content as data: the catalogue, the composition, the drawings and the effects, apart from the code that runs them.
- What do code signing and distribution channels cost for a desktop app, and in what order does PlayPets take them?: cost, units, identity checks, distribution channel requirements, and the order PlayPets takes. Kept up to date.
- How do open-source desktop apps lay out their public websites?: the case study behind the site's structure (2026-10-03).
Repository automation
| File | What it does |
|---|---|
.github/workflows/build.yml | build job: lint, test, build and E2E on five environments. site job: builds the site, so a dead link fails the PR. Runs for every PR, on main when the crates or this workflow change, and weekly |
.github/workflows/release.yml | Builds every environment from a version tag into a release draft |
.github/workflows/distribute.yml | winget manifest and Homebrew cask from a published release |
.github/workflows/pages.yml | Builds and publishes GitHub Pages when its source or shared inputs change on main |
.github/workflows/codeql.yml | CodeQL analysis of the workflows, JavaScript, Python and Rust on every PR, on main and weekly |
.github/workflows/security.yml | pnpm run security:check (redacted Git history, dependency audit, RustSec) on every PR, on main and weekly |
.github/workflows/store.yml | After a release is published: builds and certifies the Microsoft Store MSIX and sends a new submission, while STORE_SUBMISSION_ENABLED is true |
.github/workflows/store-retry.yml | By hand: sends a published release to Partner Center again with main's submission script |
.github/workflows/store-api.yml | By hand: tests the Store API script, then reads the product with the Store credentials after approval |
website/ | The VitePress site. Developer docs are copied from docs/ at build time |
packaging/ | Local distribution builds (macOS dmg; Linux and Windows through Docker) |
scripts/ | Icon generation, release, distribution file generation, CPU measurement, site preparation, screen capture, mascot pets |
Common commands
| Command | What it does |
|---|---|
pnpm test | Rust unit tests and page tests |
pnpm run check | Lint, unit tests and site build; run E2E separately |
pnpm run test:js / test:rust | Focused Node / Rust tests |
pnpm run build:app / start | Build the normal native executable / run that existing build |
pnpm run assets:audit | Check image dimensions and references; save an inventory under ignored scratch/asset-audit/ |
pnpm run lint / pnpm run format | Check / tidy code layout (rustfmt, clippy, Oxlint, Oxfmt) |
pnpm run test:e2e | Real-app E2E |
pnpm run measure | CPU measurement in five states (macOS, Linux) |
pnpm run site:dev / site:build | Site dev server / build (includes dead link check) |
pnpm run shots x.y.z | Real-app screenshots in every app language (macOS) |
pnpm run og | Redraw the four share cards (website/public/og.png in English, og-ko.png, og-ja.png, og-zh-hans.png) and the README banner |
pnpm run art | Redraw the installer art (list below) |
pnpm run dist:mac, dist:windows, dist:linux | Local distribution files (release/<platform>/) |
pnpm run release x.y.z | Release commit and tag |
pnpm run icons | Every icon from assets/icon.png |
What pnpm run art redraws:
- The macOS disk image background:
packaging/macos/dmg-background.png. - The Windows installer's sidebar and header:
packaging/windows/nsis-*.bmp. - The English screenshots Linux software centers show:
website/public/listing/en/, from the current captures. - Where each is used:
src-tauri/tauri.conf.json(bundle.macOS.dmg,bundle.windows.nsis,bundle.linux) andpackaging/linux/app.playpets.metainfo.xml.
Frequently asked questions
Can I change Windows code without checking it on Windows?
- Check that it compiles with
pnpm run dist:windows(Docker). - The CI Windows runner runs E2E.
- For behavior you only see at run time, such as how windows act, say in the PR description that it still needs checking.
Why does the page have no bundler?
- The browser reads the page's ES modules as they are.
- With no build step, the file you edit is the file that runs.
- Tests enforce the module rules instead.
- Full reasoning: the decision "Page modules run nothing on import…".
Do I need a signing key to develop?
- No. Tests, E2E and local distribution builds all run without keys.
- Keys are used only in CI when a maintainer releases.
How do I change a string?
- Page sentence: edit
src/core/strings/<language>.js. - Backend sentence: edit
src-tauri/src/i18n/<language>.rs. - Change every language together. The Korean file is the reference.
- Rules: the Multilingual strings standard.