shieldx/CLAUDE.md
Rene Fichtmueller a3793a1357 feat: ShieldX v0.1.0 — Self-Evolving LLM Prompt Injection Defense
10-layer defense pipeline with kill chain mapping, self-healing,
self-learning, and compliance reporting. Local-first, zero cloud deps.

- 72 detection rules across 7 kill chain phases
- 294 unit tests, 500+ attack corpus samples
- Management dashboard (Next.js 15, 10 pages)
- Automated resistance testing (2x daily, 31 probes)
- MITRE ATLAS, OWASP LLM Top 10, EU AI Act compliance
- Integrations: Next.js middleware, Ollama, n8n
- PostgreSQL 17 + pgvector for persistent learning
2026-03-27 15:07:27 +13:00

1.9 KiB

ShieldX — LLM Prompt Injection Defense System

Project

  • npm: @shieldx/core
  • License: Apache 2.0
  • Stack: TypeScript strict, Node.js 20+, PostgreSQL 17 + pgvector, Vitest
  • Architecture: 10-layer defense pipeline + self-evolution engine
  • Philosophy: Local-first, zero mandatory cloud, self-evolving

Commands

  • npm run build — Build with tsup (CJS + ESM + DTS)
  • npm run dev — Watch mode build
  • npm test — Run tests with vitest
  • npm run test:coverage — Coverage report (target: 80%+)
  • npm run typecheck — Type checking
  • npm run db:migrate — Run database migrations
  • npm run db:seed — Seed initial patterns (500+)
  • npm run benchmark — Performance benchmarks
  • npm run self-test — Red team self-testing

Code Style

  • TypeScript strict mode, no any except explicitly marked with // eslint-disable-next-line
  • Immutable data patterns — return new objects, never mutate
  • All async operations must have proper error handling
  • All public methods must have JSDoc documentation
  • Files < 400 lines, functions < 50 lines
  • No raw input stored in database — always SHA-256 hashed

Architecture

  • 10 defense layers (L0-L10), each independently toggleable
  • Kill chain mapping: Schneier 2026 Promptware Kill Chain (7 phases)
  • Self-evolution: GAN red team, drift detection, active learning, federated sync
  • Compliance: MITRE ATLAS, OWASP LLM Top 10 2025, EU AI Act

Performance Targets

  • L0 (Preprocessing): <0.5ms
  • L1 (Rules): <2ms
  • L2 (Classifier): <10ms
  • Full pipeline (L0-L9): <50ms
  • Embedding scan: <200ms (Ollama local)

Testing

  • Vitest with v8 coverage
  • Attack corpus: 13 JSON files, 500+ patterns each
  • Benchmarks: ASR, latency, PINT, AgentDojo, false-positive rate
  • Coverage target: 80%+ global

Git

  • Gitea: gitea.context-x.org/rene/shieldx
  • Conventional commits: feat, fix, refactor, docs, test, chore, perf
  • No Co-Authored-By headers