Skip to main content

abi-spec

Specification compiler with content-addressed SpecPacks, requirements traceability, and spec-driven development with drift detection. Part of the Planning Pack (Layer 2).

Depends on abi-control-core for schema validation.

Install (after PyPI publication)

pip install abi-spec

Status: Not yet published to PyPI. Install from source: pip install -e . from the repo root. Requires abi-control-core.

Quick start

Compile a SpecPack from PRD JSON

from abi_spec.compiler import compile_prd_json_to_specpack

# Compile a PRD JSON file into a content-addressed SpecPack
result = compile_prd_json_to_specpack(
    prd_json_path="runs/latest/prd.json",
    out_dir="specs/feature_x/",
)
print(result["manifest_hash"])  # SHA-256 of the spec manifest
print(result["prd_hash"])       # SHA-256 of the input PRD

Spec-driven development with drift detection

from pathlib import Path
from abi_spec.sdd.spec_tracker import SpecTracker

# Initialize tracker (stores metadata in .abi/ by default)
tracker = SpecTracker(tracking_dir=Path(".abi"))

# Track a spec and link it to implementing code paths
tracker.track(spec_path="specs/auth.md", code_paths=["src/auth/"])

# Detect drift between spec and code (time-based + hash-based)
drift = tracker.detect_drift(spec_path="specs/auth.md", code_paths=["src/auth/"])
if drift.has_drift:
    print(drift.details)  # e.g., "Code updated without spec update — drift detected"

Requirements traceability

from abi_spec.traceability import generate_requirements_index

# Generate a traceability index from structured requirements
requirements = [
    {
        "id": "REQ-001",
        "title": "User Authentication",
        "text": "System shall authenticate users",
        "acceptance": ["Given valid token, When request, Then access granted"],
        "source_prd_section": "Security.Authentication",
    },
]
index = generate_requirements_index(requirements)
# Returns list of dicts with req_id, title, acceptance_criteria, source_prd_section

What's included

  • SpecPack compiler -- compile PRD JSON into content-addressed, schema-validated specification packages
  • Requirements traceability -- REQ-ID tracking with structured index generation
  • Acceptance criteria parsing -- Given/When/Then extraction from structured requirements
  • Spec-driven development -- SpecTracker with SHA-256 content hashing for drift detection
  • Drift detection -- identify when specs and code are out of sync (time-based and hash-based)

ABI ecosystem

abi-spec is part of the Planning Pack (Layer 2), built on top of abi-control-core (Layer 1).

Related packages:

  • abi-control-core -- contracts and audit trail SDK (Layer 1, required)
  • abi-prd -- structured PRD generation (Layer 2)
  • abi-evals -- eval runner for validating spec compliance

Versioning

Follows Semantic Versioning. Current version: 0.2.0. See CHANGELOG.md for release notes.

License

MIT License (see LICENSE file).

Metadata

Release files for abi-spec 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 abi-spec 0.3.0
File Size Uploaded Provenance
abi_spec-0.3.0.tar.gz 60.6 kB With provenance Details

Built distribution (wheel)

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

Total release size: 76.2 kB

Release files / abi_spec-0.3.0.tar.gz

Download URL abi_spec-0.3.0.tar.gz
Size 60.6 kB
Tags Source
SHA-256 checksum
How to use checksums
543ef7a0aebae3b1109f3afcace24704db55762b22ebd3124180d2a9cbe0a75f
BLAKE2b-256 checksum
How to use checksums
3ecaee89b5753859caca8a1af887fd8a904649aca408696e1cce256ea59fe77f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Mar 14, 2026.

Transparency log

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

Download URL abi_spec-0.3.0-py3-none-any.whl
Size 15.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7e3b7142f1b715c1c426df2d99158bb38d57325a40cefd18223020ff412cef45
BLAKE2b-256 checksum
How to use checksums
eb05bf0177fad860383ab3b98c66c9becccf1fe495c54a0e0e612ded94d3e502
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Mar 14, 2026.

Transparency log

Security for abi-spec 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

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

Select from 2 files

Attestation for abi_spec-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 Mar 14, 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.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files Full provenance

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