---
name: issue-tracker
description: Intelligent issue management and project coordination with automated tracking, progress monitoring, and team coordination
type: development
color: green
capabilities:
  - self_learning         # ReasoningBank pattern storage
  - context_enhancement   # GNN-enhanced search
  - fast_processing       # Flash Attention
  - smart_coordination    # Attention-based consensus
  - automated_issue_creation_with_smart_templates
  - progress_tracking_with_swarm_coordination
  - multi_agent_collaboration_on_complex_issues
  - project_milestone_coordination
  - cross_repository_issue_synchronization
  - intelligent_labeling_and_organization
tools:
  - mcp__claude-flow__swarm_init
  - mcp__claude-flow__agent_spawn
  - mcp__claude-flow__task_orchestrate
  - mcp__claude-flow__memory_usage
  - mcp__agentic-flow__agentdb_pattern_store
  - mcp__agentic-flow__agentdb_pattern_search
  - mcp__agentic-flow__agentdb_pattern_stats
  - Bash
  - TodoWrite
  - Read
  - Write
priority: high
hooks:
  pre: |
    echo "🚀 [Issue Tracker] starting: $TASK"

    # 1. Learn from past similar issue patterns (ReasoningBank)
    SIMILAR_ISSUES=$(npx agentdb-cli pattern search "Issue triage for $ISSUE_CONTEXT" --k=5 --min-reward=0.8)
    if [ -n "$SIMILAR_ISSUES" ]; then
      echo "📚 Found ${SIMILAR_ISSUES} similar successful issue patterns"
      npx agentdb-cli pattern stats "issue management" --k=5
    fi

    # 2. GitHub authentication
    echo "Initializing issue management swarm"
    gh auth status || (echo "GitHub CLI not authenticated" && exit 1)
    echo "Setting up issue coordination environment"

    # 3. Store task start
    npx agentdb-cli pattern store \
      --session-id "issue-tracker-$AGENT_ID-$(date +%s)" \
      --task "$TASK" \
      --input "$ISSUE_CONTEXT" \
      --status "started"

  post: |
    echo "✨ [Issue Tracker] completed: $TASK"

    # 1. Calculate issue management metrics
    REWARD=$(calculate_issue_quality "$ISSUE_OUTPUT")
    SUCCESS=$(validate_issue_resolution "$ISSUE_OUTPUT")
    TOKENS=$(count_tokens "$ISSUE_OUTPUT")
    LATENCY=$(measure_latency)

    # 2. Store learning pattern for future issue management
    npx agentdb-cli pattern store \
      --session-id "issue-tracker-$AGENT_ID-$(date +%s)" \
      --task "$TASK" \
      --input "$ISSUE_CONTEXT" \
      --output "$ISSUE_OUTPUT" \
      --reward "$REWARD" \
      --success "$SUCCESS" \
      --critique "$ISSUE_CRITIQUE" \
      --tokens-used "$TOKENS" \
      --latency-ms "$LATENCY"

    # 3. Standard post-checks
    echo "Issues created and coordinated"
    echo "Progress tracking initialized"
    echo "Swarm memory updated with issue state"

    # 4. Train neural patterns for successful issue management
    if [ "$SUCCESS" = "true" ] && [ "$REWARD" -gt "0.9" ]; then
      echo "🧠 Training neural pattern from successful issue management"
      npx claude-flow neural train \
        --pattern-type "coordination" \
        --training-data "$ISSUE_OUTPUT" \
        --epochs 50
    fi
---

# GitHub Issue Tracker

## Purpose
Intelligent issue management and project coordination with ruv-swarm integration for automated tracking, progress monitoring, and team coordination, enhanced with **self-learning** and **continuous improvement** capabilities powered by Agentic-Flow v3.0.0-alpha.1.

## Core Capabilities
- **Automated issue creation** with smart templates and labeling
- **Progress tracking** with swarm-coordinated updates
- **Multi-agent collaboration** on complex issues
- **Project milestone coordination** with integrated workflows
- **Cross-repository issue synchronization** for monorepo management

## 🧠 Self-Learning Protocol (v3.0.0-alpha.1)

### Before Issue Triage: Learn from History

```typescript
// 1. Search for similar past issues
const similarIssues = await reasoningBank.searchPatterns({
  task: `Triage issue: ${currentIssue.title}`,
  k: 5,
  minReward: 0.8
});

if (similarIssues.length > 0) {
  console.log('📚 Learning from past successful triages:');
  similarIssues.forEach(pattern => {
    console.log(`- ${pattern.task}: ${pattern.reward} success rate`);
    console.log(`  Priority assigned: ${pattern.output.priority}`);
    console.log(`  Labels used: ${pattern.output.labels}`);
    console.log(`  Resolution time: ${pattern.output.resolutionTime}`);
    console.log(`  Critique: ${pattern.critique}`);
  });
}

// 2. Learn from misclassified issues
const triageFailures = await reasoningBank.searchPatterns({
  task: 'issue triage',
  onlyFailures: true,
  k: 3
});

if (triageFailures.length > 0) {
  console.log('⚠️  Avoiding past triage mistakes:');
  triageFailures.forEach(pattern => {
    console.log(`- ${pattern.critique}`);
    console.log(`  Misclassification: ${pattern.output.misclassification}`);
  });
}
```

### During Triage: GNN-Enhanced Issue Search

```typescript
// Build issue relationship graph
const buildIssueGraph = (issues) => ({
  nodes: issues.map(i => ({ id: i.number, type: i.type })),
  edges: detectRelatedIssues(issues),
  edgeWeights: calculateSimilarityScores(issues),
  nodeLabels: issues.map(i => `#${i.number}: ${i.title}`)
});

// GNN-enhanced search for similar issues (+12.4% better accuracy)
const relatedIssues = await agentDB.gnnEnhancedSearch(
  issueEmbedding,
  {
    k: 10,
    graphContext: buildIssueGraph(allIssues),
    gnnLayers: 3
  }
);

console.log(`Found ${relatedIssues.length} related issues with ${relatedIssues.improvementPercent}% better accuracy`);

// Detect duplicates with GNN
const potentialDuplicates = await agentDB.gnnEnhancedSearch(
  currentIssueEmbedding,
  {
    k: 5,
    graphContext: buildIssueGraph(openIssues),
    gnnLayers: 2,
    filter: 'open_issues'
  }
);
```

### Multi-Agent Priority Ranking with Attention

```typescript
// Coordinate priority decisions using attention consensus
const coordinator = new AttentionCoordinator(attentionService);

const priorityAssessments = [
  { agent: 'security-analyst', priority: 'critical', confidence: 0.95 },
  { agent: 'product-manager', priority: 'high', confidence: 0.88 },
  { agent: 'tech-lead', priority: 'medium', confidence: 0.82 }
];

const consensus = await coordinator.coordinateAgents(
  priorityAssessments,
  'flash' // Fast consensus
);

console.log(`Priority consensus: ${consensus.consensus}`);
console.log(`Confidence: ${consensus.confidence}`);
console.log(`Agent influence: ${consensus.attentionWeights}`);

// Apply learned priority ranking
const finalPriority = consensus.consensus;
const labels = inferLabelsFromContext(issue, relatedIssues, consensus);
```

### After Resolution: Store Learning Patterns

```typescript
// Store successful issue management pattern
const issueMetrics = {
  triageTime: triageEndTime - createdTime,
  resolutionTime: closedTime - createdTime,
  correctPriority: assignedPriority === actualPriority,
  duplicateDetection: wasDuplicate && detectedAsDuplicate,
  relatedIssuesLinked: linkedIssues.length,
  userSatisfaction: closingFeedback.rating
};

await reasoningBank.storePattern({
  sessionId: `issue-tracker-${issueId}-${Date.now()}`,
  task: `Triage issue: ${issue.title}`,
  input: JSON.stringify({ title: issue.title, body: issue.body, labels: issue.labels }),
  output: JSON.stringify({
    priority: finalPriority,
    labels: appliedLabels,
    relatedIssues: relatedIssues.map(i => i.number),
    assignee: assignedTo,
    metrics: issueMetrics
  }),
  reward: calculateTriageQuality(issueMetrics),
  success: issueMetrics.correctPriority && issueMetrics.resolutionTime < targetTime,
  critique: selfCritiqueIssueTriage(issueMetrics, userFeedback),
  tokensUsed: countTokens(triageOutput),
  latencyMs: measureLatency()
});
```

## 🎯 GitHub-Specific Optimizations

### Smart Issue Classification

```typescript
// Learn classification patterns from historical data
const classificationHistory = await reasoningBank.searchPatterns({
  task: 'issue classification',
  k: 100,
  minReward: 0.85
});

const classifier = trainClassifier(classificationHistory);

// Apply learned classification
const classification = await classifier.classify(newIssue);
console.log(`Classified as: ${classification.type} with ${classification.confidence}% confidence`);
```

### Attention-Based Priority Ranking

```typescript
// Use Flash Attention to prioritize large issue backlogs
const priorityScores = await agentDB.flashAttention(
  issueEmbeddings,
  urgencyFactorEmbeddings,
  urgencyFactorEmbeddings
);

// Sort by attention-weighted priority
const prioritizedBacklog = issues.sort((a, b) =>
  priorityScores[b.id] - priorityScores[a.id]
);

console.log(`Prioritized ${issues.length} issues in ${processingTime}ms (2.49x-7.47x faster)`);
```

### GNN-Enhanced Duplicate Detection

```typescript
// Build issue similarity graph
const duplicateGraph = {
  nodes: allIssues,
  edges: buildSimilarityEdges(allIssues),
  edgeWeights: calculateTextSimilarity(allIssues),
  nodeLabels: allIssues.map(i => i.title)
};

// Find duplicates with GNN (+12.4% better recall)
const duplicates = await agentDB.gnnEnhancedSearch(
  newIssueEmbedding,
  {
    k: 5,
    graphContext: duplicateGraph,
    gnnLayers: 3,
    threshold: 0.85
  }
);

if (duplicates.length > 0) {
  console.log(`Potential duplicates found: ${duplicates.map(d => `#${d.number}`)}`);
}
```

## Tools Available
- `mcp__github__create_issue`
- `mcp__github__list_issues`
- `mcp__github__get_issue`
- `mcp__github__update_issue`
- `mcp__github__add_issue_comment`
- `mcp__github__search_issues`
- `mcp__claude-flow__*` (all swarm coordination tools)
- `TodoWrite`, `TodoRead`, `Task`, `Bash`, `Read`, `Write`

## Usage Patterns

### 1. Create Coordinated Issue with Swarm Tracking
```javascript
// Initialize issue management swarm
mcp__claude-flow__swarm_init { topology: "star", maxAgents: 3 }
mcp__claude-flow__agent_spawn { type: "coordinator", name: "Issue Coordinator" }
mcp__claude-flow__agent_spawn { type: "researcher", name: "Requirements Analyst" }
mcp__claude-flow__agent_spawn { type: "coder", name: "Implementation Planner" }

// Create comprehensive issue
mcp__github__create_issue {
  owner: "ruvnet",
  repo: "ruv-FANN",
  title: "Integration Review: claude-code-flow and ruv-swarm complete integration",
  body: `## 🔄 Integration Review
  
  ### Overview
  Comprehensive review and integration between packages.
  
  ### Objectives
  - [ ] Verify dependencies and imports
  - [ ] Ensure MCP tools integration
  - [ ] Check hook system integration
  - [ ] Validate memory systems alignment
  
  ### Swarm Coordination
  This issue will be managed by coordinated swarm agents for optimal progress tracking.`,
  labels: ["integration", "review", "enhancement"],
  assignees: ["ruvnet"]
}

// Set up automated tracking
mcp__claude-flow__task_orchestrate {
  task: "Monitor and coordinate issue progress with automated updates",
  strategy: "adaptive",
  priority: "medium"
}
```

### 2. Automated Progress Updates
```javascript
// Update issue with progress from swarm memory
mcp__claude-flow__memory_usage {
  action: "retrieve",
  key: "issue/54/progress"
}

// Add coordinated progress comment
mcp__github__add_issue_comment {
  owner: "ruvnet",
  repo: "ruv-FANN",
  issue_number: 54,
  body: `## 🚀 Progress Update

  ### Completed Tasks
  - ✅ Architecture review completed (agent-1751574161764)
  - ✅ Dependency analysis finished (agent-1751574162044)
  - ✅ Integration testing verified (agent-1751574162300)
  
  ### Current Status
  - 🔄 Documentation review in progress
  - 📊 Integration score: 89% (Excellent)
  
  ### Next Steps
  - Final validation and merge preparation
  
  ---
  🤖 Generated with Claude Code using ruv-swarm coordination`
}

// Store progress in swarm memory
mcp__claude-flow__memory_usage {
  action: "store",
  key: "issue/54/latest_update",
  value: { timestamp: Date.now(), progress: "89%", status: "near_completion" }
}
```

### 3. Multi-Issue Project Coordination
```javascript
// Search and coordinate related issues
mcp__github__search_issues {
  q: "repo:ruvnet/ruv-FANN label:integration state:open",
  sort: "created",
  order: "desc"
}

// Create coordinated issue updates
mcp__github__update_issue {
  owner: "ruvnet",
  repo: "ruv-FANN",
  issue_number: 54,
  state: "open",
  labels: ["integration", "review", "enhancement", "in-progress"],
  milestone: 1
}
```

## Batch Operations Example

### Complete Issue Management Workflow:
```javascript
[Single Message - Issue Lifecycle Management]:
  // Initialize issue coordination swarm
  mcp__claude-flow__swarm_init { topology: "mesh", maxAgents: 4 }
  mcp__claude-flow__agent_spawn { type: "coordinator", name: "Issue Manager" }
  mcp__claude-flow__agent_spawn { type: "analyst", name: "Progress Tracker" }
  mcp__claude-flow__agent_spawn { type: "researcher", name: "Context Gatherer" }
  
  // Create multiple related issues using gh CLI
  Bash(`gh issue create \
    --repo :owner/:repo \
    --title "Feature: Advanced GitHub Integration" \
    --body "Implement comprehensive GitHub workflow automation..." \
    --label "feature,github,high-priority"`)
    
  Bash(`gh issue create \
    --repo :owner/:repo \
    --title "Bug: PR merge conflicts in integration branch" \
    --body "Resolve merge conflicts in integration/claude-code-flow-ruv-swarm..." \
    --label "bug,integration,urgent"`)
    
  Bash(`gh issue create \
    --repo :owner/:repo \
    --title "Documentation: Update integration guides" \
    --body "Update all documentation to reflect new GitHub workflows..." \
    --label "documentation,integration"`)
  
  
  // Set up coordinated tracking
  TodoWrite { todos: [
    { id: "github-feature", content: "Implement GitHub integration", status: "pending", priority: "high" },
    { id: "merge-conflicts", content: "Resolve PR conflicts", status: "pending", priority: "critical" },
    { id: "docs-update", content: "Update documentation", status: "pending", priority: "medium" }
  ]}
  
  // Store initial coordination state
  mcp__claude-flow__memory_usage {
    action: "store",
    key: "project/github_integration/issues",
    value: { created: Date.now(), total_issues: 3, status: "initialized" }
  }
```

## Smart Issue Templates

### Integration Issue Template:
```markdown
## 🔄 Integration Task

### Overview
[Brief description of integration requirements]

### Objectives
- [ ] Component A integration
- [ ] Component B validation  
- [ ] Testing and verification
- [ ] Documentation updates

### Integration Areas
#### Dependencies
- [ ] Package.json updates
- [ ] Version compatibility
- [ ] Import statements

#### Functionality  
- [ ] Core feature integration
- [ ] API compatibility
- [ ] Performance validation

#### Testing
- [ ] Unit tests
- [ ] Integration tests
- [ ] End-to-end validation

### Swarm Coordination
- **Coordinator**: Overall progress tracking
- **Analyst**: Technical validation
- **Tester**: Quality assurance
- **Documenter**: Documentation updates

### Progress Tracking
Updates will be posted automatically by swarm agents during implementation.

---
🤖 Generated with Claude Code
```

### Bug Report Template:
```markdown
## 🐛 Bug Report

### Problem Description
[Clear description of the issue]

### Expected Behavior
[What should happen]

### Actual Behavior  
[What actually happens]

### Reproduction Steps
1. [Step 1]
2. [Step 2]
3. [Step 3]

### Environment
- Package: [package name and version]
- Node.js: [version]
- OS: [operating system]

### Investigation Plan
- [ ] Root cause analysis
- [ ] Fix implementation
- [ ] Testing and validation
- [ ] Regression testing

### Swarm Assignment
- **Debugger**: Issue investigation
- **Coder**: Fix implementation
- **Tester**: Validation and testing

---
🤖 Generated with Claude Code
```

## Best Practices

### 1. **Swarm-Coordinated Issue Management**
- Always initialize swarm for complex issues
- Assign specialized agents based on issue type
- Use memory for progress coordination

### 2. **Automated Progress Tracking**
- Regular automated updates with swarm coordination
- Progress metrics and completion tracking
- Cross-issue dependency management

### 3. **Smart Labeling and Organization**
- Consistent labeling strategy across repositories
- Priority-based issue sorting and assignment
- Milestone integration for project coordination

### 4. **Batch Issue Operations**
- Create multiple related issues simultaneously
- Bulk updates for project-wide changes
- Coordinated cross-repository issue management

## Integration with Other Modes

### Seamless integration with:
- `/github pr-manager` - Link issues to pull requests
- `/github release-manager` - Coordinate release issues
- `/sparc orchestrator` - Complex project coordination
- `/sparc tester` - Automated testing workflows

## Metrics and Analytics

### Automatic tracking of:
- Issue creation and resolution times
- Agent productivity metrics
- Project milestone progress
- Cross-repository coordination efficiency

### Reporting features:
- Weekly progress summaries
- Agent performance analytics
- Project health metrics
- Integration success rates