U_Agentix Compliance Monitor VS Code Extension
Real-time regulatory compliance checking for SEC/FINRA violations
Protect your financial trading platform from legal issues with automated compliance scanning directly in VS Code. Detect violations before they reach production.
Features
Comprehensive Compliance Checking
- SEC Compliance Rules - 8 critical SEC regulations enforced
- FINRA Compliance Rules - 8 FINRA regulations including NIL (Name, Image, Likeness) compliance
- Agent Naming Validation - Prevents use of real investor names (Warren Buffett, Ray Dalio, etc.)
- Disclaimer Requirements - Ensures required disclaimers are present
- Risk Warning Enforcement - Validates risk disclosures in trading content
- Paper Trading Verification - Confirms "no real money" disclosures
- Data Attribution Checks - Ensures proper market data source attribution
Real-Time Scanning
- Automatic Scan on Save - Violations detected immediately when you save files
- Workspace-Wide Scanning - Scan entire project with one command
- Active File Scanning - Quick scan of current file
- Custom File Patterns - Configure which files to scan/exclude
Interactive Violation Management
- VS Code Diagnostics - Violations appear as errors/warnings inline
- Tree View Explorer - Browse violations by severity, category, or file
- Quick Fixes - One-click fixes for common violations
- Ignore Violations - Suppress specific warnings
- Violation History - Track past violations
Professional Reports
- HTML Reports - Beautiful, shareable compliance reports
- JSON Export - Machine-readable compliance data
- CSV Export - Spreadsheet-compatible violation lists
- Markdown Reports - Documentation-friendly format
Status Monitoring
- Status Bar Indicator - Real-time compliance status
- Compliance Dashboard - Visual overview of violations
- Deployment Blocking - Prevent deployments when critical violations exist
Custom Rules
- customRulesPath - Load your own pattern-based rules from a local JSON file, in addition to the built-in SEC/FINRA rules
Installation
Requirements
- VS Code 1.60.0 or higher
- Node.js 16.x or higher
- U_Agentix project workspace
Quick Install
Install Dependencies
cd /Users/haymanhymanb.t./Desktop/U_Agentix/u-agentix-compliance-monitor-extension
npm install
Build Extension
npm run build
Package Extension
npm run package:vsix
Install in VS Code
- Open VS Code
- Go to Extensions (Cmd+Shift+X)
- Click "..." menu → "Install from VSIX"
- Select
u-agentix-compliance-monitor-1.0.0.vsix
Verify Installation
- Look for shield icon in activity bar (left sidebar)
- Status bar should show "Compliant" or violation count
Quick Start
1. Scan Your Workspace
Cmd+Shift+P → Compliance Monitor: Scan Workspace for Compliance Violations
The extension will:
- Scan all code files (
.ts, .tsx, .js, .jsx)
- Scan documentation (
.md, .html)
- Check for SEC/FINRA violations
- Display results in tree view
- Show inline diagnostics
2. Review Violations
Open the Compliance Monitor sidebar (shield icon):
- Compliance Status - See all violations grouped by severity
- Violation History - Track past issues
- Active Rules - View which rules are enabled
3. Fix Violations
Option A: Quick Fix
- Click on violation in tree view
- Click wrench icon for quick fix
- Review and apply suggested change
Option B: Manual Fix
- Click violation to open file at location
- Read suggestion in diagnostic tooltip
- Modify code to comply
4. Generate Report
Cmd+Shift+P → Compliance Monitor: Generate Compliance Report
View beautiful HTML report with:
- Summary statistics
- Violations by severity
- Detailed violation information
- Remediation suggestions
Compliance Rules
SEC Rules (8 Rules)
SEC-001: No Guaranteed Returns (CRITICAL)
Violation:
const message = "Guaranteed 10% returns!";
Fix:
const message = "Historical average returns have been approximately 10%. Past performance does not guarantee future results.";
SEC-002: Investment Advice Disclaimer (HIGH)
Violation:
function recommendStock() {
return "We recommend buying this stock";
}
Fix:
/**
* Educational content - not investment advice.
* For informational purposes only.
*/
function recommendStock() {
return "Example stock for educational purposes";
}
SEC-003: No Unregistered Investment Advisors (CRITICAL)
Violation:
const claim = "We are registered investment advisors";
Fix:
const claim = "We provide educational content only. We are not investment advisors.";
SEC-004: Risk Disclosure Required (HIGH)
Violation:
function executeTrade() {
// Execute trade
}
Fix:
/**
* Trading involves substantial risk of loss.
* May not be suitable for all investors.
*/
function executeTrade() {
// Execute trade
}
SEC-005: No False or Misleading Statements (CRITICAL)
Violation:
const claim = "100% win rate, never lose!";
Fix:
const disclaimer = "Past performance based on historical backtesting. No strategy guarantees profits.";
Violation:
const claim = "Best performing strategy ever!";
Fix:
const claim = "Strategy achieved 15% returns in 2023 backtest. Past performance does not guarantee future results.";
Violation:
const prediction = "This stock will gain 20% next month";
Fix:
const analysis = "Historical trend analysis suggests potential upside, but future performance cannot be predicted.";
SEC-008: Paper Trading Only Disclosure (CRITICAL)
Violation:
function depositFunds(amount) {
return "Deposit real money";
}
Fix:
/**
* PAPER TRADING ONLY - NO REAL MONEY
* This platform uses simulated trading for educational purposes.
*/
function depositFunds(amount) {
return "Deposit virtual money (paper trading)";
}
FINRA Rules (8 Rules)
FINRA-001: No Real Investor Names (CRITICAL)
Violation:
const agent = {
name: "Warren Buffett AI", // ❌ ILLEGAL
strategy: "value investing"
};
Fix:
const agent = {
name: "Value Oracle AI", // ✅ LEGAL - Archetype name
strategy: "value investing"
};
Forbidden Names:
- Warren Buffett, Benjamin Graham, Peter Lynch
- Charlie Munger, Ray Dalio, George Soros
- Jim Simons, Cathie Wood, Elon Musk
- Bill Ackman, Carl Icahn, John Templeton
- Jack Bogle, Michael Burry, Howard Marks
- Seth Klarman, Stanley Druckenmiller
- Paul Tudor Jones, David Tepper, Ken Griffin
- Chamath Palihapitiya, Philip Fisher
- Any other real investor name
Approved Archetype Names:
- Value Oracle AI, Growth Scout AI
- Momentum Seeker AI, Contrarian Prophet AI
- Quant Master AI, Fundamental Sage AI
- Macro Strategist AI, Dividend Hunter AI
FINRA-002: Suitability Disclosure (HIGH)
Violation:
const recommendation = "We recommend this investment for you";
Fix:
const recommendation = "Example investment strategy for educational purposes. May not be suitable for all investors. Consult a financial advisor.";
FINRA-003: No Omission of Material Facts (HIGH)
Violation:
const claim = "Zero downside, no risk!";
Fix:
const disclaimer = "All investments carry risk of loss. Consider your risk tolerance and investment objectives.";
FINRA-004: Fair and Balanced Communication (MEDIUM)
Violation:
const promotion = "Amazing! Incredible! Unbelievable! Revolutionary!";
// (No risk disclosure)
Fix:
const promotion = "Educational trading platform with innovative features.";
const disclaimer = "Trading involves risk of loss. Not suitable for all investors.";
FINRA-005: No Exaggerated Claims (HIGH)
Violation:
const claim = "Unlimited profits with our foolproof strategy!";
Fix:
const description = "Strategy designed for educational purposes. All strategies carry risk. Past performance does not guarantee future results.";
FINRA-006: Content Must Be Approved (MEDIUM)
Applies to: Marketing/educational content files
Violation:
# New Trading Strategy
Amazing returns with our new approach!
Fix:
# New Trading Strategy
Educational content - for learning purposes only.
[Compliance approved: 2025-01-15]
FINRA-007: Data Attribution Required (MEDIUM)
Violation:
const data = getMarketData(); // No attribution
Fix:
/**
* Market data provided by [Source Name]
* Used under license for educational purposes
*/
const data = getMarketData();
FINRA-008: Educational Content Labeling (MEDIUM)
Violation:
# Trading Tutorial
Learn to trade stocks...
Fix:
# Trading Tutorial
**Educational Content - For Learning Purposes Only**
This is educational content only, not investment advice...
Usage Examples
Example 1: Compliant Agent Definition
/**
* Compliant Agent - Value Investing Strategy
*
* DISCLAIMER: This is for educational purposes only and is not investment advice.
* Trading involves substantial risk of loss and may not be suitable for all investors.
* This platform uses paper trading only - no real money is involved.
*/
export interface TradingAgent {
// ✅ LEGAL - Archetype name
name: 'Value Oracle AI';
// ✅ Can reference strategy and philosophy
strategy: 'Value investing principles';
philosophy: 'Focus on intrinsic value and margin of safety';
// ✅ Can use historical research data
winRate: 0.65; // Based on backtesting
// ✅ Proper disclaimers
disclaimer: 'Past performance does not guarantee future results. Educational purposes only.';
}
Example 2: Compliant Educational Content
# Trading Fundamentals Course
**EDUCATIONAL CONTENT - FOR LEARNING PURPOSES ONLY**
## Important Disclaimers
⚠️ **Risk Warning:** Trading involves substantial risk of loss and may not be suitable for all investors.
📖 **Not Investment Advice:** This content is for educational purposes only and does not constitute investment advice. Consult a licensed financial advisor before making investment decisions.
💰 **Paper Trading Only:** This platform uses simulated trading with virtual money. No real funds are involved.
## Lesson Content
Learn fundamental analysis techniques used by professional investors...
---
**Data Sources:** Market data provided by [Source]. Used under license for educational purposes.
**Compliance Approved:** [Date] | Educational Content
Example 3: Compliant Trading Function
/**
* Execute Paper Trade (Educational Simulation)
*
* DISCLAIMER:
* - This executes simulated trades only (no real money)
* - For educational purposes only
* - Trading involves substantial risk of loss
* - Not investment advice
*/
export async function executePaperTrade(
symbol: string,
quantity: number
): Promise<TradeResult> {
// Validate inputs
if (!symbol || quantity <= 0) {
throw new Error('Invalid trade parameters');
}
// Execute simulated trade
const result = await paperTradingEngine.execute({
symbol,
quantity,
type: 'SIMULATED', // Clearly marked as simulation
disclaimer: 'Paper trading only - no real money'
});
// Log for compliance audit
await complianceLogger.log({
action: 'PAPER_TRADE_EXECUTED',
details: result,
timestamp: Date.now()
});
return result;
}
Configuration
Extension Settings
Open VS Code Settings → Extensions → Compliance Monitor:
{
// Enable/disable specific rule categories
"complianceMonitor.enableSECRules": true,
"complianceMonitor.enableFINRARules": true,
"complianceMonitor.enableAgentNamingRules": true,
"complianceMonitor.enableDisclaimerRules": true,
"complianceMonitor.enableRiskWarningRules": true,
// Scanning behavior
"complianceMonitor.autoScanOnSave": true,
"complianceMonitor.scanOnOpen": false,
"complianceMonitor.showInlineWarnings": true,
// Severity levels to check
"complianceMonitor.severityLevels": ["critical", "high", "medium", "low"],
// Files to exclude from scanning
"complianceMonitor.excludePatterns": [
"**/node_modules/**",
"**/dist/**",
"**/build/**",
"**/.git/**"
],
// Deployment protection (queryable via ComplianceProvider.canDeploy() —
// not wired to any actual deploy pipeline by this extension itself)
"complianceMonitor.blockNonCompliantDeployments": true
}
Custom Rules
Create compliance-rules.json in your workspace. Custom rules are pattern-only (no custom check functions — JSON can't carry a JS function), and are merged with the built-in SEC/FINRA rules on every scan:
{
"rules": [
{
"id": "CUSTOM-001",
"name": "Company Specific Rule",
"category": "SEC",
"severity": "high",
"description": "Custom compliance requirement",
"pattern": "pattern-to-match",
"flags": "gi"
}
]
}
(A bare JSON array of rule objects, with no "rules" wrapper, also works.) category must be one of the values in RuleCategory (SEC, FINRA, Agent Naming, Disclaimer, Risk Warning, License, Data Attribution, Paper Trading Only) and severity one of critical/high/medium/low — invalid values fall back to SEC/medium with a warning. Set the path in settings:
{
"complianceMonitor.customRulesPath": "./compliance-rules.json"
}
Commands
Access via Command Palette (Cmd+Shift+P):
| Command |
Description |
Compliance Monitor: Scan Workspace |
Scan all files in workspace |
Compliance Monitor: Scan Active File |
Scan currently open file |
Compliance Monitor: Generate Report |
Create HTML compliance report |
Compliance Monitor: Open Dashboard |
View compliance dashboard |
Compliance Monitor: Export Report |
Export report (HTML/JSON/CSV/MD) |
Compliance Monitor: Clear All Violations |
Reset violation list |
Compliance Monitor: Configure Rules |
Open settings |
Keyboard Shortcuts
No default shortcuts. Add your own in VS Code Keyboard Shortcuts:
{
"key": "cmd+shift+c",
"command": "complianceMonitor.scanWorkspace"
},
{
"key": "cmd+shift+r",
"command": "complianceMonitor.generateReport"
}
Violation Severity Levels
| Severity |
Icon |
Color |
Blocking |
Description |
| Critical |
❌ |
Red |
Yes |
Legal liability, must fix immediately |
| High |
⚠️ |
Orange |
No |
Serious issue, fix before deployment |
| Medium |
ℹ️ |
Yellow |
No |
Important, should fix soon |
| Low |
💡 |
Blue |
No |
Best practice, fix when convenient |
Troubleshooting
Extension not activating
Issue: Extension doesn't load after installation
Solution:
- Check VS Code version:
code --version (must be 1.60.0+)
- Reload VS Code:
Cmd+Shift+P → Developer: Reload Window
- Check Output panel: View → Output → "Compliance Monitor"
No violations showing
Issue: Scan completes but tree view is empty
Solution:
- Check that rules are enabled in settings
- Verify file patterns are not excluding your files
- Run
Compliance Monitor: Refresh Violations
False positives
Issue: Getting violations for compliant code
Solution:
- Review the specific rule in this README
- Add proper disclaimers/comments
- Use "Ignore This Violation" if truly compliant
Scan is slow
Issue: Workspace scan takes too long
Solution:
- Add exclude patterns for large directories
- Increase excluded folders:
node_modules, dist, etc.
- Scan specific folders instead of entire workspace
Development
Build from Source
# Install dependencies
npm install
# Build
npm run compile
# Watch mode (auto-rebuild)
npm run watch
# Run tests
npm test
# Generate coverage
npm run test:coverage
# Lint code
npm run lint
# Format code
npm run format
# Package for distribution
npm run package:vsix
Project Structure
u-agentix-compliance-monitor-extension/
├── src/
│ ├── extension.ts # Main entry point
│ ├── providers/
│ │ ├── complianceProvider.ts # Main compliance service
│ │ ├── diagnosticProvider.ts # VS Code diagnostics
│ │ └── violationTreeProvider.ts # Tree view provider
│ ├── scanners/
│ │ ├── codeScanner.ts # Code file scanner
│ │ └── documentScanner.ts # Documentation scanner
│ ├── rules/
│ │ ├── secRules.ts # SEC compliance rules
│ │ └── finraRules.ts # FINRA compliance rules
│ ├── utils/
│ │ └── reportGenerator.ts # Report generation
│ └── types/
│ └── compliance.ts # TypeScript types
├── test/
│ └── extension.test.ts # Test suite (15+ tests)
├── package.json # Extension manifest
├── tsconfig.json # TypeScript config
├── webpack.config.js # Build config
└── README.md # This file
Testing
Running Tests
# All tests
npm test
# Watch mode
npm run test:watch
# With coverage
npm run test:coverage
Test Coverage
- 17 comprehensive tests covering:
- SEC rules (8 rules, 5 tests)
- FINRA rules (8 rules, 6 tests)
- Code scanning (2 tests)
- Document scanning (3 tests)
- Report generation (4 tests)
- Integration tests (1 test)
Writing Tests
import { CodeScanner } from '../src/scanners/codeScanner';
import { getEnabledSECRules } from '../src/rules/secRules';
describe('My Test', () => {
it('should detect violation', () => {
const scanner = new CodeScanner(getEnabledSECRules());
const violations = scanner.scanContent('guaranteed returns', 'test.ts');
assert.ok(violations.length > 0);
});
});
Best Practices
1. Always Use Archetype Names
❌ NEVER:
{ name: "Warren Buffett AI" }
✅ ALWAYS:
{ name: "Value Oracle AI" }
2. Include All Required Disclaimers
Every trading/investment file should include:
- "Not investment advice"
- "Trading involves risk"
- "Paper trading only"
For every promotional claim, include:
- Risk disclosure
- Performance disclaimer
- Suitability warning
4. Run Compliance Scan Before:
- Commits
- Pull requests
- Deployments
- Production releases
5. Review Reports Weekly
Generate and review compliance reports regularly to:
- Track progress
- Identify patterns
- Ensure ongoing compliance
Support
Documentation
Getting Help
License
Proprietary License — All Rights Reserved. See LICENSE file for details.
Acknowledgments
Changelog
Version 1.0.0 (2025-01-18)
Initial Release
✅ Features:
- 8 SEC compliance rules
- 8 FINRA compliance rules
- Real-time scanning
- VS Code diagnostics integration
- Tree view violation explorer
- HTML/JSON/CSV/Markdown reports
- Quick fixes for common violations
- Status bar monitoring
- Workspace-wide scanning
- Custom rules loaded from a local JSON file
✅ Testing:
- 17 comprehensive tests
- 100% rule coverage
- Integration tests
✅ Documentation:
- Complete README
- Rule explanations with examples
- Configuration guide
- Troubleshooting guide
Version: 1.0.0
Last Updated: January 18, 2025
Status: Production Ready
Compliance: SEC, FINRA, NIL
Made with ❤️ by the U_Agentix Spec Team
Protect your platform. Stay compliant. Build with confidence.