Back to .md Directory

LLMTrace Implementation TODO

Tracks 100+ security and infrastructure features for an LLM proxy, each with acceptance criteria anchored to research papers.

May 2, 2026
0 downloads
4 views
ai agent llm rag prompt claude guardrails safety
View source

What this file does

Tracks 100+ security and infrastructure features for an LLM proxy, each with acceptance criteria anchored to research papers.

When to use it

  • Planning a phased rollout of prompt injection defenses
  • Auditing which research-backed detection methods are implemented
  • Coordinating multiple engineering loops with quality gates
  • Validating that feature work meets literature-anchored acceptance criteria

Assumes this stack

RustPythonPyO3SQLiteClickHousePostgreSQL

LLMTrace Implementation TODO

Generated from: docs/FEATURE_ROADMAP.md Updated: 2026-02-15 Methodology: RALPH loops β€” each loop spawns a Claude Code agent with strict quality gates, reviewed by lead engineer before merge.


Status Legend

  • ⬜ Not started
  • πŸ”„ In progress
  • βœ… Done
  • ❌ Blocked

Acceptance Criteria (Literature-Anchored)

These criteria define when a task can be marked βœ…. If any criterion is not met, status must remain πŸ”„ or ⬜.

Input Security (IS): Must implement the specific algorithmic behaviors described in the literature, not heuristic approximations. For IS-001–IS-003, MOF requires token-wise bias detection, debiasing data generation, and retraining with reported over-defense gains in docs/research/injecguard-over-defense-mitigation.md. For IS-006/IS-007, thresholds must be calibrated at 0.1/0.5/1% FPR with TPR reporting per docs/research/security-state-of-art-2026.md. For IS-010/IS-011, WordNet-style synonym expansion and true lemmatization are required, not regex-only stems, per docs/research/dmpi-pmhfe-prompt-injection-detection.md. For IS-024–IS-029, adversarial robustness must include attack-specific defenses and calibration beyond normalization per docs/research/bypassing-llm-guardrails-evasion.md.

DMPI-PMHFE Architecture (DMPI-001–DMPI-006): The fusion pipeline matches the paper's dual-channel design. All 6 deviations resolved: average pooling (DMPI-001), 2 FC layers (DMPI-002), 10 binary heuristic features with paper keyword sets (DMPI-003, DMPI-005), repetition threshold >=3 (DMPI-004), is_* naming convention (DMPI-006). See Loop 12a and docs/research/dmpi-pmhfe-prompt-injection-detection.md for full specification. ML-001 (fusion training) is no longer blocked by DMPI deviations.

Tool/Agent Security (AS): Tool boundary defenses must parse/sanitize with LLM-based extraction and CheckTool-style triggering detection, not heuristic filters, per docs/research/defense-tool-result-parsing.md and docs/research/indirect-injection-firewalls.md. Multi-agent defense requires an explicit coordinator + guard multi-pass architecture (and second opinion path) rather than a single-pass heuristic pipeline, per docs/research/multi-agent-defense-pipeline.md. Pattern enforcement must detect plan compliance and routing by trust level as defined in docs/research/design-patterns-securing-agents.md.

Output Security (OS): HaluGate-style token-level detection requires ModernBERT token classification and NLI explanation layer, not heuristic or sentence-only checks, per docs/research/security-state-of-art-2026.md. Streaming safety must use partial-sequence models and progressive confidence (SCM), not re-running full-text detectors, per docs/research/security-state-of-art-2026.md. CodeShield parity requires Semgrep integration and coverage beyond basic static rules, per docs/research/security-state-of-art-2026.md.

Privacy/Protocol/Multimodal (PR/AS/MM/SA): Membership inference, poisoning, MINJA, and protocol exploit defenses must match the threat models in docs/research/prompt-injections-to-protocol-exploits.md. Multimodal defenses must include OCR and modality-specific detectors as described in the same literature. Policy language and taint/blast-radius controls must align with docs/research/llmtrace-defense-pipeline-design.md.

Evaluation (EV): Benchmarks must implement the named suites with published dataset sizes and result formatting per docs/research/benchmarks-and-tools-landscape.md and docs/research/wasp-web-agent-security-benchmark.md.

Non-Functional Requirements (NFR): Security-critical detections must be deterministic and testable, with clear latency budgets where specified (e.g., HaluGate sentinel 12ms class, token-level detection 76–162ms) from docs/research/security-state-of-art-2026.md. Any ML integration must include reproducible model loading, configuration, and tests demonstrating expected metrics.

Phase 1: Critical / Quick Wins

Loop 1 β€” Unicode Evasion Defenses

Close the 100% ASR emoji smuggling and upside-down text gaps

IDFeatureComplexityStatus
IS-020Emoji normalisation/stripping β€” 100% ASR, zero current defenseLowβœ… a62855b
IS-021Upside-down text mapping β€” 100% jailbreak evasionLowβœ… a62855b
IS-022Unicode tag character stripping (U+E0001–U+E007F)Lowβœ… a62855b
IS-031Diacritics-based evasion defense β€” accent marksLowβœ… a62855b
IS-015Braille encoding evasion defenseLowβœ… a62855b

Loop 2 β€” NotInject Benchmark + 3D Evaluation

Establish over-defense baseline and evaluation framework (current dataset: 210 samples, difficulty split 90/60/60)

IDFeatureComplexityStatus
IS-004NotInject-style over-defense benchmark dataset (339 samples, 3 difficulty levels)Lowβœ…
IS-005Three-dimensional evaluation metrics (benign/malicious/over-defense)Lowβœ… 33b3f55
EV-002NotInject evaluation runner (dataset complete: 339 samples)Lowβœ…
EV-010Paper-table output format for resultsLowβœ… 33b3f55

Loop 3 β€” FPR-Aware Threshold Optimisation

Evaluate at deployment-realistic FPR operating points

IDFeatureComplexityStatus
IS-006FPR-aware threshold optimisation β€” evaluate at 0.1%, 0.5%, 1% FPRMediumβœ… fpr_monitor.rs
IS-007Configurable operating points (high-precision / balanced / high-recall)Lowβœ… (R8)

