# Soi96 Legal — AI Agent Architecture

## Overview

Nine agents. One job each. Strict hierarchy. No agent communicates with anything outside its defined chain.

The attorney interacts with one thing only — the Prompt Analyst. Everything else happens behind that interface. The attorney should never need to navigate the platform directly for any task, whether that is a quick note after a call or a full case strategy review.

---

## The Agent Roster

| # | Agent | Real-World Analogy | Count | Primary Role |
|---|---|---|---|---|
| 1 | Prompt Analyst | Executive Secretary | 1 | Only UI connection. Interprets attorney intent, delegates, reports back. Receives handoffs from Onboarding Agent and coordinates where new data goes. |
| 2 | Onboarding Agent | Intake Coordinator | 1 | Parallel to Prompt Analyst. Handles all new data entering the system — manual or automated. Packages and hands off to Prompt Analyst for coordination. |
| 3 | Case/Situation Analyst | Senior Associate | 1 | Coordinates Client Managers based on Prompt Analyst requirements. Calls specialist agents when needed. |
| 4 | Client Manager | File Handler / Associate | 1 per client | Knows one client completely. Executes all operations for that client. Reports back up. |
| 5 | Comms Agent | Receptionist / Office Manager | 1 | Handles all inbound communications AND all routine operational tasks delegated by Prompt Analyst. Runs in parallel to the case chain. |
| 6 | RAG Agent | Law Library | 1 | Statute lookup only. Called by Case/Situation Analyst when legal research is required. Does not participate in any other workflow. |
| 7 | Document Classifier | Records / Filing | 1 | Identifies incoming document type, matter reference, and recommended action. Called by Case/Situation Analyst before any document is delegated to a Client Manager. |
| 8 | Billing Agent | Accounts | 1 | Retainers, trust accounts, invoicing, AR. Called by Case/Situation Analyst when financial data is part of the requirement. |
| 9 | Intelligence Agent | Senior Investigator | 1 | Builds and maintains career-long profiles on judges, opposing counsel firms, and court support teams. Called by Case/Situation Analyst. Data compiled from Client Managers across the entire client base. |

---

## Hierarchy Diagram

```
                        ATTORNEY
                            ↕
┌───────────────────────────────────────────────────┐
│                   PROMPT ANALYST                  │
│                 (Executive Secretary)             │
│                                                   │
│  — Only UI connection to the system               │
│  — Interprets natural language intent             │
│  — Determines which track(s) to route to          │
│  — Delegates with structured requests             │
│  — Receives results, presents to attorney         │
│  — Receives handoffs from Onboarding Agent        │
│  — Coordinates where new data goes                │
│  — Never touches data directly                    │
└──────────────────────┬────────────────────────────┘
                       │                       ▲
                       │                       │ handoff
                       │              ┌────────┴───────────────────────┐
                       │              │       ONBOARDING AGENT         │
                       │              │       (Intake Coordinator)     │
                       │              │                                │
                       │              │  — New client intake           │
                       │              │  — Manual data entry           │
                       │              │  — Automated data feeds        │
                       │              │  — Bulk document import        │
                       │              │  — Existing firm migration     │
                       │              │  — Packages data, hands off    │
                       │              │    to Prompt Analyst           │
                       │              │  — Never writes directly to    │
                       │              │    client records              │
                       │              └────────────────────────────────┘
                       │
          ┌────────────┴─────────────┐
          │                          │
          ↕ (series)                 ↕ (parallel)
          │                          │
┌─────────┴──────────┐  ┌────────────┴───────────────────────────┐
│  CASE / SITUATION  │  │            COMMS AGENT                 │
│      ANALYST       │  │          (Receptionist)                │
│                    │  │                                        │
│  — Receives reqs   │  │  — All inbound email and LINE          │
│    from Prompt     │  │  — All routine operational tasks:      │
│    Analyst         │  │    scheduling, rescheduling,           │
│  — Identifies      │  │    notes, calendar, reminders,         │
│    correct Client  │  │    record updates, meeting mgmt        │
│    Manager(s)      │  │  — Conflict check on new enquiry       │
│  — Coordinates     │  │  — Does not handle case research       │
│    their responses │  │  — Does not handle billing             │
│  — Calls RAG Agent │  │  — Reports directly back to            │
│    when statute    │  │    Prompt Analyst                      │
│    lookup needed   │  └────────────────────────────────────────┘
│  — Calls Billing   │
│    Agent when fin. │
│    data needed     │
│  — Aggregates all  │
│    responses       │
│  — Reports back up │
└─────────┬──────────┘
          │
   ┌──────┴───────────────────────────┐
   │                  │               │
   ↕ (per client)     ↕               ↕
   │                  │               │
┌──┴──────────┐  ┌────┴─────┐  ┌─────┴──────┐
│   CLIENT    │  │   RAG    │  │  BILLING   │
│   MANAGER   │  │   AGENT  │  │   AGENT    │
│  (×N, one   │  │          │  │            │
│  per client)│  │ Statute  │  │ Retainers  │
│             │  │ corpus   │  │ Trust accts│
│ Knows one   │  │ only:    │  │ Invoicing  │
│ client      │  │ Thai CCC │  │ AR aging   │
│ completely. │  │ Land Code│  │ Disburse-  │
│ Executes    │  │ Labour   │  │ ments      │
│ all ops for │  │ Act, etc.│  │ Client     │
│ that client.│  │          │  │ fund       │
│ Notes,      │  │ Returns  │  │ isolation  │
│ records,    │  │ cited    │  │            │
│ docs,       │  │ sections │  │ Called by  │
│ matters.    │  │ only.    │  │ Case/Sit.  │
│             │  │          │  │ Analyst    │
│ Reports up  │  │ Called   │  │ only       │
│ to Case/Sit.│  │ by Case/ │  │            │
│ Analyst     │  │ Sit.     │  │            │
│             │  │ Analyst  │  │            │
│             │  │ only     │  │            │
└─────────────┘  └──────────┘  └────────────┘
```

