# Litigation Dashboard v2 — Architecture & Specification

**Document owner:** Mark Harley, Principal, Boss Lawyers Pty Ltd
**Status:** Blueprint / pre-build specification
**Version:** 2.0
**Last updated:** 2026-05-01
**Related documents:**
- `projects/leap-integration-research.md` — LEAP API capability research
- `projects/litigation-dashboard-mockup.html` — UX mockup (v1)
- `projects/intranet-blueprint.md` — firm intranet platform spec
- `reference/litigation-workflow.md` — 8-phase litigation workflow
- `reference/litigation-file-workflow.md` — file management workflow
- `reference/boss-lawyers-style.md` — drafting style guide
- `reference/qld-pleading-guide.md` — UCPR pleading rules
- `reference/key-time-limits.md` — limitation periods and procedural deadlines

---

## 1. System Overview

### 1.1 Vision Statement

The Litigation Dashboard is the central nervous system of Boss Lawyers' commercial litigation and insolvency practice. It is **not** another practice management tool — LEAP already does that. It is an **AI-augmented strategic command centre** that sits *on top* of LEAP and does what LEAP cannot:

- Reads, scores, and ranks every matter on merit, risk, and commercial viability
- Catalogues, weighs, and gap-checks the evidence in every file
- Drafts compliant Queensland court documents to firm standard, first time
- Surfaces what the principal needs to know, when he needs to know it
- Compresses junior-solicitor research and drafting time by 70%+
- Lets a 2–3 lawyer boutique fight, and beat, national-firm litigation teams

The dashboard is the operational expression of the firm's positioning: **top-tier work, boutique footprint, leverage through technology.**

### 1.2 Key Users

| User | Role | Primary use of dashboard |
|---|---|---|
| **Principal Solicitor** (Mark Harley) | Strategy, drafting oversight, client management, billing | Portfolio view; case ranking; AI advice engine; document QA gate; settlement recommendations |
| **Senior Associate** (future) | Run files day-to-day under principal supervision | Matter dashboard; gap detector; AI drafting; deadline management |
| **Junior Solicitor** (future) | Research, drafting, disclosure | AI drafting (first drafts); knowledge bank; evidence cataloguing; gap reports |
| **Paralegal** | File administration, court filing, evidence indexing | Evidence inventory; calendar/deadline entry; document register; LEAP sync |
| **Client** (limited portal) | Track matter progress, review docs, pay bills | Client portal: phase tracker, key dates, summary status, invoices, secure document drop |
| **Costs Assessor** (read-only export) | Assess itemised bills | Bill export with full narrative justification |

### 1.3 Core Modules

1. **Matter Dashboard** — per-matter and portfolio operational views
2. **Case Ranking Engine** — Merit, Risk, Commercial Viability, Priority scores
3. **Evidence Analyser** — inventory, ranking, witness assessment, element-mapping
4. **Gap Detector** — pleading, legal, procedural, strategic, witness, authority gaps
5. **Document Drafter** — template-driven AI drafting with QA gates and style enforcement
6. **Knowledge Bank** — case law, legislation, precedents, playbooks, opponent intelligence
7. **AI Advice Engine** — natural-language Q&A, next-step recommendations, drafted advices
8. **LEAP Integration** — two-way sync with the firm's practice management system
9. **Reporting & Analytics** — portfolio, financial, outcome, time, client reports

### 1.4 Technology Stack (proposed)

| Layer | Choice | Rationale |
|---|---|---|
| Frontend | Next.js 15 (React, TypeScript, App Router) | Mature, fast, SSR for portal, easy deploy |
| UI library | Tailwind CSS + shadcn/ui | Consistent with existing intranet mockup; fast to build |
| Auth | Auth.js + WebAuthn / passkeys; Microsoft Entra (M365) SSO for staff | Firm uses M365; passkeys for client portal |
| Application backend | Node.js (Fastify) or Python (FastAPI) | TypeScript end-to-end favoured for shared types |
| Primary database | PostgreSQL 16 (managed: Neon / Supabase / RDS) | Relational data model maps cleanly; JSONB for flexible AI metadata |
| Vector store | pgvector (Postgres extension) | Single DB; embeddings for knowledge bank, evidence, precedents |
| Object storage | S3-compatible (AWS S3 or R2) | Documents, evidence files; Sydney region for data sovereignty |
| AI / LLM | Anthropic Claude (Opus + Sonnet via API), with OpenAI fallback | Opus for drafting/advice; Sonnet for classification/scoring; Australian residency where available |
| Local LLM (sensitive) | Self-hosted Llama 3.x or Qwen via Ollama (optional) | For privileged content where API egress is undesirable |
| Background jobs | BullMQ (Redis) or Temporal | LEAP sync, embedding generation, scheduled gap checks |
| Hosting | AWS Sydney (ap-southeast-2) or Azure Australia East | Data sovereignty (LPP, client confidentiality) |
| Observability | OpenTelemetry → Grafana Cloud | Audit trail of AI actions is non-negotiable |
| Document generation | Microsoft Graph + Word OOXML templates; PDF via Gotenberg | LEAP works in Word; everyone signs in Word |
| Email/calendar | Microsoft Graph (Outlook/M365) | Firm uses Outlook; deadline sync |

**Architectural principles:**

- **Local-first where possible** — LEAP is the source of truth for billing/trust; the dashboard owns AI artefacts (scores, gap reports, drafts).
- **Audit everything AI does** — every score, every draft, every recommendation is logged with model, prompt, output, and human override.
- **Human-in-the-loop by default** — AI never sends correspondence, files documents, or commits time entries without solicitor approval.
- **Privilege-preserving** — privileged content tagged at ingestion; egress controls; per-matter data isolation; configurable "no external AI" flag for sensitive matters.

---

## 2. LEAP Integration

LEAP is the firm's practice management system. It owns: matter creation, contacts, time entries, billing, trust accounting, document management, and calendar. The dashboard **augments** LEAP — it does not replace it.

See `projects/leap-integration-research.md` for full API capability inventory.

### 2.1 LEAP API Surface (relevant endpoints)

| Domain | Endpoints / capabilities | Direction |
|---|---|---|
| **Matters** | List, get, create, update; custom fields; matter type | Pull (primary), push (limited updates) |
| **Contacts** | Cards (people, organisations); roles per matter | Pull |
| **Time entries** | Create, update, list; activity codes; rates; matter linkage | **Push** (dashboard is the timekeeping UI) |
| **Documents** | Upload to matter; metadata; download; versioning | Two-way |
| **Calendar / appointments** | Court dates, deadlines, appointments | Two-way |
| **Trust accounting** | Trust balance per matter (read); receipt/payment requests | Pull (read), push (request) |
| **Bills / invoices** | Draft, finalise, list | Push (draft); pull (status) |
| **Workflows** | LEAP workflow steps and matter phases | Pull, status push |

### 2.2 Sync Strategy

**Pull (LEAP → Dashboard):**
- Matter list & metadata (every 5 min, webhook if available)
- Contact cards on matter open
- Calendar entries (every 15 min)
- Trust balance (on demand and every 30 min)
- Bill status (every 30 min)
- Document list (on demand; download files lazily)

**Push (Dashboard → LEAP):**
- Time entries — created in dashboard with full QLD-compliant narrative, posted to LEAP as soon as solicitor confirms
- Documents — drafts approved in dashboard saved into LEAP matter document folder with version metadata
- Calendar entries — court dates, deadlines (UCPR-derived) added to LEAP and Outlook
- Bill drafts — itemised bills assembled in dashboard from time entries, pushed to LEAP for finalisation

**Conflict resolution:**
- LEAP is authoritative for: matter ID, parties, billing, trust, finalised invoices.
- Dashboard is authoritative for: scores, gap reports, evidence inventory, AI drafts (pre-finalisation), strategy memos.
- Last-writer-wins for shared fields (matter description, status) with audit log.

### 2.3 Auto-population from LEAP

When a new matter is opened in LEAP, the dashboard automatically:

1. Detects new matter via webhook / poll
2. Pulls all metadata (parties, court, matter type, principal in charge)
3. Creates dashboard matter record
4. Triggers AI matter-type classifier (e.g., "this looks like an oppression matter — apply playbook")
5. Pre-populates: workflow phase = 1 (Initial Assessment); deadline calculator runs (e.g., if SOC served, defence due in 28 days under UCPR r 137); blank scoring entries; suggested initial document templates.

### 2.4 Fee Estimate & Costs Disclosure Monitoring

A hard requirement under *Legal Profession Act 2007* (Qld) Pt 3.4 — clients must receive disclosure of estimates, and updated disclosure if estimates change substantially (s 315).

The dashboard:

- Pulls WIP from LEAP every hour
- Compares WIP against the client's costs estimate (stored on the matter)
- Triggers an **amber alert** at 70% of estimate
- Triggers a **red alert** at 90% of estimate, generating a draft s 315 update letter and a draft revised estimate
- Logs the alert and the lawyer's action (sent / not sent / revised) for compliance audit
- Flags any matter with >30 days since last bill where WIP > $5,000 (cashflow + disclosure hygiene)

### 2.5 Calendar Sync

Court dates and procedural deadlines are litigation-critical. The dashboard:

- Calculates UCPR-derived deadlines automatically (e.g., defence: 28 days from service r 137; reply: 14 days from defence r 164; disclosure: 28 days after pleadings close r 214)
- Calculates *Limitation of Actions Act 1974* (Qld) deadlines from cause-of-action accrual dates
- Pushes all deadlines to LEAP calendar **and** to the principal's Outlook (via Microsoft Graph)
- Sets staged reminders: 30, 14, 7, 3, 1 days
- Cross-checks: if a deadline approaches and no draft exists in the matter folder, raises a **red gap alert**

### 2.6 Document Management Bridge

- Documents drafted in dashboard → saved to LEAP matter folder with naming convention `YYYYMMDD - [Doc Type] - [Description] - v[n].docx`
- Documents in LEAP folder → listed in dashboard, indexed for AI retrieval (with privilege/disclosure tags)
- Version history maintained in dashboard (LEAP versioning is shallow); each version snapshot includes: who edited, what changed, AI involvement, QA gate result.

### 2.7 Trust Account Visibility

- Trust balance shown on every matter dashboard card
- Alert when trust funds insufficient to cover anticipated outlays (counsel fees, court filing fees, expert reports)
- **Read-only view** — trust transactions remain in LEAP under Trust Account Regulation compliance

---

## 3. Matter Dashboard

The Matter Dashboard is the operational home screen — one card per matter, expandable to a full per-matter workspace.

### 3.1 Matter Overview Card

Each card displays:

- **Header:** Matter name (e.g., "Smith v Jones Pty Ltd"), matter ID, LEAP link
- **Parties:** Plaintiff(s), Defendant(s), our client's role, opponent's solicitors and counsel
- **Court:** Jurisdiction (SCQ / DCQ / FCA / QCAT), proceeding number, presiding judge if known
- **Status & Phase:** Current phase from `reference/litigation-workflow.md` (1–8):
  1. Initial Assessment & Instructions
  2. Pre-Action Strategy & Letter of Demand
  3. Pleadings (Statement of Claim → Defence → Reply)
  4. Disclosure
  5. Interlocutory Applications & Case Management
  6. Evidence & Trial Preparation
  7. Trial
  8. Post-Judgment / Enforcement / Appeal
- **Traffic Light:** Green / Amber / Red (see §3.3)
- **Key dates:** Next deadline, next court date, limitation date if applicable
- **Scores:** Merit / Risk / Commercial Viability (small chips)
- **Financial summary:** WIP, billed YTD, trust balance
- **Team:** Assigned principal, fee earners, paralegal
- **Quick actions:** Open file • Draft document • Log time • Add evidence • Send correspondence • Update status

### 3.2 Per-Matter Workspace (full view)

Tabs:

