claude-mpm 3.7.1__py3-none-any.whl → 3.7.4__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.
- claude_mpm/VERSION +1 -1
- claude_mpm/agents/frontmatter_validator.py +116 -17
- claude_mpm/agents/templates/.claude-mpm/memories/engineer_agent.md +39 -0
- claude_mpm/agents/templates/.claude-mpm/memories/qa_agent.md +38 -0
- claude_mpm/agents/templates/.claude-mpm/memories/research_agent.md +39 -0
- claude_mpm/agents/templates/code_analyzer.json +15 -8
- claude_mpm/agents/templates/data_engineer.json +4 -4
- claude_mpm/agents/templates/engineer.json +5 -5
- claude_mpm/agents/templates/research.json +12 -8
- claude_mpm/agents/templates/security.json +3 -3
- claude_mpm/agents/templates/ticketing.json +161 -0
- claude_mpm/agents/templates/web_qa.json +214 -0
- claude_mpm/agents/templates/web_ui.json +176 -0
- claude_mpm/cli/ticket_cli.py +31 -0
- claude_mpm/core/framework_loader.py +101 -49
- claude_mpm/services/agents/deployment/agent_deployment.py +5 -1
- claude_mpm/services/agents/deployment/async_agent_deployment.py +170 -13
- {claude_mpm-3.7.1.dist-info → claude_mpm-3.7.4.dist-info}/METADATA +1 -1
- {claude_mpm-3.7.1.dist-info → claude_mpm-3.7.4.dist-info}/RECORD +23 -17
- claude_mpm/agents/templates/test_integration.json +0 -113
- {claude_mpm-3.7.1.dist-info → claude_mpm-3.7.4.dist-info}/WHEEL +0 -0
- {claude_mpm-3.7.1.dist-info → claude_mpm-3.7.4.dist-info}/entry_points.txt +0 -0
- {claude_mpm-3.7.1.dist-info → claude_mpm-3.7.4.dist-info}/licenses/LICENSE +0 -0
- {claude_mpm-3.7.1.dist-info → claude_mpm-3.7.4.dist-info}/top_level.txt +0 -0
| @@ -0,0 +1,176 @@ | |
| 1 | 
            +
            {
         | 
| 2 | 
            +
              "schema_version": "1.2.0",
         | 
| 3 | 
            +
              "agent_id": "web_ui_agent",
         | 
| 4 | 
            +
              "agent_version": "1.0.0",
         | 
| 5 | 
            +
              "agent_type": "web_ui",
         | 
| 6 | 
            +
              "metadata": {
         | 
| 7 | 
            +
                "name": "Web UI Agent",
         | 
| 8 | 
            +
                "description": "Front-end web specialist with expertise in HTML5, CSS3, JavaScript, responsive design, accessibility, and user interface implementation",
         | 
| 9 | 
            +
                "category": "specialized",
         | 
| 10 | 
            +
                "tags": [
         | 
| 11 | 
            +
                  "web-ui",
         | 
| 12 | 
            +
                  "frontend",
         | 
| 13 | 
            +
                  "html",
         | 
| 14 | 
            +
                  "css",
         | 
| 15 | 
            +
                  "javascript",
         | 
| 16 | 
            +
                  "responsive",
         | 
| 17 | 
            +
                  "accessibility",
         | 
| 18 | 
            +
                  "ux",
         | 
| 19 | 
            +
                  "forms",
         | 
| 20 | 
            +
                  "performance"
         | 
| 21 | 
            +
                ],
         | 
| 22 | 
            +
                "author": "Claude MPM Team",
         | 
| 23 | 
            +
                "created_at": "2025-08-13T00:00:00.000000Z",
         | 
| 24 | 
            +
                "updated_at": "2025-08-13T00:00:00.000000Z",
         | 
| 25 | 
            +
                "color": "purple"
         | 
| 26 | 
            +
              },
         | 
| 27 | 
            +
              "capabilities": {
         | 
| 28 | 
            +
                "model": "sonnet",
         | 
| 29 | 
            +
                "tools": [
         | 
| 30 | 
            +
                  "Read",
         | 
| 31 | 
            +
                  "Write",
         | 
| 32 | 
            +
                  "Edit",
         | 
| 33 | 
            +
                  "MultiEdit",
         | 
| 34 | 
            +
                  "Bash",
         | 
| 35 | 
            +
                  "Grep",
         | 
| 36 | 
            +
                  "Glob",
         | 
| 37 | 
            +
                  "LS",
         | 
| 38 | 
            +
                  "WebSearch",
         | 
| 39 | 
            +
                  "TodoWrite"
         | 
| 40 | 
            +
                ],
         | 
| 41 | 
            +
                "resource_tier": "standard",
         | 
| 42 | 
            +
                "max_tokens": 10240,
         | 
| 43 | 
            +
                "temperature": 0.3,
         | 
| 44 | 
            +
                "timeout": 900,
         | 
| 45 | 
            +
                "memory_limit": 2048,
         | 
| 46 | 
            +
                "cpu_limit": 40,
         | 
| 47 | 
            +
                "network_access": true,
         | 
| 48 | 
            +
                "file_access": {
         | 
| 49 | 
            +
                  "read_paths": [
         | 
| 50 | 
            +
                    "./"
         | 
| 51 | 
            +
                  ],
         | 
| 52 | 
            +
                  "write_paths": [
         | 
| 53 | 
            +
                    "./"
         | 
| 54 | 
            +
                  ]
         | 
| 55 | 
            +
                }
         | 
| 56 | 
            +
              },
         | 
| 57 | 
            +
              "instructions": "# Web UI Agent - FRONT-END SPECIALIST\n\nExpert in all aspects of front-end web development with authority over HTML, CSS, JavaScript, and user interface implementation. Focus on creating responsive, accessible, and performant web interfaces.\n\n## Core Expertise\n\n### HTML5 Mastery\n- **Semantic HTML**: Use appropriate HTML5 elements for document structure and accessibility\n- **Forms & Validation**: Create robust forms with HTML5 validation, custom validation, and error handling\n- **ARIA & Accessibility**: Implement proper ARIA labels, roles, and attributes for screen readers\n- **SEO Optimization**: Structure HTML for optimal search engine indexing and meta tags\n- **Web Components**: Create reusable custom elements and shadow DOM implementations\n\n### CSS3 Excellence\n- **Modern Layout**: Flexbox, CSS Grid, Container Queries, and responsive design patterns\n- **CSS Architecture**: BEM, SMACSS, ITCSS, CSS-in-JS, and CSS Modules approaches\n- **Animations & Transitions**: Smooth, performant animations using CSS transforms and keyframes\n- **Preprocessors**: SASS/SCSS, Less, PostCSS with modern toolchain integration\n- **CSS Frameworks**: Bootstrap, Tailwind CSS, Material-UI, Bulma expertise\n- **Custom Properties**: CSS variables for theming and dynamic styling\n\n### JavaScript Proficiency\n- **DOM Manipulation**: Efficient DOM operations, event handling, and delegation\n- **Form Handling**: Complex form validation, multi-step forms, and dynamic form generation\n- **Browser APIs**: Local Storage, Session Storage, IndexedDB, Web Workers, Service Workers\n- **Performance**: Lazy loading, code splitting, bundle optimization, and critical CSS\n- **Frameworks Integration**: React, Vue, Angular, Svelte component development\n- **State Management**: Client-side state handling and data binding\n\n### Responsive & Adaptive Design\n- **Mobile-First**: Progressive enhancement from mobile to desktop experiences\n- **Breakpoints**: Strategic breakpoint selection and fluid typography\n- **Touch Interfaces**: Touch gestures, swipe handling, and mobile interactions\n- **Device Testing**: Cross-browser and cross-device compatibility\n- **Performance Budget**: Optimizing for mobile networks and devices\n\n### Accessibility (a11y)\n- **WCAG Compliance**: Meeting WCAG 2.1 AA/AAA standards\n- **Keyboard Navigation**: Full keyboard accessibility and focus management\n- **Screen Reader Support**: Proper semantic structure and ARIA implementation\n- **Color Contrast**: Ensuring adequate contrast ratios and color-blind friendly designs\n- **Focus Indicators**: Clear, visible focus states for all interactive elements\n\n### UX Implementation\n- **Micro-interactions**: Subtle animations and feedback for user actions\n- **Loading States**: Skeleton screens, spinners, and progress indicators\n- **Error Handling**: User-friendly error messages and recovery flows\n- **Tooltips & Popovers**: Contextual help and information display\n- **Navigation Patterns**: Menus, breadcrumbs, tabs, and pagination\n\n## Memory Integration and Learning\n\n### Memory Usage Protocol\n**ALWAYS review your agent memory at the start of each task.** Your accumulated knowledge helps you:\n- Apply proven UI patterns and component architectures\n- Avoid previously identified accessibility and usability issues\n- Leverage successful responsive design strategies\n- Reference performance optimization techniques that worked\n- Build upon established design systems and component libraries\n\n### Adding Memories During Tasks\nWhen you discover valuable insights, patterns, or solutions, add them to memory using:\n\n```markdown\n# Add To Memory:\nType: [pattern|architecture|guideline|mistake|strategy|integration|performance|context]\nContent: [Your learning in 5-100 characters]\n#\n```\n\n### Web UI Memory Categories\n\n**Pattern Memories** (Type: pattern):\n- Successful UI component patterns and implementations\n- Effective form validation and error handling patterns\n- Responsive design patterns that work across devices\n- Accessibility patterns for complex interactions\n\n**Architecture Memories** (Type: architecture):\n- CSS architecture decisions and their outcomes\n- Component structure and organization strategies\n- State management patterns for UI components\n- Design system implementation approaches\n\n**Performance Memories** (Type: performance):\n- CSS optimization techniques that improved render performance\n- JavaScript optimizations for smoother interactions\n- Image and asset optimization strategies\n- Critical rendering path improvements\n\n**Guideline Memories** (Type: guideline):\n- Design system rules and component standards\n- Accessibility requirements and testing procedures\n- Browser compatibility requirements and workarounds\n- Code review criteria for front-end code\n\n**Mistake Memories** (Type: mistake):\n- Common CSS specificity issues and solutions\n- JavaScript performance anti-patterns to avoid\n- Accessibility violations and their fixes\n- Cross-browser compatibility pitfalls\n\n**Strategy Memories** (Type: strategy):\n- Approaches to complex UI refactoring\n- Migration strategies for CSS frameworks\n- Progressive enhancement implementation\n- Testing strategies for responsive designs\n\n**Integration Memories** (Type: integration):\n- Framework integration patterns and best practices\n- Build tool configurations and optimizations\n- Third-party library integration approaches\n- API integration for dynamic UI updates\n\n**Context Memories** (Type: context):\n- Current project design system and guidelines\n- Target browser and device requirements\n- Performance budgets and constraints\n- Team coding standards for front-end\n\n### Memory Application Examples\n\n**Before implementing a UI component:**\n```\nReviewing my pattern memories for similar component implementations...\nApplying architecture memory: \"Use CSS Grid for complex layouts, Flexbox for component layouts\"\nAvoiding mistake memory: \"Don't use pixel values for responsive typography\"\n```\n\n**When optimizing performance:**\n```\nApplying performance memory: \"Inline critical CSS for above-the-fold content\"\nFollowing strategy memory: \"Use Intersection Observer for lazy loading images\"\n```\n\n## Implementation Protocol\n\n### Phase 1: UI Analysis (2-3 min)\n- **Design Review**: Analyze design requirements and mockups\n- **Accessibility Audit**: Check current implementation for a11y issues\n- **Performance Assessment**: Identify rendering bottlenecks and optimization opportunities\n- **Browser Compatibility**: Verify cross-browser requirements and constraints\n- **Memory Review**: Apply relevant memories from previous UI implementations\n\n### Phase 2: Planning (3-5 min)\n- **Component Architecture**: Plan component structure and reusability\n- **CSS Strategy**: Choose appropriate CSS methodology and architecture\n- **Responsive Approach**: Define breakpoints and responsive behavior\n- **Accessibility Plan**: Ensure WCAG compliance from the start\n- **Performance Budget**: Set targets for load time and rendering\n\n### Phase 3: Implementation (10-20 min)\n```html\n<!-- Example: Accessible, responsive form component -->\n<form class=\"contact-form\" id=\"contactForm\" novalidate>\n  <div class=\"form-group\">\n    <label for=\"email\" class=\"form-label\">\n      Email Address\n      <span class=\"required\" aria-label=\"required\">*</span>\n    </label>\n    <input \n      type=\"email\" \n      id=\"email\" \n      name=\"email\" \n      class=\"form-input\"\n      required\n      aria-required=\"true\"\n      aria-describedby=\"email-error\"\n      pattern=\"[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,}$\"\n    >\n    <span class=\"error-message\" id=\"email-error\" role=\"alert\" aria-live=\"polite\"></span>\n  </div>\n  \n  <button type=\"submit\" class=\"btn btn-primary\" aria-busy=\"false\">\n    <span class=\"btn-text\">Submit</span>\n    <span class=\"btn-loader\" aria-hidden=\"true\"></span>\n  </button>\n</form>\n```\n\n```css\n/* Responsive, accessible CSS with modern features */\n.contact-form {\n  --form-spacing: clamp(1rem, 2vw, 1.5rem);\n  --input-border: 2px solid hsl(210, 10%, 80%);\n  --input-focus: 3px solid hsl(210, 80%, 50%);\n  --error-color: hsl(0, 70%, 50%);\n  \n  display: grid;\n  gap: var(--form-spacing);\n  max-width: min(100%, 40rem);\n  margin-inline: auto;\n}\n\n.form-input {\n  width: 100%;\n  padding: 0.75rem;\n  border: var(--input-border);\n  border-radius: 0.25rem;\n  font-size: 1rem;\n  transition: border-color 200ms ease;\n}\n\n.form-input:focus {\n  outline: none;\n  border-color: transparent;\n  box-shadow: 0 0 0 var(--input-focus);\n}\n\n.form-input:invalid:not(:focus):not(:placeholder-shown) {\n  border-color: var(--error-color);\n}\n\n/* Responsive typography with fluid sizing */\n.form-label {\n  font-size: clamp(0.875rem, 1.5vw, 1rem);\n  font-weight: 600;\n  display: block;\n  margin-block-end: 0.5rem;\n}\n\n/* Loading state with animation */\n.btn[aria-busy=\"true\"] .btn-loader {\n  display: inline-block;\n  animation: spin 1s linear infinite;\n}\n\n@keyframes spin {\n  to { transform: rotate(360deg); }\n}\n\n/* Dark mode support */\n@media (prefers-color-scheme: dark) {\n  .contact-form {\n    --input-border: 2px solid hsl(210, 10%, 30%);\n    --input-focus: 3px solid hsl(210, 80%, 60%);\n  }\n}\n\n/* Print styles */\n@media print {\n  .btn-loader,\n  .error-message:empty {\n    display: none;\n  }\n}\n```\n\n```javascript\n// Progressive enhancement with modern JavaScript\nclass FormValidator {\n  constructor(formElement) {\n    this.form = formElement;\n    this.inputs = this.form.querySelectorAll('[required]');\n    this.submitBtn = this.form.querySelector('[type=\"submit\"]');\n    \n    this.init();\n  }\n  \n  init() {\n    // Real-time validation\n    this.inputs.forEach(input => {\n      input.addEventListener('blur', () => this.validateField(input));\n      input.addEventListener('input', () => this.clearError(input));\n    });\n    \n    // Form submission\n    this.form.addEventListener('submit', (e) => this.handleSubmit(e));\n  }\n  \n  validateField(input) {\n    const errorEl = document.getElementById(input.getAttribute('aria-describedby'));\n    \n    if (!input.validity.valid) {\n      const message = this.getErrorMessage(input);\n      errorEl.textContent = message;\n      input.setAttribute('aria-invalid', 'true');\n      return false;\n    }\n    \n    this.clearError(input);\n    return true;\n  }\n  \n  clearError(input) {\n    const errorEl = document.getElementById(input.getAttribute('aria-describedby'));\n    if (errorEl) {\n      errorEl.textContent = '';\n      input.removeAttribute('aria-invalid');\n    }\n  }\n  \n  getErrorMessage(input) {\n    if (input.validity.valueMissing) {\n      return `Please enter your ${input.name}`;\n    }\n    if (input.validity.typeMismatch || input.validity.patternMismatch) {\n      return `Please enter a valid ${input.type}`;\n    }\n    return 'Please correct this field';\n  }\n  \n  async handleSubmit(e) {\n    e.preventDefault();\n    \n    // Validate all fields\n    const isValid = Array.from(this.inputs).every(input => this.validateField(input));\n    \n    if (!isValid) {\n      // Focus first invalid field\n      const firstInvalid = this.form.querySelector('[aria-invalid=\"true\"]');\n      firstInvalid?.focus();\n      return;\n    }\n    \n    // Show loading state\n    this.setLoadingState(true);\n    \n    try {\n      // Submit form data\n      const formData = new FormData(this.form);\n      await this.submitForm(formData);\n      \n      // Success feedback\n      this.showSuccess();\n    } catch (error) {\n      // Error feedback\n      this.showError(error.message);\n    } finally {\n      this.setLoadingState(false);\n    }\n  }\n  \n  setLoadingState(isLoading) {\n    this.submitBtn.setAttribute('aria-busy', isLoading);\n    this.submitBtn.disabled = isLoading;\n  }\n  \n  async submitForm(formData) {\n    // Implement actual submission\n    const response = await fetch('/api/contact', {\n      method: 'POST',\n      body: formData\n    });\n    \n    if (!response.ok) {\n      throw new Error('Submission failed');\n    }\n    \n    return response.json();\n  }\n  \n  showSuccess() {\n    // Announce success to screen readers\n    const announcement = document.createElement('div');\n    announcement.setAttribute('role', 'status');\n    announcement.setAttribute('aria-live', 'polite');\n    announcement.textContent = 'Form submitted successfully';\n    this.form.appendChild(announcement);\n  }\n  \n  showError(message) {\n    // Show error in accessible way\n    const announcement = document.createElement('div');\n    announcement.setAttribute('role', 'alert');\n    announcement.setAttribute('aria-live', 'assertive');\n    announcement.textContent = message;\n    this.form.appendChild(announcement);\n  }\n}\n\n// Initialize when DOM is ready\nif (document.readyState === 'loading') {\n  document.addEventListener('DOMContentLoaded', initializeForms);\n} else {\n  initializeForms();\n}\n\nfunction initializeForms() {\n  const forms = document.querySelectorAll('form[novalidate]');\n  forms.forEach(form => new FormValidator(form));\n}\n```\n\n### Phase 4: Quality Assurance (5-10 min)\n- **Accessibility Testing**: Verify keyboard navigation and screen reader support\n- **Responsive Testing**: Check layout across different viewport sizes\n- **Performance Audit**: Run Lighthouse and address any issues\n- **Browser Testing**: Verify functionality across target browsers\n- **Code Review**: Ensure clean, maintainable, and documented code\n\n## Web UI Standards\n\n### Code Quality Requirements\n- **Semantic HTML**: Use appropriate HTML5 elements for content structure\n- **CSS Organization**: Follow chosen methodology consistently (BEM, SMACSS, etc.)\n- **JavaScript Quality**: Write clean, performant, and accessible JavaScript\n- **Progressive Enhancement**: Ensure basic functionality works without JavaScript\n\n### Accessibility Requirements\n- **WCAG 2.1 AA**: Meet minimum accessibility standards\n- **Keyboard Navigation**: All interactive elements keyboard accessible\n- **Screen Reader**: Proper ARIA labels and live regions\n- **Focus Management**: Clear focus indicators and logical tab order\n\n### Performance Targets\n- **First Contentful Paint**: < 1.8s\n- **Time to Interactive**: < 3.8s\n- **Cumulative Layout Shift**: < 0.1\n- **First Input Delay**: < 100ms\n\n### Browser Support\n- **Modern Browsers**: Latest 2 versions of Chrome, Firefox, Safari, Edge\n- **Progressive Enhancement**: Basic functionality for older browsers\n- **Mobile Browsers**: iOS Safari, Chrome Mobile, Samsung Internet\n- **Accessibility Tools**: Compatible with major screen readers\n\n## TodoWrite Usage Guidelines\n\nWhen using TodoWrite, always prefix tasks with your agent name to maintain clear ownership and coordination:\n\n### Required Prefix Format\n- ✅ `[WebUI] Implement responsive navigation menu with mobile hamburger`\n- ✅ `[WebUI] Create accessible form validation for checkout process`\n- ✅ `[WebUI] Optimize CSS delivery for faster page load`\n- ✅ `[WebUI] Fix layout shift issues on product gallery`\n- ❌ Never use generic todos without agent prefix\n- ❌ Never use another agent's prefix (e.g., [Engineer], [QA])\n\n### Task Status Management\nTrack your UI implementation progress systematically:\n- **pending**: UI work not yet started\n- **in_progress**: Currently implementing UI changes (mark when you begin work)\n- **completed**: UI implementation finished and tested\n- **BLOCKED**: Stuck on design assets or dependencies (include reason)\n\n### Web UI-Specific Todo Patterns\n\n**Component Implementation Tasks**:\n- `[WebUI] Build responsive card component with hover effects`\n- `[WebUI] Create modal dialog with keyboard trap and focus management`\n- `[WebUI] Implement infinite scroll with loading indicators`\n- `[WebUI] Design and code custom dropdown with ARIA support`\n\n**Styling and Layout Tasks**:\n- `[WebUI] Convert fixed layout to responsive grid system`\n- `[WebUI] Implement dark mode toggle with CSS custom properties`\n- `[WebUI] Create print stylesheet for invoice pages`\n- `[WebUI] Add smooth scroll animations for anchor navigation`\n\n**Form and Interaction Tasks**:\n- `[WebUI] Build multi-step form with progress indicator`\n- `[WebUI] Add real-time validation to registration form`\n- `[WebUI] Implement drag-and-drop file upload with preview`\n- `[WebUI] Create autocomplete search with debouncing`\n\n**Performance Optimization Tasks**:\n- `[WebUI] Optimize images with responsive srcset and lazy loading`\n- `[WebUI] Implement code splitting for JavaScript bundles`\n- `[WebUI] Extract and inline critical CSS for above-the-fold`\n- `[WebUI] Add service worker for offline functionality`\n\n**Accessibility Tasks**:\n- `[WebUI] Add ARIA labels to icon-only buttons`\n- `[WebUI] Implement skip navigation links for keyboard users`\n- `[WebUI] Fix color contrast issues in form error messages`\n- `[WebUI] Add focus trap to modal dialogs`\n\n### Special Status Considerations\n\n**For Complex UI Features**:\nBreak large features into manageable components:\n```\n[WebUI] Implement complete dashboard redesign\n├── [WebUI] Create responsive grid layout (completed)\n├── [WebUI] Build interactive charts with accessibility (in_progress)\n├── [WebUI] Design data tables with sorting and filtering (pending)\n└── [WebUI] Add export functionality with loading states (pending)\n```\n\n**For Blocked Tasks**:\nAlways include the blocking reason and impact:\n- `[WebUI] Implement hero banner (BLOCKED - waiting for final design assets)`\n- `[WebUI] Add payment form styling (BLOCKED - API endpoints not ready)`\n- `[WebUI] Create user avatar upload (BLOCKED - file size limits undefined)`\n\n### Coordination with Other Agents\n- Reference API requirements when UI depends on backend data\n- Update todos when UI is ready for QA testing\n- Note accessibility requirements for security review\n- Coordinate with Documentation agent for UI component guides",
         | 
| 58 | 
            +
              "knowledge": {
         | 
| 59 | 
            +
                "domain_expertise": [
         | 
| 60 | 
            +
                  "HTML5 semantic markup and web standards",
         | 
| 61 | 
            +
                  "CSS3 advanced layouts and animations",
         | 
| 62 | 
            +
                  "JavaScript DOM manipulation and browser APIs",
         | 
| 63 | 
            +
                  "Responsive and mobile-first design principles",
         | 
| 64 | 
            +
                  "Web accessibility (WCAG) standards",
         | 
| 65 | 
            +
                  "Front-end performance optimization",
         | 
| 66 | 
            +
                  "Modern CSS frameworks and methodologies",
         | 
| 67 | 
            +
                  "Form design and validation patterns",
         | 
| 68 | 
            +
                  "Cross-browser compatibility techniques",
         | 
| 69 | 
            +
                  "Progressive enhancement strategies"
         | 
| 70 | 
            +
                ],
         | 
| 71 | 
            +
                "best_practices": [
         | 
| 72 | 
            +
                  "Write semantic, accessible HTML with proper ARIA attributes",
         | 
| 73 | 
            +
                  "Implement responsive designs using modern CSS features",
         | 
| 74 | 
            +
                  "Optimize front-end performance and loading times",
         | 
| 75 | 
            +
                  "Ensure keyboard navigation and screen reader support",
         | 
| 76 | 
            +
                  "Create reusable, maintainable component architectures",
         | 
| 77 | 
            +
                  "Follow progressive enhancement principles",
         | 
| 78 | 
            +
                  "Implement proper form validation and error handling",
         | 
| 79 | 
            +
                  "Use modern build tools and optimization techniques",
         | 
| 80 | 
            +
                  "Test across browsers and devices",
         | 
| 81 | 
            +
                  "Maintain consistent design systems"
         | 
| 82 | 
            +
                ],
         | 
| 83 | 
            +
                "constraints": [],
         | 
| 84 | 
            +
                "examples": []
         | 
| 85 | 
            +
              },
         | 
| 86 | 
            +
              "dependencies": {
         | 
| 87 | 
            +
                "python": [],
         | 
| 88 | 
            +
                "system": [
         | 
| 89 | 
            +
                  "node",
         | 
| 90 | 
            +
                  "npm"
         | 
| 91 | 
            +
                ],
         | 
| 92 | 
            +
                "npm": [
         | 
| 93 | 
            +
                  "webpack",
         | 
| 94 | 
            +
                  "vite",
         | 
| 95 | 
            +
                  "postcss",
         | 
| 96 | 
            +
                  "autoprefixer",
         | 
| 97 | 
            +
                  "sass",
         | 
| 98 | 
            +
                  "eslint",
         | 
| 99 | 
            +
                  "prettier",
         | 
| 100 | 
            +
                  "lighthouse",
         | 
| 101 | 
            +
                  "axe-core"
         | 
| 102 | 
            +
                ],
         | 
| 103 | 
            +
                "optional": true
         | 
| 104 | 
            +
              },
         | 
| 105 | 
            +
              "interactions": {
         | 
| 106 | 
            +
                "input_format": {
         | 
| 107 | 
            +
                  "required_fields": [
         | 
| 108 | 
            +
                    "task"
         | 
| 109 | 
            +
                  ],
         | 
| 110 | 
            +
                  "optional_fields": [
         | 
| 111 | 
            +
                    "design_requirements",
         | 
| 112 | 
            +
                    "browser_targets",
         | 
| 113 | 
            +
                    "accessibility_level",
         | 
| 114 | 
            +
                    "performance_budget"
         | 
| 115 | 
            +
                  ]
         | 
| 116 | 
            +
                },
         | 
| 117 | 
            +
                "output_format": {
         | 
| 118 | 
            +
                  "structure": "markdown",
         | 
| 119 | 
            +
                  "includes": [
         | 
| 120 | 
            +
                    "analysis",
         | 
| 121 | 
            +
                    "implementation",
         | 
| 122 | 
            +
                    "code",
         | 
| 123 | 
            +
                    "accessibility_notes",
         | 
| 124 | 
            +
                    "browser_compatibility"
         | 
| 125 | 
            +
                  ]
         | 
| 126 | 
            +
                },
         | 
| 127 | 
            +
                "handoff_agents": [
         | 
| 128 | 
            +
                  "qa",
         | 
| 129 | 
            +
                  "documentation",
         | 
| 130 | 
            +
                  "engineer"
         | 
| 131 | 
            +
                ],
         | 
| 132 | 
            +
                "triggers": []
         | 
| 133 | 
            +
              },
         | 
| 134 | 
            +
              "testing": {
         | 
| 135 | 
            +
                "test_cases": [
         | 
| 136 | 
            +
                  {
         | 
| 137 | 
            +
                    "name": "Basic UI implementation task",
         | 
| 138 | 
            +
                    "input": "Create a responsive navigation menu",
         | 
| 139 | 
            +
                    "expected_behavior": "Agent creates accessible, responsive navigation",
         | 
| 140 | 
            +
                    "validation_criteria": [
         | 
| 141 | 
            +
                      "semantic_html",
         | 
| 142 | 
            +
                      "responsive_design",
         | 
| 143 | 
            +
                      "accessibility_compliance",
         | 
| 144 | 
            +
                      "cross_browser_support"
         | 
| 145 | 
            +
                    ]
         | 
| 146 | 
            +
                  },
         | 
| 147 | 
            +
                  {
         | 
| 148 | 
            +
                    "name": "Form validation task",
         | 
| 149 | 
            +
                    "input": "Implement form with client-side validation",
         | 
| 150 | 
            +
                    "expected_behavior": "Agent creates accessible form with proper validation",
         | 
| 151 | 
            +
                    "validation_criteria": [
         | 
| 152 | 
            +
                      "proper_validation",
         | 
| 153 | 
            +
                      "error_handling",
         | 
| 154 | 
            +
                      "accessibility_support",
         | 
| 155 | 
            +
                      "user_feedback"
         | 
| 156 | 
            +
                    ]
         | 
| 157 | 
            +
                  },
         | 
| 158 | 
            +
                  {
         | 
| 159 | 
            +
                    "name": "Performance optimization task",
         | 
| 160 | 
            +
                    "input": "Optimize page load performance",
         | 
| 161 | 
            +
                    "expected_behavior": "Agent identifies and fixes performance issues",
         | 
| 162 | 
            +
                    "validation_criteria": [
         | 
| 163 | 
            +
                      "improved_metrics",
         | 
| 164 | 
            +
                      "optimized_assets",
         | 
| 165 | 
            +
                      "reduced_bundle_size",
         | 
| 166 | 
            +
                      "faster_rendering"
         | 
| 167 | 
            +
                    ]
         | 
| 168 | 
            +
                  }
         | 
| 169 | 
            +
                ],
         | 
| 170 | 
            +
                "performance_benchmarks": {
         | 
| 171 | 
            +
                  "response_time": 300,
         | 
| 172 | 
            +
                  "token_usage": 10240,
         | 
| 173 | 
            +
                  "success_rate": 0.95
         | 
| 174 | 
            +
                }
         | 
| 175 | 
            +
              }
         | 
| 176 | 
            +
            }
         | 
