# Start here: author an EasyCatalog Composition Plan

You are authoring a JSON layout for EasyCatalog in Adobe InDesign. A composition
plan selects data and places existing formatting-rule assets into layout areas.
A formatting rule is a reusable InDesign design, not a JSON style definition.
The native engine handles population, continuation and transactional layout.

## Inputs and authority

Obtain the user's layout requirements, intended page/spread/container target,
and a fresh `easycatalog-composition-manifest/1` export from that document and
selected EasyCatalog data. In the EasyCatalog Data View panel menu, choose **Reports → Composition and Scripting Manifest…**. The menu command requires the Pagination module and a functional Scripting module. Scripts can obtain the manifest through `session.ecCompositionManifest()`.

For an ExtendScript request, use `scriptingDocumentation` for the API bundled with the current build. To retrieve a hosted example, send the POST request in `sampleScripts.catalogue` with its supplied build number. URL-encode the chosen filename and use the POST request in `sampleScripts.download` to fetch the script.

Use the live manifest for supported capabilities and exact resource names. Use
[the JSON Reference](Composition%20Plan%20JSON%20Reference.md) from the same build
for property constraints. If an older manifest does not advertise a feature,
do not assume that a newer example makes it available. Report inconsistencies
rather than guessing. Preserve Unicode names exactly.

Read [the AI Authoring Guide](Composition%20Plan%20AI%20Authoring%20Guide.md), then
consult [Examples](Composition%20Plan%20Examples.md) for relevant patterns.
For product data sheets built from master pages, follow the
[Data Sheet Pagination Guide](Data%20Sheet%20Pagination%20Guide.md) for source
preparation, data scope, margins, fitting and container population.
Only consult [the API Reference](Composition%20Plans%20API%20Reference.md) when
scripting or execution orchestration is requested. The engineering specification
is not the plan grammar.

## Required output

Return one ordinary `easycatalog-composition-plan/1` JSON object unless the user
asks for a different deliverable. Do not return ExtendScript by default. Do not
add comments, prose, manifest fields, provenance or undocumented keys to the
plan. Recipe `$binding` objects are placeholders: replace them everywhere,
including JSON member names, before submitting the plan. They are different
from supported plan-local `$constant`, `$component` and `$parameter` syntax.

Never invent a field, formatting rule, rule set, parent, recipe ID or URL. If a
required resource is missing, identify it and ask for that resource or a suitable
alternative. Do not silently replace the user's data selection.

## Check and repair

1. Run a contract check for JSON structure and semantics.
2. Run resolve against the actual selection and target to check bindings/assets.
3. Run a bounded rollback layout check to exercise physical fit and continuation.
4. Repair diagnostics using their `code`, JSON Pointer `path` and `message`.
   Recheck after changes. Stop and explain a repeated unresolved error instead
   of silently dropping content or disabling keeps.
5. Inspect remaining-content results and preview both initial and continuation
   pages. A successful bounded trial is not proof that the whole catalogue fits.

If you cannot run checks, label the output as unverified and tell the user which
check to run. Do not claim that a plan was validated from reading JSON alone.
Validation guidance: [AI Authoring Guide](Composition%20Plan%20AI%20Authoring%20Guide.md#validation-and-repair).

## Offline use

When online, obtain the version-appropriate documentation root from
`authoring.documentationRoot` in a fresh live manifest. The live manifest
remains authoritative for the installed features and document resources.
Supply this file, the AI Authoring Guide, JSON Reference, relevant Examples and
the live manifest together. These local documents do not require URL retrieval.
Machine-readable resource discovery, hashing and automatic authoring-package
export remain separate future work. The resolved plan must not depend on an AI
service or documentation server during composition.
