DEV Community

parteek yadav
parteek yadav

Posted on

ScopeGuard: I built an AI scope desk that refuses to give a contract verdict

Hacktoberfest Open-Source AI Challenge Week 2: Side Hustle Submission đź’¸

Hacktoberfest Open-Source AI Challenge: Week 2

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 2: Side Hustle.

What I Built

“Could we also add a small online shop?”

For a freelance web developer, that sentence could mean a useful next project—or a difficult conversation about what the current project includes.

I built ScopeGuard, a local-first scope desk that compares an original brief with new requests, shows relevant evidence, and prepares an editable, polite change-order discussion draft.

The intended buyer is an independent developer or small web studio that repeatedly prepares these conversations. The business hypothesis is saved preparation time and clearer client communication. It is not validated: there are no users, payments, pricing experiments, or revenue to report.

As a student building this project, the most useful lesson was that an AI feature becomes more credible when it admits what it cannot decide. ScopeGuard does not give a contract verdict. It helps someone find passages worth reading and questions worth asking.

Demo

Open ScopeGuard.

Fill the synthetic example, explicitly load AI, then compare the requests. The first load downloads roughly 46 MB of primary decoded runtime/model assets, plus small configuration files; actual transfer and browser resources vary.

Try a brief that includes a contact form and project gallery but explicitly excludes an online shop. Then ask for a contact form, an online shop, and a newsletter. Inspect the evidence—not just the review labels—and edit the discussion draft before sharing anything.

Nothing is automatically sent, priced, approved, or signed. Inputs are not automatically saved.

Code

Source on GitHub.

The original application code is MIT licensed. Model/runtime attribution, license texts, tests, and actual smoke-test output are included. The model weights are downloaded on demand, not committed to the repository.

How I Built It

The app has no application backend or build step: separate interface, stylesheet, browser orchestration, and pure comparison engine files can be served as a static site.

Its AI core is Xenova/all-MiniLM-L6-v2, an ONNX conversion of sentence-transformers/all-MiniLM-L6-v2, through Transformers.js 3.7.2. The model revision is pinned, and the app requests q8 quantization with WebAssembly execution.

Each brief passage and request gets a normalized, mean-pooled embedding. Cosine similarity selects the closest brief passages. Experimental thresholds produce review labels, not confidence probabilities. A separate bounded whole-token rule highlights explicit-exclusion candidates. The editable discussion draft is a deterministic template, not generated by an LLM.

Pasted text is treated as data and rendered through safe DOM construction. Inputs above 80 lines/sentences are rejected rather than silently shortened. Quantities, deadlines, conditions, and the full agreement still need human review.

The result that taught me the most

19 Node tests pass, including synthetic fixtures for thresholds, exclusion matching, and validation. These are logic tests, not model accuracy measurements.

A separate real-inference smoke test ran the pinned browser bundle’s WASM backend under Node with a test-only environment shim. It produced 384-dimensional embeddings for three synthetic requests:

  • Contact form: 0.603085, labelled ambiguous, despite being included alongside a gallery in the brief.
  • Online shop: 0.646986, flagged for exclusion review because the explicit exclusion matched.
  • Newsletter: 0.349597, labelled a potential scope change.

The contact-form result is a limitation, not a benchmark win. Sentence composition changed the signal enough to miss “possible coverage.” I retained that evidence rather than tuning around three examples. The deployed GitHub Pages app was also tested in Strawberry Browser: model loading succeeded, the four-request synthetic example produced evidence cards, and an editable discussion draft appeared. This checks one browser workflow—not broad browser compatibility or real-contract accuracy.

AI assistance

Strawberry provided substantial AI assistance with coding, testing, and writing. My role is learning from the implementation and reviewing its behavior and limitations—not claiming manual authorship of every line or model tuning.

Why Does Open Innovation Matter?

The model card declares Apache-2.0. Open weights and an open inference framework make it possible to pin the model, inspect the comparison logic, and replace components without depending on a paid per-call inference service.

After loading, the application computes embeddings on-device rather than sending brief text to a hosted inference API. That is useful for a client-document workflow, but “local-first” is not a blanket privacy promise: runtime/model downloads contact external providers, disclose normal network metadata, and require supply-chain trust. Browser caching is best effort; a fresh load is not guaranteed offline.

The opportunity is not automated contractual certainty. It is an inspectable tool that helps freelancers start a better conversation—and leaves the decision with them.

Top comments (0)