This prompt solves a narrow but high-stakes routing problem: the first user message of a session. A user who types 'hello' should not trigger a task workflow. A user who types 'I need to reset my password' should not receive a social greeting. And a user who types 'Hi, can you help me with my bill?' requires both acknowledgment and task routing. Misclassification at session start cascades into wrong system behavior, wasted tool calls, and broken user experience. Use this prompt when you need a deterministic classification of greeting, task, or mixed intent before your session router commits to a downstream workflow. It assumes the input is the first turn of a conversation and that no prior session context exists.
Prompt
Greeting vs Task Detection Prompt for Session Start

When to Use This Prompt
Defines the narrow, high-stakes routing problem this prompt solves and the conditions required for safe deployment.
This prompt is designed for conversational AI engineers and platform builders who need a reliable, low-latency classification step at the ingress layer. The ideal deployment context is a session-initialization middleware where the output of this prompt directly controls which downstream workflow, agent, or response template is invoked. The prompt expects a single user message as input and returns a structured classification with a recommended system action. It is not designed for multi-turn conversations, ongoing dialogue management, or scenarios where user identity and history should influence routing. If your system already has conversation history, pair this with a follow-up vs new intent detector instead.
Do not use this prompt when the input could contain multiple distinct tasks that require parallel processing, when the user's identity or account tier should influence routing, or when the downstream workflow requires parameter extraction beyond simple intent classification. This prompt is a routing primitive, not a full intent parser. For compound requests, use a multi-intent disambiguation prompt. For workflows requiring extracted entities, chain this prompt's output to a dedicated extraction step. Always validate the output against your expected taxonomy before committing to a downstream action, and monitor for the most common failure mode: casual openers containing embedded tasks that get classified as pure greetings.
Use Case Fit
Where the Greeting vs Task Detection prompt works, where it breaks, and the operational conditions required before deploying it at the session start boundary.
Good Fit: Conversational Session Starters
Use when: the system must decide whether to respond socially to a greeting or immediately route a task. This prompt excels at the first-turn classification problem where misrouting a casual 'hello' into a task workflow creates a broken user experience. Guardrail: deploy this prompt only at the session start boundary; reuse the classification decision for the entire session until a topic-shift detector fires.
Bad Fit: Mid-Conversation Routing
Avoid when: the user is deep in a multi-turn task and sends a message like 'thanks, that worked.' This prompt will over-classify social language and may reset the routing state incorrectly. Guardrail: use a follow-up vs. new-intent detector for mid-conversation turns. Reserve greeting detection for session-initialization logic only.
Required Inputs: Session State Context
Risk: classifying a message without knowing whether it is the first turn produces false greeting classifications on mid-session politeness. Guardrail: always inject a session_turn_count or is_session_start boolean into the prompt context. If the turn count is greater than zero, skip greeting classification entirely and route directly to intent detection.
Operational Risk: Mixed Intent Misrouting
Risk: users often blend social language with actionable requests, such as 'Hey, can you help me reset my password?' A binary greeting/task classifier will either miss the task or respond with a social-only reply. Guardrail: include a 'mixed' classification label in the output schema and route mixed inputs to task handling with an optional social acknowledgment prepended by the application layer, not the prompt.
Operational Risk: Cultural Greeting Variance
Risk: greeting patterns vary across languages and cultures. A prompt tuned on English 'hello' and 'hi' will misclassify formal greetings, regional variants, or verbose polite openers as tasks. Guardrail: maintain a locale-aware greeting lexicon in the application layer and pass detected locale as context. Run regression tests with non-English and cross-cultural greeting corpora before deployment.
Operational Risk: Silent Misclassification in Production
Risk: when the prompt misclassifies a task as a greeting, the user receives a social reply instead of help. This failure mode is silent—no error is thrown, but the user experience degrades. Guardrail: log every greeting classification with the raw input and the downstream action taken. Set up a monitoring dashboard that tracks greeting-to-task ratios and alerts on anomalous spikes that indicate classification drift.
Copy-Ready Prompt Template
A copy-ready prompt template for classifying the first user message of a session as greeting, task, or mixed intent.
This prompt template is designed to be the first classification gate in a conversational AI session. It analyzes the initial user message and determines whether the user is simply greeting the system, immediately issuing a task, or blending social language with an actionable request. The output is a structured JSON object that downstream routing logic can use to decide whether to respond with a welcome message, proceed directly to task execution, or acknowledge the greeting before prompting for the task. The template uses square-bracket placeholders for all variable inputs, making it straightforward to integrate into any prompt assembly pipeline.
textSystem: You are a session-start intent classifier. Your only job is to analyze the first user message of a conversation and classify it as one of three types: greeting, task, or mixed. You must return a valid JSON object and nothing else. [CONTEXT] Classification Definitions: - greeting: The user is only saying hello, starting a conversation, or making small talk with no actionable request. Examples: "Hi", "Hello there", "Good morning", "Hey, how are you?" - task: The user is directly asking for something to be done, providing a command, or making a request with no social preamble. Examples: "What's the weather in Tokyo?", "Summarize this document", "Set a timer for 10 minutes" - mixed: The user combines a social greeting with an actionable request in the same message. Examples: "Hi, can you help me write an email?", "Good morning! I need a report on Q3 sales" [INPUT] User Message: [USER_MESSAGE] [OUTPUT_SCHEMA] { "classification": "greeting" | "task" | "mixed", "confidence": 0.0-1.0, "rationale": "Brief explanation of the classification decision", "recommended_action": "respond_with_greeting" | "execute_task" | "acknowledge_and_prompt" } [CONSTRAINTS] - Return ONLY the JSON object. No markdown fences, no surrounding text. - If the message contains only a greeting word or phrase, classify as greeting. - If the message contains only a task or question, classify as task. - If the message contains both a greeting and a task, classify as mixed. - If the message is ambiguous, classify as task and set confidence below 0.7. - Never classify an empty or whitespace-only message as task; classify as greeting with low confidence.
To adapt this template for your application, replace the [USER_MESSAGE] placeholder with the actual first turn of the user session. The [CONTEXT] placeholder can be extended with domain-specific examples, such as common greetings in your application's language or typical task phrasings your system handles. If your system has a predefined set of task categories, you can add a [TASK_TAXONOMY] placeholder to help the model distinguish between greetings and domain-specific tasks. For high-stakes routing where misclassification could lead to a poor user experience, add a [RISK_LEVEL] parameter that adjusts the confidence threshold for the mixed classification, and ensure your harness logs the rationale field for debugging classification drift over time.
Prompt Variables
Required inputs for the Greeting vs Task Detection prompt. Each placeholder must be populated before inference. Validation notes describe how to verify the input is well-formed and safe.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[USER_MESSAGE] | The raw first-turn user input to classify | Hey there! I need help resetting my password. | Non-empty string. Max 4096 chars. Reject if null or whitespace only. |
[SESSION_HISTORY] | Prior turns in the conversation, if any exist | [] | Valid JSON array of {role, content} objects. Empty array for first turn. Reject if malformed JSON. |
[GREETING_DEFINITION] | Operational definition of a greeting for the classifier | A social opener with no actionable request for system assistance. | Non-empty string. Must be reviewed and approved. Changes require regression test re-run. |
[TASK_DEFINITION] | Operational definition of a task for the classifier | An explicit or strongly implied request for the system to perform an action or provide information. | Non-empty string. Must be reviewed and approved. Changes require regression test re-run. |
[MIXED_DEFINITION] | Operational definition of a mixed input | Contains both a social opener and an actionable request. | Non-empty string. Must be reviewed and approved. Changes require regression test re-run. |
[OUTPUT_SCHEMA] | JSON schema the model must conform to | {"type": "object", "properties": {"classification": {"enum": ["greeting", "task", "mixed"]}, "action": {"enum": ["respond_socially", "execute_task", "acknowledge_and_execute"]}, "rationale": {"type": "string"}}, "required": ["classification", "action", "rationale"]} | Valid JSON Schema draft-07 or later. Parse check required. Reject if schema does not include required fields. |
[FEW_SHOT_EXAMPLES] | Curated examples demonstrating each classification | [{"input": "Hi!", "output": {"classification": "greeting", "action": "respond_socially", "rationale": "Pure social opener."}}, {"input": "What are your hours?", "output": {"classification": "task", "action": "execute_task", "rationale": "Direct information request."}}] | Valid JSON array. Minimum 3 examples covering greeting, task, and mixed. Reject if any example has a classification not in [OUTPUT_SCHEMA] enum. |
[CONFIDENCE_THRESHOLD] | Minimum confidence score for automated routing | 0.85 | Float between 0.0 and 1.0. Values below 0.7 trigger human review fallback. Reject if not a number. |
Implementation Harness Notes
How to wire the greeting vs task detection prompt into a session-start routing middleware with validation, retries, and fallback logic.
This prompt is designed to sit at the ingress point of a conversational AI system, immediately after a user sends their first message in a session. The implementation harness should treat this as a synchronous classification step that blocks downstream routing until a decision is returned. The prompt expects a single user message as input and produces a structured JSON classification. The harness must validate that the output conforms to the expected schema before allowing the session to proceed to either a greeting handler, a task handler, or a mixed-intent clarification flow. Because this classification controls which tools, models, and policies are loaded for the remainder of the session, a misclassification at this stage is expensive—it can route a task-bearing message to a casual chit-chat model that lacks tool access, or send a simple 'hello' through an expensive agent pipeline with unnecessary function calls.
Wire the prompt into your application as a pre-routing middleware function. On session start, extract the user's first message and inject it into the [USER_MESSAGE] placeholder. Set a strict timeout of 500-800ms for the classification call; if the model does not respond within that window, fall back to a conservative 'greeting' classification to avoid blocking the user experience. Validate the JSON response against the expected schema: classification must be one of greeting, task, or mixed; confidence must be a float between 0.0 and 1.0; recommended_action must be one of respond_with_greeting, route_to_task_handler, or clarify_and_route. If validation fails, log the raw response for debugging and retry once with a stricter prompt variant that emphasizes schema compliance. If the retry also fails, escalate to a human review queue and respond to the user with a generic 'How can I help you today?' message to avoid a dead session. For high-traffic systems, cache the classification result in the session object so downstream handlers can reference it without re-classifying.
Model choice matters here. Use a fast, cost-efficient model for this classification step—GPT-4o-mini, Claude Haiku, or a fine-tuned small classifier are appropriate. Do not route this prompt to a large reasoning model; the latency and cost are unjustified for a binary-to-ternary classification task. Implement logging that captures the user message, the classification output, the validation result, and the final routing decision in a structured format. This log becomes your evaluation dataset for measuring misclassification rates over time. Set up a weekly review of sessions where the classification was greeting but the user's second message contained a task—these are false negatives that indicate the prompt is missing task-bearing language disguised as social openers. Conversely, monitor sessions classified as task where the user responded with 'just saying hi'—these false positives waste compute and create awkward user experiences. Both failure modes should trigger a review of the prompt's examples and potentially an update to the few-shot demonstrations.
Expected Output Contract
The model must return a JSON object with exactly these fields. Any deviation triggers a validation failure and should be handled by the application layer's repair or retry logic.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
classification | enum string | Must be exactly one of: greeting, task, mixed. Case-sensitive check. | |
confidence | number | Must be a float between 0.0 and 1.0 inclusive. Parse check; reject if out of range. | |
evidence_spans | array of strings | Each string must be a verbatim substring from [USER_INPUT]. Schema check for array type; null not allowed. | |
detected_greeting | string or null | If classification is greeting or mixed, must contain the extracted greeting text. If task, must be null. Conditional null check. | |
detected_task | string or null | If classification is task or mixed, must contain the extracted task description. If greeting, must be null. Conditional null check. | |
recommended_action | enum string | Must be exactly one of: respond_with_greeting, execute_task, clarify_intent. Case-sensitive check. | |
clarification_question | string or null | Required if recommended_action is clarify_intent; otherwise must be null. Conditional null check. | |
reasoning | string | Optional brief explanation of the classification decision. No validation rule enforced; used for debugging. |
Common Failure Modes
What breaks first when classifying session-opening messages and how to prevent misrouting before it reaches downstream workflows.
Casual Greetings Misclassified as Tasks
What to watch: 'Hey there' or 'Good morning' gets labeled as a support_request or general_inquiry, triggering unnecessary tool calls and workflow dispatch. Guardrail: Add a dedicated greeting class with a confidence threshold. If greeting confidence exceeds 0.85, route to a lightweight welcome handler that waits for the actual task.
Embedded Tasks Inside Social Language
What to watch: 'Hi, hope you're doing well! I need to reset my password' gets classified as a greeting-only message, dropping the actionable request. Guardrail: Always scan the full message for task indicators after detecting social openers. Use a mixed-intent classification that extracts both greeting and task spans, then route on the task.
Over-Triggering on Single Keywords
What to watch: A message containing 'help' in a casual context ('help me understand this') triggers an escalation workflow designed for crisis support. Guardrail: Require multi-signal confirmation for high-stakes intents. Combine keyword detection with syntactic analysis and context window review before routing to escalation paths.
Empty or Whitespace-Only Inputs
What to watch: Blank messages, whitespace-only strings, or attachment-only inputs with no text produce hallucinated intent labels or default to the most common training class. Guardrail: Add a pre-classification input validation layer that returns a no_content label with a prompt for the user to provide input. Never let empty inputs reach the classifier.
Confidence Score Calibration Drift
What to watch: The classifier consistently returns 0.95+ confidence for greetings but 0.60 for complex tasks, causing uneven routing thresholds and missed escalations. Guardrail: Monitor per-class confidence distributions in production. Set class-specific thresholds rather than a single global cutoff. Recalibrate when distributions shift.
Multi-Turn Context Confusion
What to watch: A follow-up message like 'also, what about billing?' gets classified as a new greeting because the classifier lacks conversation history. Guardrail: Inject the prior turn's classification and a session state summary into the prompt context. Use a follow-up vs new-intent check before running the greeting/task classifier on subsequent messages.
Evaluation Rubric
Criteria for evaluating the Greeting vs Task Detection Prompt before production deployment. Each row defines a pass standard, a failure signal, and a concrete test method to catch misrouting errors.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Greeting Classification Accuracy | Classifies 'Hi', 'Hello', 'Good morning' as 'greeting' with confidence >= 0.9 | Classifies a simple greeting as 'task' or 'mixed' | Run a golden set of 50 casual greetings; assert label is 'greeting' and confidence >= 0.9 |
Task Classification Accuracy | Classifies 'Reset my password', 'Show me Q3 report' as 'task' with confidence >= 0.9 | Classifies an explicit task request as 'greeting' or 'mixed' | Run a golden set of 50 direct task requests; assert label is 'task' and confidence >= 0.9 |
Mixed Input Detection | Classifies 'Hey, can you pull up the sales numbers?' as 'mixed' with confidence >= 0.8 | Classifies a greeting + task input as 'greeting' only or 'task' only | Run 20 inputs containing both social and task language; assert label is 'mixed' |
Actionable Task Embedded in Social Language | Extracts the task payload from 'mixed' inputs without dropping the request | Outputs a greeting response only, ignoring the embedded task | For each 'mixed' input, assert [TASK_PAYLOAD] is not null and contains the actionable request |
Recommended System Action Correctness | Returns 'respond_with_greeting' for greeting, 'execute_task' for task, 'acknowledge_and_execute' for mixed | Returns 'execute_task' for a pure greeting or 'respond_with_greeting' for a pure task | Assert [RECOMMENDED_ACTION] matches the expected action for each label in the golden set |
Confidence Score Calibration | Confidence scores correlate with classification correctness; low confidence (< 0.7) triggers a fallback or clarification path | High confidence (> 0.9) on misclassified inputs | Log confidence scores across 200 production samples; check that misclassification rate is higher in low-confidence buckets |
Empty or Whitespace Input Handling | Returns a null label or 'unclassifiable' with confidence 0.0 and no hallucinated action | Classifies empty input as 'greeting' or 'task' with non-zero confidence | Send empty string, whitespace-only string, and newline-only string; assert label is null or 'unclassifiable' and confidence is 0.0 |
Off-Topic or Gibberish Input Handling | Returns 'out_of_scope' with confidence < 0.5 and no recommended action | Classifies random characters or off-topic rants as 'task' with high confidence | Send 10 strings of random characters and 10 off-topic paragraphs; assert label is 'out_of_scope' and confidence < 0.5 |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Start with the base prompt and a simple greeting | task | mixed enum. Use a lightweight eval set of 20-30 session-opening messages. Skip confidence scores and just validate the label is one of the three allowed values.
codeClassify the user message as greeting, task, or mixed. Message: [USER_MESSAGE] Return only the label.
Watch for
- "Mixed" becoming a catch-all when the model is uncertain
- Social openers with embedded tasks ("Hey, can you help me with...") misclassified as pure greetings
- No validation that the output is exactly one of the three labels

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us