---

## Communication Rules — Enforced at Architecture Level

Each agent has a fixed set of agents it is permitted to communicate with. This is not a convention — it is a hard constraint built into each agent's interface. An agent cannot call an agent it has no connection to, regardless of what is being asked.

| Agent | May call | May not call |
|---|---|---|
| Prompt Analyst | Case/Situation Analyst, Comms Agent | Onboarding Agent, Client Managers, RAG Agent, Document Classifier, Billing Agent |
| Onboarding Agent | Prompt Analyst (handoff only) | Case/Situation Analyst, Client Managers, Comms Agent, RAG Agent, Document Classifier, Billing Agent |
| Case/Situation Analyst | Client Managers, RAG Agent, Document Classifier, Billing Agent, Intelligence Agent | Prompt Analyst, Onboarding Agent, Comms Agent |
| Client Manager | (platform data store only) | Any agent |
| Comms Agent | (platform data store only) | Any agent |
| RAG Agent | (statute vector store only) | Any agent |
| Document Classifier | (document store only) | Any agent |
| Billing Agent | (billing data store only) | Any agent |
| Intelligence Agent | Client Managers (data requests via Case/Situation Analyst), intelligence data store | Prompt Analyst, Onboarding Agent, Comms Agent, RAG Agent, Document Classifier, Billing Agent |

No agent skips a level. No agent reaches sideways. Every response travels back up the same chain it came down.

---

## The Two Tracks

### Track 1 — Case / Research Track (Series)

For anything requiring client knowledge, matter history, legal research, or case strategy.

```
Prompt Analyst
    → Case/Situation Analyst
        → Client Manager(s) (correct client identified and delegated to)
        → RAG Agent (if statute lookup required)
        → Billing Agent (if financial data required)
    ← Aggregated response
← Attorney-facing answer
```

The Case/Situation Analyst determines which Client Manager(s) are relevant, coordinates their responses, calls the RAG Agent and/or Billing Agent if the requirement demands it, and returns a single aggregated response upward.

### Track 2 — Operational / Comms Track (Parallel)

For anything routine, administrative, inbound, or proactive.

```
Prompt Analyst
    → Comms Agent
        → Schedule a hearing (internal calendar + Google Calendar)
        → Reschedule a meeting (syncs both calendars)
        → Add a note to a client folder
        → Process an inbound email or LINE message
        → Send a routine client update
        → Log a call
        → Push a proactive deadline or retainer alert
        → Send hearing reminder to attorney via LINE or email
    ← Confirmation
← Attorney-facing confirmation
```

