# drbaher CLI suite > Nine composable, local-first, agent-first CLIs for end-to-end contract operations. The agent does the operational work (ingesting foreign paper into structured data, storing and versioning templates, drafting, reviewing, linting for internal defects, comparing for drift, sending, verifying, and tracking renewals/obligations on signed contracts); the human approves the gestures that need a deliberate human action (signing, accepting a final position, escalating non-negotiables). Site: https://cli.drbaher.com/ ## The nine CLIs 1. **extract-cli** — Open-loop front door of the suite: ingest any contract (`.md`/`.txt`/`.html`/`.docx`/`.pdf`, yours or a counterparty's foreign paper) into structured JSON — parties, dates, term, governing law, a clause map normalized onto the suite's canonical clause vocabulary, defined terms, a headline value. Every field carries a `confidence` and a `source` (verify, don't trust). The deterministic tier is always on (no network); the opt-in `--llm` tier adds fuzzy fields and a clause-map fallback. Stdlib-only Python (zero runtime deps; `[docx]`/`[pdf]` extras improve fidelity). - GitHub: https://github.com/DrBaher/extract-cli - PyPI: https://pypi.org/project/extract-cli/ - Install: `pipx install extract-cli` - Agent discovery: `extract --catalog json` (uniform suite manifest), `extract schema` (the output JSON Schema, committed under `docs/spec/`; semver-stable), `extract fields --json` - Interop contract: https://github.com/DrBaher/extract-cli/blob/main/docs/INTEROP.md (shared canonical clause vocabulary + output schema; shared LLM config at `~/.config/contract-ops/llm.json`) - Agent contract: https://github.com/DrBaher/extract-cli/blob/main/AGENTS.md 2. **template-vault-cli** — Agent-first, Git-backed, clause-aware package manager for legal-document templates. Stores public sources (Common Paper, YC SAFE, Bonterms) and your own house templates in one searchable, composable, version-tracked vault. Clauses are first-class objects with provenance: fork a template, swap a clause in from another, and pull upstream parent improvements into your fork — `meta.json` records which clause came from where, so the merge is deterministic. It structures existing templates; it does not generate clause text. Stdlib-only Python (`[docx]` extra adds `python-docx`). - GitHub: https://github.com/DrBaher/template-vault-cli - PyPI: https://pypi.org/project/template-vault-cli/ - Install: `pipx install template-vault-cli` - Agent discovery: `template-vault --catalog json` (uniform suite manifest), plus `template-vault info --json` + `template-vault find --json` (validated against JSON Schemas under `docs/spec/`; semver-stable). `template-vault get --path-only` resolves a versioned template path to hand to draft-cli. - Interop contract: https://github.com/DrBaher/template-vault-cli/blob/main/docs/INTEROP.md (shared suite LLM config at `~/.config/contract-ops/llm.json`; consumed-output schemas under `docs/spec/`) - Privacy: `ask` sends template metadata only by default; `--with-content` adds excerpts and requires explicit consent (or `--yes-send` in CI). - Safety (v0.5.1+): vault references are path-contained (no `../` escape via `category`/`name`/`compose --as`/sources registry); `import` + LLM `base_url` accept only `http`/`https` (no `file://`, no cleartext key to a remote host); new vault dirs/files are owner-only (`0700`/`0600`). Releases ship PEP 740 build attestations. 3. **draft-cli** — Agent-first placeholder-filler for legal-document templates. Five-tier detection cascade (bracket / mustache / `.docx` highlight / heuristic / opt-in LLM). `.docx` round-trip preserves runs and styling, with smart cross-run merging by default and `--strict-runs` as the opt-out. Typed parameters (date / money / party with format + currency), computed placeholders (date arithmetic), positional addressing, `parties.json` registry, multi-document bundles, `--from-deal` LLM inference from prose. Single-file ESM, one runtime dep (`jszip`). - GitHub: https://github.com/DrBaher/draft-cli - npm: https://www.npmjs.com/package/@drbaher/draft-cli - Install: `npm i -g @drbaher/draft-cli` - Agent discovery: `draft --catalog json` (uniform suite manifest), `draft --list-placeholders --json` (per-template structured manifest with keys, aliases, types, defaults), `draft --validate` (precheck) - Agent contract: https://github.com/DrBaher/draft-cli/blob/main/AGENTS.md - Schema contract: https://github.com/DrBaher/draft-cli/blob/main/PARAM_SCHEMA.md (locked; stable across minor versions) 4. **nda-review-cli** — Agent-first NDA review, drafting, and two-party negotiation. Deterministic rules by default; opt-in LLM adjudication via Anthropic / OpenAI / Ollama / any OpenAI-compatible endpoint. Hash-chained negotiation state. Local-first, stdlib Python. - GitHub: https://github.com/DrBaher/nda-review-cli - PyPI: https://pypi.org/project/nda-review-cli/ - Install: `pipx install nda-review-cli` - Agent discovery: `nda-review-cli --catalog json` (24 commands, including 12 nested `negotiate` subcommands; `exitCodes` map advertised) - Structured output: `review --json` emits a machine verdict on stdout (add `--why` for per-finding evidence); bad/missing `--playbook` returns a clean structured error (exit 4), not a traceback - Agent contract: https://github.com/DrBaher/nda-review-cli/blob/main/AGENTS.md 5. **contract-lint-cli** — A deterministic linter for a contract's INTERNAL consistency: leftover placeholders, broken cross-references (a Section/Exhibit/Schedule reference with no target), undefined/unused/duplicate defined terms, heading-number gaps, inconsistent party spellings, and impossible dates. Each defect is a finding `{rule, severity, message, line, excerpt}`, and it exits non-zero so CI or an agent can gate on it. Eleven rules (placeholder + broken-xref are errors; undefined-term and signature-block ship off by default). Output: human table, `--json` (locked, timestamp-free → diff-stable), or `--sarif` (2.1.0). `--fail-on error|warning|none`, `--check` (exit-code-only), `--enable`/`--disable` a rule, `--config`. Lints `.md`/`.txt`/`.html`/`.docx`/`.pdf` and stdin (`-`, with `--format md`). Local-first, stdlib-only Python, zero deps, no model, no network. Works standalone; also composes with the contract-ops suite as the pre-signature quality gate — where compare-cli gates *drift between versions*, contract-lint gates *defects within one document*. - GitHub: https://github.com/DrBaher/contract-lint-cli - PyPI: https://pypi.org/project/contract-lint/ (package `contract-lint`, bin `contract-lint`) - Install: `pipx install contract-lint` - Agent discovery: `contract-lint --catalog json` (commands: lint, rules, demo, completion) + `contract-lint rules --json` (the rule catalog: id, severity, default state) - Agent contract: https://github.com/DrBaher/contract-lint-cli/blob/main/AGENTS.md 6. **compare-cli** — Agent-first, clause-aware drift detection between two contract versions. Single-file Node CLI, deterministic by design, no LLM tier in v1. Four-tier clause-detection cascade (H2 / bold-prefix / ALL-CAPS / synthetic). Five-class spectrum (clean / cosmetic / typographic / substantive / moved). `--from-negotiation` reads nda-review-cli's `negotiation.json` with a three-tier resolution (status: converged → per-round agreed → clause_status all "agreed"). `--require-signoffs` double-locks the gate. Output modes: human (with inline word-diff for substantive changes), `--json` (locked across v1.x), `--sarif` (SARIF v2.1.0 for code-scanning). `--check` for exit-code-only CI gates. Track-changes metadata from `.docx` surfaces alongside the diff. Two runtime deps (`jszip` + `pdfjs-dist`). - GitHub: https://github.com/DrBaher/compare-cli - npm: https://www.npmjs.com/package/compare-cli (unscoped) - Install: `npm i -g compare-cli` - Demo: `compare --demo` (exit 2 — fixture is deliberate substantive drift) - Exit codes: `0` clauses match (safe to sign), `2` substantive drift (do not sign without review), `3` cosmetic/typographic-only drift, `4` clauses moved but content identical. - Agent discovery: `compare --catalog json` (uniform suite manifest), structured `compare --json` - MCP server: separate package `compare-cli-mcp` (npm i -g compare-cli-mcp). Three tools: `compare_files`, `compare_with_negotiation`, `compare_demo`. Stdio transport. `COMPARE_MCP_BASE_DIR` env var for path lockdown. - Agent contract: https://github.com/DrBaher/compare-cli/blob/main/AGENTS.md - Schema contract: https://github.com/DrBaher/compare-cli/blob/main/COMPARE_SCHEMA.md (locked; stable across v1.x) - MCP design: https://github.com/DrBaher/compare-cli/blob/main/docs/mcp.md 7. **docx2pdf-cli** — Agent-first DOCX → PDF converter. Six hybrid backends (LibreOffice, Gotenberg, ConvertAPI, Apple Pages, Microsoft Word, textutil-cups). Strict-fidelity guard, machine-readable `--capabilities` + `--doctor` JSON (both schema-validated). NDJSON batch mode. - GitHub: https://github.com/DrBaher/docx2pdf-cli - npm: https://www.npmjs.com/package/docx2pdf-cli - Install: `npm i -g docx2pdf-cli` - Agent discovery: `docx2pdf --capabilities` (machine-readable feature contract), `docx2pdf --doctor` (host-readiness JSON), `docx2pdf --catalog json` (flag inventory) - Agent contract: https://github.com/DrBaher/docx2pdf-cli/blob/main/AGENTS.md 8. **sign-cli** — Agent-first e-signature CLI. Built-in fully-offline PAdES signer (PKCS#7 in `/ByteRange`, self-issued cert) produces real cryptographically verifiable signed PDFs with no signup. Or routes through Dropbox Sign / DocuSign / SignWell. 19-tool MCP server over stdio. 20-route HTTP API at `/v1/*`. Hash-chained audit log with append-only DB triggers. RFC 3161 timestamp anchoring. Per-signer approval tokens (TTL-bounded, single-use, scoped to one email). Opt-in consent & attribution gates (since 0.9.0): `request create --require-consent true` gates signing on a recorded intent-to-sign attestation + electronic-records (ESIGN) disclosure (canonical texts via `sign consent show`; signer accepts with `approve --agree true --accept-disclosure true`); `--require-email-verification true` gates it on a 6-digit mailbox-control proof (`signer send-verification` / `signer verify-email`, codes hashed at rest, 5-attempt lockout); `signer record-identity --identity-assurance method:…` records an out-of-band identity check (the assertion, never ID documents). Both gates are enforced in the shared signing service — CLI, MCP `sign` tool, and `POST /v1/sign` all return `CONSENT_REQUIRED` / `EMAIL_VERIFICATION_REQUIRED` until satisfied — and `--auto-approve` is rejected in combination with either. ESIGN/UETA evidence posture only; the local provider remains an eIDAS Simple Electronic Signature. - GitHub: https://github.com/DrBaher/sign-cli - npm: https://www.npmjs.com/package/@drbaher/sign-cli (scoped — the unscoped `sign-cli` belongs to an unrelated project) - Install: `npm i -g @drbaher/sign-cli` - One-shot demo (no install, no signup, 5 seconds): `npx @drbaher/sign-cli demo` - Agent discovery: `sign --catalog json`, `sign mcp tools` - MCP server: `sign mcp serve` (stdio, 19 tools, capability scoping via `--read-only`, `--tool`, `--capability`) - HTTP API: `sign serve --port 4000` (20 routes under `/v1/*`, schema at `/v1/openapi.json`) - Agent contract: https://github.com/DrBaher/sign-cli/blob/main/AGENTS.md 9. **contract-vault-cli** — A git-backed register for SIGNED contracts: register an executed deal, then surface renewals, auto-renewal notice deadlines, expirations, payment dates, and **recurring obligations** — as a queryable portfolio, an RFC 5545 `.ics` calendar, and a **reminder digest** for cron/agents. Obligation lifecycle: `obligation ` marks done/waived, assigns `--owner`, sets `--reminders`, or makes it recur (weekly/monthly/quarterly/semiannual); `due`/`obligations` are status-aware (only open by default). `remind` is the open-reminder-window digest; `config reminders` sets corpus-wide lead-times. Human-review/`accept` promotes fields to `source: manual`; `risk --strict` is a CI gate for missed renewal notices. Stdlib-only Python, zero runtime deps. Works standalone; also composes with the contract-ops suite (ingests extract-cli output) — the post-signature sibling of template-vault (template-vault stores blank templates, contract-vault stores signed instances). - GitHub: https://github.com/DrBaher/contract-vault-cli - PyPI: https://pypi.org/project/contract-vault/ (package `contract-vault`, bin `contract-vault`) - Install: `pipx install contract-vault` (`[docx]` extra pulls in extract-cli for end-to-end ingest) - Agent discovery: `contract-vault --catalog json` (21 commands incl. obligation, remind, config, and the get/show, find/search, due/obligations, risk/at-risk aliases) - Agent contract: https://github.com/DrBaher/contract-vault-cli/blob/main/AGENTS.md ## The architectural claim The asymmetry is the architecture: an agent can drive every step except the actual signing gesture, which stays gated behind a human. The mechanism is the per-signer approval token — TTL-bounded, scoped to a single signer's email, single-use. The requester (which can be the agent) holds and DMs the token to the human signer; the signer pastes it into `sign sign --token ...`. The agent never sees signer tokens. Pre-sign safety checks (`--require-hash`, `--require-title`, `--require-signer-email`) throw structured errors before any state mutation. The consent & attribution gates (sign-cli ≥ 0.9.0) deepen the asymmetry: on a request created with `--require-consent` / `--require-email-verification`, even a valid signer token won't sign until the human has attested intent, accepted the electronic-records disclosure, and/or proven mailbox control — the shared signing service returns `CONSENT_REQUIRED` / `EMAIL_VERIFICATION_REQUIRED` across CLI, MCP, and HTTP alike. This means an LLM agent can do all the operational work (sending documents, tracking status, verifying receipts, reporting back, even drafting and negotiating amendments) without the legal liability of a hallucinating model accidentally executing a contract. ## Cross-suite agent contract All nine CLIs share the same output shape; exit-code meanings vary by CLI (see below): - **Output**: success JSON to stdout, exit `0`. On failure, `{ ok: false, error: ... }` with a non-zero exit — but the error *shape* is NOT uniform (e.g. sign-cli emits a nested `error` object; docx2pdf-cli emits a flat `error` string). Branch on the exit code and confirm shape via `--catalog json`; don't assume a shared error object. - **Exit codes (NOT uniform — don't assume a shared meaning)**: most of the suite uses `0` success / `2` invalid input / `3` policy/chain/verification failed / `4` not found (nda-review-cli, sign-cli, docx2pdf-cli). Six need special-casing: **template-vault-cli** = `0` success / `1` a check reported problems / `2` invalid usage or error; **compare-cli** reuses `0`–`4` as drift classes — `0` clean, `2` substantive drift, `3` cosmetic/typographic, `4` clauses moved, `1` I/O error; **draft-cli** has its own `0`–`4` — `0` ok, `1` I/O error, `2` validation, `3` template-vault failure, `4` LLM failure; **extract-cli** = `0` success / `1` low-signal document (a finding — valid JSON still emitted; e.g. scanned/empty) / `2` bad usage; **contract-vault-cli** = `0` success / `1` failure or findings (integrity check failed, or a `--strict` review/risk gate tripped) / `2` bad usage; **contract-lint-cli** = `0` clean (no findings at/above `--fail-on`, default `error`) / `1` findings at/above the threshold (the gate tripped) / `2` bad usage or unreadable input. Read the `exitCodes` map from `--catalog json` and confirm against each CLI's AGENTS.md. - **Discovery**: **all nine answer ` --catalog json`** — one uniform shape `{ name, bin, version, description, commands|flags, exitCodes }` — call it at startup instead of hardcoding tool/flag names. Tool-specific extras: extract-cli `schema` (output JSON Schema) + `fields --json`; template-vault-cli `info --json` + `find --json` (schemas under `docs/spec/`); draft-cli `--list-placeholders --json` (per-template manifest); docx2pdf-cli `--capabilities` + `--doctor` (schema-validated host readiness); sign-cli `sign mcp tools` (live MCP tool catalog); compare-cli `--json` for the structured drift verdict; contract-vault-cli `due/obligations --format ics|json` (status-aware) + `export --format csv|md|json` + `remind` (open-reminder digest) + `config reminders` (corpus-wide lead-times); contract-lint-cli `rules --json` (the rule catalog: id, severity, default) + `--json`/`--sarif` output + `--check`/`--fail-on` for exit-code-only CI gating. - **Never hardcode tool counts, flag lists, or sub-command names** — call `--catalog json` at startup. ## Repository shape (consistent across all nine) ``` README.md # lede + "Run this" + decision tree AGENTS.md # agent quickstart: output contract / exit codes / discovery / failure→recovery CHANGELOG.md docs/ ├── setup/ # per-provider/per-backend setup ├── reference/ # one canonical file per concept (audit-chain, exit-codes, policy, …) └── recipes/ # task-oriented recipes (sign-cli only) schemas/ # JSON schemas for machine-readable outputs ``` ## MCP wire-up The suite ships three MCP servers. **`contract-ops-mcp`** (npm `contract-ops-mcp`, repo `DrBaher/contract-ops-mcp`) is the one to start with: a single stdio server that exposes ALL nine CLIs as tools — curated, typed tools for the common ops (`extract_contract`, `lint_contract`, `compare_versions`, `fill_template`, `convert_to_pdf`, `review_nda`, `template_vault_*`, `contract_vault_*`, read-only `verify_signature`/`verify_receipt`/`audit_show`) plus `catalog(cli)` / `run(cli, args)` / `suite_status` escape hatches. Discovery-driven off each CLI's `--catalog json`. Signing is human-gated (read/verify only — request/sign stays behind sign-cli's own MCP). File access confined to `CONTRACT_OPS_MCP_BASE_DIR`. Wire-up: `{ "mcpServers": { "contract-ops": { "command": "npx", "args": ["-y", "contract-ops-mcp"] } } }`. Needs the CLIs installed (`curl -fsSL https://cli.drbaher.com/install.sh | sh`, or the `ghcr.io/drbaher/contract-ops` image). The other two are specialized: **sign-cli**'s 19-tool MCP (the signing surface, below) and **compare-cli-mcp** (3 drift-gate tools). Claude Code / Claude Desktop `~/.config/claude-code/settings.json` or `claude_desktop_config.json` (sign-cli's signing-specific server): ```json { "mcpServers": { "sign-cli": { "command": "npx", "args": ["-y", "@drbaher/sign-cli", "mcp", "serve"] } } } ``` Cursor `~/.cursor/mcp.json`: ```json { "mcpServers": { "sign-cli": { "command": "npx", "args": ["-y", "@drbaher/sign-cli", "mcp", "serve"], "env": {} } } } ``` Sandboxed (read-only mode, narrowed tool set): ```bash sign mcp serve --read-only true \ --tool request_show --tool audit_verify --tool pdf_detect_signature_field ``` ## The ready-made agent (contract-ops-agent) Don't want to wire up a client? **contract-ops-agent** (npm `contract-ops-agent`, repo `DrBaher/contract-ops-agent`, image `ghcr.io/drbaher/contract-ops-agent`) is a terminal agent whose ONLY tools are the suite via contract-ops-mcp — no shell, no filesystem, no web, no signing, by construction (a startup assertion refuses to run the session if anything else is mounted; consequential tools pass a human gate). Bring any model: Claude (API key or Claude Code login), OpenAI, presets for Gemini/Grok/DeepSeek/OpenRouter/Ollama, or any OpenAI-compatible endpoint; `fallbacks` chains fail over mid-conversation. Signing is opt-in twice (`signing.mode` in config + `--enable-signing`): `prepare` mounts sign-cli read-only, `full` adds the signing act behind a typed-consent gate (interactive terminal only). Subcommands: `setup`, `doctor`, `tool` (model-free single tool call), `usage`, `--resume`. Caveat: ~50 tools are exposed — small local models (7B–14B) fail to pick from that many; use frontier cloud models or 32B+ local. Guide: https://cli.drbaher.com/agent/ ## Key URLs for agents - Suite home: https://cli.drbaher.com/ - The ready-made agent (enclosure REPL, any model): https://cli.drbaher.com/agent/ - 5-minute tour: https://cli.drbaher.com/tour/ - Playground (run all nine in-browser): https://cli.drbaher.com/play/ - Workflow walkthrough: https://cli.drbaher.com/workflow/ - MCP integration guide: https://cli.drbaher.com/mcp/ - Built for agents (Claude, Cursor, Codex, OpenClaw, langchain): https://cli.drbaher.com/built-for-agents/ - Comparison vs SaaS suites: https://cli.drbaher.com/compare/ - Changelog: https://cli.drbaher.com/changelog/ - Principles: https://cli.drbaher.com/principles/ - Playground source: https://github.com/DrBaher/contract-ops-playground ## License All nine CLIs are MIT-licensed. The showcase site itself is also open source.