Loop 4 β€” Canary Token System

Detect system prompt leakage in responses

IDFeatureComplexityStatus
SA-002Canary token injection and leakage detectionLowβœ… 5b43d93

Loop 5 β€” Tool Registry & Classification

Foundation for agent security features

IDFeatureComplexityStatus
AS-008Tool registry with security classification (category, risk score, permissions)Mediumβœ… eae4ca3
AS-015Action-type rate limitingLowβœ… eae4ca3

Loop 6 β€” Context Window Flooding Detection

DoS prevention (OWASP LLM10)

IDFeatureComplexityStatus
IS-017Context window flooding detectionLowβœ… 9997962

Loop R0 β€” Scaffold the Workspace

Create workspace, crates, and baseline repo hygiene

IDFeatureComplexityStatus
RL0-01Initialize Cargo workspace and required cratesMediumβœ…
RL0-02Add root README, .gitignore, rustfmt configLowβœ…
RL0-03Ensure crates compile cleanlyMediumβœ…

Loop R1 β€” Core Types & Traits

Define foundational core types and traits

IDFeatureComplexityStatus
RL1-01Core types: TraceEvent, TraceSpan, TenantId, SecurityFinding, SecuritySeverity, LLMProvider, ProxyConfigMediumβœ…
RL1-02Core traits: StorageBackend (or successors), SecurityAnalyzerMediumβœ…
RL1-03Error types via thiserror, serde on public types, timestamp typesMediumβœ…
RL1-04Serialization roundtrip testsMediumβœ…

Loop R2 β€” SQLite Storage Backend

Implement SQLite storage backend

IDFeatureComplexityStatus
RL2-01Sqlite storage implementation with migrationsMediumβœ…
RL2-02store/query/health_check for tracesMediumβœ…
RL2-03Integration tests with temp DBMediumβœ…

Loop R3 β€” Basic Prompt Injection Detection

Regex-based prompt injection detection

IDFeatureComplexityStatus
RL3-01RegexSecurityAnalyzer request/response scanningMediumβœ…
RL3-02Patterns: system override, role injection, base64, PIIMediumβœ…
RL3-03Comprehensive tests for known attacksMediumβœ…

Loop R4 β€” Transparent Proxy Core

Core proxy flow and async analysis

IDFeatureComplexityStatus
RL4-01HTTP proxy flow (accept, parse, forward, return)Highβœ…
RL4-02Support OpenAI-compatible routesMediumβœ…
RL4-03Async trace capture + security analysisMediumβœ…
RL4-04Circuit breaker and health endpointMediumβœ…
RL4-05YAML config loadingMediumβœ…

Loop R5 β€” Streaming SSE Support

Stream passthrough and token tracking

IDFeatureComplexityStatus
RL5-01Detect streaming requests and forward SSEHighβœ…
RL5-02Incremental token/TTFT trackingHighβœ…
RL5-03Integration tests with mock SSE upstreamMediumβœ…

Loop R5.5 β€” Storage Layer Refactor

Repository pattern split for traces/metadata/cache

IDFeatureComplexityStatus
RL5-501Split storage traits into trace/metadata/cacheHighβœ…
RL5-502Add tenant/config/audit typesMediumβœ…
RL5-503Storage composite + profile factoryMediumβœ…
RL5-504SQLite repos for traces + metadata, in-memory cacheHighβœ…
RL5-505Proxy integration with new storage profile configHighβœ…

Loop R6 β€” Configuration & CLI

CLI and config validation

IDFeatureComplexityStatus
RL6-01Clap CLI with proxy/validate subcommandsMediumβœ…
RL6-02Example config + env var overridesMediumβœ…
RL6-03Structured loggingLowβœ…

Loop R7 β€” Python Bindings

PyO3 bindings and tests

IDFeatureComplexityStatus
RL7-01PyO3 crate setup + Python APIHighβœ…
RL7-02Python tests via maturinMediumβœ…

Loop R8 β€” Integration Test & Polish

End-to-end proxy + docs

IDFeatureComplexityStatus
RL8-01Integration test with proxy + mock upstreamHighβœ…
RL8-02Top-level README, LICENSELowβœ…

Phase 2: Major Features

Loop 7 β€” Tool-Boundary Firewalling

The "minimize & sanitize" approach β€” reported low ASR on paper benchmarks (scope-specific)

IDFeatureComplexityStatus
AS-001Tool-Input Firewall (Minimizer) β€” heuristic minimizer; no LLM-based minimizationHighπŸ”„
AS-002Tool-Output Firewall (Sanitizer) β€” heuristic sanitizer; no LLM-based parsingHighπŸ”„
AS-003Tool context awareness β€” tool context defined but not used in minimizer/sanitizerMediumπŸ”„
AS-004ParseData β€” extract minimal required data from tool outputs (LLM-based parsing not implemented)HighπŸ”„
AS-005Format constraint validation β€” heuristic rules only (no schema-driven parsing)MediumπŸ”„
AS-006CheckTool β€” detect tool-output-triggered tool calls (heuristic only)HighπŸ”„
AS-007Tool output sanitization against injection triggers (heuristic only)HighπŸ”„

Loop 8 β€” Model Ensemble Diversification

Replace single-model reliance with multi-architecture ensemble

IDFeatureComplexityStatus
ML-002InjecGuard model integrationMediumβœ… 10a2369
ML-003Meta Prompt Guard 2 integration (86M + 22M)Mediumβœ… 10a2369
ML-006Multi-model ensemble voting with diverse architectures β€” InjecGuard wired as 3rd detector, majority voting replaces union mergeMediumβœ…
ML-004PIGuard model integrationMediumβœ…
ML-007Model hot-swapping without proxy restartMedium⬜

Loop 9 β€” Action-Selector Pattern Enforcement

Provable security patterns at proxy level

IDFeatureComplexityStatus
AS-010Action-Selector pattern β€” enforce action allowlists at proxy levelMediumβœ… 89ba304
AS-012Context-Minimization β€” strip unnecessary contextMediumβœ… 89ba304
AS-011Plan-then-execute pattern detectionHigh⬜
AS-014Plan compliance monitoring for declared security patternsHigh⬜
AS-013Dual LLM routing for trusted/untrusted dataHigh⬜
AS-016Trust-based routing by data sourceHigh⬜

