TraceAI - Code Attribution Tracker
Track AI-generated vs manually-written code in real-time with detailed statistics.
Features
- Real-time Tracking: Monitors every character you type or paste
- Smart Detection: Uses heuristics to distinguish between manual typing, pasting, and AI completions
- Status Bar: Shows live statistics (Manual % | AI %)
- Explorer View: Detailed breakdown in the Explorer sidebar
- Persistent Storage: Attribution data saved to
.traceai file and committed with your code
- Team Collaboration: Share attribution stats across team via git
- Debug Tools: Inspect attribution data and reset if needed
Usage
First-Time Setup
Authentication is required before the extension can function.
- Install the extension
- When you first activate the extension, you'll be prompted to authenticate
- Click "Authenticate Now" to open a web browser for Microsoft authentication
- Sign in with your Microsoft account
- Grant the necessary permissions
- Return to VS Code - the extension is now ready to use!
Alternatively, you can manually authenticate anytime using:
- Command Palette →
TraceAI: Login
Tracking Your Code
- Open any text file
- Start coding! The extension automatically tracks:
- Manual typing: Single characters typed slowly
- AI completions: Fast multi-character insertions
- Paste operations: Large text blocks or multi-line insertions
Status Bar
The status bar (bottom-right) displays:
✍️ Manual 75.3% | ✨ AI 24.7%
Click it to see detailed debug information.
Explorer View
Open the TraceAI Stats view in the Explorer sidebar to see:
- 📊 Total Characters
- ✍️ Manual (count and percentage)
- ✨ AI (count and percentage)
Commands
TraceAI: Show Debug Info - Display detailed attribution statistics
TraceAI: Reset Attribution Data - Clear and reinitialize tracking for current file
TraceAI: Refresh Statistics - Manually refresh the Explorer view
Settings
traceai.enableDecorations (default: false) - Show visual decorations for AI code
traceai.pasteThreshold (default: 10) - Minimum characters to consider as paste
traceai.updateInterval (default: 500) - Status bar update interval (ms)
How It Works
Detection Heuristics
- Manual Typing:
- Single characters with normal typing speed
- Single Enter key press (newline)
- Enter with auto-indentation
- AI Completions: Multi-character insertions happening very fast (<50ms)
- Paste Operations:
- Multi-line text with content
- Multiple newlines
- Text blocks larger than
pasteThreshold
Accuracy
The extension uses heuristic detection since it cannot access VS Code's internal APIs. Accuracy is approximately 80-90% depending on your coding patterns.
For 100% accurate tracking, see the built-in implementation (requires VS Code source modifications).
Persistence & Team Collaboration
.traceai File
Attribution data is automatically saved to a .traceai file in your workspace root when you save any tracked file. This file contains:
- Character-level attribution for each file
- Statistics (total, manual, AI percentages)
- Last modified timestamps
Example .traceai structure:
{
"version": 1,
"files": {
"src/index.ts": {
"lines": [
{ "line": 1, "chars": [1,1,1,2,2] },
{ "line": 2, "chars": [1,1,1,1] }
],
"stats": { "total": 9, "manual": 7, "ai": 2 },
"lastModified": "2025-11-20T10:30:00.000Z"
}
}
}
Sharing with Team
First Developer:
Other Developers:
- Clone/pull repository (includes
.traceai)
- Open file → Extension automatically loads attribution data
- See original author's AI/Manual percentages
- Continue editing → Attribution preserved and updated
Benefits
✅ Track AI contribution across development team
✅ Audit code authorship over time
✅ Understand AI adoption patterns in your codebase
✅ No manual intervention required
Requirements
Known Limitations
- Cannot directly detect Copilot/AI completions (uses timing heuristics instead)
- Very fast manual typing may be misclassified as AI
.traceai file should be committed to git for team sharing
Development
# Install dependencies
npm install
# Compile TypeScript
npm run compile
# Watch mode
npm run watch
# Package extension
npm install -g @vscode/vsce
vsce package
License
MIT
Feedback
Found a bug or have a suggestion? Open an issue