Skip to content

amirrezaalasti/webcontextinterface

Repository files navigation

WCI β€” Web Context Interface

License: MIT Documentation Evaluation dataset (Zenodo)
npm @webcontextinterface/spec npm @webcontextinterface/distiller npm @webcontextinterface/bridge npm @webcontextinterface/context npm @webcontextinterface/core
npm downloads/month @webcontextinterface/spec npm downloads/month @webcontextinterface/distiller npm downloads/month @webcontextinterface/bridge npm downloads/month @webcontextinterface/context npm downloads/month @webcontextinterface/core

WCI (Web Context Interface) is a three-layer open standard that augments standard HTML with structured semantic metadata, compresses it into agent-optimised context, and provides a typed action protocol β€” shipped as compact modular layers (~2–12 KB minified each).

🏷️ Semantic HTML annotations (data-wci-*)
βš—οΈ Token-efficient distillation for LLM context
⚑ Typed browser actions via WciBridge
πŸ›‘οΈ Site-wide agent policy (wci.txt / wci.json / wci.md)
πŸ§ͺ 50-scenario grounding benchmark (see below) + Zenodo dataset

WCI architecture: data-wci-* markup, distiller, LLM context, WciBridge actions, and site context files

Additionally, three site root files give agents site-wide grounding before they touch a single page β€” analogous to robots.txt:

File Purpose
/wci.txt Directive file β€” allow/deny scopes, rate limits, auth
/wci.json Structured manifest β€” task flows, scope descriptors
/wci.md Narrative context β€” injected into LLM system prompt

🌐 Documentation website

Live (Vercel): webcontextinterface.vercel.app Β· Demo

Live (GitHub Pages): amirrezaalasti.github.io/webcontextinterface Β· Demo

Static site (VitePress) with guides, API reference, and the interactive demo.

npm run docs:dev          # docs only β†’ http://localhost:5174
npm run website:build     # docs + demo β†’ docs/.vitepress/dist
npm run website:preview   # preview the full site locally

Deploy: push to main β€” Vercel rebuilds automatically (vercel.json). For GitHub Pages, enable Settings β†’ Pages β†’ Source: GitHub Actions, then the deploy workflow runs on each push.

Full concept & implementation reference: agent.md β€” vision, agentic interface/AX, spec, APIs, and codebase map.

NotebookLM (shareable overview): WCI notebook β€” audio summaries, Q&A, and briefings grounded in the paper, specification, and benchmark materials (Google sign-in required).

Markdown sources live in docs/. Quick links:

Guide Topic
πŸš€ Getting started Install, annotate, distil, dispatch
πŸ—οΈ Architecture Layers and data flow
πŸ“‹ Specification data-wci-* and site files
βš—οΈ Distillation WciDistiller
⚑ Action protocol WciBridge / ActionResult
πŸ›‘οΈ Site policy wci.txt and policy engine
πŸ€– LLM integration Closed-loop agent patterns

πŸ“¦ Install

Monorepo (development):

npm install
npm run build

npm packages (v1.2.0):

npm install @webcontextinterface/core@^1.2.0

Or install layers individually: @webcontextinterface/spec, @webcontextinterface/distiller, @webcontextinterface/bridge, @webcontextinterface/context.


🧩 Packages

Package Version Description
@webcontextinterface/spec 1.2.0 TypeScript types, role enum, readWciNodeSpec()
@webcontextinterface/distiller 1.2.0 Pruner, JSON/Markdown serializers, WciDistiller
@webcontextinterface/bridge 1.2.0 WciBridge, policy enforcement, ActionResult
@webcontextinterface/context 1.2.0 WciContextLoader, PolicyEngine, wci.txt parser
@webcontextinterface/core 1.2.0 All-in-one SDK β€” re-exports every package

πŸš€ Quick start

1. Annotate your HTML

<section
  data-wci-role="landmark"
  data-wci-id="registration-form"
  data-wci-desc="New user registration β€” capture email, password, accept terms">

  <input
    data-wci-id="email-input"
    data-wci-role="form"
    data-wci-desc="User's email address β€” must be unique"
    data-wci-action="fill"
    data-wci-required="true"
    data-wci-state='{"value":"","valid":null}'
    data-wci-scope="registration-form"
    data-wci-priority="1"
  />

  <button
    data-wci-id="submit-btn"
    data-wci-role="action"
    data-wci-desc="Submit registration β€” creates the account"
    data-wci-action="click"
    data-wci-precondition="All required fields must be valid"
    data-wci-scope="registration-form"
    data-wci-priority="1"
  >Create Account</button>

</section>

2. Distil

import { WciDistiller } from '@webcontextinterface/distiller';

const distiller = new WciDistiller({ format: 'json', scope: 'registration-form' });
const view = distiller.distilJSON(document);

3. Dispatch actions

import { WciBridge } from '@webcontextinterface/bridge';
import { WciContextLoader } from '@webcontextinterface/context';

const ctx = await WciContextLoader.load('https://your-site.com');
const bridge = new WciBridge();
bridge.setPolicy(ctx.policy);
const result = await bridge.fill('email-input', 'user@example.com');
await bridge.click('submit-btn');

4. Site context

const ctx = await WciContextLoader.load('https://your-site.com');
// Policy is enforced on bridge.dispatch when set via bridge.setPolicy(ctx.policy).
// assertScopeAllowed is optional for pre-flight checks on planned scopes:
ctx.policy.assertScopeAllowed('checkout');

🏷️ data-wci-* attribute reference

Attribute Type Description
data-wci-id string Stable unique ID
data-wci-role enum action Β· form Β· display Β· nav Β· status Β· landmark
data-wci-desc string LLM-optimised description
data-wci-action enum click Β· fill Β· select Β· check Β· upload Β· submit Β· navigate
data-wci-state JSON Current observable state snapshot
data-wci-precondition string Natural language guard condition
data-wci-required boolean Must be satisfied before form submission
data-wci-options JSON array Choices for select/radio groups
data-wci-emit string Custom DOM event fired after interaction
data-wci-scope string Parent landmark scope ID
data-wci-hidden boolean Prune this node from distilled output
data-wci-priority 1–5 Importance ranking (1 = primary CTA)

See Specification for details.


πŸ”§ Development

npm install          # install workspaces
npm run build        # build all packages (tsup β†’ dist/)
npm run lint         # TypeScript check
npm run demo         # interactive demo at http://localhost:5173
npm run docs:dev         # documentation at http://localhost:5174
npm run website:build  # full site (docs + demo) for deployment

Repository layout

WIA_framework/
β”œβ”€β”€ docs/                 # Full documentation
β”œβ”€β”€ packages/
β”‚   β”œβ”€β”€ spec/
β”‚   β”œβ”€β”€ distiller/
β”‚   β”œβ”€β”€ bridge/
β”‚   β”œβ”€β”€ context/
β”‚   └── core/             # Umbrella SDK
β”œβ”€β”€ demo/
β”œβ”€β”€ examples/
└── paper/                # Research paper (LaTeX)

πŸ§ͺ Benchmark

Official evaluation dataset (Zenodo): 10.5281/zenodo.20434088 β€” Evaluation Dataset for WCI (CC BY 4.0). Download scenarios.zip for all 50 single-shot grounding scenarios with five representations each (raw HTML, DOM outline, interactive candidates, WCI full, WCI grounding).

The same scenario tree ships in-repo under demo/scenarios/ β€” 5 handmade scenarios (flight booking, banking, checkout, dashboard, social media) plus 45 synthetic layouts. The published harness scores multi-step task grounding (meta.tasks.multiStep, primary task) across those five context formats via OpenRouter.

npm run eval:verify
npm run eval:multistep -- --models=gpt5Nano --scenarios=flight-booking,banking
npm run eval:merge-leaderboard   # update demo/public/eval-results-all.json from multistep reports
npm run demo                     # live leaderboard on the website

πŸ“ Citation

If you use WCI in research or publications, please cite:

Amirreza Alasti β€” amirrezaalasti@gmail.com

@software{Alasti_WCI_Web_Context_2026,
  author = {Alasti, Amirreza and Ghandeharioun, Niloufar and Karras, Oliver},
  license = {MIT},
  month = may,
  title = {{WCI: Web Context Interface}},
  url = {https://github.com/amirrezaalasti/webcontextinterface},
  version = {1.2.0},
  year = {2026},
  note = {Contact: amirrezaalasti@gmail.com}
}

Evaluation dataset:

@dataset{wci_eval_dataset_2026,
  author       = {Alasti, Amirreza},
  title        = {Evaluation Dataset for WCI: The Web Context Interface for Agentic Web Automation},
  year         = {2026},
  publisher    = {Zenodo},
  doi          = {10.5281/zenodo.20434088},
  url          = {https://doi.org/10.5281/zenodo.20434088}
}

A machine-readable citation file is also provided in CITATION.cff.


🀝 Contributing

Contributions are welcome! Please read our Contributing Guidelines to learn about our branch naming conventions, development setup, and Conventional Commit principles.


βš–οΈ License

MIT β€” Open Standard. See LICENSE.

About

A lightweight open standard that augments HTML with semantic metadata, turning standard web pages into highly optimized context for AI agents.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors