# Soi96 Legal — Platform Strategy

## Practice Profile

**Firm:** GPS Legal
**Jurisdiction:** Thailand (civil courts)
**Matter types:** Corporate civil, family law
**Context:** Mixed Thai and international client base; Thai attorneys + foreign legal consultants; court filings in Thai and English

## What the ERP Core Provides (No Build Required)

| Capability | Legal Use |
|---|---|
| Contact management + relationship mapping | Client records, opposing counsel, court contacts |
| Communications suite (email + call capture) | Attorney-client correspondence, automatic record linkage |
| Document AI intake | Court filings, chanote deeds, DBD records classified and linked to matter |
| Immutable activity log | Demonstration of duty of care; proof of timeline |
| Billing + AR | Invoice generation, retainer tracking |
| Granular RBAC | Client confidentiality enforced at system level |
| Multilingual infrastructure | Thai UI addition, not a rebuild |

## What Needs to Be Built

### Legal-Specific Modules

1. **Matter management** — case record linking contacts, documents, hearings, deadlines, attorneys assigned
2. **Thai civil procedure templates** — court date scheduling, filing deadlines, hearing types
3. **Time entry** — 6-minute increment logging, matter/task code assignment
4. **Trust accounting** — client retainer ledger, separate from operating funds (Thai bar requirements)
5. **Conflict of interest check** — cross-reference new matters against all existing client/opposing party records
6. **Court deadline calendar** — Thai court schedule integration, deadline warnings

### AI Intelligence Layer

Six agents in a strict hierarchy. The attorney has one interface — the Prompt Analyst. Everything else is invisible to her.

See full architecture: `docs/agent-architecture.md`

| Agent | Role |
|---|---|
| Prompt Analyst | Only UI connection. Interprets intent, delegates, reports back. Never touches data. |
| Case/Situation Analyst | Coordinates Client Managers based on Prompt Analyst requirements. Calls RAG Agent and Billing Agent when needed. |
| Client Manager (×N) | One per client. Knows that client completely. Executes all operations for that client. |
| Comms Agent | Parallel track. Inbound email/LINE plus all routine operational tasks — scheduling, notes, calendar, record updates. |
| RAG Agent | Law library only. Statute lookup with citations. Called by Case/Situation Analyst only. |
| Billing Agent | Retainers, trust accounts, invoicing, AR. Called by Case/Situation Analyst only. |

#### Two tracks, always clear

**Case/Research track (series):** Attorney request → Prompt Analyst → Case/Situation Analyst → Client Manager(s) + specialist agents → back up the chain

**Operational track (parallel):** Attorney request → Prompt Analyst → Comms Agent → confirmation back up

A single request can run both tracks simultaneously. The Prompt Analyst holds both threads and assembles the response.

## Data Architecture

```
Matter
├── id, matter_number, status, type (corporate|family)
├── opened_at, closed_at
├── attorney_id (lead), attorneys[] (team)
├── client_id → Contact
├── opposing_party[] → Contact
├── court, judge, case_number
├── hearings[] → Hearing
├── documents[] → Document
├── time_entries[] → TimeEntry
├── trust_ledger[] → TrustTransaction
└── ai_brief → generated from client KB at open

Hearing
├── date, time, court, room
├── type (initial|evidence|argument|judgment)
├── outcome, notes
└── next_hearing_id

TimeEntry
├── attorney_id, matter_id
├── date, duration_minutes
├── task_code, description
└── billable, billed_at
```

## Build Sequence

**Phase 1 — Core legal layer**
- Matter model + API
- Time entry
- Court deadline calendar
- Conflict check

**Phase 2 — Trust accounting**
- Retainer intake, disbursement, reconciliation
- Thai bar compliance reporting

**Phase 3 — AI layer**
- Client KB schema + embedding pipeline
- Comms agent (email triage first, LINE second)
- Case strategy agent (requires sufficient closed matter history — build after 6+ months of Phase 1 data)

**Phase 4 — Refinement**
- Thai language AI (Thai-language court document processing)
- Mobile access (court attendance)
- Reporting (matter volume, billing, outcome statistics)