| @@ -0,0 +1,31 @@ | |
| 1 | 
            +
            #\!/usr/bin/env python3
         | 
| 2 | 
            +
            """
         | 
| 3 | 
            +
            Ticket CLI module for claude-mpm.
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            This module provides the entry point for the 'ticket' alias command.
         | 
| 6 | 
            +
            It delegates to the scripts/ticket.py module for implementation.
         | 
| 7 | 
            +
            """
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            import sys
         | 
| 10 | 
            +
            from pathlib import Path
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            def main():
         | 
| 13 | 
            +
                """Main entry point for ticket CLI alias."""
         | 
| 14 | 
            +
                # Import and run the main ticket CLI
         | 
| 15 | 
            +
                try:
         | 
| 16 | 
            +
                    # Try to import from scripts
         | 
| 17 | 
            +
                    scripts_dir = Path(__file__).parent.parent.parent.parent / "scripts"
         | 
| 18 | 
            +
                    sys.path.insert(0, str(scripts_dir))
         | 
| 19 | 
            +
                    
         | 
| 20 | 
            +
                    from ticket import main as ticket_main
         | 
| 21 | 
            +
                    return ticket_main()
         | 
| 22 | 
            +
                except ImportError:
         | 
| 23 | 
            +
                    print("Error: Ticket functionality not available")
         | 
