Code Measure — AI vs Human Contribution Tracker
A VS Code extension that measures lines of code added/removed by AI (Kiro, Copilot, etc.) vs Human across sessions. Works with or without git — uses a local shadow index for non-git projects. Zero external dependencies.
Install
# From the .vsix file (no marketplace needed):
code --install-extension code-measure-1.0.0.vsix
Or in VS Code: Ctrl+Shift+P → "Extensions: Install from VSIX" → select code-measure-1.0.0.vsix
✨ Key Features
🎨 Colored Status Bar (Live Activity Indicator)
┌─────────────────────────────────────────────────────────┐
│ 🟢 GREEN = Human Input (you are actively typing) │
│ 🔵 BLUE = AI Writing (Kiro/agent modifying files) │
│ ⚪ WHITE = Idle (no active coding detected) │
└─────────────────────────────────────────────────────────┘
The status bar color changes in real-time based on who is currently coding. No manual action needed.
🔍 Smart AI vs Human Detection
Uses multiple behavioral signals (inspired by how git detects changes + Code Crawler's approach):
| Signal |
What it detects |
Confidence |
| File not in active editor changes |
AI wrote to a non-focused file |
95% |
Kiro .kiro/ folder activity |
Agent session is active |
90% |
| Multi-file burst (<2s) |
AI writing multiple files rapidly |
85% |
| Large change (>10 lines) at once |
AI bulk write |
80% |
| Small change in active editor |
Human typing |
90% |
| Typing rhythm (incremental edits) |
Human keyboard input |
95% |
| Recent keystroke + active editor |
Human |
95% |
📁 Works WITHOUT Git (Non-GitLab/GitHub Projects)
The extension includes a Local Diff Engine — a git-like shadow index that:
- Stores content hashes + full line snapshots of all tracked files
- Computes actual line-level diffs (LCS algorithm, like
git diff)
- Works on ANY project folder, even without
.git initialization
- Uses the same approach as git: stat-based fast path + content-hash slow path
How Git detects changes (and how we replicate it locally):
┌─────────────────────────────────────────────────────────┐
│ 1. Check file stat (mtime + size) — FAST PATH │
│ → If unchanged, skip │
│ 2. If stat changed, hash content — SLOW PATH │
│ → If hash same as index, no change │
│ 3. If hash differs, compute line diff (LCS/Myers) │
│ → Get exact +added/-removed per file │
│ 4. Update index to new state │
└─────────────────────────────────────────────────────────┘
Shadow index stored in .code-measure/shadow-index/ (auto-gitignored).
How It Works
Automatic Mode (Default — No Action Required)
The auto-observer runs passively and:
- Detects when Kiro/AI writes files directly to disk (via FileSystemWatcher)
- Detects when you type in the editor (via onDidChangeTextDocument)
- Computes proper line-level diffs using the shadow index
- Classifies each change as AI or Human based on behavioral signals
- Records everything to
.code-measure/ for reports
Manual Session Mode (Optional — For Precise Control)
1. Start Session (AI or Human)
→ Takes git snapshot (commit SHA) or shadow index baseline
2. You/AI write code...
3. End Session
→ Computes diff from snapshot
→ Records lines added/removed per file
→ Attributes to AI or Human
4. View reports, history, percentages
Commands (Ctrl+Shift+P)
| Command |
What it does |
Code Measure: Start AI Session |
Start tracking — changes attributed to AI |
Code Measure: Start Human Session |
Start tracking — changes attributed to human |
Code Measure: End Session |
End & compute diff, record results |
Code Measure: Continue as AI |
End current + start new AI session |
Code Measure: Continue as Human |
End current + start new Human session |
Code Measure: Abandon Session |
Discard session without recording |
Code Measure: Show Status |
Show active session info |
Code Measure: Show Contribution Report |
Open markdown report (daily/weekly/monthly/quarterly/annual) |
Code Measure: Show File History |
GitLab-like history for current file |
Code Measure: List Sessions |
Browse all recorded sessions |
Code Measure: Sync Prompts from Kiro Metrics |
Import prompt/token data |
Code Measure: Reset All Data |
Clear everything (with confirmation) |
The extension adds a "Code Measure" activity bar icon with three views:
- Contribution Summary — AI% vs Human% at a glance, today's stats
- Sessions — List of all recorded sessions with line counts
- File History — Per-file breakdown showing who changed what
Status Bar
Two status bar items:
Activity Indicator (colored) — Shows current state:
- 🟢
Human Input 23s — You're typing
- 🔵
AI Writing 5s — Agent is modifying files
- ⚪
Code Measure — Idle
Session Indicator — Shows active manual session:
🤖 AI #5 12m30s — AI session running
👤 HUMAN #6 3m — Human session running
📊 Session — No active session
What's Measured
| Metric |
Description |
| Lines Added |
Lines written (actual diff, not just count) |
| Lines Removed |
Lines deleted (actual diff) |
| Files Changed |
Number of files modified |
| AI % |
Percentage of all tracked changes from AI |
| Human % |
Percentage of all tracked changes from Human |
| Per-file attribution |
Which files are mostly AI vs Human |
| Time utilization |
How much time AI vs Human spent |
| Workload level |
Light/Moderate/Heavy/Overloaded assessment |
| Token usage |
Estimated prompt tokens (from .kiro/metrics) |
Settings
| Setting |
Default |
Description |
codeMeasure.excludePatterns |
[node_modules/**, .code-measure/**, ...] |
Files to ignore |
codeMeasure.userName |
OS username |
Your name for reports |
codeMeasure.autoDetectAI |
true |
Enable auto-detection |
codeMeasure.showStatusBar |
true |
Show/hide status bar items |
Data Storage
All data lives in workspace-local .code-measure/ folder:
.code-measure/
├── .gitignore — Auto-excludes from git
├── sessions.jsonl — Session records (append-only)
├── changes.jsonl — Per-file change log (append-only)
├── prompts.jsonl — Token/prompt tracking
├── project-meta.json — Sequence counters & metadata
├── active/ — Active sessions per VS Code instance
│ └── instance-{pid}.json
├── shadow-index/ — Git-like local diff engine
│ ├── index.json — File metadata (hash, size, mtime)
│ └── blobs/ — Content snapshots for diff
│ └── {hash-prefix}/
│ └── {hash}.lines
└── reports/ — Generated markdown reports
└── 2026/
└── July/
├── daily-2026-07-05.md
└── weekly-2026-06-30-to-2026-07-06.md
Architecture
┌─────────────────────────────────────────────────────────────────┐
│ Code Measure Extension │
├─────────────────────────────────────────────────────────────────┤
│ │
│ ┌──────────────┐ ┌───────────────────┐ ┌────────────────┐ │
│ │ Status Bar │ │ Auto Observer │ │ Session Mgr │ │
│ │ Controller │ │ (Passive) │ │ (Manual) │ │
│ │ │ │ │ │ │ │
│ │ Green/Blue/ │◄─┤ • FS Watcher │ │ • Start/End │ │
│ │ White state │ │ • Editor Monitor │ │ • Continue │ │
│ │ │ │ • Kiro Detector │ │ • Git Diff │ │
│ └──────────────┘ │ • Behavior Score │ └────────────────┘ │
│ └─────────┬─────────┘ │
│ │ │
│ ┌─────────▼─────────┐ │
│ │ Local Diff Engine │ │
│ │ (Shadow Index) │ │
│ │ │ │
│ │ • Content hashing │ │
│ │ • LCS line diff │ │
│ │ • Stat fast-path │ │
│ │ • Blob storage │ │
│ └─────────┬─────────┘ │
│ │ │
│ ┌─────────▼─────────┐ │
│ │ Storage │ │
│ │ (JSONL files) │ │
│ └──────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘
Key Design Decisions
- No git required — Shadow index provides git-like diffs for any project
- Behavioral classification — Multiple signals weighted for accuracy
- Real-time status bar — See at a glance who's coding right now
- No external deps — Uses only VS Code API + Node.js built-ins
- Debounced processing — Handles Kiro's rapid multi-write patterns
- Content hashing — Accurate change detection (not just line count delta)
- LCS diff algorithm — Same approach as git for accurate +/-
- Multi-instance safe — PID-based session isolation
- Append-only storage — Safe for concurrent writes
Build from Source
cd code_measure
npm install
npm run compile
npm run package
# Produces code-measure-1.0.0.vsix