Loop 10 β€” Multi-Agent Defense Coordination

Coordinator + Guard architecture β€” reported low ASR on paper benchmarks (scope-specific)

IDFeatureComplexityStatus
AS-020Coordinator agent β€” pre-input classification (policy/heuristic pipeline only)HighπŸ”„
AS-021Guard agent β€” post-generation validation (policy/heuristic pipeline only)HighπŸ”„
AS-022Hierarchical coordinator pipeline (safe routing/refusal)High⬜
AS-023Second opinion pass for borderline cases (no true multi-agent LLM pass)MediumπŸ”„
AS-024Policy store β€” centralised security rules (in-memory, not externalized)MediumπŸ”„
AS-025Multi-step action correlation across requestsHighβœ…
AS-026Multi-turn persistence detection for gradual bypass attemptsHighβœ…

Loop 11 β€” MCP Protocol Monitoring

First-mover in protocol-level security

IDFeatureComplexityStatus
AS-030MCP monitoring β€” detect manipulation and server-side attacksHighβœ… mcp_monitor.rs
AS-035Toxic Agent Flow defense β€” GitHub MCP vulnerability (generic MCP scanning only)MediumπŸ”„
AS-036ToolHijacker defense β€” tool selection manipulation (generic MCP scanning only)HighπŸ”„

Loop 12 β€” Advanced Prompt Injection Detection

Synonym expansion, lemmatisation, P2SQL

IDFeatureComplexityStatus
IS-010Synonym expansion for attack patterns (manual synonym regex, not WordNet)MediumπŸ”„
IS-011Lemmatisation before pattern matching (basic stemming, not true lemmatization)LowπŸ”„
IS-012P2SQL injection detection (regex only, no structured SQL parsing)MediumπŸ”„
IS-013Long-context jailbreak detection (position-aware sliding window)High⬜
IS-014Automated jailbreak defense (GPTFuzz-style genetic templates)High⬜
IS-016Multi-turn extraction detection (session-aware probing)HighπŸ”„
IS-040Data format coverage expansion (17 formats)Medium⬜
IS-041Multi-language trigger detectionHigh⬜
IS-018"Important Messages" header attack hardeningLowπŸ”„
IS-050Perplexity-based anomaly detection for GCG-optimized strings in tool outputsMedium⬜
IS-051Adaptive monitoring scope (input-only vs hybrid) to control attack surfaceMedium⬜
IS-052Adversarial string propagation blocking in tool outputs (perplexity threshold)High⬜

Loop 12a β€” DMPI-PMHFE Architecture Alignment

Resolve 6 architectural deviations between codebase and DMPI-PMHFE paper (arXiv 2506.06384). All 6 resolved (DMPI-001, DMPI-002, DMPI-003, DMPI-004, DMPI-005, DMPI-006). Loop 15 (Fusion Training Pipeline) is no longer blocked by DMPI deviations. Reference: docs/research/dmpi-pmhfe-prompt-injection-detection.md

IDFeatureComplexityStatus
DMPI-001Average pooling instead of CLS token β€” Implemented masked_mean_pool() in ml_detector.rs. Added PoolingStrategy enum (Cls/MeanPool), defaulting to MeanPool. BERT and DeBERTa paths both use attention-mask-aware average pooling over all non-padding tokens, matching paper spec. DebertaV2ContextPooler is now optional (only loaded for Cls strategy). Architecture doc: docs/architecture/DMPI_001_AVERAGE_POOLING.md.Medium:white_check_mark:
DMPI-0022 FC layers instead of 3 β€” Removed HIDDEN_2 and fc3; collapsed to fc1(783->256)->ReLU->fc2(256->2)->SoftMax matching paper spec. Input dim changes from 783 to 778 once DMPI-003 is also applied (768 + 10 = 778). Architecture doc: docs/architecture/DMPI_002_TWO_FC_LAYERS.md.Medium:white_check_mark:
DMPI-00310 binary features instead of 15 mixed β€” Replaced 15-dim vector (8 binary + 7 numeric) with 10 binary features matching paper Appendix A. Removed all numeric features. Added keyword-based detection for is_ignore, is_format_manipulation, is_immoral. Reordered to paper spec. Architecture doc: docs/architecture/DMPI_003_TEN_BINARY_FEATURES.md.High:white_check_mark:
DMPI-004Repetition threshold >=3 instead of >10 β€” Named constant REPETITION_THRESHOLD = 3. Word-level and phrase-level conditions changed to >= REPETITION_THRESHOLD. Expanded COMMON_WORDS (+37 words) and added COMMON_PHRASES exclusion list (29 common English bigrams) to control false positives at the lower threshold.Low:white_check_mark:
DMPI-005Missing paper features: is_immoral, is_ignore, is_format_manipulation β€” All 3 missing features now implemented as keyword-in-text checks in feature_extraction.rs. is_ignore (index 0): ignore, reveal, disregard, forget, overlook, regardless. is_format_manipulation (index 4): encode, disguising, morse, binary, hexadecimal. is_immoral (index 7): hitting, amoral, immoral, deceit, irresponsible, offensive, violent, unethical, smack, fake, illegal, biased. Resolved as part of DMPI-003. Architecture doc: docs/architecture/DMPI_003_TEN_BINARY_FEATURES.md.Medium:white_check_mark:
DMPI-006Feature naming alignment to paper convention β€” All 8 finding types renamed to paper's is_* convention: flattery_attack->is_incentive, urgency_attack->is_urgent, roleplay_attack->is_hypothetical, impersonation_attack->is_systemic, covert_attack->is_covert, excuse_attack->is_immoral, many_shot_attack->is_shot_attack, repetition_attack->is_repeated_token. Updated in lib.rs, feature_extraction.rs, and documentation.Lowβœ…

Loop 13 β€” Hallucination Detection Upgrade

HaluGate-style token-level detection

