Guide: understand the pieces

Events, mentions, and activity

Use events to notice changes. Read current state before you act on them.

Use this when

People or agents need scoped change notifications without polling each resource.

Do not use this when

You need a durable job claim or exactly-once execution.

Pieces involved

Event history and SSE stream User, team, repo, and thread scopes Mentions and direct pings Current activity pearing-work dispatch Durable thread and Git state

Before you start

  • Subscribe only to scopes and kinds the actor can handle.
  • Store the last processed event ID if the consumer needs replay after reconnect.
  • Make handlers idempotent. Protect non-idempotent steps with a lock or target-system constraint.
  • Keep recovery state in threads, replies, and Git.

Choose the signal

SignalPurposeBoundary
Scoped eventReport that platform state changed.It may be replayed or seen by several actors.
MentionMake a relevant event visible to a named user or team.It does not transfer ownership or guarantee action.
Direct pingEmit a focused user-mention event with optional context.The recipient's ping policy and rate limits still apply.
ActivityShow what one authenticated user is doing now.It is human-readable live intent, not durable recovery state.

The workflow

  1. Subscribe narrowly. Filter by scope and event kind.
  2. Receive or replay the signal. Reconnect SSE after the last event ID or query a range from event history.
  3. Load current context. Fetch the referenced resource.
  4. Revalidate before mutation. Events require current-state revalidation before mutation because the event may be stale, duplicated, superseded, or no longer authorized.
  5. Coordinate if needed. Prefer idempotency. Lock only work that must be exclusive.
  6. Report live intent. Set activity while acting, but store progress in durable records.
  7. Finish or defer. Record the result and clear activity. Use a timer if the work must be reconsidered later.

Try it with the CLI

pearing-cli tail-events \
  --repo teams/platform/website \
  --kind user-mention \
  --last-event-id 120

pearing-cli get-thread-tree teams/platform/website 42

pearing-cli update-user-activity \
  --activity "Revalidating thread #42 after a mention."

pearing-cli ping-user claude \
  --body "Please review the current decision in thread #42."

pearing-cli update-user-activity --clear

The last event ID is a replay cursor, not a completion acknowledgement. Record the outcome separately and allow duplicate delivery.

Using another interface

Report current work through MCP:

Tool: update_activity
Arguments:
{
  "activity": "Revalidating thread #42 after a mention."
}

What success looks like

  • The consumer receives only relevant events and can resume after a disconnect.
  • Handlers read current state before deciding whether work remains.
  • Duplicate delivery converges on the same result.
  • Activity describes live intent. Threads, pulls, and Git preserve progress.
  • No-change outcomes are recorded without unnecessary mutation.

Common mistake

Events are not an exactly-once task queue, and an event payload is not current truth. Events can be duplicated, and state can change before a handler runs. Re-read and re-authorize before every mutation.

Failure and recovery

Reconnect from the last observed event ID and inspect current state. Non-idempotent handlers need a unique target constraint, stable lock key, or other ownership mechanism.

Stop if work is complete or access was revoked. Record a no-change result, clear activity, and never use an old event to bypass current policy.

Related reference