Claude
Skills
Sign in
Back

self-improving-legal

Included with Lifetime
$97 forever

Captures clause risks, compliance gaps, precedent shifts, contract deviations, regulatory changes, and litigation exposure to enable continuous legal operations improvement. Use when: (1) An unfavorable clause is accepted or slips through review, (2) A compliance deadline is missed or approaching, (3) A new regulation impacts the organization, (4) A contract remains unsigned past SLA, (5) An IP infringement notice is received, (6) New case law changes interpretation in a relevant jurisdiction, (7) A data subject access request reveals process gaps.

Code Reviewscriptsassets

What this skill does


# Self-Improving Legal Skill

Log legal learnings, compliance findings, contract issues, and regulatory changes to markdown files for continuous improvement. Captures clause risks, compliance gaps, precedent shifts, contract deviations, regulatory changes, and litigation exposure. Important learnings get promoted to clause libraries, compliance checklists, regulatory trackers, contract playbooks, or risk registers.

## CRITICAL: Privilege & Confidentiality Protection

**NEVER log privileged attorney-client communications, specific case strategy, confidential settlement terms, or litigation work product in any learning or issue entry.** Always abstract findings to process-level lessons. Use generalized descriptions:

| Protected Information | Acceptable Abstraction |
|----------------------|----------------------|
| Attorney-client advice on specific matter | "Outside counsel recommended clause revision for indemnity cap" |
| Settlement amount or terms | "Settlement reached; update playbook to flag similar exposure earlier" |
| Litigation strategy details | "Discovery phase revealed need for better document retention process" |
| Privileged legal memoranda | "Internal review identified gap in force majeure clause coverage" |
| Specific opposing party positions | "Counterparty negotiation pattern: late-stage payment term changes" |
| Confidential deal terms | "Deal structure required non-standard IP assignment clause" |

When in doubt, omit the specific detail and log only the process improvement lesson. Privilege waiver through careless documentation is irreversible.

## First-Use Initialisation

Before logging anything, ensure the `.learnings/` directory and files exist in the project or workspace root. If any are missing, create them:

```bash
mkdir -p .learnings
[ -f .learnings/LEARNINGS.md ] || printf "# Legal Learnings\n\nClause risks, compliance gaps, precedent shifts, regulatory changes, and legal operations insights.\n\n**Categories**: clause_risk | compliance_gap | precedent_shift | contract_deviation | regulatory_change | litigation_exposure\n**Areas**: contracts | compliance | litigation | intellectual_property | privacy | regulatory | corporate_governance\n\n---\n" > .learnings/LEARNINGS.md
[ -f .learnings/LEGAL_ISSUES.md ] || printf "# Legal Issues Log\n\nContract disputes, compliance failures, regulatory impacts, and litigation matters.\n\n---\n" > .learnings/LEGAL_ISSUES.md
[ -f .learnings/FEATURE_REQUESTS.md ] || printf "# Legal Operations Feature Requests\n\nLegal technology, automation, and process improvement requests.\n\n---\n" > .learnings/FEATURE_REQUESTS.md
```

Never overwrite existing files. This is a no-op if `.learnings/` is already initialised.

Do not log privileged communications, specific case strategy, or confidential settlement terms. Abstract all entries to process-level lessons.

