Skip to main content

Axiom

CI PyPI Python 3.12+ License: MIT

Specs are source. Code is cache.

Axiom compiles .axiom specification files into verified Python code using LLMs. Instead of writing code and hoping it matches your intent, you write executable specifications and Axiom generates code that provably satisfies them.

The Idea

Traditional:  Intent → Code → Tests → Hope they match
Axiom:        Spec (Intent + Tests) → Code (generated + verified)

Every spec includes:

  • Intent: Natural language description of what the code should do
  • Interface: Typed parameters and return values
  • Examples: Concrete input/output pairs that must pass
  • Invariants: Properties that must hold for all inputs

Axiom generates code that satisfies all assertions, caches the result, and regenerates only when the spec changes.

Quick Start

Install

pip install axiom-spec

Set up API key

export ANTHROPIC_API_KEY=your-key-here

Initialize a project

mkdir my-project && cd my-project
axiom init

Write a spec

Create specs/validate_email.axiom:

axiom: "0.1"

metadata:
  name: validate_email
  version: 1.0.0
  description: "Validates and normalizes email addresses"
  target: "python:function"

intent: |
  Takes a string that should be an email address.
  If valid, returns it lowercased and stripped.
  If invalid, raises ValueError.

interface:
  function_name: validate_email
  parameters:
    - name: email
      type: str
      description: "The email to validate"
  returns:
    type: str
    description: "The normalized email"

examples:
  - name: valid_email
    input: { email: "User@Example.com" }
    expected_output: "user@example.com"

  - name: invalid_email
    input: { email: "not-an-email" }
    expected_output:
      raises: ValueError

invariants:
  - description: "Output is always lowercase"
    check: "output == output.lower()"

Build and verify

# Generate code from spec
axiom build specs/validate_email.axiom

# Verify generated code passes all assertions
axiom verify specs/validate_email.axiom

# Or do both at once
axiom build specs/validate_email.axiom --verify

Use the generated code

from generated.validate_email import validate_email

email = validate_email("User@Example.com")  # Returns "user@example.com"

Commands

Command Description
axiom init Initialize a new project with config and directories
axiom build <spec> Generate code from a spec file
axiom verify <spec> Run all examples and invariants against generated code
axiom build <dir> Build all specs in a directory (respects dependencies)
axiom watch Watch for spec changes and rebuild automatically
axiom explain <spec> Show human-readable summary of a spec
axiom stats Show project statistics and self-hosting metrics
axiom cache list List cached generations
axiom cache clear Clear the cache
axiom infer <file.py> Generate specs from existing Python code
axiom lint <spec> Check spec for issues
axiom lint <spec> --fix Auto-fix spec issues

Features

  • Multi-spec composition: Specs can depend on other specs
  • FastAPI support: Generate complete API endpoints with target: python:fastapi
  • TypeScript support: Generate TypeScript with target: typescript:function
  • Deterministic caching: Same spec = same code, instant rebuilds
  • Property-based testing: Invariants verified with Hypothesis
  • IDE support: VS Code extension with LSP for .axiom files
  • Watch mode: Auto-rebuild on spec changes
  • Spec inference: Generate specs from existing Python functions

Configuration

Create axiom.toml in your project root:

[project]
name = "my-project"
spec_dir = "specs"
generated_dir = "generated"

[generation]
default_model = "claude-sonnet-4-20250514"
temperature = 0.0
max_retries = 3

[verification]
run_examples = true
run_invariants = true
hypothesis_max_examples = 100

Philosophy

Traditional development treats code as the source of truth. Documentation drifts, tests become stale, and intent is lost in implementation details.

Axiom inverts this: specifications are the source of truth. Code is a cached compilation artifact that can be regenerated anytime. When you change a spec, you change the contract. When you regenerate, you get code that provably satisfies the new contract.

This isn't "AI-assisted coding" — it's a fundamental shift in what a codebase is.

Status

Axiom is in active development. Current capabilities:

  • ✅ Pure function generation (Python)
  • ✅ FastAPI endpoint generation
  • ✅ Multi-spec dependencies
  • ✅ Deterministic caching
  • ✅ Property-based verification
  • ✅ Basic TypeScript support
  • ✅ IDE integration (VS Code)
  • ✅ Spec inference from Python
  • 🚧 Self-hosting (1% of Axiom is spec-driven)

Contributing

Contributions welcome! See CONTRIBUTING.md for guidelines.

License

MIT License. See LICENSE for details.


Built by Vaspera Capital

Metadata

Release files for axiom-spec 0.1.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 axiom-spec 0.1.0
File Size Uploaded Provenance
axiom_spec-0.1.0.tar.gz 387.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for axiom-spec 0.1.0
File Interpreter ABI Platform
axiom_spec-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 536.1 kB

Release files / axiom_spec-0.1.0.tar.gz

Download URL axiom_spec-0.1.0.tar.gz
Size 387.5 kB
Tags Source
SHA-256 checksum
How to use checksums
794a61da2b9038959e942eb3c52620722fd473bb9d999931f7ff636abbdb0a2c
BLAKE2b-256 checksum
How to use checksums
6a0db28ce91778fb2382c55018c18b841065f50aadcd96efc09fd1d00c3c81e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Apr 8, 2026.

Transparency log

Release files / axiom_spec-0.1.0-py3-none-any.whl

Download URL axiom_spec-0.1.0-py3-none-any.whl
Size 148.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
13533faaae15206bee81c917247d2659639e24d2346c4ab6a49048d9247e9b83
BLAKE2b-256 checksum
How to use checksums
f08ff8c20cdade2430a93ef8a3a6d277774588731e3b04e2de043f427135f2fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Apr 8, 2026.

Transparency log

Security for axiom-spec 0.1.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 axiom_spec-0.1.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 Apr 8, 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.

Release history Release notifications | RSS feed

This release

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