fix(onboarding): seed role-aware agents from the segment answer - #1170
Draft
keithdmonte wants to merge 4 commits into
Draft
fix(onboarding): seed role-aware agents from the segment answer#1170keithdmonte wants to merge 4 commits into
keithdmonte wants to merge 4 commits into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-assistantalways callsbuildPersonalAssistantSeeds(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/agentspack, with a generic fallback otherwise. The mapped path loads the pack'sCLAUDE.md+ skills/routines via the sameloadStoreTemplatepayload the New Agent picker already installs. 6 segments become role-aware, 6 stay generic:marketinglegaloperationspeoplebookkeepingsalesSafety
buildAssistantInstructions+buildPersonalAssistantSeeds(t, i18n.language)), so unmapped/skipped users are never left worse off.{ 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