Skip to main content

Spec-Driven Development for Forge — structured acceptance criteria, SLSA Level 2 attestation, and spec-gated evolution.

Project description

forge-spec

Spec-Driven Development for the Forge agent harness.

Define what an agent run must achieve (spec.yaml), verify it against real RunResult output, and generate SLSA Level 2-inspired attestations for compliance and audit trails.

Installation

pip install forge-spec
# With LLM-assisted spec refinement:
pip install forge-spec[llm]

Quick start

from forge_spec import SpecDef, AcceptanceCriterion, SpecRunner

spec = SpecDef(
    name="no-show-optimizer",
    description="Reduce appointment no-show rate",
    objectives=["Reduce no-show rate by 15%"],
    acceptance_criteria=[
        AcceptanceCriterion(
            id="ac-001",
            description="Run completes successfully",
            check_type="assertion",
            expected="run_result.status == 'completed'",
        ),
        AcceptanceCriterion(
            id="ac-002",
            description="Output contains recommendations",
            check_type="contains",
            expected="recommendation",
        ),
    ],
)

runner = SpecRunner()
verify_result, attestation = await runner.run_pipeline(spec, run_result)
print(f"Compliance: {verify_result.compliance_rate:.0%}")

spec.yaml format

name: no-show-optimizer
version: "0.1.0"
description: Reduce appointment no-show rate
objectives:
  - Reduce no-show rate by at least 15%
constraints:
  - id: no-model-swap
    description: Preserve the primary LLM model during evolution
    mutation_kinds_blocked:
      - model_swap
acceptance_criteria:
  - id: ac-001
    description: Run must complete successfully
    check_type: assertion
    expected: "run_result.status == 'completed'"
    weight: 2.0
  - id: ac-002
    description: Output mentions recommendations
    check_type: contains
    expected: recommendation
risks:
  - id: risk-001
    description: Model hallucination in recommendations
    likelihood: 0.3
    impact: 0.8
    mitigation: Use structured output validation

Technical debt

See DEVLOG.md for DT entries introduced in Phase 4.

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

forge_spec-0.2.0.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

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

forge_spec-0.2.0-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file forge_spec-0.2.0.tar.gz.

File metadata

  • Download URL: forge_spec-0.2.0.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for forge_spec-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5fb4c9ca136cb487c717ceee3c7529371071be37335f36c712a45c914c009843
MD5 aa5f8dc9d09f769641a53d29396430c3
BLAKE2b-256 9bd01ac5f3a984c1d43855589cbc7fd4200387f0b6e8abe832b145ec2e9f896a

See more details on using hashes here.

File details

Details for the file forge_spec-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: forge_spec-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for forge_spec-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 df9a70a432c09afd81516dd2fd5c88215adbba68c4b70426d39e13830f7e60f8
MD5 9c2a7572b048bf1b62044aefce7a595f
BLAKE2b-256 5af01cd0f9debb26b78898e3d1d77919e8852514dfa0c0ddfe751f081bbf7f5a

See more details on using hashes here.

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