Code Insights — Local Coding Analytics for AI Developers Without Cloud Tracking
“Code Insights gives me a daily mirror of my own coding — local, free, and without anyone else watching.”
The Problem Code Insights Solves
I build AI agents and infrastructure all day. I have PostHog for product analytics, Datadog for infra, and Vercel Analytics for the web — but for the most important tool in my stack, my own coding process, I had nothing.
I had no idea:
- Which models actually delivered value vs. wasted tokens
- Where I got stuck most often and why
- Whether I was spending hours on architecture or debugging the same friction points over and over
Cloud-based solutions were out of the question. My coding transcripts contain business logic, client data, and proprietary code. They should not leave the machine.
So I implemented Code Insights — and this is what it looks like in practice.
What Is Code Insights?
Code Insights (@code-insights/cli) is a local, privacy-first tool for tracking and analyzing coding patterns from Cursor, Claude Code, and Codex CLI.
Core principles
The Tech Stack
Every part of the stack is chosen deliberately:
| Component | Technology | Purpose |
|---|---|---|
| CLI | @code-insights/cli (npm global) |
Sync, stats, dashboard |
| Storage | SQLite (~/.code-insights/data.db) |
Sessions, messages, timestamps — all local |
| Cursor commands | .cursor/commands/*.md |
/insights daily, /insights-week weekly |
| Rules | .cursor/rules/operator-efficiency.mdc |
Keeps models cheap, controls model selection per context |
| Playbook | docs/playbooks/CODE-INSIGHTS-V0.md |
Decision log, installation, error handling |
| Dashboard (optional) | code-insights dashboard |
Local web app at localhost:7890 |
SQLite is the right choice here. No server to start, no migrations to manage, no config files. The database is created automatically on first run and lives in ~/.code-insights/ permanently.
How I Set It Up
Installation
npm install -g @code-insights/cli
That’s it. From the next coding session onward, the CLI automatically syncs sessions to ~/.code-insights/data.db.
Cursor Slash Commands
I added two commands to .cursor/commands/:
/insights — Daily review (3 min)
What did I deliver today?
What stopped me?
One habit to take into tomorrow.
/insights-week — Weekly pattern analysis (20 min)
Which model lanes delivered the most value?
Where did the same friction points recur?
How does architecture work compare to implementation?
The commands call the Code Insights CLI in the background, pull aggregated data from SQLite, and present a structured summary directly inside Cursor. No external API calls.
The Operator Rules
The file .cursor/rules/operator-efficiency.mdc does two things:
- Controls model selection — All
/insightsruns use free OpenRouter models (North Mini, Nemotron). Composer/Auto is reserved for architecture questions and heavier work. - Enforces context separation — Work, personal, and client projects do not mix in the analysis. No transcripts end up in Git or external databases.
Why separation is critical
I work across three separate contexts every day: my own portfolio, personal projects, and client engagements. If session data gets mixed, the analysis loses all meaning — and in the worst case, proprietary business logic leaks between contexts. The operator rules are the first line of defence.
What I’m Actually Learning
After three weeks with Code Insights, the daily patterns are becoming clear:
What works
- Kimi K2 for multi-file refactoring
- North Mini for explanations and boilerplate
- Short, focused sessions (< 45 min)
- Clear, specific task descriptions in prompts
Friction points
- Long sessions without breaks lose context
- Vague tasks lead to expensive do-overs
- Wrong model for the wrong task costs double
- Missing documentation creates debugging loops
That insight — vague task descriptions lead to expensive do-overs — is impossible to see without data. Now I write clearer prompts not because it feels right, but because I can measure the difference.
The Visual Dashboard
code-insights dashboard
Starts a local web app at localhost:7890. No third-party services, no cookies, no telemetry. The dashboard shows:
- Sessions per day and week
- Model distribution and cost
- Friction points per project
- Token usage over time
Status: In testing
I have had Code Insights running for three weeks. The daily insights runs are already a built-in habit. The weekly analysis is still taking shape — it takes time to see meaningful patterns. I will follow up when I have 60 days of data.
The Value in Three Lines
3 minutes/day → clear summary: what I delivered, what stopped me, one habit for tomorrow.
20 minutes/week → pattern recognition: model lanes, friction points, architecture vs. implementation ratio.
Zero cost — free OpenRouter models, local SQLite, no subscriptions.
Want to Set It Up?
# 1. Install
npm install -g @code-insights/cli
# 2. Verify the database is created
ls ~/.code-insights/data.db
# 3. Add Cursor commands
# Copy /insights and /insights-week into .cursor/commands/
# 4. Add the operator rule
# .cursor/rules/operator-efficiency.mdc
# 5. Start the dashboard
code-insights dashboard
# → localhost:7890
The only prerequisite is that you are already using Cursor, Claude Code, or Codex CLI. Code Insights pulls data from existing sessions — no changes to your workflow are needed to start collecting data.
I write about building AI agents and keeping development costs sane. More details on the OpenRouter configuration are in the previous post on cost reduction.