Documentation Index
Fetch the complete documentation index at: https://avocadostudioai.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Guardrail Schema v1 Specification
Scope
This spec defines guardrails for AI-generated edits in the current architecture:- Data model:
PageDoc.blocks[](flat block list). - Enforced through orchestrator plan parsing + operation validation + block prop validation.
- Covers:
- Field-level constraints per block type
- Error taxonomy and response contract
- Auto-repair retry strategy and stopping rules
- Acceptance tests for valid/invalid scenarios
Locked Decisions
- Hard-blocking schema enforcement for invalid operations/props.
- MVP includes structural/schema guardrails only (no brand/policy pack yet).
- One bounded auto-repair retry for deterministic schema errors only.
- No semantic rewrites during auto-repair.
- If repair fails, return
needs_clarificationwith precise violating fields.
1) Field-Level Constraints Per Block Type
Shared Rules
- All block instances must include:
id: string(non-empty)type: BlockType(one of allowed block types)props: object
- Strings use
min(1)unless marked optional. - Array fields use
min(1)unless explicitly stated otherwise.
Block Constraints
Hero
- Required:
heading: stringsubheading: stringctaText: stringctaHref: stringimageUrl: stringimageAlt: string
- Optional:
secondaryCtaText: stringsecondaryCtaHref: string
FeatureGrid
- Required:
title: stringfeatures: FeatureItem[]with at least 1 item
FeatureItem:title: stringdescription: string
Testimonials
- Required:
title: stringitems: TestimonialItem[]with at least 1 item
TestimonialItem:quote: stringauthor: string
FAQAccordion
- Required:
title: stringitems: FAQItem[]with at least 1 item
FAQItem:q: stringa: string
CTA
- Required:
title: stringdescription: stringctaText: stringctaHref: string
Card
- Required:
title: stringdescription: stringctaText: stringctaHref: string
CardGrid
- Required:
title: stringcards: CardItem[]with at least 1 item
CardItem:title: stringdescription: stringctaText: stringctaHref: string
RichText
- Required:
body: string
- Optional:
title: string(can be empty)
Operation-Level Guardrails
EditPlan.ops[] supports only these operations:
- Page:
create_page,rename_page,remove_page,move_page,duplicate_page - Block:
add_block,update_props,remove_block,move_block,duplicate_block - List item:
add_item,update_item,remove_item,move_item
- Unknown
opvalues - Missing required op fields
- Invalid field types (e.g. non-integer indices)
- Empty ops array for direct ops endpoint
2) Error Taxonomy and Response Contract
Error Taxonomy
schema_violation
The plan/op/props fail structural validation.
Examples:
- Unknown operation
- Invalid block type
- Missing required prop
- Empty required string
- Array below minimum length
- Invalid item index
ambiguity
Request intent is unclear; no safe deterministic edit can be chosen.
Examples:
- Multiple possible targets with no active block/context
- Request lacks required selection context
not_found
Referenced page/block/item does not exist.
Examples:
page not foundselected block not found on current page
no_effective_change
Request is valid but produces no net changes.
Example:
- New content equals existing content
internal_error
Unexpected runtime error during planning/apply.
Response Contract
/chat and /chat/stream final result (success)
Clarification result
Validation/safety failure result
/ops endpoint failure shape
- Current
/opsuses{ error: string }. validationErrorsis currently part of/chat-family payloads.
3) Auto-Repair Retry Strategy and Stopping Rules
Eligibility for Auto-Repair (Deterministic Only)
Auto-repair may attempt exactly one correction pass when failures are structural and local, such as:- Missing required field with inferable fallback from context.
- Type normalization (
numberstring to integer where safe). - Enum normalization where a single exact match exists.
- Patch cleanup for unknown keys in a strict block shape.
- Semantic rewrites of copy/tone/content meaning.
- Ambiguous target selection.
- Cross-entity inference requiring user intent assumptions.
- Multi-step transformations that can change intent.
Retry Flow
- Generate plan.
- Validate plan + props.
- If valid: apply.
- If invalid and auto-repair eligible:
- run one repair pass
- revalidate
- If revalidation passes: apply repaired plan.
- If revalidation fails:
- return
needs_clarificationif ambiguity/intent gap - else return
validation_errorwith precise fields
Stopping Rules
Stop immediately when any of the following is true:- One repair pass has already been used.
- Validation errors are non-deterministic/ambiguous.
- Repair would require semantic content invention.
- Any guardrail violation remains after revalidation.
4) Acceptance Tests (Valid/Invalid Scenarios)
A. Valid Apply
A1Update Hero heading
- Input:
update_propsforHero.headingnon-empty string. - Expected:
status=applied, preview version increments, focus block set.
A2Add FeatureGrid item
- Input:
add_itemonFeatureGrid.featureswith required fields. - Expected: applied, array length +1.
A3Move block within page
- Input: valid
move_block. - Expected: applied, new order persisted.
B. Hard-Blocked Schema Violations
B1Missing required field
- Input:
add_blockHero withoutctaHref. - Expected: rejected (
validation_erroror/opserror), no state mutation.
B2Empty required string
- Input:
update_propssetCTA.title="". - Expected: rejected, no version bump.
B3Invalid list index
- Input:
update_itemwith out-of-range or negative index. - Expected: rejected, no mutation.
B4Unknown operation
- Input:
op="replace_page". - Expected: rejected by operation schema.
C. Clarification Paths
C1Ambiguous target
- Input: “make this shorter” with no active block and multiple candidates.
- Expected:
status=needs_clarification+ suggestions.
C2Unsupported intent without context
- Input: request requiring block selection when none exists.
- Expected:
needs_clarification, no mutation.
D. Auto-Repair Paths
D1Repairable deterministic mismatch
- Input: plan with one deterministic schema mismatch eligible for repair.
- Expected: one repair attempt, successful apply.
D2Non-repairable mismatch
- Input: plan requiring semantic rewrite to pass validation.
- Expected: no semantic repair;
validation_errororneeds_clarification.
D3Repair attempt fails
- Input: eligible repair attempted but still invalid after revalidation.
- Expected: stop after one retry; no additional retries.
E. Safety Invariants
For all rejected cases:- No content mutation is persisted.
previewVersiondoes not increment.- Response includes actionable error details for UI display.
Implementation Notes
- This v1 spec maps to current flat
PageDoc.blocks[]. - Section-aware composition constraints are intentionally deferred to a future spec revision.
- Future versions can extend taxonomy with policy/a11y/SEO categories without breaking v1 structural contracts.