System Architecture
Panguard AI is a TypeScript monorepo with 13 packages organized into three deployment layers. Every component — from the CLI on your laptop to the Threat Cloud in the data center — shares the same@panguard-ai/core foundation.
Three Deployment Layers
- Endpoint Layer
- Manager Layer
- Cloud Layer
The Guard agent and CLI tools run directly on the protected machine. This is where security events are detected, analyzed by Layer 1 and Layer 2 AI, and responded to in real time.Key components:
- Guard agent (continuous monitoring)
- Scan engine (on-demand audits)
- Chat notifications (Telegram, Slack, Email, LINE, Webhook)
- Trap honeypots (8 decoy service types)
- Report generator (PDF, JSON)
- Local AI via Ollama (Layer 2)
13-Package Monorepo
The codebase is organized as a pnpm workspace monorepo. Each package has a single responsibility:| Package | Layer | Purpose |
|---|---|---|
@panguard-ai/core | Shared | Rule engine, monitors, AI providers, i18n, encryption |
@panguard-ai/panguard | Endpoint | CLI entry point (panguard command) |
@panguard-ai/panguard-guard | Endpoint | Real-time protection agent (5-stage AI pipeline) |
@panguard-ai/panguard-scan | Endpoint | Security scanner and risk scoring |
@panguard-ai/panguard-chat | Endpoint | Notification system (5 channels, 3 role formats) |
@panguard-ai/panguard-trap | Endpoint | Honeypot system (8 service types) |
@panguard-ai/panguard-report | Endpoint | Compliance report generation (TCSA, ISO 27001, SOC 2) |
@panguard-ai/panguard-auth | Shared | OAuth flow, session management, tier gating |
@panguard-ai/panguard-manager | Manager | Fleet orchestration and agent registration |
@panguard-ai/threat-cloud | Cloud | Collective intelligence API server |
@panguard-ai/panguard-web | Cloud | Web dashboard (Next.js) |
@panguard-ai/admin | Cloud | Admin panel for Threat Cloud and user management |
@panguard-ai/website | Cloud | Marketing website (panguard.ai) |
@panguard-ai/core — Shared Foundation
Thecore package is the foundation that every other package depends on. It provides:
Rule Engine
Rule Engine
- Sigma rule parser and evaluator (boolean logic, aggregation, modifiers, wildcards)
- YARA scanner with native engine support and regex fallback
- 3000+ bundled Sigma rules, custom rule loading
Monitors
Monitors
4 system monitors that collect security-relevant events:
- Log Monitor — System log parsing (syslog, journald, Windows Event Log)
- Network Monitor — Connection tracking, port scanning, DNS queries
- Process Monitor — Process creation, termination, resource usage
- File Monitor — File system changes, permission modifications, new executables
AI Providers
AI Providers
- FunnelRouter for Layer 2/3 cascading
- Ollama adapter (local AI)
- Claude and OpenAI adapters (cloud AI)
- Provider auto-detection at startup
- AES-256-GCM encrypted key storage (
~/.panguard/llm.enc)
Internationalization (i18n)
Internationalization (i18n)
- English and Traditional Chinese
- All CLI output, reports, and notifications are fully localized
- Language selection via
panguard initor--langflag
System Reconnaissance
System Reconnaissance
- OS detection (macOS, Linux, Windows)
- Network interface enumeration
- Running service inventory
- Security tool detection (antivirus, EDR, IDS)
- Hardware identifier collection for encryption key derivation
Tech Stack
| Technology | Version | Purpose |
|---|---|---|
| TypeScript | 5.7 | Primary language across all packages |
| Node.js | 22 | Runtime |
| pnpm | 9+ | Workspace-aware package manager |
| Vitest | Latest | Unit and integration testing |
| esbuild | Latest | Fast bundling for CLI distribution |
| better-sqlite3 | Latest | Embedded database for Threat Cloud and Guard state |
| Next.js | 14 | Web dashboard and marketing website |
Cross-Platform Support
Panguard runs on all three major operating systems:| Platform | Guard | Scan | Trap | Manager |
|---|---|---|---|---|
| macOS (ARM64, x64) | Yes | Yes | Yes | Yes |
| Linux (x64, ARM64) | Yes | Yes | Yes | Yes |
| Windows (x64) | Yes | Yes | Yes | Yes |
core:
- Firewall: macOS
pfctl, Linuxiptables/nftables, Windowsnetsh - Service management: macOS
launchd, Linuxsystemd, Windows Services - Log sources: macOS unified log, Linux
journald/syslog, Windows Event Log
Data Flow
A typical security event flows through the system as follows:Event detected
A monitor in
core (process, network, file, or log) detects a security-relevant event on the endpoint.Layer 1 evaluation
The Sigma/YARA rule engine evaluates the event in under 1ms. If a rule matches, the event is classified and a response is triggered immediately.
AI escalation (if needed)
Unmatched events are forwarded to Layer 2 (local Ollama) or Layer 3 (Cloud AI) for deeper analysis via the FunnelRouter.
Response execution
Based on classification and confidence, the auto-response engine takes action: block IP, quarantine file, terminate process, or notify only.
Reporting and notification
Chat sends a notification via the configured channel. The event is logged for Guard status, security score updates, and compliance reports.