IDFeatureComplexityStatus
OS-001Token-level hallucination detection (ModernBERT)High⬜
OS-002NLI explanation layer for flagged spansHigh⬜
OS-003ModernBERT sentinel pre-classifierMedium⬜
OS-004Tool-call result as ground truth for fact-checkingMedium⬜
OS-005Semantic entropy-based detectionHigh⬜
OS-006Citation validationHigh⬜
ML-005ModernBERT support (for token/sentinel classifiers)High⬜

Loop 14 β€” Content Safety Expansion

Llama Guard integration, bias detection

IDFeatureComplexityStatus
OS-022Llama Guard 3 integration (14 harm categories)Medium⬜
OS-021Bias detection in responsesMedium⬜
OS-020Constitutional classifiers for output moderationHigh⬜
OS-023Language detection for unexpected output switchesLow⬜
OS-024Sentiment analysis for manipulative contentLow⬜
OS-030CodeShield-style code security expansionHighπŸ”„
OS-031Semgrep rule integration for code outputsHigh⬜
OS-032Supply chain security in code (typosquatting, confusion)High⬜

Loop 15 β€” Fusion Training Pipeline

Train the fusion classifier with real data

IDFeatureComplexityStatus
ML-001Joint end-to-end training for fusion FC layerHighβœ…
ML-014Curated training dataset (61k benign + 16k injection)Mediumβœ…
IS-001Token-wise bias detection for over-defenseHigh⬜
IS-002Adaptive debiasing data generation (1–3 token combos)High⬜
IS-003MOF retraining pipeline on debiased dataHigh⬜
ML-010MOF training pipeline (token bias β†’ debiasing β†’ retraining)High⬜
ML-011Data-centric augmentation across 17 formatsMedium⬜
ML-015GradSafe integrationHigh⬜
ML-016GCG adversarial sample generation (Python/PyTorch tooling; shared with EV-017)High⬜
ML-020ONNX runtime support for inferenceMedium⬜
ML-021INT8/INT4 quantized model loadingMedium⬜
ML-022Batched inference for GPU utilizationMedium⬜

Loop 16 β€” Benchmark Evaluation Suite

Evaluate against all major benchmarks

IDFeatureComplexityStatus
EV-001AgentDojo evaluation (97 environments)Medium⬜ (requires Python framework, not static dataset)
EV-003InjecAgent evaluation (2108 indirect injection samples)Mediumβœ…
EV-004ASB evaluation (400 agent security attack samples)Mediumβœ…
EV-005WASP evaluationMedium⬜ (requires live web environment)
EV-006CyberSecEval 2 prompt injection evaluation (251 attack samples per DMPI-PMHFE [28])Mediumβœ… 7ce0cf9
EV-007MLCommons AILuminate jailbreak benchmark (1200 demo prompts)Mediumβœ…
EV-008HPI attack approximation (55 instances, 8-category taxonomy from arXiv:2509.14285)Lowβœ… (best-effort 55-attack approximation)
EV-009Automated CI-integrated benchmark runnerMediumβœ… b15f4f0
EV-011safeguard-v2 evaluation (2060 samples)Lowβœ…
EV-012deepset-v2 evaluation (355 samples)Lowβœ…
EV-013Ivanleomk-v2 evaluation (610 samples)Lowβœ…
EV-014BIPIA evaluation (400 samples: 200 benign + 200 indirect injection, 3 scenarios)Mediumβœ…
EV-015HarmBench evaluation (400 harmful behaviors, jailbreak/safety ASR)Mediumβœ…
EV-016AgentDojo Slack suite adaptive attack evaluation (Agent-as-a-Proxy resilience, 89 samples)High⬜
EV-017Multi-objective GCG adversarial robustness red-team testing against LLMTrace ensembleHigh⬜
EV-018Cross-model transfer attack resistance testing across ensemble membersMediumβœ…
EV-019Tensor Trust prompt hijacking/extraction evaluation (1000 sampled attacks)Lowβœ…
EV-020Harelix mixed-techniques evaluation (1174 samples, tri-class)Low❌ (dataset deleted from HuggingFace)
EV-021Jackhhao jailbreak-classification over-defense test (1306 samples, balanced)Lowβœ…

Loop R9 β€” REST Query API

IDFeatureComplexityStatus
RL9-01Trace/span query endpoints + paginationHighβœ…
RL9-02Security findings endpointMediumβœ…
RL9-03API testsMediumβœ…

Loop R10 β€” LLM Provider Auto-Detection

IDFeatureComplexityStatus
RL10-01Provider detection by path/header/hostMediumβœ…
RL10-02Provider-specific response parsingMediumβœ…
RL10-03Provider detection testsMediumβœ…

Loop R11 β€” Cost Estimation Engine

IDFeatureComplexityStatus
RL11-01Pricing table + estimate_cost APIMediumβœ…
RL11-02Custom pricing configMediumβœ…
RL11-03Tests for pricingMediumβœ…

Loop R12 β€” Alert Engine (Webhooks)

IDFeatureComplexityStatus
RL12-01Webhook alerting with thresholds + cooldownMediumβœ…
RL12-02Mock webhook testsMediumβœ…

Loop R13 β€” Tenant Management API

IDFeatureComplexityStatus
RL13-01Tenant CRUD endpoints + auditHighβœ…
RL13-02Auto-create tenant on first requestMediumβœ…
RL13-03API testsMediumβœ…

Loop R14 β€” ClickHouse TraceRepository

IDFeatureComplexityStatus
RL14-01ClickHouse TraceRepository implementationHighβœ…
RL14-02Feature-gated ClickHouse testsHighβœ…

Loop R15 β€” PostgreSQL MetadataRepository

IDFeatureComplexityStatus
RL15-01Postgres MetadataRepository + migrationsHighβœ…
RL15-02Postgres integration testsHighβœ…

Loop R16 β€” Redis CacheLayer

IDFeatureComplexityStatus
RL16-01Redis CacheLayer implementationMediumβœ…
RL16-02Cache TTL and invalidation testsMediumβœ…

Loop R17 β€” Data Retention & Purging

IDFeatureComplexityStatus
RL17-01Retention policies + purge jobMediumπŸ”„
RL17-02Purge audit loggingMedium⬜

Loop R18 β€” Agent Action Analysis

