DEV Community

Cover image for ๐Ÿš€ How I Created an AI-Powered Secret Santa Using Cognee as the Memory Layer
Pravesh Sudha
Pravesh Sudha Subscriber

Posted on

๐Ÿš€ How I Created an AI-Powered Secret Santa Using Cognee as the Memory Layer

Welcome Devs ๐Ÿ‘‹ โ€” Another Fun Build with Cognee + AI

Welcome Devs to another interesting blog from my side!

Itโ€™s been a while since I first connected with Cognee, and exactly a month ago I actually built a Cognee Starter application from scratch using Flask and deployed it on AWS ECS using Terraform. If you havenโ€™t checked it out yet, hereโ€™s the link to that build โ€” youโ€™ll enjoy it:

Since then, the Cognee team has been on fire. Their GitHub repo recently crossed 10K+ stars (absolutely deserved ๐ŸŽ‰). And staying true to the momentum, they came up with a fun little community event โ€” the Secret Santa Mini Challenge.

Soโ€ฆ for this challenge, I decided to build something a bit unique โ€”

โœจ An Emotion-Aware Secret Santa powered by Gemini 2.5 Flash, with Cognee acting as the memory layer holding everything together.


How the Idea Hit Me ๐Ÿคฏ โ€” And Why Emotions Matter in Secret Santa

After going through the rules and criteria of the challenge, I started brainstorming ideasโ€ฆ and suddenly something clicked on a very personal level.

In my friend group, Iโ€™m the delightful one โ€”

Happy for no absolute reason, just vibing, giggling, randomly remembering something from Kevin Hart Special ๐Ÿ˜‚

But my friends?

Total opposite personalities:

  • One is stressed 24/7 because of career pressure

  • Another is moody, unpredictable like Mumbai weather

  • And the last one is the chill guy, relaxed in literally every situation

Reflecting on that, I thought:

Why not create a Secret Santa that understands emotions the same way we understand each other?

A Secret Santa that:

  • Reads how each friend is feeling

  • Understands their energy, mood, and stress

  • Pairs them up based on emotional compatibility

  • And even helps choose a meaningful gift

Thatโ€™s how Emotion-Aware Secret Santa was born.


How It Works ๐Ÿง ๐ŸŽ โ€” Turning Feelings Into Smart Gift Matches

Each friend gives:

  • Their name, and

  • A short description of their mood, week, stress level, or personality

For example:

  • โ€œAlice is overwhelmed with work and feeling stressed.โ€

  • โ€œBob had a great week and is feeling positive and energetic.โ€

These tiny descriptions become the foundation for the AIโ€™s reasoning.

๐Ÿงฉ Step 1 โ€” Storing the emotional descriptions with Cognee

Each user description is added into Cogneeโ€™s memory layer using:

cognify.add(...)
Enter fullscreen mode Exit fullscreen mode

Then using:

cognify()
Enter fullscreen mode Exit fullscreen mode

Cognee processes all the data with Gemini, building:

  • Semantic links

  • Entities

  • Relationships

  • A mini knowledge graph

  • Embeddings

(Iโ€™ve shown this visually in my previous video โ€” itโ€™s super cool to watch.)

๐Ÿง  Step 2 โ€” Cognee asks the right question

Cognee then asks:

โ€œWhat is the emotional state or mood of Alice?โ€

Using RAG_COMPLETION, Gemini returns refined emotional states like:

  • stressed

  • excited

  • lonely

  • happy

  • tired

๐ŸŽ… Step 3 โ€” AI-Powered Secret Santa Pairing

Now the fun logic:

  • Cognee assigns Secret Santa pairs

  • Makes sure no one gets themselves

  • And suggests a gift based on emotion

Gift suggestions are generated using a local gift dictionary (0 extra AI costโ€ฆ because while testing I hit the Gemini daily quota twice ๐Ÿ’€๐Ÿ˜‚).

๐ŸŽ‰ Step 4 โ€” The Big Reveal

Finally, the program prints a beautiful Secret Santa reveal:

  • Who is gifting whom

  • Why they were paired

  • And what gift matches their emotional state

Simple, wholesome, and powered by Cogneeโ€™s memory + Geminiโ€™s reasoning.


