Package Exports
- @vandanach/flowlens
- @vandanach/flowlens/dist/cli.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@vandanach/flowlens) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
๐ FlowLens โ Developer Friction Intelligence Agent
"Turn invisible developer pain into visible, actionable insights using AI-powered behavioral analysis"
CLI-Native โข Privacy-First โข AI-Powered
๐ฏ 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/flowlens
# Or use directly with npx
npx @vandanach/flowlensUsage
# 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
- Core friction detection engine
- AI-powered insights integration
- HTML report generation
- File exclusion system
- 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
๐ Links
Stop guessing. Start measuring. Fix what matters.
Built with โค๏ธ by developers, for developers