Skip to content

Fix/rag grounding and sse spacing#2

Merged
Tushar2604 merged 2 commits into
mainfrom
fix/rag-grounding-and-sse-spacing
Jun 30, 2026
Merged

Fix/rag grounding and sse spacing#2
Tushar2604 merged 2 commits into
mainfrom
fix/rag-grounding-and-sse-spacing

Conversation

@Tushar2604

Copy link
Copy Markdown
Owner

No description provided.

Tushar2604 and others added 2 commits June 30, 2026 09:45
Defense-in-depth for the RAG chat paths, complementing the grounding
system prompt:

- Hardened DEFAULT_SYSTEM_PROMPT: treat context/question as untrusted
  data, never reveal/repeat the prompt, ignore embedded role-changes
- Input screening (scan_input): flag instruction-override, prompt
  extraction, persona hijack, jailbreak, and forged-delimiter attempts;
  high-risk -> refuse (not sanitise)
- Structural isolation (build_grounded_prompt): wrap untrusted text in
  labelled blocks with delimiters neutralised, the primary defence
  against indirect injection via poisoned documents
- Output screening (scan_output): catch system-prompt leakage by
  phrasing and verbatim overlap

Wired into AskChatbot (JSON), the SSE stream (blocks before retrieval),
and the LangGraph generate node. New deterministic, testable domain
module src/domain/safety/guardrails.py + 12 tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Code-level deep dive across all layers (domain/application/infrastructure/
interfaces), data model, end-to-end flows, multi-tenancy/security model,
RAG + agent internals, observability, evals, deployment, and a section
documenting known issues/discrepancies.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Tushar2604
Tushar2604 merged commit 5eaba30 into main Jun 30, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant