Self-healing web data pipelines. Break the site. Watch the agent stitch it back.
Website Β· Architecture Β· ADRs Β· Healing protocol Β· Demo in 90 seconds Β· Changelog
One unedited loop, twice: the site redesigns, the agent synthesizes a validated repair, a human approves it at the gate, the pipeline goes green β then the site redesigns again and the healed spec heals again. No selector was written by a human.
Every team that extracts data from the web is on the same treadmill. The community's own numbers (r/webscraping):
- 10β15% of scrapers break every single week when target sites change structure.
- One person can maintain ~100 scrapers. Nobody can maintain 200.
- The worst failures are silent β the job exits 0 and writes empty or wrong rows into downstream pricing, dashboards, and models for days.
- A "simple" selector fix is never simple: triage β reproduce β rewrite β test β deploy β backfill β 90 engineer-minutes, every time, forever.
At a 50-scraper fleet that compounds to ~325 breaks and 487 engineer-hours ($46,000) a year of pure toil.
Reweave is an autonomous repair agent for that loop β with a human in command of every deploy:
ββββββββββββββ drift ββββββββββββββ validated ββββββββββββββ
fetch β SENTINEL β ββββββββββββββΆ β SURGEON β ββββββββββββββΆ β GATE β
ββββββΆ β detects β β synthesizesβ β a human β
β breakage β ββββββββββββββ β a repair β β approves β
ββββββββββββββ redeployed ββββββββββββββ βββββββ¬βββββββ
β² β
βββββββββββββββββββ spec v(N+1) activated ββββββββββββββββββ
- The Sentinel validates every extraction against golden records β facts known to be true. It catches silent failures: row-volume collapse, null-rate spikes, golden values that stopped being extractable.
- The Surgeon performs record-anchored selector synthesis: it re-locates the golden facts in the redesigned DOM, infers the new item containers, generalizes shared CSS signatures into candidate selectors, and accepts only candidates that reproduce the golden data. (Optional LLM candidates go through exactly the same validation β evidence over vibes.)
- The Gate quarantines the repair. A named human sees the full before/after selector diff, per-field match rates, and sample rows β and only their explicit approval activates spec
v(N+1). Every decision lands in an audit ledger with the actor's name.
The result: a 90-minute manual fix becomes a 30-second review-and-approve, and nothing ever deploys itself.
git clone https://github.com/vnmoorthy/reweave && cd reweave
pip install -e ".[dev]"
reweave serve # mission control on http://localhost:8321Then run the loop from the dashboard β or entirely from the CLI:
reweave run nimbusmart # healthy: 8 rows, confidence 100%
reweave chaos # the target site ships a redesign π₯
reweave run nimbusmart # drift detected β repair synthesized β parked at the gateOnboarding uses the same synthesis machinery as healing. You never write a selector: paste a URL plus 2+ golden examples (records you can literally see on the page), and the Surgeon derives and validates the extraction spec from your examples β then keeps it healed forever:
curl -X POST localhost:8321/api/sources -H 'Content-Type: application/json' -d '{
"name": "Books catalog (live web)",
"url": "http://books.toscrape.com/",
"golden": [
{"title": "A Light in the Attic", "price": 51.77, "url": "a-light-in-the-attic_1000/index.html"},
{"title": "Tipping the Velvet", "price": 53.74, "url": "tipping-the-velvet_999/index.html"},
{"title": "Sharp Objects", "price": 47.82, "url": "sharp-objects_997/index.html"}
]}'
# β spec v1 synthesized (article.product_pod / img.thumbnail@alt / p.price_color)
# β first run: 20 rows, 100% confidence β from 3 pasted examplesThe synthesis handles the real web's mess: it anchors values in node text
or in attributes (that catalog truncates long titles to "A Light in the β¦"
and carries the full title in title=/alt= β Reweave figures that out and
validates it against your examples). Same thing from the dashboard's
οΌ Add source button, or reweave add <url> --golden examples.json.
And the data actually flows: every run's rows are stored (last 20 runs per source), browsable in the dashboard's data drawer, and exportable:
curl "localhost:8321/api/sources/<source-id>/rows?fmt=csv" > rows.csv
reweave export <source-id> --csvAutopilot monitors every source continuously in the background
(REWEAVE_WATCH_INTERVAL, default 60s) β detection and repair-synthesis run
around the clock; deploys still wait for a human at the gate.
*A real site onboarded from 3 pasted examples: spec v1 synthesized, 20 rows extracted, autopilot watching.*
The repo ships with a breakable storefront (three complete front-end "eras" of the same site). In the dashboard:
| 1. Run pipeline | 8 products extracted, 100% confidence. |
| 2. β‘ Ship redesign | The storefront visibly redesigns in the embedded target-site pane β every selector the pipeline relied on is now gone. |
| 3. Run pipeline | The Sentinel reports the drift with named failures. The Surgeon anchors 8/8 golden records in the new DOM, synthesizes four new selectors, self-tests them, and parks a 100%-validated repair at the gate. |
| 4. Approve | Type your name (approvals are accountable), approve, and the pipeline is green again on spec v2 β with $142.50 of recovered toil booked to the impact ledger. |
| 5. Do it again | Ship the second redesign (a utility-class rebuild). The healed spec heals again. |
*The same store, before and after the chaos button. Titles, prices and links survive; every selector dies.*
*The gate, up close: per-field `old β new` selector diffs, validation match rates, extracted sample rows β and an approval that requires a name.*
Reweave treats "agent deploys its own code change" as the risk it is:
- Two independent gates. The MCP surface annotates
approve_healwithdestructiveHint, so a conforming harness (TrueForge's approval policy, Claude Code's permission prompt) interposes a human before the tool call β and Reweave's ownApprovalGatestill requires an accountable actor inside the call. Defense in depth. - Immutable spec versions. A heal never mutates history; it writes
v(N+1)and moves a pointer. Rollback is a pointer move. - Evidence-gated synthesis. A selector that cannot reproduce the golden records does not become a proposal, whether it came from the synthesizer or an LLM.
- Append-only audit ledger. Who approved what, when, and what it changed β queryable forever.
Reweave is an MCP server. Register it in TrueForge with the shipped approval policy and the reweave-operator skill pack:
The harness's agent triages incidents, reads proposals, and asks its human β the SKILL.md pack pins the operating rules (never approve without an explicit instruction; recommend rejection under 90% validation confidence).
For hostile production sites, set BRIGHTDATA_API_KEY and fetching routes through Bright Data Web Unlocker automatically β every page carries provenance (brightdata:zone, direct, demo:v2) into the audit log.
Reweave ships with the operational surface a production deployment expects:
docker compose up # containerized, /data volume, healthcheck built in
curl localhost:8321/api/health # {"status":"ok","version":"0.3.0","uptime_s":β¦}
curl localhost:8321/metrics # Prometheus: runs, drift, heals, $ recovered, per-status gauges- Webhooks β set
REWEAVE_WEBHOOK_URLand every lifecycle event (drift_detected,heal_pending,heal_approved,rollback, β¦) is POSTed as JSON with a Slack-compatibletextfield. Best-effort by design: a dead endpoint can never stall a pipeline run. - One-move rollback β
POST /api/sources/{id}/rollback(or theβ©button): immutable spec versions make a bad approval recoverable in seconds, with the actor recorded in the ledger. - API auth β set
REWEAVE_API_TOKENto require a bearer token on every/api/route;/api/healthstays open for load balancers and the dashboard prompts for the token once. - Fast where it counts β the whole repair path is milliseconds (measured, Apple M3, median of 25 runs): full heal synthesis 6.7ms, bootstrap-from-examples 2.3ms, drift assessment 0.04ms. Healing is effectively free next to one human context switch.
- Deploy guide Β· API reference Β· FAQ Β· Benchmarks
python -m pytest # 26 tests, including the full lifecycle E2EThe E2E suite proves the whole story: healthy β redesign β drift β synthesis β nothing deploys on rerun β human approves β healthy on v2 β impact booked. Plus: healing the second redesign from the healed spec, refusing to heal when the facts are gone, rejection flows, and double-approve conflicts.
reweave/
βββ reweave/ # the package
β βββ extractor.py # deterministic spec execution (all intelligence lives upstream)
β βββ sentinel.py # golden-record drift detection
β βββ surgeon.py # record-anchored selector synthesis
β βββ gates.py # accountable approval gate (manual/assisted/auto tiers)
β βββ pipeline.py # the observeβorientβdecide loop
β βββ registry.py # SQLite: immutable spec versions, incidents, audit ledger
β βββ fetch.py # Bright Data Web Unlocker / direct / demo, with provenance
β βββ impact.py # the toil-recovered ledger (defensible math, sourced)
β βββ server.py # FastAPI control plane
β βββ harness/mcp_server.py# dependency-free MCP stdio server
βββ dashboard/ # single-file mission control UI
βββ demo/ # the breakable storefront (3 structural eras) + golden records
βββ examples/ # real_source.py β monitor live books.toscrape.com
βββ skills/reweave-operator/ # TrueForge SKILL.md instruction pack
βββ harness/ # TrueForge MCP registration + approval policy
βββ tests/ # 26 tests incl. full-lifecycle E2E
βββ docs/ # architecture deep dive + ADRs + assets
β¦an LLM that rewrites my scraper? LLM output is a candidate source, not the mechanism (ADR-0001). Reweave's primary repair path is deterministic golden-record anchoring β explainable, token-free, offline-capable β and every candidate, LLM or synthesized, must reproduce your known-true data before it can even become a proposal. A hallucinated selector structurally cannot reach production.
β¦auto-healing scraper SaaS? Two differences: the approval gate is the product, not a checkbox β full before/after diffs, accountable actors, an append-only audit ledger, one-move rollback (ADR-0002, ADR-0003); and it's MIT-licensed infrastructure you run yourself, exposed as an MCP server any agent harness can drive.
β¦retrying with better selectors written by hand? That's the treadmill. The point is that the fix itself is synthesized, validated, and versioned β the human's job shrinks from "spend 90 minutes in devtools" to "read a diff and click approve."
- Drift prediction β schedule canary runs when a site's asset fingerprints churn, catching redesigns before the first bad row.
- Tiered autonomy graduation β per-source trust:
manualβassisted(auto-approve above a confidence bar, notify) βauto(approve, audit, allow instant rollback). - Fleet mode β hosted Postgres registry, hundreds of sources, team approvals.
- Beyond CSS β synthesis targets for JSON APIs, XHR payloads, and LLM-extraction prompts.
PRs welcome β see CONTRIBUTING.md. Security reports: SECURITY.md. MIT licensed.
Built in one day at the Agent Harness Hackathon (SF, Aug 2026) on TrueForge Β· Bright Data Β· Qodo. The pain is real β go read r/webscraping.
{ "mcpServers": { "reweave": { "command": "reweave", "args": ["mcp"] } }, "approvalPolicy": { "reweave": { "approve_heal": "always_ask" } } }