Delfour-Insight-Economy

Delfour Insight Economy

A fully client-side prototype of the Delfour “insight economy” pipeline. Reasoning runs in your browser via eye-js (EYE in WebAssembly); orchestration is written in Python running in Pyodide. No servers, no build.


Quick start

  1. Open demo.html in a modern browser (Chromium, Firefox, Safari).
  2. Click Run Demo.
  3. Watch the Timeline, Insight, Runtime, Reason Why, Checks, and Audit panels populate.

What this demo shows


Architecture

Components in the browser

The “bus” (integration contract)

The original Python pipeline uses a file bus (data/bus/). In this browser demo, we mimic the same contract in memory as strings passed to eye-js. Conceptually, the bus “files” are:

“Bus file” (concept) Purpose
events.ttl Human-readable timeline events (pickup, auth, scan, audit, drop).
insight.ttl The retailer-facing neutral INSIGHT envelope.
odrl.ttl Policy derived from the INSIGHT (shown via Timeline; not physically written).
now.ttl [] ex:now "…ISO…" . — string time fact for rule comparisons.
request.ttl req:r1 odrl:action odrl:use; … purpose "shopping_assist".
scan.ttl The simulated scanned product [] shop:scannedProduct prod:… .
runtime_out.json Device banner JSON (headline, note, suggested alternative).
audit.ttl Derived act:Decision and close-out act:Duty entries.

In the browser we don’t write files; we compose these strings and feed them to eye-js runs. The UI shows their content (Insight, Audit, Banner).

Pipeline (steps inside demo.html)

  1. PICKUP — Build ctx: context (retailer, device, event, timestamp, expiresAt).
  2. AGENT-DIALOG — Stub capability exchange.
  3. DESENSITIZE — Rule: health:Diabetes ⇒ need:needsLowSugar true.
  4. DERIVE INSIGHT — From need + context → ins:Insight (metric/threshold/scope/expiry).
  5. POLICY — Derive ODRL from the Insight (permission/prohibition/duty).
  6. AUTHORIZATION BUNDLE — Single eye-js run combining:

    • the Insight
    • the policy-from-insight rule (policy is derived inside the same run)
    • now (ex:now)
    • request (use@shopping_assist)
    • expiry guard (marks ex:Expired when expiresAt < now)
    • enforcement rules (Allowed/Blocked)
    • audit rules (emit act:Decision, and at close act:Duty "delete_due")
  7. SHOPPING — If Allowed, rule suggests an alternative with lower sugar (math: built-ins; typed decimals).
  8. DROP & CLOSE-OUT — Re-evaluate expiry at the end and append a delete_due duty to the audit if applicable.

Data & rules inside the page

Prefix map used throughout:

ins:    https://example.org/insight#
ctx:    https://example.org/context#
need:   https://example.org/need#
health: https://example.org/health#
shop:   https://example.org/shop#
ex:     https://example.org/enforce#
act:    https://example.org/activity#
odrl:   http://www.w3.org/ns/odrl/2/
math:   http://www.w3.org/2000/10/swap/math#
str:    http://www.w3.org/2000/10/swap/string#
xsd:    http://www.w3.org/2001/XMLSchema#
schema: http://schema.org/

Panels (what to expect)


Customize the demo


How to host it


Troubleshooting


Why neutrality matters (privacy)

Retailer sees only the neutral INSIGHT and its ODRL policy. The “Reason Why” (diabetes → needs low sugar) remains private for the user/agent UI. ODRL constrains purpose (shopping_assist), prohibits sharing for marketing, and requires deletion at expiry.