
Legal Canned Responses
- 44 installs
- 451 repo stars
- Updated July 21, 2026
- borghei/claude-skills
Generate templated responses for common legal inquiries with variable substitution and built-in escalation detection to route critical matters to counsel.
About
Generates formatted responses to recurring legal inquiries from templates, covering 7 categories with escalation triggers that flag matters needing a lawyer. A legal-ops team uses it to handle high volumes of routine intake while escalating critical cases.
- 7 response categories with universal and category-specific escalation triggers
- Python response generator with variable substitution
Legal Canned Responses by the numbers
- 44 all-time installs (skills.sh)
- Ranked #1,120 of 2,715 Automation & Workflows skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/borghei/claude-skills --skill legal-canned-responsesAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 44 |
|---|---|
| repo stars | ★ 451 |
| Last updated | July 21, 2026 |
| Repository | borghei/claude-skills ↗ |
What it does
Generate templated responses for common legal inquiries with variable substitution and built-in escalation detection to route critical matters to counsel.
Files
⚠️ EXPERIMENTAL — This skill is provided for educational and informational purposes only. It does NOT constitute legal advice. All responsibility for usage rests with the user. Consult qualified legal professionals before acting on any output.
Legal Canned Responses Skill
Overview
Production-ready toolkit for generating templated responses to common legal inquiries with built-in escalation detection. Covers 7 response categories with multiple sub-types each, plus a universal and category-specific escalation trigger system. Designed for legal operations teams handling high volumes of recurring inquiries while ensuring critical matters are routed to counsel.
Table of Contents
- Tools
- Reference Guides
- Workflows
- Response Categories
- Escalation System
- Troubleshooting
- Success Criteria
- Scope & Limitations
- Anti-Patterns
- Tool Reference
Tools
1. Response Generator (scripts/response_generator.py)
Generate formatted legal responses from templates with variable substitution and escalation detection.
python scripts/response_generator.py \
--category dsr --sub-type acknowledgment \
--var requestor_name="Jane Doe" \
--var request_type="access" \
--var request_date="2026-04-10"
python scripts/response_generator.py \
--category nda --sub-type standard-form \
--var counterparty="Acme Corp" \
--var purpose="due diligence" --json
python scripts/response_generator.py \
--category discovery --sub-type initial-notice \
--var matter_name="Smith v. Corp" \
--var custodians="Engineering,Sales"2. Escalation Detector (scripts/escalation_detector.py)
Analyze inquiry text for escalation triggers and recommend routing.
python scripts/escalation_detector.py \
--text "We received a subpoena from the DOJ regarding our pricing practices"
python scripts/escalation_detector.py \
--text "A reporter from the Wall Street Journal is asking about our data practices" --json
python scripts/escalation_detector.py \
--category vendor \
--text "The vendor is threatening litigation over the contract dispute"Reference Guides
| Reference | Purpose |
|---|---|
references/response_templates.md | Complete templates for all 7 categories with sub-types |
references/escalation_triggers.md | Universal and category-specific escalation triggers |
Workflows
Template Lifecycle
1. Creation -- Draft response template for identified recurring inquiry type 2. Review -- Legal counsel reviews template for accuracy, tone, and compliance 3. Publication -- Template added to system with metadata, variables, and triggers 4. Use -- Staff selects category/sub-type, fills variables, generates response 5. Feedback -- Track usage and collect feedback on template effectiveness 6. Update -- Revise templates based on feedback, legal changes, or policy updates 7. Retirement -- Archive templates that are no longer applicable
Response Generation Workflow
1. Classify Inquiry -- Determine category (DSR, NDA, subpoena, etc.) and sub-type 2. Check Escalation -- Run escalation detector on inquiry text 3. If Escalation Detected -- Stop; route to counsel with escalation report 4. If No Escalation -- Generate response with appropriate template and variables 5. Review & Send -- Review generated response before sending; adjust if needed
Response Categories
| Category | Sub-Types | Description |
|---|---|---|
| Data Subject Requests (DSR) | acknowledgment, verification, fulfillment, denial, extension | GDPR/CCPA data subject right requests |
| Discovery/Litigation Holds | initial-notice, reminder, modification, release | Litigation hold management |
| Privacy Inquiries | cookies, data-sharing, children, transfers | General privacy questions |
| Vendor Legal Questions | contract-status, amendments, certifications, audit | Vendor/supplier legal matters |
| NDA Requests | standard-form, counterparty-markup, decline, renewal | Non-disclosure agreement lifecycle |
| Subpoena/Legal Process | acknowledgment, objection, extension, compliance | Legal process responses |
| Insurance Notifications | initial-claim, supplemental-info, reservation-of-rights | Insurance claim management |
DSR Sub-Types
| Sub-Type | Use When | Key Variables |
|---|---|---|
| acknowledgment | New DSR received | requestor_name, request_type, request_date |
| verification | Identity verification needed | requestor_name, verification_method |
| fulfillment | Request completed | requestor_name, request_type, data_description |
| denial | Request denied with reason | requestor_name, request_type, denial_reason |
| extension | Need more time | requestor_name, request_type, extension_reason, new_deadline |
Discovery/Litigation Hold Sub-Types
| Sub-Type | Use When | Key Variables |
|---|---|---|
| initial-notice | New litigation hold issued | matter_name, custodians, data_types |
| reminder | Periodic hold reminder | matter_name, reminder_number |
| modification | Hold scope changed | matter_name, modification_description |
| release | Hold lifted | matter_name, release_date |
Escalation System
Universal Triggers (Always Escalate)
| # | Trigger | Why |
|---|---|---|
| 1 | Potential or active litigation | Legal exposure requires counsel assessment |
| 2 | Regulatory investigation or inquiry | Regulatory response requires strategic approach |
| 3 | Government or law enforcement contact | Constitutional and procedural rights at stake |
| 4 | Binding legal commitment requested | Cannot create legal obligations without counsel |
| 5 | Criminal liability exposure | Requires immediate counsel involvement |
| 6 | Media attention or press inquiry | Reputational risk requires coordinated response |
| 7 | Unprecedented or novel situation | No template exists; bespoke legal analysis needed |
| 8 | Multi-jurisdictional conflict | Cross-border legal complexity requires expert analysis |
Escalation Response Protocol
1. Stop -- Do not send any templated response 2. Alert -- Notify designated counsel immediately 3. Explain -- Provide escalation context with matched triggers 4. Recommend -- Suggest routing based on trigger type 5. Draft -- Mark any preliminary draft "FOR COUNSEL REVIEW ONLY"
Troubleshooting
| Problem | Cause | Solution |
|---|---|---|
| Missing variable in output | Required variable not provided | Check template requirements; provide all required --var parameters |
| Wrong template selected | Category/sub-type mismatch | Review category descriptions; ensure sub-type matches inquiry type |
| False positive escalation | Common words matching trigger patterns | Provide --category to use category-specific triggers; review matched triggers |
| False negative escalation | Inquiry text too vague | Add more context to inquiry text; run both universal and category-specific checks |
| Template too generic | Using default values | Replace all placeholder values with actual organization-specific details |
| Discovery hold sent to wrong custodians | Custodian list outdated | Verify custodian list against current employees and systems |
| Subpoena response not flagged | Missing category context | Always use --category subpoena for legal process; subpoena category always escalates |
| Response tone inappropriate | Wrong audience context | Select appropriate sub-type; customize tone per audience |
Success Criteria
- Response Time: Templated responses generated within 5 minutes vs. 30+ minutes manual drafting
- Escalation Accuracy: 100% of genuine escalation triggers detected (zero false negatives on CRITICAL triggers)
- Template Coverage: Templates cover 80%+ of recurring legal inquiry types
- Consistency: All responses within a category use consistent language, tone, and legal caveats
- Audit Trail: Every generated response logged with category, sub-type, date, and escalation status
Scope & Limitations
This skill covers:
- Template-based response generation for 7 common legal inquiry categories
- Escalation detection using keyword and pattern matching against known triggers
- Variable substitution for organization-specific customization
- Response metadata generation for audit trail purposes
This skill does NOT cover:
- Legal advice or attorney-client privileged analysis
- Automated sending of responses (generation only; human review required)
- Contract drafting, negotiation, or legal document creation
- Case management, docketing, or deadline tracking
- Jurisdiction-specific legal compliance validation of response content
Anti-Patterns
| Anti-Pattern | Why It Fails | Better Approach |
|---|---|---|
| Sending templated response without review | May miss context-specific nuances; legal risk | Always review generated response before sending |
| Ignoring escalation triggers | Critical matters mishandled; legal exposure | Run escalation detector on every inquiry; treat all triggers seriously |
| Using templates for novel situations | Templates assume standard scenarios; novel situations need bespoke analysis | Escalate novel situations to counsel; create new template after resolution |
| Hardcoding organization details in templates | Templates become non-portable; updates missed | Use variable substitution; maintain variables in configuration |
| Skipping identity verification for DSRs | GDPR/CCPA require verification before fulfillment | Always send verification sub-type before fulfillment |
Tool Reference
scripts/response_generator.py
Generate formatted legal responses with variable substitution.
usage: response_generator.py [-h] [--json]
--category {dsr,discovery,privacy,vendor,nda,subpoena,insurance}
--sub-type SUB_TYPE
[--var KEY=VALUE [KEY=VALUE ...]]
options:
-h, --help Show help message and exit
--json Output in JSON format
--category Response category
--sub-type Response sub-type within category
--var Variable substitution as KEY=VALUE pairsscripts/escalation_detector.py
Analyze inquiry text for escalation triggers.
usage: escalation_detector.py [-h] [--json]
--text TEXT
[--category {dsr,discovery,privacy,vendor,nda,subpoena,insurance}]
options:
-h, --help Show help message and exit
--json Output in JSON format
--text Inquiry text to analyze for escalation triggers
--category Optional category for category-specific trigger detectionLegal Escalation Triggers Reference
Comprehensive guide to universal and category-specific escalation triggers for legal inquiry handling.
Table of Contents
- Escalation Protocol
- Universal Triggers
- Category-Specific Triggers
- Escalation Response Procedure
- Customization Guidelines
- Severity Classification
- Routing Directory
Escalation Protocol
When any escalation trigger is detected, the following protocol applies immediately:
| Step | Action | Detail |
|---|---|---|
| 1. Stop | Halt template response | Do not send any templated or automated response |
| 2. Alert | Notify designated counsel | Contact the routing destination specified by the trigger |
| 3. Explain | Provide escalation context | Include matched triggers, severity, and original inquiry |
| 4. Recommend | Suggest routing | Follow the routing recommendation for the matched trigger |
| 5. Draft | Mark for review | If a draft is prepared, mark "FOR COUNSEL REVIEW ONLY" |
Universal Triggers
Universal triggers apply to ALL inquiry categories. If any universal trigger matches, the inquiry must be escalated regardless of category.
UT-001: Potential or Active Litigation
| Field | Value |
|---|---|
| Severity | HIGH |
| Routing | General Counsel |
| Keywords | litigation, lawsuit, sue/suing, filed complaint, court order, injunction, legal action, class action |
| Reason | Legal exposure requires immediate counsel assessment to preserve rights and manage defense |
UT-002: Regulatory Investigation
| Field | Value |
|---|---|
| Severity | HIGH |
| Routing | General Counsel / Regulatory Affairs |
| Keywords | regulatory investigation, regulator, enforcement action, compliance investigation, regulatory inquiry, sanction |
| Reason | Regulatory responses require strategic approach; wrong response can worsen exposure |
UT-003: Government or Law Enforcement Contact
| Field | Value |
|---|---|
| Severity | CRITICAL |
| Routing | General Counsel (Immediate) |
| Keywords | government inquiry, law enforcement, FBI, DOJ, Department of Justice, SEC, FTC, FDA, police, prosecutor, grand jury, subpoena, warrant, civil investigative demand |
| Reason | Constitutional and procedural rights at stake; improper response can waive protections |
UT-004: Binding Legal Commitment
| Field | Value |
|---|---|
| Severity | HIGH |
| Routing | Contracts / General Counsel |
| Keywords | binding commitment, sign agreement, execute contract, guarantee, indemnify, waiver, release of claims |
| Reason | Cannot create legal obligations without proper authority and counsel review |
UT-005: Criminal Liability Exposure
| Field | Value |
|---|---|
| Severity | CRITICAL |
| Routing | General Counsel (Immediate) |
| Keywords | criminal, fraud, bribery, corruption, embezzlement, money laundering, whistleblower, criminal liability, criminal investigation |
| Reason | Criminal exposure requires immediate privilege-protected counsel involvement |
UT-006: Media Attention
| Field | Value |
|---|---|
| Severity | HIGH |
| Routing | General Counsel + Communications |
| Keywords | media, press, reporter, journalist, newspaper, news article, Wall Street Journal, New York Times, Bloomberg, Reuters, public statement, press release |
| Reason | Reputational risk requires coordinated legal-communications response strategy |
UT-007: Unprecedented Situation
| Field | Value |
|---|---|
| Severity | MEDIUM |
| Routing | Senior Counsel |
| Keywords | first time, never before/seen/encountered, unprecedented, no precedent, novel issue/situation, uncharted |
| Reason | No existing template applies; bespoke legal analysis required |
UT-008: Multi-Jurisdictional Conflict
| Field | Value |
|---|---|
| Severity | HIGH |
| Routing | International / General Counsel |
| Keywords | multi-jurisdictional, cross-border, international dispute, conflict of laws, foreign government/authority/court, extraterritorial |
| Reason | Cross-border legal complexity may involve conflicting obligations |
Category-Specific Triggers
Data Subject Requests (DSR)
| ID | Trigger | Severity | Routing | Keywords |
|---|---|---|---|---|
| DSR-001 | Minor Data Subject | HIGH | Privacy Counsel | minor, child, under [age], parent consent |
| DSR-002 | Litigation Hold Conflict | HIGH | Litigation + Privacy Counsel | litigation hold, legal hold, preservation |
| DSR-003 | HR/Employment Matter | MEDIUM | Employment Counsel + Privacy | employee file/record, HR, human resources, termination, disciplinary |
| DSR-004 | Special Category Data | HIGH | Privacy Counsel | health, medical, biometric, genetic, racial, ethnic, sexual, religious, political, trade union |
DSR Escalation Notes:
- Minors: COPPA (US) requires verifiable parental consent; GDPR Art. 8 sets age threshold at 16 (member states may lower to 13)
- Litigation hold conflicts: DSR fulfillment may require deletion that conflicts with hold; cannot resolve without counsel
- Special categories: Art. 9 GDPR processing requires explicit consent or specific legal basis
Discovery/Litigation Holds
| ID | Trigger | Severity | Routing | Keywords |
|---|---|---|---|---|
| DIS-001 | Criminal Liability | CRITICAL | General Counsel (Immediate) | criminal, fraud, destruction of evidence, spoliation |
| DIS-002 | Unclear Hold Scope | HIGH | Litigation Counsel | unclear scope, what documents/data, how far back, scope question |
| DIS-003 | Deletion Conflict | CRITICAL | Litigation Counsel (Immediate) | already deleted, purged, destroyed, auto-delete, retention policy |
Discovery Escalation Notes:
- Spoliation: Any indication that relevant data may have been deleted after hold triggers immediate escalation
- Scope questions: Over-preservation is safer than under-preservation; counsel must define boundaries
Privacy Inquiries
| ID | Trigger | Severity | Routing | Keywords |
|---|---|---|---|---|
| PRI-001 | Data Breach | CRITICAL | Privacy Counsel + CISO | breach, leak, unauthorized access, data incident, compromised |
Privacy Escalation Notes:
- GDPR Art. 33: 72-hour notification obligation to supervisory authority
- State breach notification laws (US): Varying timelines and requirements
Vendor Legal Questions
| ID | Trigger | Severity | Routing | Keywords |
|---|---|---|---|---|
| VEN-001 | Vendor Dispute/Threat | HIGH | Contracts / General Counsel | threatening, dispute, breach of contract, terminate agreement, penalty |
NDA Requests
| ID | Trigger | Severity | Routing | Keywords |
|---|---|---|---|---|
| NDA-001 | Competitor NDA | HIGH | General Counsel + Business | competitor, competing, rival |
| NDA-002 | Government/Military | HIGH | Government Contracts Counsel | government, military, defense, classified, security clearance |
NDA Escalation Notes:
- Competitor NDAs may create antitrust risk; scope must be carefully limited
- Government/military NDAs involve ITAR, EAR, and classified information handling requirements
Subpoena/Legal Process
| ID | Trigger | Severity | Routing | Keywords |
|---|---|---|---|---|
| SUB-001 | Always Escalate | CRITICAL | General Counsel (Immediate) | ALL subpoena inquiries |
Subpoena Escalation Notes:
- Every subpoena or legal process matter must be reviewed by counsel without exception
- Privilege review required before any document production
- Third-party data may require notice to data subjects
- Cross-border subpoenas may conflict with foreign data protection laws (e.g., GDPR blocking statutes)
Insurance Notifications
| ID | Trigger | Severity | Routing | Keywords |
|---|---|---|---|---|
| INS-001 | Coverage Dispute | HIGH | Insurance / General Counsel | deny/denied/denial, coverage dispute, reservation of rights, bad faith |
Escalation Response Procedure
When Escalation Is Detected
1. STOP - Do not send any templated response
2. ALERT - Notify the routing destination immediately
3. EXPLAIN - Provide:
- Original inquiry text
- Matched trigger(s) with IDs
- Severity classification
- Recommended routing
4. RECOMMEND - Suggest next steps based on trigger type
5. DRAFT - If any preliminary response prepared:
- Mark "FOR COUNSEL REVIEW ONLY"
- Do NOT send until counsel approves
- Document the hold in tracking systemEscalation Documentation
| Field | Required | Description |
|---|---|---|
| Inquiry date | Yes | Date/time the inquiry was received |
| Inquiry source | Yes | Who submitted the inquiry (name, email, role) |
| Category | Yes | Response category (DSR, vendor, etc.) |
| Trigger ID(s) | Yes | Which trigger(s) matched |
| Severity | Yes | Highest matched severity level |
| Routing | Yes | Where escalation was sent |
| Counsel response | Yes | Counsel's direction and date |
| Resolution | Yes | Final outcome and date |
Customization Guidelines
Tone Customization
| Audience | Tone Adjustment |
|---|---|
| Internal employee | Direct, informative; reference internal policies |
| External customer | Professional, empathetic; reference privacy notices |
| Regulatory body | Formal, precise; reference legal obligations |
| Counterparty counsel | Legal-professional; reference contractual terms |
| Insurance carrier | Factual, timely; reference policy terms |
Jurisdiction Customization
| Jurisdiction | Key Adjustments |
|---|---|
| EU/EEA | Reference GDPR articles; use "data subject" terminology; include DPA contact |
| US (California) | Reference CCPA/CPRA; use "consumer" terminology; include opt-out rights |
| US (Federal) | Reference SOX/Dodd-Frank as applicable; use federal terminology |
| UK | Reference UK GDPR/DPA 2018; reference ICO; use UK-specific terminology |
| Multi-jurisdiction | Use broadest protections; reference all applicable frameworks |
Adding Custom Triggers
When adding organization-specific triggers:
| Consideration | Guidance |
|---|---|
| Specificity | Use specific terms, not generic words that cause false positives |
| Testing | Test new triggers against 50+ sample inquiries before deployment |
| Review | Have counsel approve all custom triggers |
| Documentation | Document rationale for each custom trigger |
| Maintenance | Review custom triggers quarterly; retire unused ones |
Severity Classification
| Severity | Definition | Response Time | Approver |
|---|---|---|---|
| CRITICAL | Immediate legal risk; rights may be waived or lost | Within 1 hour | General Counsel |
| HIGH | Significant legal risk; requires counsel strategy | Within 4 hours | Senior Counsel |
| MEDIUM | Moderate risk; counsel guidance needed | Within 24 hours | Counsel |
| LOW | Minor risk; informational escalation | Within 48 hours | Legal Operations |
Routing Directory
| Destination | Types of Matters | Typical Triggers |
|---|---|---|
| General Counsel | Litigation, government, criminal, strategic | UT-001, UT-003, UT-005 |
| Privacy Counsel | Data protection, DSRs, breaches | DSR-001, DSR-004, PRI-001 |
| Litigation Counsel | Discovery, holds, disputes | DIS-001, DIS-002, DIS-003 |
| Employment Counsel | Employee matters, HR | DSR-003 |
| Contracts Counsel | Vendor, NDA, commitments | UT-004, VEN-001 |
| Regulatory Affairs | Regulatory inquiries | UT-002 |
| Communications | Media, public statements | UT-006 |
| Insurance Counsel | Coverage, claims | INS-001 |
| International Counsel | Cross-border, multi-jurisdiction | UT-008 |
| Government Contracts | Government/military | NDA-002 |
Legal Canned Response Templates
Complete template library for 7 legal response categories with sub-types, variables, and follow-up actions.
Table of Contents
- Template Standards
- Category 1: Data Subject Requests
- Category 2: Discovery and Litigation Holds
- Category 3: Privacy Inquiries
- Category 4: Vendor Legal Questions
- Category 5: NDA Requests
- Category 6: Subpoena and Legal Process
- Category 7: Insurance Notifications
- Template Lifecycle
Template Standards
| Standard | Requirement |
|---|---|
| Tone | Professional, neutral, legally precise |
| Caveats | Include appropriate legal disclaimers where needed |
| Variables | All organization-specific details use {variable_name} placeholders |
| Privilege | Discovery and subpoena templates marked PRIVILEGED AND CONFIDENTIAL |
| Review | All templates require periodic counsel review |
| Versioning | Track template version and last review date |
Category 1: Data Subject Requests
1.1 Acknowledgment
| Field | Value |
|---|---|
| Use case | New data subject request received |
| Required variables | requestor_name, request_date, request_type, ref_number |
| Follow-up | Verify identity within 5 business days; set 30-day deadline |
| Escalation triggers | Minor, litigation hold conflict, special category data |
Template:
Dear {requestor_name},
>
We acknowledge receipt of your data subject request submitted on {request_date}. Your request for {request_type} has been logged and assigned reference number {ref_number}.
>
We will respond within the timeframe required by applicable data protection law (generally 30 days from receipt). If we require additional time, we will notify you of any extension and the reasons for it.
>
Before processing, we may need to verify your identity. If so, we will contact you with further instructions.
>
Regards, {sender_name}
1.2 Verification
| Field | Value |
|---|---|
| Use case | Identity verification needed before processing |
| Required variables | requestor_name, ref_number, verification_method |
| Follow-up | Track 14-day verification deadline; pause response timeline |
1.3 Fulfillment
| Field | Value |
|---|---|
| Use case | Request completed and data/action being communicated |
| Required variables | requestor_name, request_type, ref_number, data_description |
| Follow-up | Close request in tracker; archive for audit trail |
1.4 Denial
| Field | Value |
|---|---|
| Use case | Request denied with lawful reason |
| Required variables | requestor_name, request_type, ref_number, denial_reason |
| Follow-up | Document rationale; prepare for potential supervisory authority complaint |
1.5 Extension
| Field | Value |
|---|---|
| Use case | Additional time needed to fulfill request |
| Required variables | requestor_name, request_type, ref_number, extension_reason, new_deadline |
| Follow-up | Update tracking system; set new deadline reminder |
Category 2: Discovery and Litigation Holds
All discovery templates are marked PRIVILEGED AND CONFIDENTIAL and ATTORNEY-CLIENT COMMUNICATION.
2.1 Initial Hold Notice
| Field | Value |
|---|---|
| Use case | New litigation hold issued to custodians |
| Required variables | matter_name, custodians, notice_date, data_types |
| Follow-up | Track custodian acknowledgments; 7-day reminder; document scope |
| Privilege | YES |
Template:
PRIVILEGED AND CONFIDENTIAL
ATTORNEY-CLIENT COMMUNICATION
>
TO: {custodians}
RE: Litigation Hold - {matter_name}
>
This notice requires you to preserve all documents, communications, and data related to {matter_name}. This includes emails, documents, calendar entries, voicemails, and all ESI.
>
YOU MUST: (1) Cease routine deletion, (2) Suspend auto-delete policies, (3) Preserve all relevant documents, (4) Notify team members with relevant information.
>
DO NOT delete, modify, or move any potentially relevant documents.
2.2 Hold Reminder
| Field | Value |
|---|---|
| Use case | Periodic reminder of active hold obligations |
| Required variables | matter_name, reminder_number |
| Follow-up | Log reminder; track acknowledgments; schedule next |
| Privilege | YES |
2.3 Hold Modification
| Field | Value |
|---|---|
| Use case | Scope of hold changed (expanded or narrowed) |
| Required variables | matter_name, modification_description |
| Follow-up | Update scope documentation; track acknowledgments |
| Privilege | YES |
2.4 Hold Release
| Field | Value |
|---|---|
| Use case | Hold no longer required; custodians may resume normal policies |
| Required variables | matter_name, release_date |
| Follow-up | Close hold in tracker; verify no other active holds |
| Privilege | YES |
Category 3: Privacy Inquiries
3.1 Cookies
| Field | Value |
|---|---|
| Use case | General inquiry about cookie practices |
| Required variables | requestor_name, cookie_policy_url |
| Follow-up | Log inquiry for privacy metrics |
3.2 Data Sharing
| Field | Value |
|---|---|
| Use case | Question about who receives personal data |
| Required variables | requestor_name, sharing_details, privacy_notice_url |
| Follow-up | Log inquiry; review if suggests process gap |
3.3 Children's Privacy
| Field | Value |
|---|---|
| Use case | Concern about data collection from children |
| Required variables | requestor_name, age_threshold, privacy_email |
| Follow-up | Investigate if specific child data concern raised |
| Escalation | ALWAYS escalate if specific child identified |
3.4 International Transfers
| Field | Value |
|---|---|
| Use case | Question about cross-border data transfers |
| Required variables | requestor_name, origin_jurisdiction, transfer_mechanism |
| Follow-up | Log inquiry; verify transfer mechanisms current |
Category 4: Vendor Legal Questions
4.1 Contract Status
| Field | Value |
|---|---|
| Use case | Internal inquiry about vendor contract status |
| Required variables | requestor_name, vendor_name, contract_status, contract_ref |
| Follow-up | Update contract tracking if needed |
4.2 Amendments
| Field | Value |
|---|---|
| Use case | Request to amend existing vendor agreement |
| Required variables | requestor_name, vendor_name, contract_ref, amendment_description, review_timeline |
| Follow-up | Assign to contract attorney; set review deadline |
4.3 Certifications
| Field | Value |
|---|---|
| Use case | Request for vendor compliance certifications |
| Required variables | requestor_name, vendor_name, certification_details, submission_email, deadline |
| Follow-up | Track submission deadline; verify upon receipt |
4.4 Audit
| Field | Value |
|---|---|
| Use case | Scheduling contractual audit of vendor |
| Required variables | requestor_name, vendor_name, contract_ref, audit_scope, audit_dates |
| Follow-up | Confirm audit dates; prepare checklist |
Category 5: NDA Requests
5.1 Standard Form
| Field | Value |
|---|---|
| Use case | Sending standard NDA for execution |
| Required variables | requestor_name, counterparty, purpose, nda_type, term |
| Follow-up | Track execution; set signature deadline |
5.2 Counterparty Markup
| Field | Value |
|---|---|
| Use case | Responding to counterparty's changes to NDA |
| Required variables | requestor_name, counterparty, markup_comments |
| Follow-up | Schedule negotiation if needed; track versions |
5.3 Decline
| Field | Value |
|---|---|
| Use case | Declining to enter NDA |
| Required variables | requestor_name, counterparty, decline_reason |
| Follow-up | Document reason; notify business stakeholder |
5.4 Renewal
| Field | Value |
|---|---|
| Use case | NDA approaching expiration |
| Required variables | requestor_name, counterparty, nda_ref, expiry_date |
| Follow-up | Track renewal decision; set expiry reminder |
Category 6: Subpoena and Legal Process
ALL subpoena templates are marked FOR COUNSEL REVIEW ONLY and ALWAYS require escalation.
6.1 Acknowledgment
| Field | Value |
|---|---|
| Use case | Subpoena received and logged |
| Required variables | requestor_name, matter_name, service_date, response_deadline, issuing_party |
| Follow-up | IMMEDIATE route to counsel; calendar deadline; identify responsive docs |
| Escalation | ALWAYS |
| Privilege | YES |
6.2 Objection
| Field | Value |
|---|---|
| Use case | Raising objections to subpoena |
| Required variables | matter_name, objection_grounds |
| Follow-up | Counsel review mandatory; file by deadline |
| Escalation | ALWAYS |
| Privilege | YES |
6.3 Extension
| Field | Value |
|---|---|
| Use case | Requesting more time to respond |
| Required variables | matter_name, current_deadline, requested_deadline, extension_reason |
| Follow-up | Counsel approval required; track response |
| Escalation | ALWAYS |
| Privilege | YES |
6.4 Compliance
| Field | Value |
|---|---|
| Use case | Producing responsive documents |
| Required variables | matter_name, production_summary, privilege_status |
| Follow-up | Counsel approval mandatory; prepare privilege log |
| Escalation | ALWAYS |
| Privilege | YES |
Category 7: Insurance Notifications
7.1 Initial Claim
| Field | Value |
|---|---|
| Use case | First notification to insurance carrier |
| Required variables | requestor_name, claim_type, occurrence_date, claim_description, policy_number |
| Follow-up | Track carrier acknowledgment; gather supporting docs |
7.2 Supplemental Information
| Field | Value |
|---|---|
| Use case | Providing additional information on existing claim |
| Required variables | requestor_name, claim_number, supplemental_details |
| Follow-up | Log submission; track carrier response |
7.3 Reservation of Rights
| Field | Value |
|---|---|
| Use case | Responding to carrier's reservation of rights letter |
| Required variables | requestor_name, claim_number, ror_date |
| Follow-up | Route to counsel immediately; review coverage |
| Escalation | Route to counsel for coverage position review |
Template Lifecycle
| Stage | Actions | Owner | Frequency |
|---|---|---|---|
| Creation | Draft template for recurring inquiry type | Legal Ops | As needed |
| Review | Counsel reviews for accuracy and compliance | Counsel | Before publication |
| Publication | Add to system with metadata and variables | Legal Ops | After approval |
| Use | Select, populate, review, and send | Staff | Ongoing |
| Feedback | Track usage, collect effectiveness feedback | Legal Ops | Monthly |
| Update | Revise based on feedback, legal changes | Counsel | Quarterly |
| Retirement | Archive no-longer-applicable templates | Legal Ops | Annually |
Template Metadata Requirements
| Field | Description | Example |
|---|---|---|
| Template ID | Unique identifier | DSR-ACK-001 |
| Version | Semantic version | 1.2.0 |
| Created | Creation date | 2026-01-15 |
| Last Reviewed | Most recent counsel review | 2026-04-01 |
| Next Review | Scheduled review date | 2026-07-01 |
| Author | Original author | Legal Operations |
| Reviewer | Approving counsel | General Counsel |
| Status | Active, Draft, Retired | Active |
#!/usr/bin/env python3
"""
Legal Escalation Detector
Analyzes inquiry text for escalation triggers using keyword and pattern
matching against universal and category-specific trigger definitions.
Usage:
python escalation_detector.py --text "We received a subpoena from the DOJ"
python escalation_detector.py --text "vendor threatening litigation" --category vendor --json
python escalation_detector.py --text "reporter asking about data breach" --category privacy
"""
import argparse
import json
import re
import sys
from datetime import datetime
from typing import Any, Dict, List, Optional, Tuple
# Universal escalation triggers (always checked)
UNIVERSAL_TRIGGERS: List[Dict[str, Any]] = [
{
"id": "UT-001",
"name": "Potential or Active Litigation",
"patterns": [
r"\blitigation\b", r"\blawsuit\b", r"\bsue\b", r"\bsuing\b",
r"\bfiled\s+(a\s+)?complaint\b", r"\bcourt\s+order\b", r"\binjunction\b",
r"\blegal\s+action\b", r"\bclass\s+action\b", r"\blitigate\b",
],
"severity": "HIGH",
"routing": "General Counsel",
"reason": "Legal exposure requires immediate counsel assessment",
},
{
"id": "UT-002",
"name": "Regulatory Investigation",
"patterns": [
r"\bregulatory\s+investigation\b", r"\bregulator\b", r"\benforcement\s+action\b",
r"\bcompliance\s+investigation\b", r"\baudit\s+by\s+\w+\s+authority\b",
r"\bregulatory\s+inquiry\b", r"\bsanction\b",
],
"severity": "HIGH",
"routing": "General Counsel / Regulatory Affairs",
"reason": "Regulatory response requires strategic legal approach",
},
{
"id": "UT-003",
"name": "Government or Law Enforcement",
"patterns": [
r"\bgovernment\s+inquiry\b", r"\blaw\s+enforcement\b", r"\bfbi\b",
r"\bdoj\b", r"\bdepartment\s+of\s+justice\b", r"\bsec\b(?!\s*tion)",
r"\bftc\b", r"\bfda\b", r"\bpolice\b", r"\bprosecutor\b",
r"\bgrand\s+jury\b", r"\bsubpoena\b", r"\bwarrant\b",
r"\bcivil\s+investigative\s+demand\b",
],
"severity": "CRITICAL",
"routing": "General Counsel (Immediate)",
"reason": "Constitutional and procedural rights at stake",
},
{
"id": "UT-004",
"name": "Binding Legal Commitment",
"patterns": [
r"\bbinding\s+(legal\s+)?commitment\b", r"\bsign\s+(the\s+)?agreement\b",
r"\bexecute\s+(the\s+)?contract\b", r"\bguarantee\b", r"\bindemnif",
r"\bwaiver\b", r"\brelease\s+of\s+(all\s+)?claims\b",
],
"severity": "HIGH",
"routing": "Contracts / General Counsel",
"reason": "Cannot create legal obligations without counsel review",
},
{
"id": "UT-005",
"name": "Criminal Liability",
"patterns": [
r"\bcriminal\b", r"\bfraud\b", r"\bbribery\b", r"\bcorruption\b",
r"\bembezzlement\b", r"\bmoney\s+laundering\b", r"\bwhistleblow",
r"\bcriminal\s+liability\b", r"\bcriminal\s+investigation\b",
],
"severity": "CRITICAL",
"routing": "General Counsel (Immediate)",
"reason": "Requires immediate counsel involvement for defense strategy",
},
{
"id": "UT-006",
"name": "Media Attention",
"patterns": [
r"\bmedia\b", r"\bpress\b", r"\breporter\b", r"\bjournalist\b",
r"\bnewspaper\b", r"\bnews\b.*\barticle\b", r"\bwall\s+street\s+journal\b",
r"\bnew\s+york\s+times\b", r"\bbloomberg\b", r"\breuters\b",
r"\bpublic\s+statement\b", r"\bpress\s+release\b",
],
"severity": "HIGH",
"routing": "General Counsel + Communications",
"reason": "Reputational risk requires coordinated legal-comms response",
},
{
"id": "UT-007",
"name": "Unprecedented Situation",
"patterns": [
r"\bfirst\s+time\b", r"\bnever\s+(before|seen|encountered)\b",
r"\bunprecedented\b", r"\bno\s+precedent\b", r"\bnovel\s+(issue|situation|question)\b",
r"\buncharted\b",
],
"severity": "MEDIUM",
"routing": "Senior Counsel",
"reason": "No template exists; bespoke legal analysis needed",
},
{
"id": "UT-008",
"name": "Multi-Jurisdictional Conflict",
"patterns": [
r"\bmulti.?jurisdictional\b", r"\bcross.?border\b", r"\binternational\s+dispute\b",
r"\bconflict\s+of\s+laws\b", r"\bforeign\s+(government|authority|court)\b",
r"\bjurisdiction\s+conflict\b", r"\bextraterritorial\b",
],
"severity": "HIGH",
"routing": "International / General Counsel",
"reason": "Cross-border legal complexity requires expert analysis",
},
]
# Category-specific triggers
CATEGORY_TRIGGERS: Dict[str, List[Dict[str, Any]]] = {
"dsr": [
{
"id": "DSR-001", "name": "Minor Data Subject",
"patterns": [r"\bminor\b", r"\bchild\b", r"\bunder\s+\d+\b", r"\bparent\b.*\bconsent\b"],
"severity": "HIGH", "routing": "Privacy Counsel",
"reason": "Children's data requires special protections and counsel review",
},
{
"id": "DSR-002", "name": "Litigation Hold Conflict",
"patterns": [r"\blitigation\s+hold\b", r"\blegal\s+hold\b", r"\bpreserv"],
"severity": "HIGH", "routing": "Litigation + Privacy Counsel",
"reason": "DSR may conflict with preservation obligations",
},
{
"id": "DSR-003", "name": "HR/Employment Matter",
"patterns": [r"\bemployee\b.*\b(file|record)\b", r"\bhr\b", r"\bhuman\s+resources\b",
r"\btermination\b", r"\bdisciplinary\b"],
"severity": "MEDIUM", "routing": "Employment Counsel + Privacy",
"reason": "Employment-related DSRs need special handling",
},
{
"id": "DSR-004", "name": "Special Category Data",
"patterns": [r"\bhealth\b", r"\bmedical\b", r"\bbiometric\b", r"\bgenetic\b",
r"\bracial\b", r"\bethnic\b", r"\bsexual\b", r"\breligio",
r"\bpolitical\b", r"\btrade\s+union\b"],
"severity": "HIGH", "routing": "Privacy Counsel",
"reason": "Special category data requires elevated protections",
},
],
"discovery": [
{
"id": "DIS-001", "name": "Criminal Liability in Discovery",
"patterns": [r"\bcriminal\b", r"\bfraud\b", r"\bdestruction\s+of\s+evidence\b",
r"\bspoliation\b"],
"severity": "CRITICAL", "routing": "General Counsel (Immediate)",
"reason": "Criminal exposure requires immediate counsel involvement",
},
{
"id": "DIS-002", "name": "Unclear Hold Scope",
"patterns": [r"\bunclear\s+scope\b", r"\bwhat\s+(documents|data)\b",
r"\bhow\s+far\s+back\b", r"\bscope\s+question\b"],
"severity": "HIGH", "routing": "Litigation Counsel",
"reason": "Hold scope ambiguity risks under/over-preservation",
},
{
"id": "DIS-003", "name": "Deletion Conflict",
"patterns": [r"\balready\s+deleted\b", r"\bpurged\b", r"\bdestroyed\b",
r"\bauto.?delete\b", r"\bretention\s+polic"],
"severity": "CRITICAL", "routing": "Litigation Counsel (Immediate)",
"reason": "Potential spoliation requires immediate counsel attention",
},
],
"vendor": [
{
"id": "VEN-001", "name": "Vendor Dispute/Threat",
"patterns": [r"\bthreatening\b", r"\bdispute\b", r"\bbreach\s+of\s+contract\b",
r"\bterminate\b.*\bagreement\b", r"\bpenalt"],
"severity": "HIGH", "routing": "Contracts / General Counsel",
"reason": "Vendor disputes may escalate to litigation",
},
],
"nda": [
{
"id": "NDA-001", "name": "Competitor NDA",
"patterns": [r"\bcompetitor\b", r"\bcompeting\b", r"\brival\b"],
"severity": "HIGH", "routing": "General Counsel + Business",
"reason": "Competitor NDAs require strategic review of scope and terms",
},
{
"id": "NDA-002", "name": "Government/Military",
"patterns": [r"\bgovernment\b", r"\bmilitary\b", r"\bdefense\b", r"\bclassified\b",
r"\bsecurity\s+clearance\b"],
"severity": "HIGH", "routing": "Government Contracts Counsel",
"reason": "Government NDAs have special requirements and restrictions",
},
],
"subpoena": [
{
"id": "SUB-001", "name": "Always Escalate Subpoena",
"patterns": [r".*"], # Always matches
"severity": "CRITICAL", "routing": "General Counsel (Immediate)",
"reason": "ALL subpoena/legal process matters require counsel review",
},
],
"privacy": [
{
"id": "PRI-001", "name": "Data Breach",
"patterns": [r"\bbreach\b", r"\bleak\b", r"\bunauthorized\s+access\b",
r"\bdata\s+incident\b", r"\bcompromised\b"],
"severity": "CRITICAL", "routing": "Privacy Counsel + CISO",
"reason": "Data breaches have mandatory notification timelines",
},
],
"insurance": [
{
"id": "INS-001", "name": "Coverage Dispute",
"patterns": [r"\bden(y|ied|ial)\b", r"\bcoverage\s+dispute\b",
r"\breservation\s+of\s+rights\b", r"\bbad\s+faith\b"],
"severity": "HIGH", "routing": "Insurance / General Counsel",
"reason": "Coverage disputes require legal strategy assessment",
},
],
}
def check_triggers(text: str, triggers: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
"""Check text against a list of triggers. Returns matched triggers."""
matched = []
text_lower = text.lower()
for trigger in triggers:
for pattern in trigger["patterns"]:
if re.search(pattern, text_lower):
matched.append({
"id": trigger["id"],
"name": trigger["name"],
"severity": trigger["severity"],
"routing": trigger["routing"],
"reason": trigger["reason"],
"matched_pattern": pattern,
})
break # One match per trigger is enough
return matched
def detect_escalation(text: str, category: Optional[str] = None) -> Dict[str, Any]:
"""Run escalation detection on inquiry text."""
universal_matches = check_triggers(text, UNIVERSAL_TRIGGERS)
category_matches = []
if category and category in CATEGORY_TRIGGERS:
category_matches = check_triggers(text, CATEGORY_TRIGGERS[category])
all_matches = universal_matches + category_matches
should_escalate = len(all_matches) > 0
# Determine highest severity
severity_order = {"CRITICAL": 3, "HIGH": 2, "MEDIUM": 1, "LOW": 0}
max_severity = "NONE"
if all_matches:
max_severity = max(all_matches, key=lambda m: severity_order.get(m["severity"], 0))["severity"]
# Collect unique routing recommendations
routing = list(set(m["routing"] for m in all_matches))
return {
"analysis_date": datetime.now().strftime("%Y-%m-%d %H:%M"),
"input_text": text[:200] + ("..." if len(text) > 200 else ""),
"category": category,
"escalate": should_escalate,
"max_severity": max_severity,
"trigger_count": len(all_matches),
"universal_triggers": len(universal_matches),
"category_triggers": len(category_matches),
"recommended_routing": routing,
"matched_triggers": all_matches,
"action": _build_action(should_escalate, max_severity, routing),
}
def _build_action(escalate: bool, severity: str, routing: List[str]) -> str:
"""Build recommended action string."""
if not escalate:
return "No escalation needed. Proceed with standard template response."
if severity == "CRITICAL":
return (f"IMMEDIATE ESCALATION REQUIRED. Route to: {', '.join(routing)}. "
"Do not send any templated response. Contact counsel immediately.")
elif severity == "HIGH":
return (f"ESCALATION REQUIRED. Route to: {', '.join(routing)}. "
"Mark any draft response 'FOR COUNSEL REVIEW ONLY'.")
else:
return (f"ESCALATION RECOMMENDED. Route to: {', '.join(routing)}. "
"Seek counsel guidance before proceeding with response.")
def format_text(result: Dict[str, Any]) -> str:
"""Format escalation result as human-readable text."""
lines = []
lines.append("=" * 70)
lines.append("ESCALATION ANALYSIS")
lines.append("=" * 70)
lines.append(f"Date: {result['analysis_date']}")
lines.append(f"Category: {result['category'] or 'All (universal only)'}")
lines.append(f"Input: {result['input_text']}")
lines.append("")
if result["escalate"]:
lines.append(">>> ESCALATION REQUIRED <<<")
else:
lines.append("No escalation triggers detected.")
lines.append("")
lines.append(f"Severity: {result['max_severity']}")
lines.append(f"Triggers: {result['trigger_count']} "
f"({result['universal_triggers']} universal, "
f"{result['category_triggers']} category-specific)")
lines.append("")
lines.append(f"ACTION: {result['action']}")
if result.get("recommended_routing"):
lines.append("")
lines.append("RECOMMENDED ROUTING:")
for route in result["recommended_routing"]:
lines.append(f" -> {route}")
if result.get("matched_triggers"):
lines.append("")
lines.append("-" * 70)
lines.append("MATCHED TRIGGERS:")
lines.append("-" * 70)
for trigger in result["matched_triggers"]:
lines.append(f" [{trigger['severity']}] {trigger['id']}: {trigger['name']}")
lines.append(f" {trigger['reason']}")
lines.append("")
lines.append("=" * 70)
return "\n".join(lines)
def main() -> None:
parser = argparse.ArgumentParser(
description="Analyze inquiry text for legal escalation triggers."
)
parser.add_argument("--json", action="store_true", help="Output in JSON format")
parser.add_argument("--text", required=True,
help="Inquiry text to analyze for escalation triggers")
parser.add_argument("--category", default=None,
choices=["dsr", "discovery", "privacy", "vendor",
"nda", "subpoena", "insurance"],
help="Optional category for category-specific triggers")
args = parser.parse_args()
try:
result = detect_escalation(args.text, args.category)
if args.json:
print(json.dumps(result, indent=2))
else:
print(format_text(result))
except Exception as e:
print(f"Error: {e}", file=sys.stderr)
sys.exit(1)
if __name__ == "__main__":
main()
#!/usr/bin/env python3
"""
Legal Canned Response Generator
Generates templated responses for common legal inquiries with variable
substitution and escalation detection.
Usage:
python response_generator.py --category dsr --sub-type acknowledgment --var requestor_name="Jane Doe"
python response_generator.py --category nda --sub-type standard-form --var counterparty="Acme Corp" --json
python response_generator.py --category discovery --sub-type initial-notice --var matter_name="Smith v. Corp"
"""
import argparse
import json
import re
import sys
from datetime import datetime
from typing import Any, Dict, List, Optional, Tuple
# Template definitions: category -> sub-type -> {subject, body, variables, follow_up, privileged}
TEMPLATES: Dict[str, Dict[str, Dict[str, Any]]] = {
"dsr": {
"acknowledgment": {
"subject": "Acknowledgment of Your Data Subject Request",
"body": (
"Dear {requestor_name},\n\n"
"We acknowledge receipt of your data subject request submitted on {request_date}. "
"Your request for {request_type} has been logged and assigned reference number {ref_number}.\n\n"
"We will respond to your request within the timeframe required by applicable data "
"protection law (generally 30 days from receipt). If we require additional time, "
"we will notify you of any extension and the reasons for it.\n\n"
"Before we can process your request, we may need to verify your identity. If so, "
"we will contact you with further instructions.\n\n"
"If you have questions about the status of your request, please reference {ref_number} "
"in any correspondence.\n\n"
"Regards,\n{sender_name}\n{sender_title}"
),
"variables": ["requestor_name", "request_date", "request_type", "ref_number",
"sender_name", "sender_title"],
"follow_up": ["Verify identity within 5 business days", "Set 30-day response deadline"],
"privileged": False,
},
"verification": {
"subject": "Identity Verification Required for Your Data Subject Request",
"body": (
"Dear {requestor_name},\n\n"
"Thank you for your data subject request (Reference: {ref_number}). "
"Before we can process your request, we are required to verify your identity.\n\n"
"Please provide the following:\n"
"- {verification_method}\n\n"
"Please submit your verification documents within 14 days. "
"The response timeline for your request will be paused until identity verification "
"is complete.\n\n"
"Regards,\n{sender_name}\n{sender_title}"
),
"variables": ["requestor_name", "ref_number", "verification_method",
"sender_name", "sender_title"],
"follow_up": ["Track verification deadline (14 days)", "Resume timeline upon verification"],
"privileged": False,
},
"fulfillment": {
"subject": "Response to Your Data Subject Request",
"body": (
"Dear {requestor_name},\n\n"
"We have completed processing your {request_type} request (Reference: {ref_number}).\n\n"
"{data_description}\n\n"
"If you believe this response is incomplete or inaccurate, you have the right to "
"submit a complaint to the relevant supervisory authority.\n\n"
"Regards,\n{sender_name}\n{sender_title}"
),
"variables": ["requestor_name", "request_type", "ref_number", "data_description",
"sender_name", "sender_title"],
"follow_up": ["Close request in tracking system", "Archive response for audit trail"],
"privileged": False,
},
"denial": {
"subject": "Response to Your Data Subject Request",
"body": (
"Dear {requestor_name},\n\n"
"We have reviewed your {request_type} request (Reference: {ref_number}). "
"After careful consideration, we are unable to fulfill your request for the "
"following reason:\n\n{denial_reason}\n\n"
"You have the right to submit a complaint to the relevant supervisory authority "
"if you disagree with this decision.\n\n"
"Regards,\n{sender_name}\n{sender_title}"
),
"variables": ["requestor_name", "request_type", "ref_number", "denial_reason",
"sender_name", "sender_title"],
"follow_up": ["Document denial rationale", "Prepare for potential complaint"],
"privileged": False,
},
"extension": {
"subject": "Extension Notice for Your Data Subject Request",
"body": (
"Dear {requestor_name},\n\n"
"We are writing regarding your {request_type} request (Reference: {ref_number}). "
"Due to {extension_reason}, we require additional time to complete your request.\n\n"
"We will provide a full response by {new_deadline}.\n\n"
"We apologize for any inconvenience.\n\n"
"Regards,\n{sender_name}\n{sender_title}"
),
"variables": ["requestor_name", "request_type", "ref_number", "extension_reason",
"new_deadline", "sender_name", "sender_title"],
"follow_up": ["Update tracking system deadline", "Set reminder for new deadline"],
"privileged": False,
},
},
"discovery": {
"initial-notice": {
"subject": "LITIGATION HOLD NOTICE - {matter_name}",
"body": (
"PRIVILEGED AND CONFIDENTIAL\n"
"ATTORNEY-CLIENT COMMUNICATION\n\n"
"TO: {custodians}\n"
"RE: Litigation Hold - {matter_name}\n"
"DATE: {notice_date}\n\n"
"This notice requires you to preserve all documents, communications, and data "
"related to {matter_name}. This includes:\n\n"
"- Emails, text messages, and instant messages\n"
"- Documents, spreadsheets, and presentations\n"
"- Calendar entries and meeting notes\n"
"- Voicemails and call logs\n"
"- Any other electronically stored information (ESI)\n\n"
"Relevant data types: {data_types}\n\n"
"YOU MUST:\n"
"1. Immediately cease any routine deletion of potentially relevant documents\n"
"2. Suspend auto-delete policies for relevant systems\n"
"3. Preserve all relevant documents in their current form\n"
"4. Notify your team members who may have relevant information\n\n"
"DO NOT delete, modify, or move any potentially relevant documents. "
"Failure to comply may result in serious legal consequences.\n\n"
"Contact {sender_name} with questions.\n\n"
"{sender_name}\n{sender_title}"
),
"variables": ["matter_name", "custodians", "notice_date", "data_types",
"sender_name", "sender_title"],
"follow_up": ["Track custodian acknowledgments", "Set 7-day reminder follow-up",
"Document preservation scope"],
"privileged": True,
},
"reminder": {
"subject": "LITIGATION HOLD REMINDER #{reminder_number} - {matter_name}",
"body": (
"PRIVILEGED AND CONFIDENTIAL\n\n"
"This is reminder #{reminder_number} regarding the litigation hold for {matter_name}.\n\n"
"Your obligation to preserve all relevant documents, communications, and data "
"remains in effect. Please confirm your continued compliance by replying to this "
"message.\n\n"
"If you have discovered additional relevant information since the last notice, "
"please contact {sender_name} immediately.\n\n"
"{sender_name}\n{sender_title}"
),
"variables": ["matter_name", "reminder_number", "sender_name", "sender_title"],
"follow_up": ["Log reminder sent", "Track acknowledgments", "Schedule next reminder"],
"privileged": True,
},
"modification": {
"subject": "LITIGATION HOLD MODIFICATION - {matter_name}",
"body": (
"PRIVILEGED AND CONFIDENTIAL\n\n"
"The scope of the litigation hold for {matter_name} has been modified as follows:\n\n"
"{modification_description}\n\n"
"All other terms of the original hold notice remain in effect. "
"Please confirm your understanding of this modification.\n\n"
"{sender_name}\n{sender_title}"
),
"variables": ["matter_name", "modification_description", "sender_name", "sender_title"],
"follow_up": ["Update hold scope documentation", "Track custodian acknowledgments"],
"privileged": True,
},
"release": {
"subject": "LITIGATION HOLD RELEASE - {matter_name}",
"body": (
"PRIVILEGED AND CONFIDENTIAL\n\n"
"The litigation hold for {matter_name} is hereby released effective {release_date}.\n\n"
"You may resume normal document retention and deletion policies for materials "
"that were subject to this hold. However, do not delete any documents that may "
"be subject to other active holds or retention policies.\n\n"
"{sender_name}\n{sender_title}"
),
"variables": ["matter_name", "release_date", "sender_name", "sender_title"],
"follow_up": ["Close hold in tracking system", "Resume normal retention policies"],
"privileged": True,
},
},
"privacy": {
"cookies": {
"subject": "Re: Cookie Policy Inquiry",
"body": (
"Dear {requestor_name},\n\n"
"Thank you for your inquiry about our cookie practices.\n\n"
"Our website uses cookies as described in our Cookie Policy. "
"You can manage your cookie preferences at any time through our consent "
"management platform available on our website.\n\n"
"For more information, please visit: {cookie_policy_url}\n\n"
"Regards,\n{sender_name}\n{sender_title}"
),
"variables": ["requestor_name", "cookie_policy_url", "sender_name", "sender_title"],
"follow_up": ["Log inquiry for privacy metrics"],
"privileged": False,
},
"data-sharing": {
"subject": "Re: Data Sharing Inquiry",
"body": (
"Dear {requestor_name},\n\n"
"Thank you for your question about our data sharing practices.\n\n"
"We share personal data only as described in our Privacy Notice and "
"in accordance with applicable data protection laws. {sharing_details}\n\n"
"For complete details, please review our Privacy Notice: {privacy_notice_url}\n\n"
"Regards,\n{sender_name}\n{sender_title}"
),
"variables": ["requestor_name", "sharing_details", "privacy_notice_url",
"sender_name", "sender_title"],
"follow_up": ["Log inquiry", "Review if inquiry suggests process gap"],
"privileged": False,
},
"children": {
"subject": "Re: Children's Privacy Inquiry",
"body": (
"Dear {requestor_name},\n\n"
"Thank you for your concern regarding children's privacy.\n\n"
"Our services are not directed at children under {age_threshold}. "
"We do not knowingly collect personal data from children. "
"If you believe a child's data has been collected, please contact us "
"immediately at {privacy_email} so we can investigate and take appropriate action.\n\n"
"Regards,\n{sender_name}\n{sender_title}"
),
"variables": ["requestor_name", "age_threshold", "privacy_email",
"sender_name", "sender_title"],
"follow_up": ["Investigate if specific child data concern raised", "Log inquiry"],
"privileged": False,
},
"transfers": {
"subject": "Re: International Data Transfer Inquiry",
"body": (
"Dear {requestor_name},\n\n"
"Thank you for your inquiry about international data transfers.\n\n"
"When we transfer personal data outside {origin_jurisdiction}, we implement "
"appropriate safeguards including {transfer_mechanism}. "
"These measures ensure your data receives an adequate level of protection.\n\n"
"Regards,\n{sender_name}\n{sender_title}"
),
"variables": ["requestor_name", "origin_jurisdiction", "transfer_mechanism",
"sender_name", "sender_title"],
"follow_up": ["Log inquiry", "Verify transfer mechanisms are current"],
"privileged": False,
},
},
"vendor": {
"contract-status": {
"subject": "Re: Contract Status Inquiry - {vendor_name}",
"body": (
"Dear {requestor_name},\n\n"
"Regarding your inquiry about the contract with {vendor_name}:\n\n"
"Contract Status: {contract_status}\n"
"Contract Reference: {contract_ref}\n\n"
"{additional_details}\n\n"
"Regards,\n{sender_name}\n{sender_title}"
),
"variables": ["requestor_name", "vendor_name", "contract_status", "contract_ref",
"additional_details", "sender_name", "sender_title"],
"follow_up": ["Update contract tracking system if needed"],
"privileged": False,
},
"amendments": {
"subject": "Re: Contract Amendment Request - {vendor_name}",
"body": (
"Dear {requestor_name},\n\n"
"We have received your request to amend the agreement with {vendor_name} "
"(Reference: {contract_ref}).\n\n"
"Proposed amendment: {amendment_description}\n\n"
"This request is under review by our legal team. We will provide an update "
"within {review_timeline}.\n\n"
"Regards,\n{sender_name}\n{sender_title}"
),
"variables": ["requestor_name", "vendor_name", "contract_ref",
"amendment_description", "review_timeline", "sender_name", "sender_title"],
"follow_up": ["Assign to contract attorney", "Set review deadline"],
"privileged": False,
},
"certifications": {
"subject": "Re: Vendor Certification Request - {vendor_name}",
"body": (
"Dear {requestor_name},\n\n"
"Regarding the certification request for {vendor_name}:\n\n"
"{certification_details}\n\n"
"Please submit the required documentation to {submission_email} "
"by {deadline}.\n\n"
"Regards,\n{sender_name}\n{sender_title}"
),
"variables": ["requestor_name", "vendor_name", "certification_details",
"submission_email", "deadline", "sender_name", "sender_title"],
"follow_up": ["Track submission deadline", "Verify certifications upon receipt"],
"privileged": False,
},
"audit": {
"subject": "Re: Vendor Audit Request - {vendor_name}",
"body": (
"Dear {requestor_name},\n\n"
"We are scheduling an audit of {vendor_name} in accordance with our "
"contractual audit rights (Reference: {contract_ref}).\n\n"
"Audit scope: {audit_scope}\n"
"Proposed dates: {audit_dates}\n\n"
"Please confirm availability and prepare relevant documentation.\n\n"
"Regards,\n{sender_name}\n{sender_title}"
),
"variables": ["requestor_name", "vendor_name", "contract_ref", "audit_scope",
"audit_dates", "sender_name", "sender_title"],
"follow_up": ["Confirm audit dates", "Prepare audit checklist"],
"privileged": False,
},
},
"nda": {
"standard-form": {
"subject": "Non-Disclosure Agreement - {counterparty}",
"body": (
"Dear {requestor_name},\n\n"
"Please find attached our standard form Non-Disclosure Agreement for execution "
"in connection with {purpose}.\n\n"
"NDA Type: {nda_type}\n"
"Counterparty: {counterparty}\n"
"Term: {term}\n\n"
"Please review, sign, and return at your earliest convenience. "
"If you have questions or require modifications, please contact us.\n\n"
"Regards,\n{sender_name}\n{sender_title}"
),
"variables": ["requestor_name", "counterparty", "purpose", "nda_type", "term",
"sender_name", "sender_title"],
"follow_up": ["Track NDA execution", "Set signature deadline"],
"privileged": False,
},
"counterparty-markup": {
"subject": "Re: NDA Markup Review - {counterparty}",
"body": (
"Dear {requestor_name},\n\n"
"We have reviewed the markup provided by {counterparty} to our NDA. "
"Our comments are as follows:\n\n"
"{markup_comments}\n\n"
"Please advise on next steps.\n\n"
"Regards,\n{sender_name}\n{sender_title}"
),
"variables": ["requestor_name", "counterparty", "markup_comments",
"sender_name", "sender_title"],
"follow_up": ["Schedule negotiation call if needed", "Track markup versions"],
"privileged": False,
},
"decline": {
"subject": "Re: NDA Request - {counterparty}",
"body": (
"Dear {requestor_name},\n\n"
"After review, we are unable to enter into an NDA with {counterparty} "
"at this time. {decline_reason}\n\n"
"Regards,\n{sender_name}\n{sender_title}"
),
"variables": ["requestor_name", "counterparty", "decline_reason",
"sender_name", "sender_title"],
"follow_up": ["Document decline reason", "Notify business stakeholder"],
"privileged": False,
},
"renewal": {
"subject": "NDA Renewal Notice - {counterparty}",
"body": (
"Dear {requestor_name},\n\n"
"The NDA with {counterparty} (Reference: {nda_ref}) is approaching its "
"expiration date of {expiry_date}.\n\n"
"Please confirm whether renewal is required. If so, we will prepare "
"the renewal documentation.\n\n"
"Regards,\n{sender_name}\n{sender_title}"
),
"variables": ["requestor_name", "counterparty", "nda_ref", "expiry_date",
"sender_name", "sender_title"],
"follow_up": ["Track renewal decision", "Set expiry reminder"],
"privileged": False,
},
},
"subpoena": {
"acknowledgment": {
"subject": "FOR COUNSEL REVIEW - Subpoena Acknowledgment - {matter_name}",
"body": (
"FOR COUNSEL REVIEW ONLY\n\n"
"Dear {requestor_name},\n\n"
"We acknowledge receipt of the subpoena related to {matter_name} "
"served on {service_date}.\n\n"
"Response deadline: {response_deadline}\n"
"Issuing party: {issuing_party}\n\n"
"This matter has been referred to legal counsel for review.\n\n"
"Regards,\n{sender_name}\n{sender_title}"
),
"variables": ["requestor_name", "matter_name", "service_date",
"response_deadline", "issuing_party", "sender_name", "sender_title"],
"follow_up": ["IMMEDIATE: Route to counsel", "Calendar response deadline",
"Identify responsive documents"],
"privileged": True,
},
"objection": {
"subject": "FOR COUNSEL REVIEW - Objection to Subpoena - {matter_name}",
"body": (
"FOR COUNSEL REVIEW ONLY\n\n"
"The following objections are raised to the subpoena in {matter_name}:\n\n"
"{objection_grounds}\n\n"
"This response must be reviewed and approved by counsel before submission.\n\n"
"{sender_name}\n{sender_title}"
),
"variables": ["matter_name", "objection_grounds", "sender_name", "sender_title"],
"follow_up": ["Counsel review required", "File objection by deadline"],
"privileged": True,
},
"extension": {
"subject": "FOR COUNSEL REVIEW - Extension Request - {matter_name}",
"body": (
"FOR COUNSEL REVIEW ONLY\n\n"
"We respectfully request an extension of time to respond to the subpoena "
"in {matter_name}.\n\n"
"Current deadline: {current_deadline}\n"
"Requested deadline: {requested_deadline}\n"
"Reason: {extension_reason}\n\n"
"{sender_name}\n{sender_title}"
),
"variables": ["matter_name", "current_deadline", "requested_deadline",
"extension_reason", "sender_name", "sender_title"],
"follow_up": ["Counsel approval required", "Track extension response"],
"privileged": True,
},
"compliance": {
"subject": "FOR COUNSEL REVIEW - Subpoena Compliance - {matter_name}",
"body": (
"FOR COUNSEL REVIEW ONLY\n\n"
"The following responsive documents are prepared for production in "
"response to the subpoena in {matter_name}:\n\n"
"{production_summary}\n\n"
"Privilege review status: {privilege_status}\n\n"
"This production must be reviewed and approved by counsel before submission.\n\n"
"{sender_name}\n{sender_title}"
),
"variables": ["matter_name", "production_summary", "privilege_status",
"sender_name", "sender_title"],
"follow_up": ["Counsel approval required", "Prepare privilege log if applicable"],
"privileged": True,
},
},
"insurance": {
"initial-claim": {
"subject": "Insurance Claim Notification - {claim_type}",
"body": (
"Dear {requestor_name},\n\n"
"This notice is to inform our insurance carrier of a potential claim.\n\n"
"Claim Type: {claim_type}\n"
"Date of Occurrence: {occurrence_date}\n"
"Description: {claim_description}\n"
"Policy Number: {policy_number}\n\n"
"We will provide additional information as it becomes available.\n\n"
"Regards,\n{sender_name}\n{sender_title}"
),
"variables": ["requestor_name", "claim_type", "occurrence_date",
"claim_description", "policy_number", "sender_name", "sender_title"],
"follow_up": ["Track claim acknowledgment", "Gather supporting documentation"],
"privileged": False,
},
"supplemental-info": {
"subject": "Supplemental Information - Claim #{claim_number}",
"body": (
"Dear {requestor_name},\n\n"
"Please find below supplemental information regarding Claim #{claim_number}:\n\n"
"{supplemental_details}\n\n"
"Please confirm receipt and advise if additional information is needed.\n\n"
"Regards,\n{sender_name}\n{sender_title}"
),
"variables": ["requestor_name", "claim_number", "supplemental_details",
"sender_name", "sender_title"],
"follow_up": ["Log supplemental submission", "Track carrier response"],
"privileged": False,
},
"reservation-of-rights": {
"subject": "Re: Reservation of Rights - Claim #{claim_number}",
"body": (
"Dear {requestor_name},\n\n"
"We acknowledge receipt of the reservation of rights letter for "
"Claim #{claim_number} dated {ror_date}.\n\n"
"We have noted the carrier's position and will respond as appropriate. "
"This matter has been referred to counsel for review.\n\n"
"Regards,\n{sender_name}\n{sender_title}"
),
"variables": ["requestor_name", "claim_number", "ror_date",
"sender_name", "sender_title"],
"follow_up": ["Route to counsel immediately", "Review coverage position"],
"privileged": False,
},
},
}
# Default variable values
DEFAULTS: Dict[str, str] = {
"ref_number": "[REF-XXXX]",
"sender_name": "[SENDER NAME]",
"sender_title": "[SENDER TITLE]",
"notice_date": datetime.now().strftime("%Y-%m-%d"),
"nda_type": "Mutual",
"term": "2 years",
"age_threshold": "13",
"review_timeline": "10 business days",
}
def get_template(category: str, sub_type: str) -> Optional[Dict[str, Any]]:
"""Retrieve template by category and sub-type."""
cat_templates = TEMPLATES.get(category)
if not cat_templates:
return None
return cat_templates.get(sub_type)
def substitute_variables(text: str, variables: Dict[str, str]) -> Tuple[str, List[str]]:
"""Substitute variables in template text. Returns (text, missing_vars)."""
missing = []
pattern = re.compile(r'\{(\w+)\}')
found_vars = pattern.findall(text)
for var in found_vars:
if var in variables:
text = text.replace(f"{{{var}}}", variables[var])
elif var in DEFAULTS:
text = text.replace(f"{{{var}}}", DEFAULTS[var])
else:
missing.append(var)
text = text.replace(f"{{{var}}}", f"[{var.upper().replace('_', ' ')}]")
return text, missing
def generate_response(category: str, sub_type: str,
variables: Dict[str, str]) -> Dict[str, Any]:
"""Generate a response from template with variables."""
template = get_template(category, sub_type)
if not template:
available = list(TEMPLATES.get(category, {}).keys()) if category in TEMPLATES else []
return {
"error": True,
"message": f"Template not found: {category}/{sub_type}",
"available_sub_types": available,
"available_categories": list(TEMPLATES.keys()),
}
subject, subj_missing = substitute_variables(template["subject"], variables)
body, body_missing = substitute_variables(template["body"], variables)
all_missing = list(set(subj_missing + body_missing))
return {
"error": False,
"generated_date": datetime.now().strftime("%Y-%m-%d %H:%M"),
"category": category,
"sub_type": sub_type,
"privileged": template.get("privileged", False),
"subject": subject,
"body": body,
"follow_up_actions": template.get("follow_up", []),
"required_variables": template.get("variables", []),
"missing_variables": all_missing,
"escalation_note": "ALWAYS ESCALATE" if category == "subpoena" else None,
}
def format_text(result: Dict[str, Any]) -> str:
"""Format response as human-readable text."""
if result.get("error"):
lines = [f"ERROR: {result['message']}"]
if result.get("available_categories"):
lines.append(f"Available categories: {', '.join(result['available_categories'])}")
if result.get("available_sub_types"):
lines.append(f"Available sub-types: {', '.join(result['available_sub_types'])}")
return "\n".join(lines)
lines = []
lines.append("=" * 70)
lines.append("GENERATED LEGAL RESPONSE")
lines.append("=" * 70)
lines.append(f"Category: {result['category']}")
lines.append(f"Sub-Type: {result['sub_type']}")
lines.append(f"Date: {result['generated_date']}")
if result.get("privileged"):
lines.append("Status: PRIVILEGED AND CONFIDENTIAL")
if result.get("escalation_note"):
lines.append(f"WARNING: {result['escalation_note']}")
lines.append("")
lines.append(f"Subject: {result['subject']}")
lines.append("-" * 70)
lines.append(result["body"])
lines.append("-" * 70)
if result.get("missing_variables"):
lines.append("")
lines.append(f"MISSING VARIABLES: {', '.join(result['missing_variables'])}")
lines.append("(Shown as [PLACEHOLDER] in response)")
if result.get("follow_up_actions"):
lines.append("")
lines.append("FOLLOW-UP ACTIONS:")
for action in result["follow_up_actions"]:
lines.append(f" - {action}")
lines.append("")
lines.append("=" * 70)
return "\n".join(lines)
def parse_var(var_str: str) -> Tuple[str, str]:
"""Parse a KEY=VALUE variable string."""
if "=" not in var_str:
return var_str, ""
key, value = var_str.split("=", 1)
return key.strip(), value.strip()
def main() -> None:
parser = argparse.ArgumentParser(
description="Generate templated responses for common legal inquiries."
)
parser.add_argument("--json", action="store_true", help="Output in JSON format")
parser.add_argument("--category", required=True,
choices=list(TEMPLATES.keys()),
help="Response category")
parser.add_argument("--sub-type", required=True,
help="Response sub-type within category")
parser.add_argument("--var", action="append", default=[],
help="Variable substitution as KEY=VALUE (repeatable)")
args = parser.parse_args()
try:
variables = dict(parse_var(v) for v in args.var)
result = generate_response(args.category, args.sub_type, variables)
if args.json:
print(json.dumps(result, indent=2))
else:
print(format_text(result))
if result.get("error"):
sys.exit(1)
except Exception as e:
print(f"Error: {e}", file=sys.stderr)
sys.exit(1)
if __name__ == "__main__":
main()