feat(clauses): add Confidentiality clause type (PL)
Sprint 4 second concrete clause type — validates the add-clause workflow
from compass-clause-taxonomy fundament 7 by exercising every step on
Confidentiality after Liability shipped in Sprint 2.
Pydantic schema (compass_schemas.clauses.confidentiality):
- duration_years, mutual, exceptions (5 Literal values), survives_termination,
residuals_clause, preliminary_status, key_observations,
suggested_questions_for_counsel
- Two model_validators parallel to LiabilityClause:
enforce_counsel_disclaimer — auto-append the legal-tech sign-off line
flag_indefinite_duration — None duration_years + Approved -> downgrade
to Needs Attention with explanatory observation
Prompt (compass_prompts.clauses.confidentiality_extraction_v1):
- PROMPT_VERSION = "confidentiality_v1"
- 13 numbered rules covering schema fields, PL/EN terminology,
carve-out semantics, never-assert-enforceability discipline
- 4 few-shot examples: mutual 3yr full exceptions (Approved), indefinite
one-sided no exceptions (Needs Attention), PL § 9 5yr partial
exceptions (Needs Attention), clause absent
PL jurisdiction overlay (compass_jurisdictions.pl.confidentiality):
- MANDATORY_OBSERVATIONS reference UoZNK art. 11 (tajemnica
przedsiębiorstwa — statutory indefinite protection independent of
contract) and KC art. 484 § 2 ("rażąco wygórowana" reduction)
- PROMPT_HINTS adds PL vocabulary, market-norm reference (3-5 years),
antitrust angle on indefinite obligations
- post_extraction_check downgrades when: duration > 5 years (UoZNK
statutory already covers indefinitely), fewer than 3 of 4 core
exceptions present, residuals_clause set in a PL contract
Golden dataset (packages/evals/datasets/confidentiality_pl.jsonl):
- 4 synthetic examples on launch + TODO marker to expand to 20+
(user-side curation from anonymized PL contracts)
- Mix English / Polish text per PL real-world distribution
Eval test (packages/evals/tests/test_confidentiality_extraction.py):
- @pytest.mark.eval with the same thresholds as liability
(precision >= 0.85, recall >= 0.80, cost_per_doc <= $0.02)
- Live test skipped when ANTHROPIC_API_KEY absent
- Mock smoke test independent of --profile flag verifies runner pipeline
Registry + zod mirror:
- CLAUSE_REGISTRY in compass_agents.clause_extractor += confidentiality
- apps/web/src/components/contract-form/clauses/confidentiality.ts
is the manual zod mirror per fundament 2 sync rule
Tests: 17/17 llm-gateway + 9 evals green (2 live correctly skipped).
13-pkt compass-clause-taxonomy self-check:
- Schema fields typed (Literal enums, int, bool), two validators ✓
- Zod mirror created in same change ✓
- CLAUSE_TYPES enum already covers "confidentiality" (Sprint 2 migration) ✓
- Prompt versioned with PROMPT_VERSION constant ✓
- Few-shot count 4 covers standard / red flag / PL / absent ✓
- Disclaimer hardcoded in system prompt + auto-appended by validator ✓
- Golden dataset: 4 synthetic with explicit expand-to-20 TODO ✓
- Eval test with explicit thresholds + CI workflow trigger path ✓
- Prompt change CI hook (eval.yml watches packages/prompts/**) ✓
- PL jurisdiction post_extraction_check ✓
- Confidence threshold default (0.7/0.5) ✓
- legal-tech red flags reflected (indefinite, partial exceptions,
residuals in PL) ✓
- ADR-001 M2 schema-first + M4 eval-driven satisfied ✓
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>