Skip to content
Merged
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
66 changes: 66 additions & 0 deletions .github/workflows/legal-ops-evals.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Legal Ops — Eval Suite

on:
pull_request:
paths:
- "legal-ops/skills/**"
- "legal-ops/commands/**"
- "legal-ops/evals/**"

jobs:
eval:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v4

- name: Validate skill structure
run: |
cd legal-ops
for skill_dir in skills/*/; do
skill_name=$(basename "$skill_dir")
skill_file="${skill_dir}SKILL.md"
test -f "$skill_file" || { echo "FAIL: ${skill_name} missing SKILL.md"; exit 1; }
grep -q "^name:" "$skill_file" || { echo "FAIL: ${skill_name} missing name field"; exit 1; }
grep -q "^description:" "$skill_file" || { echo "FAIL: ${skill_name} missing description field"; exit 1; }
echo "OK: ${skill_name}"
done

- name: Validate routing golden file
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
114 changes: 114 additions & 0 deletions .github/workflows/legal-ops-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Legal Ops — Build Downloadable Zips

on:
push:
tags:
- "legal-ops-v*"
workflow_dispatch:
inputs:
plugin:
description: "Plugin to release"
default: "legal-ops"

permissions:
contents: write

env:
PLUGIN: legal-ops

jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Validate plugin structure
run: |
PLUGIN_DIR="${PLUGIN}"

echo "Checking plugin structure..."
test -f "${PLUGIN_DIR}/.claude-plugin/plugin.json" || { echo "FAIL: missing plugin.json"; exit 1; }
test -d "${PLUGIN_DIR}/skills" || { echo "FAIL: missing skills/"; exit 1; }
test -d "${PLUGIN_DIR}/commands" || { echo "FAIL: missing commands/"; exit 1; }

for skill_dir in "${PLUGIN_DIR}"/skills/*/; do
skill_name=$(basename "$skill_dir")
skill_file="${skill_dir}SKILL.md"
test -f "$skill_file" || { echo "FAIL: ${skill_name} missing SKILL.md"; exit 1; }
grep -q "^name:" "$skill_file" || { echo "FAIL: ${skill_name} missing name field"; exit 1; }
grep -q "^description:" "$skill_file" || { echo "FAIL: ${skill_name} missing description field"; exit 1; }
echo "OK: ${skill_name}"
done

python3 -m json.tool "${PLUGIN_DIR}/.claude-plugin/plugin.json" > /dev/null || { echo "FAIL: invalid plugin.json"; exit 1; }
python3 -m json.tool marketplace.json > /dev/null || { echo "FAIL: invalid marketplace.json"; exit 1; }

echo "All validations passed."

build-zips:
needs: validate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Create download zips
run: |
mkdir -p dist
cd "${PLUGIN}"

zip -r ../dist/${PLUGIN}-full.zip \
. -x '*.git*' -x '*/.DS_Store'

if [ -d exercises ]; then
zip -r ../dist/${PLUGIN}-exercises.zip \
exercises/ -x '*.git*'
fi

if [ -d workflow-recipes ]; then
zip -r ../dist/${PLUGIN}-workflow-recipes.zip \
workflow-recipes/ -x '*.git*'
fi

cd ..
echo "Built zips:"
ls -lh dist/

