Ask HN: Building LLM apps? How are you handling user context?

2 days ago 4

I've been building stuff with LLMs, and every time I need user context, I end up manually wiring up a context pipeline.

Sure, the model can reason and answer questions well, but it has zero idea who the user is, where they came from, or what they've been doing in the app. Without that, I either have to make the model ask awkward initial questions to figure it out or let it guess, which is usually wrong.

So I keep rebuilding the same setup: tracking events, enriching sessions, summarizing behavior, and injecting that into prompts.

It makes the app way more helpful, but it's a pain.

What I wish existed is a simple way to grab a session summary or user context I could just drop into a prompt. Something like:

const context = await getContext();

const response = await generateText({ system: `Here's the user context: ${context}`, messages: [...] });

Some examples of how I use this:

- For support, I pass in the docs they viewed or the error page they landed on. - For marketing, I summarize their journey, like 'ad clicked' → 'blog post read' → 'pricing page'. - For sales, I highlight behavior that suggests whether they're a startup or an enterprise. - For product, I classify the session as 'confused', 'exploring plans', or 'ready to buy'. - For recommendations, I generate embeddings from recent activity and use that to match content or products more accurately.

In all of these cases, I usually inject things like recent activity, timezone, currency, traffic source, and any signals I can gather that help guide the experience.

Has anyone else run into this same issue? Found a better way?

I'm considering building something around this initially to solve my problem. I'd love to hear how others are handling it or if this sounds useful to you.

Read Entire Article