Cosmo Docs
Desktop App

OnboardingManager

User profile, org onboarding data, memory files, and brand assets

packages/desktop/src/main/onboarding-manager.ts manages all local onboarding and memory data for the desktop app. It handles reads/writes and delegates cloud pushes to SyncManager.

Storage Layout

userData/
└── cosmo-data/
    ├── users/
    │   └── {userId}.json            ← UserProfile
    ├── onboarding/
    │   └── {orgId}.json             ← OrgOnboarding
    ├── memory/
    │   ├── user-{userId}.md         ← Plain-text user memory
    │   └── org-{orgId}.md           ← Plain-text org memory
    └── brand-assets/
        └── {orgId}/
            └── {fileName}           ← Logo, icon, etc.

Types

UserProfile

FieldTypeDescription
completedbooleanWhether onboarding is complete
completedAtstring | nullISO timestamp of completion
userIdstringUser ID
preferredNamestring | nullPreferred display name
rolestring | nullJob title or role
painPointstring | nullPrimary pain point extracted from onboarding
preferencesstring | nullFree-text preferences

OrgOnboarding

FieldTypeDescription
completedbooleanWhether org onboarding is complete
completedAtstring | nullISO timestamp of completion
orgIdstringOrg ID
companyNamestring | nullCompany name
industrystring | nullIndustry
teamSizestring | nullTeam size bucket
useCasestring | nullPrimary use case
brandKit{ logos: StorageRef[], primaryColor, secondaryColor, accentColor } | nullBrand assets

StorageRef

FieldTypeDescription
provider'local' | 'r2'Storage backend
bucketstringStorage bucket name
keystringObject key/path in storage
contentTypestringMIME type
sizeBytesnumberFile size in bytes

Methods

User Profile

MethodDescription
getUserProfile(userId)Read users/{userId}.json, return UserProfile | null
saveUserProfile(userId, data)Write profile JSON, then push to cloud via SyncManager

Org Onboarding

MethodDescription
getOrgOnboarding(orgId)Read onboarding/{orgId}.json, return OrgOnboarding | null
saveOrgOnboarding(orgId, data)Write onboarding JSON, then push to cloud via SyncManager

Memory

MethodDescription
getUserMemory(userId)Read memory/user-{userId}.md, return string or empty string
saveUserMemory(userId, content)Write memory file, push to cloud
getOrgMemory(orgId)Read memory/org-{orgId}.md
saveOrgMemory(orgId, content)Write org memory, push to cloud

Memory files are plain Markdown — the AI reads and writes them directly during interactions.

Brand Assets

MethodDescription
saveAsset(orgId, fileName, buffer, contentType)Write binary file to brand-assets/{orgId}/{fileName}
resolveAssetUrl(ref)Convert a StorageRef to a file:// URL the renderer can use

Reset

resetAll(orgId, userId) deletes all data for the given user+org combination: profile, onboarding, memory files, and brand assets. Called on onboarding:reset IPC.

Cloud Push

Every save* method calls the corresponding SyncManager.push*() method in the background. Pushes are fire-and-forget — local writes succeed regardless of network state.