Skip to main content

Post-signature management layer of the contract-ops CLI suite: register, search and surface deadlines for SIGNED contracts.

Project description

contract-vault

The post-signature management layer of the contract-ops CLI suite.

extract → draft → review → compare → convert → sign → **contract-vault**
   (entry)            (core authoring / negotiation)        (manage-out)

template-vault stores blanks (clauses, variables, composition). contract-vault is its post-signature sibling: it stores signed instances — the parties, dates, money, and obligations of executed deals — in the same git-backed, single-file, subcommand-rich shape. It is where executed contracts are registered, searched, and where renewal / notice / payment deadlines are surfaced as a calendar.

obligations is a view over the register, not a separate tool.

  • Stdlib only. Zero runtime dependencies; fully functional with no extras.
  • Git-backed, single file. No DB, no daemon. The vault is a plain git repo.
  • Deterministic. The register, .ics calendar, and reminders work fully with the LLM off. Any LLM need is delegated to the extract step you call — never reimplemented here, never on a hot path.
  • Verify, not trust. Every field carries its source (deterministic | llm | manual | none) and a confidence, propagated from extract and surfaced everywhere.

Run this

pipx run contract-vault demo     # zero-config: register two sample contracts → renewals calendar
# or, installed:  pip install contract-vault && contract-vault demo

That runs the full ingest → find → due flow on bundled fixtures (no extract-cli, no LLM, no network) and prints a renewals/notice calendar. Point it at your own signed contract with extract contract.pdf | contract-vault ingest -.

Where to go next


Install

pip install contract-vault            # zero dependencies, fully functional

Extraction itself is delegated to extract-cli. contract-vault works without it (piped JSON / .json input), but for one-shot ingestion of real documents install it with the backends you need:

pip install extract-cli               # text / markdown
pip install "extract-cli[docx]"       # + Word
pip install "extract-cli[pdf]"        # + PDF
# convenience extras that pull extract-cli in via contract-vault:
pip install "contract-vault[pdf]"

Requires Python 3.9+.


Quick start

contract-vault init ~/contracts            # create a git-backed vault
contract-vault demo                        # full ingest→find→due flow on bundled fixtures

# Ingest an executed contract (shells out to `extract` if it is on PATH):
contract-vault ingest ~/Downloads/acme-msa.pdf --vault ~/contracts

# ...or compose with extract explicitly (works even if extract is elsewhere):
extract ~/Downloads/acme-msa.pdf --json | contract-vault ingest - --vault ~/contracts

contract-vault list --vault ~/contracts
contract-vault find --auto-renew --value-gt 100000 --vault ~/contracts
contract-vault due --within 90d --format ics --vault ~/contracts > renewals.ics

The --vault flag is optional: contract-vault discovers the vault by walking up from the current directory (like git), or reads $CONTRACT_VAULT_DIR.


The vault model

A vault is a git repository laid out exactly like template-vault, one directory per deal:

~/contracts/
├── .contract-vault.json                       # vault config (kind, schema_version)
├── acme-corporation/
│   └── master-services-agreement/
│       ├── record.json                         # the structured deal record
│       └── source.pdf                          # the executed document (when vaulted)
└── initech-inc/
    └── mutual-non-disclosure-agreement/
        └── record.json

Each record.json conforms to docs/spec/contract-record.schema.json and carries: parties[], effective_date, expiration_date, term{length, auto_renew, notice_period_days, renewal_window}, governing_law, value, status, signed_on, source{path, sha256, format, vaulted}, obligations[]{type, due, description, source, confidence}, provenance{from_extract, extractor_version, ...}, and a field_meta map recording the source + confidence of every field. Re-ingesting the same document (same sha256) is idempotent.


Commands

Command What it does
init [path] Create / initialize an executed-contract vault (a git repo).
ingest <file> Run extract <file> --json (if on PATH) and store + commit the record.
ingest - Read piped extract JSON from stdin (extract f --json | contract-vault ingest -).
list List stored deals.
get <id> / show <id> Print one record (by path, leaf name, or unique prefix).
find / search Query by --counterparty, --governing-law, --currency CCC, --expiring-before DATE, --value-gt N, --auto-renew, or full-text. Pair --currency with --value-gt for currency-aware thresholds.
due / obligations Project upcoming actions. --within 30d|60d|90d, --format ics|json|table. Emits valid RFC 5545 .ics.
stats Portfolio stats: count, total value, expiring soon, by counterparty / governing law.
export Export the register as csv / md / json (--expiring-before, --needs-review). For spreadsheets & reports.
verify Integrity check: source sha256 matches + git tree clean.
review Deterministic worklist of fields that are unidentified / LLM-derived / low-confidence (--threshold; --strict exits 1 for CI). Never calls an LLM.
accept <deal> <field> Mark a reviewed field as human-verified (source=manual), optionally --value to correct it; recomputes the calendar for date/term changes. Bulk via accept --from FILE.
risk / at-risk Renewal exposure: missed notice deadlines (CRITICAL if auto-renewing), imminent notices, and expirations (--within, --strict).
history <deal> The deal's git history (ingest + each accept).
demo Run the full flow on bundled fixtures (no extract-cli, no LLM).

