empathy-framework 3.7.0__py3-none-any.whl → 3.8.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- coach_wizards/code_reviewer_README.md +60 -0
- coach_wizards/code_reviewer_wizard.py +180 -0
- {empathy_framework-3.7.0.dist-info → empathy_framework-3.8.0.dist-info}/METADATA +148 -11
- empathy_framework-3.8.0.dist-info/RECORD +333 -0
- {empathy_framework-3.7.0.dist-info → empathy_framework-3.8.0.dist-info}/top_level.txt +5 -1
- empathy_healthcare_plugin/monitors/__init__.py +9 -0
- empathy_healthcare_plugin/monitors/clinical_protocol_monitor.py +315 -0
- empathy_healthcare_plugin/monitors/monitoring/__init__.py +44 -0
- empathy_healthcare_plugin/monitors/monitoring/protocol_checker.py +300 -0
- empathy_healthcare_plugin/monitors/monitoring/protocol_loader.py +214 -0
- empathy_healthcare_plugin/monitors/monitoring/sensor_parsers.py +306 -0
- empathy_healthcare_plugin/monitors/monitoring/trajectory_analyzer.py +389 -0
- empathy_llm_toolkit/agent_factory/__init__.py +53 -0
- empathy_llm_toolkit/agent_factory/adapters/__init__.py +85 -0
- empathy_llm_toolkit/agent_factory/adapters/autogen_adapter.py +312 -0
- empathy_llm_toolkit/agent_factory/adapters/crewai_adapter.py +454 -0
- empathy_llm_toolkit/agent_factory/adapters/haystack_adapter.py +298 -0
- empathy_llm_toolkit/agent_factory/adapters/langchain_adapter.py +362 -0
- empathy_llm_toolkit/agent_factory/adapters/langgraph_adapter.py +333 -0
- empathy_llm_toolkit/agent_factory/adapters/native.py +228 -0
- empathy_llm_toolkit/agent_factory/adapters/wizard_adapter.py +426 -0
- empathy_llm_toolkit/agent_factory/base.py +305 -0
- empathy_llm_toolkit/agent_factory/crews/__init__.py +67 -0
- empathy_llm_toolkit/agent_factory/crews/code_review.py +1113 -0
- empathy_llm_toolkit/agent_factory/crews/health_check.py +1246 -0
- empathy_llm_toolkit/agent_factory/crews/refactoring.py +1128 -0
- empathy_llm_toolkit/agent_factory/crews/security_audit.py +1018 -0
- empathy_llm_toolkit/agent_factory/decorators.py +286 -0
- empathy_llm_toolkit/agent_factory/factory.py +558 -0
- empathy_llm_toolkit/agent_factory/framework.py +192 -0
- empathy_llm_toolkit/agent_factory/memory_integration.py +324 -0
- empathy_llm_toolkit/agent_factory/resilient.py +320 -0
- empathy_llm_toolkit/cli/__init__.py +8 -0
- empathy_llm_toolkit/cli/sync_claude.py +487 -0
- empathy_llm_toolkit/code_health.py +150 -3
- empathy_llm_toolkit/config/__init__.py +29 -0
- empathy_llm_toolkit/config/unified.py +295 -0
- empathy_llm_toolkit/routing/__init__.py +32 -0
- empathy_llm_toolkit/routing/model_router.py +362 -0
- empathy_llm_toolkit/security/IMPLEMENTATION_SUMMARY.md +413 -0
- empathy_llm_toolkit/security/PHASE2_COMPLETE.md +384 -0
- empathy_llm_toolkit/security/PHASE2_SECRETS_DETECTOR_COMPLETE.md +271 -0
- empathy_llm_toolkit/security/QUICK_REFERENCE.md +316 -0
- empathy_llm_toolkit/security/README.md +262 -0
- empathy_llm_toolkit/security/__init__.py +62 -0
- empathy_llm_toolkit/security/audit_logger.py +929 -0
- empathy_llm_toolkit/security/audit_logger_example.py +152 -0
- empathy_llm_toolkit/security/pii_scrubber.py +640 -0
- empathy_llm_toolkit/security/secrets_detector.py +678 -0
- empathy_llm_toolkit/security/secrets_detector_example.py +304 -0
- empathy_llm_toolkit/security/secure_memdocs.py +1192 -0
- empathy_llm_toolkit/security/secure_memdocs_example.py +278 -0
- empathy_llm_toolkit/wizards/__init__.py +38 -0
- empathy_llm_toolkit/wizards/base_wizard.py +364 -0
- empathy_llm_toolkit/wizards/customer_support_wizard.py +190 -0
- empathy_llm_toolkit/wizards/healthcare_wizard.py +362 -0
- empathy_llm_toolkit/wizards/patient_assessment_README.md +64 -0
- empathy_llm_toolkit/wizards/patient_assessment_wizard.py +193 -0
- empathy_llm_toolkit/wizards/technology_wizard.py +194 -0
- empathy_os/__init__.py +52 -52
- empathy_os/adaptive/__init__.py +13 -0
- empathy_os/adaptive/task_complexity.py +127 -0
- empathy_os/cache/__init__.py +117 -0
- empathy_os/cache/base.py +166 -0
- empathy_os/cache/dependency_manager.py +253 -0
- empathy_os/cache/hash_only.py +248 -0
- empathy_os/cache/hybrid.py +390 -0
- empathy_os/cache/storage.py +282 -0
- empathy_os/cli.py +118 -8
- empathy_os/cli_unified.py +121 -1
- empathy_os/config/__init__.py +63 -0
- empathy_os/config/xml_config.py +239 -0
- empathy_os/config.py +2 -1
- empathy_os/dashboard/__init__.py +15 -0
- empathy_os/dashboard/server.py +743 -0
- empathy_os/memory/__init__.py +195 -0
- empathy_os/memory/claude_memory.py +466 -0
- empathy_os/memory/config.py +224 -0
- empathy_os/memory/control_panel.py +1298 -0
- empathy_os/memory/edges.py +179 -0
- empathy_os/memory/graph.py +567 -0
- empathy_os/memory/long_term.py +1194 -0
- empathy_os/memory/nodes.py +179 -0
- empathy_os/memory/redis_bootstrap.py +540 -0
- empathy_os/memory/security/__init__.py +31 -0
- empathy_os/memory/security/audit_logger.py +930 -0
- empathy_os/memory/security/pii_scrubber.py +640 -0
- empathy_os/memory/security/secrets_detector.py +678 -0
- empathy_os/memory/short_term.py +2119 -0
- empathy_os/memory/storage/__init__.py +15 -0
- empathy_os/memory/summary_index.py +583 -0
- empathy_os/memory/unified.py +619 -0
- empathy_os/metrics/__init__.py +12 -0
- empathy_os/metrics/prompt_metrics.py +190 -0
- empathy_os/models/__init__.py +136 -0
- empathy_os/models/__main__.py +13 -0
- empathy_os/models/cli.py +655 -0
- empathy_os/models/empathy_executor.py +354 -0
- empathy_os/models/executor.py +252 -0
- empathy_os/models/fallback.py +671 -0
- empathy_os/models/provider_config.py +563 -0
- empathy_os/models/registry.py +382 -0
- empathy_os/models/tasks.py +302 -0
- empathy_os/models/telemetry.py +548 -0
- empathy_os/models/token_estimator.py +378 -0
- empathy_os/models/validation.py +274 -0
- empathy_os/monitoring/__init__.py +52 -0
- empathy_os/monitoring/alerts.py +23 -0
- empathy_os/monitoring/alerts_cli.py +268 -0
- empathy_os/monitoring/multi_backend.py +271 -0
- empathy_os/monitoring/otel_backend.py +363 -0
- empathy_os/optimization/__init__.py +19 -0
- empathy_os/optimization/context_optimizer.py +272 -0
- empathy_os/plugins/__init__.py +28 -0
- empathy_os/plugins/base.py +361 -0
- empathy_os/plugins/registry.py +268 -0
- empathy_os/project_index/__init__.py +30 -0
- empathy_os/project_index/cli.py +335 -0
- empathy_os/project_index/crew_integration.py +430 -0
- empathy_os/project_index/index.py +425 -0
- empathy_os/project_index/models.py +501 -0
- empathy_os/project_index/reports.py +473 -0
- empathy_os/project_index/scanner.py +538 -0
- empathy_os/prompts/__init__.py +61 -0
- empathy_os/prompts/config.py +77 -0
- empathy_os/prompts/context.py +177 -0
- empathy_os/prompts/parser.py +285 -0
- empathy_os/prompts/registry.py +313 -0
- empathy_os/prompts/templates.py +208 -0
- empathy_os/resilience/__init__.py +56 -0
- empathy_os/resilience/circuit_breaker.py +256 -0
- empathy_os/resilience/fallback.py +179 -0
- empathy_os/resilience/health.py +300 -0
- empathy_os/resilience/retry.py +209 -0
- empathy_os/resilience/timeout.py +135 -0
- empathy_os/routing/__init__.py +43 -0
- empathy_os/routing/chain_executor.py +433 -0
- empathy_os/routing/classifier.py +217 -0
- empathy_os/routing/smart_router.py +234 -0
- empathy_os/routing/wizard_registry.py +307 -0
- empathy_os/trust/__init__.py +28 -0
- empathy_os/trust/circuit_breaker.py +579 -0
- empathy_os/validation/__init__.py +19 -0
- empathy_os/validation/xml_validator.py +281 -0
- empathy_os/wizard_factory_cli.py +170 -0
- empathy_os/workflows/__init__.py +360 -0
- empathy_os/workflows/base.py +1660 -0
- empathy_os/workflows/bug_predict.py +962 -0
- empathy_os/workflows/code_review.py +960 -0
- empathy_os/workflows/code_review_adapters.py +310 -0
- empathy_os/workflows/code_review_pipeline.py +720 -0
- empathy_os/workflows/config.py +600 -0
- empathy_os/workflows/dependency_check.py +648 -0
- empathy_os/workflows/document_gen.py +1069 -0
- empathy_os/workflows/documentation_orchestrator.py +1205 -0
- empathy_os/workflows/health_check.py +679 -0
- empathy_os/workflows/keyboard_shortcuts/__init__.py +39 -0
- empathy_os/workflows/keyboard_shortcuts/generators.py +386 -0
- empathy_os/workflows/keyboard_shortcuts/parsers.py +414 -0
- empathy_os/workflows/keyboard_shortcuts/prompts.py +295 -0
- empathy_os/workflows/keyboard_shortcuts/schema.py +193 -0
- empathy_os/workflows/keyboard_shortcuts/workflow.py +505 -0
- empathy_os/workflows/manage_documentation.py +804 -0
- empathy_os/workflows/new_sample_workflow1.py +146 -0
- empathy_os/workflows/new_sample_workflow1_README.md +150 -0
- empathy_os/workflows/perf_audit.py +687 -0
- empathy_os/workflows/pr_review.py +748 -0
- empathy_os/workflows/progress.py +445 -0
- empathy_os/workflows/progress_server.py +322 -0
- empathy_os/workflows/refactor_plan.py +693 -0
- empathy_os/workflows/release_prep.py +808 -0
- empathy_os/workflows/research_synthesis.py +404 -0
- empathy_os/workflows/secure_release.py +585 -0
- empathy_os/workflows/security_adapters.py +297 -0
- empathy_os/workflows/security_audit.py +1046 -0
- empathy_os/workflows/step_config.py +234 -0
- empathy_os/workflows/test5.py +125 -0
- empathy_os/workflows/test5_README.md +158 -0
- empathy_os/workflows/test_gen.py +1855 -0
- empathy_os/workflows/test_lifecycle.py +526 -0
- empathy_os/workflows/test_maintenance.py +626 -0
- empathy_os/workflows/test_maintenance_cli.py +590 -0
- empathy_os/workflows/test_maintenance_crew.py +821 -0
- empathy_os/workflows/xml_enhanced_crew.py +285 -0
- empathy_software_plugin/cli/__init__.py +120 -0
- empathy_software_plugin/cli/inspect.py +362 -0
- empathy_software_plugin/cli.py +3 -1
- empathy_software_plugin/wizards/__init__.py +42 -0
- empathy_software_plugin/wizards/advanced_debugging_wizard.py +392 -0
- empathy_software_plugin/wizards/agent_orchestration_wizard.py +511 -0
- empathy_software_plugin/wizards/ai_collaboration_wizard.py +503 -0
- empathy_software_plugin/wizards/ai_context_wizard.py +441 -0
- empathy_software_plugin/wizards/ai_documentation_wizard.py +503 -0
- empathy_software_plugin/wizards/base_wizard.py +288 -0
- empathy_software_plugin/wizards/book_chapter_wizard.py +519 -0
- empathy_software_plugin/wizards/code_review_wizard.py +606 -0
- empathy_software_plugin/wizards/debugging/__init__.py +50 -0
- empathy_software_plugin/wizards/debugging/bug_risk_analyzer.py +414 -0
- empathy_software_plugin/wizards/debugging/config_loaders.py +442 -0
- empathy_software_plugin/wizards/debugging/fix_applier.py +469 -0
- empathy_software_plugin/wizards/debugging/language_patterns.py +383 -0
- empathy_software_plugin/wizards/debugging/linter_parsers.py +470 -0
- empathy_software_plugin/wizards/debugging/verification.py +369 -0
- empathy_software_plugin/wizards/enhanced_testing_wizard.py +537 -0
- empathy_software_plugin/wizards/memory_enhanced_debugging_wizard.py +816 -0
- empathy_software_plugin/wizards/multi_model_wizard.py +501 -0
- empathy_software_plugin/wizards/pattern_extraction_wizard.py +422 -0
- empathy_software_plugin/wizards/pattern_retriever_wizard.py +400 -0
- empathy_software_plugin/wizards/performance/__init__.py +9 -0
- empathy_software_plugin/wizards/performance/bottleneck_detector.py +221 -0
- empathy_software_plugin/wizards/performance/profiler_parsers.py +278 -0
- empathy_software_plugin/wizards/performance/trajectory_analyzer.py +429 -0
- empathy_software_plugin/wizards/performance_profiling_wizard.py +305 -0
- empathy_software_plugin/wizards/prompt_engineering_wizard.py +425 -0
- empathy_software_plugin/wizards/rag_pattern_wizard.py +461 -0
- empathy_software_plugin/wizards/security/__init__.py +32 -0
- empathy_software_plugin/wizards/security/exploit_analyzer.py +290 -0
- empathy_software_plugin/wizards/security/owasp_patterns.py +241 -0
- empathy_software_plugin/wizards/security/vulnerability_scanner.py +604 -0
- empathy_software_plugin/wizards/security_analysis_wizard.py +322 -0
- empathy_software_plugin/wizards/security_learning_wizard.py +740 -0
- empathy_software_plugin/wizards/tech_debt_wizard.py +726 -0
- empathy_software_plugin/wizards/testing/__init__.py +27 -0
- empathy_software_plugin/wizards/testing/coverage_analyzer.py +459 -0
- empathy_software_plugin/wizards/testing/quality_analyzer.py +531 -0
- empathy_software_plugin/wizards/testing/test_suggester.py +533 -0
- empathy_software_plugin/wizards/testing_wizard.py +274 -0
- hot_reload/README.md +473 -0
- hot_reload/__init__.py +62 -0
- hot_reload/config.py +84 -0
- hot_reload/integration.py +228 -0
- hot_reload/reloader.py +298 -0
- hot_reload/watcher.py +179 -0
- hot_reload/websocket.py +176 -0
- scaffolding/README.md +589 -0
- scaffolding/__init__.py +35 -0
- scaffolding/__main__.py +14 -0
- scaffolding/cli.py +240 -0
- test_generator/__init__.py +38 -0
- test_generator/__main__.py +14 -0
- test_generator/cli.py +226 -0
- test_generator/generator.py +325 -0
- test_generator/risk_analyzer.py +216 -0
- workflow_patterns/__init__.py +33 -0
- workflow_patterns/behavior.py +249 -0
- workflow_patterns/core.py +76 -0
- workflow_patterns/output.py +99 -0
- workflow_patterns/registry.py +255 -0
- workflow_patterns/structural.py +288 -0
- workflow_scaffolding/__init__.py +11 -0
- workflow_scaffolding/__main__.py +12 -0
- workflow_scaffolding/cli.py +206 -0
- workflow_scaffolding/generator.py +265 -0
- agents/code_inspection/patterns/inspection/recurring_B112.json +0 -18
- agents/code_inspection/patterns/inspection/recurring_F541.json +0 -16
- agents/code_inspection/patterns/inspection/recurring_FORMAT.json +0 -25
- agents/code_inspection/patterns/inspection/recurring_bug_20250822_def456.json +0 -16
- agents/code_inspection/patterns/inspection/recurring_bug_20250915_abc123.json +0 -16
- agents/code_inspection/patterns/inspection/recurring_bug_20251212_3c5b9951.json +0 -16
- agents/code_inspection/patterns/inspection/recurring_bug_20251212_97c0f72f.json +0 -16
- agents/code_inspection/patterns/inspection/recurring_bug_20251212_a0871d53.json +0 -16
- agents/code_inspection/patterns/inspection/recurring_bug_20251212_a9b6ec41.json +0 -16
- agents/code_inspection/patterns/inspection/recurring_bug_null_001.json +0 -16
- agents/code_inspection/patterns/inspection/recurring_builtin.json +0 -16
- agents/compliance_anticipation_agent.py +0 -1422
- agents/compliance_db.py +0 -339
- agents/epic_integration_wizard.py +0 -530
- agents/notifications.py +0 -291
- agents/trust_building_behaviors.py +0 -872
- empathy_framework-3.7.0.dist-info/RECORD +0 -105
- {empathy_framework-3.7.0.dist-info → empathy_framework-3.8.0.dist-info}/WHEEL +0 -0
- {empathy_framework-3.7.0.dist-info → empathy_framework-3.8.0.dist-info}/entry_points.txt +0 -0
- {empathy_framework-3.7.0.dist-info → empathy_framework-3.8.0.dist-info}/licenses/LICENSE +0 -0
- /empathy_os/{monitoring.py → agent_monitoring.py} +0 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Code Reviewer Wizard
|
|
2
|
+
|
|
3
|
+
**Domain:** software
|
|
4
|
+
**Type:** Wizard
|
|
5
|
+
**Generated:** Pattern-Compose Methodology
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
Auto-generated wizard using proven patterns from the Empathy Framework.
|
|
10
|
+
|
|
11
|
+
## Patterns Used
|
|
12
|
+
|
|
13
|
+
- **Empathy Level**: 0-4 empathy level configuration
|
|
14
|
+
- **User Guidance**: Help text, examples, and prompts
|
|
15
|
+
- **Code Analysis Input**: Standard code analysis input (code, file_path, language)
|
|
16
|
+
- **Risk Assessment**: Level 4 Anticipatory risk analysis
|
|
17
|
+
- **Prediction**: Level 4 Anticipatory prediction of future issues
|
|
18
|
+
- **Config Validation**: Validate wizard configuration on initialization
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```python
|
|
23
|
+
from coach_wizards.code_reviewer_wizard import CodeReviewerWizard
|
|
24
|
+
|
|
25
|
+
wizard = CodeReviewerWizard()
|
|
26
|
+
result = await wizard.process(user_input="...")
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## API Endpoints
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Process with wizard
|
|
33
|
+
POST /api/wizard/code_reviewer/process
|
|
34
|
+
{
|
|
35
|
+
"input": "your input here",
|
|
36
|
+
"context": {}
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Testing
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# Run unit tests
|
|
44
|
+
pytest tests/unit/wizards/test_code_reviewer_wizard.py
|
|
45
|
+
|
|
46
|
+
# Run with coverage
|
|
47
|
+
pytest tests/unit/wizards/test_code_reviewer_wizard.py --cov
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Next Steps
|
|
51
|
+
|
|
52
|
+
1. Customize wizard logic as needed
|
|
53
|
+
2. Add domain-specific validation
|
|
54
|
+
3. Extend with additional features
|
|
55
|
+
4. Update tests for custom logic
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
**Generated by:** Empathy Framework - Wizard Factory
|
|
60
|
+
**Methodology:** Pattern-Compose
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
"""Code reviewer Coach Wizard.
|
|
2
|
+
|
|
3
|
+
Auto-generated by Empathy Framework Scaffolding
|
|
4
|
+
Methodology: pattern-compose
|
|
5
|
+
Domain: software
|
|
6
|
+
Patterns: empathy_level, user_guidance, code_analysis_input, risk_assessment, prediction, config_validation
|
|
7
|
+
Generated: 2026-01-05T20:15:45.111917
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import logging
|
|
11
|
+
from typing import Any
|
|
12
|
+
|
|
13
|
+
from fastapi import APIRouter, HTTPException
|
|
14
|
+
from pydantic import BaseModel, Field
|
|
15
|
+
|
|
16
|
+
from patterns import get_pattern_registry
|
|
17
|
+
|
|
18
|
+
logger = logging.getLogger(__name__)
|
|
19
|
+
|
|
20
|
+
router = APIRouter(prefix="/code_reviewer", tags=["code_reviewer"])
|
|
21
|
+
|
|
22
|
+
# Pattern registry for recommendations
|
|
23
|
+
registry = get_pattern_registry()
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
# Request/Response Models
|
|
27
|
+
class AnalysisRequest(BaseModel):
|
|
28
|
+
"""Request to analyze code."""
|
|
29
|
+
|
|
30
|
+
code: str = Field(..., description="Code to analyze")
|
|
31
|
+
context: dict[str, Any] = Field(default_factory=dict, description="Additional context")
|
|
32
|
+
include_risk_assessment: bool = Field(default=True, description="Include risk analysis")
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class AnalysisResult(BaseModel):
|
|
36
|
+
"""Analysis result."""
|
|
37
|
+
|
|
38
|
+
wizard_id: str
|
|
39
|
+
analysis: dict[str, Any]
|
|
40
|
+
risk_assessment: dict[str, Any] | None = None
|
|
41
|
+
predictions: list[dict[str, Any]] = Field(default_factory=list)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
# In-memory session storage (replace with Redis in production)
|
|
45
|
+
sessions: dict[str, dict[str, Any]] = {}
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
@router.post("/analyze", response_model=AnalysisResult)
|
|
49
|
+
async def analyze_code(request: AnalysisRequest) -> AnalysisResult:
|
|
50
|
+
"""Analyze code and provide recommendations.
|
|
51
|
+
|
|
52
|
+
Args:
|
|
53
|
+
request: Analysis request with code and context
|
|
54
|
+
|
|
55
|
+
Returns:
|
|
56
|
+
Analysis results with recommendations
|
|
57
|
+
|
|
58
|
+
Raises:
|
|
59
|
+
HTTPException: If analysis fails
|
|
60
|
+
"""
|
|
61
|
+
try:
|
|
62
|
+
# Create session
|
|
63
|
+
wizard_id = f"code_reviewer_{len(sessions) + 1}"
|
|
64
|
+
|
|
65
|
+
# Perform code analysis
|
|
66
|
+
analysis = await _analyze_code(request.code, request.context)
|
|
67
|
+
|
|
68
|
+
result = AnalysisResult(
|
|
69
|
+
wizard_id=wizard_id,
|
|
70
|
+
analysis=analysis,
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
# Perform risk assessment
|
|
74
|
+
if request.include_risk_assessment:
|
|
75
|
+
risk_assessment = await _assess_risk(analysis)
|
|
76
|
+
result.risk_assessment = risk_assessment
|
|
77
|
+
|
|
78
|
+
# Generate predictions
|
|
79
|
+
predictions = await _generate_predictions(analysis)
|
|
80
|
+
result.predictions = predictions
|
|
81
|
+
|
|
82
|
+
# Store session
|
|
83
|
+
sessions[wizard_id] = {
|
|
84
|
+
"wizard_id": wizard_id,
|
|
85
|
+
"code": request.code,
|
|
86
|
+
"analysis": analysis,
|
|
87
|
+
"result": result.model_dump(),
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
logger.info(f"Analysis complete for {wizard_id}")
|
|
91
|
+
return result
|
|
92
|
+
|
|
93
|
+
except Exception as e:
|
|
94
|
+
logger.exception(f"Analysis failed: {e}")
|
|
95
|
+
raise HTTPException(status_code=500, detail=f"Analysis failed: {str(e)}")
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
@router.get("/{wizard_id}/report", response_model=dict[str, Any])
|
|
99
|
+
async def get_report(wizard_id: str) -> dict[str, Any]:
|
|
100
|
+
"""Get analysis report.
|
|
101
|
+
|
|
102
|
+
Args:
|
|
103
|
+
wizard_id: Wizard session ID
|
|
104
|
+
|
|
105
|
+
Returns:
|
|
106
|
+
Complete analysis report
|
|
107
|
+
|
|
108
|
+
Raises:
|
|
109
|
+
HTTPException: If session not found
|
|
110
|
+
"""
|
|
111
|
+
if wizard_id not in sessions:
|
|
112
|
+
raise HTTPException(status_code=404, detail="Session not found")
|
|
113
|
+
|
|
114
|
+
session = sessions[wizard_id]
|
|
115
|
+
return {
|
|
116
|
+
"wizard_id": wizard_id,
|
|
117
|
+
"analysis": session["analysis"],
|
|
118
|
+
"result": session["result"],
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
# Helper functions
|
|
123
|
+
async def _analyze_code(code: str, context: dict[str, Any]) -> dict[str, Any]:
|
|
124
|
+
"""Analyze code (placeholder - implement actual analysis).
|
|
125
|
+
|
|
126
|
+
Args:
|
|
127
|
+
code: Code to analyze
|
|
128
|
+
context: Additional context
|
|
129
|
+
|
|
130
|
+
Returns:
|
|
131
|
+
Analysis results
|
|
132
|
+
"""
|
|
133
|
+
# TODO: Implement actual code analysis
|
|
134
|
+
return {
|
|
135
|
+
"lines_of_code": len(code.split("\n")),
|
|
136
|
+
"complexity": "medium",
|
|
137
|
+
"issues_found": 0,
|
|
138
|
+
"context": context,
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
async def _assess_risk(analysis: dict[str, Any]) -> dict[str, Any]:
|
|
143
|
+
"""Assess risk based on analysis.
|
|
144
|
+
|
|
145
|
+
Args:
|
|
146
|
+
analysis: Code analysis results
|
|
147
|
+
|
|
148
|
+
Returns:
|
|
149
|
+
Risk assessment
|
|
150
|
+
"""
|
|
151
|
+
# TODO: Implement actual risk assessment
|
|
152
|
+
return {
|
|
153
|
+
"alert_level": "LOW",
|
|
154
|
+
"risk_score": 0.2,
|
|
155
|
+
"by_risk_level": {
|
|
156
|
+
"critical": 0,
|
|
157
|
+
"high": 0,
|
|
158
|
+
"medium": 0,
|
|
159
|
+
"low": 0,
|
|
160
|
+
},
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
async def _generate_predictions(analysis: dict[str, Any]) -> list[dict[str, Any]]:
|
|
165
|
+
"""Generate predictions about future issues.
|
|
166
|
+
|
|
167
|
+
Args:
|
|
168
|
+
analysis: Code analysis results
|
|
169
|
+
|
|
170
|
+
Returns:
|
|
171
|
+
List of predictions
|
|
172
|
+
"""
|
|
173
|
+
# TODO: Implement actual predictions
|
|
174
|
+
return [
|
|
175
|
+
{
|
|
176
|
+
"type": "performance",
|
|
177
|
+
"confidence": 0.8,
|
|
178
|
+
"description": "May experience performance issues with large datasets",
|
|
179
|
+
}
|
|
180
|
+
]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: empathy-framework
|
|
3
|
-
Version: 3.
|
|
4
|
-
Summary: AI collaboration framework with
|
|
3
|
+
Version: 3.8.0
|
|
4
|
+
Summary: AI collaboration framework with intelligent caching (up to 57% cache hit rate), tier routing (34-86% cost savings depending on task complexity), XML-enhanced prompts, persistent memory, CrewAI integration, and multi-agent orchestration. Includes HIPAA-compliant healthcare wizards.
|
|
5
5
|
Author-email: Patrick Roebuck <admin@smartaimemory.com>
|
|
6
6
|
Maintainer-email: Smart-AI-Memory <admin@smartaimemory.com>
|
|
7
7
|
License: # Fair Source License, version 0.9
|
|
@@ -174,6 +174,11 @@ Requires-Dist: structlog<25.0.0,>=23.0.0
|
|
|
174
174
|
Requires-Dist: defusedxml<1.0.0,>=0.7.0
|
|
175
175
|
Requires-Dist: rich<14.0.0,>=13.0.0
|
|
176
176
|
Requires-Dist: typer<1.0.0,>=0.9.0
|
|
177
|
+
Requires-Dist: pyyaml<7.0,>=6.0
|
|
178
|
+
Requires-Dist: anthropic<1.0.0,>=0.25.0
|
|
179
|
+
Requires-Dist: crewai<1.0.0,>=0.1.0
|
|
180
|
+
Requires-Dist: langchain<1.0.0,>=0.1.0
|
|
181
|
+
Requires-Dist: langchain-core<1.0.0,>=0.1.0
|
|
177
182
|
Provides-Extra: anthropic
|
|
178
183
|
Requires-Dist: anthropic<1.0.0,>=0.25.0; extra == "anthropic"
|
|
179
184
|
Provides-Extra: openai
|
|
@@ -195,6 +200,10 @@ Requires-Dist: langgraph-checkpoint<4.0.0,>=3.0.0; extra == "agents"
|
|
|
195
200
|
Requires-Dist: marshmallow<5.0.0,>=4.1.2; extra == "agents"
|
|
196
201
|
Provides-Extra: crewai
|
|
197
202
|
Requires-Dist: crewai<1.0.0,>=0.1.0; extra == "crewai"
|
|
203
|
+
Provides-Extra: cache
|
|
204
|
+
Requires-Dist: sentence-transformers<4.0.0,>=2.0.0; extra == "cache"
|
|
205
|
+
Requires-Dist: torch<3.0.0,>=2.0.0; extra == "cache"
|
|
206
|
+
Requires-Dist: numpy<3.0.0,>=1.24.0; extra == "cache"
|
|
198
207
|
Provides-Extra: healthcare
|
|
199
208
|
Requires-Dist: anthropic<1.0.0,>=0.25.0; extra == "healthcare"
|
|
200
209
|
Requires-Dist: openai<2.0.0,>=1.12.0; extra == "healthcare"
|
|
@@ -213,6 +222,9 @@ Requires-Dist: uvicorn<1.0.0,>=0.20.0; extra == "healthcare"
|
|
|
213
222
|
Requires-Dist: starlette<1.0.0,>=0.40.0; extra == "healthcare"
|
|
214
223
|
Requires-Dist: bcrypt<5.0.0,>=4.0.0; extra == "healthcare"
|
|
215
224
|
Requires-Dist: PyJWT[crypto]>=2.8.0; extra == "healthcare"
|
|
225
|
+
Requires-Dist: opentelemetry-api<2.0.0,>=1.20.0; extra == "healthcare"
|
|
226
|
+
Requires-Dist: opentelemetry-sdk<2.0.0,>=1.20.0; extra == "healthcare"
|
|
227
|
+
Requires-Dist: opentelemetry-exporter-otlp-proto-grpc<2.0.0,>=1.20.0; extra == "healthcare"
|
|
216
228
|
Requires-Dist: redis<6.0.0,>=5.0.0; extra == "healthcare"
|
|
217
229
|
Provides-Extra: software
|
|
218
230
|
Requires-Dist: python-docx<1.0.0,>=0.8.11; extra == "software"
|
|
@@ -228,6 +240,10 @@ Requires-Dist: pygls<2.0.0,>=1.0.0; extra == "lsp"
|
|
|
228
240
|
Requires-Dist: lsprotocol<2024.0.0,>=2023.0.0; extra == "lsp"
|
|
229
241
|
Provides-Extra: windows
|
|
230
242
|
Requires-Dist: colorama<1.0.0,>=0.4.6; extra == "windows"
|
|
243
|
+
Provides-Extra: otel
|
|
244
|
+
Requires-Dist: opentelemetry-api<2.0.0,>=1.20.0; extra == "otel"
|
|
245
|
+
Requires-Dist: opentelemetry-sdk<2.0.0,>=1.20.0; extra == "otel"
|
|
246
|
+
Requires-Dist: opentelemetry-exporter-otlp-proto-grpc<2.0.0,>=1.20.0; extra == "otel"
|
|
231
247
|
Provides-Extra: docs
|
|
232
248
|
Requires-Dist: mkdocs<2.0.0,>=1.5.0; extra == "docs"
|
|
233
249
|
Requires-Dist: mkdocs-material<10.0.0,>=9.4.0; extra == "docs"
|
|
@@ -277,6 +293,9 @@ Requires-Dist: uvicorn<1.0.0,>=0.20.0; extra == "enterprise"
|
|
|
277
293
|
Requires-Dist: starlette<1.0.0,>=0.40.0; extra == "enterprise"
|
|
278
294
|
Requires-Dist: bcrypt<5.0.0,>=4.0.0; extra == "enterprise"
|
|
279
295
|
Requires-Dist: PyJWT[crypto]>=2.8.0; extra == "enterprise"
|
|
296
|
+
Requires-Dist: opentelemetry-api<2.0.0,>=1.20.0; extra == "enterprise"
|
|
297
|
+
Requires-Dist: opentelemetry-sdk<2.0.0,>=1.20.0; extra == "enterprise"
|
|
298
|
+
Requires-Dist: opentelemetry-exporter-otlp-proto-grpc<2.0.0,>=1.20.0; extra == "enterprise"
|
|
280
299
|
Provides-Extra: full
|
|
281
300
|
Requires-Dist: anthropic<1.0.0,>=0.25.0; extra == "full"
|
|
282
301
|
Requires-Dist: openai<2.0.0,>=1.12.0; extra == "full"
|
|
@@ -311,6 +330,9 @@ Requires-Dist: PyJWT[crypto]>=2.8.0; extra == "all"
|
|
|
311
330
|
Requires-Dist: pygls<2.0.0,>=1.0.0; extra == "all"
|
|
312
331
|
Requires-Dist: lsprotocol<2024.0.0,>=2023.0.0; extra == "all"
|
|
313
332
|
Requires-Dist: colorama<1.0.0,>=0.4.6; extra == "all"
|
|
333
|
+
Requires-Dist: opentelemetry-api<2.0.0,>=1.20.0; extra == "all"
|
|
334
|
+
Requires-Dist: opentelemetry-sdk<2.0.0,>=1.20.0; extra == "all"
|
|
335
|
+
Requires-Dist: opentelemetry-exporter-otlp-proto-grpc<2.0.0,>=1.20.0; extra == "all"
|
|
314
336
|
Requires-Dist: mkdocs<2.0.0,>=1.5.0; extra == "all"
|
|
315
337
|
Requires-Dist: mkdocs-material<10.0.0,>=9.4.0; extra == "all"
|
|
316
338
|
Requires-Dist: mkdocstrings[python]<1.0.0,>=0.24.0; extra == "all"
|
|
@@ -503,9 +525,11 @@ See ESLintParser, PylintParser, or MyPyParser for examples.
|
|
|
503
525
|
### Previous (v3.0.x)
|
|
504
526
|
|
|
505
527
|
- **Multi-Model Provider System** — Anthropic, OpenAI, Google Gemini, Ollama, or Hybrid mode
|
|
506
|
-
- **
|
|
528
|
+
- **34-86% Cost Savings** — Smart tier routing varies by role: architects 34%, senior devs 65%, junior devs 86%*
|
|
507
529
|
- **VSCode Dashboard** — 10 integrated workflows with input history persistence
|
|
508
530
|
|
|
531
|
+
*See [Cost Savings Analysis](docs/cost-analysis/COST_SAVINGS_BY_ROLE_AND_PROVIDER.md) for your specific use case
|
|
532
|
+
|
|
509
533
|
---
|
|
510
534
|
|
|
511
535
|
## Quick Start (2 Minutes)
|
|
@@ -579,12 +603,106 @@ print(result.prevention_steps) # How to prevent it
|
|
|
579
603
|
| **Predicts future issues** | 30-90 days ahead | No | No |
|
|
580
604
|
| **Persistent memory** | Redis + patterns | No | No |
|
|
581
605
|
| **Multi-provider support** | Claude, GPT-4, Gemini, Ollama | N/A | GPT only |
|
|
582
|
-
| **Cost optimization** |
|
|
606
|
+
| **Cost optimization** | 34-86% savings* | N/A | No |
|
|
583
607
|
| **Your data stays local** | Yes | Cloud | Cloud |
|
|
584
608
|
| **Free for small teams** | ≤5 employees | No | No |
|
|
585
609
|
|
|
586
610
|
---
|
|
587
611
|
|
|
612
|
+
## What's New in v3.8.0
|
|
613
|
+
|
|
614
|
+
### 🚀 **Intelligent Response Caching: Benchmarked Performance**
|
|
615
|
+
|
|
616
|
+
**Stop paying full price for repeated LLM calls. Measured results: up to 99.8% faster, 40% cost reduction on test generation, 57% cache hit rate on security audits.**
|
|
617
|
+
|
|
618
|
+
#### Hybrid Cache: Hash + Semantic Matching
|
|
619
|
+
|
|
620
|
+
```python
|
|
621
|
+
from empathy_os.workflows import SecurityAuditWorkflow
|
|
622
|
+
|
|
623
|
+
# That's it - caching auto-configured!
|
|
624
|
+
workflow = SecurityAuditWorkflow(enable_cache=True)
|
|
625
|
+
result = await workflow.execute(target_path="./src")
|
|
626
|
+
|
|
627
|
+
# Check savings
|
|
628
|
+
print(f"Cost: ${result.cost_report.total_cost:.4f}")
|
|
629
|
+
print(f"Cache hit rate: {result.cost_report.cache_hit_rate:.1f}%")
|
|
630
|
+
print(f"Savings: ${result.cost_report.savings_from_cache:.4f}")
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
**Real Results** (v3.8.0 benchmark - see [CACHING_BENCHMARK_REPORT.md](CACHING_BENCHMARK_REPORT.md)):
|
|
634
|
+
|
|
635
|
+
- **Hash-only cache**: 30.3% average hit rate across 12 workflows, up to 99.8% faster (code review: 17.8s → 0.03s)
|
|
636
|
+
- **Hybrid cache**: Up to 57% hit rate on similar prompts (security audit - benchmarked)
|
|
637
|
+
- **Cost reduction**: 40% on test-generation workflow (measured)
|
|
638
|
+
|
|
639
|
+
#### Two Cache Strategies
|
|
640
|
+
|
|
641
|
+
**Hash-Only Cache** (Default - Zero Dependencies):
|
|
642
|
+
- Perfect for CI/CD and testing
|
|
643
|
+
- 100% hit rate on identical prompts
|
|
644
|
+
- ~5μs lookup time
|
|
645
|
+
- No ML dependencies needed
|
|
646
|
+
|
|
647
|
+
**Hybrid Cache** (Semantic Matching):
|
|
648
|
+
|
|
649
|
+
- Up to 57% hit rate on similar prompts (benchmarked)
|
|
650
|
+
- Understands intent, not just text
|
|
651
|
+
- Install: `pip install empathy-framework[cache]`
|
|
652
|
+
- Best for development and production
|
|
653
|
+
|
|
654
|
+
#### Automatic Setup
|
|
655
|
+
|
|
656
|
+
Framework detects your environment and configures optimal caching:
|
|
657
|
+
|
|
658
|
+
```python
|
|
659
|
+
# First run: Framework checks for sentence-transformers
|
|
660
|
+
# - Found? Uses hybrid cache (semantic matching, up to 57% hit rate)
|
|
661
|
+
# - Missing? Prompts: "Install for semantic matching? (y/n)"
|
|
662
|
+
# - Declined? Falls back to hash-only (100% hit rate on identical prompts)
|
|
663
|
+
# - Any errors? Disables gracefully, workflow continues
|
|
664
|
+
|
|
665
|
+
# Subsequent runs: Cache just works
|
|
666
|
+
```
|
|
667
|
+
|
|
668
|
+
#### The Caching Paradox: Adaptive Workflows
|
|
669
|
+
|
|
670
|
+
**Discovered during v3.8.0 development**: Some workflows (Security Audit, Bug Prediction) cost MORE on Run 2 with cache enabled - and that's a FEATURE.
|
|
671
|
+
|
|
672
|
+
**Why?** Adaptive workflows use cache to free up time for deeper analysis:
|
|
673
|
+
|
|
674
|
+
```
|
|
675
|
+
Security Audit without cache:
|
|
676
|
+
Run 1: $0.11, 45 seconds - surface scan finds 3 issues
|
|
677
|
+
|
|
678
|
+
Security Audit with cache:
|
|
679
|
+
Run 2: $0.13, 15 seconds - cache frees 30s for deep analysis
|
|
680
|
+
→ Uses saved time for PREMIUM tier vulnerability research
|
|
681
|
+
→ Finds 7 issues including critical SQLi we missed
|
|
682
|
+
→ Extra $0.02 cost = prevented security breach
|
|
683
|
+
```
|
|
684
|
+
|
|
685
|
+
**Result**: Cache makes workflows SMARTER, not just cheaper.
|
|
686
|
+
|
|
687
|
+
See [Adaptive Workflows Documentation](docs/caching/ADAPTIVE_WORKFLOWS.md) for full explanation.
|
|
688
|
+
|
|
689
|
+
#### Complete Documentation
|
|
690
|
+
|
|
691
|
+
- **[Quick Reference](docs/caching/QUICK_REFERENCE.md)** - Common scenarios, 1-page cheat sheet
|
|
692
|
+
- **[Configuration Guide](docs/caching/CONFIGURATION_GUIDE.md)** - All options, when to use each
|
|
693
|
+
- **[Adaptive Workflows](docs/caching/ADAPTIVE_WORKFLOWS.md)** - Why Run 2 can cost more (it's good!)
|
|
694
|
+
|
|
695
|
+
**Test it yourself**:
|
|
696
|
+
```bash
|
|
697
|
+
# Quick test (2-3 minutes)
|
|
698
|
+
python benchmark_caching_simple.py
|
|
699
|
+
|
|
700
|
+
# Full benchmark (15-20 minutes, all 12 workflows)
|
|
701
|
+
python benchmark_caching.py
|
|
702
|
+
```
|
|
703
|
+
|
|
704
|
+
---
|
|
705
|
+
|
|
588
706
|
## Become a Power User
|
|
589
707
|
|
|
590
708
|
### Level 1: Basic Usage
|
|
@@ -597,18 +715,37 @@ pip install empathy-framework[developer]
|
|
|
597
715
|
- Works out of the box with sensible defaults
|
|
598
716
|
- Auto-detects your API keys
|
|
599
717
|
|
|
600
|
-
### Level 2: Cost Optimization
|
|
718
|
+
### Level 2: Cost Optimization (Role-Based Savings)
|
|
719
|
+
|
|
720
|
+
**Tier routing automatically routes tasks to appropriate models, saving 34-86% depending on your work role.**
|
|
601
721
|
|
|
602
722
|
```bash
|
|
603
|
-
# Enable hybrid mode
|
|
723
|
+
# Enable hybrid mode
|
|
604
724
|
python -m empathy_os.models.cli provider --set hybrid
|
|
605
725
|
```
|
|
606
726
|
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
|
610
|
-
|
|
611
|
-
|
|
|
727
|
+
#### Tier Pricing
|
|
728
|
+
|
|
729
|
+
| Tier | Model | Use Case | Cost per Task* |
|
|
730
|
+
|------|-------|----------|----------------|
|
|
731
|
+
| CHEAP | GPT-4o-mini / Haiku | Summarization, formatting, simple tasks | $0.0045-0.0075 |
|
|
732
|
+
| CAPABLE | GPT-4o / Sonnet | Bug fixing, code review, analysis | $0.0725-0.090 |
|
|
733
|
+
| PREMIUM | o1 / Opus | Architecture, complex decisions, design | $0.435-0.450 |
|
|
734
|
+
|
|
735
|
+
*Typical task: 5,000 input tokens, 1,000 output tokens
|
|
736
|
+
|
|
737
|
+
#### Actual Savings by Role
|
|
738
|
+
|
|
739
|
+
| Your Role | PREMIUM % | CAPABLE % | CHEAP % | Actual Savings | Notes |
|
|
740
|
+
|-----------|-----------|-----------|---------|----------------|-------|
|
|
741
|
+
| **Architect / Designer** | 60% | 30% | 10% | **34%** | Design work requires complex reasoning |
|
|
742
|
+
| **Senior Developer** | 25% | 50% | 25% | **65%** | Mix of architecture and implementation |
|
|
743
|
+
| **Mid-Level Developer** | 15% | 60% | 25% | **73%** | Mostly implementation and bug fixes |
|
|
744
|
+
| **Junior Developer** | 5% | 40% | 55% | **86%** | Simple features, tests, documentation |
|
|
745
|
+
| **QA Engineer** | 10% | 35% | 55% | **80%** | Test generation, reports, automation |
|
|
746
|
+
| **DevOps Engineer** | 20% | 50% | 30% | **69%** | Infrastructure planning + automation |
|
|
747
|
+
|
|
748
|
+
**See [Complete Cost Analysis](docs/cost-analysis/COST_SAVINGS_BY_ROLE_AND_PROVIDER.md) for provider comparisons (Anthropic vs OpenAI vs Ollama) and detailed calculations.**
|
|
612
749
|
|
|
613
750
|
### Level 3: Multi-Model Workflows
|
|
614
751
|
|