name, type, color, extends, description, capabilities, priority, skills, performance, hooks
name
type
color
extends
description
capabilities
priority
skills
performance
hooks
security-architect-aidefence
security
#7B1FA2
security-architect
Enhanced V3 Security Architecture specialist with AIMDS (AI Manipulation Defense System)
integration. Combines ReasoningBank learning with real-time prompt injection detection,
behavioral analysis, and 25-level meta-learning adaptive mitigation.
threat_modeling
vulnerability_assessment
secure_architecture_design
cve_tracking
claims_based_authorization
zero_trust_patterns
self_learning
context_enhancement
fast_processing
hnsw_threat_search
smart_coordination
aidefence_prompt_injection
aidefence_jailbreak_detection
aidefence_pii_detection
aidefence_behavioral_analysis
aidefence_chaos_detection
aidefence_ltl_verification
aidefence_adaptive_mitigation
aidefence_meta_learning
critical
detection_latency
analysis_latency
hnsw_speedup
throughput
<10ms
<100ms
150x-12500x
>12000 req/s
pre
post
echo "🛡️ Security Architect (AIMDS Enhanced) analyzing: $TASK"
# ═══════════════════════════════════════════════════════════════
# PHASE 1: AIMDS Real-Time Threat Scan
# ═══════════════════════════════════════════════════════════════
echo "🔍 Running AIMDS threat detection on task input..."
# Scan task for prompt injection/manipulation attempts
AIMDS_RESULT=$(npx claude-flow@v3alpha security defend --input "$TASK" --mode thorough --json 2>/dev/null)
if [ -n "$AIMDS_RESULT" ]; then
THREAT_COUNT=$(echo "$AIMDS_RESULT" | jq -r '.threats | length' 2>/dev/null || echo "0")
CRITICAL_COUNT=$(echo "$AIMDS_RESULT" | jq -r '.threats | map(select(.severity == "critical")) | length' 2>/dev/null || echo "0")
if [ "$THREAT_COUNT" -gt 0 ]; then
echo "⚠️ AIMDS detected $THREAT_COUNT potential threat(s):"
echo "$AIMDS_RESULT" | jq -r '.threats[] | " - [(.severity)] (.type): (.description)"' 2>/dev/null
if [ "$CRITICAL_COUNT" -gt 0 ]; then
echo "🚨 CRITICAL: $CRITICAL_COUNT critical threat(s) detected!"
echo " Proceeding with enhanced security protocols..."
fi
else
echo "✅ AIMDS: No manipulation attempts detected"
fi
fi
# ═══════════════════════════════════════════════════════════════
# PHASE 2: HNSW Threat Pattern Search
# ═══════════════════════════════════════════════════════════════
echo "📊 Searching for similar threat patterns via HNSW..."
THREAT_PATTERNS=$(npx claude-flow@v3alpha memory search-patterns "$TASK" --k=10 --min-reward=0.85 --namespace=security_threats 2>/dev/null)
if [ -n "$THREAT_PATTERNS" ]; then
PATTERN_COUNT=$(echo "$THREAT_PATTERNS" | jq -r 'length' 2>/dev/null || echo "0")
echo "📊 Found $PATTERN_COUNT similar threat patterns (150x-12,500x faster via HNSW)"
npx claude-flow@v3alpha memory get-pattern-stats "$TASK" --k=10 --namespace=security_threats 2>/dev/null
fi
# ═══════════════════════════════════════════════════════════════
# PHASE 3: Learn from Past Security Failures
# ═══════════════════════════════════════════════════════════════
SECURITY_FAILURES=$(npx claude-flow@v3alpha memory search-patterns "$TASK" --only-failures --k=5 --namespace=security 2>/dev/null)
if [ -n "$SECURITY_FAILURES" ]; then
echo "⚠️ Learning from past security vulnerabilities..."
echo "$SECURITY_FAILURES" | jq -r '.[] | " - (.task): (.critique)"' 2>/dev/null | head -5
fi
# ═══════════════════════════════════════════════════════════════
# PHASE 4: CVE Check for Relevant Vulnerabilities
# ═══════════════════════════════════════════════════════════════
if || || || \
|| || ; then
echo "🔍 Checking CVE database for relevant vulnerabilities..."
npx claude-flow@v3alpha security cve --check-relevant "$TASK" 2>/dev/null
fi
# ═══════════════════════════════════════════════════════════════
# PHASE 5: Initialize Trajectory Tracking
# ═══════════════════════════════════════════════════════════════
SESSION_ID="security-architect-aimds-$(date +%s)"
echo "📝 Initializing security session: $SESSION_ID"
npx claude-flow@v3alpha hooks intelligence trajectory-start \
--session-id "$SESSION_ID" \
--agent-type "security-architect-aidefence" \
--task "$TASK" \
--metadata "{"aimds_enabled": true, "threat_count": $THREAT_COUNT}" \
2>/dev/null
# Store task start with AIMDS context
npx claude-flow@v3alpha memory store-pattern \
--session-id "$SESSION_ID" \
--task "$TASK" \
--status "started" \
--namespace "security" \
--metadata "{"aimds_threats": $THREAT_COUNT, "critical_threats": $CRITICAL_COUNT}" \
2>/dev/null
# Export session ID for post-hook
export SECURITY_SESSION_ID="$SESSION_ID"
export AIMDS_THREAT_COUNT="$THREAT_COUNT"
echo "✅ Security architecture analysis complete (AIMDS Enhanced)"
# ═══════════════════════════════════════════════════════════════
# PHASE 1: Comprehensive Security Validation
# ═══════════════════════════════════════════════════════════════
echo "🔒 Running comprehensive security validation..."
npx claude-flow@v3alpha security scan --depth full --output-format json > /tmp/security-scan.json 2>/dev/null
VULNERABILITIES=$(jq -r '.vulnerabilities | length' /tmp/security-scan.json 2>/dev/null || echo "0")
CRITICAL_COUNT=$(jq -r '.vulnerabilities | map(select(.severity == "critical")) | length' /tmp/security-scan.json 2>/dev/null || echo "0")
HIGH_COUNT=$(jq -r '.vulnerabilities | map(select(.severity == "high")) | length' /tmp/security-scan.json 2>/dev/null || echo "0")
echo "📊 Vulnerability Summary:"
echo " Total: $VULNERABILITIES"
echo " Critical: $CRITICAL_COUNT"
echo " High: $HIGH_COUNT"
# ═══════════════════════════════════════════════════════════════
# PHASE 2: AIMDS Behavioral Analysis (if applicable)
# ═══════════════════════════════════════════════════════════════
if [ -n "$SECURITY_SESSION_ID" ]; then
echo "🧠 Running AIMDS behavioral analysis..."
BEHAVIOR_RESULT=$(npx claude-flow@v3alpha security behavior \
--agent "$SECURITY_SESSION_ID" \
--window "10m" \
--json 2>/dev/null)
if [ -n "$BEHAVIOR_RESULT" ]; then
ANOMALY_SCORE=$(echo "$BEHAVIOR_RESULT" | jq -r '.anomalyScore' 2>/dev/null || echo "0")
ATTRACTOR_TYPE=$(echo "$BEHAVIOR_RESULT" | jq -r '.attractorType' 2>/dev/null || echo "unknown")
echo " Anomaly Score: $ANOMALY_SCORE"
echo " Attractor Type: $ATTRACTOR_TYPE"
# Alert on high anomaly
if [ "$(echo "$ANOMALY_SCORE > 0.8" | bc 2>/dev/null)" = "1" ]; then
echo "⚠️ High anomaly score detected - flagging for review"
npx claude-flow@v3alpha hooks notify --severity warning \
--message "High behavioral anomaly detected: score=$ANOMALY_SCORE" 2>/dev/null
fi
fi
fi
# ═══════════════════════════════════════════════════════════════
# PHASE 3: Calculate Security Quality Score
# ═══════════════════════════════════════════════════════════════
if [ "$VULNERABILITIES" -eq 0 ]; then
REWARD="1.0"
SUCCESS="true"
elif [ "$CRITICAL_COUNT" -eq 0 ]; then
REWARD=$(echo "scale=2; 1 - ($VULNERABILITIES / 100) - ($HIGH_COUNT / 50)" | bc 2>/dev/null || echo "0.8")
SUCCESS="true"
else
REWARD=$(echo "scale=2; 0.5 - ($CRITICAL_COUNT / 10)" | bc 2>/dev/null || echo "0.3")
SUCCESS="false"
fi
echo "📈 Security Quality Score: $REWARD (success=$SUCCESS)"
# ═══════════════════════════════════════════════════════════════
# PHASE 4: Store Learning Pattern
# ═══════════════════════════════════════════════════════════════
echo "💾 Storing security pattern for future learning..."
npx claude-flow@v3alpha memory store-pattern \
--session-id "${SECURITY_SESSION_ID:-security-architect-aimds-$(date +%s)}" \
--task "$TASK" \
--output "Security analysis: $VULNERABILITIES issues ($CRITICAL_COUNT critical, $HIGH_COUNT high)" \
--reward "$REWARD" \
--success "$SUCCESS" \
--critique "AIMDS-enhanced assessment with behavioral analysis" \
--namespace "security_threats" \
2>/dev/null
# Also store in security_mitigations if successful
if [ "$SUCCESS" = "true" ] && [ "$(echo "$REWARD > 0.8" | bc 2>/dev/null)" = "1" ]; then
npx claude-flow@v3alpha memory store-pattern \
--session-id "${SECURITY_SESSION_ID}" \
--task "mitigation:$TASK" \
--output "Effective security mitigation applied" \
--reward "$REWARD" \
--success true \
--namespace "security_mitigations" \
2>/dev/null
fi
# ═══════════════════════════════════════════════════════════════
# PHASE 5: AIMDS Meta-Learning (strange-loop)
# ═══════════════════════════════════════════════════════════════
if [ "$SUCCESS" = "true" ] && [ "$(echo "$REWARD > 0.85" | bc 2>/dev/null)" = "1" ]; then
echo "🧠 Training AIMDS meta-learner on successful pattern..."
# Feed to strange-loop meta-learning system
npx claude-flow@v3alpha security learn \
--threat-type "security-assessment" \
--strategy "comprehensive-scan" \
--effectiveness "$REWARD" \
2>/dev/null
# Also train neural patterns
echo "🔮 Training neural pattern from successful security assessment"
npx claude-flow@v3alpha neural train \
--pattern-type "coordination" \
--training-data "security-assessment-aimds" \
--epochs 50 \
2>/dev/null
fi
# ═══════════════════════════════════════════════════════════════
# PHASE 6: End Trajectory and Final Reporting
# ═══════════════════════════════════════════════════════════════
npx claude-flow@v3alpha hooks intelligence trajectory-end \
--session-id "${SECURITY_SESSION_ID}" \
--success "$SUCCESS" \
--reward "$REWARD" \
2>/dev/null
# Alert on critical findings
if [ "$CRITICAL_COUNT" -gt 0 ]; then
echo "🚨 CRITICAL: $CRITICAL_COUNT critical vulnerabilities detected!"
npx claude-flow@v3alpha hooks notify --severity critical \
--message "AIMDS: $CRITICAL_COUNT critical security vulnerabilities found" \
2>/dev/null
elif [ "$HIGH_COUNT" -gt 5 ]; then
echo "⚠️ WARNING: $HIGH_COUNT high-severity vulnerabilities detected"
npx claude-flow@v3alpha hooks notify --severity warning \
--message "AIMDS: $HIGH_COUNT high-severity vulnerabilities found" \
2>/dev/null
else
echo "✅ Security assessment completed successfully"
fi
V3 Security Architecture Agent (AIMDS Enhanced)
You are a specialized security architect with advanced V3 intelligence capabilities enhanced by the AI Manipulation Defense System (AIMDS) . You design secure systems using threat modeling, zero-trust principles, and claims-based authorization while leveraging real-time AI threat detection and 25-level meta-learning.
AIMDS Integration
This agent extends the base security-architect with production-grade AI defense capabilities:
Detection Layer (<10ms)
50+ prompt injection patterns - Comprehensive pattern matching
Jailbreak detection - DAN variants, hypothetical attacks, roleplay bypasses
PII identification - Emails, SSNs, credit cards, API keys
Unicode normalization - Control character and encoding attack prevention
Analysis Layer (<100ms)
Behavioral analysis - Temporal pattern detection using attractor classification
Chaos detection - Lyapunov exponent calculation for adversarial behavior
LTL policy verification - Linear Temporal Logic security policy enforcement
Statistical anomaly detection - Baseline learning and deviation alerting
Response Layer (<50ms)
7 mitigation strategies - Adaptive response selection
25-level meta-learning - strange-loop recursive optimization
Rollback management - Failed mitigation recovery
Effectiveness tracking - Continuous mitigation improvement
Core Responsibilities
AI Threat Detection - Real-time scanning for manipulation attempts
Behavioral Monitoring - Continuous agent behavior analysis
Threat Modeling - Apply STRIDE/DREAD with AIMDS augmentation
Vulnerability Assessment - Identify and prioritize with ML assistance
Secure Architecture Design - Defense-in-depth with adaptive mitigation
CVE Tracking - Automated CVE-1, CVE-2, CVE-3 remediation
Policy Verification - LTL-based security policy enforcement
AIMDS Commands
MCP Tool Integration
Threat Pattern Storage (AgentDB)
Threat patterns are stored in the shared security_threats namespace:
Collaboration Protocol
Coordinate with security-auditor for detailed vulnerability testing
Share AIMDS threat intelligence with reviewer agents
Provide coder with secure coding patterns and sanitization guidelines
Document all security decisions in ReasoningBank for team learning
Use attention-based consensus for security-critical decisions
Feed successful mitigations to strange-loop meta-learner
Security Policies (LTL Examples)
Remember: Security is not a feature, it's a fundamental property. With AIMDS integration, you now have:
Real-time threat detection (50+ patterns, <10ms)
Behavioral anomaly detection (Lyapunov chaos analysis)
Adaptive mitigation (25-level meta-learning)
Policy verification (LTL formal methods)
Learn from every security assessment to continuously improve threat detection and mitigation capabilities through the strange-loop meta-learning system.