Skip to content

Contract review

The failure this prevents: a reviewer asks “can they subcontract without consent?”, the model produces a fluent paragraph, and no clause in the agreement actually says it. The answer looks identical to a correct one.

  1. Ingest the agreement set. PDFs keep their page number, so every later citation lands on a page a human can open and check.

    for path in ["msa.pdf", "sow-2026.pdf", "dpa.pdf"]:
    rag.ingest(path)
  2. Ask in the reviewer’s own words.

    response = rag.ask("May the supplier subcontract without our written consent?")
  3. Read the decision before the prose. The answer text is the last thing you should trust; the decision and the citation are the first.

    from citenexus.answer.result import Decision
    if response.evidence.decision is Decision.answered:
    src = response.sources[0]
    print(response.answer) # verbatim from the contract
    print(src.document, "p.", src.page)
    else:
    print("no clause supports this:", response.answer)
The Supplier shall not subcontract any part of the Services without the prior
written consent of the Customer.
msa.pdf p. 14

The quoted sentence in every tab above is verbatim from the source, not a paraphrase. That is deliberate: a paraphrased quote is no longer evidence, and a reviewer who cannot diff the quote against the page cannot defend the answer.

The signal names are the same in all three — EvidenceSignals is one of the conformance-pinned shapes, so a reviewer reads the same four fields whichever port produced the Result.

sig = response.evidence
sig.decision # answered | refused | partial
sig.distinct_documents # how many DIFFERENT documents support this
sig.unsupported_claims_removed # sentences dropped for lacking support
sig.all_claims_verified # False means the answer was trimmed

unsupported_claims_removed is the one reviewers care about most. An answer is verified per atomic claim: if the model produces two sentences and only one is supported by the cited clause, you get the supported sentence and a count of what was dropped — not a fluent paragraph that is 50% invented.

Isolation between matters comes from the partition, and from nothing else. A CiteNexus instance is bound to one PartitionPath at construction; its vector index, manifests and evidence all live under that leaf, so a question asked on one matter’s client cannot reach another matter’s paper.

from citenexus import CiteNexus
from citenexus.domain.partition import PartitionPath
matter = CiteNexus(
"s3://firm-corpus",
partition=PartitionPath.of(("matter", "4471")),
signals=["embedding", "text"],
)
matter.ingest("msa.pdf")

One client per matter. Route the request to the instance whose partition the caller is entitled to, and the entitlement check stays in your application — where it can see your identity system.

See Access & partitions for the full contract, including what the library deliberately does not enforce for you.

A clause quoted verbatim from a superseded draft, or from the counterparty’s template instead of the executed MSA, passes the gate — the words really are there. Rank the versions at ingest and let strict mode refuse below the floor: see Authority — grounding is not standing.

  • A clause split across a page break. Chunking respects structure, but a clause whose operative sentence straddles pages can be cited to the page holding the sentence, not the clause heading. Check src.page against the clause number in the quote.
  • Definitions. “Services” may be defined 40 pages earlier. The answer cites where the obligation is stated, not where its terms are defined — ask the definition as its own question.