Implement AVRT™ Firewall - Trauma-Informed AI Middleware with SPIEL™ and THT™ Protocols #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implements complete Ethics-as-a-Service (EaaS™) middleware system that intercepts LLM inputs and outputs to enforce safety, ethics, and reasoning protocols through SPIEL™ framework and THT™ protocol validation.
Core Components
src/ethics_layer.py- SPIEL™ framework evaluator: Safety (harm detection), Personalization (trauma-aware adaptation), Integrity (consistency), Ethics (bias mitigation), Logic (fallacy detection). Outputs weighted scores and violation severities.src/response_filter.py- THT™ protocol validator: Truth (fact verification), Honesty (uncertainty/hallucination detection), Transparency (AI disclosure). Auto-applies fixes like adding disclaimers and uncertainty language.src/voice_input.py- Voice-first analyzer: Extracts emotional state, trauma indicators, urgency level (normal/elevated/critical). Infers user preferences from linguistic patterns.src/middleware.py- Orchestrator: Chains voice→SPIEL™→LLM→THT™ pipeline. Blocks on critical violations in strict mode. Maintains audit log with statistics export.Architecture
Crisis Response
Detects critical urgency (suicide, harm keywords) and injects crisis resources (988 hotline, Crisis Text Line) into blocking responses. Trauma-aware framing avoids re-traumatization.
Testing
31 unit + integration tests covering safe flows, blocking scenarios, trauma detection, bias/fallacy detection, crisis response. Zero external dependencies (stdlib only). CodeQL clean.
Demo
Interactive CLI (
demo/avrt_demo_app.py) demonstrates 9 scenarios: safe interaction, harmful content blocking, trauma-aware response, crisis detection, bias detection, interactive mode, statistics, comprehensive reports.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.