@vandanach/flowlens
v1.0.4
Published
Enterprise Developer Friction Intelligence Agent - Uses GitHub's AI platform (Models API) for behavioral analysis and actionable insights. Built for Microsoft developers.
Maintainers
Readme
🔍 FlowLens — Enterprise Developer Friction Detection with GitHub Copilot SDK
"Turn invisible developer pain into visible, actionable insights using GitHub Copilot SDK and AI-powered behavioral analysis"
Built with GitHub Copilot SDK • CLI + Copilot Chat • Privacy-First • Enterprise-Ready
🚀 GitHub Copilot SDK Integration
FlowLens is now available as a Copilot Chat participant! Interact with your friction analysis using natural language:
@flowlens analyze my project
@flowlens explain src/auth/middleware.ts
@flowlens what are my highest friction files?
@flowlens give me an executive summaryTwo Ways to Use FlowLens:
- 🤖 Copilot Chat - Ask FlowLens questions in natural language via GitHub Copilot
- ⌨️ CLI Tool - Run comprehensive analysis and generate detailed HTML reports
Both modes use the same powerful friction detection engine and AI analysis!
🎯 The Problem FlowLens Solves
Developers waste 23% of their time struggling with "friction" — confusing code, hidden dependencies, and technical debt.
Traditional code analysis measures complexity metrics, but not what really matters: How hard is this code to work with?
Real Developer Pain:
- 🔄 Returning to the same file repeatedly confusing interfaces
- ⏱️ Spending hours on simple changes → complex logic
- ✏️ High code churn → unstable requirements
- 🔗 Always editing files together → hidden coupling
- 🧪 Rapid edit-test-edit cycles → "stuck loops"
The gap: Managers can't see WHERE problems are. Developers don't know WHAT to fix first. Metrics don't explain WHY.
💡 The Solution
FlowLens watches how developers actually code and uses AI-powered analysis to transform behavioral data into specific, actionable improvements.
🔄 How It Works:
┌─────────────┐ ┌──────────────┐ ┌──────────────────┐
│ Daemon │ ───▶ │ Behavior │ ───▶ │ AI Analysis │
│ Watches │ │ Analysis │ │ (GitHub Models │
│ Codebase │ │ Engine │ │ API) │
└─────────────┘ └──────────────┘ └──────────────────┘
│ │ │
▼ ▼ ▼
File edits Friction scores Actionable insights
Time tracking Pattern detection Specific fixes
Git history ROI calculations Priority ranking🚀 Quick Start
Installation
# Install globally
npm install -g @vandanach/flowlensMethod 1: Copilot Chat (Natural Language)
# Start the Copilot agent
flowlens-copilot
# Then use in GitHub Copilot Chat:
@flowlens analyze my project
@flowlens explain src/auth.ts
@flowlens what are my top 10 friction files?
@flowlens helpMethod 2: CLI (Detailed Reports)
# 1. Initialize in your project
flowlens init
# 2. Start background daemon
flowlens start
# 3. Code normally for a few days...
# (FlowLens watches silently in the background)
# 4. Generate insights
flowlens analyze
# 5. Create visual report
flowlens reportThat's it! Zero configuration. 100% privacy. All data stays local.
✨ Key Features
1. Behavioral Friction Detection
Measures actual developer struggle:
- ⏱️ Time spent on files (cognitive load signal)
- 🔄 Revisit frequency (confusion indicator)
- ✏️ Code churn rate (instability marker)
- 🔗 Co-edit patterns (hidden dependencies)
- 🧪 Test frequency (debugging loops)
2. AI-Powered Insights
Intelligent analysis that understands your code:
- 🎯 Context-aware recommendations
- 🔍 Root cause analysis
- 💡 Specific, actionable fixes
- 📊 ROI calculations
- 🚨 Priority ranking
3. Visual Reports
Beautiful HTML dashboards with:
- 🎨 Friction heatmaps
- 📈 Trend analysis
- 💰 Time-saved estimates
- 🔗 Coupling detection
- ⚡ Priority recommendations
4. Privacy-First Architecture
- ✅ 100% local data storage
- ✅ No external servers
- ✅ Git-ignored by default
- ✅ Configurable exclusions
- ✅ Easy data deletion
📊 Example Analysis
FlowLens generates insights like:
🔥 HIGH FRICTION: auth/middleware.ts (78/100)
📉 Behavioral Signals:
+ 15 revisits in 3 days
+ 2.5 hours total time spent
+ 67% code churn (lines changed/total)
+ 8 files always edited together
🤖 AI Analysis:
"This middleware runs on every request but contains expensive
database queries inside the authentication check. The high revisit
count suggests developers struggle to understand the flow.
Specific Issues:
1. User lookup happens on every request (not cached)
2. Permission checks mixed with authentication logic
3. Implicit dependency on SessionStore not obvious from imports
Recommendations:
1. Add Redis caching layer for user lookups
2. Move authentication to separate middleware
3. Extract permissions to dedicated service
4. Add JSDoc explaining the request flow"
💰 ROI Impact:
Fixing this file could save ~5 hours/week per developer
Estimated team savings: $3,200/month (4 devs × $20k/year avg friction cost)🤖 AI Integration
How AI Analysis Works
FlowLens uses GitHub Models API to provide intelligent analysis of code friction:
// src/ai/client.ts - AI Integration
export class CopilotClient {
async getFileInsight(context: PromptContext): Promise<InsightResult> {
// 1. Build rich context from behavioral data
const prompt = PromptBuilder.buildFileAnalysisPrompt({
filePath: context.filePath,
frictionScore: context.frictionScore, // Behavioral metrics
sourceCode: context.sourceCode, // Actual code
gitHistory: context.gitHistory, // Commit patterns
patterns: context.patterns, // Detected anti-patterns
});
// 2. Call GitHub Models API with behavioral context
const response = await fetch('https://models.inference.ai.azure.com/chat/completions', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.GITHUB_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
messages: [
{
role: 'system',
content: 'You are analyzing developer friction based on behavioral data...'
},
{
role: 'user',
content: prompt
}
],
model: 'gpt-4o',
temperature: 0.7,
max_tokens: 2000,
}),
});
// 3. Return actionable insights
return {
insight: response.choices[0].message.content,
cached: false,
timestamp: Date.now(),
};
}
}Key Benefits:
- Behavioral Context — AI sees HOW developers struggle, not just WHAT code exists
- Automatic Detection — No manual code review needed
- Continuous Monitoring — Track improvements over time
- Measurable ROI — Data-driven prioritization with cost calculations
- Privacy-First — All data stays local, only analysis sent to AI
📦 Architecture
flowlens/
├── src/
│ ├── daemon/ # Background file system watcher
│ │ ├── manager.ts # Process lifecycle
│ │ └── watcher.ts # Chokidar-based monitoring
│ ├── core/ # Friction analysis engine
│ │ ├── analyzer.ts # Scoring algorithm
│ │ ├── git.ts # Git integration
│ │ └── config.ts # Configuration management
│ ├── ai/ # AI integration (GitHub Models API)
│ │ ├── client.ts # Copilot API client
│ │ └── prompts.ts # Prompt engineering
│ ├── database/ # Local data storage
│ │ └── store.ts # SQLite (sql.js)
│ ├── reporting/ # Report generation
│ │ ├── html.ts # HTML generator
│ │ └── insights.ts # Smart insights
│ └── cli.ts # Commander.js CLI
├── dist/ # Compiled JavaScript
└── package.jsonTech Stack:
- TypeScript — Type-safe development
- Node.js 18+ — Cross-platform daemon
- SQLite (sql.js) — Pure JS, no native deps
- Chokidar — Reliable file watching
- Simple-git — Git operations
- GitHub Models API — AI-powered insights
- Commander.js — CLI framework
🔧 Advanced Usage
File Exclusions
# List current exclusions
flowlens exclude list
# Add specific files
flowlens exclude add "**/*.test.js"
flowlens exclude add "package.json"
# Add common defaults automatically
flowlens exclude add-default
# (adds package-lock.json, yarn.lock, *.min.js, *.map, etc.)
# Remove exclusion
flowlens exclude remove "**/*.test.js"Configuration
Edit .flowlens/config.json:
{
"sessionGapMinutes": 5,
"dataRetentionDays": 30,
"excludePatterns": [
"**/node_modules/**",
"**/.git/**",
"**/dist/**",
"**/package-lock.json",
"**/*.min.js"
],
"copilotEnabled": true
}Environment Variables
# Set GitHub token (get one at https://github.com/settings/tokens)
export GITHUB_TOKEN="your-token-here"
# Or create a .env file
cp .env.example .env
# Edit .env and add your GitHub token
# Optional: Choose a different model (default: gpt-4o)
export GITHUB_COPILOT_MODEL="gpt-4o-mini"Note: FlowLens uses GitHub Models API (models.github.com), GitHub's free AI service. A standard GitHub Personal Access Token is all you need - no special Copilot subscription required for basic usage.
📈 Measuring Impact
Before vs. After
| Metric | Before | After FlowLens | |--------|--------|----------------| | Refactoring decisions | Gut feel | Data-driven | | Friction visibility | None | Quantified | | Prioritization | Random | ROI-based | | Improvement tracking | Impossible | Measurable | | Developer satisfaction | Unknown | Improving |
Real Impact:
"We used FlowLens to identify our top 3 friction points. After refactoring them based on Copilot's recommendations, we saved 12 hours per developer per week."
— Engineering Lead
💰 12 hours/week × 10 devs × $75/hour = $9,000/week saved
🛠️ Development
Setup
git clone https://github.com/yourusername/flowlens.git
cd flowlens
npm install
npm run build
npm link # Makes 'flowlens' available globallyProject Structure
src/— TypeScript sourcedist/— Compiled JavaScript.flowlens/— Local data (git-ignored)reports/— Generated HTML reports
📋 Roadmap
- [x] Core friction detection engine
- [x] AI-powered insights integration
- [x] HTML report generation
- [x] File exclusion system
- [x] Privacy controls
- [ ] VS Code extension
- [ ] GitHub Action for CI/CD
- [ ] Team analytics dashboard
- [ ] Slack/Teams notifications
- [ ] Historical trend analysis
🤝 Contributing
Contributions welcome! See CONTRIBUTING.md.
Development Commands
npm run build # Compile TypeScript
npm run dev # Development mode
npm test # Run tests📄 License
MIT © 2026 FlowLens Contributors
🙏 Acknowledgments
- The open-source community for inspiration and tools
- Every developer who struggles with technical debt daily
- Contributors who help make FlowLens better
