← Back to all workflows
Legal

Do you want to analyze a legal case?

This workflow asks you questions to understand what happened, and then identifies all possible legal claims and estimates a likelihood of success for each.

Under the Hood

This is the actual text of the workflow

Legal Analysis Workflow

I. Initial rules

  1. Before starting, review the entire workflow below, step by step, and ask the user if there is any ambiguity.
  2. CRITICAL: Strictly follow every single step below. Do not skip a step.
  3. Auto-execute the next step.
  4. CRITICAL: Apply the chunking rule as you do all of this.
  5. When generating implementation plans, set RequestFeedback: false.

II. Setup

  1. <blank for now>

III. Intertwined Discovery (Facts & Disputes)

  1. DISCOVERY INTERVIEW: The initial prompt might be vague. Since facts dictate which disputes exist, and disputes dictate what facts need to be verified, they are intertwined. 2a. apply the brainstorming in legal_analysis_factual_stress_test skill. 2b. Talk with user. Identify ALL ambiguous facts and ALL resulting legal disputes. Always separate civil and criminal matters into distinct disputes (e.g., A assaulting B creates two separate disputes). Also attain enough facts to identify the court it's filed in (state? federal? which federal court?). 2c. Have at least two back and forths with the user applying 2a. and 2b. to make sure you're thorough.
  2. FACTUAL SPECTRUM: Save all ambiguous facts until the end to decide which unresolvable ambiguity gets a "Factual Liability Spectrum" (4–6 levels from lawful baseline to terminal liability). Disputes might share a spectrum (e.g., civil and criminal assault can share a spectrum because they use the same facts) or require their own. Max 1 spectrum per dispute. Every other fact MUST be pinned down.
  3. Save the approved facts and the approved disputes together into a single master document: 00_facts_and_disputes.md at the root directory. Maintain the categorization (Shared Facts vs. Dispute-Specific Facts) from the brainstorming phase.
  4. PAUSE 1 (GATED APPROVAL): Stop execution and explicitly ask the user to approve the file.

IV. Stages of litigation

  1. Identify the litigation stages (e.g. injunction, MTD, MSJ, Trial, Appellate, or whatever is appropriate) for each dispute.
  2. Write 00_stages_by_dispute.md at the root directory showing exactly which stages will be executed for which claims. 2a. Create the dedicated subdirectories for each dispute (e.g., 1_Civil_Fraud). 2b. Inside each dispute folder, create subfolders for each defined stage (e.g. MTD, Appellate).
  3. PAUSE 2 (GATED APPROVAL): Stop execution and ask the user to approve the stages.

V. Cycling through the stages and disputes

  1. We'll now do a cycling process.
  2. First, pick a dispute. Then do VI. below for the dispute.
  3. Then do VII–XI for each stage of that dispute, in the stage's respective subdirectory. 3a. Before starting any appellate or post-trial stage, verify the procedural pathway from the prior stage is constitutionally valid (e.g., no double jeopardy, interlocutory appeals require qualifying conditions like collateral order doctrine). 3b. PROCEDURAL STATE COLLAPSE: Before starting any stage after the first one, auto-determine who won the prior stage. The side with the lowest chance of winning in the prior prediction is appealing. If ambiguous, the Plaintiff is appealing. Write this context to 00d_procedural_posture.md in the current stage's directory. Do not ask the user.
  4. After finishing all stages within the dispute, go back to step V.2 and pick the next dispute, and repeat.
  5. Once you finish this cycling process for all disputes, proceed to step XII below.

VI. Issue-Spotting for each dispute

  1. ISSUE-SPOTTING MATRIX: Invoke legal_analysis_issue_spotter skill. Based on the facts in 00_facts_and_disputes.md, aggressively hunt for hyper-narrow, specific statutes and case law-based causes of action for this dispute, rejecting lazy catch-all defaults. List their legal names and explicitly pair them with the highest binding available precedent. Save as 00_issue_spotting_matrix.md in this specific Dispute subdirectory.
  2. Invoke legal_analysis_engine_switch skill ("legal analysis engine switch skill") at Step VI.2 to switch to Claude. The next step requires Claude to independently review the issue-spotting matrix.
  3. As Claude, review the matrix for completeness applying the same skill, and save as 00a_issue_spotting_matrix_reviewed.md.
  4. Invoke legal analysis engine switch skill at Step VI.4 to switch to Gemini. The next step requires Gemini to run the element extractor.
  5. ELEMENT EXTRACTION: Invoke legal_analysis_element_extractor skill. Using 00_facts_and_disputes.md and 00a_issue_spotting_matrix_reviewed.md, execute the rigid fact-to-element mapping for every claim. Save as 00b_element_matrix.md.
  6. STOP FOR ELEMENT REVIEW. Complete the extractor write. Invoke legal analysis engine switch skill at Step VI.6 to switch to Claude. The next step requires Claude to independently review the element matrix.
  7. As Claude, critically review the 00b_element_matrix.md by applying the same skill, and mapping to guarantee the fact-appraisals are logically sound and adhere strictly to the static requirements without hallucination, saving the finalized, fully-mapped version as 00c_element_matrix_reviewed.md.
  8. Invoke legal analysis engine switch skill at Step VI.8 to switch to Gemini. The next step requires Gemini to draft the advocacy memos.