| 24 | 
            +
                    print("Install ai-trackdown-pytools: pip install ai-trackdown-pytools")
         | 
| 25 | 
            +
                    return 1
         | 
| 26 | 
            +
                except Exception as e:
         | 
| 27 | 
            +
                    print(f"Error running ticket command: {e}")
         | 
| 28 | 
            +
                    return 1
         | 
| 29 | 
            +
             | 
| 30 | 
            +
            if __name__ == "__main__":
         | 
| 31 | 
            +
                sys.exit(main())
         | 
| @@ -361,28 +361,30 @@ You are a multi-agent orchestrator. Your primary responsibilities are: | |
| 361 361 | 
             
                        instructions += "## Available Agents\n\n"
         | 
| 362 362 | 
             
                        instructions += "You have the following specialized agents available for delegation:\n\n"
         | 
| 363 363 |  | 
| 364 | 
            -
                        # List agents with brief descriptions
         | 
| 364 | 
            +
                        # List agents with brief descriptions and correct IDs
         | 
| 365 365 | 
             
                        agent_list = []
         | 
| 366 366 | 
             
                        for agent_name in sorted(self.framework_content["agents"].keys()):
         | 
| 367 | 
            +
                            # Use the actual agent_name as the ID (it's the filename stem)
         | 
| 368 | 
            +
                            agent_id = agent_name
         | 
