ECC
The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
- 309k
- JavaScript
- MIT
- 12 h ago
Automated, evidence-based red teaming for AI agents and LLM applications — prompt injection, tool abuse, and MCP security testing.
Repo praneeth132006/VectorShield, read from GitHub 18 min ago. praneeth132006 has not joined Take My Repo.
praneeth132006/VectorShield is a public repo on GitHub by praneeth132006. Automated, evidence-based red teaming for AI agents and LLM applications — prompt injection, tool abuse, and MCP security testing. It declares the MIT license on GitHub. It is written mainly in Python, has 0 stars and last changed on 2026-10-15. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read from GitHub on 2026-11-23.
In the maintainer's words. Shown from GitHub; Take My Repo does not keep a copy.
An AI security gateway for LLM applications. It sits between your app and your model, inspects every prompt before it reaches the model and every response before it reaches your user, and logs the decision either way.
Built for the small team shipping a support chatbot as much as for the large platform: point your existing OpenAI SDK at the gateway's URL and you are protected without rewriting your client code.
VectorShield
┌──────────────────────────────────────────────────┐
│ │
│ auth ─▶ quota ─▶ inbound inspection ────────┐ │
Client ──▶│ (LLM04) (LLM01, LLM04, LLM10) │ │
│ ▼ │
│ Decision Engine│──▶ block (403)
│ │ │
│ ▼ │
│ system prompt │
│ + canary │──▶ Target LLM
│ │ │ (OpenAI / Ollama)
│ ▼ │
Client ◀──│ ◀── outbound inspection ◀── Decision Engine │◀── response
│ (LLM06: PII, secrets, prompt leakage) │
│ │
│ every request logged (hashed) ──▶ SQLite/Postgres
└──────────────────────────────────────────────────┘
VectorShield is being built in phases. This is honest about what exists today:
| Phase | Scope | Status |
|---|---|---|
| 0 | Real authenticated proxy, tenants + policy, decision engine, rate limiting, audit log | ✅ shipped |
| 1 | Module 1 — prompt injection / jailbreak detection (LLM01) | ✅ shipped |
| 2 | Module 2 — data leakage & PII detection, canary verification (LLM06) | ✅ shipped |
| 3 | Module 3 — DoS/abuse hardening, token-budget limits (LLM04) | ✅ shipped |
| 4 | Module 4 — model extraction detection (LLM10) | ✅ shipped |
| 5 | Ops dashboards (Streamlit audit view + React console) + published benchmark table | ✅ shipped |
All four modules are in place. A jailbreak attempt is caught and blocked before it reaches
your model; a response that carries an API key, a customer record, or your system prompt is
caught on the way back; a request built to cost more than it looks is refused or flagged; and a
tenant systematically mapping your model shows up in the audit log. Every request is visible in
the ops dashboard. Benchmark numbers below are generated by
python -m benchmark.run_benchmark and are reproducible.
What is not here: streaming responses (a response must be fully inspected before it is
delivered, so stream=true is refused rather than silently unprotected), and a managed
multi-node deployment story for the behavioral state described under LLM10.
The two directions are deliberately not symmetric. Inbound, a bad request can simply be refused. Outbound, a customer is already waiting on an answer, so the default is to redact the leaked span and deliver the rest — the secret is gone either way, and only they can tell the difference.
Generated by python -m benchmark.run_benchmark, scored on the held-out split of
deepset/prompt-injections plus this repo's seed corpus — 194 examples the classifier never
saw during training. Full output lives in benchmark/results/.
| Counted as a detection | Precision | Recall | F1 | False-positive rate |
|---|---|---|---|---|
| Blocked only | 1.000 | 0.175 | 0.298 | 0.000 |
| Blocked or flagged | 0.962 | 0.625 | 0.758 | 0.018 |
Both rows matter, and the gap between them is the design, not a shortfall. The gateway only
blocks on high-confidence rule matches — where it did so, it was right every time, and it
never once blocked legitimate traffic. Everything the classifier merely suspects is flagged
for review and still delivered, because a fail-open default protects the product. Set
fail_mode: "closed" on a tenant to convert that middle band into blocks.
The same four attacks, rewritten with each obfuscation technique:
| Obfuscation | Detected | Blocked |
|---|---|---|
| none (plain text) | 4/4 | 4/4 |
| zero-width padding | 4/4 | 4/4 |
| letter spacing | 4/4 | 4/4 |
| punctuation splitting | 4/4 | 4/4 |
| leetspeak | 4/4 | 4/4 |
| homoglyphs | 4/4 | 4/4 |
| base64 payload | 4/4 | 4/4 |
| rot13 | 4/4 | 4/4 |
Scored on this repo's own corpus of 60 model responses — 26 that leak something and 34 ordinary support and developer answers, including several written specifically to bait the rules. A redaction counts as a detection.
| Precision | Recall | F1 | False-positive rate |
|---|---|---|---|
| 1.000 | 1.000 | 1.000 | 0.000 |
A perfect score on a corpus its own author wrote is worth almost nothing as a recall claim,
and it is not offered as one. Read it as a regression test: these are the leak shapes the
gateway currently knows, and it does not rewrite the 34 benign answers while catching them. The
bait cases are the interesting half — an SKU that looks like a card number, ddd-dd-dddd bay
numbers, apiKey: process.env.ACME_API_KEY, and an answer explaining that you should never
share an API key. Every one of them passes through untouched, and each was a real false positive
before it was a test.
| Leak type | Caught by |
|---|---|
| AWS, OpenAI, Anthropic, GitHub, Slack, Google, Stripe keys; private-key blocks | Key shape — structure carries the confidence, so no context is needed |
| Connection strings with embedded credentials | scheme://user:password@host, redacting only the password |
Credential-shaped assignments (client_secret = "...") |
Shape-agnostic and therefore weak on purpose; it cannot redact alone |
| Card numbers | Luhn checksum, which is what separates them from long order ids |
| SSNs, taxpayer ids, IBANs | Shape plus a corroborating word nearby |
| Emails, phone numbers | Logged; several together in one answer accumulate into a redaction |
| System prompt | 8-word shingle overlap, so reformatting does not defeat it |
| Canary token | Exact and obfuscation-folded match — the one leak that withholds the whole response |
Scored on this repo's own corpus of 42 requests — 18 shaped to cost far more than they look, against 24 that are verbose, demanding, or repetitive and entirely legitimate.
| Precision | Recall | F1 | False-positive rate |
|---|---|---|---|
| 1.000 | 1.000 | 1.000 | 0.000 |
| Abuse shape | Caught by |
|---|---|
Character runs ("A" × 8000) |
A single character repeated past any plausible prose |
| Repeated phrases | The same short phrase pasted back to back fifteen times or more |
| Low information density | Hundreds of words drawn from a handful of distinct ones |
| Unbounded output | A generation verb with no stopping condition — "repeat forever", "count to infinity" |
| Absurd explicit counts | A number far past what the named unit is ever legitimately asked for |
As with leakage, the recall figure is a regression check, not a claim — it measures the rules against the attacks their own author imagined. The false-positive half is the meaningful one, and the benign cases are chosen to hurt: "write a 2000 word guide", "generate 100 test records", "our team will continue using this service indefinitely", "which country has unlimited shipping". The last two were real false positives before they were test cases.
Scored over whole sessions, not single requests, because a lone prompt cannot be extraction. Five probing sessions against three ordinary ones; a session counts as detected if any request in it produced an LLM10 finding.
| Precision | Recall | F1 | False-positive rate |
|---|---|---|---|
| 1.000 | 1.000 | 1.000 | 0.000 |
| Probing session | Requests | Caught at request # |
|---|---|---|
| config-probing | 12 | 9 |
| classification-harvest | 30 | 13 |
| slot-enumeration | 30 | 13 |
| templated-sweep | 30 | 14 |
| translation-harvest | 30 | 16 |
The "caught at" column is the honest part of this table. Detection needs roughly a dozen requests of accumulated pattern, so an attacker who takes what they want in ten requests is not caught at all. This layer raises the cost of bulk harvesting; it does not stop a patient, low-volume one.
The ordinary sessions are deliberately the hardest realistic case — a support queue asking the same twenty questions all day, and the identical FAQ repeated eight times over. Both pass clean.
Gateway cost per request, excluding the upstream model call:
| Median | Mean | p95 | p99 |
|---|---|---|---|
| 0.35 ms | 0.94 ms | 2.75 ms | 4.98 ms |
This is roughly double what Phase 2 measured (0.21 ms median, 2.35 ms p99). The two new inbound detectors are the cost: the abuse scanner walks the prompt, and the extraction detector fingerprints it and compares against recent history. For scale, a typical hosted LLM call is 500–2000 ms, so the gateway still adds well under 1% of a request's latency — but the direction of travel is real, and every detector added to stage 0 is paid for on every single request.
The classifier ran on 24% of requests; the other 76% were settled by the rule layer alone.
--sources jailbreakbench to see for yourself.deepset/prompt-injections is the independent signal, and it dominates the split.deepset/prompt-injections for response leakage, so every one of those 60 cases was written here. Its false-positive rate is meaningful — those are realistic answers, and a rewrite of one is a real bug. Its recall is not: it measures the rules against the leaks the same author thought of.| OWASP LLM Top 10 | Threat | How the gateway addresses it |
|---|---|---|
| LLM01 | Prompt injection / jailbreaking | Staged inbound inspection: 15 evasion-resistant rules, encoded-payload decoding, and obfuscation signals at stage 0; a TF-IDF classifier at stage 1 for what cheap triage marks as worth a second look. The gateway also owns the system prompt, so a client cannot override it. |
| LLM04 | Model denial of service | Two layers. Hard limits refuse outright before any detector runs: payload caps (prompt size, message count), sliding-window request limits with escalating penalties, and a per-minute token budget charged on an estimate and reconciled against the provider's real usage. Separately, a stage 0 detector reports requests whose shape costs more than it looks — repetition bombs, unbounded-output instructions, absurd explicit counts. |
| LLM06 | Sensitive information disclosure | Stage 0 outbound scanning: credential shapes, Luhn-checked card numbers, context-corroborated national ids, and 8-word shingle overlap against the tenant's own system prompt — plus a canary token planted in that prompt, which is the one finding confident enough to withhold a whole response. Confident hits are redacted span by span, not dropped. |
| LLM10 | Model theft / extraction | Behavioral analysis across requests, since no single prompt is extraction. A bounded per-tenant history of prompt fingerprints (SimHash over word trigrams, plus a slot-blanked skeleton) surfaces near-duplicate floods, templated enumeration, and persistent probing of the model's own configuration. Flags rather than blocks: volume is never certain about intent. |
STORE_CONTENT=true. Blocked and sanitized requests always retain content so real attacks stay triageable.git clone https://github.com/praneeth132006/VectorShield.git
cd VectorShield
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env
Fully offline, no API key, no cost:
ollama pull llama3.2:3b
Or use OpenAI — set DEFAULT_PROVIDER=openai and OPENAI_API_KEY=sk-... in .env.
uvicorn app.main:app --reload
Interactive API docs: http://localhost:8000/docs
Set ADMIN_TOKEN in .env, restart, then:
curl -s localhost:8000/admin/tenants \
-H "X-Admin-Token: $ADMIN_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"support-bot","system_prompt":"You are Acme support. Only discuss Acme products."}'
The response contains api_key — it is shown once and stored only as a hash.
from openai import OpenAI
client = OpenAI(
base_url="http://localhost:8000/v1", # the only line that changes
api_key="vs_your_gateway_key",
)
client.chat.completions.create(
model="llama3.2:3b",
messages=[{"role": "user", "content": "What is your return policy?"}],
)
pip install -r requirements-dashboard.txt
streamlit run dashboard/ops.py