If you want automatic reminders, use the opt-in hook workflow described in [Hook Integration](#hook-integration).

## Quick Reference

| Situation | Action |
|-----------|--------|
| Unfavorable clause accepted in contract | Log to `.learnings/LEARNINGS.md` with category `clause_risk` |
| Compliance deadline missed or approaching | Log to `.learnings/LEGAL_ISSUES.md` with category `compliance_gap` |
| New regulation impacts the organization | Log to `.learnings/LEARNINGS.md` with category `regulatory_change` |
| Contract unsigned past SLA | Log to `.learnings/LEGAL_ISSUES.md` with category `contract_deviation` |
| IP infringement notice received | Log to `.learnings/LEGAL_ISSUES.md` with category `litigation_exposure` |
| New case law in relevant jurisdiction | Log to `.learnings/LEARNINGS.md` with category `precedent_shift` |
| Data subject access request reveals gaps | Log to `.learnings/LEARNINGS.md` with category `compliance_gap` |
| Vendor changed terms without flagging | Log to `.learnings/LEGAL_ISSUES.md` with category `contract_deviation` |
| Regulatory filing deadline within 30 days | Log to `.learnings/LEGAL_ISSUES.md` with priority `high` |
| Contract redline rejected 3+ times | Log to `.learnings/LEARNINGS.md` with category `clause_risk` |
| Similar to existing entry | Link with `**See Also**`, consider priority bump |
| Broadly applicable legal pattern | Promote to clause library, compliance checklist, or playbook |
| Proven compliance workflow | Promote to `AGENTS.md` (OpenClaw workspace) |
| Legal tool configuration | Promote to `TOOLS.md` (OpenClaw workspace) |
| Legal operations principles | Promote to `SOUL.md` (OpenClaw workspace) |

## OpenClaw Setup (Recommended)

OpenClaw is the primary platform for this skill. It uses workspace-based prompt injection with automatic skill loading.

### Installation

**Via ClawdHub (recommended):**
```bash
clawdhub install self-improving-legal
```

**Manual:**
```bash
git clone https://github.com/jose-compu/self-improving-legal.git ~/.openclaw/skills/self-improving-legal
```

### Workspace Structure

OpenClaw injects these files into every session:

```
~/.openclaw/workspace/
├── AGENTS.md          # Legal workflows, contract review delegation
├── SOUL.md            # Legal principles, privilege protection, confidentiality
├── TOOLS.md           # Legal tool capabilities, CLM configs, e-discovery
├── MEMORY.md          # Long-term memory (main session only)
├── memory/            # Daily memory files
│   └── YYYY-MM-DD.md
└── .learnings/        # This skill's log files
    ├── LEARNINGS.md
    ├── LEGAL_ISSUES.md
    └── FEATURE_REQUESTS.md
```

### Create Learning Files

```bash
mkdir -p ~/.openclaw/workspace/.learnings
```

Then create the log files (or copy from `assets/`):
- `LEARNINGS.md` — clause risks, compliance gaps, regulatory changes, precedent shifts
- `LEGAL_ISSUES.md` — contract disputes, compliance failures, litigation matters
- `FEATURE_REQUESTS.md` — legal technology and automation requests

### Promotion Targets

When legal learnings prove broadly applicable, promote them:

| Learning Type | Promote To | Example |
|---------------|------------|---------|
| Clause patterns | Clause library | "Always cap indemnity at 2x annual contract value" |
| Compliance requirements | Compliance checklist | "CCPA deletion must cover backup systems within 90 days" |
| Regulatory tracking | Regulatory tracker | "EU AI Act model documentation deadline Q1 2026" |
| Contract negotiation patterns | Contract playbook | "Vendor payment term changes require VP approval" |
| Risk patterns | Risk register | "Unlimited liability clauses in SaaS agreements" |
| Legal operations workflows | `AGENTS.md` | "Route IP matters to patent counsel within 48 hours" |

### Optional: Enable Hook

For automatic reminders at session start:

```bash
cp -r hooks/openclaw ~/.openclaw/hooks/self-improving-legal
openclaw hooks enable self-improving-legal
```

See `references/openclaw-integration.md` for complete details.

---

## Generic Setup (Other Agents)

For Claude Code, Codex, Copilot, or other agents, create `.learnings/` in the project or workspace root:

```bash
mkdir -p .learnings
```

Create the files inline using the headers shown above. Avoid reading templates from the current repo or workspace unless you explicitly trust that path.

### Add reference to agent files

Add to AGENTS.md, CLAUDE.md, or `.github/copilot-instructions.md`:

#### Legal Self-Improvement Workflow

When legal issues or findings occur:
1. Log to `.learnings/LEGAL_ISSUES.md`, `LEARNINGS.md`, or `FEATURE_REQUESTS.md`
2. **NEVER log privileged communications, case strategy, or settlement terms**
3. Review and promote broadly applicable findings to:
   - Clause libraries — reusable clause language and fallback positions
   - Compliance checklists — regulatory requirement tracking
   - Contract playbooks — negotiation patterns and escalation guides
   - Risk registers — recurring risk categories and mitigation plans

## Logging Format

### Learning Entry [LRN-YYYYMMDD-XXX]

Append to `.learnings/LEARNINGS.md`:

```markdown
## [LRN-YY

Related in Code Review