VII. The memos

  1. Plaintiff Advocacy Memo: Invoke legal_analysis_associate skill. Read the newly created 00c_element_matrix_reviewed.md. Execute the strict Pre-Flight State Machine (Jurisdiction Lock, Immunity Ceilings, Anti-Defaulting Map, Precedent Pairs) BEFORE drafting the plaintiff memo. Save as 01_pl_advocacy_memo_draft.md.
  2. Primary Review (Plaintiff): Invoke legal_analysis_partner skill. Execute the hostile 5-point Boolean Audit Ledger across the Step 1 memo. Reject and aggressively rewrite the draft if any structural hallucination or jurisdictional bleed is detected. Save as 02_pl_advocacy_memo_audited.md.
  3. Defense Advocacy Memo: Invoke legal_analysis_associate skill. Read the newly created 00c_element_matrix_reviewed.md. Execute the strict Pre-Flight State Machine BEFORE drafting the defense memo. Save as 03_def_advocacy_memo_draft.md.
  4. Primary Review (Defense): Invoke legal_analysis_partner skill. Execute the hostile 5-point Boolean Audit Ledger across the Step 3 memo. Reject and aggressively rewrite if any structural hallucination or jurisdictional bleed is detected. Save as 04_def_advocacy_memo_audited.md.

VIII. The prediction

  1. Prediction Analysis: Invoke legal_analysis_monte_carlo skill. Using the audited plaintiff and defendant memos, produce the prediction analysis following the skill's formatting and structural rules. Save as 05_prediction_analysis.md.

IX. Co-counsel review. (THE DEEP TRIANGULATION PROTOCOL)

(CRITICAL: Do NOT provide the drafted memos to the engine until Step 4).

  1. Invoke legal analysis engine switch skill at Step IX.1 to switch to Claude. The co-counsel blind triangulation protocol requires Claude as the independent reviewer.
  2. PHASE 1 (The Blind Baseline): Invoke legal_analysis_cocounsel skill. Provide ONLY 00_facts_and_disputes.md. Tell the engine to execute Phase 1 and output the baseline thesis. (Internal sequencing: finish Phase 1 before starting Phase 2 — do NOT wait for user approval.)
  3. PHASE 2 (The Logical Delta): Provide the output from Phase 1, plus ONLY 00a_issue_spotting_matrix_reviewed.md and 00c_element_matrix_reviewed.md. Tell the engine to execute Phase 2. (Internal sequencing: finish Phase 2 before starting Phase 3 — do NOT wait for user approval.)
  4. PHASE 3 & 4 (The Murder Board & Synthesis): Provide the output from Phase 2, plus the active drafted memos (02, 04, and 05). Tell the engine to execute Phase 3 and Phase 4, resolving discrepancies and saving the finalized, cross-verified files with a _reviewed suffix (e.g., 02a_pl_advocacy_memo_reviewed.md, 04a, 05a). When rewriting the prediction analysis (05a), the engine must also read legal_analysis_monte_carlo skill for formatting rules (histogram format, SCOTUS justice naming, factual spectrum descriptions).
  5. Invoke legal analysis engine switch skill at Step IX.5 to switch to Gemini. Co-counsel review is complete; returning to Gemini for factual reconciliation and summarizing.

X. Factual Reconciliation

  1. Invoke legal_analysis_factual_reconciliation skill. Follow the skill's triage protocol. If material questions require user input, PAUSE and present them before proceeding.

XI. Summarizing

  1. Invoke legal_analysis_stage_summarizer skill. Using 00_facts_and_disputes.md, the reviewed memos (02a, 04a), and the reviewed prediction (05a), produce the stage summary following the skill's rigid formatting rules. Save as 06_summary.md in the stage's subdirectory.
  2. Loop Execution: If there are remaining stages for this dispute, loop back to VII to process the next stage. If all stages are complete, go back to V to pick the next dispute.

XII. Master summary

  1. Read and follow legal_analysis_master_summarizer skill. CRITICAL: Follow the skill's structural rules precisely — do NOT freelance a new document. Compile the 06_summary.md files from all stages into msummary_[disputename].md in the dispute's directory.

XIII. External Review & Factual Updates

  1. Ask the user which disputes they want reviewed and with which tools (deepthink, deep research, anything else the user picks). 1a. A tool should only be fed one dispute at a time.
  2. Prepare a review prompt for the specific dispute, including all material facts (and the exact Factual Liability Spectrum, if one exists). Constrain them to our finalized facts; do not let them hallucinate facts that change the analysis. 2a. Run chosen tool(s) via the appropriate slash command such as /gemini-deepthink or /gemini-deepresearch. 2b. If the user picked another tool, ask the user to run it with your prompt and wait for the results. 2c. Alternatively, the user can simply do a Q&A with you to give you updated information. If they do that, ask them if they're done and treat that conversation as a review result.
  3. ADVERSARIAL AUDIT: Append each result to a single consolidated file named, e.g. v1-v2_updates.md (change the numbers for later updates) then execute the legal-analysis-audit workflow on that file.
  4. MASTER SUMMARY REVISION: Compile the incorporation recommendations from each adversarial_debrief_[source].md file. Apply only the items marked "YES incorporate." 5a. Invoke legal_analysis_v2_generator skill. Following its strict formatting and Delta-Tracking instructions, save the new master summary as msummary_[disputename]_v2, v3, and so on.
  5. Repeat 1-4 for the next dispute that the user wants reviewed.

The Output

