---
title: Plugin (UserExit) — Validation Rules
aliases: [plugin, UserExit, user-exit, user exits]
sources: [rcg-mobile-dev-agent/raw/006-contract-types-matrix.md, rcg-mobile-dev-agent/wiki/contracts/plugin.md]
last_updated: 2026-04-26
status: seed
---

# Plugin (UserExit) — Validation Rules

Plugin contracts expose server-side-style `UserExit` callbacks — small JavaScript hooks invoked by the framework at defined extension points. They are distinct from [[ui-plugins|UIPluginV2]] (which ship UI components). Plugin is a partial-validation type: the validator (55 lines) only enforces uniqueness and warns about modifications to core plugins.

## What this contract represents

A `.plugin.xml` file declares one or more `<UserExit>` entries, each with a `<Parameters>` list and a `<Code language="text/javascript">` body. The framework locates each UserExit by name and invokes it at the relevant extension point.

## File shape

-   Extension: `.plugin.xml`
-   Root element: `<Plugin>`
-   `<Code @language>` is fixed to `text/javascript`.

## Validation rules

### Cross-cutting (every contract)

-   Contract names must be unique workspace-wide.
-   Files must be readable, well-formed XML.

### Must

-   Root element is `<Plugin>`.
-   `<Code @language>` is fixed to `text/javascript` — no other language is accepted.

### Must not

-   Two `<UserExit @name>` within the same Plugin contract cannot share a name.
-   Two `<Parameter @name>` within the same UserExit cannot share a name.

### Coerced (silently rewritten)

-   A Plugin flagged `MODIFIED_CORE` is warned — the recommended path is to clone-and-customize rather than modify a core plugin in place.
-   `xmlns="*.xsd"` on the root is stripped.

## Reference

-   Internal schema reference: `rcg-mobile-dev-agent/wiki/contracts/plugin.md`.
-   Cross-repo raw source: `rcg-mobile-dev-agent/raw/006-contract-types-matrix.md`.

## See also

-   [[business-logic]] — Plugin bodies are JavaScript; general BL authoring rules apply.
-   [[ui-plugins]] — Separate contract type for UI components; don't confuse the two.
