Skip to main content

Drift

PyPI version Python 3.10+

Test-driven development for AI workflows - define your standards, validate your project, iterate to compliance.

What It Does

Drift validates your AI agent projects against custom rules you define. No built-in opinions - you write the rules in .drift.yaml, Drift validates against them.

Quick Example

1. Create .drift.yaml with your rules:

rule_definitions:
  claude_md_exists:
    description: "Project must have CLAUDE.md"
    scope: project_level
    phases:
      - name: check_file
        type: file_exists
        file_path: CLAUDE.md
        failure_message: "CLAUDE.md is missing"

2. Run validation:

uvx --from ai-drift drift

3. Fix issues, re-run until green.

That's it. Define standards → validate → fix → iterate.

Installation

Run directly with uv (no installation needed):

uvx --from ai-drift drift

Or install with uv:

uv pip install ai-drift

Common Workflow

# 1. Define your standards in .drift.yaml
# 2. Run validation
uvx --from ai-drift drift

# 3. Generate AI prompts to create missing files
uvx --from ai-drift drift draft --target-rule skill_validation > prompt.md

# 4. Fix issues manually or with AI
# 5. Re-validate until green
uvx --from ai-drift drift

What You Can Validate

Define rules to check:

  • Required files exist (CLAUDE.md, README.md, etc.)
  • Link integrity (no broken file references)
  • YAML frontmatter structure
  • Dependency health (no redundant transitive dependencies)
  • File format compliance (regex patterns)
  • Content quality (with optional LLM-based rules)

Examples: See .drift.yaml in this repo.

Configuration Options

Parameter Overrides

Override validator parameters at different levels using parameter override configuration:

# Validator-level overrides - apply to all rules using a validator
validator_param_overrides:
  core:file_exists:
    merge:
      ignore_patterns:
        - ".venv/**"
        - "node_modules/**/*"
        - "**/*.tmp"

  core:markdown_link:
    merge:
      ignore_patterns:
        - "https://example.com/**"
        - "http://localhost:**"

# Rule-level overrides - apply to specific rules
rule_param_overrides:
  Python::documentation:
    merge:
      ignore_patterns:
        - "tests/**"

  # Phase-specific override
  General::skill_validation::check_links:
    replace:
      check_external_urls: false

# Skip entire rules or phases
ignore_validation_rules:
  - "Claude Code::skill_validation::check_description_quality"
  - "Python::formatting"

Override Strategies:

  • merge: Extends lists/dicts (for ignore_patterns, etc.)
  • replace: Completely replaces parameter value

Pattern Types:

  • Glob patterns: *.md, **/*.py, src/**/*
  • Regex patterns: Auto-detected by metacharacters (^, $, \(, etc.)
  • Literal paths: Exact path matching

Precedence: validator overrides → rule overrides → phase overrides

See Configuration Guide for complete details.

Documentation

Development

./test.sh          # Run tests (90%+ coverage required)
./lint.sh          # Run linters
./lint.sh --fix    # Auto-fix formatting

License

MIT

Metadata

Release files for ai-drift 0.10.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 ai-drift 0.10.0
File Size Uploaded
ai_drift-0.10.0.tar.gz 107.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ai-drift 0.10.0
File Interpreter ABI Platform
ai_drift-0.10.0-py3-none-any.whl Python 3 none any Details

Total release size: 244.7 kB

Release files / ai_drift-0.10.0.tar.gz

Download URL ai_drift-0.10.0.tar.gz
Size 107.5 kB
Tags Source
SHA-256 checksum
How to use checksums
1ff3d34c6211b6282810d671ada3ea90d3ef9cf693a4b7a9d6a2bc12a5d3e1ef
BLAKE2b-256 checksum
How to use checksums
7529d3cecdaed5f60e99f88f9f67262281dc976c56a44ee6de233dfd1409c114
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release files / ai_drift-0.10.0-py3-none-any.whl

Download URL ai_drift-0.10.0-py3-none-any.whl
Size 137.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
50793fc17c54e4aa0bb9e42fbad69ed7b5efe24e619e2a3edf197a4bb955a757
BLAKE2b-256 checksum
How to use checksums
677e68d17918f3eeab388b79794ded8d25eddef0608b006799601e554c208d8e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release history Release notifications | RSS feed

This release

0.10.0 This release

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

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