Global I/O conventions (shared across the suite)

  • --catalog json — print the machine-readable command/flag catalog and exit (the suite discovery contract; agents call this at startup, before any subcommand).
  • --json — machine-readable JSON on stdout (opt-in; default output is human).
  • --why — structured explanation on stderr ([why] <header> + indented lines).
  • -q / --quiet / --silent — suppress non-error output.
  • --no-color — disable ANSI color (also honors NO_COLOR and FORCE_COLOR).
  • -V / --version, -h / --help.
  • Exit codes: 0 ok, 1 failure / findings (e.g. verify mismatch), 2 bad usage.

Composability

# One-shot: extract a PDF and register it.
extract deal.pdf --json | contract-vault ingest -

# Export the next quarter of renewals/notices to any calendar app.
contract-vault due --within 90d --format ics > renewals.ics

# Hand the portfolio to finance/legal as a spreadsheet or a report.
contract-vault export > portfolio.csv
contract-vault export --format md --expiring-before 2027-01-01 > renewals-report.md

# Pipe the machine-readable register into jq.
contract-vault find --expiring-before 2026-01-01 --json | jq '.deals[].id'

# A reminder manifest is just the JSON projection (days_until + suggested lead_days).
contract-vault due --within 365d --format json > reminders.json

--format json (or --json) for due/obligations doubles as a reminder manifest: each row carries days_until and a suggested lead_days. The .ics output is the same data rendered as RFC 5545, with a VALARM per event.


Shell completion

contract-vault ships a hidden __complete subcommand (matching the template-vault sibling). Register it for bash with:

_contract_vault() {
  COMPREPLY=( $(contract-vault __complete "${COMP_WORDS[@]:1}") )
}
complete -F _contract_vault contract-vault

It completes subcommands, deal ids (for get/show/verify), and query flags/counterparties/governing-laws (for find/search). (extract-cli ships an extract completion <shell> subcommand instead; both styles are valid across the suite — contract-vault uses the hidden-subcommand style.)


LLM (opt-in, delegated) and "verify, not trust"

contract-vault never calls an LLM itself. Identification of clauses and fields — including the LLM fallback for anything the deterministic tiers miss — is the job of extract-cli. ingest --llm simply forwards --llm to the extract step, which runs that LLM tier; shared config is looked up at ~/.config/contract-ops/llm.json first, then ./config/llm.json (see config/llm.json.example). The register / due / .ics paths stay fully deterministic and work with the LLM off.

Every field contract-vault stores carries its source (deterministic | llm | manual | none) and a confidence. review surfaces the ones worth a human look — without calling a model:

contract-vault review                       # unidentified / llm-derived / low-confidence fields
contract-vault review --strict               # exit 1 if anything needs review (CI gate)
contract-vault find --needs-review --json    # which deals need attention
extract deal.pdf --json --llm | contract-vault ingest -   # improve them at extraction time

# After a human checks a contract, record the verdict (-> source=manual, drops out of review):
contract-vault accept acme-corp/msa governing_law --value Delaware
contract-vault accept acme-corp/msa expiration_date --value 2027-01-31   # recomputes the calendar
contract-vault accept acme-corp/msa value            # accept the current value as verified

Interop

The cross-CLI contracts live under docs/spec/ as JSON Schema 2020-12 and are registered in docs/INTEROP.md:


Development

make install      # editable install with dev extras
make test         # full test suite
make typecheck    # mypy --strict
make coverage     # tests under coverage + report
make build        # wheel + sdist
make smoke        # build, install the wheel in a clean venv, run it
make spec-check   # validate fixtures + outputs against docs/spec schemas (offline)

See ARCHITECTURE.md and CONTRIBUTING.md.

License

MIT © DrBaher

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

contract_vault-0.1.8.tar.gz (68.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

contract_vault-0.1.8-py3-none-any.whl (33.5 kB view details)

Uploaded Python 3

File details

Details for the file contract_vault-0.1.8.tar.gz.

File metadata

  • Download URL: contract_vault-0.1.8.tar.gz
  • Upload date:
  • Size: 68.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for contract_vault-0.1.8.tar.gz
Algorithm Hash digest
SHA256 fd6cbdf3c97add30cfb0ae4862c7c296a400fa09c8c6ec342f58e7acb5243a33
MD5 93ba0a5a74718534b393957a0fbdeeaa
BLAKE2b-256 067f07b6b09c2cad83ac07709284c367a708b14ec9a1b629c514b983f79cfc7b

See more details on using hashes here.

Provenance

The following attestation bundles were made for contract_vault-0.1.8.tar.gz:

Publisher: publish.yml on DrBaher/contract-vault-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file contract_vault-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: contract_vault-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 33.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for contract_vault-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 3d236c8641b307c68db1fbf32d7a571fed2dd9d1cd8e8871a3128975baac78b4
MD5 ede1630230786a7bb7c3ff65c5968fae
BLAKE2b-256 3a81d3b5cdd43d9d481f398bf4056ca85e060a191c5e6a3c86b4898cc515e38d

See more details on using hashes here.

Provenance

The following attestation bundles were made for contract_vault-0.1.8-py3-none-any.whl:

Publisher: publish.yml on DrBaher/contract-vault-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page