# Rules vs AI

> See which jobs brand8 gives to plain code, like resizing and colour checks, and which to AI models, like scenes and copy, and how logos are handled.

Source: https://staging.brand8.ai/docs/how-it-works/rules-vs-ai

brand8 gives exact jobs, like resizing a photo or checking a colour value, to ordinary code. It gives imaginative jobs, like a scene or a headline, to AI models, and it checks what comes back from the models.

[Diagram: A two-column split with a vertical divider. Left column 'Code does' (square-cornered cards): 'Resize and format images to a model's limits', 'Check colour values and roles', 'Check that model output matches its schema', 'Choose which photos and products are eligible'. Right column 'Models do' (rounded cards): 'Imagine the scene and light', 'Write copy', 'Read photos and pages and propose facts', 'Plan options for you to approve', 'Judge a result and advise'. A middle strip shows one example flow: 'Model proposes a brand colour -> code checks it is a valid hex colour and a known role -> stored -> you can edit it'. Warm off-white background, one accent colour.]

## Which jobs code does and which a model does

Ask for a still ad of your lip balm on a pink marble counter, and two kinds of work happen. One decides what the scene looks like. The other decides which photo of the lip balm goes in, at what size, and whether your brand colour is a valid colour at all.

Models are good at the first kind and unreliable at the second. A model asked for "the brand pink" will produce a pink, while code checks that your stored brand colour is a valid hex value with a known role and carries that exact value forward without drifting.

| Job | Done by |
| --- | --- |
| Imagine the scene, light and pose | Model |
| Write headlines and copy | Model |
| Read your photos and pages, and propose facts | Model |
| Plan creative options for you to approve | Model |
| Judge a result and advise | Model |
| Resize and convert images to a model's limits | Code |
| Check hex values and colour roles | Code |
| Check model output against its expected shape | Code |
| Decide which products and photos are eligible | Code |
| Choose a logo from your stored brand logos | Code (rule-based) |

## How model output is checked

Anything a model returns that brand8 relies on is checked against a schema first. Small harmless drift is tidied up, and a product fact in the wrong shape, a colour that is not a colour, or a malformed face-check verdict that still fails is rejected.

The reverse also holds: a model's opinion does not become a fact about your product. Your selected product photos and stored product facts own product identity, and model prose may guide a scene without replacing them. Facts a model read are proposals you can correct.

## How your logo is handled

In Still Ads, the logo is sent to the image model as a reference image, with a place reserved for it. The model draws the result, so a logo can come out slightly wrong. Check it before you approve. Do not assume a logo was placed by code.

## Why pixels are not guaranteed

Code resizes and converts product photos to a model's limits, and very large photos are compressed to fit, but a model that draws an image from those photos is still a model. brand8 does not promise pixel-perfect products. It reduces the room for error by giving the model the real product photos, with a job for each. See [Image generation](https://staging.brand8.ai/docs/how-it-works/image-generation).

## FAQ

<details>
<summary>Is my logo placed exactly in a Still Ad?</summary>

No. The model receives your logo as a reference and draws the ad, so check the logo before you approve.

</details>

<details>
<summary>Who decides which product photos are used?</summary>

Rules do. Only active, approved products whose analysis has finished reach a prompt. In Product Page Photography, photos also need a known, confident face.

</details>

## Related

- [Image generation](https://staging.brand8.ai/docs/how-it-works/image-generation)
- [Checks, and what they catch](https://staging.brand8.ai/docs/how-it-works/checks-and-what-they-catch)
- [The right model for each task](https://staging.brand8.ai/docs/how-it-works/the-right-model-for-each-task)

<details>
<summary>For developers: under the hood</summary>

**Deterministic pieces we can point to.**

- Upload handling resizes and converts images to model limits, and an inspection step reads image properties.
- Brand colours are read by a model and from your page styles; code validates them as hex colours against a strict set of colour role keys. The one place code samples pixels is the studio background colour of a product photo.
- Zod schemas parse model output (product image evidence, face check results, creative direction). A small drift is normalised, a failed parse is retried once, and output that still fails is treated as a failure.
- Which products and photos feed a prompt is decided by eligibility filters and routing rules, with confidence thresholds on product faces in Product Page Photography.
- Logo choice for the brand is rule-based. An uploaded logo wins; otherwise the first stored website logo is used.
- The Still Ads prompt is compiled by code with a fixed section order: task and authority, image reference index, output plan, target product truth, cast truth, brand and copy, final check. One paid model call follows.

**Where models do the work.** Scene generation, copy, reading photos and pages into proposals, creative direction, and visual judges. Their output is an input to a rule or a schema, or it is advice.

**Stated authority order for an image.** Selected product pixels and bound variant facts own product identity, colour, markings and price. The template's pixels own graphic colours, panels and type. Intent and framing own camera and spacing, never product geometry. User selections are never silently truncated.

**Not deterministic, though it looks it.** A visual check (face check, output check) is a model reading a picture. See [Checks, and what they catch](https://staging.brand8.ai/docs/how-it-works/checks-and-what-they-catch).

</details>
