
Research
/Security News
737 Chrome VPN Extensions Linked to Brand Impersonation and Browser Traffic Redirection
The campaign amassed more than 75,000 installs by targeting Russian-speaking users seeking access to blocked services.
compare-cli
Advanced tools
Clause-aware drift detection between two contract versions. Pre-signature gate for legal teams and agent pipelines. Part of the contract-operations suite.
Clause-aware drift detection between two contract versions. Pre-signature gate for legal teams and agent pipelines. Single-file Node CLI, two runtime deps, deterministic by design, no LLM tier in v1.
compare negotiated.docx ready-to-sign.pdf
# exit 0 = safe to sign
# exit 2 = substantive drift, DO NOT sign without review
# exit 3 = cosmetic / typographic drift only (informational)
# exit 4 = clauses moved, content identical
Part of the contract-operations suite.
You negotiated a contract over several rounds with counterparty's counsel.
A few days later their paralegal sends you a ready-to-sign.pdf. Is the
PDF the same text you agreed to, or did something quietly shift between
"final version" and "version we put in the signing envelope"?
compare-cli answers that question with an exit code your CI can gate on:
$1,000 vs $1000, Oxford comma) drift.
Informational; the agreement didn't change.The CLI works on .docx, .pdf, .md, and plain text — including
cross-format comparisons (negotiated .docx vs ready-to-sign .pdf).
npm install -g compare-cli
Or run without installing:
npx -p compare-cli@latest -- compare --demo
(The package is compare-cli; the installed command is compare. The
-p … -- compare form tells npx which package to fetch and which bin
to run, since the two names differ.)
Requires Node ≥ 20. (Pinned by pdfjs-dist@^5.7.284, which we share with sign-cli.)
compare --demo
Runs against two bundled fixtures (a negotiated NDA and a candidate where the term silently shifted from "two (2) years" to "three (3) years") and exits 2. You see the headline contract — substantive drift detected, report written, exit code asserted — without authoring a file.
compare --demo --json
Same comparison, structured JSON output to stdout.
# You negotiated this:
cat > negotiated.md <<'EOF'
## 1. Purpose
This agreement governs information exchange between Acme and Globex.
## 2. Term
The term is two (2) years from the Effective Date.
## 3. Notices
All notices shall be delivered to the addresses on the cover page.
EOF
# They sent back this:
cat > ready-to-sign.md <<'EOF'
## 1. Purpose
This agreement governs information exchange between Acme and Globex.
## 2. Term
The term is three (3) years from the Effective Date.
## 3. Notices
All notices shall be delivered to the addresses on the cover page.
EOF
# Gate on it:
compare negotiated.md ready-to-sign.md
# → substantive drift, exit 2
echo "exit: $?"
# Or feed the base from nda-review-cli's negotiation.json:
compare --from-negotiation negotiation.json ready-to-sign.pdf
# Strict mode: treat typographic drift ($1,000 vs $1000) as substantive too
compare negotiated.md ready-to-sign.md --strict
In a CI pipeline:
compare negotiated.docx received/$(date +%F).pdf || {
status=$?
case $status in
0) echo "✓ safe to sign" ;;
2) echo "✗ substantive drift — do not sign" ;;
3) echo "⚠ cosmetic drift only — informational" ;;
4) echo "⚠ clauses moved but content identical" ;;
*) echo "✗ I/O or arg error" ;;
esac
exit $status
}
USAGE
compare BASE CANDIDATE [options]
compare --from-negotiation NEG.json CANDIDATE [options]
compare --demo [--json]
ARGS
BASE what was agreed (.docx | .pdf | .md | .txt | - for stdin)
CANDIDATE what is being put forward (same formats, or -)
OPTIONS
--from-negotiation PATH read base text from nda-review-cli's negotiation.json
--strict treat typographic drift as substantive (exit 2)
--strict-cosmetic treat cosmetic drift as substantive (exit 2)
--json emit structured JSON to stdout
--why print structured explanation to stderr
--silent, -q suppress stderr
--output, -o PATH write report to PATH instead of stdout
--completion bash|zsh emit shell completion script
--demo run a zero-file 30-second demo
--version, -V print version
--help, -h show this help
| Code | Meaning |
|---|---|
0 | No drift detected, safe to sign |
1 | I/O error — input not found, unreadable, malformed .docx/.pdf |
2 | Substantive drift (or --strict/--strict-cosmetic was set and tripped) |
3 | Cosmetic-only or typographic-only drift (informational) |
4 | Clause(s) moved but content identical |
Stable across minor versions. Documented in AGENTS.md and COMPARE_SCHEMA.md.
...$1,000 vs $1000,
5.0% vs 5%), Oxford comma flips, case-only differences
(Acme vs ACME)will not vs will, two years vs three years,
clauses added or removed)The exact rules — including what is deliberately not normalized away (singular/plural, tense, negation, list punctuation) — are locked in COMPARE_SCHEMA.md §5–§6.
--json output shapeStable across minor versions. Top-level keys: ok, exit_class,
exit_code, base, candidate, summary, differences, warnings.
See COMPARE_SCHEMA.md §10 for the full shape.
--why outputStructured key=value lines on stderr describing detection tiers,
alignment method, class counts, exit decision, and strict-mode state.
Same posture as draft-cli's --why.
--from-negotiationReads nda-review-cli's negotiation.json and extracts the latest
agreed text as BASE. compare-cli v1 supports both the minimum schema
(per-round agreed: true) and the de-facto current nda-review-cli
release (per-round clause_status with all values equal to "agreed").
See COMPARE_SCHEMA.md §9.
If no agreed round exists, the CLI exits 2 with a clear error.
Text extraction from .pdf is layout-lossy. When either side is a PDF,
the report surfaces a warning:
warning: candidate was extracted from PDF; layout-sensitive differences
may surface as false positives
If extraction returns zero characters (a scanned PDF without an OCR layer), compare-cli exits 1 with a clear message rather than silently reporting no drift.
negotiation.json hash-chained state file. --from-negotiation
reads its output..docx into the .pdf you put
in the signing envelope.MIT © DrBaher
FAQs
Clause-aware drift detection between two contract versions. Pre-signature gate for legal teams and agent pipelines. Part of the contract-ops suite.
The npm package compare-cli receives a total of 41 weekly downloads. As such, compare-cli popularity was classified as not popular.
We found that compare-cli demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
The campaign amassed more than 75,000 installs by targeting Russian-speaking users seeking access to blocked services.

Company News
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.