1. **Overview** — card content above plus narrative status
2. **Pleadings** — SOC, Defence, Reply, etc., with version history and QA gate results
3. **Evidence** — inventory with element-mapping (see §5)
4. **Witnesses** — witness register with credibility/availability assessment
5. **Causes of Action** — for each COA: elements, evidence per element, gaps
6. **Authorities** — case law cited / available for this matter
7. **Documents** — full document register (LEAP + dashboard)
8. **Correspondence** — inbound/outbound chronology
9. **Calendar & Deadlines** — Gantt + list view
10. **Time & Billing** — time entries, draft bills, costs estimate vs WIP
11. **Strategy** — running strategy memo, settlement positions, AI advice log
12. **Scores** — full Merit/Risk/CV breakdown with sub-scores
13. **Audit** — full activity log (AI and human)

### 3.3 Traffic Light System

Computed automatically; can be overridden by principal.

| Status | Meaning | Trigger examples |
|---|---|---|
| 🟢 Green | On track | All deadlines >7 days out; no critical gaps; WIP <70% estimate; merit ≥6 |
| 🟡 Amber | Attention needed | Deadline 3–7 days; amber gap; WIP 70–90% estimate; client correspondence overdue >10 days |
| 🔴 Red | Urgent / overdue | Deadline ≤3 days with no draft; critical gap; deemed admission risk; WIP >90% estimate; trust shortfall; limitation period <30 days |

Each light is *explainable* — clicking shows the precise reason(s).

### 3.4 Timeline View

Visual horizontal timeline per matter:

- **Past events:** filings, correspondence, conferences, court appearances
- **Pending:** scheduled deadlines, court dates
- **Future projected:** estimated trial date, projected milestones based on phase progression
- Filter by event type; export to PDF for client reports

### 3.5 Phase Progression Tracker

Linked to the 8-phase workflow. Each phase has:

- Entry criteria (what marks transition into this phase)
- Required outputs (e.g., Phase 3: SOC drafted/served; Defence drafted/served)
- Standard tasks (auto-generated as a checklist from `reference/litigation-workflow.md`)
- Common pitfalls (pulled from playbooks — see §8)
- Exit criteria

Progress bar across phases 1–8; clicking a phase reveals its checklist and current status.

### 3.6 Quick Actions

One-click flows that combine multiple operations:

- **Draft document:** opens drafter (§7) with matter context pre-loaded
- **Log time:** opens time entry with narrative AI-assist (always QLD-compliant)
- **Send correspondence:** opens correspondence drafter; sends via M365; logs in matter; auto-time-entry
- **Update status:** changes phase; triggers checklist; logs reasoning
- **Run gap check:** invokes Gap Detector (§6) on demand

### 3.7 Financial Summary

Per matter:

- **WIP** (current, by fee earner, by phase)
- **Billed** (this month / YTD / matter total)
- **Collected** vs outstanding
- **Trust balance**
- **Costs estimate** (initial, revised, current)
- **Estimate remaining** (estimate – WIP – billed)
- **Recoverable on party-party basis** (estimated, applying scale where adverse costs likely)

### 3.8 Team Assignments & Workload

- Per matter: who is doing what
- Per fee earner: matters assigned, WIP this week, deadlines this week, capacity flag
- Useful as the firm grows past one-principal

### 3.9 Client Portal View

Limited, sanitised, client-facing:

- Matter summary (no privileged content)
- Phase tracker (high-level: "Pleadings closed; disclosure underway")
- Upcoming dates client should know
- Documents shared with client
- Recent invoices and trust balance
- Secure document upload (for client to provide evidence/documents)
- Booking link for conferences

Authentication via passkey or magic link. Privilege filter applied to all content shown.

---

## 4. Case Ranking Engine

The Case Ranking Engine is what makes this dashboard *strategic* rather than administrative. It assigns four scores to every matter, updated as new evidence, pleadings, and events occur.

### 4.1 Merit Score (1–10)

How strong is our legal position?

**Plaintiff matters:** For each cause of action, assess each element on a 1–5 scale of evidentiary support:
- 1 = no evidence
- 2 = weak/circumstantial
- 3 = some direct evidence, contested
- 4 = strong direct evidence
- 5 = overwhelming, contemporaneous, corroborated

Element scores are weighted by:
- Importance of the element (some elements are pivotal, e.g., causation in negligence)
- Quantum dependent on that COA succeeding

Average across COAs gives a 1–10 Merit Score.

**Defendant matters:** For each COA pleaded against the client, assess:
- Strength of each defence (factual, legal, procedural)
- Vulnerabilities in the plaintiff's case (gaps, limitation, standing, pleading defects under *Dare v Pulham*)

Higher Merit = stronger defence position.

**Sub-scores displayed:**
- Per cause of action (or defence)
- Per element
- Quantum-weighted overall

**Worked example:**
> Smith v Jones — breach of contract + misleading conduct
> - Breach of contract: contract formation 5/5, breach 4/5, causation 3/5, loss 4/5 → element-weighted: 4.1
> - Misleading conduct (s 18 ACL): conduct 4/5, in trade/commerce 5/5, misleading 3/5, reliance 2/5, loss 3/5 → 3.4
> - Quantum weights: BoC $850k (75%), s 18 ACL $280k overlap (25%) → composite Merit = 7.6/10

### 4.2 Risk Score (1–10) — higher = higher risk

What could go wrong? Sub-components:

| Risk factor | Weight | Inputs |
|---|---|---|
| Adverse costs exposure | 0.20 | Quantum at risk; opponent's likely costs to date; party-party recoverability; security for costs prospects |
| Limitation issues | 0.15 | Time to limitation; any latent COAs; relation-back rules (UCPR r 376) |
| Witness reliability | 0.15 | Per-witness assessment (§5.2); critical-witness count; cross-exam vulnerability |
| Documentary gaps | 0.15 | Gap Detector output (§6); missing contemporaneous records |
| Opponent quality | 0.10 | Solicitor + counsel reputation; track record vs us; resourcing |
| Client cooperation/credibility | 0.15 | Instructions completeness; documents produced; prior inconsistent statements |
| Judicial tendencies | 0.05 | Allocated judge if known; appellate risk |
| Procedural/strategic risks | 0.05 | Pending applications; counterclaim exposure; cross-claims |

Composite 1–10. Displayed as a stacked bar showing each factor's contribution.

### 4.3 Commercial Viability Score (1–10)

Should the client run this matter at all?

| Factor | Inputs |
|---|---|
| Quantum vs costs | Realistic recovery / total estimated costs to judgment (Boss Lawyers + counsel + outlays) |
| Capacity to pay | Opponent solvency check (ASIC, PPSR, property searches); insurance coverage; corporate structure |
| Insurance coverage | Identified policy; insurer's stance; reservation of rights |
| Cost-benefit by phase | Marginal cost vs marginal expected value at each phase exit |
| Settlement probability | Bayesian estimate from opponent behaviour, similar matters, mediation pressure points |
| Likely settlement range | Floor / midpoint / ceiling estimates with confidence band |
| Reputational / strategic value to client | Beyond pure money — restraint enforcement, industry signal, etc. |

A matter with **Merit 9, Risk 3, but Commercial Viability 4** (e.g., judgment-proof opponent) may not be worth running — the score forces this conversation early.

### 4.4 Priority Score (composite)

Used for portfolio management:

```
Priority = w1 × Merit + w2 × (10 − Risk) + w3 × CommercialViability + w4 × Urgency + w5 × ClientValue
```

Default weights: w1=0.25, w2=0.20, w3=0.25, w4=0.20, w5=0.10. Configurable per principal preference.

Urgency = function of nearest critical deadline.
ClientValue = strategic client tier × historical fees × likelihood of repeat work.

### 4.5 Calculation, Update, Display

- **Calculation:** Hybrid AI + rule-based. Rule engine produces baseline; LLM (Sonnet) reviews narrative inputs (pleadings, witness statements, opposing correspondence) and adjusts sub-scores with reasoning. All adjustments logged.
- **Update triggers:** New evidence added, pleading filed/served, court order made, settlement offer received/sent, opponent solicitor change, time recorded that materially shifts cost-benefit.
- **Display:** Three coloured rings (Merit green-good, Risk red-high, CV blue-good), with a single Priority numeral. Hover for breakdown; click for full sub-score view with AI reasoning.

### 4.6 AI-Assisted Scoring with Human Override

- AI proposes; principal disposes. Every score has an AI-suggested value and a human-override field.
- Override requires a one-line reason, captured for calibration (§4.7).
- AI never auto-acts on a score — it informs, doesn't decide.

### 4.7 Historical Calibration

Every closed matter has predicted scores at each phase recorded. Outcomes (judgment, settlement amount, costs) are logged. The system:

- Compares predicted Merit at end-of-pleadings to actual outcome
- Computes calibration error (Brier score)
- Surfaces systematic biases ("we tend to overrate misleading conduct claims by ~1.5 points")
- Refines the model quarterly

Important: calibration is for *internal feedback*, not client-facing — never represent AI scores as legal advice.

---

## 5. Evidence Assessment Framework

### 5.1 Evidence Inventory

Every piece of evidence in every matter is catalogued with metadata:

| Field | Example |
|---|---|
| Evidence ID | EV-2026-0042 |
| Type | Document / Email / Recording / Photograph / Physical / Witness statement / Expert report |
| Description | "Email from CFO to Director re bonus calculation, 12 March 2024" |
| Source | Client's discovery; subpoena to bank; expert report by [name] |
| Date of evidence | 2024-03-12 |
| Date obtained | 2026-04-15 |
| Custody chain | If relevant (criminal-adjacent, fraud) |
| Linked COA / element | BoC element 2 (breach); s 18 ACL element 3 (misleading) |
| Linked witness | If a witness can speak to it |
| Privilege status | Open / privileged / without prejudice |
| Disclosure category | Disclosable r 211 / privileged r 212 / not disclosable |
| File location | LEAP path + dashboard ID |
| AI-extracted content | OCR text + summary + key entities/dates |

### 5.2 Evidence Ranking Matrix

Each item is scored on four dimensions (1–5):

| Dimension | 1 (poor) | 5 (strong) |
|---|---|---|
| **Relevance** | Tangential to any element | Directly proves a pivotal element |
| **Reliability** | Reconstructed, single source, motive to fabricate | Contemporaneous, independent, multiple sources, no motive |
| **Admissibility** | Hearsay with no exception, privileged, tendency/coincidence problems, illegally obtained | Plainly admissible; business record (s 69 / s 92); admission against interest; exception applies |
| **Weight** | Court would give it little | Court would treat it as decisive |

**Composite evidence score:** weighted average (Relevance 0.30, Reliability 0.25, Admissibility 0.25, Weight 0.20). Displayed 1–5 with one-decimal precision.

### 5.3 Witness Assessment

Every witness has a profile:

- **Identity:** name, role, relationship to parties
- **Subject matter:** what elements / facts can they speak to?
- **Credibility factors:**
  - Consistency (across statements, with documents, over time)
  - Demeanour indicators (from conferences) — *qualitative note only*
  - Corroboration (do contemporaneous documents back them up?)
  - Motive to lie / bias
  - Prior convictions / s 103 *Evidence Act 1977* (Qld) tendency issues
- **Availability:** willing? subpoenaable? overseas? hostile?
- **Cross-examination vulnerability:**
  - Inconsistencies in their own materials
  - Documents that contradict their account
  - Prior relevant conduct
  - Memory/accuracy limits
- **Recommended counsel approach:** lead in chief / careful XX strategy

### 5.4 Element-to-Evidence Mapping

The core diagnostic. For every cause of action pleaded (by us or against us):

1. List each **element** of the COA (drawn from the Knowledge Bank's COA library)
2. Map every piece of evidence relevant to that element
3. Compute element coverage:
   - 🟢 **Green** = ≥1 piece of evidence with composite score ≥4
   - 🟡 **Amber** = evidence exists but composite <4 OR only one source
   - 🔴 **Red** = no evidence

Visual: a grid — rows = elements, columns = COAs, cells = colour with evidence count.

**Worked example:** Breach of contract claim:

| Element | Evidence | Status |
|---|---|---|
| Existence of contract | Signed agreement (5.0); pre-contract emails (4.2) | 🟢 |
| Terms of contract (oral variation) | Witness A statement (3.2) | 🟡 |
| Breach | Internal email admission (4.5); spreadsheet (3.8) | 🟢 |
| Causation | — | 🔴 |
| Loss | Forensic accountant report (pending) | 🟡 |

Causation is red — drives gap detection (§6) and evidence-needed list.

### 5.5 Evidence Needed List

For every red and amber element, AI generates suggested evidence sources:

- "Causation: consider subpoenaing supplier [X] for delivery records 2024-03 to 2024-09; engage forensic accountant report quantifying lost margin; obtain board minutes resolving alternative supplier engagement."
- Each suggestion tagged with: cost estimate, time to obtain, likelihood of helping.

### 5.6 Document Gap Analysis

What documents *should* exist that we haven't obtained?

- AI cross-references the factual narrative against typical document categories (board minutes, bank statements, emails between key actors, accounting records, contract drafts)
- Lists missing categories with target source
- Generates draft subpoenas / disclosure requests under UCPR Ch 7 Pt 1 (disclosure) and Ch 11 Pt 4 (non-party disclosure r 242) and Ch 11 Pt 5 (subpoena)
- Tracks third-party document holders separately (banks, accountants, regulators, auditors, IT providers)

---

## 6. Gap Detector (AI-Powered)

The Gap Detector is a continuous-running diagnostic that fires on every material change to a matter and on a daily scheduled sweep.

### 6.1 Gap Categories

#### 6.1.1 Pleading Gaps
- Cross-reference each material allegation in our pleading against the evidence inventory
- Flag allegations with no supporting evidence
- Flag UCPR r 150 matters that must be specifically pleaded but aren't (illegality, fraud, mistake, performance, release, etc. — full list per `reference/qld-pleading-guide.md`)
- Flag responses missing direct explanation under r 166(4) → **deemed admission risk**
- Flag non-admissions without evidence of reasonable inquiries r 166(3)
- Flag general traverses or "save as hereinbefore admitted" language → fail
- Flag "strict proof" language → fail
- Flag American terminology ("Affirmative Defence", "Answer")
- Flag Form 17 used for SOC instead of Form 16 (or vice versa)
- Flag missing r 246 solicitor's certificate

#### 6.1.2 Legal Gaps
- For every COA pleaded: are all elements addressed in the pleading and in the evidence?
- For every defence available: is it pleaded?
- For every limitation issue: is it pleaded?
- For every counterclaim opportunity: is it identified?

#### 6.1.3 Procedural Gaps
- Disclosure due (UCPR r 214) — has list of documents been served?
- Reply due (UCPR r 164) — 14 days from defence
- Request for further and better particulars — pending response?
- Directions hearing dates approaching without compliance?
- Trial directions: pre-trial conference, expert conferences, witness lists, trial bundles
- Limitation dates approaching
- Statutory demand timing (s 459G — 21 days strict)
- Public examination summons returnable dates
- Service deadlines (within 1 year of issue UCPR r 24)

#### 6.1.4 Strategic Gaps
- Has the opponent raised a defence we haven't addressed in reply?
- Did opponent's affidavit contain new material we haven't responded to?
- Have we considered all available causes of action (e.g., parallel s 18 ACL claim alongside contract)?
- Settlement leverage points missed (Calderbank moments)?
- Have we considered security for costs (UCPR r 670)?
- Have we considered third-party / cross-claim joinder?

#### 6.1.5 Witness Gaps
- For every material fact: is there a witness who can prove it?
- For every disputed conversation: do we have both participants (or contemporaneous corroboration)?
- For expert opinion required: is an expert engaged? Are they conflicted? Have they signed Code of Conduct (UCPR Sch 1C / FCR 23.13)?

#### 6.1.6 Authority Gaps
- For every legal proposition asserted: is there a current binding (or persuasive) authority cited?
- Has the authority been doubted, distinguished, or overruled? (AustLII / Jade overruling check)
- Are there contrary authorities we haven't addressed?
- For appeal points: leading appellate authority identified?

### 6.2 Gap Report Output

Per matter, the Gap Detector produces:

```
GAP REPORT — Smith v Jones Pty Ltd — 2026-05-01

🔴 CRITICAL (4)
1. Causation element of BoC unsupported by any evidence
   → Action: subpoena Supplier X delivery records; engage forensic accountant
2. Defence para 14 denial lacks direct explanation (r 166(4))
   → DEEMED ADMISSION RISK by trial. Amend defence.
3. Limitation period for s 18 ACL claim expires 2026-08-12 (103 days)
   → Confirm tolling agreement or amend SOC
4. Defence not yet served — due 2026-05-08 (7 days). No draft.

🟡 IMPORTANT (6)
5. Reply not addressed s 32 ACL non-reliance claim raised in defence...
[etc.]

🟢 MINOR (3)
12. Citation in para 22 to Wardley Australia Ltd v Western Australia
    is correct but consider also adding HTW Valuers v Astonland...
```

### 6.3 Priority Ranking & Recommendations

Each gap has:
- Severity (Critical / Important / Minor)
- Effort to fix (Low / Medium / High)
- Suggested action (concrete next step)
- "Fix with AI" button — generates a draft amendment, response, subpoena, or research note

Critical gaps drive the matter's traffic light to red.

### 6.4 Continuous Operation

- Runs on every pleading save, evidence add, document upload
- Daily 06:00 sweep across the portfolio
- Pre-court-appearance sweep (24h before any hearing) — surfaces last-minute gaps
- Pre-billing sweep — verifies time entries, no missing days, narrative quality

---

## 7. Document Generation Engine

### 7.1 Template Library

Templates are the spine of consistent output. Organised by type, jurisdiction, and matter type.

#### Pleadings
- Statement of Claim (DCQ / SCQ / FCA Corps List)
- Defence (Form 17)
- Reply
- Counterclaim
- Amended SOC / Defence / Reply (with red-line markup)
- Further and Better Particulars
- Defence to Counterclaim
- Reply to Defence to Counterclaim
- Application for summary judgment / strike-out (UCPR r 292/293/171)

#### Correspondence
- Initial advice letter (per `reference/letter-of-advice-guide.md`)
- Letter of demand (variants: contract, debt, restraint, ACL)
- Calderbank offer
- s 315 *LPA* costs disclosure update
- Costs agreement
- Engagement letter
- Final letter before commencement
- Settlement letter (open and without prejudice variants)
- Mediation position paper
- "Without prejudice save as to costs" offer

#### Court Documents
- Originating application / claim
- Interlocutory application
- Affidavit (UCPR Form 46; Pt 11 Div 5)
- Outline of submissions
- Draft order
- Notice to admit / Notice disputing facts (r 189)
- List of documents (r 214 / Form 19)
- Subpoena / non-party disclosure notice
- Witness summons
- Trial bundle index

#### Insolvency-Specific
- Statutory demand (s 459E Corporations Act, Form 509H)
- Affidavit accompanying statutory demand
- Application to set aside statutory demand (s 459G)
- Winding up application (s 459P)
- Affidavit of service / search of ASIC
- Application for public examination (s 596A/B)
- Proof of debt
- Application under s 588FF (voidable transactions)
- DOCA proposal documents

#### Settlement Documents
- Deed of settlement and release
- Deed of release (mutual / one-way)
- Consent orders (UCPR r 666)
- Tomlin order (where appropriate)
- Confidentiality agreement / NDA

#### Internal
- File note (conference, telephone, court appearance variants)
- Strategy memo
- Costs estimate / revised estimate
- Risk memo
- Brief to counsel
- Disclosure plan
- Witness preparation memo
- Closing letter

Each template is a Word OOXML file with placeholders, plus a JSON manifest specifying:
- Required matter fields
- Required AI sections
- Style profile (firm style applied)
- QA gates that must pass before finalisation

### 7.2 AI Drafting Workflow

```
┌────────────────────────────────────────────────────────┐
│ 1. User selects document type from template library    │
│ 2. AI pulls matter context:                            │
│      • Parties, court, matter ID                       │
│      • Pleadings to date                               │
│      • Evidence inventory (for relevant elements)      │
│      • Witness statements                              │
│      • Client instructions (file notes, emails)        │
│      • Relevant authorities from Knowledge Bank        │
│      • Applicable playbook                             │
│ 3. AI generates first draft                            │
│      • Apply firm style guide (boss-lawyers-style.md) │
│      • Apply UCPR pleading rules (qld-pleading-guide) │
│      • Apply matter-specific overrides                 │
│ 4. Solicitor reviews in side-by-side editor            │
│      • Track changes; AI suggestions panel             │
│      • "Why did you draft this way?" — AI explains     │
│ 5. Quality gates run automatically:                    │
│      ✓ Deemed admission scanner (r 166)                │
│      ✓ Evidence detector (no evidence in pleadings)    │
│      ✓ General traverse detector                       │
│      ✓ Strict proof phrase detector                    │
│      ✓ American terminology detector                   │
│      ✓ Form check (Form 17 for defences, etc.)        │
│      ✓ r 150 matters checklist                         │
│      ✓ Citation format check (ALCG / AGLC4)            │
│      ✓ Currentness check (authorities not overruled)   │
│      ✓ Privilege/confidentiality check                 │
│      ✓ Style: numbering, font, spacing                 │
│      ✓ r 246 solicitor's certificate present           │
│ 6. Solicitor approves                                  │
│ 7. Document saved to LEAP matter folder + dashboard    │
│ 8. Time entry auto-generated:                          │
│      • QLD-compliant narrative                         │
│      • Itemised by discrete task                       │
│      • Solicitor confirms units                        │
│ 9. Audit log captures: prompt, model, draft versions,  │
│    QA gate results, solicitor edits, final approval    │
└────────────────────────────────────────────────────────┘
```

### 7.3 Style Enforcement

- `reference/boss-lawyers-style.md` is loaded into every drafting prompt as system context
- Common rules enforced:
  - Australian English spelling (organisation not organization)
  - Oxford comma per firm preference
  - Date format: 12 March 2024 (not 12/03/2024)
  - Numbered headings: 1, 1.1, 1.1.1
  - Section pin-cites: s 459E (not §459E or section 459E in body)
  - Case citation: *Dare v Pulham* (1982) 148 CLR 658; **NOT** "Dare v Pulham" or *Dare v. Pulham*
  - Pleadings paragraph numbering
  - 12pt Times New Roman / 11pt Calibri body per template

### 7.4 UCPR Compliance Checking

Built-in checks per pleading type:

- **Statement of Claim:** Form 16; r 149 (form of pleading); r 150 specifics; r 155 condition precedent; r 156 fraud particulars; r 159 conviction; r 246 certificate
- **Defence:** Form 17; r 165 form; r 166 specifics including deemed admission rules; r 150 specifics; r 246
- **Application:** Form 9; supporting affidavit referenced; draft order attached; service requirements

For insolvency: cross-check against *Federal Court (Corporations) Rules 2000* and *Corporations Act* form requirements.

### 7.5 Existing QA Tools Integration

The dashboard incorporates the firm's existing pleading QA tools (some already prototyped):

- Deemed admission scanner — flags r 166(4) failures
- Evidence detector — flags evidence/argument in pleading body
- General traverse detector
- Strict-proof phrase detector
- Sub-paragraph response checker
- Form heading check
- Solicitor's certificate check
- "Pre-empting allegation" detector — flags positive pleas out of order

These run as part of the QA gate (§7.2 step 5).

---

## 8. Knowledge Bank

The Knowledge Bank is the firm's institutional memory, made queryable.

### 8.1 Case Law Database

Structure:

| Field | Notes |
|---|---|
| Citation | *McKenzie v Schipanski* [2024] QSC 12 |
| Court & date | SCQ — 2024-02-14 |
| Judge | Bond J |
| Topic tags | Insolvent trading; safe harbour; s 588GA |
| Headnote (firm) | AI-summarised + lawyer-edited |
| Ratio | The narrow proposition |
| Key passages | Paragraph numbers, quoted text |
| Application notes | "Use this for: defending insolvent trading where directors took restructuring advice. Distinguishable from Plymin where..." |
| Subsequent treatment | Followed / distinguished / doubted / overruled |
| Used in | List of Boss Lawyers matters citing this |

Sources: AustLII bulk feeds (where licence permits); manual entry from CaseBase / Westlaw; AI ingestion of judgments.

Search: full-text + semantic (pgvector embeddings) + facet (court, judge, topic, year).

### 8.2 Legislation Library

Key sections, annotated:

- Section text (current)
- Amendment history (commencement dates, amending Acts)
- Cross-references to case law
- Firm commentary
- Application notes ("This section applies where... Watch out for...")

Priority sections (the ones we cite weekly):
- *Corporations Act 2001*: Pt 2D.1 (directors' duties), Pt 5.1 (schemes), Pt 5.3A (VA), Pt 5.3B (small business restructuring), Pt 5.4–5.4B (winding up), Pt 5.7B (voidable transactions), Pt 5.8 (offences), Pt 5.9 (proof of debt), s 459E, s 459G, s 459P, s 588FA-FF, s 588G-GA, s 596A/B
- UCPR 1999 (Qld): rr 5, 137, 149–169, 171, 211–222, 246, 280, 292, 293, 376, 388, 444–449, 658, 666, 670, 681
- Federal Court (Corporations) Rules 2000
- Australian Consumer Law: ss 18, 20, 21, 22, 29, 236, 237, 243
- *LPA 2007* (Qld): Pt 3.4 — Divs 4–7
- *Bankruptcy Act 1966* (Cth): ss 116, 121, 122, 139ZQ, 156A
- *Limitation of Actions Act 1974* (Qld): ss 10, 26, 27, 38

### 8.3 Precedent Library

Firm precedents — every document we've drafted that's worth keeping. Tagged by:
- Document type
- Matter type
- Court
- Outcome (won, lost, settled)
- Year
- Author

Version control: every change tracked, with reason. Useful for "give me our best statutory demand" or "show me the SOC we used in the *Acme Industries* matter."

"Used in" tracker: which matters have used this precedent → useful for conflict checks and refining the precedent.

### 8.4 Strategy Playbooks

By matter type. Each playbook is a structured document:

```
PLAYBOOK: Defending a Statutory Demand
Phase 1 — Receive demand
  • 21-day clock starts (s 459G strict)
  • Confirm service (s 109X CA / personal service)
  • Diary critical date in dashboard
  • Send urgent client conference request
Phase 2 — Assess
  • Genuine dispute (s 459H(1)(a))? — Spencer Constructions test
  • Offsetting claim (s 459H(1)(b))?
  • Defect in demand (s 459J(1)(a))?
  • Some other reason (s 459J(1)(b))?
Phase 3 — Decide
  • If grounds → application + supporting affidavit within 21 days
  • If no grounds → consider payment, refinance, voluntary administration
  • If VA → Part 5.3A, ipso facto stay considerations
Phase 4 — File and serve (if challenging)
  • Form 2 originating process; supporting affidavit
  • Personal service on creditor
  • Consider stay of demand pending hearing
Phase 5 — Hearing
  • Standard FCA / SCQ Corporations List
Common pitfalls:
  • Affidavit deficiencies — Graywinter principle (basis must appear in initial affidavit)
  • Genuine dispute conflated with merit — only need plausible contention
  • Service date miscalculation
Key authorities:
  • Spencer Constructions Pty Ltd v G&M Aldridge Pty Ltd (1997) 76 FCR 452
  • Graywinter Properties Pty Ltd v Gas & Fuel Corp Superannuation Fund (1996) 70 FCR 452
  • Eumina Investments v Westpac Banking Corp (1998) 84 FCR 454
```

Playbooks for: defending statutory demands; running statutory demand applications; oppression proceedings (ss 232–235); directors' duties claims; insolvent trading defences; voidable transaction claims (preferences, uncommercial transactions); freezing orders; restraint of trade; commercial debt recovery; building/construction (BIF Act); shareholder disputes; trust disputes; professional negligence (solicitors / accountants); ACL claims (s 18 / s 20–22); Calderbank strategy.

### 8.5 Opponent Intelligence

What do we know about opposing solicitors/counsel?

- Firm / chambers
- Past matters faced
- Litigation style (aggressive / commercial / dilatory)
- Common tactics (e.g., "always seeks security for costs in interstate matters")
- Settlement tendencies (early / mediation-focused / trench-warfare)
- Counsel briefed for trial vs interlocutories
- Win/loss record against us

**Important:** strictly internal. Never disclosed to client; never used in correspondence; never relied on as a basis for advice. Used only to refine strategy and predict opponent behaviour.

### 8.6 Knowledge Bank Updates

- New judgments ingested daily from AustLII (where authorised)
- Manual annotations encouraged after every matter
- Quarterly review session — what new authorities matter? What has shifted?
- Legislation amendments tracked via Federal Register of Legislation + QLD Legislation feeds

---

## 9. AI Advice Engine

Natural-language interface over the matter and the knowledge bank.

### 9.1 "Ask About This Matter"

Examples:
- "What's the strongest argument for the defendant on causation?"
- "Has the defendant pleaded contributory negligence?"
- "What's our position on the disclosure dispute?"
- "Summarise correspondence with Thomson Geer in the last 30 days."

The engine:
- Retrieves relevant matter content (pleadings, evidence, correspondence) via semantic + structured search
- Generates a citation-anchored answer (every claim references a document/paragraph)
- Flags uncertainty explicitly

### 9.2 "What Should I Do Next?"

Composite of:
- Phase tracker (where are we?)
- Deadline list (what's due?)
- Gap report (what's broken?)
- Strategy playbook (what should we be doing now?)

Output: a ranked task list with reasoning. Not a directive — recommendations only.

### 9.3 "Draft Advice on [Topic]"

User: "Draft a memo on prospects of setting aside the statutory demand."

AI:
1. Pulls matter facts (the demand, the alleged debt, the dispute)
2. Pulls applicable law from Knowledge Bank (s 459G, Spencer, Graywinter)
3. Applies firm advice template (`reference/letter-of-advice-guide.md`)
4. Drafts memo with: facts, issues, law, application, conclusion, risks, recommendation, costs estimate
5. Solicitor reviews and sends

Always returns a draft. Never sends without solicitor approval. Always conservative on prospects (under-promise).

### 9.4 "Compare to Similar Matters"

Semantic + structured search across the firm's closed matters:
- Find matters with similar facts, COAs, opponents, court
- Surface outcomes (judgment / settlement value / costs)
- Surface what worked / what didn't
- Useful for settlement strategy ("we settled three similar cases at 60–70% of pleaded quantum")

Privilege and confidentiality respected — comparator data anonymised in display.

### 9.5 Risk Alerts

Proactive notifications. Examples:
- "Limitation expires in 30 days — confirm protective proceeding filed."
- "Settlement offer received yesterday hasn't been considered. Calderbank consequences if rejected."
- "Defendant filed for VA — ipso facto stay implications for our termination."
- "Disclosure due in 5 days; no list of documents drafted."
- "Counsel availability conflict — trial date and counsel's other commitment overlap."

Routed to: in-app, email, and (configurable) SMS for criticals.

### 9.6 Settlement Recommendation Engine

Inputs:
- Merit score
- Costs incurred
- Costs to judgment estimate
- Likely quantum range
- Opponent capacity to pay
- Opponent solicitor's history
- Risk score
- Time to trial
- Client risk appetite

Output:
- Recommended settlement floor (walk-away)
- Target settlement
- Opening offer / counter strategy
- Calderbank timing advice
- Mediation recommendation

Plain English with reasoning. Not legal advice — decision support only. Solicitor's professional judgment governs.

---

## 10. Reporting & Analytics

### 10.1 Portfolio Overview

- All matters table with: client, matter, phase, scores, WIP, deadline, traffic light
- Filters: status, risk band, value, fee earner, client, court, matter type
- Saved views: "This week's red matters", "Insolvency portfolio", "Matters in disclosure"
- Export: CSV, PDF

### 10.2 Financial Dashboards

- WIP aging (0–30, 31–60, 61–90, 90+)
- Collections rate by month
- Matter profitability (billed – attributable cost @ blended rate)
- Estimate vs actual variance
- Trust account positions (read-only mirror of LEAP)
- Per fee earner: hours billable / billed / collected

### 10.3 Outcome Tracking

- Predicted Merit at each phase exit vs actual outcome
- Settlement at first offer / second offer / mediation / pre-trial / trial
- Costs recovered % of costs incurred (party-party assessments)
- Hit rate per matter type, per opponent, per judge

### 10.4 Time Analysis

- Where is time being spent? — by phase, task, fee earner, matter
- Median time per phase, per matter type — used to refine future cost estimates
- Outlier detection — "this matter took 3× the median for Phase 3"

### 10.5 Client Reporting

- Auto-generated monthly client status reports (Phase, key events, upcoming, financial summary)
- Editable before sending; consistent format
- Sent via email or available in client portal

---

## 11. Implementation Roadmap

### Phase 1 — MVP (0–3 months)

**Goals:** make the principal's day-to-day faster and more visible. No AI yet on critical-path drafting.

- Matter Dashboard (read-only LEAP pull)
- Basic Case Ranking — manual scoring with rule-based composite
- LEAP Integration — read-only pull (matters, contacts, calendar, WIP)
- Document Templates — top 10 templates loaded; non-AI fill from form fields
- Time entry UI with QLD-compliant narrative scaffolding
- Auth + audit log infrastructure
- Hosting in AWS Sydney

**Success criteria:** all active matters visible in one place; principal saves 30 min/day; time entries 100% QLD-compliant.

### Phase 2 — Intelligence (3–6 months)

- Evidence Framework — inventory + ranking + element mapping
- Gap Detector v1 — pleading and procedural gaps
- AI Drafting v1 — pleadings (SOC, Defence, Reply); correspondence (LOD, s 315, Calderbank)
- QA gates — deemed admission, general traverse, strict proof, evidence-in-pleading
- Knowledge Bank v1 — top 100 authorities; legislation library for our top 20 sections
- Strategy playbooks — top 5 (statutory demand defence/offence, oppression, insolvent trading, restraint, debt recovery)

**Success criteria:** first draft of a defence in 30 min from instructions; gap reports running on every matter weekly.

### Phase 3 — Integration & Advice (6–9 months)

- LEAP two-way sync (push time entries, documents, calendar)
- AI Advice Engine — "ask about this matter", "draft advice on…"
- Opponent Intelligence module
- Settlement Recommendation Engine
- Client Portal v1 (read-only summary + invoices)
- Witness assessment module
- Document gap analysis with subpoena drafting

**Success criteria:** principal queries the system instead of opening files; settlement rec engine recommendations align with principal judgment in ≥80% of cases.

### Phase 4 — Maturity (9–12 months)

- Full reporting & analytics suite
- Outcome calibration loop
- Full Knowledge Bank (1000+ authorities; all key legislation)
- All playbooks (15+ matter types)
- Client Portal v2 — secure document upload, conference booking, e-signing
- Firm intranet integration (per `projects/intranet-blueprint.md`)
- Mobile companion app for principal (deadline alerts, quick log time)

**Success criteria:** firm runs more matters per principal-hour than at start; AI calibration error <0.5 on Brier scale; client retention/satisfaction up.

### Technology Decisions to Make

| Decision | Options | Notes |
|---|---|---|
| LLM provider | Anthropic primary; OpenAI fallback; Bedrock | Anthropic first — best for legal drafting in current testing. AU-region inference where possible. |
| Hosting region | AWS Sydney vs Azure AU East | Driven by where AU-region Bedrock/Azure-OpenAI is available |
| Build vs buy CMS for Knowledge Bank | Build on Postgres+pgvector; or Notion API; or dedicated KM tool | Build — tight AI integration needs |
| Self-hosted LLM threshold | Always API / API + sensitive=local / always local | Default API; offer "local-only" toggle per matter |
| Frontend SSR vs SPA | Next.js SSR | Best for portal + SEO + perf |
| Mobile | PWA first; native if needed | PWA covers 80% of needs |

### Budget Considerations

- **Build cost (12-month roadmap, contractor-led):** indicative AUD 250–450k, depending on scope and contractor rate. In-house build with 1 senior dev + AI tooling: AUD 180–300k.
- **Run cost (annual):**
  - Hosting (AWS Sydney): AUD 8–15k
  - LLM API: AUD 12–30k (depends on usage; aggressive caching cuts this)
  - LEAP API access / Microsoft 365 / other SaaS: existing
  - Maintenance: ~20% of build cost annually
- **ROI logic:** if dashboard saves 1.5 hours/day across the principal at $800/hr, that's $300k+/yr in recovered capacity. The bar to clear is low if it actually works.

### Security & Privacy Requirements

Non-negotiable, given this is litigation data:

- **Data residency:** all PII and matter data in Australia (ap-southeast-2 or Azure AU East)
- **Encryption:** at rest (AES-256), in transit (TLS 1.3)
- **Access control:** role-based; per-matter ACLs; principal sees all, others see assigned only
- **Authentication:** passkeys / WebAuthn primary; MFA mandatory for staff; M365 SSO
- **Privilege protection:**
  - Privileged content tagged at ingestion
  - Privileged tag flows to all derived artefacts
  - "No external AI" flag per matter — forces local-only inference
  - Privilege filter on client portal
- **Confidentiality:**
  - No matter data ever used to train external models (zero-data-retention API contracts with Anthropic/OpenAI)
  - Embeddings stored locally (pgvector), never sent off-platform
  - Logs scrubbed of client identifiers in observability tools
- **Audit:**
  - Every AI invocation logged: user, matter, prompt, model, output, timestamp
  - Every score change logged with reason
  - Every document version logged
  - 7-year retention (LPA / professional standards)
- **Backup & disaster recovery:**
  - Daily encrypted backups, separate region (Melbourne / Singapore)
  - RTO: 4 hours; RPO: 1 hour
  - Quarterly DR test
- **Compliance:**
  - *Privacy Act 1988* (Cth) — APP compliance
  - *LPA 2007* (Qld) confidentiality (s 8)
  - Australian Solicitors Conduct Rules — particularly r 9 (confidentiality)
  - QLS / LSC AI usage guidelines
  - Firm AI Use Policy (anonymisation expectations)
- **Conflict checking:** dashboard runs conflict checks on every new matter against existing matters, parties, and party-related entities (ASIC search for related companies)
- **Data deletion:** on matter closure + 7 years, configurable retention; on client request, lawful deletion with court-record exceptions
- **Vendor diligence:** SOC 2 Type II from any sub-processor; DPAs in place

---

## 12. Data Model

### 12.1 Core Entities

```
Matter
  id, leap_id, name, court, proceeding_no, matter_type, phase,
  client_id, opening_date, closing_date, status, scores{},
  costs_estimate, billing_rate

Party
  id, matter_id, role (P/D/Cross-claimant/Third-party/Other),
  contact_id, represented_by, counsel

Contact (Person | Organisation)
  id, leap_id, name, type, ABN, ACN, addresses, comms,
  conflict_check_status

Document
  id, matter_id, leap_id, type, title, version, author,
  date, file_uri, embedding, privilege_status,
  disclosure_category, qa_results{}

Evidence
  id, matter_id, type, description, source, date_of_evidence,
  date_obtained, file_uri, ocr_text, summary, entities{},
  privilege_status, scores{relevance, reliability, admissibility, weight}

Witness
  id, matter_id, contact_id, subject_matters[], availability,
  willingness, credibility_score, vulnerability_notes,
  statements[]

CauseOfAction
  id, matter_id, party_role (we_assert | asserted_against_us),
  type, quantum, limitation_date

Element
  id, cause_of_action_id, name, description, evidence_links[],
  status (red/amber/green), notes

Authority
  id, citation, court, date, judges, headnote, ratio,
  topics[], passages[], subsequent_treatment, embedding

LegislationSection
  id, act, jurisdiction, section_no, current_text,
  amendments[], commentary, embedding

Precedent
  id, type, matter_type, court, outcome, file_uri,
  used_in[], version

Playbook
  id, matter_type, phase_steps[], pitfalls[], authorities[]

OpponentProfile
  id, contact_id (firm or counsel), style_notes,
  matters_faced[], outcomes{}

TimeEntry
  id, matter_id, leap_id, fee_earner_id, date, duration_units,
  rate, narrative, document_id, posted_to_leap

Deadline
  id, matter_id, type, due_date, source (UCPR/LIA/Court order),
  reminders_sent[], status, fulfilled_by_doc_id

Event
  id, matter_id, type (filing/correspondence/conference/hearing),
  date, description, doc_ids[], participant_ids[]

Score
  id, matter_id, score_type (merit/risk/cv/priority),
  value, sub_scores{}, ai_suggestion, human_override,
  override_reason, calculated_at

Gap
  id, matter_id, category, severity, description,
  suggested_action, status (open/resolved/wont_fix),
  resolved_at, resolved_by, resolved_doc_id

AuditLog
  id, actor (user | ai), action, entity_type, entity_id,
  before, after, model, prompt_hash, timestamp

ClientPortalToken
  id, client_id, matter_ids[], scopes, expires_at
```

### 12.2 Key Relationships

- `Matter` 1—N `Party`, `Document`, `Evidence`, `Witness`, `CauseOfAction`, `TimeEntry`, `Deadline`, `Event`, `Score`, `Gap`
- `CauseOfAction` 1—N `Element`
- `Element` N—N `Evidence` (an element supported by multiple pieces; an evidence item supports multiple elements)
- `Witness` 1—N `Statement`; `Witness` N—N `Element`
- `Document` N—N `Authority` (citations within the document)
- `Matter` N—1 `OpponentProfile` (per opposing solicitor)
- `Authority` and `LegislationSection` are referenced from Documents and AI prompts; embeddings underpin retrieval
- `AuditLog` references any entity polymorphically

### 12.3 AI Interaction with the Data Model

- **Retrieval:** semantic (pgvector embeddings on Documents, Evidence, Authorities, Statements) + structured (SQL filters by matter, COA, element)
- **Generation:** prompts assembled with retrieved context; outputs written back to entities (Score sub-scores, Gap entries, Document drafts)
- **Tagging:** AI classifies new evidence by COA-element relevance, witnesses by subject-matter, authorities by topic — always reviewable
- **Calibration:** closed matters feed back into model fine-tuning datasets (firm-private; never to external training)
- **No autonomous writes to LEAP:** every push to LEAP is gated by human approval — except passive event logs

### 12.4 Indexes & Performance

- `Matter(status, phase)` for portfolio queries
- `Deadline(matter_id, due_date)` for traffic light computation
- `Evidence(matter_id, scores.composite)` for ranking
- pgvector HNSW indexes on all embedding columns
- Materialised view `MatterTrafficLight` refreshed every 10 minutes
- Materialised view `PortfolioOverview` refreshed every 30 minutes

---

## 13. Open Questions / Decisions for Mark

1. **LEAP API tier** — confirm we have API access on current LEAP plan; if not, upgrade cost.
2. **Build vs partner** — fully bespoke build; or partner with an existing legal AI vendor (e.g., Harvey, Spellbook) and customise; or hybrid (vendor for AI, custom for dashboard).
3. **Counsel access** — should briefed counsel have read-only matter access? Likely yes, with privilege checks.
4. **Client portal MVP** — is read-only summary enough for v1, or do clients need document upload from day one?
5. **Pricing model** — does this become a value-add for clients (e.g., "premium reporting tier") or purely internal?
6. **Conflict check rigour** — current LEAP conflict check vs enhanced ASIC-cross-referenced check.
7. **Personal data handling** — opt-in/out for individual employees mentioned in matters (Privacy Act).
8. **Backup model** — manual exports vs continuous replication; trade-off cost vs RPO.
9. **Local LLM threshold** — at what privilege/sensitivity level do we force on-prem inference? Default rule needed.
10. **Brief to counsel format** — counsel prefer paper / PDF / portal; design accordingly.

---

## 14. Success Metrics

The dashboard succeeds if, at 12 months:

- Principal's daily admin time falls by ≥30 minutes
- First-draft pleading time falls by ≥60%
- Zero deemed admissions and zero unaddressed UCPR r 150 matters in any served pleading (measured by post-service review)
- 100% of time entries pass QLD costs assessment standard on review
- Client costs disclosure (s 315) compliance is automated and 100%
- WIP visibility is real-time; no surprises at billing
- AI-suggested settlement ranges align with principal's professional judgment in ≥80% of matters
- Calibration error on Merit scores converges below 1.0 on a 10-point scale
- The firm can run 25–35% more concurrent matters at the same staffing level
- Mark looks at this dashboard every morning before opening LEAP

That last metric is the real test. If the dashboard is the first thing he reaches for, it's working.

---

## 15. LEAP REPLACEMENT ROADMAP

> **Note on numbering:** This section was added after Sections 13 (Open Questions) and 14 (Success Metrics). It is logically the natural successor to Section 12 (AI Architecture) — the long arc from "dashboard sits on top of LEAP" to "LEAP is gone." Read it as the strategic endgame.

This section maps the path from the current architecture — where the dashboard is an intelligence layer over LEAP — to a fully integrated, AI-native legal practice management platform purpose-built for Queensland boutique commercial litigation. The endpoint: LEAP is decommissioned; everything runs natively in our system; Boss Lawyers owns the IP; the system is a genuine competitive moat; and (optionally) it becomes a SaaS product licensed to peer firms.

This is not a 6-month project. It is a 24–36 month strategic transformation, executed in phases, with regulatory compliance as the binding constraint and trust accounting as the critical path.

### 15.1 Current LEAP Dependency Map

Every function LEAP currently provides, categorised by replacement difficulty.

#### EASY TO REPLACE — already specified in this dashboard

| LEAP Function | What LEAP Does Now | What Our System Needs | Build Effort | Risk |
|---|---|---|---|---|
| Matter management | Matter creation, parties, status, type, key dates | Already specified §3 (Matter model), §6 (matter detail page) | Low — 4–6 weeks | Low |
| Contact management | Centralised contact database, conflict checks | §3 Party model + §7 conflict check enhancement (ASIC cross-ref) | Low — 3–4 weeks | Low |
| Document management | File store per matter, folders, version control, metadata | §3 Document model, §8 evidence panel, S3-backed object store with pgvector embeddings | Medium — 8–10 weeks | Low |
| Calendar / deadlines | Court date tracking, limitation alerts, reminders | §3 Deadline model, §6 traffic-light system, §11 deadline calculator | Low–Medium — 4–6 weeks | Medium (limitation miscalculation = professional negligence) |
| Time recording UI | Stopwatch, manual entry, narrative field | §11 time-recording UI integrated with billing narrative engine | Low — 3–4 weeks | Low |
| Precedent library | Template documents, merge fields | §10 drafting engine + AI-augmented precedent retrieval | Medium — 6–8 weeks | Low |
| Court forms | UCPR forms, Federal Court forms | Generated from §10 drafting engine + form library | Medium — 6–8 weeks | Medium (form non-compliance = strike-out risk) |

**Subtotal effort:** ~6–9 months of focused development for the "easy" tier. Most of this is already in the v2 spec.

#### MEDIUM DIFFICULTY — needs dedicated build

| LEAP Function | What LEAP Does Now | What Our System Needs | Build Effort | Risk |
|---|---|---|---|---|
| Time recording with billing | Capture time → push to bill | Bidirectional integration: capture → WIP → invoice generation with QLD costs narrative compliance | High — 12–16 weeks | Medium |
| Invoice generation | Tax invoices, itemised bills | LPA s 300 compliant itemised bills, GST Act compliant tax invoices, integration with trust ledger | High — 10–14 weeks | High (billing errors → costs disputes, LPA breaches) |
| Email integration | LEAP Outlook plug-in saves emails to matter | M365/Gmail Graph API integration, AI auto-classification by matter, draft generation from matter context | High — 16–20 weeks | Medium |
| Client portal | Limited; LEAP has basic portal | Secure portal with document sharing, status updates, billing visibility, secure messaging | High — 12–16 weeks | Medium (data security, privilege) |
| Reporting / WIP | Standard reports — WIP, aged debtors, productivity | §3, §11 reporting layer; custom dashboards; financial reports (P&L, BS via accounting integration) | Medium — 8–12 weeks | Low |
| Conflict checks | Name/entity search across matters | Enhanced check: ASIC cross-ref, related entities, beneficial ownership, ATO-style fuzzy matching | Medium — 6–8 weeks | High (conflict miss = LPA Pt 4.4 breach, costs orders, disqualification) |
| Costs disclosure | Manual letter generation | Automated s 308 disclosure, s 315 revised estimates triggered by WIP thresholds, s 316 billing rights | Medium — 6–8 weeks | High (s 316 non-compliance = costs unenforceable) |

**Subtotal effort:** ~10–14 months for the "medium" tier — significant compliance complexity, particularly around billing and costs disclosure.

#### HARD / REGULATED — needs compliance expertise and careful sequencing

| LEAP Function | What LEAP Does Now | What Our System Needs | Build Effort | Risk |
|---|---|---|---|---|
| Trust receipting | Generate sequentially numbered receipts on receipt of trust money | LPR 2017 compliant receipts: trust account name, receipt #, date, payer, matter, amount, purpose, signature | High — 8–10 weeks | **Critical** |
| Trust ledger | Per-matter ledger of trust money | Real-time per-matter ledger, balance never negative, immutable post-posting, full audit trail | High — 10–12 weeks | **Critical** |
| Trust journal | Inter-matter transfers, corrections | Authorised transfers between matter ledgers with dual approval; corrections only via reversing entries (immutable) | High — 6–8 weeks | **Critical** |
| Trust bank reconciliation | Monthly reconciliation per s 258 | Automated bank-feed match, exception handling, monthly reconciliation report, deficiency detection | High — 10–14 weeks | **Critical** |
| Controlled money | s 255 controlled money accounts (term deposits, interest-bearing) | Separate controlled money register, interest accrual tracking, disposal authorisations | High — 6–8 weeks | **Critical** |
| Annual external examination | Auditor extracts records | s 259 examiner-friendly export: full ledgers, reconciliations, receipts, journals, controlled money register | Medium — 4–6 weeks | **Critical** |
| Deficiency reporting | Manual detection | Automated deficiency detection + alert + s 261 immediate-reporting workflow to QLS | Medium — 4 weeks | **Critical** |
| General ledger / accounting | Office account, P&L, balance sheet | Either: (a) build full GL; or (b) integrate Xero/MYOB. Strong recommendation: integrate, do not build. | Low if integrate / Very High if build | Low if integrate / High if build |
| BAS / GST reporting | Quarterly BAS, GST on invoices | Tax invoice GST calc + integration with Xero/MYOB BAS | Low if integrate | Medium |
| Trust audit support | Records preparation for QLS audit | Audit-mode export, immutable record proof, pre-audit checklist automation | Medium — 4 weeks | **Critical** |

**Subtotal effort:** 12–18 months for the "hard" tier, with the trust accounting module on the critical path. Failure here is not a software bug — it is a regulatory event that can end the firm.

#### Hidden LEAP dependencies (often missed)

- **InfoTrack / GlobalX integrations** — title searches, ASIC searches, court filing. Replace with direct API integrations (InfoTrack and GlobalX both publish APIs).
- **LawConnect** — LEAP's e-signature and document review module. Replace with DocuSign / Adobe Sign + custom review UI.
- **Forms library updates** — LEAP pushes UCPR/FCR/court form updates centrally. Our system needs a form-update process (subscribe to QLS updates, monitor court rules amendments, version-controlled form library).
- **PEXA integration** — for property settlement (rare in litigation but exists). Direct PEXA API if needed.
- **Disbursement creditors** — barristers, experts, search agents. Needs creditor management — typically lives in Xero/MYOB once integrated.

### 15.2 Trust Accounting — The Critical Path

This is the make-or-break module. Get it wrong and the consequences are not technical — they are regulatory. Trust money belongs to the client; misapplication is a fiduciary breach; deficiency is reportable; suspension and strike-off are real outcomes for serious failures.

#### Statutory framework — Legal Profession Act 2007 (Qld) Pt 3.3

- **s 248** — definition of trust money (money held on trust for another person in the course of legal practice)
- **s 249** — definition of controlled money (trust money received with written direction to invest)
- **s 253** — **trust money must be deposited to a general trust account** (no later than the next business day after receipt; ADI authorised under the Act)
- **s 254** — **trust money must not be mixed** with other money (subject to limited exceptions for transitional balances)
- **s 255** — **controlled money** must be deposited to a controlled money account in accordance with the written direction
- **s 256** — **trust account records** must be kept (the detail of which is in the Legal Profession Regulation 2017 (Qld))
- **s 257** — power to deal with trust money (only as authorised: pay to client, apply to costs once billed and 7 days elapsed, transfer per written authority)
- **s 258** — **trust account reconciliation**: monthly reconciliation of trust account; cash book reconciled to bank statement reconciled to ledger trial balance; reconciliation kept as part of the records
- **s 259** — **annual external examination** by an external examiner approved by the QLS; lodgement of examiner's report
- **s 260** — keeping records for 7 years
- **s 261** — **deficiency in trust money — immediate reporting obligation** to the QLS Council; this is a notify-now-explain-later provision; failure to report is itself a breach
- **s 263** — false or misleading trust records: serious offence

#### Legal Profession Regulation 2017 (Qld) — record-keeping detail

- Form of receipts (sequentially numbered, mandatory fields)
- Form of trust account cash book
- Form of trust account ledgers (one per matter)
- Form of trust journal (transfers between ledgers)
- Form of trust account reconciliation statement
- Statement of trust money to clients (annual or on completion)
- Controlled money records
- Investment records

#### Queensland Law Society audit requirements

- QLS publishes the External Examiner's Checklist annually
- Examiner verifies: bank reconciliations, ledger integrity, controlled money compliance, receipt sequence integrity, journal authorisations, deficiency disclosure, statements to clients, record retention
- Examiner reports any irregularity to QLS Council
- A clean external examination is a precondition to renewal of practising certificate (in practice)

#### What our trust accounting module must do

1. **Trust receipting**
   - Sequentially numbered (system-enforced, no gaps, no manual override)
   - Mandatory fields: date, payer name, matter, amount, purpose, method (cheque/EFT/cash/card), receiver signature
   - PDF receipt generated, archived, emailed to payer (optional)
   - Cash receipts flagged for AML/CTF reporting if ≥ AUSTRAC threshold

2. **Trust ledger per matter**
   - One ledger per matter, real-time balance
   - Every entry shows: date, receipt/payment ref, description, debit, credit, running balance
   - Balance can never be negative — system blocks any transaction that would overdraw
   - Ledger is **append-only**: once a transaction is posted, it cannot be edited or deleted
   - Corrections are reversing entries with mandatory reason and dual authorisation

3. **Trust journal**
   - Inter-matter transfers (e.g., applying retainer balance from completed matter to new matter on client written instruction)
   - Dual authorisation required (drawer + checker, neither the same person)
   - Written client authority must be attached as a document reference
   - Full audit trail: who, when, why, on what authority

4. **Trust bank reconciliation (monthly, per s 258)**
   - Bank-feed integration (CBA, NAB, Westpac, ANZ — direct or via Yodlee/Plaid-style aggregator)
   - Auto-match: receipt number ↔ deposit; payment ↔ withdrawal
   - Exception queue for unmatched items
   - Reconciliation report: cash book balance ↔ bank statement balance ↔ trial balance of all matter ledgers
   - Three-way tie-out is the s 258 requirement; system enforces this and locks reconciliation only when balanced
   - Monthly reconciliation report archived as record (s 256)

5. **Controlled money management**
   - Separate register of controlled money accounts
   - Each account linked to: matter, written direction, ADI, account number, term, interest rate
   - Interest accrual tracked per direction (some directions specify interest to client; others retained subject to s 249/255)
   - Disposal only on direction or court order
   - Maturity reminders (term deposits)

6. **Interest calculations and disposal**
   - General trust account interest: by statute, paid to QLS Public Purpose Fund (in Qld; see LPA Pt 3.3 Div 5) — system tracks, does not retain
   - Controlled money interest: per direction

7. **Trust account examination preparation**
   - One-click examiner export: full ledgers, cash book, reconciliations (12 months), journals, controlled money register, statements to clients, deficiency notifications
   - QLS External Examiner's Checklist mapped to system queries — examiner can verify electronically

8. **Deficiency detection and alerts**
   - Continuous monitoring: any negative ledger, any unreconciled item > X days, any unauthorised journal
   - Alert principal immediately; lock further trust transactions on the affected ledger pending review
   - s 261 reporting workflow: pre-drafted notification to QLS, principal one-click acknowledgement that it has been sent

9. **Audit trail (immutable)**
   - Every action logged: who, when, IP, action, before/after
   - Append-only log; cryptographically chained (Merkle / hash chain) so tampering is detectable
   - 7-year retention minimum; recommend 10 years to allow margin for s 347 LPA records and any post-completion examinations

10. **Bank feed integration**
    - Read-only API access to trust account bank statement
    - Daily reconciliation pre-check (any new transactions?)
    - Alerts for unusual activity

11. **BAS/GST handling for trust disbursements**
    - Disbursements paid from trust on behalf of client are generally GST-free to the firm (the firm is acting as paying agent, not principal)
    - System distinguishes agency disbursements (no GST input) from non-agency (firm pays, on-charges with GST)
    - Flow-through to Xero/MYOB BAS preparation

#### Build vs buy analysis

**Option A: Build custom trust accounting module**
- Pros: full integration, AI-native, no vendor dependency, IP ownership
- Cons: highest regulatory risk; QLS and external examiners are unfamiliar with bespoke systems; bug = potential strike-off; build cost very high; ongoing compliance maintenance (LPA amendments, regulation changes)
- Build effort: 12–18 months with dedicated developer + compliance consultant + barrister review
- Total cost (rough): $250k–$500k plus ongoing $50k–$100k/year maintenance

**Option B: Integrate existing trust accounting module**
- Candidates:
  - **LEAP** — defeats the purpose
  - **PracticeEvolve** — full PMS competitor, not a module
  - **Smokeball** — full PMS competitor, not a module
  - **MYOB Trust** — historically existed; check current product status
  - **Xero + Trust Accounting add-on (e.g., Cordoba, FilePro)** — Xero is general ledger; trust modules are third-party
  - **FilePro Trust** — used by some QLD firms; standalone or integrated
  - **Specialist Australian providers** — there are 2–3 niche vendors offering trust accounting as an API/embedded module
- Pros: regulatory burden largely outsourced; vendor maintains compliance with LPA changes; auditors familiar; lower build cost
- Cons: integration overhead; some vendor lock-in; may not be AI-native
- Build effort: 4–6 months for integration
- Total cost (rough): $50k–$120k integration + ongoing $5k–$15k/year licence

**Option C: Partner with a trust accounting provider**
- White-label arrangement with an existing trust accounting vendor
- They provide the regulated module; we wrap it in our UI
- Pros: lowest regulatory risk; fastest time-to-market
- Cons: revenue share; less control; brand dilution if they're white-labelled

**Recommendation:** **Option B — integrate**, at least for v1.

Reasoning: trust accounting is a 30-year-mature regulatory domain. The risk-adjusted return on building it ourselves is poor — every benefit accrues to clients invisibly, while every defect is a regulatory event. Integrate a proven trust accounting module via API; expose it through our UI; let the vendor carry the compliance maintenance burden. Revisit Option A only if (a) we have validated the rest of the platform; (b) the integration constraints become commercially material; or (c) we move to a SaaS model and trust accounting becomes a feature we must own.

The time and capital saved by integrating goes into the modules where we actually create competitive advantage: AI drafting, case ranking, gap analysis, knowledge graph.

### 15.3 Billing & Invoicing Engine

#### Time recording

- Inputs: stopwatch, manual entry, calendar event auto-conversion, email auto-conversion, document-edit auto-conversion (every captured event becomes a draft time entry, principal approves)
- Each time entry: matter, fee earner, date, units (5-min), narrative, billable y/n, costs basis (s 300 itemised vs scale)
- **Narrative engine** uses the standards in `TOOLS.md` and `SOUL.md`:
  - What + From/To Whom + Date + About What + Why
  - Conventional QLD phrasing ("perusing", "considering", "drafting and settling", "attending to", "conferring with")
  - No internal/administrative entries
  - Each entry discrete and assessable independently
- AI-assisted narrative drafting (principal edits, never blind-accepts)
- Bulk-narrative review pass before invoicing — system flags non-compliant entries

#### Invoice generation

- **Tax invoice format** compliant with *A New Tax System (Goods and Services Tax) Act 1999* (Cth) s 29-70:
  - Words "tax invoice"
  - Supplier name and ABN
  - Recipient name and (if total ≥ $1,000) ABN
  - Date of issue
  - Description of supply
  - GST amount or statement that price includes GST
- **Itemised bill** per LPA s 300:
  - Sufficient detail for the costs to be assessed
  - Each item separately identified
  - Amount for each item
  - Default to itemised; lump-sum bill only on s 332 request
- **Trust money applied to invoices**:
  - 7-day notice rule (s 257): bill must be issued, 7 days elapsed, before trust money may be applied to costs (subject to authority)
  - Workflow: bill issued → 7-day clock → trust-to-office transfer permitted → journal entry → office account receipt → matter ledger updated
- **Disbursement tracking**:
  - Office disbursements (firm pays, on-charges with GST) vs agency disbursements (paying agent, no GST input)
  - Per-matter disbursement register
  - Auto-attached to next bill
- **Interest on overdue accounts**:
  - LPA s 321 — interest can be charged if disclosed in costs agreement and bill
  - Rate: as agreed or at the rate prescribed (Reserve Bank cash rate target + 2% — check current LPR)
  - Auto-calculated on overdue bills

#### Payment processing

- **Trust to office transfer** workflow with s 257 7-day check enforced by system
- **Direct debit** via Stripe / GoCardless / EziDebit
- **Credit card** via Stripe (surcharge passed through if disclosed)
- **EFT** with auto-reconciliation from office account bank feed
- **Payment plan management**: schedule, automated reminders, default escalation, varied costs agreement if extending credit

#### Costs disclosure automation

- **s 308 initial disclosure**:
  - On matter open, system generates costs disclosure document with: estimate of total costs, basis of charges, billing intervals, dispute process, right to negotiate, right to assessment
  - Pre-filled from matter type and scope template
  - Sent for client signature (DocuSign/Adobe Sign)
  - Signed copy archived; engagement gated on receipt
- **s 315 revised estimates** — auto-triggered by WIP thresholds:
  - Threshold rules: e.g., when WIP reaches 75% of last estimate, alert; when 100%, mandatory revised estimate; when scope materially changes, mandatory revised estimate
  - Pre-drafted revised estimate; principal reviews; client signs
- **s 316 billing rights notifications**:
  - Each bill includes the prescribed notification of client's rights (assessment, set-off, dispute)
  - Template baked into invoice generation; system blocks issue without notification
- **s 309 / 310** — costs agreement integration; conditional costs agreements (uplift) handled per s 323; contingency fees prohibited per s 325

#### Integration with accounting (Xero/MYOB)

- Office account general ledger lives in Xero (recommended) or MYOB
- Invoices generated in our system push to Xero as sales invoices
- Office bank feed reconciled in Xero
- P&L, balance sheet, BAS prepared in Xero
- Trust accounting (per §15.2) is separate; trust-to-office transfers reflected in both systems
- Accountant retains their existing Xero login; no disruption to bookkeeping workflow

### 15.4 Email & Communication Hub

#### Email integration (Microsoft 365 / Gmail)

- **Microsoft Graph API** (M365) and **Gmail API** (Google) — both supported
- **Auto-save emails to matter**:
  - Matter-specific BCC alias (`matter-{id}@boss.bosslawyers.com.au`) for outbound
  - Inbound: AI classification by sender domain, subject, content embedding similarity to matter context
  - Confidence threshold; below threshold → manual classification queue
  - Privileged emails flagged and access-restricted (no external indexing)
- **AI categorisation**:
  - Each email tagged: matter, type (correspondence/disclosure/court/intra-firm/admin), party, urgency
  - Auto-extract action items → tasks; deadlines → calendar; documents attached → matter document store
- **Draft responses from matter context**:
  - "Reply to this email about the Smith matter" → AI drafts using matter facts, prior correspondence, applicable authority, principal's drafting style
  - Principal edits; never auto-sends
- **Email templates with merge fields**:
  - Standard correspondence templates (acknowledgement, adjournment request, costs disclosure cover letter, etc.)
  - Merge fields: matter, parties, dates, amounts

#### SMS integration

- Twilio / MessageMedia
- Outbound: client updates ("hearing confirmed for Monday 10am"), payment reminders
- Inbound: routed to matter via known phone number; unknown numbers go to triage
- All SMS logged as file notes

#### Secure client messaging portal

- Authenticated client portal (MFA mandatory)
- Threaded messaging per matter
- Document upload/download with virus scan
- Costs and trust balance visibility
- Read receipts; message retention; export to matter file

#### Communications as evidence

- All communications (email, SMS, portal, file note) logged and timestamped
- Hash-chained for tamper evidence
- Privilege flags applied; legal professional privilege preserved on disclosure exports
- Export to court-compliant PDF bundle for use in evidence

#### Automated billing narratives for correspondence

- Each email/SMS sent or received generates a candidate time entry
- Narrative auto-drafted per the §15.3 narrative engine
- Default unit: 1 unit (5 min) for short correspondence; AI estimates units for longer drafting
- Principal reviews before bill issue

### 15.5 Migration Strategy

Five-phase plan. Each phase has defined entry criteria, exit criteria, and rollback triggers. No phase begins until the previous phase's exit criteria are met.

#### Phase A — Shadow Mode (Months 1–6)

- **State:** Dashboard runs alongside LEAP. LEAP is system of record.
- **Activities:**
  - Dashboard pulls from LEAP via API (matters, contacts, calendar, time entries, documents)
  - Dashboard adds the intelligence layer: AI drafting, case ranking, gap analysis, knowledge graph
  - All new features (per §1–§12 of this spec) only in dashboard
  - Team uses dashboard daily for read access and AI-augmented work; LEAP for data entry
- **Exit criteria:**
  - Dashboard stable in production for 60 consecutive days, no P1 incidents
  - Principal uses dashboard ≥ 80% of working hours
  - Pull-from-LEAP latency < 5 minutes for matter changes
- **Rollback trigger:** sustained outage > 4 hours on any business day → revert to LEAP-only.

#### Phase B — Partial Migration (Months 6–12)

- **State:** Dashboard becomes primary for everything except billing and trust.
- **Activities:**
  - **Time recording moves to dashboard** (sync back to LEAP for billing). Principal records time in dashboard; nightly push to LEAP time module.
  - **Document management moves to dashboard.** New documents created in dashboard; LEAP DM becomes read-only archive of pre-migration documents.
  - **Calendar/deadlines managed in dashboard.** Two-way sync with LEAP calendar maintained for fallback.
  - LEAP used for: billing, invoicing, trust accounting, accounting integrations.
- **Exit criteria:**
  - 90 days of clean time-recording sync (no missed entries, no narrative formatting errors)
  - Document migration complete with integrity check (hash verification on all migrated files)
  - Calendar drift < 24 hours on any deadline
- **Rollback trigger:** any deemed admission, missed limitation, or s 316 non-compliance attributable to dashboard → pause migration, root-cause, fix before resuming.

#### Phase C — Billing Migration (Months 12–18)

- **State:** Custom billing engine goes live. LEAP retained only for trust accounting.
- **Activities:**
  - Custom billing engine (§15.3) deployed to staging; full UAT against historical bills
  - Costs disclosure automation tested against LPA Pt 3.4 checklist
  - Xero/MYOB integration validated
  - **Parallel run:** both LEAP and dashboard produce invoices for 3 months. Each invoice compared line-by-line. Variances investigated. Zero unexplained variance required to exit parallel run.
  - After parallel run: dashboard becomes invoicing system of record.
  - LEAP used only for trust accounting and historical bill archive.
- **Exit criteria:**
  - 3-month parallel run with zero unexplained variance
  - 100% s 308/315/316 compliance audit pass
  - GST/BAS reconciles to Xero for 6 consecutive months
- **Rollback trigger:** any costs disclosure compliance failure, any tax invoice GST error, any client complaint upheld on assessment → revert to LEAP billing.

#### Phase D — Trust Accounting Migration (Months 18–24)

- **State:** Trust accounting module goes live (per §15.2 — integrated module recommended).
- **Activities:**
  - Trust accounting module deployed and tested
  - **External examination by an approved external examiner** of new system (engage examiner specifically for system review; this is NOT the annual s 259 examination — it is a pre-go-live attestation)
  - **Queensland Law Society consultation** if needed: voluntary engagement to confirm regulatory acceptability of the system architecture, particularly the immutable-ledger and reconciliation approach
  - **Parallel run minimum 6 months:** every trust transaction posted to both LEAP and new system; monthly reconciliations compared; ledgers tied out
  - Independent monthly review by external accountant during parallel run
  - Annual s 259 external examination conducted on **both** systems for the parallel-run period; clean report on new system required to exit
- **Exit criteria:**
  - 6-month parallel run with zero unexplained variance
  - Clean external examination report on new system
  - QLS no objection (if consultation undertaken)
  - Disaster recovery test: full restore from backup within 4 hours; reconciliations regenerated correctly
- **Rollback trigger:** any deficiency, any reconciliation failure, any examiner finding → halt migration, full investigation, s 261 notification if required.

#### Phase E — LEAP Decommissioned (Month 24+)

- **State:** LEAP licence cancelled; all functions native.
- **Activities:**
  - **Full data migration** of historical matters (closed and active), documents, financial records, time entries
  - Migration validated by sampling: random 5% of matters reviewed end-to-end against LEAP source
  - LEAP access maintained read-only for 7 years (LPA s 260, s 347 record retention)
  - In practice: take a final database export and a final document archive; archive to cold storage (S3 Glacier); maintain a small read-only viewer for occasional access
  - LEAP licence cancelled; cost savings flow to firm P&L
- **Cost savings:** estimated $6,000–$10,000/year on LEAP + integrated add-ons (LawConnect, etc.). Reinvest in maintenance and feature development.

### 15.6 Data Migration

#### Scope

- **Matter data**: parties, contacts, key dates, matter type, status, fee earner, costs agreement, all matter metadata
- **Documents**: every document with metadata (created date, author, type, version), preserving folder structure
- **Time entries**: complete historical time records with narratives
- **Financial records**: invoices, receipts, trust transactions (7-year retention minimum per LPA s 260; s 347 governs general record retention; recommend 10 years to allow margin)
- **Precedents and templates**
- **Calendar entries** (past and future)
- **Email links** (where LEAP stored email-to-matter associations)
- **Conflict check history**
- **Notes and file notes**

#### Process

1. **Full LEAP export** — XML/CSV via LEAP's data export tools and API
2. **Schema mapping** — LEAP fields → our schema (per §3 data model)
3. **Transformation** — clean, normalise, deduplicate, resolve foreign key references
4. **Staged load** — closed matters first (lowest risk), then active matters in order of inactivity, then current/active matters last
5. **Hash verification** — every document file hashed; pre- and post-migration hashes compared; mismatches flagged
6. **Integrity checks** — referential integrity, no orphans, no duplicate matter IDs, all parties resolvable, all financial records balance
7. **User acceptance testing** — random sample of 5% of matters reviewed end-to-end by principal and PA
8. **Post-migration audit** — independent review by external consultant

#### Validation rules

- Trust ledger balances: must reconcile to LEAP balances at migration cut-over date
- Time entries: total hours by fee earner per period must match LEAP totals
- Invoices: total billed per period must match LEAP totals
- Documents: file count and total bytes match LEAP archive
- Matters: count of open/closed/dormant matches LEAP

#### Rollback plan

- Pre-migration full backup of LEAP database and document store retained for 12 months
- Cut-over conducted on weekend; if Monday morning shows critical defect, revert to LEAP and re-attempt
- Critical defect = any of: trust ledger mismatch, missed deadline, lost document, financial record discrepancy > $0.01, conflict-check failure
- Rollback decision: principal alone; documented; QLS notification if rollback occurs during trust phase

### 15.7 Risk Analysis

#### Regulatory risk — **HIGH**

- **Trust accounting non-compliance** → suspension or strike-off
- **Costs disclosure non-compliance** → costs unenforceable (LPA s 316)
- **Conflict check failure** → professional conduct complaint, costs orders, disqualification
- **Record retention failure** → LPA s 260 breach, regulatory action
- **Privilege/confidentiality breach** → professional conduct breach, civil liability
- **Mitigation:**
  - Trust accounting: integrate (do not build) — §15.2 Option B
  - Parallel run for all financial modules — Phases C and D
  - External examination of new system before go-live — Phase D
  - QLS consultation before trust go-live — Phase D
  - Compliance consultant engaged throughout — independent of build team
  - Annual external review post-migration

#### Data loss risk — **MEDIUM-HIGH**

- **Migration corruption** — data lost, malformed, or mismapped
- **Mitigation:**
  - Full LEAP backup retained for 12 months pre- and post-migration
  - Hash verification on every document
  - Staged migration (closed matters first)
  - Sampling-based UAT
  - 6-month parallel run for trust accounting
  - Cold-storage archive of pre-migration state

#### Operational risk — **MEDIUM**

- **Staff resistance** — "LEAP works, why change?"
- **Learning curve** — productivity drop during transition
- **Mitigation:**
  - Phased rollout (Phase A is purely additive — no LEAP function removed)
  - Training program per phase
  - LEAP kept available throughout migration as backup
  - Dashboard UX must be measurably better than LEAP UX, not just "different" (else change is unjustifiable)
  - Principal as champion — if Mark uses it daily, the firm follows

#### Financial risk — **MEDIUM**

- **Build cost vs LEAP licence savings**
- LEAP cost (estimate): $500–$800/month for a small firm = $6,000–$10,000/year
- Build cost: $250k–$500k (capex) plus $50k–$100k/year (opex) — see §15.8
- **The build does not pay back via LEAP licence savings alone.** Payback is via productivity gains: more matters per fee earner, fewer admin hours, fewer compliance failures, fewer write-offs at billing.
- **Mitigation:**
  - Phased capex spend; abort options at each phase boundary
  - ROI tracked against §14 success metrics, not against LEAP licence cost
  - SaaS / licensing optionality (§15.9) provides upside if build succeeds

#### Vendor risk — **LOW-MEDIUM**

- **If we build custom, we own maintenance**
- LPA amendments, UCPR amendments, court rule updates, regulation changes — all become our problem
- **Mitigation:**
  - Clean architecture; well-documented code; standard stack (per §11)
  - Maintenance budget baked into opex from day one
  - Subscribe to QLS regulatory updates; legal-tech consultant on retainer for changes
  - For trust accounting specifically: integrate, do not build (§15.2)

#### Cybersecurity risk — **HIGH (always, for legal practice)**

- Client data including privileged communications
- **Mitigation:**
  - Encryption at rest and in transit
  - MFA mandatory for all users including principal
  - Penetration testing annually
  - Australian-hosted infrastructure (data sovereignty)
  - Local LLM inference for highly sensitive matters (per §12)
  - Cyber insurance increased to reflect platform criticality

### 15.8 Cost-Benefit Analysis

#### Current LEAP costs (estimate)

- LEAP base licence: ~$500–$800/month for a small firm (varies by user count and tier)
- LawConnect / e-signature: ~$50–$100/month
- InfoTrack/GlobalX: pay-per-search; not LEAP-specific
- Annual: ~$6,000–$10,000
- 5-year cost: ~$30,000–$50,000

#### Build costs by phase

| Phase | Activity | Estimate |
|---|---|---|
| Phase A | Shadow mode build (covers most of §1–§12) | $80k–$150k |
| Phase B | Partial migration (time, docs, calendar) | $40k–$70k |
| Phase C | Custom billing engine + costs disclosure | $60k–$100k |
| Phase D | Trust accounting integration (§15.2 Option B) + parallel run | $50k–$80k |
| Phase E | Final migration, decommission, documentation | $20k–$40k |
| **Total capex** | | **$250k–$440k** |

#### Ongoing maintenance and hosting (post-Phase E)

- Hosting (AWS/Azure, Australian region): $1,000–$2,500/month
- Database (Postgres + pgvector): included in hosting
- Object storage: ~$200–$500/month at scale
- LLM inference (mix of OpenAI/Anthropic + local for sensitive): $500–$2,000/month depending on usage
- Trust accounting module licence (Option B integration): $5k–$15k/year
- Maintenance developer (part-time / on retainer): $40k–$80k/year
- Compliance review (annual): $10k–$20k
- **Total opex: $80k–$150k/year**

#### Break-even timeline

- LEAP licence savings alone: never breaks even (savings $10k/year vs opex $100k/year)
- **Real break-even is via productivity:**
  - If dashboard saves principal 30 minutes/day (per §14 success metric), at $800/hr = $400/day = ~$100k/year (recouped fully)
  - If dashboard enables 25–35% more concurrent matters (per §14), revenue uplift dwarfs all costs
  - If costs-disclosure automation prevents one s 316 non-compliance (potential 6-figure write-off), single-event payback
  - If conflict check enhancement prevents one disqualification (potential matter loss + costs orders), single-event payback
- **Conservative payback:** 2–3 years from first capex
- **Optimistic payback:** 12–18 months if SaaS optionality realised

#### Intangible benefits

- **AI-native architecture** — every workflow can have AI added; LEAP cannot
- **Competitive advantage** — measurable speed and quality improvement vs LEAP-firms
- **IP ownership** — the firm owns its workflow, data model, and IP
- **No vendor lock-in** — exit costs trend to zero
- **Talent attraction** — modern tooling attracts modern lawyers
- **Optionality** — SaaS path (§15.9) is a real option, not a fantasy

#### The real value

A system that makes the solicitor *faster, smarter, and catches things LEAP never could*: the deemed admissions before they happen; the limitation periods at risk before they expire; the costs disclosure before it becomes unenforceable; the conflict before it becomes a complaint; the merit-weighted matter before counsel writes it off; the settlement range before the offer is made.

That is not a software upgrade. That is a different practice.

### 15.9 Competitive Moat

#### Why this matters strategically

- **No legal tech company is building AI-native practice management for Australian boutique litigation firms.**
  - The big legal-AI players (Harvey, CoCounsel, Spellbook, Ivo) target enterprise legal departments and large firms — their problems are different (volume contract review, M&A due diligence, in-house legal ops). They do not solve QLD pleadings, UCPR compliance, LPA costs disclosure, QLS trust audits, or QLD costs assessment narratives.
  - The incumbent practice management vendors (LEAP, Smokeball, PracticeEvolve, Actionstep, FilePro, SILQ) are bolting AI features onto legacy architecture. Their AI is a feature; ours is the foundation. They cannot retrofit knowledge graphs, embedding-driven gap analysis, or matter-level merit scoring without rewriting the platform.
  - There is a real, defensible market gap: AI-native, Australian-jurisdiction-specific, boutique-litigation-focused practice management.

- **A purpose-built system is a genuine competitive advantage** at the practice level:
  - Faster first drafts → more matters per fee earner
  - Better gap analysis → fewer mistakes → fewer write-offs and complaints
  - Better merit scoring → smarter intake and earlier settlement
  - Better costs compliance → no s 316 surprises
  - Better client experience → portal, transparency, real-time visibility
  - All of this is invisible to clients individually but compounds into reputation over years.

#### Future opportunity — SaaS optionality

If the system works for Boss Lawyers, it can be productised and licensed to other boutique litigation firms.

- **SaaS model:**
  - Multi-tenant architecture from the start (data isolation per firm via PostgreSQL row-level security + per-tenant encryption keys)
  - Per-fee-earner monthly subscription
  - Indicative pricing: $200–$400 per fee earner per month — premium positioning, justified by ROI
  - Trust accounting integration sold as add-on (revenue share with the integrated provider)

- **Go-to-market sequence:**
  - **Phase 1 — Boss Lawyers internal use only** (Years 1–3 per this roadmap)
  - **Phase 2 — alpha partners** (Years 3–4): 3–5 friendly QLD boutique firms; subsidised pricing in exchange for feedback and case studies
  - **Phase 3 — QLD launch** (Year 4): general availability for Queensland firms; QLS Major Sponsor engagement; conference launch
  - **Phase 4 — Australia-wide** (Year 5+): expand to NSW, VIC (different procedural rules — UCPR vs UCPR (NSW), Civil Procedure Act (Vic) — material engineering work)
  - **Phase 5 — vertical depth**: insolvency-specific module, construction-specific module, family-specific module (each as a vertical wrapper around core platform)

- **Why QLD-specific first:**
  - Mark knows QLD law cold; product is tested by the principal himself
  - QLD has ~5,000 practising solicitors; ~30% in firms < 10 lawyers — addressable market
  - QLS regulatory environment well understood
  - Geographic focus simplifies trust accounting (one set of rules) and audit (QLS examiners)

- **Why expand later:**
  - Other states' rules are similar but not identical; engineering cost is real (different UCPR, different bar associations, different trust regulators — Law Society of NSW, Victorian Legal Services Board, etc.)
  - Each jurisdiction is a real product investment, not a config flag

- **Revenue diversification for the firm:**
  - Legal practice income is constrained by fee earner hours
  - SaaS revenue scales without solicitor hours
  - Within 5 years, SaaS could be a meaningful revenue stream — possibly larger than the legal practice itself if scaled
  - Boss Lawyers becomes a **legal-tech firm with a litigation practice**, not a litigation firm with a tool
  - Optionality, not commitment: the SaaS path can be activated, paused, or sold at any phase

#### Defensibility

- **Data moat:** every closed matter is training data for the next ranking model (firm-private, never shared with external training)
- **Workflow moat:** the system encodes Mark's judgment — pleading style, costs narrative phrasing, settlement instincts, gap-analysis priorities — and that is genuinely hard to replicate
- **Regulatory moat:** the QLS-audit-clean trust accounting integration is non-trivial to recreate
- **Brand moat:** if Boss Lawyers is the firm that built this, the credibility of the platform inherits the firm's reputation

#### Strategic decision points

- **Year 1 end of Phase A:** is the dashboard demonstrably better than LEAP? Yes → continue. No → stop, write off Phase A as cost of finding out.
- **Year 2 end of Phase C:** is the firm running materially differently? Are §14 metrics being hit? Yes → continue to trust phase. No → stay on hybrid (dashboard for intelligence, LEAP for billing/trust) indefinitely.
- **Year 3 end of Phase D:** has the system passed external examination? Yes → decommission LEAP. No → indefinite parallel run.
- **Year 3+:** activate SaaS path? Decision based on whether the system is internally proven and the firm has appetite to operate a software business alongside a legal practice.

#### The endgame

If this works:

- Boss Lawyers operates with 30%+ more capacity per fee earner than peer firms
- Compliance failures are rare-to-zero
- Client experience is materially superior
- The firm has IP that has independent commercial value
- Mark has built something that outlasts him as principal

If it does not:

- Phase A still delivered the AI-augmented dashboard over LEAP — substantial value with limited downside
- Phases B–E are abort-able at each boundary
- The firm reverts to LEAP-only with no worse position than today

The asymmetry is favourable: capped downside (phased capex, abort options), uncapped upside (productivity, IP value, SaaS optionality). That is the test for whether a strategic bet is worth taking.

---

*End of specification.*
