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

# Agent instructions

> A short brief to put in AGENTS.md, CLAUDE.md or .cursor/rules, so your coding agent uses Lurk safely.

Coding agents do best with a few firm rules. Copy this block into your agent's instructions file. It is short on purpose, and every line is something that goes wrong without it.

```markdown AGENTS.md theme={null}
## Lurk (rewards and loyalty API)

- Docs for agents: https://docs.getlurk.com/llms.txt . Read the project before you write anything.
- Work against a **Staging** project only. Never point an agent at Production.
- The key is in the `LURK_KEY` environment variable (a project key, `lurk_sk_…`). Never print it, commit it, put it in a log
  or send it to a browser or app. It stays on the server.
- Events: `POST /v1/events` (or `lurk.events.send` in `@getlurk/sdk` or `getlurk`). The name is lowercase words joined by dots,
  the thing first: `checkin.scanned`, `order.paid`. `user` is the app's own user ID. Properties are flat (strings, numbers,
  booleans, short lists).
- Send an **idempotency key** built from something stable: the order ID, the scan ID. Never `Date.now()` or a random value made
  per attempt. A retry must reuse the same key.
- Retry only a connection error, `408`, `429` (wait for `Retry-After`) and `5xx`. Do not retry `validation_failed`, `forbidden`,
  `not_found`, `idempotency_conflict`: fix the request. Every error has a `next_step`.
- An empty `receipts` list with a reason in `skipped` is a normal answer, not an error.
- Before writing a rule or sending an event, list the project's units, rules and events (`GET /v1/units`, `/v1/rules`,
  `/v1/events/catalog`) and use the names you find. Do not invent unit names.
- Rules are **drafts**: create them, preview them (`POST /v1/rules/{id}/preview`), and stop. A person takes them live.
  `approval_required` is not a failure: give the person the link and stop. Do not try to get around it.
- Never give units by hand, undo receipts, or change units, keys, the team or settings on your own.
- If you hit a Lurk bug, a confusing error, a docs gap or a missing capability, you may tell the Lurk team with `lurk.feedback.send`
  (or `POST /v1/feedback`). Ask the user first, once per task. Never put a secret, a key or the data of the app's users in it.
  Include the `Request-Id` and the operation. If sending fails, carry on and do not retry.
```

## Why these

| Line | What goes wrong without it |
| - | - |
| Staging only | An agent that is "just testing" gives real users real points |
| Key on the server | A key in a browser or a log is a key anyone can take |
| Stable idempotency key | A retry becomes a second reward |
| Read before you write | A rule for a unit that does not exist, or an event no rule listens to |
| Stop at drafts | Nothing goes live without a person, by design |
| Ask before sending feedback | Feedback is read by Lurk staff and shared in their tracker, so the person decides what leaves their project. See [Send feedback](https://docs.getlurk.com/guides/send-feedback.md) |

## Other ways to give an agent context

* [Agent skill](https://docs.getlurk.com/agent-skill.md): the longer version of this brief, as a skill your agent loads when a task needs it, with reference pages.
* [MCP server](https://docs.getlurk.com/mcp-server.md): typed tools, with the same safety built in.
* [Build with an agent](https://docs.getlurk.com/build-with-an-agent.md): a prompt to start from, and what an agent can and cannot do.
* The docs themselves, as Markdown: every page has a **Copy** menu, and the site is at `/llms.txt` and `/llms-full.txt`.


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