grandiceLegal contracts
00

ABSTRACT

Contract issue spotting—not autonomous legal judgment.

Grandice provides two constrained legal workflows: one reviews a commercial contract against a fixed clause taxonomy and bounded playbook; the other compares an original contract to a revised version and reports clause-level changes and supported risk deltas.

The implementation is deterministic. Contract text is never passed to an LLM, interpreted as instructions, used to construct tool calls, browsed, or persisted by the legal analysis module. Every cited clause and finding is tied to caller-supplied source metadata and cryptographic document and span digests.

Grandice Privacy Shield can tokenize sensitive values locally before transfer. The gateway applies an additional configured residual scan to raw legal JSON before schema validation. Results disclose assumptions, limitations, omitted counts, and an invariant professional-review requirement.

01

EXECUTIVE PERSPECTIVE

Make recurring review steps reproducible without obscuring ambiguity.

Commercial review often combines clause inventories, organization-specific checklists, version comparison, and escalation. Unstructured workflows make it difficult to reproduce why an issue was raised, distinguish a missing clause from failed extraction, or verify that evidence came from the correct contract version.

01

Inconsistent triage

Reviewers use different labels, thresholds, and checklists for similar language.

02

Detached evidence

Findings circulate without exact locations or reliable document-version bindings.

03

False certainty

Lexical similarity can be presented as legal equivalence when wording is ambiguous.

04

Confidential copies

Full-content logging can create a secondary repository for sensitive deal material.

Grandice addresses the repeatable issue-spotting layer. Source authenticity, legal interpretation, negotiation position, jurisdiction-specific analysis, approval, and downstream action remain with the adopting institution and qualified professionals.

02

SCOPE AND RESPONSIBILITY BOUNDARY

Strong controls without overstating what pattern-based review can establish.

Implemented

  • Typed commercial-contract inputs
  • Deterministic segmentation and taxonomy classification
  • Literal fixed rules and bounded caller playbooks
  • Original-to-revised clause comparison
  • Explicit ambiguous-match outcomes
  • Document, span, and excerpt SHA-256 bindings
  • Local Privacy Shield integration and gateway residual scan
  • Metadata-only domain audit records
  • Mandatory qualified legal review

Outside current authority

  • Legal advice, legal conclusions, or attorney replacement
  • Enforceability, validity, compliance, or legal-effect determinations
  • Source authenticity or signature verification
  • Comprehensive clause, risk, or sensitive-data detection
  • Case-law retrieval, browsing, filing, signing, or negotiation
  • Automatic approval, redlining, or downstream execution
03

DESIGN PRINCIPLES

Evidence first. Authority last.

01

Document-as-data isolation

Contract text has no control-plane authority. Prompt-like text, JSON, URLs, and fake tool calls remain inert characters.

02

Deterministic authoritative path

Fixed parser, taxonomy, rules, matching thresholds, and methodology versions drive every authoritative output.

03

Bound every dimension

Body, text, JSON, clauses, findings, playbooks, excerpts, candidates, changes, and processing deadlines all have limits.

04

Bind evidence to versions

Document and span digests prevent an evidence location from being silently reassigned to another version.

05

Disclose incompleteness

Caps and ambiguous matches change explicit completeness fields and warnings; they do not disappear silently.

06

Human review is invariant

Neither a contract nor a playbook can suppress warnings, alter severity logic, or remove the professional-review gate.

04

SYSTEM ARCHITECTURE

A bounded path from protected contract text to review evidence.

The strongest privacy mode protects content before it leaves the caller environment. The gateway then authenticates, enforces quotas and structural bounds, scans raw JSON, validates the legal schema, and dispatches only to predefined deterministic code.

CALLER TRUST BOUNDARY GRANDICE GATEWAY LEGAL DOMAIN RUNTIME Privacy SDK / sidecarLOCAL TOKEN MAP Typed legal requestDOCUMENT + SOURCES Auth + request bounds2 MiB · DEPTH · NODES Residual privacy scanBEFORE SCHEMA VALIDATION Segment + classify + hashNO MODEL OR NETWORK CALL Rules / playbook / compareBOUNDED DETERMINISTIC WORK Qualified legal review
Figure 1. Authoritative legal outputs are produced only by predefined deterministic functions. The model gateway remains available elsewhere in Grandice, but is not in this legal execution path.
05

MANAGED WORKFLOWS

Two named agents, each mapped to one typed function.

REVIEW

Contract Review Agent

legal.contract-reviewer.v1

Segments one document, classifies clauses, evaluates fixed risks and a bounded playbook, and returns source-bound evidence.

No legal conclusions, drafting, source verification, browsing, or execution.

COMPARE

Contract Comparison Agent

legal.contract-comparator.v1

Compares original to revised using typed category blocking, exact hashes, bounded token similarity, and risk-delta keys.

No claim of semantic equivalence or complete redline fidelity.

06

REVIEW METHODOLOGY

Clause inventory, fixed taxonomy, and explainable rule evidence.

06.1