A read-only view of the audit log at http://localhost:8501: traffic and decisions over time, which detectors are firing and how confidently, the real latency this deployment is paying, a triage queue with per-request findings, and a per-tenant breakdown.
It reads the database directly and does not call the gateway's API, so it keeps working when
the gateway does not — a security dashboard that goes dark exactly when the service it watches
goes down is one an operator learns to distrust. Point DATABASE_URL at a read replica with a
read-only credential if you like; nothing in it writes.
Two things it will tell you that the benchmark cannot:
Prompt text is absent from the triage view unless the tenant opted into retention or the request was blocked, and the UI says so rather than rendering an empty column as though nothing happened.
A second, complementary view at http://localhost:5173, aimed at the opposite moment. The Streamlit dashboard answers "what has my gateway been doing?" from the audit database. The React console answers "what would my gateway do with this prompt?" against the live API.
.venv/bin/python -m uvicorn app.main:app --reload --port 8000 # terminal 1
cd frontend && npm install && npm run dev # terminal 2
Paste a tenant key into Prompt scanner and send a prompt. You get the decision, the risk
score, every finding with its detector, severity and confidence, which pipeline stages actually
ran, and the measured gateway overhead. Security test mode is on by default: it sends
dry_run: true, so the full inbound pipeline runs without an upstream model configured — which
makes it the fastest way to see the gateway work on a fresh clone.
It talks to the public API only (GET /health, POST /v1/gateway/chat) and stores nothing: the
API key lives in page memory, and its history and charts cover the current browser tab. See
frontend/README.md.
docker compose up
Brings up the gateway, Redis, and the dashboard on port 8501. Your prompts never leave your infrastructure.
| Route | Shape | Use it when |
|---|---|---|
POST /v1/chat/completions |
Byte-compatible with OpenAI | You have an existing app. Change base_url, change nothing else. |
POST /v1/gateway/chat |
OpenAI request + a full security report |
You want the risk score, the findings, the decision, and the latency overhead back with every call. |
The native surface returns:
{
"completion": { /* standard OpenAI chat completion */ },
"security": {
"request_id": "…",
"inbound": { "decision": "allow", "risk_score": 0.0, "findings": [], "stages_run": [] },
"outbound": { "decision": "allow", "risk_score": 0.0, "findings": [] },
"provider": "ollama",
"overhead_ms": 1.83 // gateway cost, excluding the model call
}
}
A blocked request returns HTTP 403 with the same security block, so you always know why.
The ML classifier is never on the hot path. Detectors declare a stage: stage 0 (regex, structural checks) runs on every request in microseconds; stage 1 (classifier) and stage 2 (embeddings) run only on requests that earn it. Measured on the benchmark, 76% of traffic never reaches the classifier. This is enforced by tests, not just convention.
Rule silence is not innocence. The cheap layer is high-precision and low-recall, so "no rule
fired" tells you almost nothing — escalating on rule silence alone would send everything to the
classifier, and escalating on nothing would mean it never runs. A third thing decides:
triage, a deliberately loose microsecond check for whether the
input is ordinary product traffic or is talking about the assistant, its instructions, or its
constraints. It is meant to over-trigger; its precision does not matter, because everything it
selects is then judged by a real detector. In the benchmark it escalates 66% of attacks and 4%
of legitimate traffic.
Normalize once, match everywhere. Attackers do not send ignore previous instructions
verbatim — they send it zero-width-padded, letter-spaced, homoglyph-substituted, or base64'd.
All of that is folded away in normalize before any rule runs, so
one rule covers a whole family of evasions instead of each rule growing its own tangle of
optional characters.
Redaction beats refusal on the way out. Outbound, a confident finding sanitizes rather than
blocks: the user gets their answer with the secret cut out of it. The exception is stated rather
than emergent — a detector sets unredactable when removing the flagged spans would not contain
the leak, which today means the canary alone, because a response containing the marker is the
system prompt being read aloud. Without that flag the choice would be an accident of confidence
calibration rather than a policy.
Outbound is stage 0 or nothing. Inbound can afford a classifier on the 24% of traffic that earns it, because the request has not been sent yet. A response is different: someone is already waiting on it, so every outbound detector is plain structure — key shapes, a checksum, a random token, shingle overlap — and there is no stage 1 to escalate to.
An ambiguous shape needs the sentence to agree. 100-20-3000 is a Social Security number and
a warehouse bay number, and no regex can tell them apart. Signatures that match ambiguous shapes
carry a context pattern: with a corroborating word nearby it is a full-confidence finding; on
its own it drops to a score that reaches the audit log and never rewrites an answer. The same
instinct keeps apiKey: process.env.ACME_API_KEY out of the results — punishing the correct way
to write it would make the gateway an enemy of good advice.
Limits are enforced; risk is judged. There is no opinion in "this prompt is 90,000
characters" or "this key has spent its minute's tokens" — those are facts with one correct
answer, so they are refused outright in quota with a 413 or 429,
before any detector runs or any token is spent. "This prompt looks like a repetition bomb" is a
judgement, so it goes through the detector contract like everything else and the Decision Engine
weighs it. LLM04 is split down that line: volume is enforced, shape is detected.
A client asking for too much output is clamped, not refused. The request is otherwise
legitimate and an operator's cost ceiling is not the caller's fault, so max_tokens is lowered
to the tenant's ceiling and the call proceeds. They get a shorter answer instead of an error.
The token budget reserves the likely cost, not the worst case. Reserving each request's full output ceiling would be safer per-request and wrong in aggregate: at the shipped defaults it caps a tenant near 9 requests a minute while the request limit advertises 60, for replies that are typically a fraction of the ceiling. So the expected cost is reserved and the real usage is charged afterwards. One request can overshoot by its own length before the window catches up — which is a better trade than throttling honest traffic to a fifth of its advertised rate.
Extraction is judged across requests, because it does not exist within one. Every other detector reads one prompt. Each prompt in a distillation harvest is individually ordinary — "summarize this review", ten thousand times with a different review. So this one keeps a bounded per-tenant history of fingerprints and asks whether the pattern is a sweep. It holds no prompt text: a 64-bit SimHash and a slot-blanked skeleton, nothing a gateway that hashes prompts by default should be ashamed to keep in memory.
Volume never blocks. Repetition is what a batch classification workload looks like, so every LLM10 finding is capped below the block band by construction — three times the detection threshold still only reaches 0.7 confidence. The honest claim is that it surfaces a pattern worth an operator's attention, not that it has caught a thief.
Detectors report; the Decision Engine decides. A detector returns findings with a
confidence and a severity and nothing else. One place — app/policy/engine.py — turns those
into allow / flag-and-log / sanitize / block. Scores combine with noisy-OR, so several
weak signals accumulate without any single detector being able to dominate.
Fail-open by default. Only high-confidence findings block. Ambiguous ones are allowed and
logged, because a false positive that breaks a real customer's support chatbot costs more than
one logged probe. Flip any tenant to fail_mode: "closed" when the opposite is true for you.
The gateway owns the system prompt. When a tenant configures one, VectorShield strips client-supplied system turns and prepends its own, with a unique canary token. A client cannot drop your instructions, and if the canary ever appears in a response you know the system prompt leaked.
A broken detector cannot take down the proxy. Detector exceptions are caught per-detector and logged. Rate-limiter failures allow the request. Log-write failures never fail a user's call.
Everything is per-tenant. Thresholds, fail mode, rate limits, system prompt, and content retention are all per-API-key, so an internal tool and a public chatbot can run different policies on one gateway.
Every setting is an environment variable; see .env.example for the annotated
list. The essentials:
| Variable | Default | Notes |
|---|---|---|
DEFAULT_PROVIDER |
ollama |
ollama (free/offline) or openai |
DATABASE_URL |
SQLite file | Use a postgresql+asyncpg:// URL in production |
REDIS_URL |
(empty) | Empty = in-process limiter. Set this if you run more than one worker. |
FAIL_MODE |
open |
open flags ambiguous traffic; closed blocks it |
BLOCK_THRESHOLD / FLAG_THRESHOLD |
0.85 / 0.45 |
The ambiguous band between them is what escalates to expensive stages |
OUTBOUND_SCANNING |
true |
Response inspection for secrets, PII, and prompt leakage |
DETECT_PII |
true |
The noisiest outbound signal; disable to keep only credentials and the canary |
STORE_CONTENT |
false |
true persists raw prompts and responses |
ADMIN_TOKEN |
(empty) | Empty disables the admin API entirely |
RATE_LIMIT_REQUESTS_PER_MINUTE |
60 |
Per API key, sliding window |
RATE_LIMIT_TOKENS_PER_MINUTE |
40000 |
Per API key. 0 disables the token budget |
MAX_PROMPT_CHARS |
48000 |
Refused with 413 before inspection. 0 = no cap |
MAX_MESSAGES |
200 |
Conversation length cap |
MAX_OUTPUT_TOKENS |
4096 |
Ceiling on max_tokens; larger requests are clamped |
EXPECTED_COMPLETION_TOKENS |
512 |
Reserved per request when the client names no max_tokens |
DETECT_RESOURCE_ABUSE |
true |
Content-shaped DoS detection (LLM04) |
DETECT_EXTRACTION |
true |
Behavioral extraction detection (LLM10) |
EXTRACTION_WINDOW_SECONDS |
600 |
How far back the behavioral profile looks |
EXTRACTION_HISTORY |
256 |
Fingerprints kept per tenant, bounded |
Every resource limit is also settable per tenant at creation — rate_limit_rpm,
rate_limit_tpm, max_prompt_chars, max_output_tokens — so an internal batch job and a public
chatbot can run under different ceilings on one gateway. 0 lifts a limit for that tenant;
omitting the field inherits the global default.
pip install -r requirements-dev.txt
pytest # test suite
ruff check . # lint
ruff format . # format
pip install -r requirements-dashboard.txt
streamlit run dashboard/ops.py # ops dashboard
The dashboard's query layer lives in dashboard/data.py and is covered by
tests; dashboard/ops.py is rendering only, so a chart cannot quietly
disagree with the query behind it. (It is not named app.py because streamlit run puts the
script's own directory first on sys.path, where it would shadow the gateway's app package.)
The shipped artifact (models/injection_clf.joblib, 704K) is committed so a fresh clone detects
attacks out of the box. It is fully reproducible:
python -m training.train_classifier # public datasets
python -m training.train_classifier --sources seed # fully offline
Held-out model-only scores: precision 0.924, recall 0.913, F1 0.918, false-positive rate 0.053, ROC-AUC 0.975, 0.074 ms per inference.
The artifact is a joblib pickle, so loading it executes code. It is built only from the public datasets listed above by the script in this repo — but treat it with the same trust you extend to the rest of the source, and rebuild it yourself if you would rather not load ours.
python -m benchmark.run_benchmark # regenerate the tables above
See CONTRIBUTING.md, including how to add a new detection rule.
praneeth132006/VectorShield is a public repo on GitHub by praneeth132006. Automated, evidence-based red teaming for AI agents and LLM applications — prompt injection, tool abuse, and MCP security testing.
It declares the MIT license on GitHub.
Its maker tagged it for macOS, Windows and Linux, or as Docker or cross-platform. That is declared by the maker; Take My Repo has not tested it.
Open "Take it" on its page: Take My Repo writes an install plan for your machine and hands it to your AI agent (Claude Code, Codex or Cursor), which asks you before each step. Take My Repo has not tested it on any machine.
Its last change on GitHub was on 2026-10-15. GitHub counts 1 open issue and pull requests. Take My Repo does not judge from that whether it is maintained.

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
Nobody has reviewed it on Take My Repo yet, which says nothing about its quality.
Reverse engineer anything with agents, from app behavior down to native binaries.
Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.
Knowledge infrastructure to make your agents smarter. Search, scrape and access 550+ data providers through one API.
Open-source Claude Skills for security — Red Team offense, Blue Team defense, and Ops — across every major tech stack. Vetted, risk-labeled, and validated before merge.

Free, open-source Markdown notes that live in your own GitHub repo. Wikilinks, backlinks, offline search, Mermaid diagram studio, PDF reading and real version history, with no lock-in.

NetMap: see where your internet traffic goes. Every server your computer talks to on a world map, with real names, encryption status and security alerts. Live capture or Wireshark files; exports to Google My Maps/Earth.
Targeted password-profiling wordlist generator for authorized password auditing and pentesting — OSINT-driven candidates, hashcat .rule output, policy-aware filtering, and strict explosion control. Written in Go.

Chrome extension that shows what a suspicious email is really hiding: real sender, real links, hidden text, trackers and risky attachments, explained in plain language.
This page is also available as structured data, with the same sources and dates.
/api/v1/resources/gh/praneeth132006/VectorShieldTake My Repo has not tested this on your machine. Requirements come from the project's own documentation.