# AI Training Loop — How the System Gets Smarter

## Overview

Every matter that closes makes the next one smarter.
Every email approved makes the next draft better.
The system compounds — it does not plateau.

---

## The Matter Intelligence Loop

```
New matter opens
        ↓
Client KB agent retrieves:
  - Prior matters for this client (outcomes, what worked, what didn't)
  - Asset profile (property, corporate interests, relevant to this matter type)
  - Standing instructions and communication preferences
  - Relationship and sensitivity notes
        ↓
Strategy agent queries:
  - Similar historical matters by type, asset profile, opposing counsel
  - What arguments worked in Thai civil courts for this matter type
  - Typical resolution timelines and settlement ranges
  - How this opposing counsel has behaved in prior matters (if known)
        ↓
Attorney receives at matter-open:
  - Pre-briefed matter summary (no hunting through files)
  - Relevant prior matter summaries surfaced automatically
  - Strategic framing based on similar resolved matters
        ↓
During the matter:
  - All actions, documents, communications feed back into the KB in real time
  - Hearing outcomes, rulings, and procedural decisions recorded
  - Attorney notes captured (arguments made, judge responses, tactical decisions)
        ↓
Matter closes:
  - Outcome recorded (won / settled / lost / withdrawn)
  - Attorney authors closing note: what worked, what didn't, opposing counsel assessment
  - Full matter record added to training dataset
        ↓
Weekly fine-tune on Workbeast:
  - New matter outcomes incorporated into strategy agent
  - Communication approvals incorporated into comms agent
  - Document examples incorporated into classifier
        ↓
Next similar matter opens — system is measurably smarter
```

---

## Three Agent Types, Three Training Sources

### 1. Client Knowledge Base Agent
**What it does:** Retrieves and synthesises client context at matter-open.
**What it trains on:** Client profiles, matter histories, communication patterns, document history.
**How it improves:** Every new matter adds to the client's history. Every correction to an auto-generated brief tells the system what it missed.
**Timeline to usefulness:** Day 1 (even empty KB provides structure). Compounds from first closed matter.

### 2. Case Strategy Agent
**What it does:** Surfaces relevant prior matters and strategic framing for new cases.
**What it trains on:** Closed matter records — arguments, outcomes, judge tendencies, opposing counsel patterns, settlement ranges, resolution timelines.
**How it improves:** Every closed matter is a new training example. Requires minimum ~20-30 closed matters of each type before pattern recognition becomes reliable.
**Timeline to usefulness:** 6–12 months of active matter flow. Quality accelerates with volume.

### 3. Communications Agent
**What it does:** Classifies inbound messages, drafts responses, routes to correct staff.
**What it trains on:** Every attorney-approved draft (positive) and every attorney rewrite (correction signal).
**How it improves:** Continuously — every sent message is a training example. The agent learns the firm's voice, the clients' communication patterns, and which classifications need human review.
**Timeline to usefulness:** Useful from day 1 for classification and routing. Draft quality improves materially by month 3–4. Sounds like the firm by month 12.

---

## The Compounding Effect

| Timeframe | What the system knows |
|---|---|
| Day 1 | Client identities, matter types, team structure |
| Month 3 | Communication patterns, document taxonomy, routine drafts improving |
| Month 6 | First matters closing — strategy agent getting first real training data |
| Month 12 | Agent voice matches the firm. Strategy agent recognising patterns. Client KB rich for returning clients. |
| Year 2 | Institutional knowledge that would take a new attorney 2–3 years to acquire |
| Year 3 | Full strategy agent — new matter assessment draws on hundreds of resolved cases. Genuine competitive moat. |

---

## What Makes This Defensible

**The data is proprietary.**
No competitor can replicate what Soi96 Legal's strategy agent knows about Thai civil courts,
Bangkok judges, opposing counsel patterns, and the outcomes of Soi96 Legal's specific case load.
That knowledge took years to accumulate and exists nowhere else.

**The voice is proprietary.**
The communications agent trained on 12 months of Soi96 Legal's approved correspondence
sounds like the firm. Not like a generic AI. Not like another firm's system.

**The institutional memory survives.**
When an attorney leaves, they take their knowledge with them — unless it's in the system.
When Soi96 Legal's system has 3 years of matter history, the firm's institutional knowledge
is independent of any individual. New attorneys onboard in days, not months.
The partner can step back. The firm continues.

---

## Infrastructure

The training pipeline already exists on Workbeast:
- Unsloth QLoRA fine-tuning on Qwen2.5-14B
- Weekly automated run (Saturday 2am via cron)
- Per-model training (bigwig-assistant, bigwig-code, bigwig-business)
- Legal adds: bigwig-legal-{tenant_slug} per tenant

Each tenant's model trains only on their own data.
The base model is shared. The fine-tuned adapter is tenant-specific and isolated.

New tenant onboarding initialises an empty training pipeline.
First closed matter is the first training example.
The system is useful immediately and improves continuously.