IDFeatureComplexityStatus
RL18-01AgentAction model + auto-parse tool callsHighβœ…
RL18-02Actions reporting API + query filtersHighβœ…
RL18-03Action security analysis + storageHighβœ…
RL18-04Python SDK action reportingMediumβœ…

Phase 3: Research Frontier

Loop 17 β€” Multimodal Security

IDFeatureComplexityStatus
MM-001Image injection detectionHigh⬜
MM-004OCR-based text extraction from imagesMedium⬜
MM-002Audio injection detectionHigh⬜
MM-003Cross-modal consistency checkingHigh⬜
MM-005Steganography detection (image/audio)High⬜
MM-006Video frame injection detectionHigh⬜

Loop 18 β€” Protocol Security (A2A/ANP)

IDFeatureComplexityStatus
AS-031A2A protocol securityHigh⬜
AS-032ANP protocol securityHigh⬜
AS-033Dynamic trust managementHigh⬜
AS-034Inter-agent trust verificationHigh⬜

Loop 19 β€” Streaming Content Monitor

IDFeatureComplexityStatus
OS-010Purpose-built partial-sequence detection modelsHigh⬜
OS-011Training-inference gap mitigation (partial sequence training)High⬜
OS-012Token-level harm annotationsHigh⬜
OS-013Progressive confidence scoringMedium⬜

Loop 20 β€” Advanced Privacy

IDFeatureComplexityStatus
PR-001Membership inference defenseHigh⬜
PR-002Data extraction preventionHigh⬜
PR-003Federated learning poisoning defenseHigh⬜
PR-004Vector/embedding poisoning detectionHigh⬜
PR-005RAG retrieval anomaly monitoringMedium⬜
PR-006Multi-language PII detection (non-Latin scripts)HighπŸ”„
PR-007Context-aware PII enhancement (lemma-based boosting)MediumπŸ”„
PR-009Compliance mapping to GDPR/HIPAA/CCPA entitiesMediumπŸ”„
PR-010Memory poisoning detection (MINJA)High⬜
PR-011Cross-session state integrityHigh⬜
PR-008Custom PII entity type pluginsMedium⬜
PR-012Speculative side-channel defenseHigh⬜

Loop 21 β€” Policy Language

IDFeatureComplexityStatus
SA-001Declarative policy specification (Colang/OPA-style)High⬜
SA-003Taint trackingHigh⬜
SA-004Blast radius reduction for tool accessMedium⬜
SA-005Backdoor detection (prompt/parameter level)High⬜
SA-006Composite backdoor detection (CBA-style)High⬜
SA-007Data poisoning detection (PoisonedRAG)High⬜
SA-008Social engineering simulation defenseHigh⬜
SA-009Contagious recursive blocking defenseHigh⬜
SA-010GuardReasoner integrationHigh⬜

Loop 22 β€” Adversarial ML Robustness

IDFeatureComplexityStatus
IS-024AML evasion resistance (TextFooler, BERT-Attack, BAE) β€” normalization only, no attack-specific defensesHighπŸ”„
IS-025Ensemble diversification against transferability β€” no transferability testing or trainingHighπŸ”„
IS-026Adversarial training integration (TextAttack samples)High⬜
IS-027Adaptive thresholding for evasion indicatorsMedium⬜
IS-028Multi-pass normalisation (aggressive + conservative + semantic-preserving)MediumπŸ”„
ML-012Adversarial training on TextAttack samplesHigh⬜ (needs training pipeline)
ML-013Robust training with Unicode/character injection samplesHigh⬜
IS-029Confidence calibration (Platt scaling) β€” temperature scaling onlyMediumπŸ”„
IS-023Character smuggling variants (comprehensive unicode exploitation)MediumπŸ”„
IS-030Word-importance transferability mitigationHigh⬜

Loop 23 β€” E2E Accuracy Optimization (Post Stress Test)

After wiring OperatingPoint, threshold filtering, over-defence suppression, and score capping for single-detector findings, the E2E stress test reached 83.7% accuracy, 84.7% F1 on a 153-sample corpus (79 malicious, 74 benign) from 13+ benchmark datasets. The remaining 15 FPs and 10 FNs require ML-level fixes documented below. Reference: docs/FEATURE_ROADMAP.md section 3.4.4 for full analysis.

Review findings (2026-02-15, AI Engineer + MLOps Engineer):

  • Combined ML-030 + ML-033 impact is NOT additive; realistic combined: -7 to -12 FPs.
  • ML-030 must precede ML-033 (calibrating before fine-tuning is wasted work).
  • ML-030 triggers ML-001 re-evaluation (fusion classifier needs re-validation after base model changes).
  • ML-033 supersedes IS-029 (Loop 22). IS-029 remains for temperature scaling only; ML-033 adds proper Platt scaling.
  • IS-060 elevated to P0 (4 FNs, largest single FN category, indirect injection is most dangerous for agent systems).
  • IS-070 elevated to P1 (shell injection in agent contexts is high-severity).
  • ML-034 elevated to P1 (encoding bypass is an active evasion vector).
  • Acceptance criterion for ALL items: full benchmark suite recall must not decrease by >1pp.
  • MLOps prerequisites (OPS-001 through OPS-008) must be addressed before deploying model changes.
  • Recommended execution order: ML-032 + ML-034 (patch evasion vectors) -> ML-033 (calibrate existing system) -> IS-070 (expand detection) -> ML-030 (model fine-tuning, highest risk last).

Infrastructure already wired (this session):

  • SecurityAnalysisConfig.operating_point + SecurityAnalysisConfig.over_defence config fields
  • EnsembleSecurityAnalyzer::filter_by_thresholds() applying per-category confidence gates
  • EnsembleSecurityAnalyzer::apply_over_defence() suppressing auxiliary-only findings (no injection corroboration)
  • Single-detector score cap at 60 (Medium) in add_security_finding()
  • 3 new regex patterns: roleplay_lets (jailbreak), authority_claim_update (is_systemic), disable_safety (prompt_injection)

Dependency chain:

OPS-001..OPS-008 (prerequisites)
    |
    v
ML-032 + ML-034 (patch evasion vectors, low risk)
    |
    v
