Skip to main content

csd-intent

Cross-runtime audit tool for CSD intent specifications. Validates intent.yaml against CSD-INTENT-01 and confirms every claim is attested by at least one test marker across any test runner - pytest, vitest, Playwright, Jest, or anything that uses the standard intent() / @intent() marker shape.

This tool is standalone. It does not run inside your project's test suite; it is invoked separately (CLI, CI step, or pre-commit hook).

Why it exists

pytest-intent, vitest-intent, and playwright-intent provide the test-side marker helpers - they let a test declare which intent claim it attests. They deliberately know nothing about other runtimes, schema validation, or whether a claim is unattested.

csd-intent owns the cross-runtime auditing: it walks every test file in the project (Python via AST, TS/JS via regex), reads intent.yaml, and answers:

  1. Schema - does every claim match CSD-INTENT-01?
  2. Orphan - does every test marker reference a real claim?
  3. Coverage - does every claim have at least one attesting test, anywhere?

Install

# From PyPI:
pip install csd-intent

# Local dev against a csd-library checkout:
pip install -e path/to/csd-library/csd-intent

Use

# Audit the current directory (expects intent.yaml at the root):
csd-intent

# Audit a specific project:
csd-intent /path/to/project

# Audit but tolerate unattested claims (the "intent before test" workflow):
csd-intent --fail-on schema

# Constrain the scan to specific directories:
csd-intent --tests-dir backend/tests --tests-dir frontend/src --tests-dir e2e

# Quiet summary only:
csd-intent --quiet

Exit code is 0 on a clean audit, 1 when any violation falls into the configured --fail-on set (any by default).

Output

intent.yaml (/path/to/project/intent.yaml): 24 claims, 2 violation(s).

UNATTESTED (2):
  [unattested] INT-SB-018: no @intent / intent() marker references this claim
  [unattested] INT-SB-029: no @intent / intent() marker references this claim

What it scans

  • Python: any file matching test_*.py or *_test.py, walked via AST for @intent("INT-...") decorators on functions starting with test_.
  • JS/TS: any file matching *.test.{ts,tsx,js,jsx,mts,cts} or *.spec.{ts,...}, scanned by regex for intent('INT-...', 'name', fn) calls (single-ID and array-of-IDs forms both supported).
  • Excluded directories: node_modules, .venv, venv, dist, build, .git, __pycache__, .pytest_cache, .mypy_cache, .ruff_cache, .tox.

CSD-INTENT-01 conformance

The schema check validates each claim against the canonical fields per CSD-INTENT-01 §4.1:

INT-NNN:
  version: 1.0.0
  status: active                # draft | active | deprecated
  statement: "..."              # >= 10 chars, RFC 2119 language
  rationale: "..."              # optional but recommended
  test:
    scope: integration          # unit | integration | e2e | llm
    component: SwitchFlow
    type: behavior              # invariant | behavior | contract
  criticality: critical         # critical | high | medium | low

For projects still on the legacy flat-scope: shape, the tool accepts it (with no warning) - that's a migration concession, not a recommendation.

Duplicate keys are refused

intent.yaml is parsed with a loader that raises on a repeated key rather than resolving it last-wins. A claim id reused by accident would otherwise delete the earlier claim before any check could see it - and every marker written for that claim would silently start attesting the survivor, with the audit still printing CLEAN. The duplicate is reported as a schema violation naming both lines:

SCHEMA (1):
  [schema] intent.yaml: duplicate key `INT-GATE-006` (first declared on line 42,
  declared again on line 187); YAML would silently keep only the last one

Merge keys still work: <<: *base plus an explicit override is not a duplicate.

License

MIT.

Metadata

Release files for csd-intent 0.5.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 csd-intent 0.5.0
File Size Uploaded Provenance Actions
csd_intent-0.5.0.tar.gz 22.9 kB With provenance Details for csd_intent-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for csd-intent 0.5.0
File Interpreter ABI Platform Actions
csd_intent-0.5.0-py3-none-any.whl Python 3 none any Details for csd_intent-0.5.0-py3-none-any.whl

Total release size: 39.3 kB

Release files / csd_intent-0.5.0.tar.gz

Download URL csd_intent-0.5.0.tar.gz
Size 22.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1ae9a1f897ff32efe78225e2a5df685c37836e18fc50100f3d7d8ceda541cd57
BLAKE2b-256 checksum
How to use checksums
bf5ebd04842577647de47b7f476a0794b1fb90ccd0b36bcbf8ca8bdc7f160531
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 31, 2026.

Transparency log

Release files / csd_intent-0.5.0-py3-none-any.whl

Download URL csd_intent-0.5.0-py3-none-any.whl
Size 16.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
89e7638b801e1876928022becae6952c11acf1e6fd04484b57bdf23e37487e6c
BLAKE2b-256 checksum
How to use checksums
f3a9143313cd21a38771ac89c40f31aa06ca498f12115c66daf67ecd8eb02d72
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 31, 2026.

Transparency log

Security for csd-intent 0.5.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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for csd_intent-0.5.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 Aug 31, 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