---
title: "Catch a removed field in a Directus schema snapshot"
description: "One field left the settings collection. 273 others stayed."
slug: "snapshot-change-gate"
type: recipe
locale: en-US
canonical: "https://www.coremodels.io/recipe/directus/snapshot-change-gate"
updatedAt: "2026-12-04T12:00:00+00:00"
last_updated: "2026-12-04T12:00:00+00:00"
---

# Catch a removed field in a Directus schema snapshot

One field left the settings collection. 273 others stayed.

Import your Directus content model once, then get pass or fail for each change, with the name of every field that breaks. Recorded with the CMS starter template that Directus Labs publishes.

- Tools: `create_project`, `import_vendor_project`, `audit_vendor_project` on https://go.coremodels.io/mcp-admin (can write, sign-in required)
- Example: the CMS starter template that Directus Labs publishes, https://github.com/directus-labs/starters
- Recorded: 2026-12-04

## What you get

You import a schema snapshot once. After the next change, your assistant compares the new snapshot with it and names each removed field, each changed type and each list that lost a choice. The answer is a pass or a fail.

| What we did | What CoreModels answered | Time |
| --- | --- | --- |
| Imported the file of 28 January 2026 | 22 types in the model | 7 s |
| Audited the file of 20 July 2026 | **fail**: 1 error (a field was removed) | 4 s |
| Audited the first file again | **pass**: 0 errors | 2 s |

Recorded on 4 December 2026 with the CMS starter template that Directus Labs publishes ([repository](https://github.com/directus-labs/starters)). Between January and July 2026 its authors removed the field `openai_api_key` from the collection `globals`. Licence: MIT.

## What you need

- A CoreModels account with one project. Every plan starts with a 14-day free trial; a card is required to start.
- An assistant that can use MCP servers, for example Claude Code or Cursor.
- No Directus login. CoreModels reads one file from a public link.

## Run it

### 1. Connect your assistant

In Claude Code, run this command. Then sign in when it asks. This address can write to your projects, because an import creates a model.

```bash
claude mcp add --transport http coremodels https://go.coremodels.io/mcp-admin
```

Cursor, Claude Desktop and other clients: [connect guide](/mcp-server).

### 2. Import the version the site was built on

This is the content model of 28 January 2026, read from GitHub.

```text
Create a CoreModels project named "Directus example". Then call import_vendor_project on it with vendor "directus" and this link in artifactUrls (name: link):
snapshot: https://raw.githubusercontent.com/directus-labs/starters/fc9b338135f2570e937eed41ae7bbcd79a6f757e/cms/directus/template/src/schema/snapshot.json
```

Your assistant calls `create_project`, then `import_vendor_project`. The answer we got:

`import_vendor_project (part of the answer)`

```json
{
  "success": true,
  "vendor": "directus",
  "datasetsAdded": 22,
  "nodesEnriched": 246,
  "errors": []
}
```

Your model has 22 types now. Each has its fields, with the type from Directus.

### 3. Audit the newer version

Between January and July 2026 its authors removed the field `openai_api_key` from the collection `globals`.

```text
Now call audit_vendor_project on the same project with vendor "directus" and the newer file in artifactUrls. Tell me the gate and list every Error:
snapshot: https://raw.githubusercontent.com/directus-labs/starters/7cd86516248c3fffc33bd91427d871f8a7ce8058/cms/directus/template/src/schema/snapshot.json
```

Your assistant calls `audit_vendor_project`. The answer we got:

`audit_vendor_project (part of the answer)`

```json
{
  "gate": "fail",
  "errorCount": 1,
  "warningCount": 83,
  "findings": [
    {
      "severity": "Error",
      "code": "field-removed",
      "subject": "globals.openai_api_key",
      "message": "Field is governed in CoreModels but no longer exists on the estate dataset."
    }
  ]
}
```

An audit only reads. The model still holds the first version.

### 4. Check that the gate also passes

A check that always fails is of no use. Audit the first version again.

```text
Call audit_vendor_project again, this time with the first link. The gate must be pass.
```

Your assistant calls `audit_vendor_project`. The answer we got:

`audit_vendor_project (part of the answer)`

```json
{
  "gate": "pass",
  "errorCount": 0,
  "warningCount": 83
}
```

## Now with your own project

The schema snapshot as JSON. Directus can also write YAML, which CoreModels does not read. Run this, then give your assistant the prompt.

```bash
npx directus schema snapshot --format json ./snapshot.json
```

```text
Create a CoreModels project for our Directus content model. Import our Directus schema snapshot (JSON) (snapshot.json) with import_vendor_project, vendor "directus". Then audit the same files and show me the gate. Keep the project id: we will audit each later change against it.
```

## In a pull request

This command gives the same answer without an assistant. It needs `jq`, a project id and an API key from Settings, API Keys. It ends with an error when the gate is fail, so a pull request check stops.

```bash
jq -n --rawfile f snapshot.json '{artifacts: {"snapshot": $f}, failOn: "error"}' |
  curl -sS -X POST "https://go.coremodels.io/v1/$PROJECT_ID/integrations/directus/audit" -H "Authorization: Bearer $COREMODELS_KEY" -H "Content-Type: application/json" -d @- |
  jq -e '.data | .gate, (.findings[] | select(.severity == "Error") | .code + " " + .subject), (.gate == "pass")'
```

The service answers 200 also when the gate is fail. Read `gate`, as the command does. If the command prints `null`, no file was found at that path.

## What it does not do

- A field that becomes required is not reported.
- A collection that is deleted is not reported. Its fields are no longer compared.
- The audit also gives advice about hidden and read-only fields. Those lines are warnings and do not make it fail.
- CoreModels reads the file you give it. It has no login to Directus and it writes nothing back.

[Start building](https://www.coremodels.io/start)

14-day free trial. Builder $49/mo after the trial. Cancel any time.

## Sitemap

- [Sitemap in markdown](https://www.coremodels.io/sitemap.md)
