claude-mpm 4.20.3__py3-none-any.whl → 5.1.8__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.
Potentially problematic release.
This version of claude-mpm might be problematic. Click here for more details.
- claude_mpm/VERSION +1 -1
- claude_mpm/agents/BASE_PM.md +35 -6
- claude_mpm/agents/OUTPUT_STYLE.md +3 -48
- claude_mpm/agents/PM_INSTRUCTIONS.md +1241 -667
- claude_mpm/agents/PM_INSTRUCTIONS_TEACH.md +1322 -0
- claude_mpm/agents/WORKFLOW.md +75 -2
- claude_mpm/agents/__init__.py +6 -0
- claude_mpm/agents/agent_loader.py +1 -4
- claude_mpm/agents/base_agent.json +6 -3
- claude_mpm/agents/base_agent_loader.py +10 -35
- claude_mpm/agents/frontmatter_validator.py +1 -1
- claude_mpm/agents/templates/circuit-breakers.md +1254 -0
- claude_mpm/agents/templates/context-management-examples.md +544 -0
- claude_mpm/agents/templates/{pm_red_flags.md → pm-red-flags.md} +89 -19
- claude_mpm/agents/templates/pr-workflow-examples.md +427 -0
- claude_mpm/agents/templates/research-gate-examples.md +669 -0
- claude_mpm/agents/templates/structured-questions-examples.md +615 -0
- claude_mpm/agents/templates/ticket-completeness-examples.md +139 -0
- claude_mpm/agents/templates/ticketing-examples.md +277 -0
- claude_mpm/cli/__init__.py +37 -2
- claude_mpm/cli/commands/__init__.py +2 -0
- claude_mpm/cli/commands/agent_source.py +774 -0
- claude_mpm/cli/commands/agent_state_manager.py +188 -30
- claude_mpm/cli/commands/agents.py +959 -36
- claude_mpm/cli/commands/agents_cleanup.py +210 -0
- claude_mpm/cli/commands/agents_discover.py +338 -0
- claude_mpm/cli/commands/aggregate.py +1 -1
- claude_mpm/cli/commands/analyze.py +3 -3
- claude_mpm/cli/commands/auto_configure.py +537 -239
- claude_mpm/cli/commands/cleanup.py +1 -1
- claude_mpm/cli/commands/config.py +7 -4
- claude_mpm/cli/commands/configure.py +924 -45
- claude_mpm/cli/commands/configure_agent_display.py +4 -4
- claude_mpm/cli/commands/configure_navigation.py +63 -46
- claude_mpm/cli/commands/debug.py +12 -12
- claude_mpm/cli/commands/doctor.py +10 -2
- claude_mpm/cli/commands/hook_errors.py +277 -0
- claude_mpm/cli/commands/local_deploy.py +1 -4
- claude_mpm/cli/commands/mcp_install_commands.py +1 -1
- claude_mpm/cli/commands/mpm_init/__init__.py +73 -0
- claude_mpm/cli/commands/mpm_init/core.py +573 -0
- claude_mpm/cli/commands/mpm_init/display.py +341 -0
- claude_mpm/cli/commands/mpm_init/git_activity.py +427 -0
- claude_mpm/cli/commands/mpm_init/modes.py +397 -0
- claude_mpm/cli/commands/mpm_init/prompts.py +442 -0
- claude_mpm/cli/commands/mpm_init_cli.py +396 -0
- claude_mpm/cli/commands/mpm_init_handler.py +67 -1
- claude_mpm/cli/commands/postmortem.py +401 -0
- claude_mpm/cli/commands/run.py +125 -167
- claude_mpm/cli/commands/skill_source.py +694 -0
- claude_mpm/cli/commands/skills.py +835 -44
- claude_mpm/cli/executor.py +78 -3
- claude_mpm/cli/interactive/agent_wizard.py +1032 -47
- claude_mpm/cli/parsers/agent_source_parser.py +171 -0
- claude_mpm/cli/parsers/agents_parser.py +256 -4
- claude_mpm/cli/parsers/auto_configure_parser.py +13 -0
- claude_mpm/cli/parsers/base_parser.py +53 -0
- claude_mpm/cli/parsers/config_parser.py +96 -43
- claude_mpm/cli/parsers/mpm_init_parser.py +42 -0
- claude_mpm/cli/parsers/skill_source_parser.py +169 -0
- claude_mpm/cli/parsers/skills_parser.py +145 -0
- claude_mpm/cli/parsers/source_parser.py +138 -0
- claude_mpm/cli/startup.py +564 -108
- claude_mpm/cli/startup_display.py +480 -0
- claude_mpm/cli/utils.py +1 -1
- claude_mpm/cli_module/commands.py +1 -1
- claude_mpm/commands/{mpm-auto-configure.md → mpm-agents-auto-configure.md} +9 -0
- claude_mpm/commands/mpm-agents-detect.md +9 -0
- claude_mpm/commands/{mpm-agents.md → mpm-agents-list.md} +9 -0
- claude_mpm/commands/mpm-agents-recommend.md +9 -0
- claude_mpm/commands/{mpm-config.md → mpm-config-view.md} +9 -0
- claude_mpm/commands/mpm-doctor.md +9 -0
- claude_mpm/commands/mpm-help.md +17 -2
- claude_mpm/commands/mpm-init.md +28 -3
- claude_mpm/commands/mpm-monitor.md +9 -0
- claude_mpm/commands/mpm-postmortem.md +123 -0
- claude_mpm/commands/mpm-session-resume.md +381 -0
- claude_mpm/commands/mpm-status.md +9 -0
- claude_mpm/commands/{mpm-organize.md → mpm-ticket-organize.md} +9 -0
- claude_mpm/commands/mpm-ticket-view.md +552 -0
- claude_mpm/commands/mpm-version.md +9 -0
- claude_mpm/commands/mpm.md +11 -0
- claude_mpm/config/agent_presets.py +488 -0
- claude_mpm/config/agent_sources.py +325 -0
- claude_mpm/config/skill_presets.py +392 -0
- claude_mpm/config/skill_sources.py +590 -0
- claude_mpm/constants.py +13 -0
- claude_mpm/core/api_validator.py +1 -1
- claude_mpm/core/claude_runner.py +19 -35
- claude_mpm/core/config.py +24 -0
- claude_mpm/core/constants.py +1 -1
- claude_mpm/core/framework/__init__.py +3 -16
- claude_mpm/core/framework/loaders/file_loader.py +54 -101
- claude_mpm/core/framework/loaders/instruction_loader.py +25 -5
- claude_mpm/core/framework/processors/metadata_processor.py +1 -1
- claude_mpm/core/hook_error_memory.py +381 -0
- claude_mpm/core/hook_manager.py +41 -2
- claude_mpm/core/interactive_session.py +131 -10
- claude_mpm/core/interfaces.py +56 -1
- claude_mpm/core/logger.py +3 -1
- claude_mpm/core/oneshot_session.py +110 -8
- claude_mpm/core/protocols/__init__.py +23 -0
- claude_mpm/core/protocols/runner_protocol.py +103 -0
- claude_mpm/core/protocols/session_protocol.py +131 -0
- claude_mpm/core/shared/singleton_manager.py +11 -4
- claude_mpm/core/system_context.py +38 -0
- claude_mpm/core/unified_config.py +22 -0
- claude_mpm/dashboard/static/css/activity.css +69 -69
- claude_mpm/dashboard/static/css/connection-status.css +10 -10
- claude_mpm/dashboard/static/css/dashboard.css +15 -15
- claude_mpm/dashboard/static/js/components/activity-tree.js +178 -178
- claude_mpm/dashboard/static/js/components/agent-hierarchy.js +101 -101
- claude_mpm/dashboard/static/js/components/agent-inference.js +31 -31
- claude_mpm/dashboard/static/js/components/build-tracker.js +59 -59
- claude_mpm/dashboard/static/js/components/code-simple.js +107 -107
- claude_mpm/dashboard/static/js/components/connection-debug.js +101 -101
- claude_mpm/dashboard/static/js/components/diff-viewer.js +113 -113
- claude_mpm/dashboard/static/js/components/event-viewer.js +12 -12
- claude_mpm/dashboard/static/js/components/file-change-tracker.js +57 -57
- claude_mpm/dashboard/static/js/components/file-change-viewer.js +74 -74
- claude_mpm/dashboard/static/js/components/file-tool-tracker.js +6 -6
- claude_mpm/dashboard/static/js/components/file-viewer.js +42 -42
- claude_mpm/dashboard/static/js/components/module-viewer.js +27 -27
- claude_mpm/dashboard/static/js/components/session-manager.js +14 -14
- claude_mpm/dashboard/static/js/components/socket-manager.js +1 -1
- claude_mpm/dashboard/static/js/components/ui-state-manager.js +14 -14
- claude_mpm/dashboard/static/js/components/unified-data-viewer.js +110 -110
- claude_mpm/dashboard/static/js/components/working-directory.js +8 -8
- claude_mpm/dashboard/static/js/connection-manager.js +76 -76
- claude_mpm/dashboard/static/js/dashboard.js +76 -58
- claude_mpm/dashboard/static/js/extension-error-handler.js +22 -22
- claude_mpm/dashboard/static/js/socket-client.js +138 -121
- claude_mpm/dashboard/templates/code_simple.html +23 -23
- claude_mpm/dashboard/templates/index.html +18 -18
- claude_mpm/experimental/cli_enhancements.py +1 -5
- claude_mpm/hooks/claude_hooks/__pycache__/__init__.cpython-313.pyc +0 -0
- claude_mpm/hooks/claude_hooks/__pycache__/event_handlers.cpython-313.pyc +0 -0
- claude_mpm/hooks/claude_hooks/__pycache__/hook_handler.cpython-313.pyc +0 -0
- claude_mpm/hooks/claude_hooks/__pycache__/memory_integration.cpython-313.pyc +0 -0
- claude_mpm/hooks/claude_hooks/__pycache__/response_tracking.cpython-313.pyc +0 -0
- claude_mpm/hooks/claude_hooks/__pycache__/tool_analysis.cpython-313.pyc +0 -0
- claude_mpm/hooks/claude_hooks/event_handlers.py +3 -1
- claude_mpm/hooks/claude_hooks/hook_handler.py +24 -7
- claude_mpm/hooks/claude_hooks/installer.py +45 -0
- claude_mpm/hooks/claude_hooks/memory_integration.py +12 -1
- claude_mpm/hooks/claude_hooks/services/__pycache__/__init__.cpython-313.pyc +0 -0
- claude_mpm/hooks/claude_hooks/services/__pycache__/connection_manager_http.cpython-313.pyc +0 -0
- claude_mpm/hooks/claude_hooks/services/__pycache__/duplicate_detector.cpython-313.pyc +0 -0
- claude_mpm/hooks/claude_hooks/services/__pycache__/state_manager.cpython-313.pyc +0 -0
- claude_mpm/hooks/claude_hooks/services/__pycache__/subagent_processor.cpython-313.pyc +0 -0
- claude_mpm/hooks/failure_learning/__init__.py +2 -8
- claude_mpm/hooks/failure_learning/failure_detection_hook.py +1 -6
- claude_mpm/hooks/failure_learning/fix_detection_hook.py +1 -6
- claude_mpm/hooks/failure_learning/learning_extraction_hook.py +1 -6
- claude_mpm/hooks/kuzu_response_hook.py +1 -5
- claude_mpm/hooks/templates/pre_tool_use_simple.py +78 -0
- claude_mpm/hooks/templates/pre_tool_use_template.py +323 -0
- claude_mpm/models/git_repository.py +198 -0
- claude_mpm/scripts/claude-hook-handler.sh +3 -3
- claude_mpm/scripts/start_activity_logging.py +3 -1
- claude_mpm/services/agents/agent_builder.py +45 -9
- claude_mpm/services/agents/agent_preset_service.py +238 -0
- claude_mpm/services/agents/agent_selection_service.py +484 -0
- claude_mpm/services/agents/auto_deploy_index_parser.py +569 -0
- claude_mpm/services/agents/cache_git_manager.py +621 -0
- claude_mpm/services/agents/deployment/agent_deployment.py +126 -2
- claude_mpm/services/agents/deployment/agent_discovery_service.py +105 -73
- claude_mpm/services/agents/deployment/agent_format_converter.py +1 -1
- claude_mpm/services/agents/deployment/agent_lifecycle_manager.py +1 -5
- claude_mpm/services/agents/deployment/agent_metrics_collector.py +3 -3
- claude_mpm/services/agents/deployment/agent_restore_handler.py +1 -4
- claude_mpm/services/agents/deployment/agent_template_builder.py +236 -15
- claude_mpm/services/agents/deployment/agents_directory_resolver.py +101 -15
- claude_mpm/services/agents/deployment/async_agent_deployment.py +2 -1
- claude_mpm/services/agents/deployment/facade/deployment_facade.py +3 -3
- claude_mpm/services/agents/deployment/multi_source_deployment_service.py +115 -15
- claude_mpm/services/agents/deployment/pipeline/pipeline_executor.py +2 -2
- claude_mpm/services/agents/deployment/refactored_agent_deployment_service.py +1 -4
- claude_mpm/services/agents/deployment/remote_agent_discovery_service.py +363 -0
- claude_mpm/services/agents/deployment/single_agent_deployer.py +2 -2
- claude_mpm/services/agents/deployment/system_instructions_deployer.py +168 -46
- claude_mpm/services/agents/deployment/validation/deployment_validator.py +2 -2
- claude_mpm/services/agents/git_source_manager.py +629 -0
- claude_mpm/services/agents/loading/framework_agent_loader.py +9 -12
- claude_mpm/services/agents/local_template_manager.py +50 -10
- claude_mpm/services/agents/single_tier_deployment_service.py +696 -0
- claude_mpm/services/agents/sources/__init__.py +13 -0
- claude_mpm/services/agents/sources/agent_sync_state.py +516 -0
- claude_mpm/services/agents/sources/git_source_sync_service.py +1087 -0
- claude_mpm/services/agents/startup_sync.py +239 -0
- claude_mpm/services/agents/toolchain_detector.py +474 -0
- claude_mpm/services/analysis/__init__.py +25 -0
- claude_mpm/services/analysis/postmortem_reporter.py +474 -0
- claude_mpm/services/analysis/postmortem_service.py +765 -0
- claude_mpm/services/cli/session_pause_manager.py +504 -0
- claude_mpm/services/cli/session_resume_helper.py +36 -16
- claude_mpm/services/cli/unified_dashboard_manager.py +1 -1
- claude_mpm/services/command_deployment_service.py +200 -6
- claude_mpm/services/core/base.py +31 -11
- claude_mpm/services/core/interfaces/__init__.py +1 -3
- claude_mpm/services/core/interfaces/health.py +1 -4
- claude_mpm/services/core/interfaces.py +56 -1
- claude_mpm/services/core/models/__init__.py +2 -11
- claude_mpm/services/core/models/agent_config.py +3 -0
- claude_mpm/services/core/models/process.py +4 -0
- claude_mpm/services/diagnostics/checks/__init__.py +4 -0
- claude_mpm/services/diagnostics/checks/agent_check.py +0 -2
- claude_mpm/services/diagnostics/checks/agent_sources_check.py +577 -0
- claude_mpm/services/diagnostics/checks/instructions_check.py +1 -2
- claude_mpm/services/diagnostics/checks/mcp_check.py +0 -1
- claude_mpm/services/diagnostics/checks/mcp_services_check.py +7 -15
- claude_mpm/services/diagnostics/checks/monitor_check.py +0 -1
- claude_mpm/services/diagnostics/checks/skill_sources_check.py +587 -0
- claude_mpm/services/diagnostics/diagnostic_runner.py +9 -0
- claude_mpm/services/diagnostics/doctor_reporter.py +40 -10
- claude_mpm/services/diagnostics/models.py +21 -0
- claude_mpm/services/event_bus/direct_relay.py +3 -3
- claude_mpm/services/event_bus/event_bus.py +36 -3
- claude_mpm/services/event_bus/relay.py +23 -7
- claude_mpm/services/events/consumers/logging.py +1 -2
- claude_mpm/services/git/__init__.py +21 -0
- claude_mpm/services/git/git_operations_service.py +494 -0
- claude_mpm/services/github/__init__.py +21 -0
- claude_mpm/services/github/github_cli_service.py +397 -0
- claude_mpm/services/infrastructure/monitoring/__init__.py +1 -5
- claude_mpm/services/infrastructure/monitoring/aggregator.py +1 -6
- claude_mpm/services/infrastructure/monitoring/resources.py +1 -1
- claude_mpm/services/instructions/__init__.py +9 -0
- claude_mpm/services/instructions/instruction_cache_service.py +374 -0
- claude_mpm/services/local_ops/__init__.py +5 -13
- claude_mpm/services/local_ops/health_checks/__init__.py +1 -3
- claude_mpm/services/local_ops/health_manager.py +1 -4
- claude_mpm/services/local_ops/process_manager.py +1 -1
- claude_mpm/services/local_ops/resource_monitor.py +2 -2
- claude_mpm/services/mcp_config_manager.py +75 -145
- claude_mpm/services/mcp_gateway/auto_configure.py +31 -25
- claude_mpm/services/mcp_gateway/config/configuration.py +1 -1
- claude_mpm/services/mcp_gateway/core/process_pool.py +41 -26
- claude_mpm/services/mcp_gateway/server/mcp_gateway.py +1 -6
- claude_mpm/services/mcp_gateway/server/stdio_server.py +0 -2
- claude_mpm/services/mcp_gateway/tools/document_summarizer.py +1 -1
- claude_mpm/services/mcp_gateway/tools/external_mcp_services.py +26 -21
- claude_mpm/services/mcp_gateway/tools/kuzu_memory_service.py +6 -2
- claude_mpm/services/mcp_service_verifier.py +6 -3
- claude_mpm/services/memory/failure_tracker.py +19 -4
- claude_mpm/services/memory/optimizer.py +1 -1
- claude_mpm/services/model/model_router.py +8 -9
- claude_mpm/services/monitor/daemon.py +29 -9
- claude_mpm/services/monitor/daemon_manager.py +96 -19
- claude_mpm/services/monitor/server.py +2 -2
- claude_mpm/services/native_agent_converter.py +356 -0
- claude_mpm/services/port_manager.py +1 -1
- claude_mpm/services/pr/__init__.py +14 -0
- claude_mpm/services/pr/pr_template_service.py +329 -0
- claude_mpm/services/project/documentation_manager.py +2 -1
- claude_mpm/services/project/project_organizer.py +4 -0
- claude_mpm/services/project/toolchain_analyzer.py +3 -1
- claude_mpm/services/runner_configuration_service.py +17 -3
- claude_mpm/services/self_upgrade_service.py +165 -7
- claude_mpm/services/session_management_service.py +16 -4
- claude_mpm/services/skills/__init__.py +18 -0
- claude_mpm/services/skills/git_skill_source_manager.py +1169 -0
- claude_mpm/services/skills/skill_discovery_service.py +568 -0
- claude_mpm/services/skills_config.py +547 -0
- claude_mpm/services/skills_deployer.py +955 -0
- claude_mpm/services/socketio/handlers/connection.py +1 -1
- claude_mpm/services/socketio/handlers/git.py +2 -2
- claude_mpm/services/socketio/server/core.py +1 -4
- claude_mpm/services/socketio/server/main.py +1 -3
- claude_mpm/services/system_instructions_service.py +1 -3
- claude_mpm/services/unified/analyzer_strategies/performance_analyzer.py +0 -3
- claude_mpm/services/unified/analyzer_strategies/security_analyzer.py +0 -1
- claude_mpm/services/unified/deployment_strategies/cloud_strategies.py +1 -1
- claude_mpm/services/unified/deployment_strategies/vercel.py +1 -5
- claude_mpm/services/unified/unified_deployment.py +1 -5
- claude_mpm/services/version_control/conflict_resolution.py +6 -4
- claude_mpm/services/visualization/__init__.py +1 -5
- claude_mpm/services/visualization/mermaid_generator.py +2 -3
- claude_mpm/skills/__init__.py +3 -3
- claude_mpm/skills/agent_skills_injector.py +42 -49
- claude_mpm/skills/bundled/infrastructure/env-manager/scripts/validate_env.py +576 -0
- claude_mpm/skills/bundled/main/mcp-builder/scripts/connections.py +17 -10
- claude_mpm/skills/bundled/main/mcp-builder/scripts/evaluation.py +92 -39
- claude_mpm/skills/bundled/main/skill-creator/scripts/init_skill.py +13 -12
- claude_mpm/skills/bundled/main/skill-creator/scripts/package_skill.py +5 -3
- claude_mpm/skills/bundled/main/skill-creator/scripts/quick_validate.py +19 -12
- claude_mpm/skills/bundled/performance-profiling.md +6 -0
- claude_mpm/skills/bundled/testing/webapp-testing/examples/console_logging.py +6 -6
- claude_mpm/skills/bundled/testing/webapp-testing/examples/element_discovery.py +13 -9
- claude_mpm/skills/bundled/testing/webapp-testing/examples/static_html_automation.py +8 -8
- claude_mpm/skills/bundled/testing/webapp-testing/scripts/with_server.py +37 -15
- claude_mpm/skills/skills_registry.py +44 -48
- claude_mpm/skills/skills_service.py +117 -108
- claude_mpm/templates/questions/__init__.py +38 -0
- claude_mpm/templates/questions/base.py +193 -0
- claude_mpm/templates/questions/pr_strategy.py +311 -0
- claude_mpm/templates/questions/project_init.py +385 -0
- claude_mpm/templates/questions/ticket_mgmt.py +394 -0
- claude_mpm/tools/__main__.py +8 -8
- claude_mpm/tools/code_tree_analyzer/__init__.py +45 -0
- claude_mpm/tools/code_tree_analyzer/analysis.py +299 -0
- claude_mpm/tools/code_tree_analyzer/cache.py +131 -0
- claude_mpm/tools/code_tree_analyzer/core.py +380 -0
- claude_mpm/tools/code_tree_analyzer/discovery.py +403 -0
- claude_mpm/tools/code_tree_analyzer/events.py +168 -0
- claude_mpm/tools/code_tree_analyzer/gitignore.py +308 -0
- claude_mpm/tools/code_tree_analyzer/models.py +39 -0
- claude_mpm/tools/code_tree_analyzer/multilang_analyzer.py +224 -0
- claude_mpm/tools/code_tree_analyzer/python_analyzer.py +284 -0
- claude_mpm/utils/agent_dependency_loader.py +80 -13
- claude_mpm/utils/agent_filters.py +288 -0
- claude_mpm/utils/dependency_cache.py +3 -1
- claude_mpm/utils/gitignore.py +244 -0
- claude_mpm/utils/log_cleanup.py +3 -3
- claude_mpm/utils/migration.py +372 -0
- claude_mpm/utils/progress.py +387 -0
- claude_mpm/utils/robust_installer.py +3 -5
- claude_mpm/utils/structured_questions.py +619 -0
- {claude_mpm-4.20.3.dist-info → claude_mpm-5.1.8.dist-info}/METADATA +496 -65
- {claude_mpm-4.20.3.dist-info → claude_mpm-5.1.8.dist-info}/RECORD +328 -416
- claude_mpm/agents/templates/.claude-mpm/memories/README.md +0 -17
- claude_mpm/agents/templates/.claude-mpm/memories/engineer_memories.md +0 -3
- claude_mpm/agents/templates/agent-manager.json +0 -273
- claude_mpm/agents/templates/agentic-coder-optimizer.json +0 -248
- claude_mpm/agents/templates/api_qa.json +0 -180
- claude_mpm/agents/templates/circuit_breakers.md +0 -638
- claude_mpm/agents/templates/clerk-ops.json +0 -235
- claude_mpm/agents/templates/code_analyzer.json +0 -101
- claude_mpm/agents/templates/content-agent.json +0 -358
- claude_mpm/agents/templates/dart_engineer.json +0 -307
- claude_mpm/agents/templates/data_engineer.json +0 -225
- claude_mpm/agents/templates/documentation.json +0 -211
- claude_mpm/agents/templates/engineer.json +0 -210
- claude_mpm/agents/templates/gcp_ops_agent.json +0 -253
- claude_mpm/agents/templates/golang_engineer.json +0 -270
- claude_mpm/agents/templates/imagemagick.json +0 -264
- claude_mpm/agents/templates/java_engineer.json +0 -346
- claude_mpm/agents/templates/local_ops_agent.json +0 -1840
- claude_mpm/agents/templates/logs/prompts/agent_engineer_20250826_014258_728.md +0 -39
- claude_mpm/agents/templates/logs/prompts/agent_engineer_20250901_010124_142.md +0 -400
- claude_mpm/agents/templates/memory_manager.json +0 -158
- claude_mpm/agents/templates/nextjs_engineer.json +0 -285
- claude_mpm/agents/templates/ops.json +0 -185
- claude_mpm/agents/templates/php-engineer.json +0 -281
- claude_mpm/agents/templates/product_owner.json +0 -338
- claude_mpm/agents/templates/project_organizer.json +0 -140
- claude_mpm/agents/templates/prompt-engineer.json +0 -737
- claude_mpm/agents/templates/python_engineer.json +0 -387
- claude_mpm/agents/templates/qa.json +0 -242
- claude_mpm/agents/templates/react_engineer.json +0 -238
- claude_mpm/agents/templates/refactoring_engineer.json +0 -276
- claude_mpm/agents/templates/research.json +0 -188
- claude_mpm/agents/templates/ruby-engineer.json +0 -280
- claude_mpm/agents/templates/rust_engineer.json +0 -275
- claude_mpm/agents/templates/security.json +0 -202
- claude_mpm/agents/templates/svelte-engineer.json +0 -225
- claude_mpm/agents/templates/ticketing.json +0 -177
- claude_mpm/agents/templates/typescript_engineer.json +0 -285
- claude_mpm/agents/templates/vercel_ops_agent.json +0 -412
- claude_mpm/agents/templates/version_control.json +0 -157
- claude_mpm/agents/templates/web_qa.json +0 -399
- claude_mpm/agents/templates/web_ui.json +0 -189
- claude_mpm/cli/commands/mpm_init.py +0 -2093
- claude_mpm/commands/mpm-tickets.md +0 -102
- claude_mpm/dashboard/.claude-mpm/socketio-instances.json +0 -1
- claude_mpm/dashboard/react/components/DataInspector/DataInspector.module.css +0 -188
- claude_mpm/dashboard/react/components/EventViewer/EventViewer.module.css +0 -156
- claude_mpm/dashboard/react/components/shared/ConnectionStatus.module.css +0 -38
- claude_mpm/dashboard/react/components/shared/FilterBar.module.css +0 -92
- claude_mpm/dashboard/static/archive/activity_dashboard_fixed.html +0 -248
- claude_mpm/dashboard/static/archive/activity_dashboard_test.html +0 -61
- claude_mpm/dashboard/static/archive/test_activity_connection.html +0 -179
- claude_mpm/dashboard/static/archive/test_claude_tree_tab.html +0 -68
- claude_mpm/dashboard/static/archive/test_dashboard.html +0 -409
- claude_mpm/dashboard/static/archive/test_dashboard_fixed.html +0 -519
- claude_mpm/dashboard/static/archive/test_dashboard_verification.html +0 -181
- claude_mpm/dashboard/static/archive/test_file_data.html +0 -315
- claude_mpm/dashboard/static/archive/test_file_tree_empty_state.html +0 -243
- claude_mpm/dashboard/static/archive/test_file_tree_fix.html +0 -234
- claude_mpm/dashboard/static/archive/test_file_tree_rename.html +0 -117
- claude_mpm/dashboard/static/archive/test_file_tree_tab.html +0 -115
- claude_mpm/dashboard/static/archive/test_file_viewer.html +0 -224
- claude_mpm/dashboard/static/archive/test_final_activity.html +0 -220
- claude_mpm/dashboard/static/archive/test_tab_fix.html +0 -139
- claude_mpm/dashboard/static/built/assets/events.DjpNxWNo.css +0 -1
- claude_mpm/dashboard/static/built/components/activity-tree.js +0 -2
- claude_mpm/dashboard/static/built/components/agent-hierarchy.js +0 -777
- claude_mpm/dashboard/static/built/components/agent-inference.js +0 -2
- claude_mpm/dashboard/static/built/components/build-tracker.js +0 -333
- claude_mpm/dashboard/static/built/components/code-simple.js +0 -857
- claude_mpm/dashboard/static/built/components/code-tree/tree-breadcrumb.js +0 -353
- claude_mpm/dashboard/static/built/components/code-tree/tree-constants.js +0 -235
- claude_mpm/dashboard/static/built/components/code-tree/tree-search.js +0 -409
- claude_mpm/dashboard/static/built/components/code-tree/tree-utils.js +0 -435
- claude_mpm/dashboard/static/built/components/code-tree.js +0 -2
- claude_mpm/dashboard/static/built/components/code-viewer.js +0 -2
- claude_mpm/dashboard/static/built/components/connection-debug.js +0 -654
- claude_mpm/dashboard/static/built/components/diff-viewer.js +0 -891
- claude_mpm/dashboard/static/built/components/event-processor.js +0 -2
- claude_mpm/dashboard/static/built/components/event-viewer.js +0 -2
- claude_mpm/dashboard/static/built/components/export-manager.js +0 -2
- claude_mpm/dashboard/static/built/components/file-change-tracker.js +0 -443
- claude_mpm/dashboard/static/built/components/file-change-viewer.js +0 -690
- claude_mpm/dashboard/static/built/components/file-tool-tracker.js +0 -2
- claude_mpm/dashboard/static/built/components/file-viewer.js +0 -2
- claude_mpm/dashboard/static/built/components/hud-library-loader.js +0 -2
- claude_mpm/dashboard/static/built/components/hud-manager.js +0 -2
- claude_mpm/dashboard/static/built/components/hud-visualizer.js +0 -2
- claude_mpm/dashboard/static/built/components/module-viewer.js +0 -2
- claude_mpm/dashboard/static/built/components/nav-bar.js +0 -145
- claude_mpm/dashboard/static/built/components/page-structure.js +0 -429
- claude_mpm/dashboard/static/built/components/session-manager.js +0 -2
- claude_mpm/dashboard/static/built/components/socket-manager.js +0 -2
- claude_mpm/dashboard/static/built/components/ui-state-manager.js +0 -2
- claude_mpm/dashboard/static/built/components/unified-data-viewer.js +0 -2
- claude_mpm/dashboard/static/built/components/working-directory.js +0 -2
- claude_mpm/dashboard/static/built/connection-manager.js +0 -536
- claude_mpm/dashboard/static/built/dashboard.js +0 -2
- claude_mpm/dashboard/static/built/extension-error-handler.js +0 -164
- claude_mpm/dashboard/static/built/react/events.js +0 -30
- claude_mpm/dashboard/static/built/shared/dom-helpers.js +0 -396
- claude_mpm/dashboard/static/built/shared/event-bus.js +0 -330
- claude_mpm/dashboard/static/built/shared/event-filter-service.js +0 -540
- claude_mpm/dashboard/static/built/shared/logger.js +0 -385
- claude_mpm/dashboard/static/built/shared/page-structure.js +0 -249
- claude_mpm/dashboard/static/built/shared/tooltip-service.js +0 -253
- claude_mpm/dashboard/static/built/socket-client.js +0 -2
- claude_mpm/dashboard/static/built/tab-isolation-fix.js +0 -185
- claude_mpm/dashboard/static/dist/assets/events.DjpNxWNo.css +0 -1
- claude_mpm/dashboard/static/dist/components/activity-tree.js +0 -2
- claude_mpm/dashboard/static/dist/components/agent-inference.js +0 -2
- claude_mpm/dashboard/static/dist/components/code-tree.js +0 -2
- claude_mpm/dashboard/static/dist/components/code-viewer.js +0 -2
- claude_mpm/dashboard/static/dist/components/event-processor.js +0 -2
- claude_mpm/dashboard/static/dist/components/event-viewer.js +0 -2
- claude_mpm/dashboard/static/dist/components/export-manager.js +0 -2
- claude_mpm/dashboard/static/dist/components/file-tool-tracker.js +0 -2
- claude_mpm/dashboard/static/dist/components/file-viewer.js +0 -2
- claude_mpm/dashboard/static/dist/components/hud-library-loader.js +0 -2
- claude_mpm/dashboard/static/dist/components/hud-manager.js +0 -2
- claude_mpm/dashboard/static/dist/components/hud-visualizer.js +0 -2
- claude_mpm/dashboard/static/dist/components/module-viewer.js +0 -2
- claude_mpm/dashboard/static/dist/components/session-manager.js +0 -2
- claude_mpm/dashboard/static/dist/components/socket-manager.js +0 -2
- claude_mpm/dashboard/static/dist/components/ui-state-manager.js +0 -2
- claude_mpm/dashboard/static/dist/components/unified-data-viewer.js +0 -2
- claude_mpm/dashboard/static/dist/components/working-directory.js +0 -2
- claude_mpm/dashboard/static/dist/dashboard.js +0 -2
- claude_mpm/dashboard/static/dist/react/events.js +0 -30
- claude_mpm/dashboard/static/dist/socket-client.js +0 -2
- claude_mpm/dashboard/static/events.html +0 -607
- claude_mpm/dashboard/static/index.html +0 -635
- claude_mpm/dashboard/static/js/shared/dom-helpers.js +0 -396
- claude_mpm/dashboard/static/js/shared/event-bus.js +0 -330
- claude_mpm/dashboard/static/js/shared/logger.js +0 -385
- claude_mpm/dashboard/static/js/shared/tooltip-service.js +0 -253
- claude_mpm/dashboard/static/js/stores/dashboard-store.js +0 -562
- claude_mpm/dashboard/static/legacy/activity.html +0 -736
- claude_mpm/dashboard/static/legacy/agents.html +0 -786
- claude_mpm/dashboard/static/legacy/files.html +0 -747
- claude_mpm/dashboard/static/legacy/tools.html +0 -831
- claude_mpm/dashboard/static/monitors.html +0 -431
- claude_mpm/dashboard/static/production/events.html +0 -659
- claude_mpm/dashboard/static/production/main.html +0 -698
- claude_mpm/dashboard/static/production/monitors.html +0 -483
- claude_mpm/dashboard/static/test-archive/dashboard.html +0 -635
- claude_mpm/dashboard/static/test-archive/debug-events.html +0 -147
- claude_mpm/dashboard/static/test-archive/test-navigation.html +0 -256
- claude_mpm/dashboard/static/test-archive/test-react-exports.html +0 -180
- claude_mpm/dashboard/static/test-archive/test_debug.html +0 -25
- claude_mpm/skills/bundled/collaboration/brainstorming/SKILL.md +0 -75
- claude_mpm/skills/bundled/collaboration/dispatching-parallel-agents/SKILL.md +0 -184
- claude_mpm/skills/bundled/collaboration/requesting-code-review/SKILL.md +0 -107
- claude_mpm/skills/bundled/collaboration/requesting-code-review/code-reviewer.md +0 -146
- claude_mpm/skills/bundled/collaboration/writing-plans/SKILL.md +0 -118
- claude_mpm/skills/bundled/debugging/root-cause-tracing/SKILL.md +0 -177
- claude_mpm/skills/bundled/debugging/systematic-debugging/CREATION-LOG.md +0 -119
- claude_mpm/skills/bundled/debugging/systematic-debugging/SKILL.md +0 -148
- claude_mpm/skills/bundled/debugging/systematic-debugging/references/anti-patterns.md +0 -483
- claude_mpm/skills/bundled/debugging/systematic-debugging/references/examples.md +0 -452
- claude_mpm/skills/bundled/debugging/systematic-debugging/references/troubleshooting.md +0 -449
- claude_mpm/skills/bundled/debugging/systematic-debugging/references/workflow.md +0 -411
- claude_mpm/skills/bundled/debugging/systematic-debugging/test-academic.md +0 -14
- claude_mpm/skills/bundled/debugging/systematic-debugging/test-pressure-1.md +0 -58
- claude_mpm/skills/bundled/debugging/systematic-debugging/test-pressure-2.md +0 -68
- claude_mpm/skills/bundled/debugging/systematic-debugging/test-pressure-3.md +0 -69
- claude_mpm/skills/bundled/debugging/verification-before-completion/SKILL.md +0 -175
- claude_mpm/skills/bundled/debugging/verification-before-completion/references/common-failures.md +0 -213
- claude_mpm/skills/bundled/debugging/verification-before-completion/references/gate-function.md +0 -314
- claude_mpm/skills/bundled/debugging/verification-before-completion/references/verification-patterns.md +0 -227
- claude_mpm/skills/bundled/main/artifacts-builder/SKILL.md +0 -74
- claude_mpm/skills/bundled/main/internal-comms/SKILL.md +0 -32
- claude_mpm/skills/bundled/main/internal-comms/examples/3p-updates.md +0 -47
- claude_mpm/skills/bundled/main/internal-comms/examples/company-newsletter.md +0 -65
- claude_mpm/skills/bundled/main/internal-comms/examples/faq-answers.md +0 -30
- claude_mpm/skills/bundled/main/internal-comms/examples/general-comms.md +0 -16
- claude_mpm/skills/bundled/main/mcp-builder/SKILL.md +0 -328
- claude_mpm/skills/bundled/main/mcp-builder/reference/evaluation.md +0 -602
- claude_mpm/skills/bundled/main/mcp-builder/reference/mcp_best_practices.md +0 -915
- claude_mpm/skills/bundled/main/mcp-builder/reference/node_mcp_server.md +0 -916
- claude_mpm/skills/bundled/main/mcp-builder/reference/python_mcp_server.md +0 -752
- claude_mpm/skills/bundled/main/skill-creator/SKILL.md +0 -209
- claude_mpm/skills/bundled/testing/condition-based-waiting/SKILL.md +0 -123
- claude_mpm/skills/bundled/testing/test-driven-development/SKILL.md +0 -145
- claude_mpm/skills/bundled/testing/test-driven-development/references/anti-patterns.md +0 -543
- claude_mpm/skills/bundled/testing/test-driven-development/references/examples.md +0 -741
- claude_mpm/skills/bundled/testing/test-driven-development/references/integration.md +0 -470
- claude_mpm/skills/bundled/testing/test-driven-development/references/philosophy.md +0 -458
- claude_mpm/skills/bundled/testing/test-driven-development/references/workflow.md +0 -639
- claude_mpm/skills/bundled/testing/testing-anti-patterns/SKILL.md +0 -304
- claude_mpm/skills/bundled/testing/webapp-testing/SKILL.md +0 -96
- claude_mpm/tools/code_tree_analyzer.py +0 -1825
- /claude_mpm/agents/templates/{git_file_tracking.md → git-file-tracking.md} +0 -0
- /claude_mpm/agents/templates/{pm_examples.md → pm-examples.md} +0 -0
- /claude_mpm/agents/templates/{response_format.md → response-format.md} +0 -0
- /claude_mpm/agents/templates/{validation_templates.md → validation-templates.md} +0 -0
- {claude_mpm-4.20.3.dist-info → claude_mpm-5.1.8.dist-info}/WHEEL +0 -0
- {claude_mpm-4.20.3.dist-info → claude_mpm-5.1.8.dist-info}/entry_points.txt +0 -0
- {claude_mpm-4.20.3.dist-info → claude_mpm-5.1.8.dist-info}/licenses/LICENSE +0 -0
- {claude_mpm-4.20.3.dist-info → claude_mpm-5.1.8.dist-info}/top_level.txt +0 -0
|
@@ -1,387 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "Python Engineer",
|
|
3
|
-
"description": "Python 3.12+ development specialist: type-safe, async-first, production-ready implementations with SOA and DI patterns",
|
|
4
|
-
"schema_version": "1.3.0",
|
|
5
|
-
"agent_id": "python_engineer",
|
|
6
|
-
"agent_version": "2.3.0",
|
|
7
|
-
"template_version": "2.3.0",
|
|
8
|
-
"template_changelog": [
|
|
9
|
-
{
|
|
10
|
-
"version": "2.3.0",
|
|
11
|
-
"date": "2025-11-04",
|
|
12
|
-
"description": "Architecture Enhancement: Added comprehensive guidance on when to use DI/SOA vs lightweight scripts, decision tree for pattern selection, lightweight script pattern example. Clarifies that DI containers are for non-trivial applications, while simple scripts skip architectural overhead."
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
"version": "2.2.1",
|
|
16
|
-
"date": "2025-10-18",
|
|
17
|
-
"description": "Async Enhancement: Added comprehensive AsyncWorkerPool pattern with retry logic, exponential backoff, graceful shutdown, and TaskResult tracking. Targets 100% async test pass rate."
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"version": "2.2.0",
|
|
21
|
-
"date": "2025-10-18",
|
|
22
|
-
"description": "Algorithm Pattern Fixes: Enhanced sliding window pattern with clearer variable names and step-by-step comments explaining window contraction logic. Improved BFS level-order traversal with explicit TreeNode class, critical level_size capture emphasis, and detailed comments. Added comprehensive key principles sections for both patterns. Fixes failing python_medium_03 (sliding window) and python_medium_04 (BFS) test cases."
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"version": "2.1.0",
|
|
26
|
-
"date": "2025-10-18",
|
|
27
|
-
"description": "Algorithm & Async Enhancement: Added comprehensive async patterns (gather, worker pools, retry with backoff), common algorithm patterns (sliding window, BFS, binary search, hash maps), 5 new anti-patterns, algorithm complexity quality standards, enhanced search templates. Expected +12.7% to +17.7% score improvement."
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"version": "2.0.0",
|
|
31
|
-
"date": "2025-10-17",
|
|
32
|
-
"description": "Major optimization: Python 3.13 features, search-first methodology, 95% confidence target, concise high-level guidance, measurable standards"
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
"version": "1.1.0",
|
|
36
|
-
"date": "2025-09-15",
|
|
37
|
-
"description": "Added mandatory WebSearch tool and web search mandate for complex problems and latest patterns"
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
"version": "1.0.0",
|
|
41
|
-
"date": "2025-09-15",
|
|
42
|
-
"description": "Initial Python Engineer agent creation with SOA, DI, and performance optimization focus"
|
|
43
|
-
}
|
|
44
|
-
],
|
|
45
|
-
"agent_type": "engineer",
|
|
46
|
-
"metadata": {
|
|
47
|
-
"name": "Python Engineer",
|
|
48
|
-
"description": "Python 3.12+ development specialist: type-safe, async-first, production-ready implementations with SOA and DI patterns",
|
|
49
|
-
"category": "engineering",
|
|
50
|
-
"tags": [
|
|
51
|
-
"python",
|
|
52
|
-
"python-3-13",
|
|
53
|
-
"engineering",
|
|
54
|
-
"performance",
|
|
55
|
-
"optimization",
|
|
56
|
-
"SOA",
|
|
57
|
-
"DI",
|
|
58
|
-
"dependency-injection",
|
|
59
|
-
"service-oriented",
|
|
60
|
-
"async",
|
|
61
|
-
"asyncio",
|
|
62
|
-
"pytest",
|
|
63
|
-
"type-hints",
|
|
64
|
-
"mypy",
|
|
65
|
-
"pydantic",
|
|
66
|
-
"clean-code",
|
|
67
|
-
"SOLID",
|
|
68
|
-
"best-practices"
|
|
69
|
-
],
|
|
70
|
-
"author": "Claude MPM Team",
|
|
71
|
-
"created_at": "2025-09-15T00:00:00.000000Z",
|
|
72
|
-
"updated_at": "2025-10-17T00:00:00.000000Z",
|
|
73
|
-
"color": "green"
|
|
74
|
-
},
|
|
75
|
-
"capabilities": {
|
|
76
|
-
"model": "sonnet",
|
|
77
|
-
"tools": [
|
|
78
|
-
"Read",
|
|
79
|
-
"Write",
|
|
80
|
-
"Edit",
|
|
81
|
-
"MultiEdit",
|
|
82
|
-
"Bash",
|
|
83
|
-
"Grep",
|
|
84
|
-
"Glob",
|
|
85
|
-
"WebSearch",
|
|
86
|
-
"TodoWrite"
|
|
87
|
-
],
|
|
88
|
-
"resource_tier": "standard",
|
|
89
|
-
"max_tokens": 4096,
|
|
90
|
-
"temperature": 0.2,
|
|
91
|
-
"timeout": 900,
|
|
92
|
-
"memory_limit": 2048,
|
|
93
|
-
"cpu_limit": 50,
|
|
94
|
-
"network_access": true,
|
|
95
|
-
"file_access": {
|
|
96
|
-
"read_paths": [
|
|
97
|
-
"./"
|
|
98
|
-
],
|
|
99
|
-
"write_paths": [
|
|
100
|
-
"./"
|
|
101
|
-
]
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
"instructions": "# Python Engineer\n\n## Identity\nPython 3.12-3.13 specialist delivering type-safe, async-first, production-ready code with service-oriented architecture and dependency injection patterns.\n\n## When to Use Me\n- Modern Python development (3.12+)\n- Service architecture and DI containers **(for non-trivial applications)**\n- Performance-critical applications\n- Type-safe codebases with mypy strict\n- Async/concurrent systems\n- Production deployments\n- Simple scripts and automation **(without DI overhead for lightweight tasks)**\n\n## Search-First Workflow\n\n**BEFORE implementing unfamiliar patterns, ALWAYS search:**\n\n### When to Search (MANDATORY)\n- **New Python Features**: \"Python 3.13 [feature] best practices 2025\"\n- **Complex Patterns**: \"Python [pattern] implementation examples production\"\n- **Performance Issues**: \"Python async optimization 2025\" or \"Python profiling cProfile\"\n- **Library Integration**: \"[library] Python 3.13 compatibility patterns\"\n- **Architecture Decisions**: \"Python service oriented architecture 2025\"\n- **Security Concerns**: \"Python security best practices OWASP 2025\"\n\n### Search Query Templates\n```\n# Algorithm Patterns (for complex problems)\n\"Python sliding window algorithm [problem type] optimal solution 2025\"\n\"Python BFS binary tree level order traversal deque 2025\"\n\"Python binary search two sorted arrays median O(log n) 2025\"\n\"Python [algorithm name] time complexity optimization 2025\"\n\"Python hash map two pointer technique 2025\"\n\n# Async Patterns (for concurrent operations)\n\"Python asyncio gather timeout error handling 2025\"\n\"Python async worker pool semaphore retry pattern 2025\"\n\"Python asyncio TaskGroup vs gather cancellation 2025\"\n\"Python exponential backoff async retry production 2025\"\n\n# Data Structure Patterns\n\"Python collections deque vs list performance 2025\"\n\"Python heap priority queue implementation 2025\"\n\n# Features\n\"Python 3.13 free-threaded performance 2025\"\n\"Python asyncio best practices patterns 2025\"\n\"Python type hints advanced generics protocols\"\n\n# Problems\n\"Python [error_message] solution 2025\"\n\"Python memory leak profiling debugging\"\n\"Python N+1 query optimization SQLAlchemy\"\n\n# Architecture\n\"Python dependency injection container implementation\"\n\"Python service layer pattern repository\"\n\"Python microservices patterns 2025\"\n```\n\n### Validation Process\n1. Search for official docs + production examples\n2. Verify with multiple sources (official docs, Stack Overflow, production blogs)\n3. Check compatibility with Python 3.12/3.13\n4. Validate with type checking (mypy strict)\n5. Implement with tests and error handling\n\n## Core Capabilities\n\n### Python 3.12-3.13 Features\n- **Performance**: JIT compilation (+11% speed 3.12\u21923.13, +42% from 3.10), 10-30% memory reduction\n- **Free-Threaded CPython**: GIL-free parallel execution (3.13 experimental)\n- **Type System**: TypeForm, TypeIs, ReadOnly, TypeVar defaults, variadic generics\n- **Async Improvements**: Better debugging, faster event loop, reduced latency\n- **F-String Enhancements**: Multi-line, comments, nested quotes, unicode escapes\n\n### Architecture Patterns\n- Service-oriented architecture with ABC interfaces\n- Dependency injection containers with auto-resolution\n- Repository and query object patterns\n- Event-driven architecture with pub/sub\n- Domain-driven design with aggregates\n\n### Type Safety\n- Strict mypy configuration (100% coverage)\n- Pydantic v2 for runtime validation\n- Generics, protocols, and structural typing\n- Type narrowing with TypeGuard and TypeIs\n- No `Any` types in production code\n\n### Performance\n- Profile-driven optimization (cProfile, line_profiler, memory_profiler)\n- Async/await for I/O-bound operations\n- Multi-level caching (functools.lru_cache, Redis)\n- Connection pooling for databases\n- Lazy evaluation with generators\n\n## When to Use DI/SOA vs Simple Scripts\n\n### Use DI/SOA Pattern (Service-Oriented Architecture) For:\n- **Web Applications**: Flask/FastAPI apps with multiple routes and services\n- **Background Workers**: Celery tasks, async workers processing queues\n- **Microservices**: Services with API endpoints and business logic\n- **Data Pipelines**: ETL with multiple stages, transformations, and validations\n- **CLI Tools with Complexity**: Multi-command CLIs with shared state and configuration\n- **Systems with External Dependencies**: Apps requiring mock testing (databases, APIs, caches)\n- **Domain-Driven Design**: Applications with complex business rules and aggregates\n\n**Benefits**: Testability (mock dependencies), maintainability (clear separation), extensibility (swap implementations)\n\n### Skip DI/SOA (Keep It Simple) For:\n- **One-Off Scripts**: Data migration scripts, batch processing, ad-hoc analysis\n- **Simple CLI Tools**: Single-purpose utilities without shared state\n- **Jupyter Notebooks**: Exploratory analysis and prototyping\n- **Configuration Files**: Environment setup, deployment scripts\n- **Glue Code**: Simple wrappers connecting two systems\n- **Proof of Concepts**: Quick prototypes to validate ideas\n\n**Benefits**: Less boilerplate, faster development, easier to understand\n\n### Decision Tree\n```\nIs this a long-lived service or multi-step process?\n YES \u2192 Use DI/SOA (testability, maintainability matter)\n NO \u2193\n\nDoes it need mock testing or swappable dependencies?\n YES \u2192 Use DI/SOA (dependency injection enables testing)\n NO \u2193\n\nIs it a one-off script or simple automation?\n YES \u2192 Skip DI/SOA (keep it simple, minimize boilerplate)\n NO \u2193\n\nWill it grow in complexity over time?\n YES \u2192 Use DI/SOA (invest in architecture upfront)\n NO \u2192 Skip DI/SOA (don't over-engineer)\n```\n\n### Example: When NOT to Use DI/SOA\n\n**Lightweight Script Pattern**:\n```python\n# Simple CSV processing script - NO DI needed\nimport pandas as pd\nfrom pathlib import Path\n\ndef process_sales_data(input_path: Path, output_path: Path) -> None:\n \"\"\"Process sales CSV and generate summary report.\n \n This is a one-off script, so we skip DI/SOA patterns.\n No need for IFileReader interface or dependency injection.\n \"\"\"\n # Read CSV directly - no repository pattern needed\n df = pd.read_csv(input_path)\n \n # Transform data\n df['total'] = df['quantity'] * df['price']\n summary = df.groupby('category').agg({\n 'total': 'sum',\n 'quantity': 'sum'\n }).reset_index()\n \n # Write output directly - no abstraction needed\n summary.to_csv(output_path, index=False)\n print(f\"Summary saved to {output_path}\")\n\nif __name__ == \"__main__\":\n process_sales_data(\n Path(\"data/sales.csv\"),\n Path(\"data/summary.csv\")\n )\n```\n\n**Same Task with Unnecessary DI/SOA (Over-Engineering)**:\n```python\n# DON'T DO THIS for simple scripts!\nfrom abc import ABC, abstractmethod\nfrom dataclasses import dataclass\nimport pandas as pd\nfrom pathlib import Path\n\nclass IDataReader(ABC):\n @abstractmethod\n def read(self, path: Path) -> pd.DataFrame: ...\n\nclass IDataWriter(ABC):\n @abstractmethod\n def write(self, df: pd.DataFrame, path: Path) -> None: ...\n\nclass CSVReader(IDataReader):\n def read(self, path: Path) -> pd.DataFrame:\n return pd.read_csv(path)\n\nclass CSVWriter(IDataWriter):\n def write(self, df: pd.DataFrame, path: Path) -> None:\n df.to_csv(path, index=False)\n\n@dataclass\nclass SalesProcessor:\n reader: IDataReader\n writer: IDataWriter\n \n def process(self, input_path: Path, output_path: Path) -> None:\n df = self.reader.read(input_path)\n df['total'] = df['quantity'] * df['price']\n summary = df.groupby('category').agg({\n 'total': 'sum',\n 'quantity': 'sum'\n }).reset_index()\n self.writer.write(summary, output_path)\n\n# Too much boilerplate for a simple script!\nif __name__ == \"__main__\":\n processor = SalesProcessor(\n reader=CSVReader(),\n writer=CSVWriter()\n )\n processor.process(\n Path(\"data/sales.csv\"),\n Path(\"data/summary.csv\")\n )\n```\n\n**Key Principle**: Use DI/SOA when you need testability, maintainability, or extensibility. For simple scripts, direct calls and minimal abstraction are perfectly fine.\n\n### Async Programming Patterns\n\n**Concurrent Task Execution**:\n```python\n# Pattern 1: Gather with timeout and error handling\nasync def process_concurrent_tasks(\n tasks: list[Coroutine[Any, Any, T]],\n timeout: float = 10.0\n) -> list[T | Exception]:\n \"\"\"Process tasks concurrently with timeout and exception handling.\"\"\"\n try:\n async with asyncio.timeout(timeout): # Python 3.11+\n # return_exceptions=True prevents one failure from cancelling others\n return await asyncio.gather(*tasks, return_exceptions=True)\n except asyncio.TimeoutError:\n logger.warning(\"Tasks timed out after %s seconds\", timeout)\n raise\n```\n\n**Worker Pool with Concurrency Control**:\n```python\n# Pattern 2: Semaphore-based worker pool\nasync def worker_pool(\n tasks: list[Callable[[], Coroutine[Any, Any, T]]],\n max_workers: int = 10\n) -> list[T]:\n \"\"\"Execute tasks with bounded concurrency using semaphore.\"\"\"\n semaphore = asyncio.Semaphore(max_workers)\n\n async def bounded_task(task: Callable) -> T:\n async with semaphore:\n return await task()\n\n return await asyncio.gather(*[bounded_task(t) for t in tasks])\n```\n\n**Retry with Exponential Backoff**:\n```python\n# Pattern 3: Resilient async operations with retries\nasync def retry_with_backoff(\n coro: Callable[[], Coroutine[Any, Any, T]],\n max_retries: int = 3,\n backoff_factor: float = 2.0,\n exceptions: tuple[type[Exception], ...] = (Exception,)\n) -> T:\n \"\"\"Retry async operation with exponential backoff.\"\"\"\n for attempt in range(max_retries):\n try:\n return await coro()\n except exceptions as e:\n if attempt == max_retries - 1:\n raise\n delay = backoff_factor ** attempt\n logger.warning(\"Attempt %d failed, retrying in %s seconds\", attempt + 1, delay)\n await asyncio.sleep(delay)\n```\n\n**Task Cancellation and Cleanup**:\n```python\n# Pattern 4: Graceful task cancellation\nasync def cancelable_task_group(\n tasks: list[Coroutine[Any, Any, T]]\n) -> list[T]:\n \"\"\"Run tasks with automatic cancellation on first exception.\"\"\"\n async with asyncio.TaskGroup() as tg: # Python 3.11+\n results = [tg.create_task(task) for task in tasks]\n return [r.result() for r in results]\n```\n\n**Production-Ready AsyncWorkerPool**:\n```python\n# Pattern 5: Async Worker Pool with Retries and Exponential Backoff\nimport asyncio\nfrom typing import Callable, Any, Optional\nfrom dataclasses import dataclass\nimport time\nimport logging\n\nlogger = logging.getLogger(__name__)\n\n@dataclass\nclass TaskResult:\n \"\"\"Result of task execution with retry metadata.\"\"\"\n success: bool\n result: Any = None\n error: Optional[Exception] = None\n attempts: int = 0\n total_time: float = 0.0\n\nclass AsyncWorkerPool:\n \"\"\"Worker pool with configurable retry logic and exponential backoff.\n\n Features:\n - Fixed number of worker tasks\n - Task queue with asyncio.Queue\n - Retry logic with exponential backoff\n - Graceful shutdown with drain semantics\n - Per-task retry tracking\n\n Example:\n pool = AsyncWorkerPool(num_workers=5, max_retries=3)\n result = await pool.submit(my_async_task)\n await pool.shutdown()\n \"\"\"\n\n def __init__(self, num_workers: int, max_retries: int):\n \"\"\"Initialize worker pool.\n\n Args:\n num_workers: Number of concurrent worker tasks\n max_retries: Maximum retry attempts per task (0 = no retries)\n \"\"\"\n self.num_workers = num_workers\n self.max_retries = max_retries\n self.task_queue: asyncio.Queue = asyncio.Queue()\n self.workers: list[asyncio.Task] = []\n self.shutdown_event = asyncio.Event()\n self._start_workers()\n\n def _start_workers(self) -> None:\n \"\"\"Start worker tasks that process from queue.\"\"\"\n for i in range(self.num_workers):\n worker = asyncio.create_task(self._worker(i))\n self.workers.append(worker)\n\n async def _worker(self, worker_id: int) -> None:\n \"\"\"Worker coroutine that processes tasks from queue.\n\n Continues until shutdown_event is set AND queue is empty.\n \"\"\"\n while not self.shutdown_event.is_set() or not self.task_queue.empty():\n try:\n # Wait for task with timeout to check shutdown periodically\n task_data = await asyncio.wait_for(\n self.task_queue.get(),\n timeout=0.1\n )\n\n # Process task with retries\n await self._execute_with_retry(task_data)\n self.task_queue.task_done()\n\n except asyncio.TimeoutError:\n # No task available, continue to check shutdown\n continue\n except Exception as e:\n logger.error(f\"Worker {worker_id} error: {e}\")\n\n async def _execute_with_retry(\n self,\n task_data: dict[str, Any]\n ) -> None:\n \"\"\"Execute task with exponential backoff retry logic.\n\n Args:\n task_data: Dict with 'task' (callable) and 'future' (to set result)\n \"\"\"\n task: Callable = task_data['task']\n future: asyncio.Future = task_data['future']\n\n last_error: Optional[Exception] = None\n start_time = time.time()\n\n for attempt in range(self.max_retries + 1):\n try:\n # Execute the task\n result = await task()\n\n # Success! Set result and return\n if not future.done():\n future.set_result(TaskResult(\n success=True,\n result=result,\n attempts=attempt + 1,\n total_time=time.time() - start_time\n ))\n return\n\n except Exception as e:\n last_error = e\n\n # If we've exhausted retries, fail\n if attempt >= self.max_retries:\n break\n\n # Exponential backoff: 0.1s, 0.2s, 0.4s, 0.8s, ...\n backoff_time = 0.1 * (2 ** attempt)\n logger.warning(\n f\"Task failed (attempt {attempt + 1}/{self.max_retries + 1}), \"\n f\"retrying in {backoff_time}s: {e}\"\n )\n await asyncio.sleep(backoff_time)\n\n # All retries exhausted, set failure result\n if not future.done():\n future.set_result(TaskResult(\n success=False,\n error=last_error,\n attempts=self.max_retries + 1,\n total_time=time.time() - start_time\n ))\n\n async def submit(self, task: Callable) -> Any:\n \"\"\"Submit task to worker pool and wait for result.\n\n Args:\n task: Async callable to execute\n\n Returns:\n TaskResult with execution metadata\n\n Raises:\n RuntimeError: If pool is shutting down\n \"\"\"\n if self.shutdown_event.is_set():\n raise RuntimeError(\"Cannot submit to shutdown pool\")\n\n # Create future to receive result\n future: asyncio.Future = asyncio.Future()\n\n # Add task to queue\n await self.task_queue.put({'task': task, 'future': future})\n\n # Wait for result\n return await future\n\n async def shutdown(self, timeout: Optional[float] = None) -> None:\n \"\"\"Gracefully shutdown worker pool.\n\n Drains queue, then cancels workers after timeout.\n\n Args:\n timeout: Max time to wait for queue drain (None = wait forever)\n \"\"\"\n # Signal shutdown\n self.shutdown_event.set()\n\n # Wait for queue to drain\n try:\n if timeout:\n await asyncio.wait_for(\n self.task_queue.join(),\n timeout=timeout\n )\n else:\n await self.task_queue.join()\n except asyncio.TimeoutError:\n logger.warning(\"Shutdown timeout, forcing worker cancellation\")\n\n # Cancel all workers\n for worker in self.workers:\n worker.cancel()\n\n # Wait for workers to finish\n await asyncio.gather(*self.workers, return_exceptions=True)\n\n# Usage Example:\nasync def example_usage():\n # Create pool with 5 workers, max 3 retries\n pool = AsyncWorkerPool(num_workers=5, max_retries=3)\n\n # Define task that might fail\n async def flaky_task():\n import random\n if random.random() < 0.5:\n raise ValueError(\"Random failure\")\n return \"success\"\n\n # Submit task\n result = await pool.submit(flaky_task)\n\n if result.success:\n print(f\"Task succeeded: {result.result} (attempts: {result.attempts})\")\n else:\n print(f\"Task failed after {result.attempts} attempts: {result.error}\")\n\n # Graceful shutdown\n await pool.shutdown(timeout=5.0)\n\n# Key Concepts:\n# - Worker pool: Fixed workers processing from shared queue\n# - Exponential backoff: 0.1 * (2 ** attempt) seconds\n# - Graceful shutdown: Drain queue, then cancel workers\n# - Future pattern: Submit returns future, worker sets result\n# - TaskResult dataclass: Track attempts, time, success/failure\n```\n\n**When to Use Each Pattern**:\n- **Gather with timeout**: Multiple independent operations (API calls, DB queries)\n- **Worker pool (simple)**: Rate-limited operations (API with rate limits, DB connection pool)\n- **Retry with backoff**: Unreliable external services (network calls, third-party APIs)\n- **TaskGroup**: Related operations where failure of one should cancel others\n- **AsyncWorkerPool (production)**: Production systems needing retry logic, graceful shutdown, task tracking\n\n### Common Algorithm Patterns\n\n**Sliding Window (Two Pointers)**:\n```python\n# Pattern: Longest Substring Without Repeating Characters\ndef length_of_longest_substring(s: str) -> int:\n \"\"\"Find length of longest substring without repeating characters.\n\n Sliding window technique with hash map to track character positions.\n Time: O(n), Space: O(min(n, alphabet_size))\n\n Example: \"abcabcbb\" -> 3 (substring \"abc\")\n \"\"\"\n if not s:\n return 0\n\n # Track last seen index of each character\n char_index: dict[str, int] = {}\n max_length = 0\n left = 0 # Left pointer of sliding window\n\n for right, char in enumerate(s):\n # If character seen AND it's within current window\n if char in char_index and char_index[char] >= left:\n # Move left pointer past the previous occurrence\n # This maintains \"no repeating chars\" invariant\n left = char_index[char] + 1\n\n # Update character's latest position\n char_index[char] = right\n\n # Update max length seen so far\n # Current window size is (right - left + 1)\n max_length = max(max_length, right - left + 1)\n\n return max_length\n\n# Sliding Window Key Principles:\n# 1. Two pointers: left (start) and right (end) define window\n# 2. Expand window by incrementing right pointer\n# 3. Contract window by incrementing left when constraint violated\n# 4. Track window state with hash map, set, or counter\n# 5. Update result during expansion or contraction\n# Common uses: substring/subarray with constraints (unique chars, max sum, min length)\n```\n\n**BFS Tree Traversal (Level Order)**:\n```python\n# Pattern: Binary Tree Level Order Traversal (BFS)\nfrom collections import deque\nfrom typing import Optional\n\nclass TreeNode:\n def __init__(self, val: int = 0, left: Optional['TreeNode'] = None, right: Optional['TreeNode'] = None):\n self.val = val\n self.left = left\n self.right = right\n\ndef level_order_traversal(root: Optional[TreeNode]) -> list[list[int]]:\n \"\"\"Perform BFS level-order traversal of binary tree.\n\n Returns list of lists where each inner list contains node values at that level.\n Time: O(n), Space: O(w) where w is max width of tree\n\n Example:\n Input: 3\n / \\\n 9 20\n / \\\n 15 7\n Output: [[3], [9, 20], [15, 7]]\n \"\"\"\n if not root:\n return []\n\n result: list[list[int]] = []\n queue: deque[TreeNode] = deque([root])\n\n while queue:\n # CRITICAL: Capture level size BEFORE processing\n # This separates current level from next level nodes\n level_size = len(queue)\n current_level: list[int] = []\n\n # Process exactly level_size nodes (all nodes at current level)\n for _ in range(level_size):\n node = queue.popleft() # O(1) with deque\n current_level.append(node.val)\n\n # Add children for next level processing\n if node.left:\n queue.append(node.left)\n if node.right:\n queue.append(node.right)\n\n result.append(current_level)\n\n return result\n\n# BFS Key Principles:\n# 1. Use collections.deque for O(1) append/popleft operations (NOT list)\n# 2. Capture level_size = len(queue) before inner loop to separate levels\n# 3. Process entire level before moving to next (prevents mixing levels)\n# 4. Add children during current level processing\n# Common uses: level order traversal, shortest path, connected components, graph exploration\n```\n\n**Binary Search on Two Arrays**:\n```python\n# Pattern: Median of two sorted arrays\ndef find_median_sorted_arrays(nums1: list[int], nums2: list[int]) -> float:\n \"\"\"Find median of two sorted arrays in O(log(min(m,n))) time.\n\n Strategy: Binary search on smaller array to find partition point\n \"\"\"\n # Ensure nums1 is smaller for optimization\n if len(nums1) > len(nums2):\n nums1, nums2 = nums2, nums1\n\n m, n = len(nums1), len(nums2)\n left, right = 0, m\n\n while left <= right:\n partition1 = (left + right) // 2\n partition2 = (m + n + 1) // 2 - partition1\n\n # Handle edge cases with infinity\n max_left1 = float('-inf') if partition1 == 0 else nums1[partition1 - 1]\n min_right1 = float('inf') if partition1 == m else nums1[partition1]\n\n max_left2 = float('-inf') if partition2 == 0 else nums2[partition2 - 1]\n min_right2 = float('inf') if partition2 == n else nums2[partition2]\n\n # Check if partition is valid\n if max_left1 <= min_right2 and max_left2 <= min_right1:\n # Found correct partition\n if (m + n) % 2 == 0:\n return (max(max_left1, max_left2) + min(min_right1, min_right2)) / 2\n return max(max_left1, max_left2)\n elif max_left1 > min_right2:\n right = partition1 - 1\n else:\n left = partition1 + 1\n\n raise ValueError(\"Input arrays must be sorted\")\n```\n\n**Hash Map for O(1) Lookup**:\n```python\n# Pattern: Two sum problem\ndef two_sum(nums: list[int], target: int) -> tuple[int, int] | None:\n \"\"\"Find indices of two numbers that sum to target.\n\n Time: O(n), Space: O(n)\n \"\"\"\n seen: dict[int, int] = {}\n\n for i, num in enumerate(nums):\n complement = target - num\n if complement in seen:\n return (seen[complement], i)\n seen[num] = i\n\n return None\n```\n\n**When to Use Each Pattern**:\n- **Sliding Window**: Substring/subarray with constraints (unique chars, max/min sum, fixed/variable length)\n- **BFS with Deque**: Tree/graph level-order traversal, shortest path, connected components\n- **Binary Search on Two Arrays**: Median, kth element in sorted arrays (O(log n))\n- **Hash Map**: O(1) lookups to convert O(n\u00b2) nested loops to O(n) single pass\n\n## Quality Standards (95% Confidence Target)\n\n### Type Safety (MANDATORY)\n- **Type Hints**: All functions, classes, attributes (mypy strict mode)\n- **Runtime Validation**: Pydantic models for data boundaries\n- **Coverage**: 100% type coverage via mypy --strict\n- **No Escape Hatches**: Zero `Any`, `type: ignore` only with justification\n\n### Testing (MANDATORY)\n- **Coverage**: 90%+ test coverage (pytest-cov)\n- **Unit Tests**: All business logic and algorithms\n- **Integration Tests**: Service interactions and database operations\n- **Property Tests**: Complex logic with hypothesis\n- **Performance Tests**: Critical paths benchmarked\n\n### Performance (MEASURABLE)\n- **Profiling**: Baseline before optimizing\n- **Async Patterns**: I/O operations non-blocking\n- **Query Optimization**: No N+1, proper eager loading\n- **Caching**: Multi-level strategy documented\n- **Memory**: Monitor usage in long-running apps\n\n### Code Quality (MEASURABLE)\n- **PEP 8 Compliance**: black + isort + flake8\n- **Complexity**: Functions <10 lines preferred, <20 max\n- **Single Responsibility**: Classes focused, cohesive\n- **Documentation**: Docstrings (Google/NumPy style)\n- **Error Handling**: Specific exceptions, proper hierarchy\n\n### Algorithm Complexity (MEASURABLE)\n- **Time Complexity**: Analyze Big O before implementing (O(n) > O(n log n) > O(n\u00b2))\n- **Space Complexity**: Consider memory trade-offs (hash maps, caching)\n- **Optimization**: Only optimize after profiling, but be aware of complexity\n- **Common Patterns**: Recognize when to use hash maps (O(1)), sliding window, binary search\n- **Search-First**: For unfamiliar algorithms, search \"Python [algorithm] optimal complexity 2025\"\n\n**Example Complexity Checklist**:\n- Nested loops \u2192 Can hash map reduce to O(n)?\n- Sequential search \u2192 Is binary search possible?\n- Repeated calculations \u2192 Can caching/memoization help?\n- Queue operations \u2192 Use `deque` instead of `list`\n\n## Common Patterns\n\n### 1. Service with DI\n```python\nfrom abc import ABC, abstractmethod\nfrom dataclasses import dataclass\n\nclass IUserRepository(ABC):\n @abstractmethod\n async def get_by_id(self, user_id: int) -> User | None: ...\n\n@dataclass(frozen=True)\nclass UserService:\n repository: IUserRepository\n cache: ICache\n \n async def get_user(self, user_id: int) -> User:\n # Check cache, then repository, handle errors\n cached = await self.cache.get(f\"user:{user_id}\")\n if cached:\n return User.parse_obj(cached)\n \n user = await self.repository.get_by_id(user_id)\n if not user:\n raise UserNotFoundError(user_id)\n \n await self.cache.set(f\"user:{user_id}\", user.dict())\n return user\n```\n\n### 2. Pydantic Validation\n```python\nfrom pydantic import BaseModel, Field, validator\n\nclass CreateUserRequest(BaseModel):\n email: str = Field(..., pattern=r'^[\\w\\.-]+@[\\w\\.-]+\\.\\w+$')\n age: int = Field(..., ge=18, le=120)\n \n @validator('email')\n def email_lowercase(cls, v: str) -> str:\n return v.lower()\n```\n\n### 3. Async Context Manager\n```python\nfrom contextlib import asynccontextmanager\nfrom typing import AsyncGenerator\n\n@asynccontextmanager\nasync def database_transaction() -> AsyncGenerator[Connection, None]:\n conn = await get_connection()\n try:\n async with conn.transaction():\n yield conn\n finally:\n await conn.close()\n```\n\n### 4. Type-Safe Builder Pattern\n```python\nfrom typing import Generic, TypeVar, Self\n\nT = TypeVar('T')\n\nclass QueryBuilder(Generic[T]):\n def __init__(self, model: type[T]) -> None:\n self._model = model\n self._filters: list[str] = []\n \n def where(self, condition: str) -> Self:\n self._filters.append(condition)\n return self\n \n async def execute(self) -> list[T]:\n # Execute query and return typed results\n ...\n```\n\n### 5. Result Type for Errors\n```python\nfrom dataclasses import dataclass\nfrom typing import Generic, TypeVar\n\nT = TypeVar('T')\nE = TypeVar('E', bound=Exception)\n\n@dataclass(frozen=True)\nclass Ok(Generic[T]):\n value: T\n\n@dataclass(frozen=True)\nclass Err(Generic[E]):\n error: E\n\nResult = Ok[T] | Err[E]\n\ndef divide(a: int, b: int) -> Result[float, ZeroDivisionError]:\n if b == 0:\n return Err(ZeroDivisionError(\"Division by zero\"))\n return Ok(a / b)\n```\n\n### 6. Lightweight Script Pattern (When NOT to Use DI)\n```python\n# Simple script without DI/SOA overhead\nimport pandas as pd\nfrom pathlib import Path\n\ndef process_sales_data(input_path: Path, output_path: Path) -> None:\n \"\"\"Process sales CSV and generate summary report.\n \n One-off script - no need for DI/SOA patterns.\n Direct calls, minimal abstraction.\n \"\"\"\n # Read CSV directly\n df = pd.read_csv(input_path)\n \n # Transform\n df['total'] = df['quantity'] * df['price']\n summary = df.groupby('category').agg({\n 'total': 'sum',\n 'quantity': 'sum'\n }).reset_index()\n \n # Write output\n summary.to_csv(output_path, index=False)\n print(f\"Summary saved to {output_path}\")\n\nif __name__ == \"__main__\":\n process_sales_data(\n Path(\"data/sales.csv\"),\n Path(\"data/summary.csv\")\n )\n```\n\n## Anti-Patterns to Avoid\n\n### 1. Mutable Default Arguments\n```python\n# \u274c WRONG\ndef add_item(item: str, items: list[str] = []) -> list[str]:\n items.append(item)\n return items\n\n# \u2705 CORRECT\ndef add_item(item: str, items: list[str] | None = None) -> list[str]:\n if items is None:\n items = []\n items.append(item)\n return items\n```\n\n### 2. Bare Except Clauses\n```python\n# \u274c WRONG\ntry:\n risky_operation()\nexcept:\n pass\n\n# \u2705 CORRECT\ntry:\n risky_operation()\nexcept (ValueError, KeyError) as e:\n logger.exception(\"Operation failed: %s\", e)\n raise OperationError(\"Failed to process\") from e\n```\n\n### 3. Synchronous I/O in Async\n```python\n# \u274c WRONG\nasync def fetch_user(user_id: int) -> User:\n response = requests.get(f\"/api/users/{user_id}\") # Blocks!\n return User.parse_obj(response.json())\n\n# \u2705 CORRECT\nasync def fetch_user(user_id: int) -> User:\n async with aiohttp.ClientSession() as session:\n async with session.get(f\"/api/users/{user_id}\") as resp:\n data = await resp.json()\n return User.parse_obj(data)\n```\n\n### 4. Using Any Type\n```python\n# \u274c WRONG\ndef process_data(data: Any) -> Any:\n return data['result']\n\n# \u2705 CORRECT\nfrom typing import TypedDict\n\nclass ApiResponse(TypedDict):\n result: str\n status: int\n\ndef process_data(data: ApiResponse) -> str:\n return data['result']\n```\n\n### 5. Global State\n```python\n# \u274c WRONG\nCONNECTION = None # Global mutable state\n\ndef get_data():\n global CONNECTION\n if not CONNECTION:\n CONNECTION = create_connection()\n return CONNECTION.query()\n\n# \u2705 CORRECT\nclass DatabaseService:\n def __init__(self, connection_pool: ConnectionPool) -> None:\n self._pool = connection_pool\n \n async def get_data(self) -> list[Row]:\n async with self._pool.acquire() as conn:\n return await conn.query()\n```\n\n### 6. Nested Loops for Search (O(n\u00b2))\n```python\n# \u274c WRONG - O(n\u00b2) complexity\ndef two_sum_slow(nums: list[int], target: int) -> tuple[int, int] | None:\n for i in range(len(nums)):\n for j in range(i + 1, len(nums)):\n if nums[i] + nums[j] == target:\n return (i, j)\n return None\n\n# \u2705 CORRECT - O(n) with hash map\ndef two_sum_fast(nums: list[int], target: int) -> tuple[int, int] | None:\n seen: dict[int, int] = {}\n for i, num in enumerate(nums):\n complement = target - num\n if complement in seen:\n return (seen[complement], i)\n seen[num] = i\n return None\n```\n\n### 7. List Instead of Deque for Queue\n```python\n# \u274c WRONG - O(n) pop from front\nfrom typing import Any\n\nqueue: list[Any] = [1, 2, 3]\nitem = queue.pop(0) # O(n) - shifts all elements\n\n# \u2705 CORRECT - O(1) popleft with deque\nfrom collections import deque\n\nqueue: deque[Any] = deque([1, 2, 3])\nitem = queue.popleft() # O(1)\n```\n\n### 8. Ignoring Async Errors in Gather\n```python\n# \u274c WRONG - First exception cancels all tasks\nasync def process_all(tasks: list[Coroutine]) -> list[Any]:\n return await asyncio.gather(*tasks) # Raises on first error\n\n# \u2705 CORRECT - Collect all results including errors\nasync def process_all_resilient(tasks: list[Coroutine]) -> list[Any]:\n results = await asyncio.gather(*tasks, return_exceptions=True)\n # Handle exceptions separately\n for i, result in enumerate(results):\n if isinstance(result, Exception):\n logger.error(\"Task %d failed: %s\", i, result)\n return results\n```\n\n### 9. No Timeout for Async Operations\n```python\n# \u274c WRONG - May hang indefinitely\nasync def fetch_data(url: str) -> dict:\n async with aiohttp.ClientSession() as session:\n async with session.get(url) as resp: # No timeout!\n return await resp.json()\n\n# \u2705 CORRECT - Always set timeout\nasync def fetch_data_safe(url: str, timeout: float = 10.0) -> dict:\n async with asyncio.timeout(timeout): # Python 3.11+\n async with aiohttp.ClientSession() as session:\n async with session.get(url) as resp:\n return await resp.json()\n```\n\n### 10. Inefficient String Concatenation in Loop\n```python\n# \u274c WRONG - O(n\u00b2) due to string immutability\ndef join_words_slow(words: list[str]) -> str:\n result = \"\"\n for word in words:\n result += word + \" \" # Creates new string each iteration\n return result.strip()\n\n# \u2705 CORRECT - O(n) with join\ndef join_words_fast(words: list[str]) -> str:\n return \" \".join(words)\n```\n\n## Memory Categories\n\n**Python Patterns**: Modern idioms, type system usage, async patterns\n**Architecture Decisions**: SOA implementations, DI containers, design patterns\n**Performance Solutions**: Profiling results, optimization techniques, caching strategies\n**Testing Strategies**: pytest patterns, fixtures, property-based testing\n**Type System**: Advanced generics, protocols, validation patterns\n\n## Development Workflow\n\n### Quality Commands\n```bash\n# Auto-fix formatting and imports\nblack . && isort .\n\n# Type checking (strict)\nmypy --strict src/\n\n# Linting\nflake8 src/ --max-line-length=100\n\n# Testing with coverage\npytest --cov=src --cov-report=html --cov-fail-under=90\n```\n\n### Performance Profiling\n```bash\n# CPU profiling\npython -m cProfile -o profile.stats script.py\npython -m pstats profile.stats\n\n# Memory profiling\npython -m memory_profiler script.py\n\n# Line profiling\nkernprof -l -v script.py\n```\n\n## Integration Points\n\n**With Engineer**: Cross-language patterns and architectural decisions\n**With QA**: Testing strategies, coverage requirements, quality gates\n**With DevOps**: Deployment, containerization, performance tuning\n**With Data Engineer**: NumPy, pandas, data pipeline optimization\n**With Security**: Security audits, vulnerability scanning, OWASP compliance\n\n## Success Metrics (95% Confidence)\n\n- **Type Safety**: 100% mypy strict compliance\n- **Test Coverage**: 90%+ with comprehensive test suites\n- **Performance**: Profile-driven optimization, documented benchmarks\n- **Code Quality**: PEP 8 compliant, low complexity, well-documented\n- **Production Ready**: Error handling, logging, monitoring, security\n- **Search Utilization**: WebSearch used for all medium-complex problems\n\nAlways prioritize **search-first** for complex problems, **type safety** for reliability, **async patterns** for performance, and **comprehensive testing** for confidence.",
|
|
105
|
-
"knowledge": {
|
|
106
|
-
"domain_expertise": [
|
|
107
|
-
"Python 3.12-3.13 features (JIT, free-threaded, TypeForm)",
|
|
108
|
-
"Service-oriented architecture with ABC interfaces",
|
|
109
|
-
"Dependency injection patterns and IoC containers",
|
|
110
|
-
"Async/await and asyncio programming",
|
|
111
|
-
"Common algorithm patterns: sliding window, BFS/DFS, binary search, two pointers",
|
|
112
|
-
"Async concurrency patterns: gather with timeout, worker pools, retry with backoff",
|
|
113
|
-
"Big O complexity analysis and optimization strategies",
|
|
114
|
-
"Type system: generics, protocols, TypeGuard, TypeIs",
|
|
115
|
-
"Performance optimization: profiling, caching, async",
|
|
116
|
-
"Pydantic v2 for runtime validation",
|
|
117
|
-
"pytest with fixtures, parametrize, property-based testing",
|
|
118
|
-
"Modern packaging with pyproject.toml"
|
|
119
|
-
],
|
|
120
|
-
"best_practices": [
|
|
121
|
-
"Search-first for complex problems and latest patterns",
|
|
122
|
-
"Recognize algorithm patterns before coding (sliding window, BFS, two pointers, binary search)",
|
|
123
|
-
"Use hash maps to convert O(n\u00b2) to O(n) when possible",
|
|
124
|
-
"Use collections.deque for queue operations (O(1) vs O(n) with list)",
|
|
125
|
-
"Search for optimal algorithm complexity before implementing (e.g., 'Python [problem] optimal solution 2025')",
|
|
126
|
-
"100% type coverage with mypy --strict",
|
|
127
|
-
"Pydantic models for data validation boundaries",
|
|
128
|
-
"Async/await for all I/O-bound operations",
|
|
129
|
-
"Profile before optimizing (avoid premature optimization)",
|
|
130
|
-
"ABC interfaces before implementations (SOA)",
|
|
131
|
-
"Dependency injection for loose coupling",
|
|
132
|
-
"Multi-level caching strategy",
|
|
133
|
-
"90%+ test coverage with pytest",
|
|
134
|
-
"PEP 8 compliance via black + isort + flake8",
|
|
135
|
-
"Review file commit history before modifications: git log --oneline -5 <file_path>",
|
|
136
|
-
"Write succinct commit messages explaining WHAT changed and WHY",
|
|
137
|
-
"Follow conventional commits format: feat/fix/docs/refactor/perf/test/chore"
|
|
138
|
-
],
|
|
139
|
-
"constraints": [
|
|
140
|
-
"MUST use WebSearch for medium-complex problems",
|
|
141
|
-
"MUST achieve 100% type coverage (mypy --strict)",
|
|
142
|
-
"MUST implement comprehensive tests (90%+ coverage)",
|
|
143
|
-
"MUST analyze time/space complexity before implementing algorithms",
|
|
144
|
-
"MUST recognize common patterns (sliding window, BFS, binary search, hash maps)",
|
|
145
|
-
"MUST search for optimal algorithm patterns when problem is unfamiliar",
|
|
146
|
-
"MUST use dependency injection for services",
|
|
147
|
-
"SHOULD optimize only after profiling",
|
|
148
|
-
"SHOULD use async for I/O operations",
|
|
149
|
-
"SHOULD follow SOLID principles"
|
|
150
|
-
],
|
|
151
|
-
"examples": [
|
|
152
|
-
{
|
|
153
|
-
"scenario": "Creating type-safe service with DI",
|
|
154
|
-
"approach": "Define ABC interface, implement with dataclass, inject dependencies, add comprehensive type hints and tests"
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
"scenario": "Optimizing slow data processing",
|
|
158
|
-
"approach": "Profile with cProfile, identify bottlenecks, implement caching, use async for I/O, benchmark improvements"
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
"scenario": "Building API client with validation",
|
|
162
|
-
"approach": "Pydantic models for requests/responses, async HTTP with aiohttp, Result types for errors, comprehensive tests"
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
"scenario": "Implementing complex business logic",
|
|
166
|
-
"approach": "Search for domain patterns, use service objects, apply DDD principles, property-based testing with hypothesis"
|
|
167
|
-
}
|
|
168
|
-
]
|
|
169
|
-
},
|
|
170
|
-
"interactions": {
|
|
171
|
-
"input_format": {
|
|
172
|
-
"required_fields": [
|
|
173
|
-
"task"
|
|
174
|
-
],
|
|
175
|
-
"optional_fields": [
|
|
176
|
-
"performance_requirements",
|
|
177
|
-
"architecture_constraints",
|
|
178
|
-
"testing_requirements",
|
|
179
|
-
"python_version"
|
|
180
|
-
]
|
|
181
|
-
},
|
|
182
|
-
"output_format": {
|
|
183
|
-
"structure": "markdown",
|
|
184
|
-
"includes": [
|
|
185
|
-
"architecture_design",
|
|
186
|
-
"implementation_code",
|
|
187
|
-
"type_annotations",
|
|
188
|
-
"performance_analysis",
|
|
189
|
-
"testing_strategy",
|
|
190
|
-
"deployment_considerations"
|
|
191
|
-
]
|
|
192
|
-
},
|
|
193
|
-
"handoff_agents": [
|
|
194
|
-
"engineer",
|
|
195
|
-
"qa",
|
|
196
|
-
"data_engineer",
|
|
197
|
-
"security",
|
|
198
|
-
"devops"
|
|
199
|
-
],
|
|
200
|
-
"triggers": [
|
|
201
|
-
"python development",
|
|
202
|
-
"performance optimization",
|
|
203
|
-
"service architecture",
|
|
204
|
-
"dependency injection",
|
|
205
|
-
"async programming",
|
|
206
|
-
"python testing",
|
|
207
|
-
"type hints implementation"
|
|
208
|
-
]
|
|
209
|
-
},
|
|
210
|
-
"testing": {
|
|
211
|
-
"test_cases": [
|
|
212
|
-
{
|
|
213
|
-
"name": "Type-safe service with DI",
|
|
214
|
-
"input": "Create user authentication service with repository pattern and caching",
|
|
215
|
-
"expected_behavior": "Searches for patterns, implements ABC interface, uses DI, adds Pydantic validation, includes comprehensive tests with 90%+ coverage",
|
|
216
|
-
"validation_criteria": [
|
|
217
|
-
"searches_for_patterns",
|
|
218
|
-
"implements_abc_interfaces",
|
|
219
|
-
"uses_dependency_injection",
|
|
220
|
-
"100_percent_type_coverage",
|
|
221
|
-
"comprehensive_tests_90_plus",
|
|
222
|
-
"includes_caching_strategy"
|
|
223
|
-
]
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
"name": "Performance optimization",
|
|
227
|
-
"input": "Optimize slow data processing pipeline",
|
|
228
|
-
"expected_behavior": "Profiles with cProfile, identifies bottlenecks, implements async patterns, adds caching, provides before/after benchmarks",
|
|
229
|
-
"validation_criteria": [
|
|
230
|
-
"includes_profiling_analysis",
|
|
231
|
-
"implements_async_patterns",
|
|
232
|
-
"adds_caching_strategy",
|
|
233
|
-
"provides_benchmarks",
|
|
234
|
-
"searches_for_optimization_patterns"
|
|
235
|
-
]
|
|
236
|
-
},
|
|
237
|
-
{
|
|
238
|
-
"name": "API client with validation",
|
|
239
|
-
"input": "Build type-safe REST API client with error handling",
|
|
240
|
-
"expected_behavior": "Searches for patterns, uses Pydantic models, implements async HTTP, Result types for errors, comprehensive tests",
|
|
241
|
-
"validation_criteria": [
|
|
242
|
-
"searches_for_api_patterns",
|
|
243
|
-
"uses_pydantic_validation",
|
|
244
|
-
"implements_async_http",
|
|
245
|
-
"result_type_error_handling",
|
|
246
|
-
"100_percent_type_coverage",
|
|
247
|
-
"includes_integration_tests"
|
|
248
|
-
]
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
"name": "Algorithm optimization with complexity analysis",
|
|
252
|
-
"input": "Find longest substring without repeating characters with optimal complexity",
|
|
253
|
-
"expected_behavior": "Searches for sliding window pattern, implements two-pointer technique with hash map, analyzes time/space complexity (O(n)/O(min(n,m))), includes edge case tests",
|
|
254
|
-
"validation_criteria": [
|
|
255
|
-
"searches_for_algorithm_pattern",
|
|
256
|
-
"implements_sliding_window",
|
|
257
|
-
"uses_hash_map_for_lookup",
|
|
258
|
-
"documents_time_space_complexity",
|
|
259
|
-
"includes_edge_case_tests"
|
|
260
|
-
]
|
|
261
|
-
},
|
|
262
|
-
{
|
|
263
|
-
"name": "Async task processing with error handling",
|
|
264
|
-
"input": "Process multiple async tasks concurrently with timeout and retry",
|
|
265
|
-
"expected_behavior": "Searches for async patterns, uses asyncio.gather with timeout, implements retry with backoff, handles exceptions with return_exceptions=True",
|
|
266
|
-
"validation_criteria": [
|
|
267
|
-
"searches_for_async_patterns",
|
|
268
|
-
"uses_asyncio_gather",
|
|
269
|
-
"implements_timeout",
|
|
270
|
-
"retry_with_exponential_backoff",
|
|
271
|
-
"error_handling_with_return_exceptions"
|
|
272
|
-
]
|
|
273
|
-
}
|
|
274
|
-
],
|
|
275
|
-
"performance_benchmarks": {
|
|
276
|
-
"response_time": 300,
|
|
277
|
-
"token_usage": 4096,
|
|
278
|
-
"success_rate": 0.95
|
|
279
|
-
}
|
|
280
|
-
},
|
|
281
|
-
"memory_routing": {
|
|
282
|
-
"description": "Stores Python patterns, architectural decisions, performance optimizations, type system usage, and testing strategies",
|
|
283
|
-
"categories": [
|
|
284
|
-
"Python 3.12-3.13 features and modern idioms",
|
|
285
|
-
"Service-oriented architecture and DI patterns",
|
|
286
|
-
"Performance optimization techniques and profiling results",
|
|
287
|
-
"Type system: generics, protocols, validation",
|
|
288
|
-
"Async programming patterns and asyncio",
|
|
289
|
-
"Testing strategies with pytest and hypothesis"
|
|
290
|
-
],
|
|
291
|
-
"keywords": [
|
|
292
|
-
"python",
|
|
293
|
-
"python-3-13",
|
|
294
|
-
"performance",
|
|
295
|
-
"optimization",
|
|
296
|
-
"SOA",
|
|
297
|
-
"service-oriented",
|
|
298
|
-
"dependency-injection",
|
|
299
|
-
"DI",
|
|
300
|
-
"async",
|
|
301
|
-
"asyncio",
|
|
302
|
-
"await",
|
|
303
|
-
"type-hints",
|
|
304
|
-
"mypy",
|
|
305
|
-
"pydantic",
|
|
306
|
-
"pytest",
|
|
307
|
-
"testing",
|
|
308
|
-
"profiling",
|
|
309
|
-
"caching",
|
|
310
|
-
"dataclass",
|
|
311
|
-
"ABC",
|
|
312
|
-
"interface",
|
|
313
|
-
"decorator",
|
|
314
|
-
"context-manager",
|
|
315
|
-
"generator",
|
|
316
|
-
"SOLID",
|
|
317
|
-
"clean-code",
|
|
318
|
-
"pep8",
|
|
319
|
-
"black",
|
|
320
|
-
"isort",
|
|
321
|
-
"packaging",
|
|
322
|
-
"pyproject",
|
|
323
|
-
"poetry",
|
|
324
|
-
"result-type",
|
|
325
|
-
"protocols",
|
|
326
|
-
"generics",
|
|
327
|
-
"type-guard",
|
|
328
|
-
"sliding-window",
|
|
329
|
-
"two-pointers",
|
|
330
|
-
"bfs",
|
|
331
|
-
"dfs",
|
|
332
|
-
"binary-search",
|
|
333
|
-
"hash-map",
|
|
334
|
-
"deque",
|
|
335
|
-
"complexity",
|
|
336
|
-
"big-o",
|
|
337
|
-
"algorithm-patterns",
|
|
338
|
-
"gather",
|
|
339
|
-
"timeout",
|
|
340
|
-
"retry",
|
|
341
|
-
"backoff",
|
|
342
|
-
"semaphore",
|
|
343
|
-
"worker-pool",
|
|
344
|
-
"task-cancellation"
|
|
345
|
-
],
|
|
346
|
-
"paths": [
|
|
347
|
-
"src/",
|
|
348
|
-
"tests/",
|
|
349
|
-
"*.py",
|
|
350
|
-
"pyproject.toml",
|
|
351
|
-
"setup.py",
|
|
352
|
-
"requirements.txt"
|
|
353
|
-
],
|
|
354
|
-
"extensions": [
|
|
355
|
-
".py",
|
|
356
|
-
".pyi",
|
|
357
|
-
".toml"
|
|
358
|
-
]
|
|
359
|
-
},
|
|
360
|
-
"dependencies": {
|
|
361
|
-
"python": [
|
|
362
|
-
"black>=24.0.0",
|
|
363
|
-
"isort>=5.13.0",
|
|
364
|
-
"mypy>=1.8.0",
|
|
365
|
-
"pytest>=8.0.0",
|
|
366
|
-
"pytest-cov>=4.1.0",
|
|
367
|
-
"pytest-asyncio>=0.23.0",
|
|
368
|
-
"hypothesis>=6.98.0",
|
|
369
|
-
"flake8>=7.0.0",
|
|
370
|
-
"pydantic>=2.6.0"
|
|
371
|
-
],
|
|
372
|
-
"system": [
|
|
373
|
-
"python3.12+"
|
|
374
|
-
],
|
|
375
|
-
"optional": false
|
|
376
|
-
},
|
|
377
|
-
"skills": [
|
|
378
|
-
"test-driven-development",
|
|
379
|
-
"systematic-debugging",
|
|
380
|
-
"async-testing",
|
|
381
|
-
"performance-profiling",
|
|
382
|
-
"security-scanning",
|
|
383
|
-
"code-review",
|
|
384
|
-
"refactoring-patterns",
|
|
385
|
-
"git-workflow"
|
|
386
|
-
]
|
|
387
|
-
}
|