Code Review tool redesigned for the Vibe Coding era
AgentLens is a Code Review tool designed specifically for the era of AI-assisted coding.
It addresses the fundamental challenge of reviewing AI-generated code by providing:
- Dual-Track Data Collection: Captures both Hook events and session files from AI Agents
- Contributor Detection: Identifies whether code was written by AI or humans using hunk-level similarity matching
- VS Code Sidebar Integration: View connected agents and recent AI activity directly in VS Code
- GitLens-Style Blame: Displays contributor information inline when hovering over code
- Multi-Agent Support: Works with Cursor, Claude Code, and other AI coding assistants
- Performance Optimized: 4-level filtering for efficient matching on large datasets
- 4-Level Filtering: File path → Time window → Content length → Levenshtein matching
- High Performance: 100 records < 50ms, 500 records < 150ms
- Configurable Thresholds: Customize AI/Human detection sensitivity
- Real-time Tracking: Monitor matching performance with detailed metrics
- Bottleneck Analysis: Automatic detection of performance issues
- Developer Mode: Enhanced debugging information in VS Code
- Date-based Sharding: Efficient JSONL files organized by date
- Auto Cleanup: Configurable retention policy (default: 7 days)
- Prompt Tracking: Link code changes to their triggering prompts
- One-Click Reporting: Report matching issues directly from VS Code
- Rich Context: Includes candidates, performance metrics, and debug info
- User Feedback: Collect expected results for improvement
In the Vibe Coding era:
- AI Agents generate large amounts of code quickly
- Traditional code review focuses on "human thinking process"
- Reviewing AI-generated code requires understanding the Agent's task breakdown and decision-making
- Git history shows human authors even for AI-generated code
AgentLens provides:
- Agent Traceability: Track which AI Agent generated which code
- Session Context: Link code changes to the original conversation and task breakdown
- Contributor Classification: Automatically detect AI vs. human contributions
- TODO Integration: Connect code with the Agent's task breakdown
AgentLens uses a 4-layer architecture:
┌─────────────────────────────────────────────────────┐
│ Layer 4: Product Delivery │
│ (CLI Tool, VS Code Extension, GitLens Integration)│
├─────────────────────────────────────────────────────┤
│ Layer 3: Product Core │
│ (Protocol Parsing, Rendering, State Management) │
├─────────────────────────────────────────────────────┤
│ Layer 2: Data Layer │
│ (ReviewUnit, SessionSource, Todo Models) │
├─────────────────────────────────────────────────────┤
│ Layer 1: Tool Layer │
│ (Hook System, Session Monitoring, Git Integration)│
└─────────────────────────────────────────────────────┘
.agentlens/data/hooks/
├── changes/ # Code change records (sharded by date)
│ ├── 2026-02-10.jsonl
│ ├── 2026-02-11.jsonl
│ └── 2026-02-12.jsonl
├── prompts/ # User prompts (sharded by date)
│ ├── 2026-02-10.jsonl
│ └── 2026-02-11.jsonl
├── logs/
│ └── performance.jsonl # Performance metrics
├── reports/ # Issue reports
│ └── 2026-02-12/
│ └── report-{id}.json
└── sessions.json # Session metadata
- Node.js >= 22.15.1
- pnpm >= 9.5.0
- Git repository
# Clone the repository
git clone https://github.com/alienzhou/agentlens.git
cd agentlens
# Install dependencies
pnpm install
# Build all packages
pnpm buildcd your-project
agentlens config --initThis creates a .agentlens/ directory with:
data/sessions/- Session datadata/hooks/- Hook captured data (sharded by date)data/todos.json- TODO itemsconfig/- Configuration files
# Connect to Cursor
agentlens hook connect cursor
# Connect to Claude Code
agentlens hook connect claude-code
# Check connection status
agentlens hook status# Show working tree changes with contributor info
agentlens diff --annotated
# Show staged changes
agentlens diff --staged
# Output to markdown
agentlens diff --format markdown -o report.md# Interactive review session
agentlens review
# Filter by session
agentlens review --session abc123
# Export to file
agentlens review --format markdown -o review-report.md# List all TODOs
agentlens todos
# Filter by status
agentlens todos --status pending
# Output as JSON
agentlens todos --format jsonThis monorepo contains:
| Package | Description | Status |
|---|---|---|
| @agentlens/core | Core data models, Git integration, contributor detection, performance tracking | ✅ Stable |
| @agentlens/hook | Agent hook adapters (Cursor, Claude Code) | ✅ Stable |
| @agentlens/cli | Command-line interface | ✅ Stable |
| agentlens (VSCode) | VS Code extension with blame annotations | ✅ Beta |
AgentLens uses 4-level filtering with Levenshtein similarity matching to determine code authorship:
Level 1: File Path Filter (100 records → 30 records)
↓
Level 2: Time Window Filter (30 records → 15 records)
↓
Level 3: Content Length Filter (15 records → 5 records)
↓
Level 4: Levenshtein Matching (5 candidates → best match)
Classification Thresholds:
- ≥ 90% similarity → AI Generated
- 70-90% similarity → AI Generated (Human Modified)
- < 70% similarity → Human Contribution
- Sidebar - Connected Agents: View all detected AI agents and their connection status
- Sidebar - Recent Activity: Browse recent AI-generated code changes with quick file navigation
- Line Blame: Hover over any line to see contributor info (AI or Human)
- Developer Mode: Enable
agentLens.developerModefor detailed debug info - Report Issue: Click "🐛 Report Issue" to report matching problems
- Auto Cleanup: Automatic cleanup of old data files
{
"agentLens.matching.timeWindowDays": 3,
"agentLens.matching.lengthTolerance": 0.5,
"agentLens.autoCleanup.enabled": true,
"agentLens.autoCleanup.retentionDays": 7,
"agentLens.developerMode": false
}agentlens/
├── packages/
│ ├── core/ # Core library (detection, storage, performance)
│ ├── hook/ # Hook system (agent adapters)
│ ├── cli/ # CLI tool
│ └── vscode/ # VS Code extension
├── docs/ # Documentation
│ └── v01-mvp/ # MVP documentation
├── .github/ # CI/CD workflows
└── vitest.config.ts # Test configuration
# Development
pnpm dev # Watch mode for all packages
pnpm build # Build all packages
pnpm test # Run tests in watch mode
pnpm test:run # Run tests once
pnpm test:coverage # Generate coverage report
# Code Quality
pnpm lint # Lint all packages
pnpm lint:fix # Fix linting issues
pnpm format # Format code with Prettier
pnpm format:check # Check code formatting
pnpm typecheck # Type check all packages
# Cleanup
pnpm clean # Remove build artifacts and node_modules# Run all tests (9 test files, 167+ test cases)
pnpm test:run
# Run tests for specific package
pnpm --filter @agentlens/core test
# Generate coverage report
pnpm test:coverage| Test Category | Files | Test Cases |
|---|---|---|
| Sharded Storage | 1 | 22 |
| Cleanup Manager | 1 | 26 |
| 4-Level Filtering | 1 | 22 |
| Performance Tracker | 1 | 23 |
| Report Service | 1 | 34 |
| Integration Tests | 1 | 12 |
| Legacy Tests | 3 | 28 |
| Total | 9 | 167 |
- Project Overview
- Requirements Analysis
- Architecture Design
- Task List
- Verification Checklist
- ADR Index
- Phase 0: Project infrastructure and tool layer
- Phase 1: Data layer validation (CLI tool)
- Phase 2: Product core layer (VS Code extension)
- Performance Optimization: 4-level filtering, sharded storage
- Report Issue: One-click issue reporting with rich context
- Phase 3: Product delivery layer (GitLens integration)
- Marketplace Release: Publish to VS Code Marketplace
See docs/v01-mvp/04-task-list.md for detailed task breakdown.
Install from VS Code Marketplace:
- Open VS Code
- Go to Extensions (Ctrl+Shift+X / Cmd+Shift+X)
- Search for "AgentLens"
- Click Install
Or install via command line:
code --install-extension vibe-x-ai.agentlensWe welcome contributions! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'feat: add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
See CONTRIBUTING.md for detailed guidelines.
This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by the Vibe Coding movement
- Built with simple-git for Git operations
- Uses Commander.js for CLI
- Styled with chalk for terminal output
- File watching with chokidar
- Similarity matching with fast-levenshtein
- Author: alienzhou
- Repository: agentlens
- Issues: GitHub Issues
- VS Code Marketplace: AgentLens
- Documentation: docs/
Note: This is Beta version (v0.1). Core features including contributor detection, performance monitoring, and VS Code integration are functional. The Skill system for protocol content generation will be available in future versions.
