Standard: Pet file format
Applies to
- Every pet file PlayPets reads:
- The starter pets bundled with the app: packed into the executable and unpacked into
builtin/in the data folder.assets/pets/is the source. - The Codex pet folder (
~/.codex/pets;CODEX_HOMEcan change it). - Pets imported from an address or a ZIP file and copied into
pets/in the data folder. - Folders a person picks.
- The starter pets bundled with the app: packed into the executable and unpacked into
- The required baseline follows the Codex pet format.
- Optional PlayPets artwork fields are described below; other hosts may ignore them.
- Not covered: the source web pages and per-site JSON during import.
pets/importer/turns those into pet folders, and the saved result follows this format.
Rules
A pet is one folder containing pet.json and a sprite sheet.
json
{
"id": "white",
"displayName": "White",
"kind": "animal",
"description": "A puppy.",
"spriteVersionNumber": 2,
"spritesheetPath": "spritesheet.webp",
"source": { "name": "Awesome Codex Pet", "url": "https://…", "creator": "lingxiaotian", "license": "CC BY-NC 4.0" }
}pet.jsonis a regular file inside the folder, 64KB or smaller.idanddisplayNameare non-empty strings.spriteVersionNumberis1or2. Missing means1.spritesheetPathpoints inside the folder. A path that points outside through a symbolic link or..is rejected.- The sprite sheet is a regular PNG or WebP file, 32MB or smaller.
- Sheet size:
| Version | Width | Height | Rows |
|---|---|---|---|
| v1 | 1536px | 1872px | 9 |
| v2 | 1536px | 2288px | 11 |
- One cell is 192×208px; a row has 8 cells.
The animation in each row. src/core/animation.js is the source for how many cells each row uses and how long each cell lasts.
| Row | Animation | Cells used |
|---|---|---|
| 0 | Idle | 6 |
| 1, 2 | Walk right, walk left | 8 |
| 3 | Wave | 4 |
| 4 | Jump | 5 |
| 5 | Error | 8 |
| 6 | Waiting | 6 |
| 7 | Working | 6 |
| 8 | Done | 6 |
| 9, 10 | Gaze in 16 directions (v2 only) | 8 |
- Rows 1 and 2 are not played by their durations: a walk shows the cell its legs have reached over the ground covered (
src/core/gait.js).- The app reads where the cycle's feet are widest (contact) and closest (passing) from the cells themselves, and the stride from how far apart they reach; a row whose feet hardly change keeps the drawn order.
- A row whose figure does not rise and fall by itself is lifted a little in time with the steps.
- Draw the eight cells as one cycle: contact, down, passing, up, then the same with the other leg.
Pet identity value
- A pet's identity value is the first 24 characters of its folder path's SHA-256.
- Friends refer to pets by this value.
- If a pet folder moves, its existing friends are parked at the next start.
- Parked friends keep their saved records and closeness.
- Moving the folder back to its original path makes them available again.
- This calculation is tied to saved state and does not change.
- Built-in Aria and Noah entries also have an explicit migration for legacy assets and styles.
- That migration does not merge independently invited friends.
Identity and optional artwork
Pets and friends
- A drawing style is not a pet type.
- An ordinary baseline sheet may be pixel art, paper, plush, sculpted or realistic.
- The four bundled pets, Daisy, Clover, Pip and Miso, are defined by
assets/pets/{daisy,clover,pip,miso}/pet.jsonand embedded bysrc-tauri/src/pets/builtin.rs. - Each invitation creates an independent friend, even when the same pet is invited again.
- Names, relationships, personality and closeness belong to that friend.
- Conversations belong to the current app session and are not written to saved state.
- Restarting or migrating saved assets does not restore chat logs.
- Every pet works in the yard at every size and on the desktop.
Optional fields
The reader accepts these optional PlayPets fields; an ordinary import does not need them:
json
{
"portraitPath": "portrait.png",
"seasonalSpritesheets": {
"summer": "seasonal/summer.png",
"winter": "seasonal/winter.png"
},
"realisticSpritesheets": {
"default": "alternate/spritesheet.png",
"summer": "alternate/summer.png",
"winter": "alternate/winter.png"
},
"realisticPortraitPath": "alternate/portrait.png",
"actionsPath": "actions.json"
}seasonalSpritesheets:- Recognizes
spring,summer,autumnandwinter. - The official creator workflow defaults to three complete outfits: a base shared by spring and autumn, plus summer and winter atlases.
- Each outfit contains all nine animation states and sixteen gaze directions.
- Separate spring or autumn outfits are optional extensions.
- The format still supports all four seasons.
- Each sheet has the baseline's version and dimensions.
- Missing or invalid entries fall back to the baseline; the pet stays available.
- Recognizes
realisticSpritesheets:- A legacy compatibility field, not a general appearance contract.
- Recognizes
default,summerandwinter. - The alternate appearance is offered only when
defaultis valid. - A missing seasonal sheet falls back to that appearance's default.
- Friend settings offer this control only for a pet with a usable alternate baseline.
portraitPath:- An optional baseline PNG/WebP chat portrait, at most 8 MiB, each dimension from 1 to 4096 pixels.
- An ordinary pet needs no portrait.
realisticPortraitPathapplies the same validation to a legacy alternate portrait.actionsPath: the pet's own game poses; see Game poses.- Optional paths stay relative and inside the pet folder, with the same file and symlink checks as the baseline.
- Invalid optional material is ignored.
- Serving a sprite checks its files again, because they can change after scanning.
Game poses
actionsPathnames a JSON file of drawings for four yard games: digging, planting, showing a find and fishing.- A pet without it, or with an invalid file, plays its ordinary rows in those games; nothing else about it changes.
- Read by
pets/actions.rs, served by thepetActionscommand, and played bysrc/core/companion-actions.js. - The four bundled pets ship theirs in this format; the creator kit makes them (
pack-pet --actions). - Design: Game poses for every pet.
json
{
"version": 1,
"outfits": {
"base": {
"dig": {
"image": "actions/base/dig.png",
"canvas": [224, 224],
"anchor": [96, 199],
"ground": [150, 199],
"contactAt": 560,
"tossAt": 1280,
"frames": [{ "rect": [0, 0, 224, 224], "duration": 280 }]
}
}
}
}| Field | Rule |
|---|---|
| File | At most 256 KiB, inside the folder, version 1 |
outfits | base (required), spring, summer, autumn, winter; a season plays its own outfit, else base |
| Clips | dig, plant, discover, cast, wait, reel, sit, stretch, walk-front, walk-back, run-right, run-left; other names are ignored |
image | PNG or WebP inside the folder, at most 8 MiB and 4096×4096; at most 32 distinct images |
canvas | Integers up to 384×416; missing means 192×208 |
anchor | The feet, inside the canvas |
offset | Where the canvas sits against the 192×208 cell; missing means [0, 0]; kept as written |
frames | 1 to 64; rect is four integers, the canvas's size, inside the image; duration 1 to 10000 ms |
tip | Every cast, wait and reel frame: the rod tip, inside the canvas |
ground | dig and plant only: where the tool meets the ground, inside the canvas |
contactAt, tossAt, commitAt | Optional ms within the clip; toss and commit never before contact |
loop | Optional boolean |
stride | walk-front, walk-back, run-right and run-left only, optional: the ground one cycle covers, in body lengths, 0.5 to 1.2 |
- A clip that breaks a rule is left out;
cast,waitandreelstay or go together. sitandstretchare optional: outdoors an idle friend sits or stretches only with them, and strolls instead without them.walk-frontandwalk-backare the walks toward and away from the viewer,run-rightandrun-lefta game's run. Each is one cycle of exactly eight frames, stepped by the distance walked (src/core/gait.js), not by its durations; a clip with another count is not played.- Without both walks, a friend strolls only within 35° of across, where its side walk looks right.
- Without a run, a game's run plays the side walk faster.
- Design: Natural walking.
- An outfit with no clip left is left out; without
base, the pet has no poses. - The app does not tie a season's poses to a seasonal sheet: draw a season's poses only with that season's sheet, or the friend digs in clothes it does not walk in. The creator kit refuses them without
--season. - The file is read again when the page asks for it, and each image again when served.
- It holds no text a person reads or an AI sees.
- The realistic appearance and the desktop overlay play no poses.
Appearances
- Switching to a supported alternate appearance keeps the same friend and its chat from the current session.
- Importing a different pet folder adds another asset.
- It does not replace an existing friend's look.
- The runtime currently has nine action states and, in v2, sixteen gaze directions.
- Extra design poses do not add runtime states; game poses play only in the four games above.
- Appearance IDs that creators name freely are still a proposal in the companions design.
Portable downloads
- Provide
pet.jsonand its canonical baseline sheet as an independent package. - PlayPets wardrobes, portraits and game poses do not make a pet work in another host.
- For generated materials, keep the source attribution, source images, prompts and packing metadata.
- Detailed turnaround and face references are design sources, not playable sheets.
Recommendations
Follow these when you can. When you cannot, say why in the PR.
- Include
descriptionandkind. A new friend's starting personality becomesdescription (kind). - For imported pets, record the site, address, creator and license in
source. The Invite tab shows them on the card.
Exceptions
| When | How |
|---|---|
| Pets from a community site with a different format | Not imported. The discovery registry in src/content/communities.json can list a browse-only site; importer/sites.rs derives importable from the trusted adapter ID and address. A discovery link does not add an importer or change the generic importer’s security checks |
| The Codex pet format changes | Accept it in a PR that adds a new version number. The SHEET_VERSIONS table in pets/catalog.rs is the single source for versions and row counts (reading and importing both use it). If the meaning of a row changes, also update src/core/animation.js and this document |
Rationale
- The same format as Codex pets means existing community pets work unchanged.
- The app opens files other people made, so it rejects large files and paths that point outside the folder.
- Based on: design record “Stronger agent integration, community import, personality and activity memory”
Automated checks
- Rust
pets::catalog::tests: size per version, rejecting paths outside the folder, required fields, reading the size from the file header alone, and source information. - Rust
pets::actions::tests: each rule of the game poses file, the fishing clips kept together, paths outside the folder, and a broken file leaving the pet usable. - Rust
app::sprite::tests:hasActionsonly with valid poses, and?action=nserving only validated images. - Rust
pets::importer::tests: per-site address parsing and the saved result. Real site responses are checked withpnpm run test:live-import.
Change history
- 2026-10-01 First version
- 2026-10-11 Document optional wardrobes, legacy appearances, separate named pets and parked identities
- 2026-11-23 Add optional game poses (
actionsPath)