# Integration guidelines

Source: https://projectfeed.app/docs/agents/guidelines

How an agent, script, or MCP client should watch for changes, poll, retry, and hold credentials so it stays within its limits.

## Watch for changes with webhooks

To learn when something changes, subscribe an outbound webhook instead of listing tasks or posts on a timer. A webhook sends a signed POST to your endpoint when a subscribed event happens. Events cover posts, comments, reactions, projects, members, tasks, docs, canvases, time entries, and Chat. See [Webhooks](https://projectfeed.app/docs/webhooks).

Post lists have no changed-since filter. A poller has to read whole pages again to find out what changed, while a webhook delivers the change itself. Task lists accept `updatedSince`, and notifications and audit logs accept a `since` timestamp. See [API conventions](https://projectfeed.app/docs/api/conventions).

Webhooks need a public HTTPS endpoint. To try one against a local server, `pf webhooks listen` forwards delivery records to it. See [CLI webhooks](https://projectfeed.app/docs/cli/webhooks).

Webhooks can send `handoff.created`, `handoff.status_changed`, and `handoff.updated`. [MCP events](https://projectfeed.app/docs/agents/mcp/events) require a client with an approved callback receiver. For local agents, run pf handoffs wait as a background command; it polls outside the model and returns when work is ready.

## Poll slowly when you have to

-   Use pf handoffs wait for a local background wait. For MCP-only polling, wait 60 seconds between checks and 120 seconds after an empty result; respect retryAfterSeconds.
-   Read several statuses in one call with `statuses`. The inbox allows one first-page poll a minute for each key or token and direction, and every status shares that budget. Faster polls return `rate_limit_exceeded`.
-   For your own tasks, call `list_tasks` with `assigneeId` set to `me` and `updatedSince` set to the largest `updatedAt` you have seen minus 5 seconds, skipping tasks you already have, and follow `nextCursor` until it is null. Do not read the whole list again. A new comment does not change `updatedAt`, so for comments pass `since` to `list_task_comments`. For notifications and audit logs, pass the time of your last read as `since`. For post lists, keep the last result you read and compare against it, and poll no more than once every five minutes.
-   `check_auth` returns your `userId`. Compare it with each task's assignee and each comment's author to skip your own writes.
-   Run one poller per credential. Two workers polling with the same key share its budget, and both get throttled.
-   Under a scheduler, such as cron or an agent host schedule, run one bounded check per tick and exit. Do not start a loop that never ends. See [Personal tool handoffs](https://projectfeed.app/docs/agents/mcp/personal-handoffs) for a scheduled inbox check.

## Keep one MCP session

-   A client on the 2026 transport sends each request on its own and has no session to manage. Use it when your client supports it.
-   A client that negotiates a 2025 protocol version gets a session from `initialize`, whether it signs in with OAuth or an API token. Send its `Mcp-Session-Id` with every later request. Do not call `initialize` again for each tool call.
-   When the run ends, send `DELETE /api/mcp` with the same `Mcp-Session-Id`. A session you leave open expires 24 hours after its last request.
-   Share one session per credential and workspace within a process. A session belongs to the workspace it was opened for, so a token that works across workspaces needs one session for each. Requests from every session on a key count against that key's limits.

See [MCP transport](https://projectfeed.app/docs/agents/mcp/protocol-reference#use-the-transport) for request examples.

## Handle limits and retries

HTTP 429

Wait for the `Retry-After` seconds, add a little random delay, and stop after a few attempts. See [Rate limits](https://projectfeed.app/docs/api/rate-limits).

rate_limit_exceeded from an MCP tool

The tool call returns an error result with `retryAfterSeconds`. Wait that long before calling the tool again.

A read fails with a server error or times out

Retry it with exponential backoff. The pf CLI retries a read that gets a server error up to three times, but not a read that times out.

A write fails with a server error or timeout

Check whether the write went through before sending it again. Routes and tools that accept `idempotencyKey` or `requestKey` return the first result when you resend the same key. See [API conventions](https://projectfeed.app/docs/api/conventions) for the routes that accept one.

A validation error

Change the input. Sending the same request again returns the same error.

Before a batch job, check the remaining quota with `GET /api/v1/limits`, `pf limits`, or the `get_limits` tool. Slow down as the remaining count nears zero.

## Make fewer calls

-   Change up to 50 tasks in one call with `POST /api/v1/tasks/bulk` or the `bulk_update_tasks` tool.
-   Follow cursors page by page and stop once you have what you need. Do not read a list again from the start to find one item.
-   In the CLI, ask for only the fields a script reads, such as `--json id,title,status`.
-   Keep data that rarely changes, such as projects and members, for the length of a run instead of reading it before every call.

## Give each agent its own credential

-   Give each agent or tool its own API token or OAuth connection. Each key has its own rate limit, and a personal tool's handoff inbox belongs to the credential that registered it.
-   All of one person's personal tokens share a limit of 2,000 requests a minute, so a busy agent on a personal token slows that person's other tools.
-   Grant only the scopes the agent needs. An agent that only reads needs only read scopes. See [Scopes and token types](https://projectfeed.app/docs/api/scopes).
-   Run unattended jobs on a workspace-owned [service account](https://projectfeed.app/docs/api/service-accounts/overview).
-   Keep keys in an environment variable or a secret store. Never put a key in source control, a shared log, or an agent's prompt. Revoke and replace a key that leaks.

## Give the agent these rules

An agent follows rules it reads at the start of a session. Add these lines to AGENTS.md, CLAUDE.md, or the instruction file your agent reads. The MCP server also sends a short version of them to the client when it connects.

Markdown

```
## Project Feed limits

- Use pf handoffs wait --json as a local background command to wait for work.
  If only MCP is available, poll 60 seconds apart, or 120 seconds when empty.
- If the MCP client uses a 2025 protocol version, keep one session for the
  whole run. Do not call initialize per tool call, and end the session with
  DELETE /api/mcp when you finish. The 2026 transport has no session.
- After a rate-limit error, wait the seconds it reports before trying again.
- When you retry a write that accepts requestKey or idempotencyKey, send the
  same value. For other writes, check whether the first attempt went through
  before retrying.
- Use one background wait per receiving credential. Do not wrap pf handoffs list in a tight loop.
- Change up to 50 tasks with one bulk call instead of one call per task.
```
