---
title: "Change feed | IdentityHound"
description: "Learn what IdentityHound's change feed records, who may read it, and how its cursors, ordering, and retention work."
url: "https://agentpost.tools/docs/identityhound/concepts/change-feed"
kind: concept
---

# Change feed

The change feed records IdentityHound events in order, including sign-ins, new members, grants, approved delegations, and config changes. Your server reads it to keep its own records in step or react to changes. Each environment has its own feed. Adopt EventWolf too for [automatic event history](#event-history).

Only your server reads the feed, with the project’s secret key. A signed-in principal is refused with [`trusted_caller_required`](/docs/identityhound/errors.md#trusted_caller_required). Events are kept for 30 days.

## Events

Each event is a CloudEvent 1.0 in JSON, with its own `id`, whose `type` is `tools.agentpost.identity.<name>`, such as `tools.agentpost.identity.membership.added`. Its `data` holds what changed, the `workspaceId` it happened in, if any, and `context`, who acted, in the shape every Agentpost service’s feed uses, with two fields of IdentityHound’s own beside it:

-   **`actor.id`:** who made the request with its own credential. It is a principal’s ID, `trusted_caller` for your server, or `anonymous` for a request before sign-in.
-   **`onBehalfOf.id` and `delegationId`:** when the actor was a delegate with a delegated token, the delegator it acted for and the [delegation](/docs/identityhound/concepts/delegations.md). [Who acted](/docs/platform/concepts/principals.md#who-acted) gives the rule.
-   **`via`:** the credential the change came through: `session`, `api_key`, `delegated_token`, `trusted_caller`, or `system`, for what IdentityHound does on its own, such as ending an expired grant.

A delegate’s change reads `"context": { "actor": { "id": "prn_…" }, "onBehalfOf": { "id": "prn_…" }, "delegationId": "dlg_…", "via": "delegated_token" }`. Until November 2026 the context was `{ actorId, onBehalfOfId?, delegationId?, via }`, and the events already in the feed were moved to the new shape; a reader written for the old one reads `actor.id` for `actorId` and `onBehalfOf.id` for `onBehalfOfId`, and SDK 0.4.0 types it.

A change and its event commit together, so the feed never holds an event for a change that didn’t happen, or misses the event of one that did. The feed also holds `access.denied` events from [audited access checks](/docs/identityhound/concepts/access-checks.md#what-an-answer-carries). The [events reference](/docs/identityhound/reference/events.md#event-types) lists every type.

## Cursors

Each event has a `seq`, its place in the project’s feed, assigned in the same transaction as the change. Sequences are unique within the project’s feed. A cursor is a `seq`: a read’s `after` selects only events with a greater `seq`, in increasing order. The default `after` is `0`.

Every answer has `next`, the cursor for the next read. A full page gives its last event’s `seq`. A shorter page has caught up, so it gives the newest `seq` read, past any events the `types` filter skipped, so a reader of a few types doesn’t read the others again. [Lists](/docs/platform/api-basics.md#lists) says how a feed pages. The optional `types` filter matches full type names separated by commas, with any spaces around each name ignored.

A follower that needs no history starts from now: `after=latest` answers with no events and `next` set to the newest `seq`, so its next read returns only later changes.

## Sessions that end

Two events end a session, and each has the session’s `sessionId`, its `principalId`, and a `reason`:

-   **`auth.signed_out`:** the session signed out with itself. Its `reason` is `sign_out`.
-   **`session.revoked`:** any other end, such as the principal ending it from its list of sessions (`self`), being suspended, deleted, or merged, or removing the identity it signed in with. Its `reason` names which.

A session that runs out, past its idle limit or its `expiresAt`, records no event. A server that keeps data per session keeps each session’s `expiresAt` itself, or looks the session up with [`GET /sessions/:id`](/docs/identityhound/reference/principals.md#get-a-session). In the SDK, `IdentityEvent` types each event’s `data` by its `type`, so narrowing on `tools.agentpost.identity.session.revoked` gives `data.sessionId`.

## Event history

When your project adopts both IdentityHound and EventWolf, Agentpost automatically forwards the change feed into [EventWolf’s history](/docs/eventwolf/concepts/events.md). Each environment forwards into its own history, in feed order, and continues while your app is offline. A change forwarded twice, as after Agentpost restarts, is one event while the first is still in EventWolf’s history, since EventWolf deduplicates on `source` and `id`.

Adopting the second service backfills the changes still in the feed, so a project that adopts EventWolf later gets at most its last 30 days of changes. Older changes are gone from the feed and can’t be forwarded.

The forwarded event keeps the feed event’s `source`, `type`, `id`, `subject`, `time`, and `data` as they are. Agentpost adds three extensions, so EventWolf can find the event by who acted and where:

-   **`actor`:** `principal:` and `data.context.actor.id`.
-   **`onbehalfof`:** for a delegate acting for its delegator, `principal:` and `data.context.onBehalfOf.id`.
-   **`workspace`:** `data.workspaceId`, when the change has one.

A change made by your server’s secret key or before sign-in, whose `actor.id` is `trusted_caller` or `anonymous`, has no `actor`: those values name kinds of caller, not principals, and stay only in `data.context`. EventWolf gives each event its own `sequence`, in the feed’s order.

Your EventWolf config and event type schemas still apply. If EventWolf rejects a change, forwarding retries that change before sending later changes from the same environment. Other projects continue. Fix the rejection through [EventWolf’s ingestion failures](/docs/eventwolf/reference/ingest-failures.md) before the source feed expires. Once accepted, the event follows EventWolf’s retention. Agentpost’s starting EventWolf config keeps events forever. Deleting the project stops forwarding and removes its history, in both services.

## Limits

-   Each event is kept for 30 days from its `time`. A read whose cursor is older than the oldest event kept answers [`cursor_expired`](/docs/identityhound/errors.md#cursor_expired) (410), with `details.oldest`, the first `seq` still kept, and `details.latest`, the newest. Reading on would skip the removed changes, so bring your records up to date from IdentityHound’s records first, then read with `after` set to `details.oldest - 1`, or with `after=latest`. `after=0` always reads from the oldest event kept.

## Where to act on it

-   [Sync records with the change feed](/docs/identityhound/guides/change-feed.md) processes pages, saves a cursor, and resumes safely after a stopped run.
-   [Let one principal act for another](/docs/identityhound/guides/agents.md) makes changes the feed records with both the delegator and the delegate.
-   [Send security notices](/docs/identityhound/guides/security-notices.md) emails a principal about changes to its account, in your own words.
-   [Change feed](/docs/identityhound/reference/events.md) has the read and every event type.
