Skip to content

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_HOME can change it).
    • Pets imported from an address or a ZIP file and copied into pets/ in the data folder.
    • Folders a person picks.
  • 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.json is a regular file inside the folder, 64KB or smaller.
  • id and displayName are non-empty strings.
  • spriteVersionNumber is 1 or 2. Missing means 1.
  • spritesheetPath points 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:
VersionWidthHeightRows
v11536px1872px9
v21536px2288px11
  • 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.

RowAnimationCells used
0Idle6
1, 2Walk right, walk left8
3Wave4
4Jump5
5Error8
6Waiting6
7Working6
8Done6
9, 10Gaze 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.json and embedded by src-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, autumn and winter.
    • 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.
  • realisticSpritesheets:
    • A legacy compatibility field, not a general appearance contract.
    • Recognizes default, summer and winter.
    • The alternate appearance is offered only when default is 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.
  • realisticPortraitPath applies 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 ​

  • actionsPath names 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 the petActions command, and played by src/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 }]
      }
    }
  }
}
FieldRule
FileAt most 256 KiB, inside the folder, version 1
outfitsbase (required), spring, summer, autumn, winter; a season plays its own outfit, else base
Clipsdig, plant, discover, cast, wait, reel, sit, stretch, walk-front, walk-back, run-right, run-left; other names are ignored
imagePNG or WebP inside the folder, at most 8 MiB and 4096×4096; at most 32 distinct images
canvasIntegers up to 384×416; missing means 192×208
anchorThe feet, inside the canvas
offsetWhere the canvas sits against the 192×208 cell; missing means [0, 0]; kept as written
frames1 to 64; rect is four integers, the canvas's size, inside the image; duration 1 to 10000 ms
tipEvery cast, wait and reel frame: the rod tip, inside the canvas
grounddig and plant only: where the tool meets the ground, inside the canvas
contactAt, tossAt, commitAtOptional ms within the clip; toss and commit never before contact
loopOptional boolean
stridewalk-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, wait and reel stay or go together.
  • sit and stretch are optional: outdoors an idle friend sits or stretches only with them, and strolls instead without them.
  • walk-front and walk-back are the walks toward and away from the viewer, run-right and run-left a 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.json and 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 description and kind. A new friend's starting personality becomes description (kind).
  • For imported pets, record the site, address, creator and license in source. The Invite tab shows them on the card.

Exceptions ​

WhenHow
Pets from a community site with a different formatNot 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 changesAccept 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 ​

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: hasActions only with valid poses, and ?action=n serving only validated images.
  • Rust pets::importer::tests: per-site address parsing and the saved result. Real site responses are checked with pnpm 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)

Free and open source under the MIT license. Not affiliated with OpenAI; ChatGPT and Codex are trademarks of OpenAI.