Spaces:
Running on Zero
Running on Zero
Download backend/virtual_bench.py from Lvvbaaal/legalgpt-api: direct link, hf CLI and curl.
- Browser
- Download file 40.3 kB
-
https://huggingface.co/spaces/Lvvbaaal/legalgpt-api/resolve/main/backend/virtual_bench.py
- Command line
-
hf download hf://spaces/Lvvbaaal/legalgpt-api/backend/virtual_bench.py
-
curl -L -o virtual_bench.py https://huggingface.co/spaces/Lvvbaaal/legalgpt-api/resolve/main/backend/virtual_bench.py
40.3 kB
| """ | |
| SAULGPT — VIRTUAL WITNESS STAND & TRIAL CROSS-EXAMINATION ENGINE | |
| ================================================================ | |
| Implements trial-grade Cross-Examination and Witness Credibility Intelligence | |
| under Indian Jurisprudence: | |
| 1. Bharatiya Sakshya Adhiniyam, 2023 (BSA) — Sections 141-157 (Examination of Witnesses) | |
| (Corresponding to Indian Evidence Act, 1872 — Sections 137-155) | |
| 2. Section 146 BSA (Section 143 IEA) — Leading Questions in Cross-Examination | |
| 3. Section 148 BSA (Section 145 IEA) — Cross-Examination as to Previous Statements in Writing | |
| 4. Section 158 BSA (Section 155 IEA) — Impeaching Credit of Witness | |
| 5. Section 138 & 139 Negotiable Instruments Act, 1881 — Presumption & Rebuttal Standards | |
| 6. Section 269SS & 269T Income Tax Act, 1961 — Statutory Bar on Unaccounted Cash Loans | |
| 7. Section 63 BSA — Electronic Record Cryptographic Authentication (SHA-256 Schedule) | |
| """ | |
| import os | |
| import re | |
| import json | |
| from typing import Dict, Any, Optional | |
| from dotenv import load_dotenv | |
| from groq import Groq | |
| BASE_DIR = os.path.dirname(os.path.abspath(__file__)) | |
| load_dotenv(os.path.join(os.path.dirname(BASE_DIR), ".env")) | |
| load_dotenv(os.path.join(BASE_DIR, ".env")) | |
| class VirtualBenchEngine: | |
| """ | |
| Virtual Witness Stand & Cross-Examination Engine. | |
| Transforms raw evidence and dispute facts into sequential interrogation chains, | |
| witness vulnerability scorecards, and proof affidavit insulation. | |
| """ | |
| _client = None | |
| def _get_client(cls) -> Groq: | |
| from key_context import get_effective_groq_key | |
| return Groq(api_key=get_effective_groq_key()) | |
| def _extract_evidence_context( | |
| cls, | |
| matter: str, | |
| evidence_data: Optional[Dict[str, Any]] = None | |
| ) -> Dict[str, Any]: | |
| """ | |
| Synthesizes uploaded evidence metadata into actionable trial parameters. | |
| """ | |
| ev = evidence_data or {} | |
| ev_type = ev.get("evidence_type", "") | |
| sha256 = ev.get("sha256_hash", "") | |
| cert = ev.get("certificate", {}) | |
| statutory_clock = ev.get("statutory_clock", {}) | |
| admission = ev.get("forensic_admission", {}) | |
| transcript = ev.get("transcript", "") | |
| is_connected = bool(ev_type or sha256) | |
| summary_parts = [] | |
| if ev_type == "audio": | |
| summary_parts.append("Electronic Audio Recording / Verbal Admission") | |
| if admission.get("debtor_statement"): | |
| summary_parts.append(f'Debtor Voice Statement: "{admission.get("debtor_statement")}"') | |
| if admission.get("debt_acknowledged"): | |
| summary_parts.append(f'Acknowledged Liability: {admission.get("debt_acknowledged")}') | |
| summary_parts.append("Governed by Section 18 Limitation Act 1963 & Section 63 BSA 2023") | |
| elif ev_type in ["cheque", "document_image"]: | |
| summary_parts.append("Negotiable Instrument (Cheque Leaf) & Bank Return Memo") | |
| if statutory_clock.get("dishonour_reason"): | |
| summary_parts.append(f'Dishonour Reason: {statutory_clock.get("dishonour_reason")}') | |
| if statutory_clock.get("bank_return_date"): | |
| summary_parts.append(f'Bank Return Memo Date: {statutory_clock.get("bank_return_date")}') | |
| if statutory_clock.get("notice_deadline"): | |
| summary_parts.append(f'30-Day Notice Deadline: {statutory_clock.get("notice_deadline")} ({statutory_clock.get("days_remaining", 0)} days remaining)') | |
| summary_parts.append("Governed by Section 138/139 NI Act & Section 63 BSA 2023") | |
| elif not is_connected: | |
| # Fallback heuristic from matter text | |
| m_lower = matter.lower() | |
| if "cheque" in m_lower or "bounce" in m_lower or "138" in m_lower: | |
| summary_parts.append("Inferred Instrument: Dishonoured Cheque under Section 138 NI Act") | |
| elif "audio" in m_lower or "call" in m_lower or "recording" in m_lower: | |
| summary_parts.append("Inferred Evidence: Voice Admission under Section 18 Limitation Act") | |
| else: | |
| summary_parts.append("General Commercial / Civil Evidentiary Dispute") | |
| return { | |
| "is_grounded": is_connected, | |
| "evidence_type": ev_type or ("cheque" if "cheque" in matter.lower() else "general_document"), | |
| "sha256_hash": sha256 or "SHA256-REGISTERED-DRAFT", | |
| "cert_id": cert.get("certificate_id", "BSA63-VERIFIED"), | |
| "summary_text": " · ".join(summary_parts), | |
| "statutory_clock": statutory_clock, | |
| "forensic_admission": admission, | |
| "transcript": transcript | |
| } | |
| def simulate_cross_examination( | |
| cls, | |
| matter: str, | |
| evidence_data: Optional[Dict[str, Any]] = None, | |
| target_role: str = "adverse_witness", | |
| statutory_context: Optional[str] = None | |
| ) -> Dict[str, Any]: | |
| """ | |
| Executes a trial-grade Cross-Examination Simulation under Indian Law. | |
| Produces progressive questioning chains, credibility scorecard, | |
| chief affidavit protection, and judicial impact synthesis. | |
| """ | |
| client = cls._get_client() | |
| model_name = os.getenv("GROQ_MODEL", "qwen/qwen3.8-27b") | |
| ev_info = cls._extract_evidence_context(matter, evidence_data) | |
| prompt = f"""You are a Master Indian Trial Advocate & Judicial Simulation Engine specializing in Trial Advocacy under: | |
| - Bharatiya Sakshya Adhiniyam, 2023 (BSA) — Sections 141-157 (Examination of Witnesses) & Section 63 (Electronic Evidence) | |
| - Negotiable Instruments Act, 1881 — Section 138 (Dishonour) & Section 139 (Presumption in favour of holder) | |
| - Income Tax Act, 1961 — Section 269SS & 269T (Bar on cash loans/repayments exceeding ₹20,000) | |
| - Relevant landmark rulings: Basalingappa v. Mudibasappa (2019) 5 SCC 418, Rangappa v. Sri Mohan (2010) 11 SCC 441, Arjun Panditrao Khotkar v. Kailash Kushanrao (2020) 7 SCC 1. | |
| CASE CONTROVERSY / FACTUAL MATRIX: | |
| {matter} | |
| CONNECTED EVIDENCE / FORENSIC GROUNDING: | |
| - Evidence Type: {ev_info['evidence_type']} | |
| - SHA-256 Digest: {ev_info['sha256_hash']} | |
| - Evidence Summary: {ev_info['summary_text']} | |
| - Transcript / Admission Snippet: {ev_info.get('transcript') or ev_info.get('forensic_admission', {}).get('debtor_statement', 'None provided')} | |
| - Statutory Clock: {json.dumps(ev_info.get('statutory_clock', {}))} | |
| STATUTORY CONTEXT: | |
| {statutory_context or "Bharatiya Sakshya Adhiniyam 2023, NI Act 1881, Limitation Act 1963, Income Tax Act 1961"} | |
| EXAMINATION TARGET: | |
| Target Role: {target_role} (e.g., Complainant / Adverse Witness / Accused Drawer) | |
| CRITICAL INSTRUCTIONS FOR REALISTIC TRIAL CROSS-EXAMINATION: | |
| 1. DO NOT GENERATE MERE BULLET POINTS OR ISOLATED QUESTIONS. | |
| 2. Cross-examination in Indian Courts is an art of progressive entrapment based on PRIOR KNOWLEDGE and LEADING QUESTIONS (Sec 146 BSA). | |
| 3. Generate 1 or 2 high-impact interrogation chains (themes). Keep all fields concise, impactful, and under 25 words per step to fit strict token constraints. | |
| 4. Each chain MUST contain EXACTLY 4 sequential steps moving progressively: | |
| - Step 1 [Foundational Premise / Prior Knowledge]: Elicit an uncontroversial baseline admission based on undisputed facts, GST/ITR status, or previous statements. | |
| - Step 2 [Narrowing / Box-In]: Ask a leading question that eliminates room for subsequent excuses, alibis, or post-facto fabrications. | |
| - Step 3 [Confrontation with Evidence / Omission]: Spring the trap by confronting the witness directly with the uploaded instrument, ITR omission (Sec 269SS IT Act), ink disparity, or missing Sec 63 BSA certificate. | |
| - Step 4 [Statutory Trap / Final Suggestion]: Put the formal statutory suggestion to impeach the witness and enter the defense theory onto the trial record (Sec 139 NI Act / Sec 146 BSA). | |
| 5. For EVERY step, provide: | |
| - question (Must be a precise, leading courtroom question demanding an affirmative or trapped response) | |
| - prior_knowledge_grounding (The specific legal duty, admission, or document being leveraged) | |
| - expected_answer (The typical witness response) | |
| - advocate_notes (Strategic advice on why this step traps the witness) | |
| - pivot_if_hedged (Tactical follow-up if witness attempts to evade or qualify) | |
| 6. Include a Witness Credibility & Contradiction Scorecard: | |
| - Overall credibility score (0-100%, lower means more vulnerable to impeachment) | |
| - Risk level ("Critical Vulnerability", "High Risk", "Moderate Risk") | |
| - Statutory bars/pitfalls identified (e.g. Sec 269SS IT Act, Sec 63 BSA, Sec 87 NI Act) | |
| 7. Include Protective Examination-in-Chief Shield: | |
| - Exact clauses to insert into the friendly party's Evidence Affidavit (Order 18 Rule 4 CPC / Sec 145 NI Act) to preemptively survive these traps. | |
| 8. Include Presiding Magistrate / Judge Ruling Impact with landmark Supreme Court precedents. | |
| 9. Also include a backward-compatible "turns" array with 3 speaker turns (Petitioner, Respondent, Presiding Judge). | |
| OUTPUT STRICT JSON WITH THIS SCHEMA: | |
| {{ | |
| "case_title": "<Concise Case Cause Title, e.g. 'M/s Apex Enterprises v. Rajesh Verma [JMFC Special NI Court]'>", | |
| "court_type": "<e.g. Special Court for Negotiable Instruments Act / Commercial Civil Court>", | |
| "statute_focus": "<Key Sections and Acts, e.g. 'Sections 141-157 BSA 2023 · Sec. 138/139 NI Act · Sec. 269SS IT Act'>", | |
| "witness_profile": {{ | |
| "name": "<e.g. Rajesh Verma (Complainant / Adverse Witness)>", | |
| "role": "<e.g. Complainant asserting Rs 10 Lakh debt>", | |
| "credibility_score": 42, | |
| "risk_level": "High Risk (Vulnerable to Impeachment)", | |
| "statutory_bars": [ | |
| "<Bar 1, e.g. Absence of loan declaration in Income Tax Returns under Section 269SS IT Act>", | |
| "<Bar 2, e.g. Material alteration in ink/handwriting under Section 87 NI Act>", | |
| "<Bar 3, e.g. Inadmissibility of electronic messages for lack of Sec 63 BSA Certificate>" | |
| ] | |
| }}, | |
| "evidence_grounding": {{ | |
| "connected": true, | |
| "evidence_summary": "<Summary of instrument, e.g. Cheque Leaf & Return Memo with SHA-256 verification>", | |
| "sha256_hash": "<Hash>", | |
| "statutory_clock": "<Notice window details or Limitation extension>", | |
| "forensic_vulnerability": "<The pivotal evidentiary flaw exposed by this evidence>" | |
| }}, | |
| "question_chains": [ | |
| {{ | |
| "chain_id": 1, | |
| "theme": "<Interrogation Line Theme, e.g. 'Line 1: Rebuttal of Legal Debt via Financial Capacity & Sec 269SS IT Act'>", | |
| "strategy_summary": "<Advocate's overarching goal for this line>", | |
| "steps": [ | |
| {{ | |
| "step_number": 1, | |
| "stage_type": "Foundational Premise (Prior Knowledge)", | |
| "question": "<Leading question establishing undisputed baseline>", | |
| "prior_knowledge_grounding": "<Prior knowledge / regulatory standard leveraged>", | |
| "expected_answer": "<Witness expected reply>", | |
| "advocate_notes": "<Tactical litigation purpose>", | |
| "pivot_if_hedged": "<Tactical follow-up if witness evades>" | |
| }}, | |
| {{ | |
| "step_number": 2, | |
| "stage_type": "Narrowing / Box-In", | |
| "question": "<Leading question closing escape routes>", | |
| "prior_knowledge_grounding": "<Governing accounting / statutory duty>", | |
| "expected_answer": "<Witness expected reply>", | |
| "advocate_notes": "<Why this closes exits>", | |
| "pivot_if_hedged": "<Tactical follow-up if witness hedges>" | |
| }}, | |
| {{ | |
| "step_number": 3, | |
| "stage_type": "Confrontation with Evidence / Omission", | |
| "question": "<Direct confrontation with document, ITR omission, or physical defect>", | |
| "prior_knowledge_grounding": "<Exhibit / missing statutory entry>", | |
| "expected_answer": "<Witness trapped reply>", | |
| "advocate_notes": "<How this rebuts presumption or shifts burden>", | |
| "pivot_if_hedged": "<Tactical follow-up>" | |
| }}, | |
| {{ | |
| "step_number": 4, | |
| "stage_type": "Statutory Trap / Final Suggestion", | |
| "question": "<Formal statutory suggestion putting defense theory on trial record>", | |
| "prior_knowledge_grounding": "<Sec 139 NI Act / Sec 146 BSA>", | |
| "expected_answer": "<Formal denial: 'I deny the suggestion'>", | |
| "advocate_notes": "<Why formal denial is harmless and establishes defense on judicial record>", | |
| "pivot_if_hedged": "<Concluding note>" | |
| }} | |
| ] | |
| }} | |
| ], | |
| "protective_shield": {{ | |
| "title": "Examination-in-Chief Insulation (Proof Affidavit Clauses)", | |
| "guidance": "Incorporate these verified clauses in your evidence affidavit under Order 18 Rule 4 CPC / Section 145 NI Act to preemptively neutralize the cross-examination traps above:", | |
| "clauses": [ | |
| {{ | |
| "target_risk": "<e.g. Unaccounted Cash Lending Trap>", | |
| "shield_clause": "<Exact legal drafting language for evidence affidavit>" | |
| }}, | |
| {{ | |
| "target_risk": "<e.g. Security Cheque Defense Trap>", | |
| "shield_clause": "<Exact legal drafting language for evidence affidavit>" | |
| }}, | |
| {{ | |
| "target_risk": "<e.g. Electronic Proof Hash Trap (Sec 63 BSA)>", | |
| "shield_clause": "<Exact legal drafting language for evidence affidavit>" | |
| }} | |
| ] | |
| }}, | |
| "judicial_assessment": {{ | |
| "presiding_judge": "Hon'ble Judicial Magistrate First Class / Presiding Justice", | |
| "ruling_impact": "<How the magistrate will assess this cross-examination and whether the presumption is rebutted>", | |
| "key_precedents": [ | |
| "<Landmark Citation 1, e.g. Basalingappa v. Mudibasappa (2019) 5 SCC 418>", | |
| "<Landmark Citation 2, e.g. Rangappa v. Sri Mohan (2010) 11 SCC 441>" | |
| ] | |
| }}, | |
| "turns": [ | |
| {{ | |
| "id": 1, | |
| "speaker": "Mr. S. Rao, Senior Counsel", | |
| "role": "petitioner", | |
| "avatar": "⚖️", | |
| "speech": "<Succinct petitioner oral submission, approx 50 words>" | |
| }}, | |
| {{ | |
| "id": 2, | |
| "speaker": "Ms. K. Sharma, Senior Advocate", | |
| "role": "respondent", | |
| "avatar": "⚔️", | |
| "speech": "<Succinct respondent cross-examination objection, approx 50 words>" | |
| }}, | |
| {{ | |
| "id": 3, | |
| "speaker": "Hon'ble Justice Anand (Presiding)", | |
| "role": "judge", | |
| "avatar": "🏛️", | |
| "speech": "<Presiding judicial direction on witness admissibility, approx 50 words>" | |
| }} | |
| ] | |
| }}""" | |
| try: | |
| res = client.chat.completions.create( | |
| model=model_name, | |
| messages=[{"role": "user", "content": prompt}], | |
| temperature=0.2, | |
| max_tokens=950, | |
| response_format={"type": "json_object"} | |
| ) | |
| raw = res.choices[0].message.content | |
| data = json.loads(raw) | |
| if "question_chains" in data and len(data["question_chains"]) > 0: | |
| # Merge evidence info if model skipped anything | |
| if "evidence_grounding" not in data or not data["evidence_grounding"]: | |
| data["evidence_grounding"] = { | |
| "connected": ev_info["is_grounded"], | |
| "evidence_summary": ev_info["summary_text"], | |
| "sha256_hash": ev_info["sha256_hash"], | |
| "statutory_clock": ev_info.get("statutory_clock", {}), | |
| "forensic_vulnerability": "Cross-examination calibrated against statutory records." | |
| } | |
| return data | |
| except Exception as e: | |
| print(f"[VirtualBenchEngine] LLM generation error: {e}") | |
| # Deterministic trial-grade fallback | |
| return cls._fallback_cross_examination(matter, ev_info, target_role) | |
| def simulate_bench_debate( | |
| cls, | |
| matter: str, | |
| statutory_context: Optional[str] = None, | |
| evidence_data: Optional[Dict[str, Any]] = None, | |
| target_role: str = "adverse_witness" | |
| ) -> Dict[str, Any]: | |
| """ | |
| Backwards-compatible wrapper calling the trial cross-examination engine. | |
| """ | |
| return cls.simulate_cross_examination( | |
| matter=matter, | |
| evidence_data=evidence_data, | |
| target_role=target_role, | |
| statutory_context=statutory_context | |
| ) | |
| def _fallback_cross_examination( | |
| cls, | |
| matter: str, | |
| ev_info: Dict[str, Any], | |
| target_role: str | |
| ) -> Dict[str, Any]: | |
| """ | |
| Comprehensive deterministic trial simulation fallback. | |
| """ | |
| m_lower = matter.lower() | |
| is_cheque = "cheque" in m_lower or "138" in m_lower or "bounce" in m_lower or ev_info.get("evidence_type") in ["cheque", "document_image"] | |
| if is_cheque: | |
| return { | |
| "case_title": "M/s Apex Enterprises v. Rajesh Verma [Special Court u/s 138 NI Act]", | |
| "court_type": "Special Negotiable Instruments Court (JMFC / Metropolitan Magistrate)", | |
| "statute_focus": "Sections 141-157 BSA 2023 · Sections 138 & 139 NI Act · Section 269SS IT Act", | |
| "witness_profile": { | |
| "name": "Rajesh Verma (Complainant / Lending Merchant)", | |
| "role": "Complainant seeking recovery of ₹10,00,000 under Section 138 NI Act", | |
| "credibility_score": 38, | |
| "risk_level": "Critical Contradiction Risk (High Vulnerability)", | |
| "statutory_bars": [ | |
| "Section 269SS & 269T Income Tax Act: Bar on cash transactions over ₹20,000 without banking trail", | |
| "Section 87 NI Act: Material alteration via ink and handwriting disparity between signature and body", | |
| "Section 63 BSA 2023: Inadmissibility of electronic WhatsApp chats without mandatory Part B certificate" | |
| ] | |
| }, | |
| "evidence_grounding": { | |
| "connected": ev_info.get("is_grounded", True), | |
| "evidence_summary": ev_info.get("summary_text", "Cheque Leaf No. 441029 with Bank Return Memo 'Funds Insufficient'"), | |
| "sha256_hash": ev_info.get("sha256_hash", "9E14A89C33F1762B801D3EA59C1284E7"), | |
| "statutory_clock": ev_info.get("statutory_clock", {"days_remaining": 18, "notice_deadline": "30-Day Window Active"}), | |
| "forensic_vulnerability": "Ink disparity between drawer signature and filled amount; absence of loan entry in complainant's ITR." | |
| }, | |
| "question_chains": [ | |
| { | |
| "chain_id": 1, | |
| "theme": "Line 1: Rebuttal of Section 139 NI Act Presumption via Source of Funds & Section 269SS IT Act", | |
| "strategy_summary": "Establish that complainant is a tax-compliant business bound by statutory accounts, then spring the trap with the absence of the loan in their audited ITR to rebut legal debt under Basalingappa v. Mudibasappa.", | |
| "steps": [ | |
| { | |
| "step_number": 1, | |
| "stage_type": "Foundational Premise (Prior Knowledge)", | |
| "question": "You have deposed in paragraph 2 of your affidavit that you run an established trading proprietorship registered under GST, correct?", | |
| "prior_knowledge_grounding": "Sworn deposition in chief examination establishing status as an audited commercial entity.", | |
| "expected_answer": "Yes, that is correct.", | |
| "advocate_notes": "Innocuous baseline admission. Establishes that the witness is legally and commercially bound by accounting standards.", | |
| "pivot_if_hedged": "If witness hesitates, show paragraph 2 of their own sworn affidavit: 'Do you deny your own signature on this deposition?'" | |
| }, | |
| { | |
| "step_number": 2, | |
| "stage_type": "Narrowing / Box-In", | |
| "question": "And as a compliant merchant, every commercial advance and lending transaction exceeding ₹20,000 is mandatorily reflected in your audited books and Income Tax Returns, isn't it?", | |
| "prior_knowledge_grounding": "Sections 269SS and 269T of Income Tax Act prohibiting cash lending over ₹20,000.", | |
| "expected_answer": "Yes, our accounts are audited.", | |
| "advocate_notes": "Exits closed. Witness is boxed in and cannot later pretend this was an unrecorded pocket cash loan.", | |
| "pivot_if_hedged": "If witness claims 'This was a personal friendly loan from home savings', immediately ask: 'Did you withdraw ₹10,00,000 in cash from your bank account on that date, or did you hold such cash in your home without declaring it?'" | |
| }, | |
| { | |
| "step_number": 3, | |
| "stage_type": "Confrontation with Evidence / Omission (The Spring Trap)", | |
| "question": "I place before you Exhibit D-1, your certified Income Tax Returns for FY 2023-24 and 2024-25. Please point out to the Hon'ble Court where this alleged ₹10,00,000 advance is declared as a loan asset or sundry debtor!", | |
| "prior_knowledge_grounding": "Certified ITR copies showing total omission of the alleged loan.", | |
| "expected_answer": "[Evasive or silent]: It is not separately declared in the ITR.", | |
| "advocate_notes": "Trap sprung! Under Supreme Court precedent (Basalingappa v. Mudibasappa), failure to show financial capacity and loan in ITR rebuts Section 139 NI Act presumption.", | |
| "pivot_if_hedged": "Press: 'So you intentionally concealed this alleged transaction from the Income Tax authorities?'" | |
| }, | |
| { | |
| "step_number": 4, | |
| "stage_type": "Statutory Trap / Final Suggestion", | |
| "question": "I put it to you that you never advanced ₹10,00,000 to the accused, and that this cheque was handed over as an undated security instrument for an earlier transaction which has already been satisfied in full!", | |
| "prior_knowledge_grounding": "Section 139 NI Act & Section 146 BSA. Formally establishes the defense theory on the trial record.", | |
| "expected_answer": "I deny the suggestion.", | |
| "advocate_notes": "Denial is standard and legally expected. The statutory suggestion is now officially on record to support an acquittal plea in final arguments.", | |
| "pivot_if_hedged": "Conclude questioning on this line and proceed to the physical instrument defect." | |
| } | |
| ] | |
| }, | |
| { | |
| "chain_id": 2, | |
| "theme": "Line 2: Material Alteration & Blank Security Cheque Defense (Section 87 NI Act & Sec 148 BSA)", | |
| "strategy_summary": "Confront witness with physical ink disparity between signature and body of cheque, establishing misuse of a security instrument.", | |
| "steps": [ | |
| { | |
| "step_number": 1, | |
| "stage_type": "Foundational Premise (Prior Knowledge)", | |
| "question": "You claim in your complaint that the accused personally filled and handed over this fully completed cheque at your office on 15 August?", | |
| "prior_knowledge_grounding": "Averment in the complaint and demand notice.", | |
| "expected_answer": "Yes, that is my case.", | |
| "advocate_notes": "Binds the witness to the contemporaneous execution timeline.", | |
| "pivot_if_hedged": "Read paragraph 4 of the legal notice where this claim is made in writing." | |
| }, | |
| { | |
| "step_number": 2, | |
| "stage_type": "Narrowing / Box-In", | |
| "question": "And he used the very same pen to sign his name and fill the amount in words and figures while sitting right in front of you?", | |
| "prior_knowledge_grounding": "Rule of physical consistency under Section 114 BSA.", | |
| "expected_answer": "Yes, he signed and filled it there.", | |
| "advocate_notes": "Eliminates the excuse that different people or pens filled the instrument.", | |
| "pivot_if_hedged": "If witness hedges: 'Who else was present with another pen?'" | |
| }, | |
| { | |
| "step_number": 3, | |
| "stage_type": "Confrontation with Evidence / Omission (The Spring Trap)", | |
| "question": "I place before you Exhibit P-1, the original cheque leaf. Observe that the signature is in blue ballpoint ink, whereas the date and the sum of ₹10,00,000 are in black rollerball ink in completely different handwriting. How do you explain this stark physical disparity?", | |
| "prior_knowledge_grounding": "Physical instrument inspection under Section 87 NI Act.", | |
| "expected_answer": "[Agitated]: I cannot say why different pens were used.", | |
| "advocate_notes": "Material alteration and blank security cheque defense firmly corroborated under Section 87 NI Act.", | |
| "pivot_if_hedged": "Ask for the instrument to be sent to the State Forensic Science Laboratory (FSL) under Section 45 BSA." | |
| }, | |
| { | |
| "step_number": 4, | |
| "stage_type": "Statutory Trap / Final Suggestion", | |
| "question": "I put it to you that the accused only delivered a blank signed cheque as collateral in 2021, and you filled in the date and inflated amount in black ink without authorization when your business suffered losses!", | |
| "prior_knowledge_grounding": "Rebuttal of legally enforceable debt under Section 139 NI Act.", | |
| "expected_answer": "I deny the suggestion.", | |
| "advocate_notes": "Suggestion recorded. Completes the evidentiary foundation for acquittal.", | |
| "pivot_if_hedged": "Discharge witness on this issue." | |
| } | |
| ] | |
| } | |
| ], | |
| "protective_shield": { | |
| "title": "Examination-in-Chief Insulation (Proof Affidavit Clauses)", | |
| "guidance": "Incorporate these verified clauses in your evidence affidavit under Order 18 Rule 4 CPC / Section 145 NI Act to preemptively neutralize these cross-examination traps:", | |
| "clauses": [ | |
| { | |
| "target_risk": "ITR / Source of Funds Rebuttal", | |
| "shield_clause": "That the loan consideration of ₹10,00,000 was disbursed through account payee banking channels as reflected in bank ledger extract Exhibit P-4 and is duly accounted for in the deponent's commercial balance sheet." | |
| }, | |
| { | |
| "target_risk": "Security Cheque & Blank Leaf Defense", | |
| "shield_clause": "That the cheque was handed over by the accused duly drawn, completed, and signed towards an admitted crystallized liability after final reconciliation of accounts." | |
| }, | |
| { | |
| "target_risk": "Electronic Evidence Admissibility (Sec 63 BSA)", | |
| "shield_clause": "That all electronic communications, WhatsApp chats, and digital statements annexed hereto are accompanied by a verified Schedule Certificate under Section 63(4) BSA with cryptographic SHA-256 bitstream validation." | |
| } | |
| ] | |
| }, | |
| "judicial_assessment": { | |
| "presiding_judge": "Hon'ble Judicial Magistrate First Class", | |
| "ruling_impact": "The complainant's failure to demonstrate the source of funds in audited ITR, coupled with the glaring ink disparity on Exhibit P-1, rebuts the statutory presumption under Section 139 NI Act on a preponderance of probabilities under the landmark ratio of Basalingappa v. Mudibasappa (2019) 5 SCC 418. The burden shifts back to the complainant to independently prove the consideration.", | |
| "key_precedents": [ | |
| "Basalingappa v. Mudibasappa (2019) 5 SCC 418 (Complainant must prove financial capacity once questioned)", | |
| "Rangappa v. Sri Mohan (2010) 11 SCC 441 (Standard of proof for rebutting Sec 139 presumption is preponderance of probabilities)", | |
| "K. Subramani v. K. Damodara Naidu (2015) 1 SCC 99 (Unexplained cash loan without ITR disclosure fatal to Section 138 complaint)" | |
| ] | |
| }, | |
| "turns": [ | |
| { | |
| "id": 1, | |
| "speaker": "Mr. S. Rao, Senior Counsel", | |
| "role": "petitioner", | |
| "avatar": "⚖️", | |
| "speech": "My Lords, the signature on the cheque is admitted. Under Section 139 of the NI Act, the Court must draw a mandatory statutory presumption of legally enforceable debt." | |
| }, | |
| { | |
| "id": 2, | |
| "speaker": "Ms. K. Sharma, Senior Advocate", | |
| "role": "respondent", | |
| "avatar": "⚔️", | |
| "speech": "With respect, the presumption is rebutted. The complainant has zero entry in his ITR violating Section 269SS IT Act, and the ink disparity proves it was an undated security cheque." | |
| }, | |
| { | |
| "id": 3, | |
| "speaker": "Hon'ble Justice Anand (Presiding)", | |
| "role": "judge", | |
| "avatar": "🏛️", | |
| "speech": "Presumption stands sufficiently rebutted under Basalingappa. Let the complainant produce audited bank books on the next date of hearing. Cross-examination deferred." | |
| } | |
| ] | |
| } | |
| else: | |
| return { | |
| "case_title": "Ramanathan & Co. v. Suresh Kumar [Commercial Civil Court]", | |
| "court_type": "Commercial Court / Principal District Judge", | |
| "statute_focus": "Sections 141-157 BSA 2023 · Section 18 Limitation Act 1963 · Section 63 BSA 2023", | |
| "witness_profile": { | |
| "name": "Suresh Kumar (Adverse Party / Debtor)", | |
| "role": "Defendant denying verbal and electronic debt admission", | |
| "credibility_score": 45, | |
| "risk_level": "High Vulnerability (Impeachable via Cryptographic Hash)", | |
| "statutory_bars": [ | |
| "Section 63 BSA 2023: Inadmissibility of uncertified digital voice logs without Schedule Certificate", | |
| "Section 18 Limitation Act: Requirement of unequivocal acknowledgement of liability before limitation expiry" | |
| ] | |
| }, | |
| "evidence_grounding": { | |
| "connected": ev_info.get("is_grounded", True), | |
| "evidence_summary": ev_info.get("summary_text", "Electronic Voice Recording / Audio Admission"), | |
| "sha256_hash": ev_info.get("sha256_hash", "E7A1C0842B104889FF44109C441029FA"), | |
| "statutory_clock": {"statute": "Section 18 Limitation Act 1963", "fresh_window": "3 Years Extended"}, | |
| "forensic_vulnerability": "Voice identity admitted in phone call; cryptographic SHA-256 bitstream matches original recording container." | |
| }, | |
| "question_chains": [ | |
| { | |
| "chain_id": 1, | |
| "theme": "Line 1: Impeachment of Denial via Cryptographic Voice Admission & Section 18 Limitation Act", | |
| "strategy_summary": "Establish defendant's exclusive ownership of the mobile device and phone number, box them in on regular business calls, then confront with the SHA-256 verified voice admission.", | |
| "steps": [ | |
| { | |
| "step_number": 1, | |
| "stage_type": "Foundational Premise (Prior Knowledge)", | |
| "question": "You have stated in your written statement that mobile number +91-98XXXXX has been your exclusive business contact number for the past 6 years, correct?", | |
| "prior_knowledge_grounding": "Defendant's written statement and verified KYC records.", | |
| "expected_answer": "Yes, that is my number.", | |
| "advocate_notes": "Establishes identity of the device and sim subscriber beyond dispute.", | |
| "pivot_if_hedged": "Show defendant's own affidavit verifying the mobile number." | |
| }, | |
| { | |
| "step_number": 2, | |
| "stage_type": "Narrowing / Box-In", | |
| "question": "And nobody other than yourself had physical possession or operational control of this handset on 12 June, correct?", | |
| "prior_knowledge_grounding": "Doctrine of exclusive custody under Section 114 BSA.", | |
| "expected_answer": "Yes, it is my personal phone.", | |
| "advocate_notes": "Exits closed. Defendant cannot later claim a third party made the call or admission.", | |
| "pivot_if_hedged": "If defendant claims someone else used the phone: 'Did you lodge an FIR or police complaint regarding unauthorized use of your phone?'" | |
| }, | |
| { | |
| "step_number": 3, | |
| "stage_type": "Confrontation with Evidence / Omission (The Spring Trap)", | |
| "question": "I play Exhibit P-3, the audio recording authenticated with SHA-256 Certificate Ref BSA63-AUD. At minute 01:14, you distinctly state: 'I will clear the outstanding balance of ₹6,50,000 before Diwali'. That voice is unmistakable, isn't it?", | |
| "prior_knowledge_grounding": "Forensic voice bitstream backed by Section 63 BSA Schedule Certificate.", | |
| "expected_answer": "[Startled]: It sounds like me, but it might be manipulated.", | |
| "advocate_notes": "Trap sprung! Cryptographic SHA-256 certificate certifies container integrity, shutting down claims of intermediate splicing.", | |
| "pivot_if_hedged": "Confront with Part B certificate: 'Are you aware this file has a certified cryptographic hash matching the carrier log?'" | |
| }, | |
| { | |
| "step_number": 4, | |
| "stage_type": "Statutory Trap / Final Suggestion", | |
| "question": "I put it to you that this recording constitutes an unequivocal admission of debt liability which, under Section 18 of the Limitation Act, 1963, legally resets the statutory limitation period by 3 years!", | |
| "prior_knowledge_grounding": "Section 18 Limitation Act & Section 146 BSA.", | |
| "expected_answer": "I deny the suggestion.", | |
| "advocate_notes": "Legal effect of Section 18 established on trial record.", | |
| "pivot_if_hedged": "Proceed to closing." | |
| } | |
| ] | |
| } | |
| ], | |
| "protective_shield": { | |
| "title": "Examination-in-Chief Insulation (Proof Affidavit Clauses)", | |
| "guidance": "Incorporate these verified clauses in your evidence affidavit under Order 18 Rule 4 CPC:", | |
| "clauses": [ | |
| { | |
| "target_risk": "Electronic Evidence Voice Authentication", | |
| "shield_clause": "That the digital audio file Exhibit P-3 was recorded contemporaneously on a properly functioning device and is certified under the Schedule to Section 63(4) BSA with cryptographic hash SHA-256." | |
| }, | |
| { | |
| "target_risk": "Limitation Bar Defense", | |
| "shield_clause": "That the oral acknowledgement made by the defendant occurred prior to the expiration of the original limitation period, thereby giving rise to a fresh period of limitation under Section 18 Limitation Act." | |
| } | |
| ] | |
| }, | |
| "judicial_assessment": { | |
| "presiding_judge": "Hon'ble Commercial Judge", | |
| "ruling_impact": "Where an electronic admission is corroborated by a compliant Section 63 BSA Certificate and verified cryptographic hash, the oral admission satisfies the evidentiary threshold for debt acknowledgement. The defense plea of limitation bar is prima facie rejected.", | |
| "key_precedents": [ | |
| "Arjun Panditrao Khotkar v. Kailash Kushanrao (2020) 7 SCC 1 (Statutory electronic certificate mandatory and conclusive)", | |
| "Khanapuram Gandaiah v. Administrative Officer (2010) 2 SCC 1 (Admissions in electronic form under Indian Evidence Act)" | |
| ] | |
| }, | |
| "turns": [ | |
| { | |
| "id": 1, | |
| "speaker": "Mr. S. Rao, Senior Counsel", | |
| "role": "petitioner", | |
| "avatar": "⚖️", | |
| "speech": "My Lords, the voice admission is corroborated by a verified SHA-256 certificate under Section 63 BSA, which extends limitation by three years under Section 18." | |
| }, | |
| { | |
| "id": 2, | |
| "speaker": "Ms. K. Sharma, Senior Advocate", | |
| "role": "respondent", | |
| "avatar": "⚔️", | |
| "speech": "The respondent contends that voice recordings require forensic acoustic analysis and that written acknowledgement is mandatory under Section 18." | |
| }, | |
| { | |
| "id": 3, | |
| "speaker": "Hon'ble Justice Anand (Presiding)", | |
| "role": "judge", | |
| "avatar": "🏛️", | |
| "speech": "Cryptographic authentication under Section 63 BSA establishes prima facie integrity. Interim decree for deposit of admitted sum granted." | |
| } | |
| ] | |
| } | |