Quality gates for AI agent swarms: content scoring, hook validation, and agent sync
Project description
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-checkwith 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:
CERVELLASWARM_QUALITY_GATES_CONFIGenv var.cervella/quality-gates.yamlin project root~/.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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cervellaswarm_quality_gates-0.1.0.tar.gz.
File metadata
- Download URL: cervellaswarm_quality_gates-0.1.0.tar.gz
- Upload date:
- Size: 25.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a87629602ef501b05dfbc73741586de9beec3ab99356e61b1a089f182378f19a
|
|
| MD5 |
135c085810cc47613130ea02c39f4d8d
|
|
| BLAKE2b-256 |
b1f92ed899c8443a3780c797a24cf399bfc4779a0c05da62f06d02921fb8acca
|
Provenance
The following attestation bundles were made for cervellaswarm_quality_gates-0.1.0.tar.gz:
Publisher:
publish-quality-gates.yml on rafapra3008/cervellaswarm-internal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cervellaswarm_quality_gates-0.1.0.tar.gz -
Subject digest:
a87629602ef501b05dfbc73741586de9beec3ab99356e61b1a089f182378f19a - Sigstore transparency entry: 991493181
- Sigstore integration time:
-
Permalink:
rafapra3008/cervellaswarm-internal@e7230c814685c0542ecc7b71c05dc14aa12dcde7 -
Branch / Tag:
refs/tags/quality-gates-v0.1.0 - Owner: https://github.com/rafapra3008
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-quality-gates.yml@e7230c814685c0542ecc7b71c05dc14aa12dcde7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cervellaswarm_quality_gates-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cervellaswarm_quality_gates-0.1.0-py3-none-any.whl
- Upload date:
- Size: 19.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae310367d7dd45d02018802ec0873f8ef75d0f16276c21ef9fa290922101518a
|
|
| MD5 |
d211c11374b7bfe8083e4afe0c3c5372
|
|
| BLAKE2b-256 |
86296a46a8ca7c5a8ce26832aa05c8bc54bbb067afc5082011db919ec4ac2dce
|
Provenance
The following attestation bundles were made for cervellaswarm_quality_gates-0.1.0-py3-none-any.whl:
Publisher:
publish-quality-gates.yml on rafapra3008/cervellaswarm-internal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cervellaswarm_quality_gates-0.1.0-py3-none-any.whl -
Subject digest:
ae310367d7dd45d02018802ec0873f8ef75d0f16276c21ef9fa290922101518a - Sigstore transparency entry: 991493187
- Sigstore integration time:
-
Permalink:
rafapra3008/cervellaswarm-internal@e7230c814685c0542ecc7b71c05dc14aa12dcde7 -
Branch / Tag:
refs/tags/quality-gates-v0.1.0 - Owner: https://github.com/rafapra3008
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-quality-gates.yml@e7230c814685c0542ecc7b71c05dc14aa12dcde7 -
Trigger Event:
push
-
Statement type: