# CRM Ownership and Next-Action Projection

## Why this note exists

This release train ships CRM ownership and next-action projection across the shared core, UI, API, and Elevasis operations bundle.

Shared CRM deal responses now carry nullable `ownership` and `nextAction` values derived from activity history. The CRM list and detail surfaces render the move owner directly, and detail actions prefer the projected `nextAction` before falling back to ownership-aware derivation. The Elevasis operations bundle also writes canonical follow-up and deferred-next-step activity events so ownership can sort consistently.

## Applies to

Template-derived projects that:

- consume `@elevasis/core/business/acquisition/api-schemas` deal list or detail response types
- render CRM list, detail, or action surfaces from `@elevasis/ui`
- author CRM operations workflows that append or interpret deal activity events
- read `activity_log` rows and classify who owns the next move

Projects with no CRM surface and no `acq_deals` workflow logic can ignore this train.

## Required actions

1. Pull template changes with `/git-sync` after this train publishes so package baselines for `@elevasis/core` and `@elevasis/ui` are refreshed.

2. Upgrade shared packages in the derived project after the publish stages complete:

```bash
pnpm up @elevasis/core @elevasis/ui --latest
```

3. Audit any project-owned CRM workflow code that writes activity events. Outbound follow-up should emit `followup_email_sent`, and "lead will check / get back to us" replies should emit `lead_deferred_next_step` when they defer our next action.

4. Audit any project-owned CRM UI code that computes available actions locally. Prefer the server-projected `nextAction` when present, and suppress send-reply affordances when `ownership` is `them`.

5. If the project deploys an operations bundle with CRM reply or follow-up handlers, redeploy that bundle after package upgrades so runtime activity writes match the new ownership derivation:

```bash
pnpm -C operations exec elevasis-sdk deploy --prod
```

## Verification

After upgrading:

- `pnpm check-types` passes in project packages that consume CRM types or UI.
- CRM list rows show the expected move owner for deals with inbound replies, outbound replies, follow-ups, reminders, booking nudges, and deferred-next-step replies.
- CRM detail actions expose Send Reply only when the server-projected action and ownership allow it.
- Operations tests or smoke probes confirm follow-up handlers emit `followup_email_sent`.
- A CRM reply where the lead says they will check internally records `lead_deferred_next_step` and sorts after the inbound reply event.

## Not handled by /git-sync

`/git-sync` does not:

- publish `@elevasis/core` or `@elevasis/ui`
- run package upgrades inside derived projects
- redeploy project-owned operations bundles
- rewrite project-owned CRM workflow logic that still emits legacy activity event names
- verify or repair historical `activity_log` rows in project databases
