# Yumina Pack Spec A Yumina resource pack (bundle) is one JSON file, `name.bundle.json`, that installs one system (entries, variables, behaviors, audio, an interface) into any card. Its entries, variables, behaviors and interface code use the same objects as a world: see the Yumina World Spec (https://docs.yumina.io/world-spec/download) for their full shapes. Import a finished file on Library → Bundles → Import Bundle. # Pack File: Fields A pack is one JSON object, saved as `name.bundle.json`. Yumina calls the type `YuminaBundle`. ## Top-Level Structure ```json { "bundleVersion": "3.0.0", "name": "Mood Meter", "description": "What the pack does, for people browsing the market", "tags": ["interface", "relationship"], "createdAt": "2026-11-30T00:00:00.000Z", "entries": [], "variables": [], "rules": [], "reactions": [], "audioTracks": [], "worldbooks": [], "entryFolders": [], "customTags": [], "rootComponent": null, "settings": [] } ``` ## The Seven Fields a File Must Have A file is read as a pack only when all seven are there, with these types. Empty arrays are fine. | Field | Type | Notes | |-------|------|-------| | `bundleVersion` | string | Write `"3.0.0"` | | `name` | string | 1 to 100 characters. Also names the interface folder on install | | `createdAt` | string | Any ISO date, e.g. `"2026-11-30T00:00:00.000Z"` | | `tags` | string[] | Up to 10 are kept | | `entries` | array | Can be `[]` | | `variables` | array | Can be `[]` | | `rules` | array | Can be `[]`. Write `[]` even when the behaviors are in `reactions` | ::: warning Missing a field Studio's **⋮ → Import Bundle → From File** reads a file that lacks any of the seven as a whole card, and loads it in place of the card you have open (the card is renamed after the pack and its own entries disappear). Check the seven fields before importing there, or import on **Library → Bundles** first, which only adds a pack to your library. ::: ## Field Reference | Field | Type | Description | |-------|------|-------------| | `description` | string | Shown on the pack's page and in the install dialog. Up to 3,000 characters | | `entries` | WorldEntry[] | Lore, rules for the AI, character sheets, openings. Same shape as a world's [entries](/world-spec/entries) | | `variables` | Variable[] | The state the pack keeps. Same shape as a world's [variables](/world-spec/variables) | | `reactions` | Reaction[] | Behaviors, the current form. See [Rules & Reactions](/world-spec/rules) | | `rules` | Rule[] | Behaviors, the older form. Use `reactions` for a new pack | | `audioTracks` | AudioTrack[] | Music and sounds. Same shape as a world's [audio](/world-spec/audio). Each track gets a new id on install, and references to the old id are not rewritten | | `worldbooks` | Worldbook[] | Situations the pack's entries belong to. Optional | | `entryFolders` | EntryFolder[] | Folders the pack's entries sit in. Optional | | `customTags` | string[] | Entry tags the pack uses. Optional | | `rootComponent` | RootComponent | The pack's interface code. Optional; leave it out for a pack with no screen | | `settings` | BundleSettingField[] | A form the installer fills in (a name, a voice, a picture). Optional | | `version` | number | Set by Yumina when a version is published. Leave it out; a file's value is ignored | Put each behavior in `reactions` or in `rules`, never both: a behavior in both arrays fires twice. ## Ids Inside a Pack Inside the file, parts point at each other by id, the same way they do in a world: a behavior's condition names a variable id, a `toggle-entry` names an entry id, an entry's `folderId` names a folder. Pick any unique strings. Yumina rewrites them on install (see [Installing into a card](/pack-spec/installing)), so they never clash with the card's own. Variable ids are the exception: they are kept as written unless the card already has a variable with the same name. Use `snake_case` ids, so entries can read them as `{{mood}}` macros. ## The Interface (`rootComponent`) ```json "rootComponent": { "id": "mood-meter-ui", "name": "Mood Meter", "entryFile": "index.tsx", "files": { "index.tsx": "export default function MoodMeter() { ... }", "bar.tsx": "export default function Bar({ value }) { ... }" }, "updatedAt": "2026-11-30T00:00:00.000Z" } ``` The files are React/TSX and run in the same sandbox as a card's own interface, with the same `useYumina()` API. See [Custom UI](/world-spec/custom-ui). The entry file's default export is what gets drawn. Files can import each other with relative paths (`./bar`); they are copied into one folder together. A pack's interface is drawn in one of three ways: | Form | How to write it | What the player sees | |------|-----------------|---------------------| | **Overlay** (default) | Default export only | Drawn on top of the card's own screen. Use `position: "fixed"`, keep it small, and leave the chat usable | | **App** | Also `export const app = { id, icon, name, variable, accent }` | A button in the shared App dock on the right. The default export is drawn in the App panel and gets a `close` prop | | **Whole screen** | Draw the full screen yourself, e.g. with `` | Used when the installer picks **Replace the current screen** | `app` fields: `id` (unique, one dock button per id), `icon` (an emoji), `name`, `variable` (the variable id the App shows; the dock marks the button when it changes), `accent` and optional `accent2` (colors), optional `badge(value)` returning a number to show on the button. Read state as `api.variables.` or `api.variables[""]`. When the installer keeps the pack's variable under another id, Yumina rewrites both forms in the pack's files, along with any string literal that is exactly the old id. Choose variable ids that do not also appear in the code as plain text. ## Settings Form (`settings`) A list of fields the installer fills in right after installing, or later from the pack's frame on the canvas. Each value is written into a variable's `defaultValue`. Studio's pack maker has no editor for this form: write it in the file. ```json "settings": [ { "id": "char-name", "label": "Character name", "type": "text", "variableId": "companion", "path": "name" }, { "id": "char-voice", "label": "Voice", "type": "voice", "variableId": "companion", "path": "voice.id" } ] ``` | Field | Description | |-------|-------------| | `id`, `label`, `hint` | The field's id, its label and a short hint | | `type` | `text`, `textarea`, `number`, `toggle`, `select`, `asset`, `voice`, `liveCharacter` | | `variableId` | The variable that receives the value | | `path` | Dot path inside a `json` variable, e.g. `voice.id`. Leave it out to replace the whole value | | `options` | For `select`: `[{ "value": "...", "label": "..." }]` | | `accept`, `extensionRules` | For `asset`: which files the picker accepts, and extra values to write per file extension | | `also` | Other `{ path, value }` pairs written with a `voice` or `liveCharacter` pick | ## Pictures and Sounds Point at a file as `@asset:`, where the id is a file in your own **Library → Assets**. The easiest way to get these links right is to place the pictures in a card first (Studio writes the `@asset:` links for you) and make the pack from that card. When someone installs your pack from the market or their library, Yumina copies every file the pack points at into their own assets and rewrites the links, so your later edits or deletions never break their card. A file from someone else's library cannot be used this way. ## What a Pack Cannot Carry A pack has no card settings (model, temperature, context size), cover, scene images, reply processing rules, 3D scenes or Player interface builder layout. To share a whole card, export or publish the card instead. --- # Installing a Pack into a Card Installing adds the pack's parts to the card. It never overwrites the card's own entries, variables, behaviors or interface. Write a pack with these rules in mind. ## Where to Install From | Where | What it records | |-------|-----------------| | **Resource market** button in the canvas toolbar (next to **Add**), tabs **Hub** and **My Library**: press **Install** on a pack. Folded into the canvas, the same list lets you drag a pack onto the board, the player's screen or a situation | The pack it came from: its pictures are copied, and the card is offered new versions | | **⋮ → Import Bundle**, tabs **From File**, **From Library**, **From Hub** | The content only: no picture copies, no update offers | Use the Resource market for anything you or others will keep updating. ## The Install Dialog Before anything goes in, the installer sees what the pack brings and chooses: - **What goes in**: lore (entries), behaviors and audio can each be left out. The pack's variables always come along, since the other parts use them. - **Variables with the same name**: see below. - **Visual layer**, when the pack has an interface: **Keep both screens**, **Replace the current screen**, or **Leave its screen out**. - **Have the assistant fit it to this card**, for interface packs: the assistant rewrites hard-coded names and text for this card, using the installer's credits. Off means the pack goes in exactly as written. - **Settings**, when the pack has a [settings form](/pack-spec/format#settings-form-settings): a second step, which can also be done later. ## What Happens to Each Part | Part | On install | |------|-----------| | Entries | New ids. Placed at the top of the card's lists. Openings (`role: "greeting"`) become extra openings of the card | | Variables | Keep their ids, unless the card has one with the same name (see below). An id the card already has is shared, not added twice | | Behaviors | New ids. Every variable, entry, behavior and situation they point at is rewritten to the installed ids. Placed after the card's own | | Situations | New ids. Their activation conditions follow the variable ids | | Entry folders | New ids, in the situation their entries are in | | Audio tracks | New ids. References to a track's old id (in behaviors, entries or code) are not rewritten | | Interface | Copied into its own folder; see below | | Pictures (`@asset:`) | Copied into the installer's assets and relinked (Resource market installs only) | Everything installed is colored with the pack's color in Studio and grouped in a frame named after the pack. ### Variables with the Same Name When the card already has a variable whose name matches one of the pack's (ignoring case) under another id, the installer picks per variable: - **Merge into one**: the pack uses the card's variable. The pack's behaviors, entries and interface code are pointed at the card's id. - **Keep both**: the pack's variable is added under a new id and a new name (`Mood (1)` by default), and the pack's parts point at that. When the ids match too, the variable is shared without asking. ### The Interface Folder The pack's files go into `_bundles//` in the card's interface. The folder name comes from the pack's name: lower case, every run of characters other than `a-z` and `0-9` becomes `-`, at most 32 characters, `bundle` when nothing is left (a name with no Latin letters), and `-2`, `-3` added when the folder is taken. The pack's entry file is renamed `index.tsx` inside it. On the first install with an interface, the card's own entry file moves to `__user-root.tsx`, and `index.tsx` becomes a generated file that draws the card's screen with every installed pack on top. Do not edit the generated `index.tsx`; Yumina writes it again on each install and removal. - **Keep both screens**: the pack is an overlay, or a button in the App dock when it exports `app`. - **Replace the current screen**: the pack's default export becomes the whole screen. The card's own interface stays as a file, unused, and comes back when the pack is removed. - **Leave its screen out**: no files are copied. ### Into a Situation Dropping a pack onto a situation on the canvas installs it there: its entries and behaviors that had no situation of their own belong to that situation. Its variables stay the card's. ## Removing a Pack The trash icon on the pack's frame takes out exactly what the install added: entries, variables, behaviors, audio tracks, folders, situations and the interface folder. A screen it replaced comes back. When the installer has edited the pack's parts since, Yumina warns first. ## New Versions When the author publishes a new version, cards that installed the pack from the Resource market show an update button on its frame. Updating swaps in the new version under the same install, then puts back whatever the installer had changed in the old one (unless they choose the author's). Values from the settings form are always kept. --- # Example: Mood Meter The smallest pack that uses every common part. It adds: - a variable `mood` (0 to 100, starts at 50) that the AI raises and lowers, - an entry that tells the AI what the number means, - a behavior that adds 10 when the player presses **Cheer up**, - an interface: a meter in the top right corner of the screen, with the button. Download mood-meter.bundle.json ## The File ```json { "bundleVersion": "3.0.0", "name": "Mood Meter", "description": "A small meter in the corner that shows how the main character feels about the player. The AI moves it as the story goes, and the player can press Cheer up.", "tags": ["interface", "relationship"], "createdAt": "2026-11-30T00:00:00.000Z", "entries": [ { "id": "mood-guide", "name": "Mood meter guide", "content": "The main character's mood toward {{user}} is {{mood}} out of 100. 0 to 29: cold and short. 30 to 69: ordinary. 70 to 100: warm and open. Let it shape how they speak.", "role": "system", "section": "system-presets", "position": 0, "enabled": true, "alwaysSend": true, "keywords": [], "conditions": [], "conditionLogic": "all" } ], "variables": [ { "id": "mood", "name": "Mood", "type": "number", "defaultValue": 50, "min": 0, "max": 100, "description": "How the main character feels about the player", "behaviorRules": "Raise by 3 to 10 when the player is kind, funny or helpful. Lower by 3 to 10 when the player is rude or cold. At most 10 per turn." } ], "rules": [], "reactions": [ { "id": "cheer-up", "name": "Cheer up button", "when": { "eventType": "action:fired", "match": { "actionId": { "operator": "eq", "value": "cheer_up" } } }, "conditions": [], "conditionLogic": "all", "then": [{ "type": "set", "path": "mood", "operation": "add", "value": 10 }], "priority": 0, "enabled": true } ], "audioTracks": [], "rootComponent": { "id": "mood-meter-ui", "name": "Mood Meter", "entryFile": "index.tsx", "files": { "index.tsx": "export default function MoodMeter() {\n const api = useYumina();\n const mood = Number(api.variables.mood ?? 50);\n const color = mood < 30 ? \"#6b8cff\" : mood < 70 ? \"#e0b44c\" : \"#ff6b8a\";\n return (\n
\n
\n Mood\n {mood}\n
\n
\n
\n
\n \n
\n );\n}\n" }, "updatedAt": "2026-11-30T00:00:00.000Z" } } ``` The interface code, unescaped: ```tsx export default function MoodMeter() { const api = useYumina(); const mood = Number(api.variables.mood ?? 50); const color = mood < 30 ? "#6b8cff" : mood < 70 ? "#e0b44c" : "#ff6b8a"; return (
Mood {mood}
); } ``` ## How the Parts Connect - The interface reads `api.variables.mood` and redraws whenever it changes. - The button calls `api.executeAction("cheer_up")`. That fires an `action:fired` event with `actionId: "cheer_up"`, which the behavior's `when` matches. The behavior adds 10 to `mood`; `max: 100` keeps it in range. - The AI sees the variable with its `behaviorRules`, and changes it in a reply with a directive such as `[mood: +5]`. See [Variables & Directives](/world-spec/variables). - The entry reads the current value through the `{{mood}}` macro, so the AI knows what the number means for this turn. ## Try It 1. Download the file and import it on **Library → Bundles → Import Bundle**. 2. Open any card in Studio, press **Resource market** next to **Add**, open **My Library** and press **Install** on Mood Meter. 3. In the dialog, leave **Keep both screens** selected and untick **Have the assistant fit it to this card**, then press **Import**. 4. Press **Play**. The meter shows 50 in the top right corner. Press **Cheer up** and it shows 60; the playtest panel lists the change as "The player pressed a button". ## Make It Your Own Ask your AI to change it, with the [single-file spec](/pack-spec/download) in context. Some directions: - Track one value per character: make `mood` a `json` variable keyed by character id, and draw one bar each. - Turn it into an App: add `export const app = { id: "mood", icon: "💗", name: "Mood", variable: "mood", accent: "#ff6b8a" }` and lay the default export out for a side panel instead of a corner. - Limit the button: add `"cooldownTurns": 3` to the behavior. --- # Import, Publish, Update ## Get the File into Yumina **Library → Bundles → Import Bundle**, then pick the `.bundle.json`. The pack is saved to your library as a private pack. Nothing else changes, so this is the safe first step for a file your AI wrote. From there you can install it into any of your cards (see [Installing into a card](/pack-spec/installing)), edit its page, or publish it. Two other places also take a file, and install it straight into the open card without saving a pack: - **Resource market → Import from file** in Studio. A file that turns out to be a whole card asks before replacing the open card. - **⋮ → Import Bundle → From File** in Studio. A file that is not a complete pack replaces the open card without asking (see [the seven fields](/pack-spec/format#the-seven-fields-a-file-must-have)). ## Or Make It from a Card In Studio, **⋮ → Save as template or pack** (also at the top of the Resource market). Tick the entries, variables and behaviors to take; the variables a ticked behavior uses are marked "suggested". Tick **Visual layer** to take the card's own interface (other packs installed in the card stay behind). Audio tracks always come along. Then save as a new pack or as the next version of one you already have. This is the way to build a pack with pictures, and the easiest way to test it: the card is your test bench. ## The Pack's Page **Library → Bundles**, then the pencil on the pack, opens **Edit Bundle**: | Setting | What it does | |---------|--------------| | Cover, name, description, tags | What people see in the market. Name, description and tags change at once; a new cover on a live pack is reviewed like content | | Type | **Module**: goes into an existing card. **Template**: a whole card to start from (its interface, opening and characters) | | Demo card | One of your published cards that uses the pack, shown on its page | | Private / Public | Public lists it in the Resource Market | | Contents → Made from | The card or the file the next version comes from, with **Update** or **Upload** | **Export** on the pack's tile downloads its current content as `.bundle.json`. Give that file to your AI to change, and upload the result as the next version. ## Publish Set the pack to **Public** on its page, or press **Publish** on its tile in the Resource market's **My Library**. A new creator's first publish waits for review; a trusted creator's goes live at once. Once live, the pack is version 1 and anyone can find it under **Hub** in the Resource market. ## Ship a New Version On the pack's page, under **Contents → Made from**: - **A bundle file (.json) → Upload**: pick the next version of the file. A file without a `settings` form keeps the pack's current one. - **A card → Update**: takes the same parts from the card as they are now, and offers what the card has that the pack does not. Yumina shows what changed (new, changed, removed, interface, audio) and you add a short note. Publishing makes it version 2, 3 and so on. For a public pack, a new creator's update waits for review while the current version stays live. Cards that installed the pack from the Resource market get an update button on the pack's frame. Updating keeps what each installer changed in their copy and the values they set in the settings form.