Segmentation

Lines with bounded recognized headings, numbering, or capitalization start clauses. Each segment records document ID, source ID, Unicode code-point and line coordinates, excerpt, classification method, and document/span/excerpt digests.

06.2

Commercial taxonomy

Categories cover services, scope, service levels, fees, payment, taxes, term, termination, renewal, warranties, liability, indemnity, insurance, confidentiality, data protection, security, intellectual property, licensing, assignment, subcontracting, compliance, audit, records, governing law, disputes, force majeure, notices, change control, and standard boilerplate.

06.3

Fixed issue-spotting rules

Current rules identify supported language for potentially unlimited liability, broad indemnity, unilateral termination, automatic renewal, assignment imbalance, confidentiality and data-protection gaps, missing liability caps, required clauses, prohibited literals, governing-law preference mismatch, and declared review policies.

06.4

Evidence semantics

A match means a configured literal or absence rule fired. It does not mean the clause is unenforceable, unacceptable, illegal, one-sided in context, or complete. “Not detected” is not equivalent to “legally absent.”

07

PLAYBOOK CONTROL

Typed review policy—not executable policy.

A caller can send an immutable playbook inside a request. The schema accepts only bounded known fields. It does not accept regular expressions, prompts, templates, code, URLs, imports, tools, dynamic field paths, approval actions, or severity overrides for mandatory platform warnings.

Accepted controls

  • Required typed clause categories
  • Case-insensitive literal prohibited phrases
  • Preferred governing-law label
  • Liability-cap requirement
  • Bounded clause-scoped review policies

Rejected authority

  • Caller regular expressions
  • Document or playbook instructions
  • Network and retrieval configuration
  • Executable expressions or tools
  • Automatic approval or remediation
08

COMPARISON METHODOLOGY

Direction, bounded similarity, and explicit ambiguity.

The declared direction is always original_to_revised. Exact span hashes match first. Remaining candidates are blocked by clause category and position, with no more than sixteen revised candidates and 512 normalized tokens per original clause.

Original clausesMAX 250 Revised clausesMAX 250 Category blocking≤ 16 CANDIDATES Hash + token score≤ 512 TOKENS Exact / unchanged Modified / ambiguous Added / removed
Figure 2. Candidate blocking prevents unrestricted all-pairs comparison. Similarity is lexical evidence, not a semantic or legal-equivalence score.

Risk deltas identify supported findings that are new, resolved, or persistent. IDs use canonical rule and clause-category identity; prohibited literal rules additionally bind a phrase digest. Deltas remain limited to the implemented rules and supplied playbook.

09

PROVENANCE AND SPAN INTEGRITY

Every evidence location is bound to a document version.

Caller citations identify the asserted source; Grandice does not verify their authenticity. The legal runtime computes SHA-256 values for document text, exact source spans, and rendered excerpts. Coordinates use versioned zero-based, end-exclusive Unicode code points.

CALLER SOURCEsource_idcitationas_ofATTRIBUTED · NOT VERIFIED DOCUMENT VERSIONdocument_idsource_iddocument_sha256coordinate_unit EVIDENCE SPANchar_start / char_endline_start / line_endspan_sha256excerpt_sha256
Figure 3. Cryptographic binding detects evidence/version mix-ups. It does not authenticate who supplied the contract or prove the legal reliability of the source.
10

PRIVACY AND CONFIDENTIALITY

Protect locally, scan again, retain less.

Contracts routinely contain party names, contacts, addresses, signatures, pricing, trade secrets, and negotiation context. Local protection is the preferred path for confidential workloads because configured residual detection is defense in depth—not proof that a contract contains no sensitive information.

01 · LOCALSDK / sidecarTOKENIZE VALUESKEEP MAP LOCAL 02 · TRANSFERProtected JSONOPAQUE TOKENSTYPED CONTRACT 03 · GATEWAYResidual scanRAW JSON FIRSTREJECT DETECTIONS 04 · RUNTIMEIn-memory analysisNO CONTENT AUDITLOCAL REHYDRATION
Figure 4. A local token map enables protected transfer and caller-side rehydration. Direct hosted requests expose original content to gateway memory even when the legal module does not persist it.
PreferredClient SDK or loopback sidecar before transfer
Second layerlegal-strict-v1 raw-JSON residual scan
AuditOperational metadata; no document or response body
Claim boundaryConfigured detector coverage is best effort
11

AUDIT AND GOVERNANCE

Trace operations without building a contract-content archive.

Each terminal API outcome records request ID, time, authenticated key and available organization/member references, endpoint, agent, asserted privacy mode, status, duration, schema names, source/warning counts, and methodology version. Contract text, excerpts, citations, findings, token maps, and response bodies are excluded.

domain.runCONTENT RETAINED: FALSE
request_iddom_...agentlegal.contract-reviewer.v1 status200privacy_modesidecar input_schemaContractAnalysisInputoutput_schemaContractAnalysis methodologygrandice-legal-deterministic-1.0.0contentnot stored

