agentleFS
LegalQuantsLegalQuants/lq-skills/skills/text-provenance/SKILL.md

text-provenance

Skill63 starsChanged 6 months agoApache-2.0View on GitHub

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.

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 7 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Not a plagiarism adjudication or finding of academic/professional misconduct.

    line 77
  2. Distinctive:

    Not legal advice on copyright, IP, or contract-derivation claims.

    line 78
  3. Distinctive:

    Not evidentiary; results are not formatted for proceedings.

    line 79
  4. Distinctive:

    Not a semantic search — lexically different paraphrases will be missed.

    line 80
  5. Distinctive:

    Not a substitute for embedding-based retrieval where semantic match is required.

    line 81
  6. Distinctive:

    Stop and route to the responsible lawyer when:

    line 85
  7. Distinctive:

    Not a substitute for embedding-based retrieval in all contexts

    line 94

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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
);
// Returns ranked list of potential sources with confidence scores

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.

Confidence Bands

Map the raw similarity score to action bands:

  • High (≥ 0.85) — strong lexical match; lawyer can rely on this as a likely source but must still verify the underlying passage.
  • Medium (0.55 – 0.85) — possible match; route to human comparison before relying.
  • Low (< 0.55) — weak signal; do not treat as a source attribution. Show alongside other candidates but do not single out.

Out of Scope

  • Not a plagiarism adjudication or finding of academic/professional misconduct.
  • Not legal advice on copyright, IP, or contract-derivation claims.
  • Not evidentiary; results are not formatted for proceedings.
  • Not a semantic search — lexically different paraphrases will be missed.
  • Not a substitute for embedding-based retrieval where semantic match is required.

Escalation

Stop and route to the responsible lawyer when:

  • the top result is in the Low band but the calling workflow expects a definitive source;
  • the use case is disciplinary, evidentiary, or potentially defamatory (e.g., flagging a lawyer or student for plagiarism);
  • two or more candidates score within 0.05 of each other and the workflow requires a single source attribution.

Limitations

  • Cannot handle semantically similar but lexically different text
  • Works best with longer source documents
  • Not a substitute for embedding-based retrieval in all contexts

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.