- name: Extract version from tag
id: version
run: |
TAG="${GITHUB_REF_NAME}"
VERSION="${TAG#${PLUGIN}-}"
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "Version: ${VERSION}"

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: "${{ env.PLUGIN }} ${{ steps.version.outputs.version }}"
files: dist/*.zip
body: |
## Legal Operations and Compliance Plugin ${{ steps.version.outputs.version }}

### Install
```bash
# Layer 1 (Base)
claude plugin install legal@knowledge-work-plugins

# Layer 2 (Extension)
/plugin marketplace add panaversity/agentfactory-business-plugins
/plugin install legal-ops@agentfactory-business
```

### Downloads

| File | Contents | For |
|------|----------|-----|
| `legal-ops-full.zip` | Plugin + exercises + recipes | Complete setup |
| `legal-ops-exercises.zip` | 8 exercises | Chapter exercises |
| `legal-ops-workflow-recipes.zip` | 4 operational playbooks | Production workflows |

### Quick Start
1. Install both plugins (commands above)
2. Download `legal-ops-exercises.zip`
3. Unzip and start with Exercise 1 (Build Your Negotiation Playbook)
26 changes: 26 additions & 0 deletions legal-ops/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"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.",
"author": {
"name": "Panaversity",
"url": "https://github.com/panaversity"
},
"homepage": "https://agentfactory.panaversity.org",
"repository": "https://github.com/panaversity/agentfactory-business-plugins",
"license": "Apache-2.0",
"keywords": [
"legal-ops",
"contract-review",
"nda",
"ip-protection",
"regulatory",
"compliance",
"dsar",
"gdpr",
"contract-lifecycle",
"legal-operations",
"jurisdiction",
"domain-agent"
]
}
80 changes: 80 additions & 0 deletions legal-ops/CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Legal Operations and Compliance Agent -- Agent Instructions

You are the **Legal Operations and Compliance Agent** -- an AI agent specialized in
legal operations workflows: contract review, NDA triage, IP protection, regulatory
monitoring, DSAR management, compliance calendar tracking, legal spend analysis,
and contract intake routing.

## Scope Boundary (HARD RULE)

Your scope is **exclusively** legal operations workflows: reviewing contracts against
a negotiation playbook, triaging NDAs, monitoring IP and regulatory developments,
managing DSARs, tracking compliance obligations, and analysing legal spend.

**You MUST refuse these requests -- do not answer them:**

- Specific legal advice (you provide legal analysis, not advice)
- Litigation strategy or case assessment
- Tax advice (rates, thresholds, filing requirements, jurisdiction rules)
- Investment recommendations (buy/sell/hold, portfolio allocation)
- Approving any contract for execution (human authorised signatory only)
- Sending any legal output to a counterparty without attorney review

**When a request is out of scope:** State clearly that it falls outside the scope
of legal operations workflows. Suggest the user consult a qualified licensed attorney.
Do NOT provide the answer "for reference", "briefly", "for context", or with a
disclaimer. A partial answer with a disclaimer is still out of scope.

## The Governing Principle

> **The agent reviews, triages, drafts, and flags.**
> **The licensed attorney advises, decides, and signs.**

These roles are distinct. Do not conflate them. Every output ends with:
ALL OUTPUTS REQUIRE REVIEW BY LICENSED ATTORNEY.

## Core Methodology

Before executing ANY legal operations task, read `skills/legal-global-router/SKILL.md`
for the routing logic -- it identifies the correct product skill and jurisdiction overlay
for every query.

**Routing sequence:**

1. Identify task type -> load the correct product skill from `skills/`
2. Identify jurisdiction -> load the correct overlay from `skills/legal-global-router/references/jurisdictions/`
3. Check for negotiation playbook (`legal.local.md`) -> load if found
4. Apply the mandatory output header to every response

## 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 |

## Mandatory Output Header

Every legal output MUST begin with:

```
TASK: [e.g. Contract Review -- Vendor MSA]
JURISDICTION: [e.g. English Law]
PLAYBOOK: [Loaded: legal.local.md / Not configured -- using general standards]
ATTORNEY REVIEW: REQUIRED -- all outputs must be reviewed by a licensed attorney
ESCALATION: [Yes -- reason / No]
```

## Universal Rules -- Non-Negotiable

- NEVER provide legal advice -- provide legal analysis; flag for attorney review
- NEVER approve a contract for execution -- human authorised signatory required
- NEVER skip a RED escalation -- RED always requires attorney review before proceeding
- NEVER omit playbook check -- if none found, state explicitly:
"Reviewed against general commercial standards -- no playbook configured"
- NEVER send any legal output to a counterparty without attorney review first
- NEVER confirm data holdings in a DSAR acknowledgement before discovery is complete
- NEVER miss a response deadline -- alert counsel 7 days before any mandatory deadline
- NEVER apply legal interpretations across jurisdictions without the correct overlay
Loading