> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getcliq.io/llms.txt
> Use this file to discover all available pages before exploring further.

# The hug folder and bundle

> What a hug's folder holds, what hug.json and definition.mjs contain, the bundle rules and the bundle hash.

Hugs › Reference

```text theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
review-batch/               the hug's name is the folder's name: lowercase letters, digits and -
  hug.ts                    the definition (define_hug)
  src/main.ts               the page (mount_hug) — or src/main.tsx (React)
  hug.test.ts               tests
  build.mjs                 the build — yours to change (keep hug_esbuild_plugins() from @getcliqio/hug-frontend/build)
  package.json              "build": "node build.mjs", "test": …
  tsconfig.json
  dist/                     the bundle — written by the build; the only part installed and published
    index.html              the page (hug.json's entry)
    assets/main.js          its script, every library compiled in
    definition.mjs          the definition, compiled for Node
    hug.json                what the hug is
```

## `hug.json`

Written by the build from the definition:

```json theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
{
  "name": "review-batch",
  "title": "Review a batch of documents",
  "description": "Asks a reviewer to look at a batch of a company’s documents …",
  "entry": "index.html",
  "sdk_version": "1.15.16",
  "definition": "definition.mjs",
  "params_schema": { "type": "object", "properties": { "company": { "type": "string" } } }
}
```

| | |
| - | - |
| `name`, `title`, `description` | From the definition — shown in lists, and told to models |
| `entry` | The page loaded in the frame |
| `sdk_version` | The `@getcliqio/hug-frontend` it was built with |
| `definition` | The compiled definition module |
| `params_schema` | The params as JSON Schema, for models |

## `definition.mjs`

The definition compiled for Node (it has only Zod in it). cliqd and the agents' SDK import it to check params and
answers when a Hug is asked by name, and LLM agents read its title, description and params schema.

## The rules

`cliq hug build` checks them, and CliqHub checks them again when the bundle is uploaded:

* **Text only.** Every file is UTF-8 text — HTML, JS, CSS, JSON, SVG, `.mjs`. Images and fonts are inlined as data
  URIs (the scaffolded build does it). No audio, video or WebAssembly.
* **Self-contained.** Every file it loads is in the bundle — no outside URLs (the sandbox blocks them anyway), no
  CDN, no import maps.
* **At most 5 MB and 200 files.**
* `hug.json` and `definition.mjs` present; `entry` exists.
* Data never goes in a bundle: it arrives as params and attachments.

## The hash

A bundle is named by `sha256` over a canonical listing of `dist/`: for each file, sorted by path,
`<path>\t<size>\t<sha256 of its bytes>\n`. Same files, same hash, on any machine. cliqd computes it when a Hug is
asked (cached until `dist/` changes); CliqHub recomputes it on upload and refuses a mismatch. No hash is written
anywhere by hand.

## Versions

The SDK follows semver; `hug.json` records the version a bundle was built with. The bridge protocol is versioned
separately, and CliqHub keeps every protocol a kept bundle needs, so an old Hug's page always runs.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.