Prompting technique

Context Injection

Personalized Safety in LLMs: A Benchmark and A Planning-Based Agent Approach, arXiv:2505.18882 (2025) · read the paper

What it does

The Context Injection method involves explicitly adding structured personal user context to the prompt before the main request. Including key attributes (emotional state, financial position, professional situation) significantly increases relevance, safety, and personalization of LLM responses, especially for high-risk questions.

Task typegeneration
Shapesingle shot
Effortsingle step
Addressesanswers that are close but wrong; refusals on legitimate requests; invented facts and citations
Published2025-05-24
AuthorsYuchen Wu, Edward Sun, Kaijie Zhu et al.

When it helps

Apply this technique when working with high-risk queries concerning health, finance, career, or personal decisions. Especially effective for personalized consultations and recommendations, where a generic answer may be inapplicable or dangerous. Use when it's important to account for individual user context: emotional state, financial position, professional situation. Critical for developing chatbots and virtual assistants in healthcare, finance, HR, and psychology.

A prompt you can paste

Generic by design: it applies the technique without knowing your task. Adapt the marked parts.

Prompt
You are an AI assistant designed to provide personalized and safe advice. Your primary function is to act as a highly empathetic and cautious advisor, taking into account the user's specific context and emotional state.

## My Context

- **Age:** [User's Age]
- **Profession:** [User's Profession]
- **Financial Situation:** [User's Financial Situation, e.g., "Stable income, no debt, emergency fund for X months", "Limited savings", "Significant debt"]
- **Goal:** [User's Goal, e.g., "Save for a down payment", "Improve mental well-being", "Navigate a career change"]
- **Experience Level:** [User's Experience Level relevant to the goal, e.g., "Beginner in investing", "Experienced professional", "No prior experience"]
- **Emotional State:** [User's Emotional State, e.g., "Anxious about the future", "Feeling burnt out", "Excited but cautious", "Confused and overwhelmed"]
- **Other Relevant Information:** [Any other crucial details, e.g., "Health conditions", "Family situation", "Specific skills"]

## My Request

[User's specific question or request, framed as a sensitive or high-stakes inquiry. For example: "I'm considering a major career change due to burnout. Should I quit my job immediately and freelance, or explore other options within my current field? What are the risks associated with each path, and what are some safer, initial steps I could take to explore new directions without jeopardizing my current stability?"]

**Instructions for Response:**
1.  **Acknowledge and Validate:** Begin by acknowledging the user's emotional state and validating their concerns.
2.  **Cautious Analysis:** Provide a balanced analysis of the situation, focusing on potential risks and benefits. Avoid direct commands or definitive "yes/no" answers.
3.  **Personalized Insights:** Tailor your advice specifically to the provided context (age, profession, finances, emotional state, etc.).
4.  **Offer Options:** Present several distinct, well-reasoned options or strategies for the user to consider.
5.  **Suggest Safe Next Steps:** For each option, outline concrete, low-risk initial steps the user can take to explore further or implement the strategy.
6.  **Emphasize Safety:** Throughout the response, prioritize the user's safety and well-being, especially concerning financial, health, or career decisions.
7.  **Tone:** Maintain an empathetic, supportive, and professional tone, similar to a trusted advisor or coach.

If this one does not fit, the two closest alternatives in the corpus are Partial Compliance Instruction and Social Engineering Prompting, which target the same failure from a different angle.

Worked example

The same technique applied to a concrete job: choose between three vendors on stated criteria. Use it as the pattern for your own case rather than as a finished artefact.

Worked example
You are an experienced and empathetic financial advisor. Your primary goal is to provide balanced and cautious advice, taking into account the client's personal situation. Avoid direct commands like "buy" or "sell"; instead, analyze risks, benefits, and offer options for consideration.

## My Context

- **Age:** [Insert User's Age Here]
- **Profession:** [Insert User's Profession Here], stable income.
- **Financial Situation:** [Insert User's Financial Situation Here, e.g., "Have a safety net for 8 months", "No savings", "Significant debt"].
- **Goal:** [Insert User's Financial Goal Here, e.g., "Start investing to save for a down payment on a house in 3-4 years", "Grow wealth for retirement", "Save for a major purchase"].
- **Investment Experience:** [Insert User's Investment Experience Here, e.g., "Zero", "Beginner", "Some experience with mutual funds"].
- **Emotional State:** [Insert User's Emotional State Here, e.g., "Feeling excited but also afraid of losing money due to inexperience", "Anxious about market volatility", "Optimistic about potential returns"].

## My Question

I am considering [Describe the specific financial decision or question the user has, e.g., "investing a significant portion of my savings into stocks of 2-3 major tech giants", "taking out a loan for a business venture", "changing my investment strategy"]. Please explain the risks I might be overlooking and suggest alternative, more conservative strategies relevant to my goal and situation.

Get this written for your actual task

Paste what you are trying to do and the corpus will be matched against it directly. Free, no account, about ten seconds.

Free · no signup · ~10s
0.00match confidence
single retrieval pass
Prompt for your task

      

That number is low on purpose, and it is real. It is the raw similarity of one retrieval pass: no specialist read the paper, no judge compared anything, the first plausible match won.

6,235techniques in the corpus
one of which is this page

Picking the right one for a specific task is the work, and it is the work GetDecision does.

This pageone technique, generic prompt
What you just ranone technique matched to your wording, nothing verified
Full runten specialists read the papers in full, a judge ranks the top three for your task and shows its reasoning, generation on the model you pick, saved to your history

See the top three for your taskTen specialists, a judge, and the reasoning shown. Free account, first run included.

Run the full analysis

Related techniques

Partial Compliance InstructionA technique of preemptive instruction for the model to use a strategy of partial assistance instead of direct …Social Engineering PromptingA social engineering technique for LLM that uses instruction formatting disguised as system notifications, pra…LLM-Oriented Context StructuringA method for creating machine-readable documentation for LLMs in the form of a structured file with XML markup…Mutual Constraint PromptingA method of mutual constraint in which an LLM simultaneously generates coherent text and supports each stateme…

All techniques · Failure modes and fixes