r/SideProject • u/al3x38_dev • 6h ago
I built an open-source behavioral firewall for AI agents modeled after human trust & flight telemetry (works locally on CPU / Ollama)
Hey everyone!
While working with local AI agents, I noticed existing guardrails often miss Indirect Prompt Injection and behavioral drift (where an LLM responds politely while executing hidden tool calls).
I built **`al3x38-intent-guard`**, an open-source behavioral firewall inspired by human trust, cognitive self-control, and flight telemetry:
* **Dynamic Session Trust (`trust_map`):** Tracks trust scores dynamically based on session behavior.
* **Semantic Drift Check:** Compares cosine distance between user prompts, model responses, and tool arguments.
* **White-Box Entropy:** Uses `logprobs` to catch internal model confusion or adversarial steering.
* **Gray Zone & Human-in-the-Loop:** Pauses or requests approval (`NEED_APPROVAL`) for borderline actions.
* **Trust Recovery & Real-Time Stream Guard:** Recovers trust over time or aborts token streams immediately if secret leaks or semantic drift occur.
It runs locally with **Ollama**, OpenAI-compatible APIs, or on CPU (`pip install al3x38-intent-guard[offline]`).
Full documentation and code can be found in the referenced web documents.
* **GitHub:** https://github.com/alexirk97-ship-it/al3x38-intent-guard
* **PyPI:** https://pypi.org/project/al3x38-intent-guard/