When you run this workflow, the AI agents will generate the following folders and files:

  • 001_legal_analysis_[case_name]/ — The root folder created for the specific case.

    • Example: 001_legal_analysis_smith_v_jones\​
  • 00_facts_and_disputes.md — Master document containing all approved facts and disputes across the entire case.

    • Example: 001_legal_analysis_smith_v_jones\​00_facts_and_disputes.md
  • 00_stages_by_dispute.md — Tracks which litigation stages (MTD, Trial, Appellate, SCOTUS) will be executed for each dispute.

    • Example: 001_legal_analysis_smith_v_jones\​00_stages_by_dispute.md
  • [Dispute Name]/ — Dedicated subdirectories generated for every distinct legal dispute.

    • Example: 001_legal_analysis_smith_v_jones\​1_Civil_Fraud\​
  • [Dispute Name]/00_issue_spotting_matrix.md — The exhaustive menu of every possible cause of action, statute, or legal theory that applies to this dispute.

    • Example: 001_legal_analysis_smith_v_jones\​1_Civil_Fraud\​00_issue_spotting_matrix.md
  • [Dispute Name]/00a_issue_spotting_matrix_reviewed.md — The cross-engine reviewed version of the issue spotting matrix.

    • Example: 001_legal_analysis_smith_v_jones\​1_Civil_Fraud\​00a_issue_spotting_matrix_reviewed.md
  • [Dispute Name]/00b_element_matrix.md — A matrix mapping the case facts directly to the required legal elements for each claim.

    • Example: 001_legal_analysis_smith_v_jones\​1_Civil_Fraud\​00b_element_matrix.md
  • [Dispute Name]/00c_element_matrix_reviewed.md — The cross-engine reviewed version of the element matrix, purged of hallucinations.

    • Example: 001_legal_analysis_smith_v_jones\​1_Civil_Fraud\​00c_element_matrix_reviewed.md
  • [Dispute Name]/[Stage]/ — Subdirectories for each litigation stage analyzed (e.g. MTD, Trial, Appellate, SCOTUS).

    • Example: 001_legal_analysis_smith_v_jones\​1_Civil_Fraud\​MTD\​
  • [Stage]/00d_procedural_posture.md — Context auto-generated for appellate or post-trial stages, documenting who won the prior stage.

    • Example: 001_legal_analysis_smith_v_jones\​1_Civil_Fraud\​Appellate\​00d_procedural_posture.md
  • [Stage]/01_pl_advocacy_memo_draft.md — The initial draft of the plaintiff's advocacy memo for this stage.

    • Example: 001_legal_analysis_smith_v_jones\​1_Civil_Fraud\​MTD\​01_pl_advocacy_memo_draft.md
  • [Stage]/02_pl_advocacy_memo_audited.md — The partner-audited version of the plaintiff's memo.

    • Example: 001_legal_analysis_smith_v_jones\​1_Civil_Fraud\​MTD\​02_pl_advocacy_memo_audited.md
  • [Stage]/03_def_advocacy_memo_draft.md — The initial draft of the defense's advocacy memo.

    • Example: 001_legal_analysis_smith_v_jones\​1_Civil_Fraud\​MTD\​03_def_advocacy_memo_draft.md
  • [Stage]/04_def_advocacy_memo_audited.md — The partner-audited version of the defense's memo.

    • Example: 001_legal_analysis_smith_v_jones\​1_Civil_Fraud\​MTD\​04_def_advocacy_memo_audited.md
  • [Stage]/05_prediction_analysis.md — The Monte Carlo prediction on how a judge or jury might rule at this stage.

    • Example: 001_legal_analysis_smith_v_jones\​1_Civil_Fraud\​MTD\​05_prediction_analysis.md
  • [Stage]/02a_pl_advocacy_memo_reviewed.md — The co-counsel blind-reviewed version of the plaintiff's memo.

    • Example: 001_legal_analysis_smith_v_jones\​1_Civil_Fraud\​MTD\​02a_pl_advocacy_memo_reviewed.md
  • [Stage]/04a_def_advocacy_memo_reviewed.md — The co-counsel blind-reviewed version of the defense's memo.

    • Example: 001_legal_analysis_smith_v_jones\​1_Civil_Fraud\​MTD\​04a_def_advocacy_memo_reviewed.md
  • [Stage]/05a_prediction_analysis_reviewed.md — The co-counsel blind-reviewed version of the prediction.

    • Example: 001_legal_analysis_smith_v_jones\​1_Civil_Fraud\​MTD\​05a_prediction_analysis_reviewed.md
  • 07_new_factual_questions.md — New factual questions surfaced during the analysis that weren't identified during the original discovery interview.

    • Example: 001_legal_analysis_smith_v_jones\​07_new_factual_questions.md
  • [Stage]/06_summary.md — The condensed stage summary compiling all memos and predictions into a single document.

    • Example: 001_legal_analysis_smith_v_jones\​1_Civil_Fraud\​MTD\​06_summary.md
  • [Dispute Name]/msummary_[dispute].md — The master summary compiling all stage summaries for the entire dispute.

    • Example: 001_legal_analysis_smith_v_jones\​1_Civil_Fraud\​msummary_civil_fraud.md
  • [Dispute Name]/adversarial_debrief_[source].md — Adversarial audit of external review results (Deep Think, Deep Research, Westlaw, etc.).

    • Example: 001_legal_analysis_smith_v_jones\​1_Civil_Fraud\​adversarial_debrief_deep_think.md
  • [Dispute Name]/msummary_[dispute]_v2.md — Updated master summary incorporating findings from external audits.

    • Example: 001_legal_analysis_smith_v_jones\​1_Civil_Fraud\​msummary_civil_fraud_v2.md
  • [Dispute Name]/msummary_[dispute]_v2_highlighted.md — Track-changes highlighted version showing exactly what changed between v1 and v2.

    • Example: 001_legal_analysis_smith_v_jones\​1_Civil_Fraud\​msummary_civil_fraud_v2_highlighted.md

How to Set This Up

Option 1: The Easy Way (Automated)

Just point Antigravity to this webpage and ask it to figure it out for you. Antigravity can read this documentation, copy the workflow script, and automatically generate all the required skill files in the correct directories on your machine.

Option 2: The Hard Way (Manual Copy & Paste)

If Antigravity fails to set this up automatically, you will need to manually copy the scripts into your local directories:

  1. Copy the raw workflow script from the "Under the Hood" section above.
  2. Save it as C:\Users\[Your Name]\.gemini\antigravity\global_workflows\legal-analysis.md.
  3. You must also click every hyperlinked skill file and save its contents into your skills directory. You must do this for every single skill file linked in the workflow. For example, the legal_analysis_partner skill must be saved to C:\Users\[Your Name]\.gemini\antigravity\skills\legal_analysis_partner\SKILL.md.
  4. Once all files are saved, open Antigravity and type /legal-analysis in the chat to run it.