Prototype: Personal Trust‑Tier AI Assistant with Transparency + Ollama Integration #359
Kristi-Hugs
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
🛡️ Prototype: Personal Trust‑Tier AI Assistant with Transparency + Ollama Integration
📌 Idea
Most AI assistants today act like black boxes: they block or filter content without telling you why, and they rarely give you control over how open or strict they should be.
This prototype explores a personal trust‑tier bot designed for solo use:
Trust tiers (1–4): Strict → Balanced → Open → Peer
Transparency: Every block shows the exact rule, trigger, and rationale
Audit trail: Append‑only log of all prompts, responses, and blocks
Local LLM integration: Uses Ollama to run models like Mistral or Llama3 entirely on your machine
The goal: give the user full agency while keeping only hard harm categories blocked (self‑harm, violence, illegal activity). Everything else is surfaced with provenance and confidence.
🧩 Features
Tiered modes: Switch between Strict, Balanced, Open, and Peer
Rule engine: Blocks harmful prompts with clear explanations
Audit log: JSON lines file for every interaction
LLM responses: Calls a local Ollama model instead of echoing text
Extensible: Easy to add web retrieval, contradiction maps, or override workflows
⚙️ Prototype Code (Python CLI)
python
import json, re, datetime, subprocess
--- Config ---
RULES = [
{"id":"RULE_HARM","category":"self_harm","triggers":["suicide","kill","hurt"],"action":"block"},
{"id":"RULE_ILLEGAL","category":"illegal","triggers":["counterfeit","exploit","hack bank"],"action":"block"},
]
TIERS = {
1: "Strict",
2: "Balanced",
3: "Open",
4: "Peer"
}
LOG_FILE = "audit.log"
MODEL = "mistral" # change to "llama3" or any Ollama model you’ve installed
--- Helpers ---
def now(): return datetime.datetime.utcnow().isoformat()+"Z"
def log(entry):
with open(LOG_FILE,"a",encoding="utf-8") as f:
f.write(json.dumps(entry)+"\n")
def pre_check(prompt):
for rule in RULES:
for t in rule["triggers"]:
if re.search(r"\b"+re.escape(t)+r"\b",prompt,re.I):
return {"blocked":True,"rule":rule,"trigger":t}
return {"blocked":False}
def run_llm(prompt, model=MODEL):
# Calls local Ollama model
result = subprocess.run(["ollama","run",model,prompt],
capture_output=True,text=True)
return result.stdout.strip()
--- Main loop ---
def run_session(tier=2):
print(f"Trust Tier {tier}: {TIERS[tier]}")
while True:
prompt = input("\nYou> ")
if prompt.lower() in ["quit","exit"]: break
if name=="main":
run_session(tier=2) # start in Balanced mode
🚀 How to Run
Install Ollama.
Pull a model:
bash
ollama pull mistral
or
bash
ollama pull llama3
Save the script as trustbot.py.
Run:
bash
python trustbot.py
Type prompts, switch tiers by editing the run_session(tier=…) line.
🛠 Roadmap
Web retrieval: Add a fetcher to pull public web pages and feed them into the model.
Contradiction maps: Extract claims from multiple sources and visualize conflicts.
Override workflow: Let the user approve one‑time exceptions with full logging.
UI layer: Build a simple TUI or web dashboard for tier switching and audit review.
💡 Discussion Prompt
How would you extend this prototype?
Should trust tiers be user‑driven only, or adaptive based on context?
What’s the best way to visualize contradictions and provenance for solo users?
Beta Was this translation helpful? Give feedback.
All reactions