Skip to content

pbathuri/ai-ethics-coach

Repository files navigation

AI Ethics Coach

Privacy-first Chrome extension for ChatGPT - improves prompts, audits responses for credibility, analyzes sources, and surfaces the energy cost of every reply.



TL;DR

Drop-in Chrome extension that lives alongside ChatGPT and does four things at once:

  1. Prompt Coach - inline tips while you type, Tab-to-apply, academic variants (Socratic · Research-backed · Lab · Citation-ready)
  2. Response Auditor - credibility score, flag list, source links on every assistant reply
  3. Source Analyzer - optional background fetch of referenced URLs → read-time + topic extraction (consent-gated)
  4. Energy Awareness - per-prompt and per-session energy estimates, surfaced in real-world units (LED bulb time, phone charges, kettle boils)

All enhancement logic runs locally in the page. The only network calls are the source-analyzer fetches, and those require explicit consent.


Why this exists

LLMs are graded on fluency; they should also be graded on source quality, citation integrity, and resource cost. Most students and researchers never see any of that. This extension surfaces it - next to the prompt box, next to the reply - so the cost of a sloppy prompt or an unsourced answer is visible at the moment of use, not after the fact.

Built originally as a campus-friendly companion: stores your institution's AI-use policy links, lets you check every reply against them, and keeps every byte of your prompt content on your machine.


Feature tree

flowchart LR
    U[User at<br/>ChatGPT] --> PC[Prompt Coach]
    U --> RA[Response<br/>Auditor]
    U --> SA[Source<br/>Analyzer]
    U --> EA[Energy<br/>Awareness]

    PC --> PCa[inline tips<br/>Tab-to-apply]
    PC --> PCb[Academic<br/>variants modal]
    PC --> PCc[Selection<br/>bubble actions]

    RA --> RAa[credibility<br/>score + flags]
    RA --> RAb[detected<br/>source URLs]
    RA --> RAc[reference<br/>enrichment]

    SA --> SAa[read-time<br/>estimate]
    SA --> SAb[title + topic<br/>extraction]
    SA --> SAc[learning<br/>bullets]

    EA --> EAa[per-prompt<br/>energy]
    EA --> EAb[session +<br/>conversation total]
    EA --> EAc[real-world<br/>equivalence]
Loading

Architecture

File Role
manifest.json MV3 config - content script on ChatGPT domains, background service worker, popup, options
content.js UI panel, modal enhancer, prompt coaching, energy heuristics, response auditor, selection bubble, DOM observers
background.js analyze(url) fetch + read-time + topic extraction; provider RPCs (grammarCheck, synonyms, llmSuggest, plagCheck) with strict timeouts + rate limits
options.html Policy-link storage in chrome.storage.sync
popup.html / popup.js Minimal popup stub
styles.css Panel + modal styling

Message flow

content.js  --chrome.runtime.sendMessage({ fn: "analyzeSources" })-->  background.js
background.js  --fetch() + strip HTML + readtime + title/headings-->  provider (optional)
background.js  --respond with array of source items-->  content.js --> renderAuditor()

Install & use

See HOW_TO.md for permissions, shortcuts, and troubleshooting. Short version:

  1. Chrome → chrome://extensionsDeveloper mode on
  2. Load unpacked → this folder
  3. Open ChatGPT → the floating AI Ethics Coach panel appears
  4. Type → inline tips; press Tab to apply
  5. Paste URLs in your prompt → side mini-panel shows read-time and learning bullets
  6. Enhance Prompt (Academic) → pick a variant → Insert
  7. Send a message → when the reply arrives, Scan latest reply → credibility, sources, energy, totals

Privacy

  • Prompt analysis is local. Tokens, inline tips, selection-bubble rewrites - none of it leaves the page.
  • Source analysis requires explicit user consent. The background worker fetches the URL, strips HTML, computes read-time, extracts <title> and headings, and discards the page body. No content is persisted beyond transient metadata.
  • Provider RPCs (optional LLM enrichment) are OFF by default. If enabled, API keys live in chrome.storage.session (cleared on browser restart).

Full policy: POLICY.md.


Energy heuristics

The extension approximates per-prompt and per-reply energy via token count and model profile, then converts to a relatable unit of your choice:

  • LED bulb: seconds a 7W LED would run
  • Phone charge: fraction of a typical smartphone charge
  • Kettle boil: fraction of one 3 kW kettle boil

Session and per-conversation totals accumulate beneath the panel. These are estimates - the point is to make the cost visible, not to be a billing meter.


Roadmap

  • Policy-aware prompts that auto-surface stored policyLinks and flag inline policy violations
  • Richer mascot sprite sets; perimeter runner animation
  • RAG-style local snippets - let the user provide PDFs/notes (kept on-device) to inform variants
  • Multi-model energy profiles + prompt-length budgets
  • Citation normalization (APA / MLA / Chicago) for detected references
  • Accessibility - keyboard-only modal controls, ARIA
  • Export pack - share prompt variants and audits as Markdown

Further reading

Doc Contents
ARCHITECTURE.md Deep dive into flows, snippets, observer logic
HOW_TO.md Install, permissions, hotkeys, troubleshooting
CONTRIBUTING.md Local setup, debug checklist, PR guidance
POLICY.md Author, ownership, privacy policy
TESTING_CHECKLIST.md Coverage across prompt, auditor, analyzer, energy
RELIABILITY_UPGRADES.md Hardening work log
FIXES_APPLIED.md Bug-fix log
DEBUG_STEPS.md Live-debugging recipes

Part of @pbathuri's project portfolio - AI-ethics tooling.

About

Privacy-first Chrome extension that audits ChatGPT replies for credibility, surfaces source read-time, coaches prompts, and shows per-reply energy cost

Topics

Resources

License

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors