Skip to main content

Cometric

CI

Commercial Intelligence Engine. Cometric models the commercial arrangements behind service engagements, simulates their economics month by month, and searches for structures that balance profitability, risk, and client value.

  1. Model. Arrangements are compositions, not a single "pricing model": billing bases, rate schedules, allowances, minimums, adjustments, delivery costs, and capacity, each typed and validated.
  2. Simulate. A deterministic decimal engine computes contractual fees, costs by margin layer, contribution, client effective unit price, capacity use, and who absorbs each deviation from plan.
  3. Optimize. A grid search over the parameters you declare returns the trade-off frontier. Nothing is ranked unless you supply an objective, and every recommendation is marked for human review.

It is built for any service relationship priced through a composite arrangement: consulting, outsourcing, managed services, and alternative legal services. Sector knowledge ships as data-only packs.

Guarantees

  • No model arithmetic. Every amount is computed by decimal code. Floating-point input is rejected.
  • Reproducible. Each result carries a SHA-256 fingerprint of its canonical inputs, engine version, and policies.
  • Traceable. Every fee line records its evaluation step, formula, quantity, and contract version.
  • Explicit policy. Cost layering, capacity ceilings, recognition rules, and risk tolerances are inputs. Missing economic policy is an error, never a silent default.
  • Labeled knowledge. Pack concepts and claims carry evidence classes. Inference and proposals are always labeled as such.

Install

pip install "cometric[mcp]"           # or: uv pip install "cometric[mcp]"
uv sync --all-extras                  # from a checkout

PyPI

Python 3.11 or later.

Quickstart

cometric validate src/cometric/examples/spec_example.json
cometric calculate src/cometric/examples/case_a.json --scenario base --cost-policy reference
cometric explain src/cometric/examples/spec_example.json --period 2027-01
cometric break-even src/cometric/examples/case_b.json --driver contracts --scenario base --cost-policy reference
cometric floor src/cometric/examples/case_b.json --cost-policy reference --target-margin 0.20
cometric template base_plus_overage
cometric template phased_fixed_fee --pack consulting
cometric template tiered_units_annual_minimum --pack alsp
cometric reconcile engagement.json --scenarios actual-quantities.json --actuals actuals.json --cost-policy reference --summary-only
cometric lookup PM-023
import json

import cometric

case = json.load(open("src/cometric/examples/case_a.json"))
result = cometric.calculate_periods(case["engagement"], case["scenarios"][1], "reference", detail="periods")
print(result["term"]["contribution_margin"], result["input_fingerprint"])

MCP server

Cometric ships a read-only, stateless MCP server: 19 tools (start with quickstart), schema and template discovery, resources for the glossary, schemas, concept schemes, rules, coverage, templates, and worked examples, and six guided prompts.

cometric mcp                                   # stdio
COMETRIC_ALLOWED_ROOT=/path/to/models cometric mcp   # stdio, may read input files under that root
cometric mcp --transport http --port 8765      # stateless streamable HTTP at POST /mcp

Claude Code:

claude mcp add cometric -- uvx --from "cometric[mcp]" cometric mcp

The HTTP transport keeps no session state, answers GET /mcp with 405, keeps DNS-rebinding protection on (set COMETRIC_ALLOWED_HOSTS for your hostname), and checks a bearer token when COMETRIC_MCP_TOKEN is set.

Concepts

Concept Meaning
Engagement Parties, units, services, effective-dated arrangement versions, delivery plan
Fee component One charge computed by one method: fixed recurring, time, dedicated resource, unit output, weighted unit output, allowance plus overage, fixed project, outcome adjustment (gain-share, success fee, percent of outcome)
Realization Contractual fee against hours worked at a standard rate card, with write-down and effective billing rate
Accumulation period Allowances, minimums, tiers, and capacity accumulate over a declared period independent of the monthly grain
Evaluation order Resolve, measure, consume allowances, price, collar, discount, minimum, performance, cap
Cost policy Maps each cost category to exactly one margin layer; reference is shipped and must be named
Scenario Immutable, origin-labeled assumptions spread to months by exact allocation
Derived risk Who absorbs a deviation: provider contribution versus client unit price
Dominance A candidate is dominated when another is at least as good on every metric and better on one

Packs

Packs are YAML only, with no executable code. base holds domain-neutral commercial knowledge: billing bases, 34 pricing models, 61 levers, 16 commercial dimensions, 49 metrics and indicators, cost categories, compatibility and reasoning rules, selection heuristics, mechanisms, and negotiation exchanges. alsp extends it for alternative legal services with service categories, unit templates, provider types, regulatory review rules, sector prevalence overlays, and evidence. consulting extends it for advisory work with realization and staffing concepts, outcome-fee review rules, and five templates: role-based time and materials, capped time and materials, phased fixed fee, hours-drawdown retainer, and fixed fee plus success fee.

cometric packs
cometric validate-pack alsp
cometric validate-pack consulting

Development

uv sync --all-extras
uv run pytest
uv run ruff check src tests scripts && uv run ruff format --check src tests scripts
uv run python scripts/build_fixtures.py   # regenerate casebook fixtures

The specification is docs/COMETRIC_SPEC_v0.3.md (normative for 0.1.0). Implementation status is in docs/STATUS.md; worked commercial patterns (tiered minimums, transition credits, partial billing, cost from hours, early termination) are in docs/PATTERNS.md; reconciling a real engagement is described in docs/RECONCILIATION.md.

License

Apache License 2.0. See LICENSE.

Metadata

Release files for cometric 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cometric 0.3.0
File Size Uploaded Provenance Actions
cometric-0.3.0.tar.gz 494.4 kB With provenance Details for cometric-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cometric 0.3.0
File Interpreter ABI Platform Actions
cometric-0.3.0-py3-none-any.whl Python 3 none any Details for cometric-0.3.0-py3-none-any.whl

Total release size: 697.9 kB

Release files / cometric-0.3.0.tar.gz

Download URL cometric-0.3.0.tar.gz
Size 494.4 kB
Tags Source
SHA-256 checksum
How to use checksums
71b88cef84fa8ea43df148f89256cffeb5c6e728e8ef436b1e071d6508a78d07
BLAKE2b-256 checksum
How to use checksums
861cf4026747fc2a7f976d46759cd60df926c9b9d3a15554fcad3feebb82f5e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

Release files / cometric-0.3.0-py3-none-any.whl

Download URL cometric-0.3.0-py3-none-any.whl
Size 203.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6430292b1c9136ccd6676ccb2932a34d96ad6fa6179e675acc92eb10958623ce
BLAKE2b-256 checksum
How to use checksums
96786a94e6399673874d84fcc4658152beb6b758e2da8684f3bae14501d56ea3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

Security for cometric 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for cometric-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page