# gopinathmaharaja/agy-lens architecture

> Architecture diagram of the GitHub repository gopinathmaharaja/agy-lens, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gopinathmaharaja/agy-lens
- Repository: https://github.com/gopinathmaharaja/agy-lens

## Overview

AI-Lens is a local-first VS Code extension for Antigravity usage monitoring, prompt coaching, and history analysis. Its main workflow collects runtime and transcript data, parses and analyzes it, persists records locally, then presents status and dashboard insights. Separate capability branches cover prompt improvement, model advice, quota/context monitoring, and export. The graph uses README claims and the supplied source excerpts/index; some subsystem links are documented or index-supported rather than shown in full implementation excerpts.

Main entry points: [`src/services/syncService.ts`](https://github.com/gopinathmaharaja/agy-lens/blob/master/src/services/syncService.ts) (Sync orchestration), [`src/webview/dashboardPanel.ts`](https://github.com/gopinathmaharaja/agy-lens/blob/master/src/webview/dashboardPanel.ts) (Dashboard panel), [`src/extension.ts`](https://github.com/gopinathmaharaja/agy-lens/blob/master/src/extension.ts) (Extension runtime), [`src/database/repositories`](https://github.com/gopinathmaharaja/agy-lens/tree/master/src/database/repositories) (Usage & history repositories)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Collection &amp; Parsing"]
  node_collector["Antigravity collector"]
  node_transcript["Transcript collection"]
  node_history["History collection"]
  node_quota["Quota collection<br/>[quotaCollector.ts]"]
  node_transcriptparser["Transcript parsing"]
  node_statusparser["Status normalization<br/>[statusParser.ts]"]
  node_modelparser["Model parsing<br/>[modelParser.ts]"]
  node_sync["Sync orchestration<br/>[syncService.ts]"]
end

subgraph group_analysis["Intelligence &amp; Coaching"]
  node_promptanalysis["Prompt scoring<br/>[promptAnalyzer.ts]"]
  node_usageanalysis["Usage analytics<br/>[usageAnalyzer.ts]"]
  node_conversation["Conversation analysis"]
  node_improver["Prompt improvement<br/>[promptImprover.ts]"]
  node_recommend["Model recommendations"]
  node_redactor["Secret redaction<br/>[secretRedactor.ts]"]
end

subgraph group_storage["Local Data"]
  node_database[("SQLite database<br/>[database.ts]")]
  node_schema["Database schema<br/>[schema.ts]"]
  node_repositories["Usage &amp; history repositories"]
end

subgraph group_experience["VS Code Experience"]
  node_extension["Extension runtime<br/>[extension.ts]"]
  node_statusbar["Status bar<br/>[statusBar.ts]"]
  node_dashboard["Dashboard panel<br/>[dashboardPanel.ts]"]
  node_dashboardui["Dashboard interface<br/>[App.tsx]"]
  node_export["Data export<br/>[exportService.ts]"]
end

node_user(("VS Code user"))

node_user -->|"uses"| node_extension
node_extension -->|"starts sync"| node_sync
node_extension -->|"registers"| node_statusbar
node_extension -->|"opens"| node_dashboard
node_extension -->|"registers export"| node_export
node_sync -->|"collects runtime"| node_collector
node_sync -->|"collects transcripts"| node_transcript
node_sync -->|"collects history"| node_history
node_sync -->|"collects quota"| node_quota
node_collector -->|"parses models"| node_modelparser
node_collector -->|"normalizes status"| node_statusparser
node_sync -->|"normalizes snapshot"| node_statusparser
node_sync -->|"scores prompts"| node_promptanalysis
node_transcriptparser -->|"analyzes conversation"| node_conversation
node_promptanalysis -->|"redacts secrets"| node_redactor
node_sync -->|"stores collected records"| node_repositories
node_repositories -->|"queries and writes"| node_database
node_database -->|"initializes from"| node_schema
node_statusbar -->|"formats status"| node_statusparser
node_dashboard -->|"requests live sync"| node_sync
node_dashboard -->|"reads analytics data"| node_repositories
node_dashboard -->|"computes usage views"| node_usageanalysis
node_dashboard -->|"offers prompt improvement"| node_improver
node_dashboard -->|"requests model advice"| node_recommend
node_dashboard -->|"renders dashboard"| node_dashboardui
node_export -->|"reads records"| node_repositories
node_export -->|"redacts exported data"| node_redactor
node_dashboard -.->|"shows conversation insights"| node_conversation

click node_extension "https://github.com/gopinathmaharaja/agy-lens/blob/master/src/extension.ts"
click node_collector "https://github.com/gopinathmaharaja/agy-lens/blob/master/src/collectors/antigravityCollector.ts"
click node_transcript "https://github.com/gopinathmaharaja/agy-lens/blob/master/src/collectors/transcriptCollector.ts"
click node_history "https://github.com/gopinathmaharaja/agy-lens/blob/master/src/collectors/historyCollector.ts"
click node_quota "https://github.com/gopinathmaharaja/agy-lens/blob/master/src/collectors/quotaCollector.ts"
click node_transcriptparser "https://github.com/gopinathmaharaja/agy-lens/blob/master/src/parsers/transcriptParser.ts"
click node_statusparser "https://github.com/gopinathmaharaja/agy-lens/blob/master/src/parsers/statusParser.ts"
click node_modelparser "https://github.com/gopinathmaharaja/agy-lens/blob/master/src/parsers/modelParser.ts"
click node_sync "https://github.com/gopinathmaharaja/agy-lens/blob/master/src/services/syncService.ts"
click node_promptanalysis "https://github.com/gopinathmaharaja/agy-lens/blob/master/src/analytics/promptAnalyzer.ts"
click node_usageanalysis "https://github.com/gopinathmaharaja/agy-lens/blob/master/src/analytics/usageAnalyzer.ts"
click node_conversation "https://github.com/gopinathmaharaja/agy-lens/blob/master/src/analytics/conversationAnalyzer.ts"
click node_improver "https://github.com/gopinathmaharaja/agy-lens/blob/master/src/analytics/promptImprover.ts"
click node_recommend "https://github.com/gopinathmaharaja/agy-lens/blob/master/src/recommendations/modelRecommendation.ts"
click node_database "https://github.com/gopinathmaharaja/agy-lens/blob/master/src/database/database.ts"
click node_schema "https://github.com/gopinathmaharaja/agy-lens/blob/master/src/database/schema.ts"
click node_repositories "https://github.com/gopinathmaharaja/agy-lens/tree/master/src/database/repositories"
click node_statusbar "https://github.com/gopinathmaharaja/agy-lens/blob/master/src/ui/statusBar.ts"
click node_dashboard "https://github.com/gopinathmaharaja/agy-lens/blob/master/src/webview/dashboardPanel.ts"
click node_dashboardui "https://github.com/gopinathmaharaja/agy-lens/blob/master/webview-ui/src/App.tsx"
click node_export "https://github.com/gopinathmaharaja/agy-lens/blob/master/src/services/exportService.ts"
click node_redactor "https://github.com/gopinathmaharaja/agy-lens/blob/master/src/services/secretRedactor.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_collector,node_transcript,node_history,node_quota,node_transcriptparser,node_statusparser,node_modelparser,node_sync,node_user toneBlue
class node_promptanalysis,node_usageanalysis,node_conversation,node_improver,node_recommend,node_redactor toneAmber
class node_database,node_schema,node_repositories toneMint
class node_extension,node_statusbar,node_dashboard,node_dashboardui,node_export toneRose
```

## Components

### Collection & Parsing

- [Antigravity collector](https://github.com/gopinathmaharaja/agy-lens/blob/master/src/collectors/antigravityCollector.ts): `src/collectors/antigravityCollector.ts`
- [Transcript collection](https://github.com/gopinathmaharaja/agy-lens/blob/master/src/collectors/transcriptCollector.ts): `src/collectors/transcriptCollector.ts`
- [History collection](https://github.com/gopinathmaharaja/agy-lens/blob/master/src/collectors/historyCollector.ts): `src/collectors/historyCollector.ts`
- [Quota collection](https://github.com/gopinathmaharaja/agy-lens/blob/master/src/collectors/quotaCollector.ts): `src/collectors/quotaCollector.ts`
- [Transcript parsing](https://github.com/gopinathmaharaja/agy-lens/blob/master/src/parsers/transcriptParser.ts): `src/parsers/transcriptParser.ts`
- [Status normalization](https://github.com/gopinathmaharaja/agy-lens/blob/master/src/parsers/statusParser.ts): `src/parsers/statusParser.ts`
- [Model parsing](https://github.com/gopinathmaharaja/agy-lens/blob/master/src/parsers/modelParser.ts): `src/parsers/modelParser.ts`
- [Sync orchestration](https://github.com/gopinathmaharaja/agy-lens/blob/master/src/services/syncService.ts): `src/services/syncService.ts`

### Intelligence & Coaching

- [Prompt scoring](https://github.com/gopinathmaharaja/agy-lens/blob/master/src/analytics/promptAnalyzer.ts): `src/analytics/promptAnalyzer.ts`
- [Usage analytics](https://github.com/gopinathmaharaja/agy-lens/blob/master/src/analytics/usageAnalyzer.ts): `src/analytics/usageAnalyzer.ts`
- [Conversation analysis](https://github.com/gopinathmaharaja/agy-lens/blob/master/src/analytics/conversationAnalyzer.ts): `src/analytics/conversationAnalyzer.ts`
- [Prompt improvement](https://github.com/gopinathmaharaja/agy-lens/blob/master/src/analytics/promptImprover.ts): `src/analytics/promptImprover.ts`
- [Model recommendations](https://github.com/gopinathmaharaja/agy-lens/blob/master/src/recommendations/modelRecommendation.ts): `src/recommendations/modelRecommendation.ts`
- [Secret redaction](https://github.com/gopinathmaharaja/agy-lens/blob/master/src/services/secretRedactor.ts): `src/services/secretRedactor.ts`

### Local Data

- [SQLite database](https://github.com/gopinathmaharaja/agy-lens/blob/master/src/database/database.ts): `src/database/database.ts`
- [Database schema](https://github.com/gopinathmaharaja/agy-lens/blob/master/src/database/schema.ts): `src/database/schema.ts`
- [Usage & history repositories](https://github.com/gopinathmaharaja/agy-lens/tree/master/src/database/repositories): `src/database/repositories`

### VS Code Experience

- [Extension runtime](https://github.com/gopinathmaharaja/agy-lens/blob/master/src/extension.ts): `src/extension.ts`
- [Status bar](https://github.com/gopinathmaharaja/agy-lens/blob/master/src/ui/statusBar.ts): `src/ui/statusBar.ts`
- [Dashboard panel](https://github.com/gopinathmaharaja/agy-lens/blob/master/src/webview/dashboardPanel.ts): `src/webview/dashboardPanel.ts`
- [Dashboard interface](https://github.com/gopinathmaharaja/agy-lens/blob/master/webview-ui/src/App.tsx): `webview-ui/src/App.tsx`
- [Data export](https://github.com/gopinathmaharaja/agy-lens/blob/master/src/services/exportService.ts): `src/services/exportService.ts`

### Other components

- **VS Code user**

## Connections

- VS Code user → Extension runtime: uses (evidence: `README.md`)
- Extension runtime → Sync orchestration: starts sync (evidence: `src/extension.ts`)
- Extension runtime → Status bar: registers (evidence: `src/extension.ts`)
- Extension runtime → Dashboard panel: opens (evidence: `src/extension.ts`)
- Extension runtime → Data export: registers export (evidence: `src/extension.ts`)
- Sync orchestration → Antigravity collector: collects runtime (evidence: `src/services/syncService.ts`)
- Sync orchestration → Transcript collection: collects transcripts (evidence: `src/services/syncService.ts`)
- Sync orchestration → History collection: collects history (evidence: `src/services/syncService.ts`)
- Sync orchestration → Quota collection: collects quota (evidence: `src/services/syncService.ts`)
- Antigravity collector → Model parsing: parses models (evidence: `src/collectors/antigravityCollector.ts`)
- Antigravity collector → Status normalization: normalizes status (evidence: `src/collectors/antigravityCollector.ts`)
- Sync orchestration → Status normalization: normalizes snapshot (evidence: `src/services/syncService.ts`)
- Sync orchestration → Prompt scoring: scores prompts (evidence: `src/services/syncService.ts`)
- Transcript parsing → Conversation analysis: analyzes conversation (evidence: `src/parsers/transcriptParser.ts`)
- Prompt scoring → Secret redaction: redacts secrets (evidence: `src/analytics/promptAnalyzer.ts`)
- Sync orchestration → Usage & history repositories: stores collected records (evidence: `src/services/syncService.ts`)
- Usage & history repositories → SQLite database: queries and writes (evidence: `src/database/repositories/sessionRepository.ts`)
- SQLite database → Database schema: initializes from (evidence: `src/database/database.ts`)
- Status bar → Status normalization: formats status (evidence: `src/ui/statusBar.ts`)
- Dashboard panel → Sync orchestration: requests live sync (evidence: `src/webview/dashboardPanel.ts`)
- Dashboard panel → Usage & history repositories: reads analytics data (evidence: `src/webview/dashboardPanel.ts`)
- Dashboard panel → Usage analytics: computes usage views (evidence: `src/webview/dashboardPanel.ts`)
- Dashboard panel → Prompt improvement: offers prompt improvement (evidence: `src/webview/dashboardPanel.ts`)
- Dashboard panel → Model recommendations: requests model advice (evidence: `src/webview/dashboardPanel.ts`)
- Dashboard panel → Dashboard interface: renders dashboard (evidence: `README.md`)
- Data export → Usage & history repositories: reads records (evidence: `src/services/exportService.ts`)
- Data export → Secret redaction: redacts exported data (evidence: `src/services/exportService.ts`)
- Dashboard panel → Conversation analysis: shows conversation insights
