Skip to main content

cervellaswarm-quality-gates

Quality gates for AI agent swarms: content scoring, hook validation, and agent sync.

Part of the CervellaSwarm ecosystem.

Features

  • Content Quality Scoring - Score session documents across 4 dimensions: actionability (30%), specificity (30%), freshness (20%), conciseness (20%)
  • Hook Validation - Verify hook file integrity: executable, correct shebang, proper permissions (OK/BROKEN/DISABLED/NOT_EXEC)
  • Agent Sync - Compare and synchronize agent definition directories across projects
  • CLI - cervella-check with subcommands: quality, hooks, sync, all
  • Zero dependencies - Pure Python stdlib, no external packages required

Installation

pip install cervellaswarm-quality-gates

Quick Start

from cervellaswarm_quality_gates import score_content, validate_hooks, compare_agents

# Score a session document
result = score_content("## Session 42\n### What happened\n- Fixed auth bug in login flow\n### Next steps\n1. Deploy to staging")
print(f"Quality: {result.total:.1f}/10")

# Validate hooks in a directory
reports = validate_hooks("/path/to/hooks/")
for r in reports:
    print(f"{r.name}: {r.status.value}")

# Compare agent directories
diff = compare_agents("/project-a/agents/", "/project-b/agents/")
print(f"Only in A: {diff.only_in_source}")

CLI Usage

# Score content quality of a file
cervella-check quality path/to/session-state.md

# Validate all hooks in a directory
cervella-check hooks path/to/hooks/

# Compare agent directories
cervella-check sync /agents/source/ /agents/target/

# Run all checks with JSON output
cervella-check all --project-dir . --json

Configuration

Config file search order:

  1. CERVELLASWARM_QUALITY_GATES_CONFIG env var
  2. .cervella/quality-gates.yaml in project root
  3. ~/.claude/quality-gates.yaml (user-level)
# .cervella/quality-gates.yaml
quality:
  weights:
    actionability: 0.30
    specificity: 0.30
    freshness: 0.20
    conciseness: 0.20
  min_score: 7.0

hooks:
  directory: .claude/hooks/
  required_hooks:
    - session_start
    - file_limits

sync:
  ignore_patterns:
    - "*.pyc"
    - "__pycache__"

Scoring Dimensions

Dimension Weight What it measures
Actionability 30% Contains concrete next steps, decisions, action items
Specificity 30% Uses specific names, numbers, file paths (not vague)
Freshness 20% Has dates, session numbers, timestamps
Conciseness 20% Information density (not bloated with filler)

Hook Statuses

Status Meaning
OK Hook exists, is executable, has valid shebang
BROKEN Hook exists but has errors (bad shebang, syntax)
DISABLED Hook file exists but is not enabled
NOT_EXEC Hook exists but lacks execute permission
MISSING Hook file not found

Comparison with Alternatives

Feature quality-gates flake8/ruff custom scripts
Content quality scoring Yes No Manual
Hook validation Yes No Manual
Agent directory sync Yes No Manual
AI-agent aware Yes No Varies
Zero dependencies Yes No Varies
YAML config Yes Yes Manual

License

Apache-2.0 - see LICENSE for details.

Metadata

Release files for cervellaswarm-quality-gates 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 cervellaswarm-quality-gates 0.1.0
File Size Uploaded Provenance Actions
cervellaswarm_quality_gates-0.1.0.tar.gz 25.5 kB With provenance Details for cervellaswarm_quality_gates-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cervellaswarm-quality-gates 0.1.0
File Interpreter ABI Platform Actions
cervellaswarm_quality_gates-0.1.0-py3-none-any.whl Python 3 none any Details for cervellaswarm_quality_gates-0.1.0-py3-none-any.whl

Total release size: 45.4 kB

Release files / cervellaswarm_quality_gates-0.1.0.tar.gz

Download URL cervellaswarm_quality_gates-0.1.0.tar.gz
Size 25.5 kB
Tags Source
SHA-256 checksum
How to use checksums
a87629602ef501b05dfbc73741586de9beec3ab99356e61b1a089f182378f19a
BLAKE2b-256 checksum
How to use checksums
b1f92ed899c8443a3780c797a24cf399bfc4779a0c05da62f06d02921fb8acca
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 Feb 25, 2026.

Transparency log

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

Download URL cervellaswarm_quality_gates-0.1.0-py3-none-any.whl
Size 19.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ae310367d7dd45d02018802ec0873f8ef75d0f16276c21ef9fa290922101518a
BLAKE2b-256 checksum
How to use checksums
86296a46a8ca7c5a8ce26832aa05c8bc54bbb067afc5082011db919ec4ac2dce
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 Feb 25, 2026.

Transparency log

Security for cervellaswarm-quality-gates 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 cervellaswarm_quality_gates-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 Feb 25, 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.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