Security framework for AI agents

Open-source middleware that detects and defends against AI Agent Traps. Scan inputs, RAG chunks, and outputs before they reach your LLM.

$ npm install @stylusnexus/agentarmor

What it detects

Shipped

Content Injection

Hidden HTML, metadata injection, dynamic cloaking, syntactic masking

Shipped

Behavioural Control

Jailbreak patterns, data exfiltration, unauthorized sub-agent spawning

Shipped

Cognitive State

RAG poisoning, memory poisoning, contextual learning manipulation

Shipped

Semantic Manipulation

Biased framing, oversight evasion, persona hyperstition

Shipped

Encoded Payloads

Instructions written in base64, hex or rot13. They are decoded and rescanned, and reported only when the decoded text is itself an attack, so images, JWTs and hashes stay clean

Shipped

ASCII Smuggling

Instructions re-encoded into invisible Unicode so they render as nothing to a reviewer but are still read by the model — detected and stripped

Shipped

Credential Exposure

Leaked API keys, tokens, private keys, and connection strings in ingested content — redacted in evidence so a scan never leaks what it finds

Shipped

Dependency Substitution

Package installs that skip the trusted registry: custom index flags and config commands, installs from a raw URL, and a resolver redirected to a proxy (strict only)

Shipped

Tool-Call Tampering

A download piped into a shell, a shell run on a downloaded script, or decoded text run by a shell, inside the command of a tool call. The same line as plain text is not flagged: install guides write it too

Shipped

Response Anomaly

Scores commands and tool call arguments by a download that is run (inside a tool call), secrets sent out, layered encoding, credentials in arguments and string entropy. One signal reports at strict, two or more at balanced

Shipped

Multi-turn / Session

Cross-turn split-payload detection via scanSession — instructions chopped across conversation turns

Shipped

ML Classifier

DeBERTa-v3 multi-label model via ONNX. Optional async detection alongside regex patterns.

Planned

Systemic + HITL

Congestion, cascades, collusion, approval fatigue, social engineering

Quick start

import { AgentArmor } from '@stylusnexus/agentarmor';

const armor = new AgentArmor();

// Scan any text before it reaches your LLM
const result = armor.scanSync(userInput);

if (result.threats.length > 0) {
  console.log('Threats detected:', result.threats);
  const safe = armor.sanitize(userInput, result);
}

// Filter RAG chunks before context assembly
const clean = armor.scanRAGChunksSync(chunks)
  .filter(r => r.threats.length === 0);

Eval results (v0.6.0 patterns)

StrictnessDetection RateFalse Positive Rate
Permissive82.1%0.0%
Balanced91.0%0.0%
Strict91.0%0.0%

105 curated samples (67 adversarial, 38 benign) from WASP, HackAPrompt, Greshake et al., and 2025-2026 real-world incidents.

Includes 10 samples from real-world attacks (MCP poisoning, RAG saturation, supply chain injection) that regex does not yet catch, measuring the gap the ML classifier closes. On the original 49 adversarial samples, regex detection is 100% at balanced.