ML-033 (calibrate existing system, supersedes IS-029)
    |
    v
IS-060 + IS-070 (new detection capabilities)
    |
    v
ML-030 (fine-tune DeBERTa, highest risk)
    |
    v
ML-001 re-evaluation (fusion classifier re-validation)
    |
    v
ML-031 (multilingual calibration, depends on language detection infra)

MLOps prerequisites (must complete before deploying ML changes):

IDFeatureComplexityStatus
OPS-001Externalize SecurityConfig to file/env β€” All thresholds, operating points, and model identifiers loadable from config file or environment variables. Hardcoded values serve only as fallback defaults. Required before ML-033 (recalibrated thresholds currently require code change and rebuild).Medium⬜
OPS-002Pin model revisions with SHA β€” Use hf_hub revision/commit SHA parameters for all model downloads. Add SHA256 integrity verification of SafeTensors files. Current code downloads latest revision on cold start, risking silent behavior changes.Low⬜
OPS-003Model inference metrics β€” Expose per-model inference latency histograms, raw score distributions, classification outcome counters, ensemble agreement rate. Essential for validating model changes in production.Medium⬜
OPS-004Model version manifest β€” models.toml declaring model name, revision SHA, expected SafeTensors SHA256, deployment timestamp. Enables rollback by reverting manifest to previous version.Low⬜
OPS-005CI regression test gate β€” CI step that loads ensemble, runs fixed regression set (50-100 canonical examples), asserts no accuracy regression beyond threshold. Blocks merge on failure.Medium⬜
OPS-006Training infrastructure for ML-030 β€” Define training environment (Python/PyTorch), GPU provisioning, SafeTensors export validation step ensuring layer-name compatibility with Candle loader. Define artifact registry for fine-tuned weights.High⬜
OPS-007Expand calibration dataset to 1,000+ samples β€” 153 stress test samples is insufficient for Platt scaling. Collect stratified samples across injection types. Separate calibration holdout from ML-030 training set (at least 30% of NotInject reserved for calibration).Medium⬜
OPS-008Shadow-mode inference β€” Run new model ensemble in parallel without affecting response path, log predictions for offline comparison. Required for safe validation of ML-030 fine-tuned model before production cutover.High⬜

ML accuracy work items:

IDFeatureComplexityPriorityStatus
ML-032Short-input confidence scaling β€” For inputs < 10 tokens, scale confidence threshold linearly from 0.95 (at 1 token) to normal threshold (at 10 tokens). Do NOT bypass ML entirely to avoid blind spots for short attacks like "Ignore all previous instructions" (5 tokens). Estimated impact: -1 FP.LowP1⬜
ML-034Encoding decoder preprocessor β€” Before ML inference, apply decoding pipeline: base64, rot13, leetspeak, hex, binary, upside-down text, Cyrillic homoglyphs. Add content-type heuristic before decoding (skip base64 if string contains spaces/punctuation). Specify latency cap (5ms max). Must define integration plan with existing jailbreak_detector.rs encoding detection (augment, not replace). 7/11 encoding evasion test cases detected (64%); 4 misses are encoded payloads without plaintext injection markers.MediumP1⬜
ML-033Confidence recalibration (Platt scaling) β€” Apply Platt scaling (logistic regression) to recalibrate DeBERTa output probabilities. Supersedes IS-029 temperature scaling. Requires OPS-007 (1,000+ calibration samples). Calibration set MUST be disjoint from ML-030 training set. Specify per-model vs post-ensemble calibration. Re-derive operating point thresholds after calibration (current HighRecall/Balanced/HighPrecision values become invalid). Estimated impact: -2 to -4 FPs. Depends on: OPS-007.MediumP1⬜
IS-060Spotlighting/datamarking for indirect injection β€” Split input into instruction zones and data zones using configurable boundary markers. Apply injection detection only to data zones. Sub-tasks: (a) zone boundary detection heuristics for common data formats (HTML tables, email headers, CSV, JSON data fields), (b) config-declared boundary support, (c) ensemble integration (feed datamarking results into existing voting). Targets 4 BIPIA FNs (40% of all FNs). Reference: docs/research/spotlighting-indirect-injection-defense.md (datamarking reduces ASR from >50% to <3%).HighP0⬜
IS-070Shell command injection detection β€” Detect dangerous shell commands (curl with exfiltration, python -c with socket, wget, reverse shell, rm -rf) in prompt content. Extend existing RL3-02 regex patterns (do not duplicate). Distinct from prompt injection; targets 2 FN code execution attacks. Critical for agent systems with tool-use capabilities.MediumP1⬜
ML-030DeBERTa fine-tuning on NotInject dataset β€” Fine-tune protectai/deberta-v3-base-prompt-injection-v2 using 339 NotInject samples + 15 stress test FPs + 10-20 "creative writing instruction" samples as hard negatives. Mix with full training set (61k benign + 16k injection from ML-014) to prevent catastrophic forgetting. Training: 3 epochs, lr=2e-5, batch_size=16. Reserve 20% of NotInject for validation. Acceptance criteria: F1 >= 0.88 on held-out set, no per-class recall regression > 2%, full benchmark suite pass. Estimated impact: -5 to -10 FPs. Depends on: OPS-002, OPS-004, OPS-005, OPS-006. Triggers: ML-001 re-evaluation.HighP0⬜
ML-031Multilingual calibration β€” Two sub-tasks: (a) add language detection to ensemble pipeline (e.g., lingua-rs or trigram detector), (b) calibrate per-language confidence thresholds using holdout set. Collect 1,000+ benign Chinese samples (traditional + simplified, technical/conversational/educational). Fine-tuning is a separate future item. Estimated impact: -2 FPs. Depends on: ML-030.MediumP2⬜

Loop R19 β€” ML Prompt Injection Detection (Candle)

IDFeatureComplexityStatus
RL19-01Candle ML detector + ensemble integrationHighβœ…
RL19-02ML config wiring + fallbackMediumβœ…
RL19-03Benchmark + testsMediumπŸ”„

Loop R20 β€” OpenTelemetry Ingestion Gateway

