Intelligence & Risk Alerts
Relevant source files
The following files were used as context for generating this wiki page:
The Intelligence & Risk Alerts system in Comply-Quick provides proactive monitoring and automated remediation strategies for web compliance. It is designed to track changes in regulations and website technical stacks, notifying users when compliance scores drop or new risks are detected. This system shifts the platform from a static generation tool to an active monitoring service, ensuring that compliance packages remain current against evolving legal landscapes.
The system is primarily composed of the Compliance Intelligence module for real-time website monitoring and the Autopilot pipeline for automated package regeneration based on regulatory updates. These features are generally gated behind premium tiers, specifically the Pro and Enterprise plans.
Sources: src/app/dashboard/home/IntelligencePanel.tsx:37-41, src/app/dashboard/home/CommandCenterView.tsx:300-305, src/lib/autopilot/pipeline.ts:1-6
Monitoring Architecture
The monitoring system allows users to register URLs for periodic scanning. A background process (typically a weekly cron job) re-scans these URLs to identify new tracking pixels or configuration changes that impact the overall compliance score.
Key Components
| Component | Description |
|---|---|
| Monitor | A record representing a watched URL, tracking its active status and historical compliance scores. |
| Alert | A notification generated when a monitor detects increased risk, categorized by severity (Info, Warning, Critical). |
| Intelligence Panel | The frontend interface for managing monitored sites and interacting with generated alerts. |
| Scanner Pipeline | The underlying execution engine that performs headless renders to detect deep-embedded trackers. |
Sources: src/app/dashboard/home/IntelligencePanel.tsx:7-34, src/lib/scanner/pipeline.ts:65-75
Alert Severity and Types
Alerts are categorized into specific types to determine the automated "Fix It" recommendation:
- new_tracker: Detected when a re-scan identifies tracking technologies not present in the previous snapshot.
- score_drop: Triggered when the compliance score decreases due to configuration changes.
- new_critical: Specifically flags new critical findings that require immediate attention.
- scan_failed: Notifies the user if the site is unreachable or blocking the scanner.
Sources: src/lib/intelligence/pipeline.ts:32-60, src/app/dashboard/home/IntelligencePanel.tsx:28-32
Data Flow: Alert Remediation
When an alert is raised, the system can generate a "Fix It" remediation plan. This plan uses an AI-driven pipeline to provide concrete, plain-language steps for the user.
The diagram shows the decision logic between using an AI-generated plan versus a deterministic fallback based on the availability of the AI service.
Sources: src/lib/intelligence/pipeline.ts:68-87, src/app/dashboard/home/IntelligencePanel.tsx:125-145
Autopilot & Regulatory Alerts
The Autopilot system monitors external regulatory changes (e.g., GDPR or CCPA amendments). When a regulation change is detected, the system automatically builds a Regeneration Proposal.
Regeneration Process
- Snapshot Comparison: The system retrieves the project's current technical inputs (framework, pixels, regions).
- Package Regeneration: A new compliance package is generated using the updated ClauseEngine.
- Diff Analysis: The new package is compared against the stored version to calculate added/removed lines and sections.
- Proposal Generation: A summary is created explaining the impact of the regulatory change to the user.
The sequence diagram illustrates how the system regenerates content and utilizes the AI Analyst to explain technical diffs in plain language.
Sources: src/lib/autopilot/pipeline.ts:80-110, src/app/dashboard/home/CommandCenterView.tsx:50-80
Implementation Details
Intelligence Alert Data Structure
The Alert interface defines the properties used to render and resolve risk notifications.
interface Alert {
id: string;
monitorId: string | null;
type: string;
severity: "info" | "warning" | "critical";
title: string;
body: string;
detail: Record<string, unknown>;
fixRecommendation: string | null;
read: boolean;
resolved: boolean;
createdAt: string;
}
Sources: src/app/dashboard/home/IntelligencePanel.tsx:17-29
AI Recommendation Logic
The buildFixRecommendation function ensures that even if the AI service is offline, users receive actionable advice through the fallbackRecommendation engine.
export async function buildFixRecommendation(input: FixInput, ai: AiClient): Promise<string> {
if (!ai.live) return fallbackRecommendation(input);
try {
const out = await ai.complete({
system: "You are a web compliance analyst. Output a short numbered remediation plan only.",
prompt: buildPrompt(input),
temperature: 0.2,
maxTokens: 220,
});
return out.trim() || fallbackRecommendation(input);
} catch {
return fallbackRecommendation(input);
}
}
Sources: src/lib/intelligence/pipeline.ts:68-87
Summary
The Intelligence & Risk Alert system serves as the proactive layer of the Comply-Quick platform. By combining continuous site monitoring with regulatory tracking via the Autopilot pipeline, it provides users with real-time visibility into their compliance posture. The system's ability to generate automated remediation plans through AI or deterministic fallbacks ensures that users can respond quickly to identified risks, maintaining the integrity of their legal protections.