Pure, standalone maturity tracking system for project lifecycle management
Project description
Socrates Maturity Tracking System
A pure, standalone library for calculating and tracking project maturity across four phases and five quality categories. This is the core foundation of the Socrates AI system's agent coordination.
What is Maturity?
Project maturity is measured across:
Four Phases:
- Discovery (0-25%): Define problem, scope, audience
- Analysis (25-50%): Gather requirements, analyze data
- Design (50-75%): Technology choices, architecture
- Implementation (75-100%): Code development, testing
Five Quality Categories:
- Code Quality
- Testing Coverage
- Documentation
- Architecture
- Performance
Key Features
Smart Calculation Algorithm
The maturity calculation uses a unique algorithm that:
- Never penalizes advancing to new phases
- Only averages phases being worked on
- Example: Discovery 100%, Analysis 0% = 100% overall (not 50%)
Pure Data Transformation
- No side effects
- No external dependencies
- Fully deterministic
- Can be used standalone or composed with other libraries
Comprehensive Category Tracking
- Per-phase category scores (0.0-1.0)
- Weak category identification (< 0.6)
- Category improvement tracking
- Historical event logging
Installation
pip install socrates-maturity
Quick Start
from socrates_maturity import MaturityCalculator
# Calculate overall maturity from phase scores
phase_scores = {"discovery": 1.0, "analysis": 0.3}
overall = MaturityCalculator.calculate_overall_maturity(phase_scores)
# overall = 0.65 (65%)
# Estimate current phase
current_phase = MaturityCalculator.estimate_current_phase(overall)
# current_phase = "design"
# Find weak categories
weak = MaturityCalculator.identify_weak_categories({
"code_quality": 0.4,
"testing": 0.8,
"documentation": 0.3
})
# weak = ["code_quality", "documentation"]
# Get phase completion
completion = MaturityCalculator.get_phase_completion_percentage(overall)
# completion = 60 (60% through current phase)
API Reference
MaturityCalculator
Static utility class providing maturity calculation functions.
calculate_overall_maturity(phase_scores: Dict[str, float]) -> float
Calculate overall project maturity from phase scores.
Args:
phase_scores: Dict mapping phase names to scores (0.0-1.0)
Returns: Overall maturity as float (0.0-1.0)
Examples:
# Single phase
MaturityCalculator.calculate_overall_maturity({"discovery": 1.0})
# → 1.0
# Two phases (no penalty for new phase)
MaturityCalculator.calculate_overall_maturity({"discovery": 1.0, "analysis": 0.0})
# → 1.0
# Two phases with progress
MaturityCalculator.calculate_overall_maturity({"discovery": 1.0, "analysis": 0.3})
# → 0.65
estimate_current_phase(overall_maturity: float) -> str
Estimate current phase based on overall maturity.
Args:
overall_maturity: Overall maturity (0.0-1.0 or 0-100)
Returns: Phase name ("discovery", "analysis", "design", "implementation")
Examples:
MaturityCalculator.estimate_current_phase(0.1) # → "discovery"
MaturityCalculator.estimate_current_phase(0.4) # → "analysis"
MaturityCalculator.estimate_current_phase(0.65) # → "design"
MaturityCalculator.estimate_current_phase(0.9) # → "implementation"
get_phase_completion_percentage(overall_maturity: float) -> int
Get completion percentage within current phase.
Args:
overall_maturity: Overall maturity (0.0-1.0)
Returns: Completion percentage (0-100)
Examples:
MaturityCalculator.get_phase_completion_percentage(0.1) # → 40 (40% through discovery)
MaturityCalculator.get_phase_completion_percentage(0.4) # → 60 (60% through analysis)
MaturityCalculator.get_phase_completion_percentage(0.9) # → 60 (60% through implementation)
identify_weak_categories(category_scores: Dict[str, float], weak_threshold: float = 0.6) -> List[str]
Identify categories below weakness threshold.
Args:
category_scores: Dict mapping category names to scores (0.0-1.0)weak_threshold: Score threshold for weakness (default 0.6)
Returns: List of weak category names
Examples:
MaturityCalculator.identify_weak_categories({
"code_quality": 0.4,
"testing": 0.3,
"documentation": 0.8
})
# → ["code_quality", "testing"]
calculate_category_improvement(before: Dict[str, float], after: Dict[str, float]) -> Dict[str, float]
Calculate improvement in each category.
Args:
before: Category scores before (0.0-1.0)after: Category scores after (0.0-1.0)
Returns: Dict of category → improvement delta
Examples:
MaturityCalculator.calculate_category_improvement(
{"quality": 0.4},
{"quality": 0.6}
)
# → {"quality": 0.2}
Data Models
CategoryScore
Per-category maturity score within a phase.
Fields:
category: str- Category namecurrent_score: float- Current score (0.0-1.0)target_score: float- Target score (0.0-1.0)confidence: float- Confidence in scorespec_count: int- Number of specs in category
Properties:
percentage: float- Percentage of target achievedis_complete: bool- Has reached target?
PhaseMaturity
Complete maturity information for a phase.
Fields:
phase: str- Phase nameoverall_score: float- Phase overall score (0-100%)category_scores: Dict[str, CategoryScore]- Per-category scorestotal_specs: int- Total specs in phasemissing_categories: List[str]- Categories below targetstrongest_categories: List[str]- Categories at/above targetweakest_categories: List[str]- Weakest categoriesis_ready_to_advance: bool- Can move to next phase?warnings: List[str]- Any warnings
MaturityEvent
Historical maturity change event.
Fields:
timestamp: datetime- When event occurredphase: str- Phase involvedscore_before: float- Score before eventscore_after: float- Score after eventdelta: float- Change in scoreevent_type: str- Type of eventdetails: Dict[str, Any]- Additional details
How It Drives Agent Coordination
This maturity system is used by the Socrates AI agent coordination layer:
- QualityController analyzes code and calculates maturity
- SkillGenerator detects weak categories from maturity data
- SkillGenerator creates adaptive skills for weak areas
- Target agents receive skills and adjust their behavior
- LearningAgent tracks which skills were effective
- System updates maturity as weak areas improve
- Cycle repeats with higher maturity and better recommendations
Example workflow:
# 1. Calculate maturity
overall = MaturityCalculator.calculate_overall_maturity(
{"discovery": 1.0, "analysis": 0.3}
) # → 0.65
# 2. Identify weak categories
current_phase = MaturityCalculator.estimate_current_phase(overall) # → "design"
weak_categories = MaturityCalculator.identify_weak_categories({
"functional_requirements": 0.4,
"non_functional_requirements": 0.5,
"data_requirements": 0.8
}) # → ["functional_requirements", "non_functional_requirements"]
# 3. SkillGenerator creates skills for weak areas
# (skills generation happens in socratic-agents)
# 4. Agents apply skills, improving weak areas
# → After improvements, maturity increases to 0.72
Testing
Run the test suite:
pytest tests/
With coverage:
pytest --cov=src/socrates_maturity tests/
Design Principles
Pure Functions
All calculation functions are pure - same input always produces same output, with no side effects.
Deterministic
Completely deterministic and stateless. Can be used in parallel or distributed systems.
Flexible
Works with any phase or category naming scheme. Not tied to Socrates specifically.
Extensible
Easy to add new phases, categories, or calculation rules.
License
MIT
Contributing
Contributions welcome! Please ensure:
- Tests pass:
pytest - Code formatted:
black src/ - No linting issues:
ruff check src/ - Type hints present:
mypy src/
More Information
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
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 socratic_maturity-0.2.0.tar.gz.
File metadata
- Download URL: socratic_maturity-0.2.0.tar.gz
- Upload date:
- Size: 14.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a4e51d2178d6d41d2c10ff1f92413ed85eb7d266ec861be961be2ebcfe9965a
|
|
| MD5 |
10ed8cd081c57d7582e76baf7323cf6a
|
|
| BLAKE2b-256 |
499f532d5789394951ecf16a058728f7b93a4a077230a5137a0eb7f603fe00c9
|
File details
Details for the file socratic_maturity-0.2.0-py3-none-any.whl.
File metadata
- Download URL: socratic_maturity-0.2.0-py3-none-any.whl
- Upload date:
- Size: 13.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
31dce31a8706da4e1cb17ee9e04c4ac36bdebaa454f9ac6cb1311bab277f4294
|
|
| MD5 |
ae5b9975e67c561d5ee9cb757d15531c
|
|
| BLAKE2b-256 |
cd0170a7cdb84ff9fdb8d2182accd444ee25467746fabb996eba4135d05ade5e
|