Technical docs
Onboarding
Overview
Current bootstrap and invite-entry behavior for new users.
Self-serve bootstrap
- Trigger:
- Google OAuth callback at `/api/auth/google/callback`
- runs only for a brand-new user when there is no invite code in OAuth `state`
- Backend builder:
- `OrganizationBuilder.createDefaultOrganization()`
- creates `My Organization`
- seeds `available_tokens` with `DEFAULT_AVAILABLE_TOKENS` (`2000`)
- sets the new org as the user's `current_organization_id`
Optional default AI teammate
- Builder reads system setting `onboarding_employee_id`.
- If the setting points to a valid system AI teammate, that teammate is cloned into the new org.
Ally welcome bootstrap
- The builder resolves the new user's personal Ally employee in the new org with `AiEmployeeService.findUserAllyEmployee(organizationId, user.id)`.
- If that personal Ally employee exists, the backend:
- creates or restores the user's employee-chat-backed Ally conversation for the new org
- inserts a completed AI welcome message
- updates the conversation last-message summary so it appears immediately in history
- The current seeded welcome message is:
```text Welcome — I’m Ally.
I can help you get started and support you as a personal assistant across your work.
You have a few welcome AI credits to get started. You can connect your favorite LLM provider in Settings, including your ChatGPT subscription.
Tell me the first job you want done — from support and onboarding to drafting, ops, or anything else on your mind.
Or we can start with a quick chat about how I can help. ```
First redirect after signup
- New users who enter the non-invite onboarding flow are redirected to `/onboarding?onboarding=true` when an organization is available; otherwise they go to `/`.
- The page is also available later from the user menu under `Getting started`.
Workspace setup
- `Welcome to Alloy` asks `What do you want to build?`. The `Start with Ally` choices are `Automate a task`, `Build a dashboard`, and `Build a sales CRM`. Each opens Ally with an editable prompt in the composer; it does not send the message or create anything automatically. The CRM prompt asks Ally to help build linked Companies, People, Deals, and Tasks, a pipeline board, and a dashboard with follow-ups. If Ally cannot be loaded, the page offers `Try again`.
- Under `Set up your AI`, `Connect LLM Provider` links admins to `Connect an AI provider` in organization settings for API-key or Codex account setup. Other users are asked to contact an admin.
- `Connect your own agent` offers `Codex`, `Claude Code`, and `Other`. `Create agent token` opens a dialog with the Personal Ally Hosted MCP token configuration. `Copy setup instructions` copies instructions for the selected client, separately from the credential. See [Hosted MCP](hosted-mcp.md) and [Work with Alloy plugin](work-with-alloy-plugin.md).
Invite route (`/invite/[code]`)
- Page bootstrap:
- loads invite metadata from `GET /api/invites/{code}`
- shows one of:
- guest invite view
- authenticated accept view
- already-in-organization view
- not-found state
- Guest behavior:
- `Sign in with Google` starts OAuth with `state: { inviteCode: code }`
- the guest view warns that sign-in will automatically accept the invite
- OAuth callback behavior with an invite code:
- backend tries `AcceptInviteProcessor` immediately
- on success, callback returns redirect `/`
- on handled invite failure, callback redirects back to `/invite/{code}`
- Authenticated behavior on the invite page:
- `Accept Invite` calls `GET /api/invites/{code}/accept`
- accepted invites redirect to `/`
- `already_in_organization` shows `Go to Dashboard`
Support notes
- Landing on `/` after self-serve signup usually means the onboarding redirect did not receive an organization ID.
- Missing Ally welcome usually means the user's personal Ally employee was not created or could not be resolved in the new org.
- If `?onboarding=true` is present and Ally does not auto-open after load, treat that as unexpected.
- Invite acceptance always switches the user's current organization to the invited org.