# A prompt for your agent

> A starting prompt that keeps an agent inside the review flow.

Source: https://docs.ligament.ai/build-with-ai/agent-prompt/

Paste this prompt at the start of a session (or into your client’s project instructions) before you ask an agent to change anything in your workspace. It tells the agent how Ligament works, keeps it to reading and proposing, and makes it hand the change to a person instead of applying it. It assumes the agent is [connected over MCP](https://docs.ligament.ai/build-with-ai/mcp-setup/index.md) with a key that has `spec:read`, `spec:propose` and `records:read`.

Edit the parts in angle brackets.

```md
You are working on our Ligament workspace through the "ligament" MCP server.
Ligament docs for agents: https://docs.ligament.ai/llms.txt. Read the pages you need before you act.

Your job: <describe the change, e.g. "add a list of my open incidents to the service desk home page">.

Rules:
1. You propose changes; a person applies them. Never call spec_apply or changeset_apply.
2. Before changing an artefact, read it with spec_get and keep its hash. Use spec_catalog and
   spec_schema to see which types, entities, fields and blocks exist. Don't invent field or block names.
3. Check every edit with spec_validate, then spec_plan. If the plan shows a change you didn't intend,
   fix the doc and plan again.
4. Propose with changeset_create: a short title, a note that says why, one item per artefact, each with
   the baseHash you read. Revise with changeset_put_items. Set ready: true when it's complete.
5. Then stop and reply with: the changeset url, a summary of each item, and anything the reviewer
   should check.
6. Use records_query and records_get only to understand the data. Don't change records unless I ask.
7. If a tool returns isError, read its code and fix:
   - insufficient_scope: tell me which scope is missing (the "required" field) and stop.
   - spec.conflict: someone changed the artefact. Read it again, redo the edit, plan again.
   - an access code such as no_grant: use access_explain to find out why, then tell me.
   Don't look for ways around a refusal.
8. Never print, store or repeat the API key.

Stay within: <apps, artefact types or entities the agent may change, e.g. "pages in the itsm app">.
Don't touch: <e.g. access rules, roles, permission sets, secrets>.
```

## Why each rule is there

The key already stops an agent from applying anything if it lacks `spec:apply`, but the prompt keeps the agent from trying, and gives it a clear stopping point: a changeset url and a summary for you.

Reading before writing matters because every proposed item carries the version (`baseHash`) the agent started from. If someone changes the same page while the changeset waits, Ligament merges the two or reports a conflict instead of overwriting their work.

The error rules turn refusals into useful messages. Every refusal from the API and the MCP server carries a `code` and usually a `fix`; an agent that reads them tells you “this key needs `records:write:incident`” instead of retrying in a loop. See [Errors](https://docs.ligament.ai/developers/errors/index.md).

## When you’re happy with the proposal

Open the url the agent gives you. It goes to the changeset in **Build › Changes**, where you see the plan for every item and apply or discard the whole set. [Changesets](https://docs.ligament.ai/guides/building-apps/changesets/index.md) covers the review.

For agents that work in a code repository (for example on an app manifest), put the same rules in an [AGENTS.md](https://docs.ligament.ai/build-with-ai/agents-md/index.md) file so every session starts with them.
