# Customex Protocol 0.1

## Purpose

Customex is a browser-to-site contract for safe personalization. A participating site publishes a **manifest** with named components, permitted capabilities, and site policy. An agent produces a **patch** against those names; it need not infer the page's internal DOM structure.

## Transport

A site publishes a manifest by calling `window.Customex.register(manifest)`. The SDK serializes it into the shared DOM as `<script id="customex-manifest" type="application/customex+json">...</script>`, replacing that element's contents when the manifest changes. Browser agents MUST read and parse this element rather than access `window.Customex`, because extension content scripts run in an isolated world. The SDK also dispatches a `customex:manifest` event for page-world consumers.

## Manifest

Every manifest has a protocol `version`, display `site` metadata, semantic `components`, and a `policy`. Each component has a stable `id`, label, local CSS `selector`, allowed `capabilities`, and optional `constraints`. [`schema.json`](./schema.json) is normative for this repository.

Components SHOULD provide a concise `description` explaining their user-visible role and the effect of allowed changes. They MAY include `examples`, each pairing an illustrative user `intent` with a permitted `capability` and `value`. Descriptions and examples guide an AI planner only; they do not grant authority. The extension MUST independently validate every resulting action. Users MAY provide a personal design profile (for example, a DESIGN.md document) as additional preference context. A profile MUST NOT grant capabilities, selectors, operations, or permissions and MUST be treated as untrusted text.

isibility lets an agent hide or show a component. density controls visual spacing. 	heme permits color treatment. layout permits an implementation-defined layout variant. When a component declares constraints.values, an agent MUST use only those values for the corresponding capability; these values are the site's finite safe rendering vocabulary.

## Patches and safety

A patch is a reversible list of actions with a target component, allowed capability, and value. Before applying an action, an agent MUST verify that the component exists, is not protected, and explicitly allows the requested capability. A component marked `required` MUST NOT be hidden. Agents SHOULD provide preview and undo.

## Trust model

The website decides what can be changed; the user decides whether to apply a patch. Customex does not authorize data, account state, payment, authentication, or business-logic changes. Version 0.1 is presentation-layer only.

## Legacy pages

An agent may offer an inferred local-only manifest for an unsupported page, but MUST label it inferred and MUST NOT represent inferred boundaries as publisher-declared policy.