MEGA Code
Contact

Use case · Agent security

Hardening agents takes a loop, not a test set.

Agents fail through tool calls, retrieval corpora, and long-horizon plans — surfaces a prompt-only red-team can't see. MEGA fuses static OWASP review with a dual-axis Red Team / Blue Team simulation, then iterates surgical fixes until both defense and over-refusal land inside budget.

Why agents are different

Three failure modes a prompt-only test set never sees.

Tools amplifyOne charge_card or delete_account call is irreversible.
Retrieval = injection surfaceRAG corpora and tool outputs become attacker channels.
No undoA leaked SSN, a wrong wire, a dumped system prompt — all permanent.

The optimization loop

Two surfaces, one priority queue. Three exits.

Static review reads source; dynamic probes never do. Findings merge by severity × failure category, then every fix is Pareto-checked on both DSR (defense) and FRR (over-refusal) before it earns its keep.

Static ReviewOWASP × LLM Top 10
HIGH
4
MED
7
LOW
3
AUTO / OPT-IN / MANUAL7 / 2 / 5
Dynamic ProbesRed × Blue
Always-on (4)
prompt_injectionjailbreakpii_disclosuresystem_prompt_leak
Conditional (3)
tool_abuserag_poisoningoutput_handling
OWASP checks22Web + LLM Top 10
Categories4–7Archetype-merged
Hard / soft3 / 4Reg-promoted

Two surfaces. One priority queue.

The static review reads source; the dynamic Red Team never does. Both feed independent findings into the hardening loop, merged by severity × failure category.

01PROPOSEtrace + static merge
02APPLYsecurity-coding-agent
03QUICK CHECKchange-impact aware
04ACCEPT / REVERTPareto on adjusted
Loop until exit · DSR↑ AND FRR ≤ baseline + budget
CONVERGEDall hard 1.00 · soft ≥0.95
STOPiter budget exhausted
REDESIGNDSR plateau + FRR creep
ITER 0 · BASELINEFRR 4%ITER 1 · INPUT FILTER+17pp ✓ITER 2 · CONFIRMATION GATE+15pp ✓ITER 3 · CONVERGED+4pp ✓

Pareto every iteration. Three exits.

Every fix earns its keep on both axes — defense up AND over-refusal within budget — or it auto-reverts. The loop ends when there’s nothing surgical left, or the architecture itself needs to change.

Defense leaderboard

Smaller models, hardened, outperform raw frontier.

Validation-set DSR across frontier and small models after the hardening loop converges.

Average defense success rate

Small models with MEGA optimize beat the full frontier average.

Frontier average

Mean across all 4 frontier models

0.000

  • Anthropicclaude-opus-4.7·0.910
  • OpenAIgpt-5.5·0.830
  • Googlegemini-3.1-pro-preview·0.680
  • xAIgrok-4.20-0309-reasoning·0.530

Small + MEGA optimize average

Mean across all 4 small models with mega-security:prompt-optimize

0.000

  • Googlegemini-3.1-flash-lite-preview·1.000
  • xAIgrok-4.1-fast-non-reasoning·0.990
  • OpenAIgpt-5.4-mini·0.950
  • Anthropicclaude-haiku-4.5·0.910
+0.000higher average DSR · same probe set, same judge