Inspiration
Cognee gives AI agents memory by turning your data into a knowledge graph. Its Google Calendar connector lets an agent answer questions like "what did I agree to in last week's design review?". While reading the connector for Mergetober, I noticed it keyed everything on the calendar id string you configure.
What it does
In Google Calendar your main calendar has two names: the alias "primary" and its real id, your email address. The connector's own helper script lists calendars by real id, so GOOGLE_CALENDAR_IDS=primary,[email protected] is an easy setup to end up with, and the connector then stored every event twice (gcal:primary:<id> and gcal:[email protected]:<id>). That meant double the LLM calls during cognify and duplicate facts in memory.
The fix treats both names as one calendar and keeps the first spelling configured, so existing ["primary"] setups don't change at all, and duplicates left by earlier syncs are forgotten on the next run.
How we built it
- Reused the calendar list the sync already fetches to find the primary calendar's real id (no extra API calls).
- Added
_without_primary_aliasto drop the second spelling before syncing. - Added three tests against the connector's in-memory Calendar API fake; the full suite and ruff pass on Python 3.11 and 3.13 (GitHub Actions on my fork).
- PR: https://github.com/topoteretes/cognee-community/pull/587, issue: https://github.com/topoteretes/cognee/issues/6481
Challenges we ran into
With ~500 connector proposals already filed this month, a new connector wasn't realistic, and the first bug I reported (all-day events stored one day too long, cognee#6470) was fixed by someone else within hours. So I opened the PR and the issue together for this one.
What we learned
Aliases are identity bugs waiting to happen: whenever an API gives one thing two names, anything keyed on the raw string can split it in two.
What's next
Respond to maintainer review on #587 and get it merged.
Built With
- cognee
- github-actions
- google-calendar
- python