Skip to main content

Specification engineering plane — PRD-to-SpecPack compiler for the ABI ecosystem

Project description

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).

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

abi_spec-0.3.0.tar.gz (60.6 kB view details)

Uploaded Source

Built Distribution

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

abi_spec-0.3.0-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

Details for the file abi_spec-0.3.0.tar.gz.

File metadata

  • Download URL: abi_spec-0.3.0.tar.gz
  • Upload date:
  • Size: 60.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for abi_spec-0.3.0.tar.gz
Algorithm Hash digest
SHA256 543ef7a0aebae3b1109f3afcace24704db55762b22ebd3124180d2a9cbe0a75f
MD5 55e607358e4d4f4e180079c624028e0e
BLAKE2b-256 3ecaee89b5753859caca8a1af887fd8a904649aca408696e1cce256ea59fe77f

See more details on using hashes here.

Provenance

The following attestation bundles were made for abi_spec-0.3.0.tar.gz:

Publisher: publish.yml on AbilityBI/abi-spec

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

File details

Details for the file abi_spec-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: abi_spec-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 15.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for abi_spec-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7e3b7142f1b715c1c426df2d99158bb38d57325a40cefd18223020ff412cef45
MD5 b3b7d23c9341e3006b33ecba83e7e6ff
BLAKE2b-256 eb05bf0177fad860383ab3b98c66c9becccf1fe495c54a0e0e612ded94d3e502

See more details on using hashes here.

Provenance

The following attestation bundles were made for abi_spec-0.3.0-py3-none-any.whl:

Publisher: publish.yml on AbilityBI/abi-spec

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