| name | text-provenance |
| title | text-provenance |
| description | Use when you need to identify the likely source of a text passage, attribute text to documents in a RAG system, detect plagiarism, or match contract clauses to their origin. |
| author | LegalQuants |
| author_url | https://github.com/LegalQuants/lq-skills/tree/main/skills/text-provenance |
| license | Apache-2.0 |
| version | 0.1.0 |
| execution_mode | open |
| jurisdiction | general |
| practice | general |
| language | en |
| tags | ["text-analysis","rag","citation","provenance","similarity","attribution"] |
text-provenance
When to Use
- RAG citation highlighting — show which source document a generated text came from
- Contract playbook matching — find which standard clause a contract clause derives from
- Plagiarism detection
- Source attribution for AI-generated legal text
- Any text provenance task where you need to trace text back to its origin
How It Works
Core Approach
Lightweight text similarity metrics — no embeddings or API calls at runtime. Fast, deterministic string matching that works in-browser or server-side.
Comparison Methods
- Surface similarity — character-level comparison
- N-gram overlap — phrase-level matching
- Fingerprint matching — exact phrase detection
Usage
import { findProvenance } from 'text-provenance';
const sources = await findProvenance(
"the quick brown fox jumps over the lazy dog",
corpusDocuments
);
Edge Cases
Works where embeddings fail:
- Short text snippets
- Exact phrase matching
- High-precision attribution tasks
- Privacy-sensitive contexts (no data leaves the machine)
Audience and Work Shape
Audience: developers and lawyers building RAG-citation, contract-derivation, or plagiarism-detection workflows. The output is a candidate ranking, not a finding.
Work shape: Pattern-Matched Review. Lexical similarity is the matching function; the user decides what counts as a match.
Scope and Legal Use
This skill provides legal support, not legal advice. The output is a ranked list of candidate sources with similarity scores — never an attribution conclusion, never a plagiarism finding, never a contract-derivation determination of legal effect.
Privilege and confidentiality. Runs client-side with no network calls. No text leaves the user's machine unless the calling application chooses to transmit it. Skill itself does not create new privilege exposure.
Accountability. A qualified lawyer must review and accept any output before relying on it for an attribution, plagiarism, or contract-derivation decision. The similarity score is a signal, not a verdict.