Skip to content

Implement SBERT Vector Embeddings and Stateful Context for Guard Agent#8

Open
ttudii wants to merge 7 commits into
xoriors:mainfrom
ttudii:ttudii/llm-password-reset
Open

Implement SBERT Vector Embeddings and Stateful Context for Guard Agent#8
ttudii wants to merge 7 commits into
xoriors:mainfrom
ttudii:ttudii/llm-password-reset

Conversation

@ttudii
Copy link
Copy Markdown

@ttudii ttudii commented Dec 12, 2025

Overview

This PR delivers the final, feature-complete implementation of the G·U·A·R·D Authentication System.

It finalizes the transition from syntactic matching to a Semantic Engine using sentence-transformers (SBERT). The system is now fully Dockerized, operationally Stateful (handling ambiguous inputs via short-term memory), and documented for deployment.

Closes Issue: #4 (Experimental Semantic Auth)


Key Changes Implemented

1. Semantic Engine & Zero-Knowledge Storage

  • Integrated SBERT (all-MiniLM-L6-v2) for 384-dimensional vector embeddings.
  • Zero-Knowledge Architecture: Raw passphrases are vectorized immediately upon enrollment and discarded. Only the embeddings are stored.
  • Ambiguity Logic: Implemented the "Contextual Challenge" flow (Score 0.65–0.80 triggers a clarification request).

2. Database Architecture (SQLite)

Moved from flat files to a structured SQLite database (guard_secure.db) with three tables:

  • users: Credentials and lock status.
  • phrases: Serialized JSON vector embeddings.
  • auth_context: Short-term memory table to handle multi-turn ambiguous verifications.

3. DevOps & Deployment

  • Added Dockerfile for the FastAPI backend.
  • Added docker-compose.yml to orchestrate the backend and Ngrok tunnel automatically.
  • Secured configuration via .env file injection.

4. Documentation

  • Completely rewrote README.md to reflect the new architecture.
  • Added Frontend Guide.
  • Updated API Reference for all endpoints (/enroll, /verify, /user/{id}, /update).

Checklist

  • Backend Logic (SBERT + FastAPI)
  • Database Implementation (SQLite + Context Table)
  • Dockerization (Compose + Ngrok)
  • Zero-Knowledge Text Handling verified
  • Documentation & README updated

…d (semantic authentication already implemented); guard_openai.yaml file used as action in

guard; README.md file contains a short documentation about starting server and initiating tunnel connection; .gitignore prevents commiting large files from virtual environment or __pycache__; requirments.txt lists imports necessary for python server, useful when creating the virtual environment.
…ide the database to store a partial response
…el. Secured auth tokens by moving them to .env and updating .gitignore
@ttudii ttudii marked this pull request as ready for review December 13, 2025 11:19
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