IDFeatureComplexityStatus
RL20-01OTLP/HTTP endpoint + mappingHighβœ…
RL20-02OTEL ingestion testsMediumβœ…

Loop R21 β€” Web Dashboard

IDFeatureComplexityStatus
RL21-01Next.js dashboard scaffolding + pagesHighβœ…
RL21-02API client + charts + DockerHighβœ…

Loop R22 β€” CI/CD Pipeline

IDFeatureComplexityStatus
RL22-01CI workflow (fmt/clippy/test)Mediumβœ…
RL22-02Release workflow + image scanMediumβœ…

Loop R23 β€” RBAC & Auth

IDFeatureComplexityStatus
RL23-01API keys + role enforcementHighβœ…
RL23-02Tenant isolationHighβœ…

Loop R24 β€” Compliance Reporting

IDFeatureComplexityStatus
RL24-01Report generator + APIHighβœ…
RL24-02Optional PDF exportMedium⬜

Loop R25 β€” gRPC Ingestion Gateway

IDFeatureComplexityStatus
RL25-01gRPC ingestion server + protoHighβœ…
RL25-02Streaming ingestion supportHighβœ…

Loop R26 β€” Kubernetes Operator + Helm

IDFeatureComplexityStatus
RL26-01Helm chart + deployment docsHighβœ…
RL26-02Optional CRD operatorHigh⬜

Loop R27 β€” WASM Bindings

IDFeatureComplexityStatus
RL27-01wasm-bindgen crate + JS APIMediumβœ…
RL27-02WASM testsMediumβœ…

Loop R28 β€” Node.js Bindings

IDFeatureComplexityStatus
RL28-01napi-rs bindings + TS typesMediumβœ…
RL28-02Node testsMediumβœ…

Loop R29 β€” Statistical Anomaly Detection

IDFeatureComplexityStatus
RL29-01Anomaly detector + configHighβœ…
RL29-02Alert integration + testsHighβœ…

Loop R30 β€” Real-time Streaming Security Analysis

IDFeatureComplexityStatus
RL30-01Streaming incremental analysisHighβœ…
RL30-02Mid-stream alerting testsHighβœ…

Loop R31 β€” Expanded PII Detection

IDFeatureComplexityStatus
RL31-01International PII patterns + suppressionHighβœ…
RL31-02PII redaction modes + testsHighβœ…

Loop R32 β€” ML PII via NER

IDFeatureComplexityStatus
RL32-01NER model integration + ensembleHighβœ…
RL32-02NER testsMediumβœ…

Loop R33 β€” ML Inference Monitoring + Warm-up

IDFeatureComplexityStatus
RL33-01Inference timing + preloadMediumβœ…
RL33-02Warm-up testsMediumβœ…

Loop R34 β€” Multi-Channel Alerting

IDFeatureComplexityStatus
RL34-01Slack (Block Kit) + PagerDuty (Events API v2) done; Email channel TODOHighπŸ”„
RL34-02Deduplication done; escalation stub only (no full escalation policy engine)HighπŸ”„

Loop R35 β€” Externalize Pricing + OWASP Tests

IDFeatureComplexityStatus
RL35-01Pricing config externalizationMediumβœ…
RL35-02OWASP LLM Top 10 test suiteHighβœ…

Loop R36 β€” Graceful Shutdown + Signal Handling

IDFeatureComplexityStatus
RL36-01SIGTERM/SIGINT handling + task drainHighβœ…
RL36-02Shutdown testsMediumβœ…

Loop R37 β€” Prometheus Metrics Endpoint

IDFeatureComplexityStatus
RL37-01Metrics endpoint + instrumentationHighβœ…
RL37-02Metrics testsMediumβœ…

Loop R38 β€” Database Migration Management

IDFeatureComplexityStatus
RL38-01Migration tooling + CLIHighβœ…
RL38-02Migration testsMediumβœ…

Loop R39 β€” Secrets Hardening + Startup Probe

IDFeatureComplexityStatus
RL39-01Secrets hardening + startup probeMediumβœ…

Loop R40 β€” Integration Tests in CI + Container Scanning

IDFeatureComplexityStatus
RL40-01Compose-based integration tests in CIHighβœ…
RL40-02Container scanning in releaseMediumβœ…

Loop R41 β€” Per-tenant Rate Limiting + Compliance Persistence

IDFeatureComplexityStatus
RL41-01Tenant rate limiting middlewareHighβœ…
RL41-02Compliance report persistence + APIHighβœ…

Quality Gates (enforced on every loop)

  1. cargo fmt --all --check β€” zero diffs
  2. cargo clippy --workspace -- -D warnings β€” zero warnings
  3. cargo test --workspace β€” zero failures (pre-existing failures must be fixed)
  4. Lead engineer review β€” diff reviewed before commit
  5. CI green β€” verified after push

Notes

  • IS-007 (Configurable operating points) completed in R8 commit 41e219b. Fully wired to proxy config and ensemble in 2026-02-15 session: SecurityAnalysisConfig.operating_point field drives EnsembleSecurityAnalyzer::with_operating_point(), filter_by_thresholds() applies per-category confidence gates, over_defence flag enables auxiliary-only suppression.
  • R11 (code_security module) completed in commit b08dccc, tests fixed in aa9ab98
  • Each loop targets a coherent feature set that can be tested independently
  • Phase 1 focuses on closing critical 100% ASR gaps and establishing evaluation baseline
  • RALPH quality policy: no placeholders/mocks; if spec requires ML, implement real ML inference (regex fallback only when model weights unavailable).
  • AS-004/AS-006/AS-007 are πŸ”„ because literature expects LLM-based parsing/sanitization for tool outputs; current implementation is heuristic only.
  • AS-020/AS-021/AS-023/AS-024 are πŸ”„ because literature expects multi-agent LLM coordination; current implementation is heuristic/policy-only.
  • IS-024/IS-027/IS-028/IS-029 are πŸ”„ because only normalization/temperature scaling exists (no attack-specific defenses or Platt scaling). ML-033 (Loop 23) supersedes IS-029 for Platt scaling; IS-029 remains for temperature-scaling-only scope.
  • PR-006 is πŸ”„ because full non-Latin PII coverage and a custom-entity plugin architecture are not fully implemented.
  • Tool parsing expectations come from docs/research/defense-tool-result-parsing.md and docs/research/indirect-injection-firewalls.md.
  • Multi-agent expectations come from docs/research/multi-agent-defense-pipeline.md.
  • Adversarial robustness expectations come from docs/research/bypassing-llm-guardrails-evasion.md.
  • Over-defense mitigation expectations come from docs/research/injecguard-over-defense-mitigation.md.
  • Benchmark coverage expectations come from docs/research/benchmarks-and-tools-landscape.md and docs/research/wasp-web-agent-security-benchmark.md.
  • CyberSecEval 2 benchmark expectations (EV-006) come from docs/research/cyberseceval2-llm-security-benchmark.md. The 251 attack sample count is sourced from DMPI-PMHFE (arXiv 2506.06384) which used the CyberSecEval 2 prompt injection dataset; the full paper covers additional suites (500 code interpreter abuse prompts, exploit generation, FRR).
  • BIPIA benchmark expectations (EV-014) come from docs/research/bipia-indirect-prompt-injection-benchmark.md. First indirect prompt injection benchmark (KDD 2025, arXiv 2312.14197): 86,250 test prompts, 50 attack types, 25-model baseline. Boundary token defense (<data>/</data>) is most impactful intervention (1064% ASR increase without it) and is implementable at proxy level (relevant to AS-001/AS-002).
  • Agent-as-a-Proxy attack implications (EV-016) come from docs/research/agent-as-a-proxy-attacks.md. Monitoring-based defenses (including LLMTrace proxy monitoring) are fundamentally fragile: 90%+ ASR via GCG-optimized adversarial strings. Validates that structural defenses (AS-001/AS-002 sanitization, boundary tokens) are more robust than observation-based monitoring. High-perplexity detection in tool outputs is a viable countermeasure.
  • IS-050 -> IS-052 dependency: IS-052 (adversarial string propagation blocking) depends on IS-050 (perplexity-based anomaly detection) for surprisal scoring. IS-050 must be implemented first. IS-052 runs before AS-002 in the tool-output sanitization pipeline.
  • IS-050 -> IS-051 implicit dependency: IS-051 (adaptive monitoring scope) auto-switches to input-only mode when IS-050 detects sustained high-perplexity anomalies in tool outputs (suggests active adaptive attack). IS-050 must be implemented first for auto-switching; manual override works independently.
  • ML-016 and EV-017 share GCG Python/PyTorch offline tooling (tools/gcg/ or scripts/adversarial/). Not part of the Rust proxy runtime.
  • EV-016 and EV-001 share AgentDojo benchmark infrastructure. EV-016 focuses on Slack suite (89 samples) with adaptive (GCG) attacks; EV-001 covers the full 97 environments.
  • EV-018 depends on ML-006 (ensemble must be wired before transfer resistance can be tested).
  • ML-016 (GCG adversarial sample generation) is in Loop 15 (Fusion Training Pipeline). Requires Python/PyTorch offline tooling, not Rust proxy code. Shared with EV-017.
  • Token-level perplexity detection expectations (IS-050) come from docs/research/token-level-perplexity-detection.md. PGM-based per-token detection with GPT-2 124M (CPU-only, <1GB) achieves perfect sequence-level detection and 0.93+ token-level F1. O(n) DP algorithm. Core implementation reference for IS-050.
  • Perplexity-based attack detection expectations (IS-050) come from docs/research/perplexity-based-attack-detection.md. Two-feature LightGBM (PPL + token length) achieves 99.1% F2 on GCG attacks. GCG mean PPL 3525 vs benign ~30-45. Perplexity alone is insufficient (false positives on code/non-English); token length as second feature resolves this.
  • Task Shield alignment expectations (ML-016) come from docs/research/task-shield-alignment-defense.md. Task-alignment defense ("does this serve the user?") achieves 2.07% ASR with 69.79% utility on GPT-4o. ContributesTo scoring at message boundaries. Directly informs ML-016 goal-drift detector design; provides EV-016 baseline comparison targets.
  • Spotlighting expectations (IS-004, AS-001/AS-002) come from docs/research/spotlighting-indirect-injection-defense.md. Datamarking reduces ASR from >50% to <3% with zero NLP quality impact. Dynamic/randomized tokens essential. Encoding (base64) achieves 0% ASR but requires GPT-4-class models. Validates and extends boundary tag approach.
  • Instruction hierarchy expectations (IS-004, SA-003) come from docs/research/instruction-hierarchy-defense.md. Privilege hierarchy (system > user > tool) via SFT+RLHF. +63.1 pp on system message extraction defense. Validates proxy-level boundary tags as complement to model-level hierarchy. Over-refusal is main trade-off (-22.7 pp).
  • DMPI-001–DMPI-006 (Loop 12a) were prerequisites for ML-001 (Loop 15). All 6 deviations are now resolved; the fusion classifier architecture matches the DMPI-PMHFE specification. See docs/research/dmpi-pmhfe-prompt-injection-detection.md for the authoritative paper breakdown.
  • DMPI-003 and DMPI-005 resolved together: feature vector is now 10 binary dimensions matching paper Appendix A. See docs/architecture/DMPI_003_TEN_BINARY_FEATURES.md.
  • DMPI-006 (naming) resolved: all 8 finding types renamed to paper's is_* convention.
  • EV-002 is βœ… because the NotInject dataset is 339 samples with equal difficulty tiers (113/113/113).

What's inside

2 phases, 20 loops, 100+ feature IDs, status legend, and literature-anchored acceptance criteria per section.

Change this for your project

  • Replace docs/research/ paths with your own research document locations
  • Replace commit hashes like a62855b with your own repository's commits
  • Replace repository name epappas/llmtrace with your own project name

Where it goes

Keep alongside your test suite. Used to define and score model evaluations.

Worth borrowing

  • RALPH loops with strict quality gates and lead engineer review before merge
  • Literature-anchored acceptance criteria that must all be met before marking a task done
  • Status legend with explicit blocked/in-progress/done states tied to concrete criteria

Related Documents