> ## Documentation Index
> Fetch the complete documentation index at: https://docs.usecontextlayer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Slate

> Understand a slate's repository, app, agents, MCP tools, resource declarations, and deployment lifecycle.

A **slate** is software that ContextLayer builds, hosts, and runs from one Git repository. Its app, agents, MCP tools, and resource declarations travel together in Git. Connected accounts, secret values, and database contents are managed separately from that source code.

Each slate has an Owner, a Git remote, and a hosted URL. Work in a local checkout, then push `main` to build and deploy a revision of the slate.

## What a slate contains

The repository can contain three ways to interact with the slate:

* [**App**](https://docs.usecontextlayer.com/core-concepts/slate/app.md): a React Router app that people open in a browser.
* [**Agents**](https://docs.usecontextlayer.com/core-concepts/slate/agents.md): named sets of standing instructions that run as jobs, on demand or on a schedule.
* [**MCP tools and Views**](https://docs.usecontextlayer.com/core-concepts/slate/mcp.md): tools and interfaces that clients supporting the Model Context Protocol (MCP) discover and use through the slate's `/mcp` endpoint.

[Resources](https://docs.usecontextlayer.com/core-concepts/resources) are connections, databases, and secrets. The app and each agent name their requirements in a **declaration**: a `slate.json` file. A declaration says what code needs; it does not contain credentials or database contents.

Declarations share one namespace per resource kind within the slate. If the app and an agent both declare `notes`, those declarations refer to the same logical database and must agree on its mode. The mode selects its Owner: two consumers using the same slug and Owner reach the same stored data, while different viewers' viewer-mode databases remain separate.

> [!NOTE]
>
> MCP tools have their own `slate.json` files, but connections, databases, and secrets are currently supported for apps and agents only. An MCP tool's resource declarations must be empty.

## Find your way around the repository

| Path | Contents |
| - | - |
| `app/` | The app's root and routes |
| `public/slate.json` | The app's declaration |
| `agents/<name>/` | An agent: `instructions.md`, its `slate.json` and optional `schedules/` |
| `mcp/<name>/` | An MCP tool: `index.ts` and its `slate.json` |
| `mcp-ui/<name>/index.html` | An MCP View |
| `databases/<slug>/` | A database's Kysely configuration, migrations and generated query types |
| `.contextlayer/` | Local development state, ignored by Git |

The starter contains the app and one database, `notes`. Add directories for the agents, MCP tools, and Views you want to build.

For example, a checkout with an added `digest` agent and `echo` MCP tool has this structure. Configuration and dependency files are omitted here so you can see where the authored behavior lives:

```text theme={null}
.
├── AGENTS.md
├── README.md
├── agents/
│   └── digest/
│       ├── instructions.md
│       ├── schedules/
│       │   └── weekly.md
│       └── slate.json
├── app/
│   ├── root.tsx
│   ├── routes/
│   │   └── home.tsx
│   └── routes.ts
├── databases/
│   └── notes/
│       ├── kysely.config.ts
│       ├── migrations/
│       │   └── 001_create_notes.ts
│       └── types.ts
├── mcp/
│   └── echo/
│       ├── index.ts
│       └── slate.json
├── public/
│   └── slate.json
└── workers/
    └── app.ts
```

The starter's `public/slate.json` declares an owner-mode `notes` database:

```json public/slate.json theme={null}
{
  "connections": {},
  "databases": {
    "notes": {
      "mode": "owner"
    }
  },
  "secrets": {}
}
```

Here, `notes` is the database slug used in code and in `databases/notes/`. In the hosted slate, `"mode": "owner"` selects a database belonging to the slate's Owner. See [Databases](https://docs.usecontextlayer.com/core-concepts/resources/databases.md) for migrations, queries, and the distinction between local and hosted data.

## Create a slate

The CLI's `init` command creates a slate in ContextLayer and writes a checkout from the starter bundled with the CLI. It sets the Git remote and commits the starter on `main`. Sign in with `login` before creating a slate; the [Quickstart](https://docs.usecontextlayer.com/quickstart.md) walks through the sequence. Run `npx @usecontextlayer/cli init --help` for creation options.

A slate belongs to one [Owner](https://docs.usecontextlayer.com/core-concepts/owners-and-viewers.md): you, or an organization you belong to. Its name is its hostname label, generated at creation from an adjective, a color and an animal.

## Deploy with a Git push

Pushing `main` to the slate's ContextLayer remote starts its deployment lifecycle:

1. Build the pushed commit.
2. Apply that commit's database migrations.
3. Deploy the built app and MCP tools.
4. Install the agent schedules from that commit.

If a migration fails, that commit is not deployed. A push publishes source to the repository; the hosted app changes when deployment succeeds. See [Deploy a slate](https://docs.usecontextlayer.com/how-to/deploy.md) for the workflow.

Only the owning user, or a member of the owning organization, can clone, pull or push a slate, whether it is private or public.

## The hosted URL and the dashboard

`init` prints two links:

* The hosted URL, `https://<name>.contextlayer.xyz/`, where people open the slate. It works once the first deployment succeeds.
* The slate's page in the dashboard at `platform.usecontextlayer.com`. The dashboard lists the slates you can manage, under Personal and under each of your organizations, with each slate's latest commit.

## Private by default

A new slate is private. A private slate with a personal Owner opens only for that user; a private organization slate opens only for members of that organization. A public slate opens for anybody. Visibility governs viewing only: Git access and management stay with the owning user or the members of the owning organization either way.

Visibility is changed through the API: [Update who can view a slate](https://docs.usecontextlayer.com/api-reference/slates/update-who-can-view-a-slate.md). [Owners and viewers](https://docs.usecontextlayer.com/core-concepts/owners-and-viewers.md) covers who can see and do what.

## The chrome

The **chrome** is ContextLayer's header and configuration tray around a hosted app. It shows who you are signed in as and whether the slate's setup is complete. The tray lists declared connections and viewer-mode secrets, so you can connect an account, assign it to a connection, and supply required secret values. These changes configure the hosted slate; see [Connections and assignments](https://docs.usecontextlayer.com/core-concepts/resources/connections-and-assignments.md).

The chrome is served from a ContextLayer origin in an iframe, separate from your app. The app cannot read it, and the chrome passes no credentials or profile data to the app. The starter's `app/root.tsx` mounts it through the SDK's `Layout`. Local development does not show the chrome.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.