Primary domain audit metadata is purged at gateway startup and by an hourly opportunistic cleanup after the configured period—90 days by default. Reverse-proxy logs, crash reporting, encrypted backups, and institutional observability have separate lifecycles and require deployment-specific review.

12

RUNTIME CONTROLS

Resource limits are part of the authority model.

API deadlines bound caller waiting time. The token and candidate caps remove the unbounded quadratic comparison path that a timeout alone cannot stop in a worker thread. Exact omitted counts and complete: false are returned when supported output caps are reached.

13

DEVELOPER INTEGRATION

Direct APIs or the common managed-agent envelope.

POST/v1/legal/contracts/review
POST/v1/legal/contracts/compare
GET/v1/agents
POST/v1/agents/runs
GET/v1/domain/runs/{request_id}
{
  "metadata": {
    "as_of": "2026-09-15",
    "sources": [{
      "source_id": "msa-source",
      "citation": "Caller contract repository record",
      "as_of": "2026-09-15"
    }]
  },
  "document": {
    "document_id": "msa-v7",
    "source_id": "msa-source",
    "document_type": "master_services_agreement",
    "text": "1. Services\n..."
  },
  "playbook": {
    "playbook_id": "commercial-standard",
    "version": "3",
    "required_clause_types": ["confidentiality", "data_protection"],
    "liability_cap_required": true
  }
}

For local tokenization, preserve one request-scoped token map for all documents in a comparison and rehydrate only returned display fields in the caller trust boundary. Never rehydrate into control fields such as agent IDs, playbook IDs, clause categories, status, or severity.

14

EVALUATION ROADMAP

Measure extraction, comparison, safety, and reviewer utility separately.

TRACK 01

Clause extraction

  • Heading and boundary precision/recall
  • Taxonomy accuracy by document type
  • Unicode and line-span reproduction
  • Unknown-category calibration
TRACK 02

Rule behavior

  • Attorney-reviewed golden contracts
  • False-positive/negative analysis per rule
  • Playbook conformance and literal safety
  • Stable finding IDs across runs
TRACK 03

Comparison

  • Known-edit and reversal fixtures
  • Duplicate heading ambiguity
  • Moves, rewrites, additions, removals
  • Cross-document digest isolation
TRACK 04

Operational safety

  • Maximum-size latency and concurrency
  • Prompt-injection inertness
  • Privacy detector stress tests
  • Audit and log content inspection
15

CURRENT LIMITATIONS

What a deterministic lexical system can miss.

Interpretive limits

  • Defined-term interactions across distant clauses
  • Exceptions, schedules, exhibits, and incorporated documents
  • Commercial context and negotiating leverage
  • Jurisdiction-specific enforceability and doctrine
  • Legal equivalence after substantial rewriting

Extraction limits

  • Scanned PDFs require upstream extraction
  • Tables and unusual formatting can reduce segmentation quality
  • Unsupported synonyms may classify as unknown
  • Only the first bounded outputs are returned
  • Caller sources are attributed, not authenticated

Privacy limits

  • Names and context-dependent secrets may evade pattern detectors
  • Direct hosted use exposes original content to process memory
  • Audit metadata and infrastructure backups have lifecycles
  • Local tokenization can change display coordinates after rehydration
  • Deployers must validate logging and observability configuration
16

CONCLUSION

Contract intelligence should make review evidence easier to inspect—not easier to overtrust.

Grandice combines deterministic clause processing, bounded comparison, literal-only playbooks, cryptographically bound evidence, Privacy Shield integration, metadata-only audit, and an explicit qualified-review boundary.

The result is a developer-controlled issue-spotting layer, not an autonomous legal actor. Production adoption still requires source controls, approved playbooks, tenant authorization, representative legal evaluation, privacy and security review, retention governance, and qualified professional supervision.

INERT DOCUMENTSBOUND EVIDENCEHUMAN LEGAL JUDGMENT
A

APPENDIX

Response invariants and implementation references

{
  "request_id": "dom_...",
  "privacy": {
    "mode": "sidecar",
    "residual_check": {
      "status": "passed",
      "coverage": "configured_policy_detectors",
      "guarantee": "best_effort"
    },
    "content_retained": false
  },
  "data": {
    "methodology_version": "grandice-legal-deterministic-1.0.0",
    "complete": true,
    "legal_advice": false,
    "content_persisted": false,
    "professional_review_required": true
  }
}
grandice_domain/legal.pyLegal schemas, taxonomy, segmentation, rules, evidence hashing, and comparison
grandice_domain/agents.pyVersioned legal workflow registry and declared capabilities
gateway/routes/legal.pyAuthenticated direct legal APIs, deadlines, audit, and response headers
gateway/domain_runtime.pyRaw-JSON limits, residual privacy enforcement, audit write, and envelope
LEGAL-APIS.mdInput contracts, limits, privacy guidance, and responsibility boundary
tests/test_legal_domain.pyCore behavior, evidence, ambiguity, delta, injection, and cap tests