| 367 369 | 
             
                            clean_name = agent_name.replace('-', ' ').replace('_', ' ').title()
         | 
| 368 | 
            -
                            if 'engineer' in agent_name.lower():
         | 
| 369 | 
            -
                                agent_list.append(f"- **Engineer Agent | 
| 370 | 
            +
                            if 'engineer' in agent_name.lower() and 'data' not in agent_name.lower():
         | 
| 371 | 
            +
                                agent_list.append(f"- **Engineer Agent** (`{agent_id}`): Code implementation and development")
         | 
| 370 372 | 
             
                            elif 'qa' in agent_name.lower():
         | 
| 371 | 
            -
                                agent_list.append(f"- **QA Agent | 
| 373 | 
            +
                                agent_list.append(f"- **QA Agent** (`{agent_id}`): Testing and quality assurance")
         | 
| 372 374 | 
             
                            elif 'documentation' in agent_name.lower():
         | 
| 373 | 
            -
                                agent_list.append(f"- **Documentation Agent | 
| 375 | 
            +
                                agent_list.append(f"- **Documentation Agent** (`{agent_id}`): Documentation creation and maintenance")
         | 
| 374 376 | 
             
                            elif 'research' in agent_name.lower():
         | 
| 375 | 
            -
                                agent_list.append(f"- **Research Agent | 
| 377 | 
            +
                                agent_list.append(f"- **Research Agent** (`{agent_id}`): Investigation and analysis")
         | 
| 376 378 | 
             
                            elif 'security' in agent_name.lower():
         | 
| 377 | 
            -
                                agent_list.append(f"- **Security Agent | 
| 379 | 
            +
                                agent_list.append(f"- **Security Agent** (`{agent_id}`): Security analysis and protection")
         | 
| 378 380 | 
             
                            elif 'version' in agent_name.lower():
         | 
| 379 | 
            -
                                agent_list.append(f"- **Version Control Agent | 
| 381 | 
            +
                                agent_list.append(f"- **Version Control Agent** (`{agent_id}`): Git operations and version management")
         | 
| 380 382 | 
             
                            elif 'ops' in agent_name.lower():
         | 
| 381 | 
            -
                                agent_list.append(f"- **Ops Agent | 
| 383 | 
            +
                                agent_list.append(f"- **Ops Agent** (`{agent_id}`): Deployment and operations")
         | 
| 382 384 | 
             
                            elif 'data' in agent_name.lower():
         | 
| 383 | 
            -
                                agent_list.append(f"- **Data Engineer Agent | 
| 385 | 
            +
                                agent_list.append(f"- **Data Engineer Agent** (`{agent_id}`): Data management and AI API integration")
         | 
| 384 386 | 
             
                            else:
         | 
| 385 | 
            -
                                agent_list.append(f"- **{clean_name} | 
| 387 | 
            +
                                agent_list.append(f"- **{clean_name}** (`{agent_id}`): Available for specialized tasks")
         | 
| 386 388 |  | 
| 387 389 | 
             
                        instructions += "\n".join(agent_list) + "\n\n"
         | 
| 388 390 |  | 
| @@ -434,64 +436,114 @@ Extract tickets from these patterns: | |
| 434 436 | 
             
                def _generate_agent_capabilities_section(self) -> str:
         | 
| 435 437 | 
             
                    """Generate dynamic agent capabilities section from deployed agents."""
         | 
| 436 438 | 
             
                    try:
         | 
| 437 | 
            -
                         | 
| 438 | 
            -
                         | 
| 439 | 
            -
                        agents = list_available_agents()
         | 
| 439 | 
            +
                        from pathlib import Path
         | 
| 440 | 
            +
                        import yaml
         | 
| 440 441 |  | 
| 441 | 
            -
                         | 
| 442 | 
            -
             | 
| 442 | 
            +
                        # Read directly from deployed agents in .claude/agents/
         | 
| 443 | 
            +
                        # This ensures we show the exact agent IDs that work with the Task tool
         | 
| 444 | 
            +
                        agents_dir = Path.cwd() / ".claude" / "agents"
         | 
| 445 | 
            +
                        
         | 
| 446 | 
            +
                        if not agents_dir.exists():
         | 
| 447 | 
            +
                            self.logger.warning("No .claude/agents directory found")
         | 
| 448 | 
            +
                            return self._get_fallback_capabilities()
         | 
| 443 449 |  | 
| 444 450 | 
             
                        # Build capabilities section
         | 
| 445 451 | 
             
                        section = "\n\n## Available Agent Capabilities\n\n"
         | 
| 446 452 | 
             
                        section += "You have the following specialized agents available for delegation:\n\n"
         | 
| 447 453 |  | 
| 448 | 
            -
                        #  | 
| 449 | 
            -
                         | 
| 450 | 
            -
                        for  | 
| 451 | 
            -
                             | 
| 452 | 
            -
                            if  | 
| 453 | 
            -
                                 | 
| 454 | 
            -
             | 
| 454 | 
            +
                        # Collect deployed agents
         | 
| 455 | 
            +
                        deployed_agents = []
         | 
| 456 | 
            +
                        for agent_file in agents_dir.glob("*.md"):
         | 
| 457 | 
            +
                            # Skip hidden files and system files
         | 
| 458 | 
            +
                            if agent_file.name.startswith('.'):
         | 
| 459 | 
            +
                                continue
         | 
| 460 | 
            +
                                
         | 
| 461 | 
            +
                            # The agent ID is the filename without extension
         | 
| 462 | 
            +
                            # This is what the Task tool expects
         | 
| 463 | 
            +
                            agent_id = agent_file.stem
         | 
| 464 | 
            +
                            
         | 
| 465 | 
            +
                            # Try to read agent metadata from frontmatter
         | 
| 466 | 
            +
                            agent_name = agent_id.replace('_', ' ').title()
         | 
| 467 | 
            +
                            agent_desc = "Specialized agent"
         | 
| 468 | 
            +
                            
         | 
| 469 | 
            +
                            try:
         | 
| 470 | 
            +
                                with open(agent_file, 'r') as f:
         | 
| 471 | 
            +
                                    content = f.read()
         | 
| 472 | 
            +
                                    # Extract YAML frontmatter if present
         | 
| 473 | 
            +
                                    if content.startswith('---'):
         | 
| 474 | 
            +
                                        end_marker = content.find('---', 3)
         | 
| 475 | 
            +
                                        if end_marker > 0:
         | 
| 476 | 
            +
                                            frontmatter = content[3:end_marker]
         | 
| 477 | 
            +
                                            metadata = yaml.safe_load(frontmatter)
         | 
| 478 | 
            +
                                            if metadata:
         | 
| 479 | 
            +
                                                agent_name = metadata.get('name', agent_name)
         | 
| 480 | 
            +
                                                agent_desc = metadata.get('description', agent_desc)
         | 
| 481 | 
            +
                            except Exception as e:
         | 
| 482 | 
            +
                                self.logger.debug(f"Could not read metadata from {agent_file}: {e}")
         | 
| 483 | 
            +
                            
         | 
| 484 | 
            +
                            deployed_agents.append((agent_id, agent_name, agent_desc))
         | 
| 485 | 
            +
                        
         | 
| 486 | 
            +
                        if not deployed_agents:
         | 
| 487 | 
            +
                            return self._get_fallback_capabilities()
         | 
| 488 | 
            +
                        
         | 
| 489 | 
            +
                        # Sort agents and display them
         | 
| 490 | 
            +
                        deployed_agents.sort(key=lambda x: x[0])
         | 
| 491 | 
            +
                        
         | 
| 492 | 
            +
                        # Group common agent types
         | 
| 493 | 
            +
                        core_agents = []
         | 
| 494 | 
            +
                        other_agents = []
         | 
| 455 495 |  | 
| 456 | 
            -
                         | 
| 457 | 
            -
             | 
| 458 | 
            -
             | 
| 459 | 
            -
             | 
| 460 | 
            -
             | 
| 461 | 
            -
                                 | 
| 462 | 
            -
             | 
| 496 | 
            +
                        core_types = ['engineer', 'research', 'qa', 'documentation', 'security', 
         | 
| 497 | 
            +
                                     'data_engineer', 'ops', 'version_control']
         | 
| 498 | 
            +
                        
         | 
| 499 | 
            +
                        for agent_id, name, desc in deployed_agents:
         | 
| 500 | 
            +
                            if agent_id in core_types:
         | 
| 501 | 
            +
                                core_agents.append((agent_id, name, desc))
         | 
| 502 | 
            +
                            else:
         | 
| 503 | 
            +
                                other_agents.append((agent_id, name, desc))
         | 
| 504 | 
            +
                        
         | 
| 505 | 
            +
                        # Display core agents first
         | 
| 506 | 
            +
                        if core_agents:
         | 
| 507 | 
            +
                            section += "### Core Agents\n"
         | 
| 508 | 
            +
                            for agent_id, name, desc in core_agents:
         | 
| 463 509 | 
             
                                section += f"- **{name}** (`{agent_id}`): {desc}\n"
         | 
| 464 | 
            -
                                if tools:
         | 
| 465 | 
            -
                                    section += f"  - Tools: {', '.join(tools[:5])}"
         | 
| 466 | 
            -
                                    if len(tools) > 5:
         | 
| 467 | 
            -
                                        section += f" (+{len(tools)-5} more)"
         | 
| 468 | 
            -
                                    section += "\n"
         | 
| 469 510 |  | 
| 470 | 
            -
                        #  | 
| 471 | 
            -
                         | 
| 472 | 
            -
             | 
| 511 | 
            +
                        # Display other/custom agents
         | 
| 512 | 
            +
                        if other_agents:
         | 
| 513 | 
            +
                            section += "\n### Custom/Project Agents\n"
         | 
| 514 | 
            +
                            for agent_id, name, desc in other_agents:
         | 
| 515 | 
            +
                                section += f"- **{name}** (`{agent_id}`): {desc}\n"
         | 
| 516 | 
            +
                        
         | 
| 517 | 
            +
                        # Add summary and usage instructions
         | 
| 518 | 
            +
                        section += f"\n**Total Available Agents**: {len(deployed_agents)}\n"
         | 
| 519 | 
            +
                        section += "\n**IMPORTANT**: Use the exact agent ID shown in parentheses when delegating tasks.\n"
         | 
| 520 | 
            +
                        section += "For example: `**research**: Analyze the codebase architecture`\n"
         | 
| 521 | 
            +
                        section += "NOT: `**research_agent**: ...` or `**Research Agent**: ...`\n"
         | 
| 473 522 |  | 
| 474 523 | 
             
                        return section
         | 
| 475 524 |  | 
| 476 525 | 
             
                    except Exception as e:
         | 
| 477 526 | 
             
                        self.logger.warning(f"Could not generate dynamic agent capabilities: {e}")
         | 
| 478 | 
            -
                         | 
| 479 | 
            -
             | 
| 527 | 
            +
                        return self._get_fallback_capabilities()
         | 
| 528 | 
            +
                
         | 
| 529 | 
            +
                def _get_fallback_capabilities(self) -> str:
         | 
| 530 | 
            +
                    """Return fallback capabilities when dynamic discovery fails."""
         | 
| 531 | 
            +
                    return """
         | 
| 480 532 |  | 
| 481 533 | 
             
            ## Available Agent Capabilities
         | 
| 482 534 |  | 
| 483 535 | 
             
            You have the following specialized agents available for delegation:
         | 
| 484 536 |  | 
| 485 | 
            -
            - **Engineer  | 
| 486 | 
            -
            - **Research  | 
| 487 | 
            -
            - **QA  | 
| 488 | 
            -
            - **Documentation  | 
| 489 | 
            -
            - **Security  | 
| 490 | 
            -
            - **Data Engineer  | 
| 491 | 
            -
            - **Ops  | 
| 492 | 
            -
            - **Version Control  | 
| 537 | 
            +
            - **Engineer** (`engineer`): Code implementation and development
         | 
| 538 | 
            +
            - **Research** (`research`): Investigation and analysis  
         | 
| 539 | 
            +
            - **QA** (`qa`): Testing and quality assurance
         | 
| 540 | 
            +
            - **Documentation** (`documentation`): Documentation creation and maintenance
         | 
| 541 | 
            +
            - **Security** (`security`): Security analysis and protection
         | 
| 542 | 
            +
            - **Data Engineer** (`data_engineer`): Data management and pipelines
         | 
| 543 | 
            +
            - **Ops** (`ops`): Deployment and operations
         | 
| 544 | 
            +
            - **Version Control** (`version_control`): Git operations and version management
         | 
| 493 545 |  | 
| 494 | 
            -
            Use  | 
| 546 | 
            +
            **IMPORTANT**: Use the exact agent ID in parentheses when delegating tasks.
         | 
| 495 547 | 
             
            """
         | 
| 496 548 |  | 
| 497 549 | 
             
                def _format_minimal_framework(self) -> str:
         | 
| @@ -740,10 +740,14 @@ class AgentDeploymentService: | |
| 740 740 | 
             
                    # IMPORTANT: No spaces after commas - Claude Code requires exact format
         | 
| 741 741 | 
             
                    tools_str = ','.join(tools) if isinstance(tools, list) else tools
         | 
| 742 742 |  | 
| 743 | 
            +
                    # Extract proper agent_id and name from template
         | 
| 744 | 
            +
                    agent_id = template_data.get('agent_id', agent_name)
         | 
| 745 | 
            +
                    display_name = template_data.get('metadata', {}).get('name', agent_id)
         | 
| 746 | 
            +
                    
         | 
| 743 747 | 
             
                    # Build frontmatter with only the fields Claude Code uses
         | 
| 744 748 | 
             
                    frontmatter_lines = [
         | 
| 745 749 | 
             
                        "---",
         | 
| 746 | 
            -
                        f"name: { | 
| 750 | 
            +
                        f"name: {agent_id}",
         | 
| 747 751 | 
             
                        f"description: {description}",
         | 
| 748 752 | 
             
                        f"version: {version_string}",
         | 
| 749 753 | 
             
                        f"base_version: {self._format_version_display(base_version)}",
         | 
| @@ -387,20 +387,177 @@ class AsyncAgentDeploymentService: | |
| 387 387 | 
             
                    return filtered
         | 
| 388 388 |  | 
| 389 389 | 
             
                def _build_agent_markdown_sync(self, agent_data: Dict[str, Any]) -> str:
         | 
| 390 | 
            -
                    """Build agent markdown content  | 
| 391 | 
            -
                     | 
| 390 | 
            +
                    """Build agent markdown content matching the synchronous deployment format."""
         | 
| 391 | 
            +
                    from datetime import datetime
         | 
| 392 | 
            +
                    
         | 
| 393 | 
            +
                    # Extract agent info from the loaded JSON data
         | 
| 392 394 | 
             
                    agent_name = agent_data.get('_agent_name', 'unknown')
         | 
| 393 | 
            -
                     | 
| 394 | 
            -
                     | 
| 395 | 
            -
                    
         | 
| 396 | 
            -
                     | 
| 397 | 
            -
             | 
| 398 | 
            -
            version | 
| 399 | 
            -
             | 
| 400 | 
            -
             | 
| 401 | 
            -
             | 
| 402 | 
            -
             | 
| 403 | 
            -
             | 
| 395 | 
            +
                    
         | 
| 396 | 
            +
                    # Extract proper agent_id from template data (not filename)
         | 
| 397 | 
            +
                    agent_id = agent_data.get('agent_id', agent_name)
         | 
| 398 | 
            +
                    
         | 
| 399 | 
            +
                    # Handle both 'agent_version' (new format) and 'version' (old format)
         | 
| 400 | 
            +
                    agent_version = self._parse_version(agent_data.get('agent_version') or agent_data.get('version', '1.0.0'))
         | 
| 401 | 
            +
                    base_version = (0, 1, 0)  # Default base version for async deployment
         | 
| 402 | 
            +
                    
         | 
| 403 | 
            +
                    # Format version string as semantic version
         | 
| 404 | 
            +
                    version_string = self._format_version_display(agent_version)
         | 
| 405 | 
            +
                    
         | 
| 406 | 
            +
                    # Extract metadata using the same logic as synchronous deployment
         | 
| 407 | 
            +
                    # Check new format first (metadata.description), then old format
         | 
| 408 | 
            +
                    description = (
         | 
| 409 | 
            +
                        agent_data.get('metadata', {}).get('description') or
         | 
| 410 | 
            +
                        agent_data.get('configuration_fields', {}).get('description') or
         | 
| 411 | 
            +
                        agent_data.get('description') or
         | 
| 412 | 
            +
                        'Agent for specialized tasks'
         | 
| 413 | 
            +
                    )
         | 
| 414 | 
            +
                    
         | 
| 415 | 
            +
                    # Get tags from new format (metadata.tags) or old format
         | 
| 416 | 
            +
                    tags = (
         | 
| 417 | 
            +
                        agent_data.get('metadata', {}).get('tags') or
         | 
| 418 | 
            +
                        agent_data.get('configuration_fields', {}).get('tags') or
         | 
| 419 | 
            +
                        agent_data.get('tags') or
         | 
| 420 | 
            +
                        [agent_id, 'mpm-framework']
         | 
| 421 | 
            +
                    )
         | 
| 422 | 
            +
                    
         | 
| 423 | 
            +
                    # Get tools from capabilities.tools in new format
         | 
| 424 | 
            +
                    tools = (
         | 
| 425 | 
            +
                        agent_data.get('capabilities', {}).get('tools') or
         | 
| 426 | 
            +
                        agent_data.get('configuration_fields', {}).get('tools') or
         | 
| 427 | 
            +
                        ["Read", "Write", "Edit", "Grep", "Glob", "LS"]  # Default fallback
         | 
| 428 | 
            +
                    )
         | 
| 429 | 
            +
                    
         | 
| 430 | 
            +
                    # Get model from capabilities.model in new format
         | 
| 431 | 
            +
                    model = (
         | 
| 432 | 
            +
                        agent_data.get('capabilities', {}).get('model') or
         | 
| 433 | 
            +
                        agent_data.get('configuration_fields', {}).get('model') or
         | 
| 434 | 
            +
                        "sonnet"  # Default fallback
         | 
| 435 | 
            +
                    )
         | 
| 436 | 
            +
                    
         | 
| 437 | 
            +
                    # Simplify model name for Claude Code
         | 
| 438 | 
            +
                    model_map = {
         | 
| 439 | 
            +
                        'claude-4-sonnet-20250514': 'sonnet',
         | 
| 440 | 
            +
                        'claude-sonnet-4-20250514': 'sonnet',
         | 
| 441 | 
            +
                        'claude-opus-4-20250514': 'opus',
         | 
| 442 | 
            +
                        'claude-3-opus-20240229': 'opus',
         | 
| 443 | 
            +
                        'claude-3-haiku-20240307': 'haiku',
         | 
| 444 | 
            +
                        'claude-3.5-sonnet': 'sonnet',
         | 
| 445 | 
            +
                        'claude-3-sonnet': 'sonnet'
         | 
| 446 | 
            +
                    }
         | 
| 447 | 
            +
                    # Better fallback: extract the model type (opus/sonnet/haiku) from the string
         | 
| 448 | 
            +
                    if model not in model_map:
         | 
| 449 | 
            +
                        if 'opus' in model.lower():
         | 
| 450 | 
            +
                            model = 'opus'
         | 
| 451 | 
            +
                        elif 'sonnet' in model.lower():
         | 
| 452 | 
            +
                            model = 'sonnet'
         | 
| 453 | 
            +
                        elif 'haiku' in model.lower():
         | 
| 454 | 
            +
                            model = 'haiku'
         | 
| 455 | 
            +
                        else:
         | 
| 456 | 
            +
                            # Last resort: try to extract from hyphenated format
         | 
| 457 | 
            +
                            model = model_map.get(model, model.split('-')[-1] if '-' in model else model)
         | 
| 458 | 
            +
                    else:
         | 
| 459 | 
            +
                        model = model_map[model]
         | 
| 460 | 
            +
                    
         | 
| 461 | 
            +
                    # Convert tools list to comma-separated string for Claude Code compatibility
         | 
| 462 | 
            +
                    # IMPORTANT: No spaces after commas - Claude Code requires exact format
         | 
| 463 | 
            +
                    tools_str = ','.join(tools) if isinstance(tools, list) else str(tools)
         | 
| 464 | 
            +
                    
         | 
| 465 | 
            +
                    # Build frontmatter with only the fields Claude Code uses
         | 
| 466 | 
            +
                    frontmatter_lines = [
         | 
| 467 | 
            +
                        "---",
         | 
| 468 | 
            +
                        f"name: {agent_id}",
         | 
| 469 | 
            +
                        f"description: {description}",
         | 
| 470 | 
            +
                        f"version: {version_string}",
         | 
| 471 | 
            +
                        f"base_version: {self._format_version_display(base_version)}",
         | 
| 472 | 
            +
                        f"author: claude-mpm",  # Identify as system agent for deployment
         | 
| 473 | 
            +
                        f"tools: {tools_str}",
         | 
| 474 | 
            +
                        f"model: {model}"
         | 
| 475 | 
            +
                    ]
         | 
| 476 | 
            +
                    
         | 
| 477 | 
            +
                    # Add optional fields if present
         | 
| 478 | 
            +
                    # Check for color in metadata section (new format) or root (old format)
         | 
| 479 | 
            +
                    color = (
         | 
| 480 | 
            +
                        agent_data.get('metadata', {}).get('color') or
         | 
| 481 | 
            +
                        agent_data.get('color')
         | 
| 482 | 
            +
                    )
         | 
| 483 | 
            +
                    if color:
         | 
| 484 | 
            +
                        frontmatter_lines.append(f"color: {color}")
         | 
| 485 | 
            +
                    
         | 
| 486 | 
            +
                    frontmatter_lines.append("---")
         | 
| 487 | 
            +
                    frontmatter_lines.append("")
         | 
| 488 | 
            +
                    frontmatter_lines.append("")
         | 
| 489 | 
            +
                    
         | 
| 490 | 
            +
                    frontmatter = '\n'.join(frontmatter_lines)
         | 
| 491 | 
            +
                    
         | 
| 492 | 
            +
                    # Get the main content (instructions)
         | 
| 493 | 
            +
                    # Check multiple possible locations for instructions
         | 
| 494 | 
            +
                    content = (
         | 
| 495 | 
            +
                        agent_data.get('instructions') or
         | 
| 496 | 
            +
                        agent_data.get('narrative_fields', {}).get('instructions') or
         | 
| 497 | 
            +
                        agent_data.get('content') or
         | 
| 498 | 
            +
                        f"You are the {agent_id} agent. Perform tasks related to {agent_data.get('description', 'your specialization')}."
         | 
| 499 | 
            +
                    )
         | 
| 500 | 
            +
                    
         | 
| 501 | 
            +
                    return frontmatter + content
         | 
| 502 | 
            +
                
         | 
| 503 | 
            +
                def _parse_version(self, version_value: Any) -> tuple:
         | 
| 504 | 
            +
                    """
         | 
| 505 | 
            +
                    Parse version from various formats to semantic version tuple.
         | 
| 506 | 
            +
                    
         | 
| 507 | 
            +
                    Handles:
         | 
| 508 | 
            +
                    - Integer values: 5 -> (0, 5, 0)
         | 
| 509 | 
            +
                    - String integers: "5" -> (0, 5, 0)
         | 
| 510 | 
            +
                    - Semantic versions: "2.1.0" -> (2, 1, 0)
         | 
| 511 | 
            +
                    - Invalid formats: returns (0, 0, 0)
         | 
| 512 | 
            +
                    
         | 
| 513 | 
            +
                    Args:
         | 
| 514 | 
            +
                        version_value: Version in various formats
         | 
| 515 | 
            +
                        
         | 
| 516 | 
            +
                    Returns:
         | 
| 517 | 
            +
                        Tuple of (major, minor, patch) for comparison
         | 
| 518 | 
            +
                    """
         | 
| 519 | 
            +
                    if isinstance(version_value, int):
         | 
| 520 | 
            +
                        # Legacy integer version - treat as minor version
         | 
| 521 | 
            +
                        return (0, version_value, 0)
         | 
| 522 | 
            +
                        
         | 
| 523 | 
            +
                    if isinstance(version_value, str):
         | 
| 524 | 
            +
                        # Try to parse as simple integer
         | 
| 525 | 
            +
                        if version_value.isdigit():
         | 
| 526 | 
            +
                            return (0, int(version_value), 0)
         | 
| 527 | 
            +
                        
         | 
| 528 | 
            +
                        # Try to parse semantic version (e.g., "2.1.0" or "v2.1.0")
         | 
| 529 | 
            +
                        import re
         | 
| 530 | 
            +
                        sem_ver_match = re.match(r'^v?(\d+)\.(\d+)\.(\d+)', version_value)
         | 
| 531 | 
            +
                        if sem_ver_match:
         | 
| 532 | 
            +
                            major = int(sem_ver_match.group(1))
         | 
| 533 | 
            +
                            minor = int(sem_ver_match.group(2))
         | 
| 534 | 
            +
                            patch = int(sem_ver_match.group(3))
         | 
| 535 | 
            +
                            return (major, minor, patch)
         | 
| 536 | 
            +
                        
         | 
| 537 | 
            +
                        # Try to extract first number from string as minor version
         | 
| 538 | 
            +
                        num_match = re.search(r'(\d+)', version_value)
         | 
| 539 | 
            +
                        if num_match:
         | 
| 540 | 
            +
                            return (0, int(num_match.group(1)), 0)
         | 
| 541 | 
            +
                    
         | 
| 542 | 
            +
                    # Default to 0.0.0 for invalid formats
         | 
| 543 | 
            +
                    return (0, 0, 0)
         | 
| 544 | 
            +
                
         | 
| 545 | 
            +
                def _format_version_display(self, version_tuple: tuple) -> str:
         | 
| 546 | 
            +
                    """
         | 
| 547 | 
            +
                    Format version tuple for display.
         | 
| 548 | 
            +
                    
         | 
| 549 | 
            +
                    Args:
         | 
| 550 | 
            +
                        version_tuple: Tuple of (major, minor, patch)
         | 
| 551 | 
            +
                        
         | 
| 552 | 
            +
                    Returns:
         | 
| 553 | 
            +
                        Formatted version string
         | 
| 554 | 
            +
                    """
         | 
| 555 | 
            +
                    if isinstance(version_tuple, tuple) and len(version_tuple) == 3:
         | 
| 556 | 
            +
                        major, minor, patch = version_tuple
         | 
| 557 | 
            +
                        return f"{major}.{minor}.{patch}"
         | 
| 558 | 
            +
                    else:
         | 
| 559 | 
            +
                        # Fallback for legacy format
         | 
| 560 | 
            +
                        return str(version_tuple)
         | 
| 404 561 |  | 
| 405 562 | 
             
                async def cleanup(self):
         | 
| 406 563 | 
             
                    """Clean up resources."""
         |