Skip to content

fix(onboarding): seed role-aware agents from the segment answer - #1170

Draft
keithdmonte wants to merge 4 commits into
gethouston:mainfrom
keithdmonte:fix/onboarding-segment-role-aware-seeds
Draft

fix(onboarding): seed role-aware agents from the segment answer#1170
keithdmonte wants to merge 4 commits into
gethouston:mainfrom
keithdmonte:fix/onboarding-segment-role-aware-seeds

Conversation

@keithdmonte

Copy link
Copy Markdown

Demo

Demo URL: TODO — to be added

Bug

The first-run segment answer is persisted (engine pref + local mirror) and sent to PostHog, but never reaches seeding. use-create-assistant always calls buildPersonalAssistantSeeds (the generic Daily Briefing + Meeting-prep), so every user gets the same assistant no matter what role they picked.

Prior art

Checked all remote branches and open PRs. Nothing touches this — the two open onboarding-* branches (fix-onboarding-i18n-and-stuck-waiting, onboarding-posthog-funnel-zeros) modify none of the files here.

Fix

Map each onboarding segment to an existing store/agents pack, with a generic fallback otherwise. The mapped path loads the pack's CLAUDE.md + skills/routines via the same loadStoreTemplate payload the New Agent picker already installs. 6 segments become role-aware, 6 stay generic:

Segment Pack
marketing marketing
legal legal
operations operations
people_hr people
finance bookkeeping
sales sales
product, engineering, student, design, data_science, something_else generic

Safety

  • Generic fallback is byte-identical to current behaviour (same buildAssistantInstructions + buildPersonalAssistantSeeds(t, i18n.language)), so unmapped/skipped users are never left worse off.
  • Unit tests cover all 12 segments plus skipped/undefined/null/unknown.
  • The host writes the same structure either path ({ claudeMd, seeds: Record<string,string> }); only the seeded content differs.

Not runtime-tested

Cloud repo is private and there's no Firebase key locally, so this was not run in the app. Typecheck (tsgo --noEmit) and Biome are clean; the mapping unit tests pass.

🤖 Generated with Claude Code

keithdmonte and others added 4 commits July 31, 2026 16:31
The first-run segment answer was stored but never reached seeding:
use-create-assistant always called buildPersonalAssistantSeeds (generic
Daily Briefing + Meeting-prep) regardless of the role the user picked.

Wire the segment through so seeding is role-aware. A new
segment-agent-pack map routes each segment to a first-party store pack
(marketing, legal, operations, people, bookkeeping, sales) and the
onboarding create loads that pack's CLAUDE.md + skills/routines via the
same loadStoreTemplate path the New Agent picker uses. Segments with no
matching pack (product, engineering, student, design, data_science,
something_else) and a skipped answer fall back to the generic assistant,
so a user is never left worse off than before.

The host ignores configId (it writes exactly claudeMd + seeds), so no
other plumbing changes; the locale still selects the translated pack
variant.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Unit-tests agentPackForSegment over all 12 segments plus the
skipped/undefined/null/unknown fallbacks, and pins SEGMENT_AGENT_PACK to
an independently-spelled expected map so a silent edit can't regress it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The founder's requirement is "a set of agents", but each store pack is a
single agent, so mapping a segment to one pack only seeded one. Map each
segment to an ARRAY of packs and create one agent per pack.

- SEGMENT_AGENT_PACK now maps segment -> string[] (packs in seed order).
- The first pack seeds the primary onboarding assistant (unchanged path);
  the remaining packs become their own first-party store agents via the
  new seedExtraPackAgents, created the same way the New Agent picker does.
- Extra-agent seeding runs in the background (never gates the email step)
  and is idempotent by configId, so a retried/re-mounted first-run never
  hits the engine's dup-name conflict.
- Unmapped/skipped segments still fall back to the generic assistant,
  byte-identical to before.

The two seed helpers moved to assistant-segment-seeds.ts to keep
use-create-assistant.ts under the 200-line cap. Unit tests updated to the
array shape and assert every mapped segment ships a set (>= 2 agents).

Segment -> packs:
  marketing  -> [marketing, outbound]
  sales      -> [sales, outbound]
  operations -> [operations, support]
  people_hr  -> [people, operations]
  finance    -> [bookkeeping, operations]
  legal      -> [legal, operations]

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
When a segment maps to packs, the first pack now IS the primary onboarding
agent — it carries that pack's catalog identity (name, and via configId its
icon + description) instead of wearing the generic assistant name. The rest
of the create path is unchanged.

- create-personal-assistant accepts an optional configId (defaults to the
  generic personal assistant), so the primary agent's AgentConfig — hence
  its icon/description — is the pack's own.
- assistant-segment-seeds returns a PrimaryAssistantSpec { name, configId,
  instructions, seeds }: the pack's catalog name + id when role-seeded, the
  generic identity otherwise. Unmapped/skipped stays byte-identical.
- Tests assert every referenced pack exists in the catalog with a name +
  icon, and that each mapped segment's primary pack resolves to a full
  catalog identity (name + icon + description).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant