# LLM Instructions

Source: https://payloadcms.com/docs/beta/configuration/llm-instructions

LLM instructions guide AI agents working with your collections and globals. Payload core manages configured Markdown instructions and additional instructions saved through the Admin Panel. The feature works without the MCP plugin.

Both the [CLI](/docs/v4/configuration/cli.md) and [MCP plugin](/docs/v4/plugins/mcp.md) return configured instructions combined with saved additional instructions as Markdown. Only `getCollectionSchema` and `getGlobalSchema` include them, so agents should read the schema before creating or updating content. Instructions are omitted when both sources are empty.

## Configuration

Set `llmInstructions` on a collection or global to provide read-only Markdown instructions. Use the root `llmInstructions` option to control instruction management:

```ts
import { buildConfig } from 'payload'

export default buildConfig({
  collections: [
    {
      slug: 'pages',
      llmInstructions:
        'Use the configured layout blocks and keep page titles concise.',
      fields: [
        /* ... */
      ],
    },
  ],
  globals: [
    {
      slug: 'settings',
      llmInstructions:
        'Preserve existing navigation links unless asked to change them.',
      fields: [
        /* ... */
      ],
    },
  ],
  llmInstructions: {
    access: ({ req }) => req.user?.roles?.includes('admin') ?? false,
  },
})
```

## Editing instructions

Open **Edit LLM instructions** from a collection's list menu or a global's edit menu. The hidden **LLM Instructions** collection has one configuration-owned entry per visible collection or global. Its **Additional instructions** tab saves editable instructions; **System instructions (read-only)** displays the configured Markdown and cannot be edited through the Admin Panel or API.

## Editor

Lexical uses a dedicated instructions editor with paragraphs, H2–H4 headings, bold, italic, strikethrough, ordered and unordered lists, and a fixed toolbar. Its feature set is independent of the root editor's features. Set `llmInstructions.editor` to a separate rich-text adapter to override it.

## Access control

Authenticated users can read saved instructions for collections and globals they have read access to. Editing also requires update access to the target and permission through `llmInstructions.access`, which defaults to users of the admin auth collection. Target access is evaluated at the entity level, as in the Admin Panel.

## Disabling management

Set the root `llmInstructions` option to `false` to disable the management collection and menu items. Configured collection and global instructions are still included in CLI and MCP schema responses.
