# AI Onboarding Concierge

## Objective

Answer setup questions and point new users at the next step that actually matters.

A guided setup assistant that reads the account's real completion state, answers questions about the product, and links the user into the interface where each remaining step is done.

## Before You Begin

This feature is being added to an application that already exists and already
works. Do not scaffold a new project, and do not assume a blank slate.

Inspect the codebase first and establish:

- The existing application structure and where code of this kind already lives.
- The framework and version in use.
- The existing design system — colours, spacing, typography, and component conventions.
- Existing UI components you can reuse instead of writing new ones.
- The existing database structure, if this feature needs to persist anything.
- The existing authentication and authorization system, if this feature is user-scoped.
- Dependencies already installed, so you don't add a library that duplicates one.
- The existing test setup and conventions.

Only start writing code once you understand the above. If the application
already implements part of this feature, extend it rather than replacing it.

## Implementation Instructions

1. Find the existing source of truth for setup progress — the onboarding checklist, activation flags, or whatever the app already uses — and read from it. Do not have the assistant infer completion from conversation history.
2. Filter candidate next steps by the user's plan and role before anything is suggested, so the assistant never recommends an action the account cannot take or the person is not permitted to perform.
3. Make every recommendation end in a link or control that opens the real screen for that step. The assistant explains and directs; the app's own interface does the work.
4. Recompute progress from the app after the user returns, and only then acknowledge a step as done. Confirm nothing on the strength of the user having said they did it.
5. Do not let the assistant become the only path through setup. The existing onboarding checklist and empty states remain fully usable with the assistant closed, and this brief extends them rather than replacing them.

## UI and UX Requirements

Match the application's existing design system exactly. Reuse its components,
spacing, and typography. This feature should look like it was always there.

## Responsive Requirements

Works on mobile, tablet, and desktop. Touch targets are large enough to hit on a
phone, and nothing overflows horizontally at 320px.

## Accessibility Requirements

- Fully keyboard navigable.
- Correct semantic elements and ARIA roles.
- Visible focus states.
- Meets WCAG AA contrast.
- Dynamic changes are announced to screen readers.
- Respects prefers-reduced-motion.

## Edge Cases

- A user who completed a step in another tab, or before the assistant opened, must not be told to do it again. Refresh the completion state on every turn, not once per session.
- When the assistant cannot answer with confidence, it must say so and hand off to the app's normal help — documentation, support, or a human — rather than producing a plausible-sounding invented instruction.
- Recommending an upgrade-only or admin-only action to someone who cannot take it turns setup into a dead end. Restrict the candidate set up front instead of apologising afterwards.
- Claiming setup succeeded when the app's state says otherwise destroys trust in everything else the assistant says. Verified state always wins over the model's account of what happened.
- Trapping the user in a chat window when a two-field form would finish the job is worse than no assistant. Prefer sending them to the interface over collecting values conversationally.
- When the model is unavailable, the assistant must degrade to the static checklist and documentation links rather than showing an error that blocks onboarding.
- The account context sent to the provider must be limited to setup state and plan level. Customer records, uploaded content, and credentials never leave the app as part of an onboarding question.
- A long back-and-forth must have a token and turn ceiling per session, after which the assistant summarises and hands off rather than growing the conversation indefinitely.

## Testing

Exercise the feature end to end in the running application. Cover every edge case
above, then run the existing test suite and confirm nothing regressed.

## Acceptance Criteria

- [ ] Setup progress is read from the app's own completion state and refreshed on every turn.
- [ ] Recommended actions are filtered by the user's plan and role before being offered.
- [ ] Each recommendation links into the real interface where the step is completed.
- [ ] A step is only reported complete after the app verifies it.
- [ ] Low confidence produces an explicit handoff to normal help rather than a guess.
- [ ] The existing onboarding checklist remains fully usable when the assistant is closed or the model is unavailable.
- [ ] Per-session token and turn ceilings are enforced.
- [ ] The feature matches the existing design system.
- [ ] No existing functionality is broken.

## Adaptation Rules

- Match the existing design system. Do not introduce a new colour palette,
  spacing scale, or component library.
- Reuse existing components and utilities wherever they fit.
- Follow the naming, file layout, and code style already present.
- Do not upgrade, replace, or remove existing dependencies to make this
  feature fit. Adapt the feature to the app, not the app to the feature.
- Do not break existing functionality. If a change is genuinely required in
  existing code, make the smallest one that works and say so.
- If something in these instructions conflicts with how the application is
  built, follow the application and explain the deviation.

## Final Verification

Before you report the work as done:

1. Re-read the acceptance criteria above and check each one against what you
   actually built.
2. Run the application and exercise the feature end to end.
3. Run the existing test suite and confirm you have broken nothing.
4. Check the feature on mobile, tablet, and desktop widths.
5. Check keyboard navigation and focus handling.
6. Summarize what changed: files added, files modified, and anything you
   deliberately did differently because of how this application is built.

If any acceptance criterion is unmet, fix it before reporting completion.
