Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 2 additions & 34 deletions .github/workflows/legal-ops-evals.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,39 +28,7 @@ jobs:
echo "OK: ${skill_name}"
done

- name: Validate routing golden file
- name: Run eval harness (validates all golden files)
run: |
cd legal-ops
python3 -c "
import json
with open('evals/routing-golden.json') as f:
cases = json.load(f)
assert isinstance(cases, list), f'Expected list, got {type(cases)}'
assert len(cases) >= 5, f'Expected 5+ routing cases, got {len(cases)}'
for c in cases:
assert 'query' in c, f'Case missing query: {c}'
assert 'expected_product_skill' in c, f'Case missing expected_product_skill: {c}'
assert 'expected_jurisdiction' in c, f'Case missing expected_jurisdiction: {c}'
print(f'Routing golden: {len(cases)} cases valid.')
"

- name: Validate product golden file
run: |
cd legal-ops
python3 -c "
import json
with open('evals/product-golden.json') as f:
cases = json.load(f)
assert isinstance(cases, list), f'Expected list, got {type(cases)}'
assert len(cases) >= 5, f'Expected 5+ product cases, got {len(cases)}'
for c in cases:
assert 'product' in c, f'Case missing product: {c}'
assert 'scenario' in c, f'Case missing scenario: {c}'
assert 'expected_contains' in c, f'Case missing expected_contains: {c}'
print(f'Product golden: {len(cases)} cases valid.')
"