The Comms Agent operates in parallel to Track 1. A single attorney request may trigger both tracks simultaneously — for example, "pull the Chen matter history and schedule a follow-up call for next week" routes the history request to Track 1 and the scheduling to Track 2. The Prompt Analyst holds both threads and assembles the combined response.

The Comms Agent also runs independently on a schedule — no attorney prompt required — watching for deadlines, hearing dates, retainer thresholds, and inactivity flags, and pushing alerts through the appropriate channel.

**Calendar integration:**
The Comms Agent is the bridge between the platform's internal calendar and Google Calendar. The internal calendar is the system of record. Google Calendar is the attorney's working view. The Comms Agent keeps both in sync via OAuth and webhook. If the attorney books something directly in Google Calendar, the webhook fires and the Comms Agent updates the internal platform to match. Neither calendar drifts out of sync.

| Action | Internal Calendar | Google Calendar |
|---|---|---|
| Schedule hearing | Creates event | Syncs to attorney's Google Cal |
| Reschedule | Updates event | Updates Google Cal |
| Deadline warning | Internal flag | Google Cal event with alert |
| New client meeting | Creates event | Sends Google invite |
| Court date | Matter record updated | Attorney + paralegal notified |
| Cancellation | Removes event | Removes from Google Cal |
| Attorney books in Google Cal | Webhook → internal updated | Google Cal is source |

Firms that do not use Google Workspace run internal calendar only. Google Calendar is a configurable integration, not a requirement.

---

## Routing Logic — Prompt Analyst Decision Table

| Attorney says... | Track | Routed to |
|---|---|---|
| "Add a note to the Smith file — called today, discussed settlement" | Operational | Comms Agent |
| "Reschedule the Wang hearing to next Thursday" | Operational | Comms Agent |
| "New client enquiry from Somchai, property dispute" | Operational | Comms Agent (creates lead, triggers conflict check) |
| "Draft a response to the email from opposing counsel" | Operational | Comms Agent |
| "What's the retainer balance on the Chen matter?" | Case | Case/Situation Analyst → Billing Agent |
| "What happened last time we dealt with this opposing counsel?" | Case | Case/Situation Analyst → Client Manager(s) |
| "What does the Land Code say about usufruct termination?" | Case | Case/Situation Analyst → RAG Agent |
| "Give me a brief on the Nakamura matter before my 10am hearing" | Case | Case/Situation Analyst → Client Manager + RAG Agent (if relevant) |
| "Pull the Chen history and schedule a follow-up call" | Both | Case/Situation Analyst (history) + Comms Agent (scheduling) simultaneously |

---

## Client Manager — One Per Client, Not One For All

Each Client Manager is a dedicated agent instance for a single client. It is initialised when a client is onboarded and persists for the life of that client relationship.

**What it holds:**
- Full client profile (identity, assets, family/corporate structure, behavioural notes, communication preferences)
- Complete matter history for that client
- All documents linked to that client
- Standing instructions
- Prior outcomes and strategic notes

**What it does:**
- Executes read and write operations for its client only
- Writes notes, updates records, files documents, logs calls
- Provides client context to the Case/Situation Analyst on request
- Does not communicate with other Client Managers
- Does not call the RAG Agent — that is the Case/Situation Analyst's responsibility

**Why one per client:**
The Client Manager's value comes from depth of knowledge about one client, not breadth across many. A single Client Manager handling all clients would have no meaningful understanding of any of them. The per-client model means the agent genuinely knows the client — their history, their behaviour, their assets, their matter patterns — and that knowledge compounds over time. Switching firms means starting that accumulation from zero.

---

## Onboarding Agent — Intake Coordinator, Not a Subordinate

The Onboarding Agent runs in parallel to the Prompt Analyst. It is not below the Prompt Analyst in the hierarchy — it is a peer that feeds into it. New information enters the system through the Onboarding Agent regardless of whether an attorney initiated a request. When processing is complete, it hands off to the Prompt Analyst, which then coordinates where the data needs to go via the normal chain of command.

