Skip to content
contract-ops CLI suite

Tool · Python

template-vault-cli

template-vault-cli v0.4.8 0 498/wk on npm Latest from PyPI · checked Thu, 21 May 2026

A Git-backed, clause-aware package manager for legal-document templates. Public sources (Common Paper, YC SAFE, Bonterms) and your own house templates live in one searchable, composable, version-tracked vault. Clauses are first-class objects with provenance: fork a template, swap a single clause in from another, and later pull upstream parent improvements into your fork — meta.json records which clause came from where, so the merge is deterministic. The storage layer at the start of the contract pipeline.

TL;DR — pipx install template-vault-cli, then template-vault demo for a zero-config compose-and-swap tour. template-vault init in a folder makes a vault; import, find, compose, and swap work from there. It structures templates — it doesn't generate clause text.
template-vault demo — compose + swap

Try it live

Explore a seeded demo vault — search, list, and inspect templates and their clauses (read-only).

Runs the real CLI on your input in a sandbox — no setup, nothing stored. Open in a new tab ↗

What it does

  • Stores templates as plain files in a Git repo. Multi-user sync is just git pull / git push (wrapped as sync / publish). No database, no server.
  • Indexes with a small meta.json per template. Category, jurisdiction, tags, summary, version history. find searches by category, tag, jurisdiction, or keyword.
  • Clause-aware composition. compose forks a base template; swap replaces one clause from another template. Each swap appends to clause_overrides in meta.json — e.g. "Term and Survival" from nda/yc@v1 — so the provenance is permanent.
  • Deterministic upgrades. When a parent template gets a new version, upgrade pulls the parent's other clause changes into your fork but leaves locally-swapped clauses alone. That's the whole point of recording the override.
  • Public-source import. sources lists known upstreams; import common-paper-mutual-nda fetches the text from the upstream URL at import time (with optional hash pinning). Nothing is bundled.
  • Versioning + integrity. history shows the versions / swaps / amends timeline; diff compares two versions; verify does a content-level sha256 check across the vault.
  • Opt-in, metadata-only LLM. ask sends only template metadata (name, category, jurisdiction, tags, summary, clause titles) to your configured provider by default; --with-content adds excerpts only after explicit confirmation (or --yes-send in CI). The CLI structures existing templates; it does not write new clauses.

Quickstart

install + run
# Install
pipx install template-vault-cli
template-vault --version

# Zero-config: compose + swap against inline fixtures, then poke at the vault
template-vault demo

# Or pull a real public template into a vault of your own
mkdir my-vault && cd my-vault
template-vault init
template-vault import common-paper-mutual-nda
template-vault list

# Fork + swap one clause, with provenance recorded
template-vault compose --base nda/house --as nda/house-startup
template-vault swap nda/house-startup --clause "Term and Survival" --from nda/yc
template-vault info nda/house-startup        # shows clause_overrides: 1

For agents and automation

template-vault is the suite's storage contract. The cross-CLI interop doc (docs/INTEROP.md) is the citation point for what this repo provides to its siblings. Structured outputs (info --json, find --json, history --json, stats --json) are validated against JSON Schemas committed under docs/spec/, with a semver commitment: a backward-incompatible schema change requires a major version bump. Downstream tools (e.g. nda-review-cli pulling clause structure) validate against the schema rather than trusting field shapes by convention.

recommended agent defaults
# Discover what's in the vault, then resolve a template path
template-vault find "mutual nda california" --json --top-k 5
template-vault info nda/common-paper-mutual --json
template-vault get  nda/common-paper-mutual --path-only   # → hand to draft-cli

LLM features (ask) share one on-disk provider config with the other Python CLI in the suite: ~/.config/contract-ops/llm.json is the suite-wide location, so configuring it once lights up LLM features across every tool that adopts the same lookup order. Metadata-only by default; content excerpts require explicit consent. --why on the write-side commands prints a short structured explanation to stderr so it never pollutes structured stdout.

Where it fits in the workflow

The storage layer at the start of the six-CLI workflow. template-vault get <ref> resolves a versioned template, which you hand to draft-cli to fill placeholders, then to nda-review-cli for review and negotiation. It's where your house templates and forked public sources live with provenance — the source of truth the rest of the pipeline draws from. See the full workflow for the chained commands.

It's also useful on its own as a versioned, searchable library for any team that maintains a collection of document templates and wants composition with an audit trail. The contract pipeline is one application.

Repo

github.com/DrBaher/template-vault-cli · MIT licensed · Stdlib-only Python ([docx] extra adds python-docx) · PyPI-installable.

Edit this page on GitHub