Skip to content

LPA Safety Score

The LPA Safety Score (0–100) is the primary output of the /fund review-lpa command and the automated inbox review pipeline.

5-Agent Review Pipeline

How It Works

Five agents run in parallel, each analysing a different dimension of the LPA. Their scores are combined as a weighted average.

AgentRoleWeight
fund-termsTerm extraction & categorisation20%
fund-risksRisk scoring (1–10 per provision)25%
fund-complianceRegulatory compliance checks20%
fund-obligationsObligations & timeline mapping15%
fund-recommendationsNegotiation recommendations20%

Agent data flows linearly: the Terms agent output feeds into Risk, Compliance, Obligations, and Recommendations agents.

Agent Score Weights

Grade Thresholds

ScoreGradeInterpretation
90–100AInvestor-favourable, minor concerns only
75–89BStandard market terms with some negotiation points
60–74CMaterial issues, negotiation recommended
45–59DSignificant risk, legal review required
0–44FHighly investor-unfavourable, do not sign without major revisions

LPA Safety Score Scale

Implementation

The pipeline runs via the Anthropic SDK directly in apps/web/src/lib/review-pipeline.ts. It does not depend on the claude CLI binary.

PDF Prompt Caching

The document is sent once with cache_control: ephemeral. All five agent calls share the cached prefix, significantly reducing API cost for large documents.

Input Format

typescript
interface ReviewResult {
  fundSlug: string;
  fundName: string;
  documentName: string;
  reviewedAt: string;
  safetyScore: number;   // 0–100
  grade: 'A' | 'B' | 'C' | 'D' | 'F';
  verdict: string;
  agents: AgentResult[];
  totalFindings: number;
}

Findings Severity

Each finding carries a severity level: high, med, or low. The compliance tracker raises macOS notifications for High Risk findings when running locally.

Triggering a Review

Via CLI (T1)

bash
/fund review-lpa path/to/lpa.pdf

Via Webapp Upload (T3)

Drop a PDF into the upload UI at /w/[slug]/upload. The inbox watcher picks it up within 30 seconds and triggers the pipeline automatically.

Via API (T3)

bash
curl -X POST http://localhost:3000/api/review/trigger \
  -H "Content-Type: application/json" \
  -d '{"filename": "apex-lpa-2024.pdf", "fundId": "..."}'

Via Direct Upload API

bash
curl -X POST http://localhost:3000/api/upload \
  -H "x-api-key: $UPLOAD_API_KEY" \
  -F "file=@apex-lpa-2024.pdf"

Intentional Test Issues

The sample LPA (generate_sample_lpa.py) contains 10 intentional issues for validating detection:

  1. Aggressive carry (25%, no hurdle)
  2. Weak clawback
  3. Broad GP discretion on investment period extension
  4. No LPAC consent for affiliate transactions
  5. Vague fee offsets
  6. Missing key person provision
  7. Overly broad confidentiality
  8. 120-day opt-out trap
  9. Free GP assignment
  10. No excuse/exclusion rights

T1 (skills + CLI) and T2 (vault template) are MIT licensed.