Try It Yourself ๐ŸŽ„ โ€” Run the Emotion-Aware Secret Santa on Your Machine

Iโ€™ve open-sourced the entire project so you can explore, modify, and have fun with it.

The code is available here:

๐Ÿ‘‰ GitHub Repo: https://github.com/Pravesh-Sudha/secret-santa-cognee

Clone it to your system and youโ€™re ready to get started.

๐Ÿ”‘ Step 1 โ€” Get Your Gemini API Key

To run this project, youโ€™ll need a Gemini API key.

The good news? Google AI Studio gives you one for free.

Once you have your key:

  1. Inside the project directory, create a .env file

  2. Copy everything from .env.example

  3. Replace the values of:

* `LLM_API_KEY`

* `EMBEDDING_API_KEY`  
    with your Gemini key
Enter fullscreen mode Exit fullscreen mode

And boom โ€” the setup is done.

๐Ÿ”ง Step 2 โ€” Install Dependencies

Inside your project directory, run:

uv sync
Enter fullscreen mode Exit fullscreen mode

This will install all required dependencies cleanly.

๐Ÿ“ Step 3 โ€” Customise Your Friends & Gifts

You can now explore the code and make the project your own:

๐Ÿ‘ฅ Add your own friends

Open:

data/friends.json
Enter fullscreen mode Exit fullscreen mode

Add your friends and their mood descriptions.

(Tip: try to keep it max 4 friends, otherwise you may hit the Gemini daily quota like I did ๐Ÿ˜ญ๐Ÿ˜‚)

๐ŸŽ Customise the gifts

Inside:

gift_gen.py
Enter fullscreen mode Exit fullscreen mode

You can update gifts for each emotion to make them more fun, personal, or chaotic โ€” your call.

โ–ถ๏ธ Step 4 โ€” Run the Project

Once everything is set up, run:

uv run main.py
Enter fullscreen mode Exit fullscreen mode

The program takes around 2โ€“3 minutes, and thenโ€ฆ

๐ŸŽ‰ You get a full Secret Santa reveal right in your terminal!

  • Who got whom

  • Their emotional reasoning

  • And the perfect gift suggestion

All powered by Cognee + Gemini.

NOTE: Initially, I planned to generate gifts using Gemini tooโ€ฆ but Geminiโ€™s โ€œRequests per Minuteโ€ limit looked at me and said:
โ€œNot today, brother.โ€
So I switched to a local gift list โ€” zero extra AI cost, much more reliable.


๐Ÿ“ฝ๏ธ Video Demonstration


๐ŸŽ„ Conclusion โ€” Building with Cognee Is Just Too Much Fun

This Secret Santa Mini Challenge by Cognee was the perfect excuse to experiment, break things, fix things, hit API limits twice ๐Ÿ˜ญ, and eventually build something that felt genuinely personal.

Using Cognee as the memory layer + Gemini 2.5 Flash for reasoning turned a simple holiday tradition into a small emotionally aware AI system โ€” and honestly, thatโ€™s the kind of playful innovation that makes me love building these projects.

If you try it out, tweak it, or turn it into something wild and creative, Iโ€™d genuinely love to see it.

And big shoutout to the Cognee team for organizing such a wholesome challenge and continuing to ship amazing updates to the ecosystem.

More AI projects, more experiments, and more community fun coming soon.

Till then โ€” keep building, keep learning, and keep vibing. โœจ

๐ŸŒ Connect With Me

If you enjoyed this project or want to follow my DevOps + AI journey, find me here:

See you in the next build! ๐Ÿš€

Top comments (4)

Collapse
 
nadinev profile image
Nadine

The only gifts my friends will get from me are 50% AI-generated, 50% copy-pasting the prompt I wrote :)

Collapse
 
pravesh_sudha_3c2b0c2b5e0 profile image
Pravesh Sudha

And they will be the good one too!

Collapse
 
hande_kafkas_16805c7d4eab profile image
Hande Kafkas

thanks for sharing Pravesh! love the creativity!

Collapse
 
pravesh_sudha_3c2b0c2b5e0 profile image
Pravesh Sudha

๐Ÿ˜Š