🛡️ Copilot Sentinel v2
AI-powered code review, pattern detection, and auto-context for GitHub Copilot
Your codebase has a story. Sentinel reads it — so Copilot doesn't have to waste premium requests figuring it out.
What is Copilot Sentinel?
Copilot Sentinel is a VS Code extension that sits between your project and GitHub Copilot. It does two things:
- Keeps Copilot informed — auto-generates and maintains
.github/copilot-instructions.md so Copilot already knows your tech stack, architecture, and conventions before you ask anything.
- Runs local agents — code review, duplicate detection, project analysis, and context enrichment — all without burning a single premium request.
Why You Need This
GitHub Copilot Pro gives you 300 premium requests/month. Without Sentinel:
| What happens |
Requests wasted |
| Copilot re-scans your project every new chat |
~1 each time |
| You ask "add a new endpoint" and Copilot searches your entire codebase |
~1-2 |
| Copilot suggests patterns that don't match your existing code |
Time wasted + another request to fix |
| You ask Copilot to review your code |
~1-2 per file |
| You ask "are there any circular dependencies?" |
~2-3 (deep analysis) |
Sentinel does all of this locally, for free, automatically.
|
Without Sentinel |
With Sentinel |
| Context rebuilding |
3-5 requests/day wasted |
0 wasted |
| Code review |
1-2 requests per file |
Free (local agent) |
| Pattern detection |
2-3 requests per ask |
Free (local agent) |
| Project analysis |
2-3 requests per ask |
Free (local agent) |
| Effective monthly quota |
~150-180 usable |
Full 300 |
Features
🔄 Auto Baseline Sync
Sentinel scans your project and generates .github/copilot-instructions.md — the file Copilot reads automatically. It includes your tech stack, dependencies, folder structure, entry points, and architecture.
- Auto-syncs on save (debounced, configurable)
- Delta-sync — only writes when content actually changes
- Multi-framework — Node.js, Python, Flutter, Rust, Go, Java, PHP, Ruby, C#, Swift
🔍 Code Review Agent
Static analysis across your entire project. Detects:
- Long files and functions
- Deep nesting
- Empty catch blocks
console.log / debug statements
- TODO/FIXME comments
- Magic numbers
any type usage (TypeScript)
- Duplicate imports
- Complex conditions
- Too many function parameters
Each file gets a quality score (0–100) with specific line numbers and fix suggestions.
🔗 Common Pattern Agent
Finds what your codebase has in common with itself:
- Import frequency — which modules are used everywhere
- Duplicate code blocks — exact matches across different files
- Similar file pairs — files with overlapping structure (Jaccard similarity)
- Shared patterns — repeated try-catch, validation, logging, singletons
📊 Project Analyzer Agent
Deep structural analysis:
- Import graph — who imports what
- Circular dependencies — detected and reported
- Orphan files — files never imported by anything
- Coupling scores — most connected files
- Complexity metrics — lines, functions, imports per file
- Architecture layers — auto-detected (controllers, services, models, etc.)
📝 Auto Context Agent
Takes findings from all three agents and enriches your copilot-instructions.md with:
- Detected code conventions
- Most used modules
- Architecture layers
- Circular dependency warnings
- Common patterns
- Quality summary
- AI-specific guidelines
Result: Copilot gets a complete understanding of your project without spending a single request.
💾 Shadow Cache
Save and reuse AI conversations locally:
- Save prompts + responses with tags
- Save selected code from the editor (right-click)
- Search across all cached entries
- Import/export as JSON
- Insert cached snippets at cursor
📈 Token Savings Dashboard
Visual proof of how much Sentinel is saving you:
- Lifetime tokens saved
- Dollar value saved
- Daily/weekly/monthly breakdowns
- Quota recovery gauge
- Per-event breakdown chart
How to Use
Quick Start
- Install Copilot Sentinel from the VS Code marketplace
- Open a project — Sentinel activates automatically and syncs the baseline
- That's it — Copilot now reads your project context from
.github/copilot-instructions.md
Run the Agents
Open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P) and type Sentinel:
| Command |
What it does |
Sentinel: Run All Agents |
Runs Review → Patterns → Analysis → Context in sequence |
Sentinel: Run Code Review Agent |
Reviews all code files for issues |
Sentinel: Detect Common Patterns |
Finds duplicates, shared patterns, similar files |
Sentinel: Analyze Project Structure |
Builds import graph, finds circular deps |
Sentinel: Enrich Copilot Context |
Updates copilot-instructions.md with agent findings |
Sentinel: Agent Dashboard |
Opens interactive dashboard with all results |
Sentinel: Show Agent Results in Output |
Prints formatted results to the Output panel |
View Results
Option 1: Output Channel
After agents run, the Output panel opens automatically with formatted tables:
┌──────────────────────────────────────────────────────────────┐
│ 🔍 CODE REVIEW RESULTS │
├──────────────────────────────────────────────────────────────┤
│ Avg Quality Score : 82.3/100
│ Total Issues : 14
│ ├─ Errors : 2
│ ├─ Warnings : 5
│ Files with Issues:
│ ⚠️ src/scanner.ts (score: 65, 681 lines, 5 issues)
│ 🔴 L 42 [file-length] File is 681 lines (max 300).
│ 💡 Extract related logic into separate files.
└──────────────────────────────────────────────────────────────┘
Option 2: Agent Dashboard
Run Sentinel: Agent Dashboard for a visual interface with tabs:
- Overview — files analyzed, avg score, issues, duplicates, circular deps
- Code Review — per-file scores, issue tables, severity breakdown
- Patterns — shared patterns, import frequency, duplicate blocks, similar files
- Analysis — import graph stats, circular deps, coupled files, complexity table
- Context — detected conventions, generated enrichment preview
Shadow Cache
Sentinel: Save to Shadow Cache — save a prompt + response
Sentinel: Save Selection to Shadow Cache — right-click selected code
Sentinel: Open Shadow Cache — search and browse all entries
Sentinel: Import Shadow Cache — import from a JSON file
Auto Features
| Feature |
Default |
Setting |
| Auto-sync baseline on save |
✅ On |
copilotSentinel.autoSyncOnSave |
| Auto-review on save |
❌ Off |
copilotSentinel.agentAutoReviewOnSave |
| Auto-enrich context |
✅ On |
copilotSentinel.agentAutoContextEnrich |
| Debounce delay |
2000ms |
copilotSentinel.debounceDelay |
Flow Diagram
┌─────────────────────────────────────────────────────────────┐
│ VS Code │
│ │
│ ┌──────────┐ ┌─────────────────────────────────────┐ │
│ │ Your Code │ │ Copilot Sentinel │ │
│ │ │───▶│ │ │
│ └──────────┘ │ ┌─────────────────────────────┐ │ │
│ │ │ │ Baseline Scanner │ │ │
│ │ on save │ │ Detect → Scan → Generate │ │ │
│ │ │ └──────────────┬──────────────┘ │ │
│ │ │ │ │ │
│ │ │ ┌──────────────▼──────────────┐ │ │
│ │ │ │ Agent Suite │ │ │
│ │ │ │ ┌────────┐ ┌────────────┐ │ │ │
│ │ │ │ │ Review │ │ Patterns │ │ │ │
│ │ │ │ └────────┘ └────────────┘ │ │ │
│ │ │ │ ┌────────┐ ┌────────────┐ │ │ │
│ │ │ │ │Analyze │ │Auto Context │ │ │ │
│ │ │ │ └────────┘ └────────────┘ │ │ │
│ │ │ └──────────────┬──────────────┘ │ │
│ ▼ │ ▼ │ │
│ ┌──────────┐ │ ┌─────────────────────────────┐ │ │
│ │ .github/ │◀──│ │ copilot-instructions.md │ │ │
│ │ copilot- │ │ │ ┌─ Tech Stack │ │ │
│ │ instruct- │ │ │ ├─ Architecture │ │ │
│ │ ions.md │ │ │ ├─ Agent Insights │ │ │
│ └──────────┘ │ │ ├─ Conventions │ │ │
│ │ │ │ ├─ Circular Dep Warnings │ │ │
│ │ │ │ └─ AI Guidelines │ │ │
│ ▼ │ └─────────────────────────────┘ │ │
│ GitHub Copilot └─────────────────────────────────────┘ │
│ reads this file │
│ as context │
└─────────────────────────────────────────────────────────────┘
Settings Reference
Baseline Settings
| Setting |
Default |
Description |
copilotSentinel.autoSyncOnSave |
true |
Auto-sync baseline when code files are saved |
copilotSentinel.debounceDelay |
2000 |
Delay (ms) before auto-sync triggers |
copilotSentinel.maxFilesPerCategory |
15 |
Max files listed per architecture category |
copilotSentinel.fileExtensions |
.ts, .js, .py, ... |
File extensions that trigger auto-sync |
copilotSentinel.customScanPatterns |
[] |
Custom glob patterns for additional categories |
copilotSentinel.excludePatterns |
[] |
Additional folders to exclude from scanning |
Agent Settings
| Setting |
Default |
Description |
copilotSentinel.agentAutoReviewOnSave |
false |
Quick code review on every save |
copilotSentinel.agentAutoContextEnrich |
true |
Auto-enrich context on baseline update |
copilotSentinel.agentMaxFileLength |
300 |
Max file lines before warning |
copilotSentinel.agentMaxFunctionLength |
50 |
Max function lines before warning |
copilotSentinel.agentMaxNestingDepth |
4 |
Max nesting depth before warning |
copilotSentinel.agentMaxParameters |
5 |
Max function parameters before warning |
copilotSentinel.agentMinDuplicateLines |
6 |
Min lines to flag as duplicate block |
copilotSentinel.agentSimilarityThreshold |
0.7 |
Threshold for similar file detection (0–1) |
Shadow Cache Settings
| Setting |
Default |
Description |
copilotSentinel.shadowCacheMaxEntries |
500 |
Max cached entries (oldest removed first) |
Supported Languages
| Language |
Config File |
Framework |
| JavaScript / TypeScript |
package.json |
Node.js, React, Vue, Svelte |
| Dart |
pubspec.yaml |
Flutter |
| Python |
requirements.txt, pyproject.toml |
Django, FastAPI, Flask |
| Rust |
Cargo.toml |
— |
| Go |
go.mod |
— |
| Java / Kotlin |
pom.xml, build.gradle |
Spring, Android |
| PHP |
composer.json |
Laravel |
| Ruby |
Gemfile |
Rails |
| C# |
*.csproj |
.NET |
| Swift |
Package.swift |
SwiftUI, UIKit |
All Commands
| Command |
Description |
Sentinel: Sync Project Baseline |
Manually trigger a baseline scan |
Sentinel: Open Baseline File |
Open the generated copilot-instructions.md |
Sentinel: Show Output Log |
Open the Sentinel output channel |
Sentinel: Run All Agents |
Run all 4 agents in sequence |
Sentinel: Run Code Review Agent |
Run code review only |
Sentinel: Detect Common Patterns |
Run pattern detection only |
Sentinel: Analyze Project Structure |
Run project analysis only |
Sentinel: Enrich Copilot Context |
Run context enrichment only |
Sentinel: Agent Dashboard |
Open the agent results dashboard |
Sentinel: Show Agent Results in Output |
Print results to output channel |
Sentinel: Token Savings Dashboard |
Open the savings dashboard |
Sentinel: Open Shadow Cache |
Browse cached AI snippets |
Sentinel: Save to Shadow Cache |
Save a prompt + response |
Sentinel: Save Selection to Shadow Cache |
Save selected code |
Sentinel: Import Shadow Cache |
Import from JSON file |
Privacy
Everything runs locally inside VS Code. No data is sent to any server. The only file written is .github/copilot-instructions.md in your workspace — which GitHub Copilot reads automatically as project context.
License
MIT