Extends the regex-only pre-check into three stages: regex scan, then embedding-similarity search against known injection examples, and only if that score clears a threshold, an LLM judge confirms intent before blocking. Catches paraphrased injection attempts the fixed regex patterns miss without paying for an LLM call on every query. Validated end-to-end against a real Anthropic API key and a live Qdrant instance: the new path correctly blocked a paraphrased injection (audit log confirms rule_id: injection.semantic_llm_judge) while a benign near-miss passed through without ever reaching the LLM judge. Also documents two reliability issues found while testing with claude-haiku-4-5 (a non-deterministic policy verdict and a forced tool-call loop that can end without calling any tool) in docs/SAFETY_WRITEUP.md section 6 -- unrelated to this change, but worth recording since they were found in the same pass. Co-Authored-By: Claude Sonnet 5 <[email protected]>
14 lines
436 B
Bash
14 lines
436 B
Bash
# Required
|
|
ANTHROPIC_API_KEY=
|
|
|
|
# Optional overrides (defaults shown)
|
|
MARITIME_LLM_MODEL=claude-sonnet-5
|
|
MARITIME_QDRANT_URL=http://localhost:6334
|
|
MARITIME_COLLECTION_NAME=maritime_kb
|
|
MARITIME_EMBEDDING_CACHE_DIR=.fastembed_cache
|
|
MARITIME_TOP_K=4
|
|
MARITIME_SEMANTIC_INJECTION_THRESHOLD=0.60
|
|
MARITIME_AUDIT_LOG_PATH=data/audit_log.jsonl
|
|
MARITIME_DOCUMENTS_DIR=src/knowledge/documents
|
|
MARITIME_GOLDEN_DATASET_PATH=data/golden_dataset.jsonl
|