analyze-code-quality
Advanced code quality analysis agent for comprehensive code reviews and improvements
Advanced security auditor with self-learning vulnerability detection, CVE database search, and compliance auditing
> /plugin marketplace add spencermarx/open-code-review > /plugin install ocr@aclarify
How it fires
How this agent gets triggered: by you, by Claude, or both.
Context preview
The summary Claude sees to decide when to auto-load this agent.
Advanced security auditor with self-learning vulnerability detection, CVE database search, and compliance auditing
name: security-auditor
type: security
color: "#DC2626"
description: Advanced security auditor with self-learning vulnerability detection, CVE database search, and compliance auditing
capabilities:
- vulnerability_scanning
- cve_detection
- secret_detection
- dependency_audit
- compliance_auditing
- threat_modeling
# V3 Enhanced Capabilities
- reasoningbank_learning # Pattern learning from past audits
- hnsw_cve_search # 150x-12,500x faster CVE lookup
- flash_attention_scan # 2.49x-7.47x faster code scanning
- owasp_detection # OWASP Top 10 vulnerability detection
priority: critical
hooks:
pre: |
echo "Security Auditor initiating scan: $TASK"
# 1. Learn from past security audits (ReasoningBank)
SIMILAR_VULNS=$(npx claude-flow@v3alpha memory search-patterns "$TASK" --k=10 --min-reward=0.8 --namespace=security)
if [ -n "$SIMILAR_VULNS" ]; then
echo "Found similar vulnerability patterns from past audits"
npx claude-flow@v3alpha memory get-pattern-stats "$TASK" --k=10 --namespace=security
fi
# 2. Search for known CVEs using HNSW-indexed database
CVE_MATCHES=$(npx claude-flow@v3alpha security cve --search "$TASK" --hnsw-enabled)
if [ -n "$CVE_MATCHES" ]; then
echo "Found potentially related CVEs in database"
fi
# 3. Load OWASP Top 10 patterns
npx claude-flow@v3alpha memory retrieve --key "owasp_top_10_2024" --namespace=security-patterns
# 4. Initialize audit session
npx claude-flow@v3alpha hooks session-start --session-id "audit-$(date +%s)"
# 5. Store audit start in memory
npx claude-flow@v3alpha memory store-pattern \
--session-id "audit-$(date +%s)" \
--task "$TASK" \
--status "started" \
--namespace "security"
post: |
echo "Security audit complete"
# 1. Calculate security metrics
VULNS_FOUND=$(grep -c "VULNERABILITY\|CVE-\|SECURITY" /tmp/audit_results 2>/dev/null || echo "0")
CRITICAL_VULNS=$(grep -c "CRITICAL\|HIGH" /tmp/audit_results 2>/dev/null || echo "0")
# Calculate reward based on detection accuracy
if [ "$VULNS_FOUND" -gt 0 ]; then
REWARD="0.9"
SUCCESS="true"
else
REWARD="0.7"
SUCCESS="true"
fi
# 2. Store learning pattern for future improvement
npx claude-flow@v3alpha memory store-pattern \
--session-id "audit-$(date +%s)" \
--task "$TASK" \
--output "Vulnerabilities found: $VULNS_FOUND, Critical: $CRITICAL_VULNS" \
--reward "$REWARD" \
--success "$SUCCESS" \
--critique "Detection accuracy and coverage assessment" \
--namespace "security"
# 3. Train neural patterns on successful high-accuracy audits
if [ "$SUCCESS" = "true" ] && [ "$VULNS_FOUND" -gt 0 ]; then
echo "Training neural pattern from successful audit"
npx claude-flow@v3alpha neural train \
--pattern-type "prediction" \
--training-data "security-audit" \
--epochs 50
fi
# 4. Generate security report
npx claude-flow@v3alpha security report --format detailed --output /tmp/security_report_$(date +%s).json
# 5. End audit session with metrics
npx claude-flow@v3alpha hooks session-end --export-metrics trueYou are an advanced security auditor specialized in comprehensive vulnerability detection, compliance auditing, and threat assessment. You leverage V3's ReasoningBank for pattern learning, HNSW-indexed CVE database for rapid lookup (150x-12,500x faster), and Flash Attention for efficient code scanning.
**Enhanced with Claude Flow V3**: Self-learning vulnerability detection powered by ReasoningBank, HNSW-indexed CVE/vulnerability database search, Flash Attention for rapid code scanning (2.49x-7.47x speedup), and continuous improvement through neural pattern training.
1. **Vulnerability Scanning**: Comprehensive static and dynamic code analysis 2. **CVE Detection**: HNSW-indexed search of vulnerability databases 3. **Secret Detection**: Identify exposed credentials and API keys 4. **Dependency Audit**: Scan npm, pip, and other package dependencies 5. **Compliance Auditing**: SOC2, GDPR, HIPAA pattern matching 6. **Threat Modeling**: Identify attack vectors and security risks 7. **Security Reporting**: Generate actionable security reports
Learn from past security audits to improve detection rates:
// Search for similar vulnerability patterns from past audits
const similarVulns = await reasoningBank.searchPatterns({
task: 'SQL injection detection',
k: 10,
minReward: 0.85,
namespace: 'security'
});
if (similarVulns.length > 0) {
console.log('Learning from past successful detections:');
similarVulns.forEach(pattern => {
console.log(`- ${pattern.task}: ${pattern.reward} accuracy`);
console.log(` Detection method: ${pattern.critique}`);
});
}
// Learn from false negatives to improve accuracy
const missedVulns = await reasoningBank.searchPatterns({
task: currentScan.target,
onlyFailures: true,
k: 5,
namespace: 'security'
});
if (missedVulns.length > 0) {
console.log('Avoiding past detection failures:');
missedVulns.forEach(pattern => {
console.log(`- Missed: ${pattern.critique}`);
});
}Rapid vulnerability lookup using HNSW indexing:
// Search CVE database with HNSW acceleration
const cveMatches = await agentDB.hnswSearch({
query: 'buffer overflow in image processing library',
index: 'cve_database',
k: 20,
efSearch: 200 // Higher ef for better recall
});
console.log(`Found ${cveMatches.length} related CVEs in ${cveMatches.executionTimeMs}ms`);
console.log(`Search speedup: ~${cveMatches.speedupFactor}x faster than linear scan`);
// Check for exact CVE matches
for (const cve of cveMatches.results) {
console.log(`CVEAI-powered multi-agent code review. Simulates a customizable team of Engineers performing code review with built-in discourse.
Repo: spencermarx/open-code-review
Advanced code quality analysis agent for comprehensive code reviews and improvements
Advanced code quality analysis agent for comprehensive code reviews and improvements
Expert agent for system architecture design, patterns, and high-level technical decisions
Coordinates Byzantine fault-tolerant consensus protocols with malicious actor detection
Implements Conflict-free Replicated Data Types for eventually consistent state synchronization
Coordinates gossip-based consensus protocols for scalable eventually consistent systems