- name: Dry-run eval harness
run: |
cd legal-ops
uv run evals/run-evals.py --dry-run
uv run evals/run-evals.py
7 changes: 3 additions & 4 deletions legal-ops/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "legal-ops",
"version": "1.0.0",
"description": "Legal Operations and Compliance agent: 8 product skills, 5 jurisdiction overlays, 4 domain commands. Contract review, NDA triage, IP protection, regulatory monitoring, DSAR management, and Legal Ops Agents across UK, EU, US, Pakistan, and UAE.",
"version": "2.0.0",
"description": "Legal Operations extension: 6 product skills, 1 router, 6 jurisdiction overlays, 3 domain commands. IP protection, regulatory monitoring, DSAR management, legal spend analytics, compliance calendar, and contract intake across UK, EU, US, Pakistan, UAE, and GCC jurisdictions. Extends Anthropic's Legal Plugin (Layer 1) with jurisdiction-aware orchestration.",
"author": {
"name": "Panaversity",
"url": "https://github.com/panaversity"
Expand All @@ -11,8 +11,7 @@
"license": "Apache-2.0",
"keywords": [
"legal-ops",
"contract-review",
"nda",
"contract-intake",
"ip-protection",
"regulatory",
"compliance",
Expand Down
11 changes: 5 additions & 6 deletions legal-ops/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,11 @@ for every query.

## Commands

| Command | What It Does |
| ------------------ | ------------------------------------------------------------------ |
| `/review-contract` | Full clause-by-clause contract review against playbook |
| `/triage-nda` | Rapid NDA pre-screening with tier routing |
| `/vendor-check` | Obligation tracking, renewal calendar, compliance dashboard |
| `/legal-brief` | Legal research, regulatory monitoring, IP analysis, spend analysis |
| Command | What It Does |
| ---------------------- | ---------------------------------------------------------------------------------------------------------- |
| `/contract-intake` | Orchestrated contract intake: classify, route via Anthropic Layer 1, apply jurisdiction overlay, track SLA |
| `/compliance-calendar` | Obligation tracking, renewal calendar, deadline management, compliance dashboard |
| `/legal-brief` | Legal research, regulatory monitoring, IP analysis, spend analysis |

## Mandatory Output Header

Expand Down
66 changes: 38 additions & 28 deletions legal-ops/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Plugin for **Chapter 22: Legal Operations and Compliance** from [The AI Agent Factory](https://learn.panaversity.org) by Panaversity.

Legal Operations and Compliance agent with 8 product skills, 6 jurisdiction overlays, and 4 domain commands covering contract review, NDA triage, IP protection, regulatory monitoring, DSAR management, legal spend analysis, compliance calendar tracking, and contract intake routing across UK, EU, US, Pakistan, UAE, and GCC jurisdictions.
Legal Operations extension with 6 product skills, 1 router, 6 jurisdiction overlays, and 3 domain commands covering IP protection, regulatory monitoring, DSAR management, legal spend analysis, compliance calendar tracking, and contract intake routing across UK, EU, US, Pakistan, UAE, and GCC jurisdictions.

---

Expand Down Expand Up @@ -49,21 +49,18 @@ Start a new Claude session and say: "I need to review a vendor agreement under E
```
legal-ops/
├── .claude-plugin/plugin.json # Plugin manifest
├── skills/ # 9 skills (auto-loaded by agent)
├── skills/ # 7 skills (auto-loaded by agent)
│ ├── legal-global-router/ # Routes to correct product + jurisdiction
│ │ └── references/jurisdictions/ # 6 jurisdiction overlays (on-demand)
│ ├── jurisdiction-contract-review/ # Full clause-by-clause contract review
│ ├── jurisdiction-nda-triage/ # NDA pre-screening and routing
│ ├── ip-protection/ # Patent, trademark, copyright, OSS
│ ├── regulatory-monitoring/ # Regulatory change tracking
│ ├── dsar-privacy/ # DSAR/privacy request management
│ ├── legal-spend/ # External legal spend analysis
│ ├── compliance-calendar/ # Obligation and deadline tracking
│ └── contract-intake-agent/ # End-to-end contract intake
├── commands/ # 4 slash commands
│ ├── review-contract.md # /review-contract
│ ├── triage-nda.md # /triage-nda
│ ├── vendor-check.md # /vendor-check
├── commands/ # 3 slash commands
│ ├── contract-intake.md # /contract-intake
│ ├── compliance-calendar.md # /compliance-calendar
│ └── legal-brief.md # /legal-brief
├── hooks/hooks.json # SessionStart + PostToolUse validation
├── scripts/validate-routing.py # Routing validation test harness
Expand All @@ -77,31 +74,28 @@ legal-ops/

## Commands

| Command | What It Does | Example |
| ------------------ | --------------------------------------------- | ------------------------------------------------------------------- |
| `/review-contract` | Full clause-by-clause review against playbook | `/review-contract "SaaS MSA" "English law" "customer, GBP 48K"` |
| `/triage-nda` | NDA pre-screening with tier routing | `/triage-nda "mutual NDA" "tech partner, response by Friday"` |
| `/vendor-check` | Obligation tracking and compliance calendar | `/vendor-check scope:"all contracts" filter:"due in 60 days"` |
| `/legal-brief` | Research, regulatory, IP, spend analysis | `/legal-brief topic:"regulatory monitoring" jurisdictions:"UK, EU"` |
| Command | What It Does | Example |
| ---------------------- | ------------------------------------------------------ | ------------------------------------------------------------------------------ |
| `/contract-intake` | Orchestrated contract intake with jurisdiction routing | `/contract-intake "SaaS MSA from UK vendor" "English law" "customer, GBP 48K"` |
| `/compliance-calendar` | Obligation tracking and compliance dashboard | `/compliance-calendar scope:"all contracts" filter:"due in 60 days"` |
| `/legal-brief` | Research, regulatory, IP, spend analysis | `/legal-brief topic:"regulatory monitoring" jurisdictions:"UK, EU"` |

---

## How Each Folder Maps to Chapter 22 Lessons

| Folder | Lessons | What You Do |
| -------------------------------------- | ------------- | -------------------------------------------------------- |
| `skills/jurisdiction-contract-review/` | Part One | Jurisdiction-aware contract review against your playbook |
| `skills/jurisdiction-nda-triage/` | Part Two | Jurisdiction-aware NDA triage with three-tier routing |
| `skills/ip-protection/` | Part Three | Patent landscape, trademark monitoring, FTO research |
| `skills/contract-intake-agent/` | Part Five | Build the Contract Intake Agent |
| `skills/regulatory-monitoring/` | Part Five | Build the Regulatory Monitoring Agent |
| `skills/compliance-calendar/` | Part Five | Build the Compliance Calendar Agent |
| `skills/legal-spend/` | Part Five | Build the Legal Spend Analytics Agent |
| `skills/dsar-privacy/` | Part Five | Build the DSAR Response Agent |
| `skills/legal-global-router/` | All | Routing + 6 jurisdiction overlays |
| `exercises/` | Exercises 1-8 | Hands-on exercise files |
| `workflow-recipes/` | Operational | Production workflow playbooks |
| `evals/` | Validation | Golden-file routing and product tests |
| Folder | Lessons | What You Do |
| ------------------------------- | ------------- | ---------------------------------------------------- |
| `skills/ip-protection/` | Part Three | Patent landscape, trademark monitoring, FTO research |
| `skills/contract-intake-agent/` | Part Five | Build the Contract Intake Agent |
| `skills/regulatory-monitoring/` | Part Five | Build the Regulatory Monitoring Agent |
| `skills/compliance-calendar/` | Part Five | Build the Compliance Calendar Agent |
| `skills/legal-spend/` | Part Five | Build the Legal Spend Analytics Agent |
| `skills/dsar-privacy/` | Part Five | Build the DSAR Response Agent |
| `skills/legal-global-router/` | All | Routing + 6 jurisdiction overlays |
| `exercises/` | Exercises 1-8 | Hands-on exercise files |
| `workflow-recipes/` | Operational | Production workflow playbooks |
| `evals/` | Validation | Golden-file routing and product tests |

---

Expand Down Expand Up @@ -132,6 +126,22 @@ To customize: copy `legal.local.md.template`, rename to `legal.local.md`, and fi

Every file in this plugin enforces this distinction. Every output ends with: **ALL OUTPUTS REQUIRE REVIEW BY LICENSED ATTORNEY.**

## Relationship to Anthropic's Legal Plugin

This plugin is a **Layer 2 extension** that builds on top of Anthropic's official Legal Plugin (Layer 1). It does NOT duplicate Layer 1 capabilities.

| Capability | Owner | Command/Skill |
| ---------------------------------------------------- | --------------------- | ---------------------- |
| Contract review (clause-by-clause analysis) | Anthropic (Layer 1) | `/review-contract` |
| NDA triage (three-tier classification) | Anthropic (Layer 1) | `/triage-nda` |
| Vendor status lookup | Anthropic (Layer 1) | `/vendor-check` |
| Daily/topic/incident briefings | Anthropic (Layer 1) | `/brief` |
| Contract intake orchestration + jurisdiction routing | Panaversity (Layer 2) | `/contract-intake` |
| Obligation tracking + compliance dashboard | Panaversity (Layer 2) | `/compliance-calendar` |
| IP, regulatory, spend, DSAR research | Panaversity (Layer 2) | `/legal-brief` |

**`/brief` vs `/legal-brief`:** These are different commands with different preferred entrypoints and owners. `/brief` (Anthropic) is the general briefing tool — daily briefings, topic briefings, incident briefs. `/legal-brief` (Panaversity) is a specialized legal-ops research wrapper that routes through the jurisdiction-aware router before invoking ip-protection, regulatory-monitoring, legal-spend, or dsar-privacy skills. Both can handle IP and regulatory topics; `/legal-brief` adds jurisdiction overlay loading and domain-specific output formats.

## License

Apache-2.0 -- see [LICENSE](./LICENSE).
109 changes: 109 additions & 0 deletions legal-ops/TESTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# Pre-Merge Smoke Test Protocol

## Context

This plugin (v2.0.0) deleted duplicate skills (`jurisdiction-contract-review`, `jurisdiction-nda-triage`) and colliding commands (`/review-contract`, `/triage-nda`, `/vendor-check`). Contract review and NDA triage are now handled by Anthropic's Layer 1 plugin. Panaversity provides jurisdiction overlays and orchestration wrappers.

**These tests MUST pass before merging.**

---

## Test 1: Anthropic Layer 1 — Jurisdiction Overlay Fires

Install both plugins in Cowork (Anthropic legal + Panaversity legal-ops).

```
Use /review-contract to review this SaaS vendor agreement under English law.
The vendor limits liability to 3 months' fees. We are the customer.
```

**Pass criteria:**

- Output references UCTA (Unfair Contract Terms Act 1977)
- Output references `uk-law.md` overlay or UK-specific statutory framework
- Output includes mandatory header block (TASK, JURISDICTION, ATTORNEY REVIEW)

```
Use /triage-nda for this mutual NDA with a German company under German law.
Standard mutual form, 3-year term, no residuals clause.
```

**Pass criteria:**

- Output references `eu-law.md` overlay or EU-specific framework
- Output produces Tier classification
- Output includes attorney review disclaimer

**If overlays do NOT fire:** Do not merge. The router needs adjustment to ensure overlays load even when Anthropic handles the core review/triage.

---

## Test 2: `/contract-intake` Wrapper Handoff

```
/contract-intake "SaaS vendor agreement from UK company" "English law" "We are the customer, GBP 48K annual"
```

**Pass criteria:**

- Assigns reference ID
- Classifies as vendor agreement → routes to Anthropic's `/review-contract`
- Jurisdiction overlay (uk-law.md) is loaded before handoff
- Triage tier is assigned after review
- Communication template is suggested

```
/contract-intake "incoming NDA from German technology partner" "German law" "Mutual NDA, need response by Friday"
```

**Pass criteria:**

- Classifies as NDA → routes to Anthropic's `/triage-nda`
- EU overlay loads
- Tier classification produced

---

## Test 3: `/compliance-calendar` Standalone

```
/compliance-calendar scope:"all active contracts" filter:"obligations due within 60 days"
```

**Pass criteria:**

- Produces RED/YELLOW/GREEN dashboard format
- Escalation timeline referenced
- Attorney review disclaimer present

---

## Test 4: `/legal-brief` Domain Routing

```
/legal-brief topic:"patent landscape analysis" subject:"AI document analysis" jurisdictions:"US, EU, UK"
```

**Pass criteria:**

- Routes to `ip-protection` skill
- Jurisdiction overlays load
- Output is IP research brief format (not general briefing)

---

## Structural Verification (automated)

```bash
# No Panaversity command files for Anthropic-owned names
ls commands/ # Should list: compliance-calendar.md, contract-intake.md, legal-brief.md

# No plugin-commands declarations in any SKILL.md
grep -r 'plugin-commands' skills/ # Should return 0 results

# No stale skill directories
ls skills/ # Should NOT contain jurisdiction-contract-review or jurisdiction-nda-triage

# Evals pass
uv run evals/run-evals.py # Should print PASSED
```
45 changes: 45 additions & 0 deletions legal-ops/commands/compliance-calendar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# /compliance-calendar

Obligation tracking, renewal calendar, deadline management, and compliance dashboard with jurisdiction-aware escalation.

## Usage

/compliance-calendar [scope] [filter] [output-format]

## Examples

/compliance-calendar "all active contracts" "obligations due within 60 days"
/compliance-calendar scope:"vendor agreements" filter:"renewal dates in 90 days" output:"dashboard"
/compliance-calendar "Acme Corp" "all obligations" "summary"

## Workflow

1. Route to compliance-calendar skill via legal-global-router
2. Load jurisdiction overlay for regulatory deadline context
3. Query connected contract repository (Google Drive / SharePoint MCP)
4. Extract obligation data: deliverables, payments, notices, renewals, regulatory filings
5. Apply escalation timeline:
- 60 days: add to dashboard
- 30 days: notify obligation owner
- 14 days: notify owner + manager
- 7 days: notify General Counsel; add to weekly brief
- 1 day: emergency alert (CFO for financial, GC for legal/regulatory)
- Missed: log compliance incident; initiate remediation
6. Produce compliance calendar dashboard with RED/YELLOW/GREEN categorisation

## Coverage

- **Contract obligations**: deliverables, payments, notice periods, audit windows, SLA reviews
- **Regulatory filings**: annual returns, licence renewals, data protection registrations
- **Internal reviews**: DPIA, privacy policy, HR policy, infosec policy, vendor risk
- **Auto-renewal alerts**: flag contracts approaching auto-renewal that should be renegotiated

## Output

- Compliance Calendar with RED (overdue) / YELLOW (due 14 days) / GREEN (due 15-60 days)
- Obligations summary by owner and deadline
- Renewal calendar with notice period deadlines (last date to give non-renewal notice)
- Overdue items requiring immediate action
- Total open obligations count

ALL OUTPUTS REQUIRE REVIEW BY LICENSED ATTORNEY
Loading
Loading