Intent Detection Router
Purpose
The intent classifier is the first gate in the request pipeline. It determines what the user wants to do — not what topic they are asking about (that is the practice-area detector) or where (that is the jurisdiction detector). Getting intent right at this stage ensures the correct downstream skill is invoked, the correct output format is prepared, and the correct safety checks are applied.
Every incoming user message goes through this classifier. The output is consumed by [[router-complexity-grader]], [[router-practice-area-detector]], and ultimately the skill selector.
Intent Labels
Exactly one primary intent and zero or more secondary intents are assigned from this set:
drafting
User wants to generate a new document, agreement, clause, notice, letter, or other legal text from scratch or from a brief.
Signals:
- Verb "draft", "write", "create", "generate", "prepare", "make me a…"
- Named document type without an existing document pasted: NDA, MSA, lease, employment agreement, will, SHA, SAFE, MOA
- "Can you write a [document]…"
Note: a drafting request that names a known document type is high-confidence drafting even if the user does not say the word "draft". "Can you make me an NDA for my software company?" is unambiguously drafting.
review
User wants the AI to read, critique, redline, analyze, or provide comments on an existing document or clause that they have provided.
Signals:
- User pastes or attaches a document with instruction: "review", "check", "look at this", "what do you think of", "red-flag", "is this okay?"
- Verb "review", "analyze", "assess", "evaluate", "critique", "redline"
Note: if a user pastes a document without any instruction, the intent is ambiguous. Do not assume review — route to [[conversation-clarifying-questions]] to ask whether they want a review, summary, translation, or something else.
research
User is asking a legal question about a rule of law, statute, regulation, jurisdiction, case, or principle without asking the AI to produce a document or render judgment on a specific situation.
Signals:
- "What is…", "How does…", "Explain…", "What are the rules for…"
- Cites a statute number, regulation, or case and asks what it says
- Asks for a comparative overview: "How do UAE and KSA handle…"
Distinction from advice: if the question is genuinely about what the law says (not what the user should do), it is research. "What is the limitation period under UAE law?" is research. "Has my claim expired?" is advice.
summarize
User wants a shorter version of something — a document, clause, thread, judgment, or regulatory text.
Signals:
- "Summarize", "give me the key points", "TL;DR", "what does this say in plain language", "explain this in simple terms"
translate
User wants a translation of text from one language to another.
Signals:
- Explicit language pair request: "translate this to Arabic", "translate to English"
- Pastes text in one language and asks for it in another
- "What does [foreign phrase] mean in legal context"
Note: legal translation from Arabic to English or vice versa may also trigger [[review-translation-quality-ar-en]] as a secondary skill.
compare
User wants an A-vs-B analysis — comparing clauses, jurisdictions, contract versions, or regulatory regimes.
Signals:
- "Compare", "what's the difference between", "how does X differ from Y", "which is better for me"
- Two or more options explicitly stated
calculate
User wants a numerical output — a calculated deadline, end-of-service gratuity, statutory interest, notice period, or other computable result.
Signals:
- "Calculate", "compute", "how much is…", "when does [period] expire", "what is the end-of-service"
- Numbers provided (hire dates, salary, contract value) with a question about a derived quantity
advice
User is asking what they should do, whether they can do something, or what will happen in their specific situation.
Signals:
- "Can I…", "Should I…", "What happens if…", "Is this enforceable against me…", "Do I need to…"
- Describes a specific factual situation and asks for a recommended course of action
Important: advice is the highest-caution intent. It triggers the no-legal-advice disclaimer check and safety review. See [[safety-compliance-ai-not-privileged-disclaimer-us]] and related skills for handling.
Distinction from research: "Is this enforceable?" / "What should I do?" = advice. "What does Article 47 say?" = research.
admin
User is asking about billing, settings, account management, plan features, integrations, or the Louis platform itself.
Signals:
- "How do I upgrade…", "What does the Pro plan include…", "My API key…", "Can I connect this to…"
chitchat
User is engaging in small talk, greetings, or off-topic conversation with no legal task.
Signals:
- Greetings: "Hi", "Hello", "How are you"
- Off-topic: "Tell me a joke", "What's the weather like"
- Follow-up affirmations in conversation: "Thanks", "Got it", "Sounds good"
Logic — Classification Rules
- Parse the message for the primary action verb and the object of the request
- Apply the intent label whose definition best matches the action verb + object pair
- Assign secondary intents for any substantive parallel task (e.g., "draft me an NDA and explain the key clauses" → primary:
drafting, secondary: research)
- Set confidence based on: (a) clarity of the verb; (b) absence of ambiguity about what the user wants; (c) whether context is required to disambiguate
Confidence thresholds
- ≥ 0.80: high confidence; proceed with the classified intent
- 0.60–0.79: moderate confidence; classify but note uncertainty in any downstream skill calls
- < 0.60: low confidence; do not proceed with the classified intent; route to [[conversation-clarifying-questions]] to ask "Do you want me to [option A], [option B], or [option C]?"
Specific disambiguation rules
- Document pasted with no instruction →
confidence < 0.60; ask before classifying
- "Is this enforceable?" without context →
advice at confidence 0.70
- "Can you make me an NDA" →
drafting at confidence 0.95 even without explicit "draft"
- "What happens if I don't pay?" →
advice at confidence 0.85
Output
Return a single JSON object on one line:
{
"primary": "<label>",
"secondary": ["<label>", ...],
"confidence": 0.0-1.0,
"ambiguity_note": "<if confidence < 0.80, one sentence describing what is unclear>"
}
If confidence < 0.60: before returning this JSON (or alongside it, in the same response), invoke [[conversation-clarifying-questions]] to ask the user.
Related Skills
- [[router-complexity-grader]]
- [[router-jurisdiction-detector]]
- [[router-practice-area-detector]]
- [[router-persona-selector]]
- [[router-confidence-scorer]]
- [[conversation-clarifying-questions]]
1---2name: router-intent-detection3description: Use as the primary intent classifier for every incoming user message. Classifies each message into exactly one primary intent and zero or more secondary intents from a defined label set — drafting, review, research, summarize, translate, compare, calculate, advice, admin, chitchat. Outputs a JSON object with primary intent, secondary intents, and confidence score. Routes low-confidence messages to the clarifying-questions skill rather than guessing.4license: MIT5metadata:6 id: router.intent-detection7 category: router8 priority: P09 intent: [__router__]10 related: [router-complexity-grader, router-jurisdiction-detector, router-practice-area-detector, router-persona-selector, router-confidence-scorer]11 source: https://skillmd.com/skills/sboghossian-mini-claude-for-legal/router-intent-detection12 upstream: Louis — HAQQ Legal AI (github.com/sboghossian/mini-claude-for-legal)13 version: "1.0"14---1516# Intent Detection Router1718## Purpose1920The intent classifier is the first gate in the request pipeline. It determines what the user wants to do — not what topic they are asking about (that is the practice-area detector) or where (that is the jurisdiction detector). Getting intent right at this stage ensures the correct downstream skill is invoked, the correct output format is prepared, and the correct safety checks are applied.2122Every incoming user message goes through this classifier. The output is consumed by [[router-complexity-grader]], [[router-practice-area-detector]], and ultimately the skill selector.2324## Intent Labels2526Exactly one primary intent and zero or more secondary intents are assigned from this set:2728### `drafting`29User wants to generate a new document, agreement, clause, notice, letter, or other legal text from scratch or from a brief.3031Signals:32- Verb "draft", "write", "create", "generate", "prepare", "make me a…"33- Named document type without an existing document pasted: NDA, MSA, lease, employment agreement, will, SHA, SAFE, MOA34- "Can you write a [document]…"3536**Note**: a drafting request that names a known document type is high-confidence drafting even if the user does not say the word "draft". "Can you make me an NDA for my software company?" is unambiguously `drafting`.3738### `review`39User wants the AI to read, critique, redline, analyze, or provide comments on an existing document or clause that they have provided.4041Signals:42- User pastes or attaches a document with instruction: "review", "check", "look at this", "what do you think of", "red-flag", "is this okay?"43- Verb "review", "analyze", "assess", "evaluate", "critique", "redline"4445**Note**: if a user pastes a document without any instruction, the intent is ambiguous. Do not assume review — route to [[conversation-clarifying-questions]] to ask whether they want a review, summary, translation, or something else.4647### `research`48User is asking a legal question about a rule of law, statute, regulation, jurisdiction, case, or principle without asking the AI to produce a document or render judgment on a specific situation.4950Signals:51- "What is…", "How does…", "Explain…", "What are the rules for…"52- Cites a statute number, regulation, or case and asks what it says53- Asks for a comparative overview: "How do UAE and KSA handle…"5455**Distinction from `advice`**: if the question is genuinely about what the law says (not what the user should do), it is `research`. "What is the limitation period under UAE law?" is research. "Has my claim expired?" is advice.5657### `summarize`58User wants a shorter version of something — a document, clause, thread, judgment, or regulatory text.5960Signals:61- "Summarize", "give me the key points", "TL;DR", "what does this say in plain language", "explain this in simple terms"6263### `translate`64User wants a translation of text from one language to another.6566Signals:67- Explicit language pair request: "translate this to Arabic", "translate to English"68- Pastes text in one language and asks for it in another69- "What does [foreign phrase] mean in legal context"7071**Note**: legal translation from Arabic to English or vice versa may also trigger [[review-translation-quality-ar-en]] as a secondary skill.7273### `compare`74User wants an A-vs-B analysis — comparing clauses, jurisdictions, contract versions, or regulatory regimes.7576Signals:77- "Compare", "what's the difference between", "how does X differ from Y", "which is better for me"78- Two or more options explicitly stated7980### `calculate`81User wants a numerical output — a calculated deadline, end-of-service gratuity, statutory interest, notice period, or other computable result.8283Signals:84- "Calculate", "compute", "how much is…", "when does [period] expire", "what is the end-of-service"85- Numbers provided (hire dates, salary, contract value) with a question about a derived quantity8687### `advice`88User is asking what they should do, whether they can do something, or what will happen in their specific situation.8990Signals:91- "Can I…", "Should I…", "What happens if…", "Is this enforceable against me…", "Do I need to…"92- Describes a specific factual situation and asks for a recommended course of action9394**Important**: `advice` is the highest-caution intent. It triggers the no-legal-advice disclaimer check and safety review. See [[safety-compliance-ai-not-privileged-disclaimer-us]] and related skills for handling.9596**Distinction from `research`**: "Is this enforceable?" / "What should I do?" = advice. "What does Article 47 say?" = research.9798### `admin`99User is asking about billing, settings, account management, plan features, integrations, or the Louis platform itself.100101Signals:102- "How do I upgrade…", "What does the Pro plan include…", "My API key…", "Can I connect this to…"103104### `chitchat`105User is engaging in small talk, greetings, or off-topic conversation with no legal task.106107Signals:108- Greetings: "Hi", "Hello", "How are you"109- Off-topic: "Tell me a joke", "What's the weather like"110- Follow-up affirmations in conversation: "Thanks", "Got it", "Sounds good"111112## Logic — Classification Rules1131141. Parse the message for the primary action verb and the object of the request1152. Apply the intent label whose definition best matches the action verb + object pair1163. Assign secondary intents for any substantive parallel task (e.g., "draft me an NDA and explain the key clauses" → primary: `drafting`, secondary: `research`)1174. Set confidence based on: (a) clarity of the verb; (b) absence of ambiguity about what the user wants; (c) whether context is required to disambiguate118119### Confidence thresholds120121- **≥ 0.80**: high confidence; proceed with the classified intent122- **0.60–0.79**: moderate confidence; classify but note uncertainty in any downstream skill calls123- **< 0.60**: low confidence; do not proceed with the classified intent; route to [[conversation-clarifying-questions]] to ask "Do you want me to [option A], [option B], or [option C]?"124125### Specific disambiguation rules126127- Document pasted with no instruction → `confidence < 0.60`; ask before classifying128- "Is this enforceable?" without context → `advice` at confidence 0.70129- "Can you make me an NDA" → `drafting` at confidence 0.95 even without explicit "draft"130- "What happens if I don't pay?" → `advice` at confidence 0.85131132## Output133134Return a single JSON object on one line:135136```json137{138 "primary": "<label>",139 "secondary": ["<label>", ...],140 "confidence": 0.0-1.0,141 "ambiguity_note": "<if confidence < 0.80, one sentence describing what is unclear>"142}143```144145If confidence < 0.60: before returning this JSON (or alongside it, in the same response), invoke [[conversation-clarifying-questions]] to ask the user.146147## Related Skills148149- [[router-complexity-grader]]150- [[router-jurisdiction-detector]]151- [[router-practice-area-detector]]152- [[router-persona-selector]]153- [[router-confidence-scorer]]154- [[conversation-clarifying-questions]]