create_maintenance_workflows
Design and implement workflows for AI context maintenance, enabling teams to manage updates, review tasks, and monitor metrics efficiently.
Instructions
Create team workflows for maintaining AI context quality over time
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| analysisId | No | Analysis ID from analyze_codebase_deeply | |
| includeChecklists | No | Include review checklists | |
| includeMetrics | No | Include metrics dashboard | |
| includeTraining | No | Include training materials | |
| projectPath | Yes | Path to the project directory | |
| teamSize | Yes | Number of developers on the team | |
| updateFrequency | Yes | How often the team updates context |
Implementation Reference
- Core handler function that executes the tool logic: creates maintenance workflow files (handbook, checklists, procedures, onboarding guides, metrics, training) in the project's agent-context/workflows directory based on analysis and config. Returns success status and list of created files.export async function createMaintenanceWorkflows( config: MaintenanceConfig ): Promise<MaintenanceResult> { const result: MaintenanceResult = { success: false, filesCreated: [], message: '', workflows: { regular: [], emergency: [], onboarding: [], }, }; try { // Check if analysis has been completed const analysisId = config.analysisId || global.latestAnalysisId; if (!analysisId || !global.codebaseAnalysis?.[analysisId]) { throw new Error('Codebase analysis must be completed first. Run analyze_codebase_deeply tool.'); } const analysis: DeepAnalysisResult = global.codebaseAnalysis[analysisId]; // Create workflows directory const workflowsDir = join(config.projectPath, 'agent-context', 'workflows'); if (!existsSync(workflowsDir)) { mkdirSync(workflowsDir, { recursive: true }); } // Create maintenance handbook const handbook = createMaintenanceHandbook(config, analysis); const handbookPath = join(workflowsDir, 'MAINTENANCE-HANDBOOK.md'); writeFileSync(handbookPath, handbook); result.filesCreated.push(handbookPath); result.workflows.regular.push('Maintenance Handbook'); // Create update workflow const updateWorkflow = createUpdateWorkflow(config, analysis); const updatePath = join(workflowsDir, 'context-update-workflow.md'); writeFileSync(updatePath, updateWorkflow); result.filesCreated.push(updatePath); result.workflows.regular.push('Context Update Workflow'); // Create review checklist if requested if (config.includeChecklists) { const reviewChecklist = createReviewChecklist(config, analysis); const checklistPath = join(workflowsDir, 'context-review-checklist.md'); writeFileSync(checklistPath, reviewChecklist); result.filesCreated.push(checklistPath); result.workflows.regular.push('Review Checklist'); // Create quality checklist const qualityChecklist = createQualityChecklist(analysis); const qualityPath = join(workflowsDir, 'quality-checklist.md'); writeFileSync(qualityPath, qualityChecklist); result.filesCreated.push(qualityPath); result.workflows.regular.push('Quality Checklist'); } // Create emergency procedures const emergencyProcedures = createEmergencyProcedures(config, analysis); const emergencyPath = join(workflowsDir, 'emergency-procedures.md'); writeFileSync(emergencyPath, emergencyProcedures); result.filesCreated.push(emergencyPath); result.workflows.emergency.push('Emergency Procedures'); // Create team onboarding guide const onboardingGuide = createOnboardingGuide(config, analysis); const onboardingPath = join(workflowsDir, 'team-onboarding.md'); writeFileSync(onboardingPath, onboardingGuide); result.filesCreated.push(onboardingPath); result.workflows.onboarding.push('Team Onboarding'); // Create metrics dashboard if requested if (config.includeMetrics) { const metricsDashboard = createMetricsDashboard(config, analysis); const metricsPath = join(workflowsDir, 'metrics-dashboard.md'); writeFileSync(metricsPath, metricsDashboard); result.filesCreated.push(metricsPath); result.workflows.regular.push('Metrics Dashboard'); } // Create training materials if requested if (config.includeTraining) { const trainingMaterials = createTrainingMaterials(config, analysis); const trainingPath = join(workflowsDir, 'ai-context-training.md'); writeFileSync(trainingPath, trainingMaterials); result.filesCreated.push(trainingPath); result.workflows.onboarding.push('Training Materials'); } // Create workflow index const workflowIndex = createWorkflowIndex(result.workflows, config); const indexPath = join(workflowsDir, 'README.md'); writeFileSync(indexPath, workflowIndex); result.filesCreated.push(indexPath); result.success = true; result.message = `Created ${result.filesCreated.length} maintenance workflows for ${config.teamSize}-person team`; } catch (error) { result.success = false; result.message = `Failed to create maintenance workflows: ${error}`; } return result; }
- src/tools/index.ts:318-338 (registration)MCP server request handler dispatch case for 'create_maintenance_workflows': parses input arguments with Zod schema, calls the handler function createMaintenanceWorkflows(params), and returns JSON result as text content.case 'create_maintenance_workflows': { const params = z.object({ projectPath: z.string(), analysisId: z.string().optional(), teamSize: z.number(), updateFrequency: z.enum(['daily', 'weekly', 'biweekly', 'monthly']), includeChecklists: z.boolean().optional(), includeMetrics: z.boolean().optional(), includeTraining: z.boolean().optional(), }).parse(args); const result = await createMaintenanceWorkflows(params); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
- Tool definition object including name, description, and inputSchema (JSON Schema) for validation when listing tools via MCP ListToolsRequest.name: 'create_maintenance_workflows', description: 'Create team workflows for maintaining AI context quality over time', inputSchema: { type: 'object', properties: { projectPath: { type: 'string', description: 'Path to the project directory', }, analysisId: { type: 'string', description: 'Analysis ID from analyze_codebase_deeply', }, teamSize: { type: 'number', description: 'Number of developers on the team', }, updateFrequency: { type: 'string', enum: ['daily', 'weekly', 'biweekly', 'monthly'], description: 'How often the team updates context', }, includeChecklists: { type: 'boolean', description: 'Include review checklists', }, includeMetrics: { type: 'boolean', description: 'Include metrics dashboard', }, includeTraining: { type: 'boolean', description: 'Include training materials', }, }, required: ['projectPath', 'teamSize', 'updateFrequency'], }, },
- src/tools/index.ts:23-23 (registration)Imports the toolDefinitions array which includes the schema for create_maintenance_workflows, used in setupTools for ListToolsRequestHandler.import { toolDefinitions } from './tool-definitions.js';
- src/tools/index.ts:20-20 (registration)Imports the handler function from the implementation file.import { createMaintenanceWorkflows } from './workspace/create-maintenance-workflows.js';