---
description:
globs:
alwaysApply: true
---
# Enhanced Universal Intent Verification & Workflow Integration
## Core Mandate: Complete Development Action Capture
**CRITICAL INSTRUCTION**: Every user interaction must trigger comprehensive workflow capture - intent verification is the gateway to complete development visibility.
## Enhanced Workflow Integration
### 1. EXPANDED INTENT DETECTION SCOPE
#### Beyond Task Creation - Detect ALL Development Activities:
```typescript
// COMPREHENSIVE INTENT CATEGORIES
{
"task_management": ["create", "update", "complete", "block", "assign"],
"code_development": ["implement", "fix", "refactor", "optimize", "debug"],
"documentation": ["document", "explain", "guide", "readme", "api"],
"testing": ["test", "validate", "verify", "qa", "coverage"],
"deployment": ["deploy", "release", "rollback", "hotfix", "patch"],
"investigation": ["research", "analyze", "explore", "understand", "learn"],
"collaboration": ["review", "discuss", "handover", "transfer", "coordinate"],
"maintenance": ["cleanup", "organize", "archive", "backup", "migrate"]
}
```
### 2. MANDATORY WORKFLOW TRIGGER PATTERN
#### Every User Interaction Must Execute This Sequence:
```typescript
// STEP 1: INTENT VERIFICATION (MANDATORY FIRST)
const intentResult = await analyzeUserIntent(input, context);
// STEP 2: WORKFLOW ROUTING (BASED ON INTENT)
switch(intentResult.category) {
case 'task_management':
await triggerTaskWorkflow(intentResult);
break;
case 'code_development':
await triggerDevelopmentWorkflow(intentResult);
break;
case 'documentation':
await triggerDocumentationWorkflow(intentResult);
break;
// ... all categories must have workflows
}
// STEP 3: COMPREHENSIVE DATA CAPTURE
await captureWorkflowData({
intent: intentResult,
context: fullContext,
actions: plannedActions,
timeline: workflowTimeline
});
// STEP 4: USER APPROVAL (MANDATORY)
const approval = await waitForUserApproval(workflowPlan);
// STEP 5: EXECUTE WITH TRACKING (ONLY AFTER APPROVAL)
if (approval.confirmed) {
await executeWithFullTracking(approvedActions);
}
```
### 3. ENHANCED CONTEXT GATHERING
#### Comprehensive Context Matrix:
```typescript
// AUTOMATICALLY GATHERED FOR EVERY INTERACTION
{
"environment_context": {
"working_directory": "Current directory path",
"git_branch": "Active git branch",
"git_status": "Uncommitted changes",
"recent_commits": "Last 5 commits with messages",
"modified_files": "Files changed since last commit"
},
"project_context": {
"active_tasks": "Currently in-progress tasks",
"recent_tasks": "Recently completed tasks",
"project_structure": "Key directories and files",
"dependencies": "Package.json, requirements, etc.",
"documentation": "README, docs, comments"
},
"development_context": {
"recent_activity": "File edits, commits, deploys",
"current_focus": "What developer is working on",
"blockers": "Known issues or dependencies",
"next_steps": "Planned upcoming work",
"time_investment": "Hours spent on current task"
},
"collaboration_context": {
"team_members": "Other developers involved",
"pending_reviews": "Code reviews waiting",
"shared_resources": "Shared files or systems",
"communication_history": "Recent discussions or decisions",
"handover_status": "Incoming or outgoing handovers"
}
}
```
### 4. INTELLIGENT WORKFLOW ROUTING
#### Smart Action Classification:
```typescript
// AUTOMATIC ROUTING BASED ON INTENT + CONTEXT
function routeToWorkflow(intent, context) {
if (intent.isWorkRequest && !context.hasActiveTask) {
return "CREATE_TASK_WORKFLOW";
}
if (intent.isWorkRequest && context.hasActiveTask) {
return "UPDATE_ACTIVE_TASK_WORKFLOW";
}
if (intent.isQuestionOrClarification) {
return "KNOWLEDGE_CAPTURE_WORKFLOW";
}
if (intent.isCompletionSignal) {
return "TASK_COMPLETION_WORKFLOW";
}
if (intent.isHandoverRequest) {
return "KNOWLEDGE_TRANSFER_WORKFLOW";
}
if (intent.isContextSwitch) {
return "TASK_SWITCHING_WORKFLOW";
}
// Default: Capture as general activity
return "ACTIVITY_LOGGING_WORKFLOW";
}
```
### 5. COMPREHENSIVE DATA CAPTURE WORKFLOWS
#### Task Creation Workflow (Enhanced):
```typescript
// TRIGGERED: When work request detected
async function executeTaskCreationWorkflow(intent, context) {
// 1. Create comprehensive task
const task = await createTask({
title: intent.suggestedTitle,
description: intent.suggestedDescription,
context: context.fullContext,
estimatedHours: intent.estimatedComplexity,
priority: intent.urgencyLevel,
dependencies: context.identifiedDependencies,
acceptanceCriteria: intent.successCriteria
});
// 2. Initialize progress monitoring
await initializeProgressMonitoring(task.id, context);
// 3. Create initial changelog entry
await createChangelogEntry({
title: `Task Created: ${task.title}`,
changeType: 'task_creation',
taskId: task.id,
context: intent.originalInput,
decisions: intent.keyDecisions
});
// 4. Set as active task
await setActiveTask(task.id, context.workingDirectory);
return task;
}
```
#### Development Activity Workflow:
```typescript
// TRIGGERED: When code changes or technical work detected
async function executeDevelopmentWorkflow(intent, context) {
// 1. Ensure active task exists
let activeTask = context.activeTask;
if (!activeTask) {
activeTask = await createImplicitTask(intent, context);
}
// 2. Capture development activity
await createChangelogEntry({
title: intent.activityDescription,
changeType: intent.developmentType, // 'file_change', 'bug_fix', etc.
taskId: activeTask.id,
affectedFiles: context.modifiedFiles,
approach: intent.technicalApproach,
timeSpent: context.timeInvestment,
decisions: intent.technicalDecisions
});
// 3. Update task progress
await updateTaskProgress(activeTask.id, {
lastActivity: new Date(),
progressSignals: context.progressIndicators,
blockers: intent.identifiedBlockers
});
return { task: activeTask, activity: 'captured' };
}
```
#### Knowledge Capture Workflow:
```typescript
// TRIGGERED: When questions, clarifications, or learning detected
async function executeKnowledgeCaptureWorkflow(intent, context) {
// 1. Capture knowledge exchange
await createChangelogEntry({
title: `Knowledge: ${intent.questionOrTopic}`,
changeType: 'clarification',
questionsAsked: intent.questions,
clarificationsProvided: intent.answers,
decisionsMade: intent.decisions,
taskId: context.activeTask?.id,
eventContext: intent.conversationContext
});
// 2. Update project knowledge base
await updateProjectKnowledge({
topic: intent.topic,
insights: intent.insights,
decisions: intent.decisions,
resources: intent.references
});
return { knowledge: 'captured', insights: intent.insights };
}
```
### 6. ENHANCED USER APPROVAL SYSTEM
#### Comprehensive Approval Interface:
```
š§ **Enhanced Intent Analysis & Workflow Plan**
š **Intent Classification**
Category: [Development Activity Type]
Confidence: [XX]%
Complexity: [Low/Medium/High/Complex]
š **Planned Workflow Execution**
1. [Step 1 with description]
2. [Step 2 with description]
3. [Step 3 with description]
š **Data Capture Plan**
⢠Task: [Create new / Update existing / Link to active]
⢠Changelog: [Activity type and scope]
⢠Progress: [Status updates and monitoring]
⢠Context: [Working directory, files, timeline]
šÆ **Expected Outcomes**
⢠[Specific deliverable 1]
⢠[Specific deliverable 2]
⢠[Progress milestone reached]
ā±ļø **Time Investment**
Estimated: [X] minutes
Previous similar: [Y] minutes average
š **Integration Points**
⢠Active Task: [Current task or "Create new"]
⢠Project: [Project name and context]
⢠Dependencies: [Related tasks or blockers]
---
ā
**Approve This Workflow Plan?**
A. ā
"Yes, execute the complete workflow"
B. š "Modify: [specify changes needed]"
C. ā "No, different approach: [explain]"
D. ā "Questions: [ask for clarification]"
ā ļø **Complete Transparency**: This workflow will capture all activity for project visibility and handover preparation.
```
### 7. QUALITY ASSURANCE & COMPLIANCE
#### Mandatory Compliance Checks:
```typescript
// BEFORE ANY ACTION EXECUTION
function validateWorkflowCompliance(plan) {
const checks = {
hasIntentVerification: plan.intentVerified === true,
hasUserApproval: plan.userApproved === true,
hasTaskLinkage: plan.taskId !== null,
hasChangelogPlan: plan.changelogEntry !== null,
hasProgressTracking: plan.progressMonitoring === true,
hasContextCapture: plan.contextCaptured === true
};
const failed = Object.entries(checks)
.filter(([key, passed]) => !passed)
.map(([key]) => key);
if (failed.length > 0) {
throw new Error(`Workflow compliance failed: ${failed.join(', ')}`);
}
return true;
}
```
#### Post-Execution Verification:
```typescript
// AFTER WORKFLOW COMPLETION
async function verifyWorkflowExecution(workflowId) {
const verification = {
taskUpdated: await verifyTaskWasUpdated(workflowId),
changelogCreated: await verifyChangelogWasCreated(workflowId),
progressCaptured: await verifyProgressWasCaptured(workflowId),
contextPreserved: await verifyContextWasPreserved(workflowId),
handoverReady: await verifyHandoverDataExists(workflowId)
};
return verification;
}
```
### 8. CONTINUOUS LEARNING & OPTIMIZATION
#### Pattern Recognition & Improvement:
```typescript
// ONGOING LEARNING FROM EVERY INTERACTION
{
"accuracy_tracking": {
"intent_classification": "% correctly identified",
"workflow_routing": "% routed to correct workflow",
"time_estimation": "% within 20% of actual",
"completion_prediction": "% correctly predicted"
},
"user_satisfaction": {
"workflow_helpfulness": "User rating 1-10",
"interruption_level": "Perceived disruption",
"value_added": "Benefit vs overhead",
"handover_effectiveness": "Handover success rate"
},
"system_performance": {
"response_time": "Time to complete verification",
"data_completeness": "% of required data captured",
"compliance_rate": "% of interactions following workflow",
"error_recovery": "% of failed workflows recovered"
}
}
```
## CRITICAL SUCCESS METRICS
### Developer Experience:
- **Workflow Adoption**: 100% of development activities captured
- **Time Overhead**: <2 minutes additional time per interaction
- **Value Perception**: >8/10 developer satisfaction rating
- **Handover Success**: <30 minutes for new developer productivity
### Project Visibility:
- **Activity Coverage**: 100% of work visible in tasks/changelog
- **Progress Accuracy**: >90% real-time status accuracy
- **Knowledge Retention**: 100% of decisions and context captured
- **Handover Completeness**: All necessary information available
### System Intelligence:
- **Intent Accuracy**: >95% correct intent classification
- **Workflow Efficiency**: Continuous improvement in routing
- **Predictive Accuracy**: >85% correct completion predictions
- **Learning Velocity**: Measurable improvement over time
This enhanced intent verification system ensures that every development action is captured, tracked, and made available for seamless team coordination and knowledge transfer.