Skip to content

Conversation

@tomjtobin
Copy link

Summary

This PR adds a per-user context string that can be set via email and used when parsing incoming emails into calendar events.

Changes

  • Firestore

    • Add getUserContext(uid) and setUserContext(uid, context) helpers on the Users collection.
    • Store userContext as a string field on Users/{uid}.
  • Email flow

    • Extend understandSubject to handle subjects starting with context as a new setContext action.
    • Add setUserContextFromEmail(email, sender, uid) that:
      • Reads the previous userContext.
      • Replaces it with the email body.
      • Replies with a threaded email showing old vs new context.
      • Emits a userContextUpdated analytics event.
  • AI integration

    • In processEmail, when a uid is available:
      • Load userContext from Firestore.
      • Append a short User context section to the system prompts for both event extraction and timezone selection.
      • If context is empty or loading fails, default back to the existing prompts.

Behavior

  • A signed-up, verified user can send an email with subject starting with context and the body will become their stored context (e.g. grade/school info for a child).
  • All subsequent fwd event emails for that user will be interpreted by the AI with this context included, which can be used to filter or interpret which events are relevant.

Notes

  • No breaking changes to existing add/remove/fwd flows.
  • Firestore schema is backward compatible: userContext is an optional field on the Users document.

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