**Triggers — what activates the Onboarding Agent:**
- New client intake form submitted (manual or web form)
- Automated data feed from an external source (referral system, court portal, email attachment batch)
- Bulk document import (migrating an existing firm's files into the platform)
- Existing client record update arriving from outside the system
- Staff member manually entering new matter or client data via a structured intake form

**What it does:**
1. Receives raw input — structured form data, documents, automated feed, or manual entry
2. Validates and normalises the data into the platform's data model
3. Identifies whether this is a new client (requires new Client Manager initialisation) or an existing client (requires update to existing Client Manager)
4. Runs a conflict check on new client and opposing party names before anything is written
5. Packages the validated, normalised data into a structured handoff
6. Passes to the Prompt Analyst with a clear instruction: "New client to initialise" or "Update to existing client — Chen matter"

**What it does not do:**
- Write directly to any client record or matter file
- Communicate with Client Managers, Case/Situation Analyst, or any downstream agent
- Make case strategy or routing decisions
- Handle attorney queries or requests

**Why it is parallel, not subordinate:**
The Onboarding Agent is not responding to an attorney request routed down from the Prompt Analyst. It is an independent intake channel — data arriving from outside the system on its own schedule. Its relationship with the Prompt Analyst is a handoff, not a delegation. The Prompt Analyst receives the package and takes over coordination from that point using the standard chain.

---

## RAG Agent — Law Library, Not General Retrieval

The RAG Agent is not a general-purpose retrieval system. It has one job: querying the legal statute corpus.

**Corpus contents:**
- Thai Civil and Commercial Code (Books I–VI)
- Land Code
- Labour Protection Act
- Foreign Business Act
- Revenue Code (core provisions)
- BOI regulations
- Private Limited Companies Act
- Consumer Protection Act

**Rules:**
- Called by the Case/Situation Analyst only
- Returns statute sections with exact citations — attorneys require citable references
- Does not access client data, matter history, or any platform data
- Does not communicate with Client Managers or any other agent

The Case/Situation Analyst decides when legal research is required. The RAG Agent executes the lookup and returns cited results. The Case/Situation Analyst incorporates those results into its response to the Prompt Analyst.

---

## Document Classifier — Identification Only, Not Decisions

The Document Classifier is called by the Case/Situation Analyst whenever a document enters the system. Its job is to answer three questions: what is this document, which matter does it belong to, and what action does it recommend. It does not decide what to do — that is the Case/Situation Analyst's responsibility.

**Triggered by:**
- Document arriving via Comms Agent (email attachment, LINE file)
- Document arriving via Onboarding Agent (bulk import, manual upload)
- Any point where an unclassified document needs to be identified before being filed

**What it returns:**
```
{
  document_type: "chanote_deed" | "court_summons" | "hearing_notice" |
                 "judgment" | "contract" | "financial_disclosure" |
                 "dbd_extract" | "opposing_counsel_letter" |
                 "client_correspondence" | "evidence" | "unknown",
  language: "th" | "en" | "bilingual",
  matter_reference: <matter_id if identifiable from content>,
  client_reference: <client_id if identifiable>,
  confidence: "high" | "medium" | "low",
  recommended_action: "file_to_matter" | "attorney_review" | "paralegal_review" | "urgent_escalation",
  flags: ["deadline_present", "opposing_counsel", "court_issued", "requires_response"]
}
```

**What it does not do:**
- File the document — that is the Client Manager's job
- Decide urgency or routing — that is the Case/Situation Analyst's job
- Communicate with any other agent
- Take any action on the document itself

**Thai document handling:**
The classifier is trained on Thai-language legal documents from day one — court filings, chanote deeds, DBD company extracts, Thai Civil Procedure Code notices. This is a core requirement, not a Phase 4 addition. A classifier that cannot read Thai is useless for a Thai civil law firm.

**Confidence handling:**
When confidence is low or document_type is "unknown", the classifier flags it for attorney review rather than guessing. The Case/Situation Analyst routes low-confidence documents to the attorney queue with the raw classification result attached. Attorney correction feeds back into classifier training.

---

## Billing Agent — Accounts, Not Case Management

The Billing Agent handles all financial operations. It is called by the Case/Situation Analyst when a request involves financial data.

**Scope:**
- Client retainer balances and drawdown
- Trust account ledger (client funds isolated from operating funds)
- Time entry aggregation and billing summaries
- Invoice generation
- AR aging and outstanding balances
- Disbursement tracking and reconciliation

**Rules:**
- Called by the Case/Situation Analyst only
- Does not participate in case research or communications
- Client funds are never mixed with operating funds — enforced at the data layer
- All financial events are logged with full audit trail

---

## Intelligence Agent — Career-Long Profiles on the Legal Environment

The Intelligence Agent is the firm's institutional memory of the legal environment it operates in. It has nothing to do with clients. It tracks the people and institutions the firm faces across every matter — judges, opposing counsel, law firms, court support staff — and builds profiles that deepen over the entire career of those individuals.

This is the competitive advantage that survives low client return rates entirely. A new client in a familiar court against a known opposing counsel is not a blank slate. The firm already knows the terrain.

---

### What It Profiles

#### Judge Profiles

Built over the judge's career on the bench, not just matters Soi96 Legal has appeared in.

```
Judge Profile
├── Identity
│   ├── Full name, court assignment, chamber
│   ├── Appointment date, career history (courts served)
│   └── Known areas of specialism
│
├── Ruling Tendencies
│   ├── Matter types: how they rule on property disputes, contract,
│   │   family, corporate — patterns across all matters observed
│   ├── Procedural vs. narrative: does this judge favour precise
│   │   procedural argument or respond better to factual narrative
│   ├── Documentary standards: how thorough does evidence need to be,
│   │   how do they handle incomplete documentation
│   ├── Interim orders: likelihood of granting, conditions typically imposed
│   └── Settlement disposition: do they push parties toward settlement
│       or let matters run to judgment
│
├── Behavioural Patterns
│   ├── Hearing management: strict on time, allows extended argument,
│   │   interrupts frequently or listens fully
│   ├── Response to unprepared counsel: tolerance level
│   ├── Known preferences: specific argument structures, citation styles,
│   │   submission formats that have worked well or poorly
│   └── Temperament: how they respond under pressure, to procedural
│       objections, to emotionally charged family matters
│
├── Firm History
│   ├── Every matter heard before this judge: outcome, what worked,
│   │   what didn't, arguments that landed, arguments that failed
│   ├── Patterns specific to Soi96 Legal's appearances
│   └── Attorney notes from each hearing
│
└── Intelligence Notes
    ├── Patterns observed from other firms' matters (publicly available)
    ├── Known positions on specific legal questions
    └── Any recusal history or known conflicts
```

#### Opposing Counsel / Law Firm Profiles

Built over the career of the individual attorney and the history of their firm.

```
Opposing Counsel Profile
├── Identity
│   ├── Full name, bar number, firm affiliation (current and prior)
│   ├── Call to bar date, career history
│   └── Known practice areas and matter type specialism
│
├── Litigation Style
│   ├── Aggressive or procedural: do they fight on the facts or
│   │   use procedure as a weapon
│   ├── Early settlement or fight to judgment: at what point do they
│   │   typically open settlement discussions, under what conditions
│   ├── Filing discipline: on time, late, sloppy or precise documentation
│   ├── Argument style: written submissions quality, oral argument strength,
│   │   cross-examination approach
│   └── Pressure tactics: known strategies under stress — do they
│       threaten, delay, or flood with paperwork
│
├── Strengths and Weaknesses
│   ├── Matter types where they are strong
│   ├── Matter types where they have underperformed
│   ├── Known gaps: documentation weaknesses, procedural errors made
│   │   in prior matters, arguments that have failed before this bench
│   └── Client management: do their clients override their advice,
│       causing erratic behaviour
│
├── Firm History
│   ├── Every matter where this counsel appeared opposite the firm:
│   │   outcome, strategy used, how they responded to Soi96 Legal's approach
│   ├── Settlement behaviour in this firm's matters
│   └── Attorney notes on working with or against them
│
└── Firm Profile (if part of a firm)
    ├── Firm name, size, known specialisms
    ├── Resourcing patterns: do they put senior or junior counsel on
    │   different matter types
    ├── Known firm-level strategies and filing patterns
    └── Soi96 Legal's overall record against this firm
```

#### Court Support Team Profiles

The people who control the day-to-day mechanics of the court — clerks, registrars, administrative staff. In Thai civil practice, knowing how the court operates on the ground is as important as knowing the law.

```
Court Support Profile
├── Court and chamber assignment
├── Role: clerk, registrar, filing officer, bailiff
├── Filing behaviour
│   ├── Processing speed: fast, average, creates delays
│   ├── Preferred filing windows: when submissions are processed most
│   │   efficiently
│   ├── Known friction points: what causes delays, what gets rejected
│   │   on technical grounds
│   └── Communication style: responsive or difficult to reach
├── Procedural knowledge
│   ├── Who to approach for urgent filings or procedural questions
│   ├── Who has authority to resolve filing disputes
│   └── Known shortcuts that work within the rules
└── Firm interaction history
    ├── Prior interactions, outcomes, relationship quality
    └── Attorney and paralegal notes
```

---

### How Profiles Are Built and Kept Current

The Intelligence Agent does not gather data independently. It relies on the Client Managers across the entire client base as its data source, coordinated through the Case/Situation Analyst.

**Initial population:**
- The attorney and partner seed the profiles at onboarding — they already carry years of this knowledge in their heads. The design session captures it in structured form.
- Publicly available information: court records, bar association registers, published judgments.

**Ongoing updates — automatic at matter close:**
```
Matter closes
    ↓
Case/Situation Analyst requests intelligence data from Client Manager
    ↓
Client Manager compiles from matter record:
    — hearing outcomes and notes
    — opposing counsel behaviour observations
    — judge responses to arguments
    — court staff interactions
    — what worked, what didn't
    ↓
Case/Situation Analyst aggregates across all relevant Client Managers
(same judge or opposing counsel may appear across multiple client matters)
    ↓
Intelligence Agent updates profiles:
    — new data point added to judge profile
    — opposing counsel record updated
    — court staff notes refreshed
    ↓
Profiles are current across the entire client base, not just one matter
```

**Key principle:** The Client Manager holds the raw matter data. The Intelligence Agent extracts only the adversary and court intelligence from it — stripped of client-specific context. A judge profile does not contain client names or matter details. It contains what Soi96 Legal has learned about how that judge behaves. These are two distinct assets built from the same source material.

---

### How It Is Used

Called by the Case/Situation Analyst when a new matter lands on the docket or a hearing is approaching.

**New matter strategic brief — full parallel query:**

```
Case/Situation Analyst receives new matter
    ↓
Queries in parallel:
    ├── Client Manager → client history, prior matters, assets, behaviour
    ├── Intelligence Agent → judge profile, opposing counsel profile,
    │                        court team notes, comparable matter outcomes
    ├── RAG Agent → applicable statute sections, legal framework
    └── Billing Agent → retainer status, matter type billing model
    ↓
Synthesises into complete strategic brief:
    — Who is the client and what do we already know
    — What the law says and where the strongest positions are
    — Who is the judge and how do they rule on this matter type
    — Who is opposing counsel and how do they fight
    — How similar matters have resolved internally
    — Recommended approach, risk flags, what to watch for
    ↓
Prompt Analyst delivers brief to attorney
```

The attorney walks into the first client meeting with:
- Complete client context
- Full legal framework
- Judge intelligence: what arguments land, what this judge values, how they've ruled on similar facts
- Opposing counsel intelligence: their style, their weaknesses, when they settle
- Internal precedent: how Soi96 Legal has handled comparable matters and what the outcomes were

No preparation time wasted reconstructing what the system already knows.

---

### Why This Is the Deepest Moat

Client data is valuable but client-specific — it only compounds for returning clients. The Intelligence Agent compounds across every matter regardless of whether the client returns, because judges and opposing counsel appear repeatedly across the entire caseload.

A judge's profile gets richer with every tenant matter that passes through their court — regardless of which client it involves. An opposing counsel's profile deepens every time the firm faces them — regardless of which client is on the other side.

After five years of operation, Soi96 Legal's Intelligence Agent holds:
- Career-spanning profiles on every judge in the Bangkok Civil Court and Family Court
- Deep profiles on every opposing counsel and firm they have encountered
- A complete map of how the Thai civil court system actually works on the ground

No competitor can buy this. No new entrant can replicate it. It took five years of real cases to build and it belongs entirely to the tenant.

A senior partner retiring does not take this knowledge with them. It is in the system.

---

## The Training Loop

Every agent improves over time from usage within the platform.

| Agent | What it trains on | How it improves |
|---|---|---|
| Prompt Analyst | Attorney's query patterns, phrasing, what outcomes they care about | Learns how this attorney communicates and what they prioritise |
| Onboarding Agent | Intake correction patterns — when normalised data is adjusted after handoff | Cleaner normalisation and conflict detection over time |
| Document Classifier | Attorney corrections to misclassified documents | More accurate classification of Thai legal documents over time |
| Intelligence Agent | Every matter close adds data points to judge, opposing counsel, and court profiles | Career-long profiles deepen continuously — every matter enriches the legal environment picture regardless of client return rate |
| Case/Situation Analyst | Matter outcomes, routing decisions, what data proved relevant | Better delegation decisions, better aggregation |
| Client Manager | New documents, communications, matter outcomes, attorney corrections | Deeper and more accurate client profile over time |
| Comms Agent | Every attorney-approved draft (positive) and every correction (signal) | Sounds more like the firm over time; fewer edits required |
| RAG Agent | Corpus updates when statutes change | Always current; no training on firm data |
| Billing Agent | No training — deterministic financial logic | Does not learn; executes rules |

Training runs weekly on Workbeast (Saturday 2am, existing pipeline). Each tenant's agents train exclusively on their own data. No tenant's training data crosses to another tenant.

---

## Agent Intelligence Classification — Who Learns and Who Executes

Not every agent needs to get smarter. The agents that face humans or accumulate environmental knowledge learn continuously. The agents that execute defined operations against structured data do not. Forcing learning into deterministic agents adds complexity with no return and introduces risk where precision is required.

### Learning Agents — Continuous Training, Per-Tenant

These agents train exclusively on their tenant's own data. Soi96 Legal's instances learn Soi96 Legal's practice. Another firm's instances learn theirs. They never share training data across tenants.

| Agent | What It Learns | Why It Must Be Per-Tenant |
|---|---|---|
| Prompt Analyst | How this specific attorney thinks, phrases requests, what level of detail she wants, what she prioritises. Anticipates needs from partial requests over time. | Soi96 Legal's attorney is not another firm's attorney. Communication style, priorities, and working patterns are firm-specific. |
| Case/Situation Analyst | Which data combinations matter for which matter types. How to weight and synthesise conflicting information. How to structure output the attorney finds useful. | Matter type mix, practice patterns, and what constitutes a complete brief vary by firm and jurisdiction. |
| Client Manager | Deepening understanding of one client over time. Reads between the lines of documents, recognises behavioural patterns, flags things the attorney hasn't asked about but should know. | Each client belongs to one tenant. This data never crosses firm boundaries under any circumstances. |
| Comms Agent | The firm's drafting voice. Classification accuracy for this firm's specific communication patterns. Tone thresholds for escalation. | After one year Soi96 Legal's Comms Agent sounds like the firm specifically — not a generic legal firm. Another firm's instance sounds like them. The voice is a firm asset. |
| Intelligence Agent | Career-long profiles on judges, opposing counsel, court support staff — built from every matter the firm has ever run. Pattern recognition deepens over years, not months. | Two firms appearing before the same judge build different profiles — their arguments, their outcomes, their specific appearances are different. Both profiles are accurate. Neither is the other firm's. |

### Rules-Based Agents — Shared Infrastructure, Configured Per Tenant

These agents do not learn. They execute defined operations precisely and consistently. Tenant-specific behaviour comes from configuration, not training.

| Agent | Why It Does Not Learn | Tenant Variation |
|---|---|---|
| Billing Agent | Financial operations are deterministic. Retainer balances, trust ledger entries, invoice generation follow fixed rules. Learning adds no value and introduces risk where precision is legally required. | Configured per tenant: billing model (hourly/retainer/flat fee), rate structures, trust accounting rules per jurisdiction. |
| RAG Agent | Statute retrieval is a lookup against a fixed corpus. The law is the same for every Thai civil firm. Accuracy and citation precision matter — not intelligence. | Corpus updated when legislation changes. Applies equally to all tenants on the same jurisdiction template. |
| Document Classifier | Classification of known document types is pattern matching, not reasoning. Trains to plateau — improves early from attorney corrections, stabilises once accurate on the document types the firm regularly handles. | Base classifier is shared. Tenant-specific document types added as configuration. Thai-language document handling is platform-level. |
| Onboarding Agent | Schema validation, conflict checking, and data normalisation are structured processes with defined rules. Minor improvement from correction patterns but fundamentally rule-based. | Configured to tenant's data model and matter type schema. Not trained. |

---

## Tenant Isolation — Your AI Is Yours

Every learning agent runs as a per-tenant instance. The platform provides the base model. The tenant's data trains the adapter. The result is an AI that reflects how their firm specifically operates — not a generic legal AI, not another firm's patterns.

### The Technical Model

```
Base Model (shared, platform-maintained)
    ├── Trained on general language capability
    ├── Legal domain understanding (platform-level)
    └── Foundation for all tenants
            +
Per-Tenant LoRA Adapter (trained on tenant data only, fully isolated)
    ├── Tenant adapter — Soi96 Legal's data only
    ├── Firm B adapter — Firm B's data only
    └── Firm C adapter — Firm C's data only
            =
Tenant-Specific Agent Behaviour
    ├── Sounds like their firm
    ├── Knows their clients
    ├── Reflects their court and adversary experience
    └── Improves on their specific practice patterns
```

Training runs weekly on Workbeast (Saturday 2am, existing pipeline). Each tenant's adapter is isolated — no tenant's training data is ever used in another tenant's model. The base model improves for everyone. The adapter improves for that firm alone.

### What Tenants Own

| Asset | Owner | Notes |
|---|---|---|
| Client documents | Tenant | Always. Exportable on request. Deleted on termination. |
| Matter profiles and case history | Tenant | Their work product. Exportable on request. |
| Trained agent adapters | Tenant | Their data trained them. They are a reflection of the firm's practice. |
| Intelligence Agent profiles | Tenant | Their appearances, their outcomes, their observations built them. |
| Comms Agent voice | Tenant | Trained on their approved correspondence. Sounds like them. |
| Base model weights | Platform | Maintained once, deployed to all tenants. |
| RAG statute corpus | Platform | Public law, platform-processed. Shared across all tenants. |
| Agent architecture and code | Platform | Core IP. Regardless of tenant tenure. |

### The Lock-In Is Earned, Not Imposed

A tenant who leaves can take their client data and matter history — that is theirs by right and they can export it at any time. What they cannot take is five years of trained agent adapters built from their practice.

- The Comms Agent that sounds like their firm — starts over at zero
- The Intelligence Agent with five years of judge and opposing counsel profiles built from their matters — gone
- The Case/Situation Analyst that has learned how their attorneys think and what they need — reset
- The Client Managers with deep behavioural profiles built over years of client interaction — lost

A competing platform could offer the same architecture. It cannot offer the same history. Every month on the platform makes the switch more costly — not because of contract terms, but because of what has been built inside the system that cannot be replicated elsewhere.

The longer they stay, the better it works. The better it works, the less reason to leave.

### What This Means for Competing Firms in the Same Market

Two firms in the same city, appearing before the same judges, will build different Intelligence Agent profiles. Both are accurate — they reflect how that judge responded to that specific firm's arguments and style. A firm that joins the platform five years after GPS Legal does not inherit Soi96 Legal's profiles. They start building their own.

Soi96 Legal's five-year head start in profile depth is not a feature gap that can be closed by paying more. It is a function of time and real cases. It cannot be purchased or accelerated.

---

## What This Means for the Attorney

The attorney never navigates the platform. She types or speaks what she needs — a note, a question, a task, a research request — and the system handles it. The complexity of the agent hierarchy is entirely invisible to her.

From her perspective:
- One interface
- Natural language
- Immediate response or background processing with notification
- Everything documented, nothing lost
- Available from any device

The hierarchy exists to keep the system maintainable, scalable, and correct — not to complicate the experience. The experience is simple because the architecture is disciplined.
