adityasingh2400/Resonant

Resonant — live commerce intelligence

0

stars

25

commits

Python

primary language

Jul 25, 2026

updated

README

Resonant

An AI livestream seller that learns which selling strategies actually close.

Paste a product page link. Resonant becomes the host — answering every comment and DM live, in the viewer's language, around the clock. Every answer it gives is scored by what the viewer did next, and the strategy it uses tomorrow is built from what sold today.

⚖️ License: PolyForm Noncommercial 1.0.0 — commercial use is FORBIDDEN. Source-available, not open source. You may read, study, and use this code for personal, educational, or research purposes only. Any commercial use — including internal business use, hosted services, or building competing products — requires a separate written license. See LICENSE and NOTICE.

Copyright 2026 Aditya Singh. All rights reserved.


The problem

Live selling converts at ~30% — roughly 10× a static product page. It's a $68B market in the US. But a human host costs $12,000/month for a small business, works 8 hours a day, and can't sell into other time zones or other languages.

And there's a fourth problem nobody prices in: it's extremely difficult to figure out which selling strategies actually make people buy. A host says a hundred things in a stream, and nobody is tracking which one closed the sale. That knowledge never accumulates, and it never transfers to the next seller.

Resonant is built around that fourth problem. Being cheaper is the wedge; knowing what works is the point.


How it works

  product page URL
        │
        ▼
  ┌───────────────┐   price · materials · features · category
  │   CHANNEL3    │   commission rate · imagery
  │  (substrate)  │   ── the only facts Resonant may state ──
  └───────┬───────┘
          ▼
  ┌─────────────────────────────────────────────────────────┐
  │                    COMMERCE GRAPH                        │
  │   archetype │ intent │ channel │ stage  →  strategy      │
  │   deterministic argmax over scores — no LLM in the        │
  │   retrieval path                                          │
  └───────┬─────────────────────────────────────┬───────────┘
          │ strategy + proven lines             │ outcome
          ▼                                     │ re-weights
  ┌───────────────┐                             │ the path
  │  ONE LLM CALL │  intent · language · draft  │
  │ classify+draft│  (writes words only —        │
  └───────┬───────┘   never picks the strategy)  │
          ▼                                     │
  ┌───────────────┐                             │
  │   TWO-TIER    │  strategy → treatment →     │
  │     STAGE     │  clip bucket + TTS          │
  └───────┬───────┘                             │
          ▼                                     │
    viewer reacts ─────────────────────────────┘
    (buys · DMs · replies · isn't convinced)

The separation is the whole design. The graph decides how to sell. The language model only decides how to word it. Every decision is inspectable arithmetic rather than a model's opinion, and it resolves in microseconds.

1 · Ingestion

A pasted retailer URL resolves through Channel3 — exact catalog lookup first, then semantic search on the URL slug using the domain as a brand hint, then a cached sample so the stage always has something to sell. The normalized record carries price, materials, key features, availability, imagery, the commission rate, and the product category, which maps to the archetype the graph indexes on.

That payload is also the guardrail: it's the only set of facts the seller may claim.

2 · The graph

A fixed five-column vocabulary, never invented at runtime:

Product → Customer context → Strategy → Treatment → Outcome
  • Intents — question · price_objection · skepticism · compliment · other
  • Strategies — evidence_first · aspiration · social_proof · urgency · reassurance
  • Treatments — calm_confident · energetic · warm
  • Outcomes — cta_click · dm_opened · positive_reply · not_convinced · no_response

Strategy selection is an argmax over scores on the context key archetype|intent|channel|stage. Every interaction stores a connected path, and every outcome re-weights the edges on the path that produced it:

OutcomeWeight
Purchase click+2.0
DM opened+1.0
Positive reply+0.5
Answered at all+0.1
No response−0.25
"Not convinced"−1.0

When enough negative evidence accumulates, the leading strategy for that context changes — and because the graph's strategy table is injected into the prompt, the seller's script changes with it, mid-stream. The UI surfaces that moment explicitly, and any posture card opens the verbatim prompt the model last received.

Responses whose paths ended in a purchase become proven lines, fed back verbatim into later drafts.

Because the context key starts with the product archetype rather than the seller, what the graph learns about a category is portable: every new seller in that category starts from the playbook that already won.

3 · Delivery

The chosen strategy carries a treatment, and the treatment selects a clip bucket — so the graph picks the performance, not just the words.

The stage runs two tiers. Tier 0 is an always-playing idle loop that never stops. Tier 1 is the reactive layer, crossfading over it in 120 ms and fading back out over 500 ms to reveal the idle underneath, so there is no re-entry hitch. The 120 ms is tuned: longer crossfades expose two mouth poses at half opacity each, and a short blur pulse masks the residual mismatch.

When a lip-sync pod is reachable, responses upgrade to lip-synced renders. When it isn't, they degrade to a treatment clip plus streamed TTS, with no user-visible error.

4 · Cross-channel

Comments and DMs run the same pipeline. A DM carrying a price objection or skepticism is promoted to a proactive on-stream mention about 12 seconds later — a move a human host and moderator can't coordinate live.


What's real, what's prepared, what's simulated

Stated plainly, because the distinction matters when evaluating this.

RealProduct ingestion, intent classification, strategy selection, script generation, TTS, the clip stage, outcome recording, policy shifts, the commission figure (catalog price × catalog commission rate), and the latency numbers on screen
Prepared, disclosedStarting strategy weights in priors.json — hand-authored from UGC motif research on one product archetype, attributed in the file, and overwritten by live evidence. Also the avatar clip library, which is rendered ahead of time, and a cached product record used when the catalog is unreachable
Replayed, labeledbackend/scripts/demo_replay.py replays a scripted earlier-in-the-stream sequence to age the graph. Every replayed event is flagged replay in the UI, and the latency readout shows replay rather than an invented millisecond count
Modeled, not measuredMonthly running-cost figures. They come from projected provider usage, not from a billed month of operation
Not builtReal platform integrations (the shopper page stands in for a live chat feed; the pipeline behind it is unchanged). Purchase attribution beyond the click. Multi-stream isolation

No video is generated at runtime. Body, pose, and lighting are rendered ahead of time; only the mouth region is ever synthesized live, and only on the lip-sync tier.


Run it

Prerequisites — Python 3.11+, Node 18+, and a .env built from .env.example. At minimum: CHANNEL3_API_KEY for ingestion, ELEVENLABS_API_KEY + ELEVENLABS_VOICE_ID for voice, and one LLM credential. The provider chain tries Anthropic, Bedrock, OpenAI, and Gemini in order, then falls back to a deterministic rule path — so the loop never hard-fails on a missing key, it just gets less fluent.

make bootstrap     # one-time: venv, dependencies, checks
make start         # backend :8000 + dashboard :5173
make stop
SurfaceURLWhat it's for
Dashboardlocalhost:5173Onboarding, the stage, the operator view
Control roomlocalhost:8000/brainConstellation, script posture, tickers, live prompt
Shopper pagelocalhost:8000/watchWhat a viewer sees — chat, DMs, buy
API docslocalhost:8000/docs

Quick check — onboard a product, then ask it something:

curl -X POST localhost:8000/api/resonant/onboard \
  -H 'Content-Type: application/json' \
  -d '{"url":"https://<retailer>/<product-page>"}'

curl -X POST localhost:8000/api/resonant/event \
  -H 'Content-Type: application/json' \
  -d '{"channel":"chat","client_id":"c1","username":"alex","text":"is it real leather?"}'

curl "localhost:8000/api/resonant/query?intent=price_objection"

That last call returns the selected strategy, the score of every alternative, the confidence, and the interactions that produced it — the same deterministic explanation the UI shows.

pytest backend/tests -q

Repo map

PathWhat's in it
backend/agents/graph_engine.pyThe commerce graph — vocabulary, scoring, policy shifts, persistence
backend/agents/brain_llm.pyThe classify-and-draft call, prompt construction, provider chain
backend/agents/channel3.pyProduct ingestion, URL resolution, category → archetype mapping
backend/resonant_routes.pyEvent pipeline, graph endpoints, page routes
backend/agents/avatar_director.pyTwo-tier stage orchestration
backend/static/brain.htmlControl room — constellation, posture panel, prompt modal
backend/static/watch.htmlShopper page and the clip stage
backend/priors.jsonHand-authored starting weights, with sources
dashboard/Operator dashboard (Vite + React)
backend/tests/Graph, route, and endpoint smoke tests

The graph is the place to start reading — graph_engine.py is small, has no framework in it, and every claim above about determinism is checkable in select_strategy.


License

Source-available, not open sourcePolyForm Noncommercial 1.0.0.

  • ✅ Personal use, research, education, evaluation, hobby projects
  • ❌ Any commercial use, including competing products, internal business use, hosting Resonant as a paid service, or training models on this codebase commercially

For commercial licensing, contact the repo owner.

Copyright 2026 Aditya Singh. All rights reserved.

Contributors

adityasingh2400

25 commits

adityasingh2400/Resonant

Resonant — live commerce intelligence

0

stars

25

commits

Python

primary language

Jul 25, 2026

updated

README

Resonant

An AI livestream seller that learns which selling strategies actually close.

Paste a product page link. Resonant becomes the host — answering every comment and DM live, in the viewer's language, around the clock. Every answer it gives is scored by what the viewer did next, and the strategy it uses tomorrow is built from what sold today.

⚖️ License: PolyForm Noncommercial 1.0.0 — commercial use is FORBIDDEN. Source-available, not open source. You may read, study, and use this code for personal, educational, or research purposes only. Any commercial use — including internal business use, hosted services, or building competing products — requires a separate written license. See LICENSE and NOTICE.

Copyright 2026 Aditya Singh. All rights reserved.


The problem

Live selling converts at ~30% — roughly 10× a static product page. It's a $68B market in the US. But a human host costs $12,000/month for a small business, works 8 hours a day, and can't sell into other time zones or other languages.

And there's a fourth problem nobody prices in: it's extremely difficult to figure out which selling strategies actually make people buy. A host says a hundred things in a stream, and nobody is tracking which one closed the sale. That knowledge never accumulates, and it never transfers to the next seller.

Resonant is built around that fourth problem. Being cheaper is the wedge; knowing what works is the point.


How it works

  product page URL
        │
        ▼
  ┌───────────────┐   price · materials · features · category
  │   CHANNEL3    │   commission rate · imagery
  │  (substrate)  │   ── the only facts Resonant may state ──
  └───────┬───────┘
          ▼
  ┌─────────────────────────────────────────────────────────┐
  │                    COMMERCE GRAPH                        │
  │   archetype │ intent │ channel │ stage  →  strategy      │
  │   deterministic argmax over scores — no LLM in the        │
  │   retrieval path                                          │
  └───────┬─────────────────────────────────────┬───────────┘
          │ strategy + proven lines             │ outcome
          ▼                                     │ re-weights
  ┌───────────────┐                             │ the path
  │  ONE LLM CALL │  intent · language · draft  │
  │ classify+draft│  (writes words only —        │
  └───────┬───────┘   never picks the strategy)  │
          ▼                                     │
  ┌───────────────┐                             │
  │   TWO-TIER    │  strategy → treatment →     │
  │     STAGE     │  clip bucket + TTS          │
  └───────┬───────┘                             │
          ▼                                     │
    viewer reacts ─────────────────────────────┘
    (buys · DMs · replies · isn't convinced)

The separation is the whole design. The graph decides how to sell. The language model only decides how to word it. Every decision is inspectable arithmetic rather than a model's opinion, and it resolves in microseconds.

1 · Ingestion

A pasted retailer URL resolves through Channel3 — exact catalog lookup first, then semantic search on the URL slug using the domain as a brand hint, then a cached sample so the stage always has something to sell. The normalized record carries price, materials, key features, availability, imagery, the commission rate, and the product category, which maps to the archetype the graph indexes on.

That payload is also the guardrail: it's the only set of facts the seller may claim.

2 · The graph

A fixed five-column vocabulary, never invented at runtime:

Product → Customer context → Strategy → Treatment → Outcome
  • Intents — question · price_objection · skepticism · compliment · other
  • Strategies — evidence_first · aspiration · social_proof · urgency · reassurance
  • Treatments — calm_confident · energetic · warm
  • Outcomes — cta_click · dm_opened · positive_reply · not_convinced · no_response

Strategy selection is an argmax over scores on the context key archetype|intent|channel|stage. Every interaction stores a connected path, and every outcome re-weights the edges on the path that produced it:

OutcomeWeight
Purchase click+2.0
DM opened+1.0
Positive reply+0.5
Answered at all+0.1
No response−0.25
"Not convinced"−1.0

When enough negative evidence accumulates, the leading strategy for that context changes — and because the graph's strategy table is injected into the prompt, the seller's script changes with it, mid-stream. The UI surfaces that moment explicitly, and any posture card opens the verbatim prompt the model last received.

Responses whose paths ended in a purchase become proven lines, fed back verbatim into later drafts.

Because the context key starts with the product archetype rather than the seller, what the graph learns about a category is portable: every new seller in that category starts from the playbook that already won.

3 · Delivery

The chosen strategy carries a treatment, and the treatment selects a clip bucket — so the graph picks the performance, not just the words.

The stage runs two tiers. Tier 0 is an always-playing idle loop that never stops. Tier 1 is the reactive layer, crossfading over it in 120 ms and fading back out over 500 ms to reveal the idle underneath, so there is no re-entry hitch. The 120 ms is tuned: longer crossfades expose two mouth poses at half opacity each, and a short blur pulse masks the residual mismatch.

When a lip-sync pod is reachable, responses upgrade to lip-synced renders. When it isn't, they degrade to a treatment clip plus streamed TTS, with no user-visible error.

4 · Cross-channel

Comments and DMs run the same pipeline. A DM carrying a price objection or skepticism is promoted to a proactive on-stream mention about 12 seconds later — a move a human host and moderator can't coordinate live.


What's real, what's prepared, what's simulated

Stated plainly, because the distinction matters when evaluating this.

RealProduct ingestion, intent classification, strategy selection, script generation, TTS, the clip stage, outcome recording, policy shifts, the commission figure (catalog price × catalog commission rate), and the latency numbers on screen
Prepared, disclosedStarting strategy weights in priors.json — hand-authored from UGC motif research on one product archetype, attributed in the file, and overwritten by live evidence. Also the avatar clip library, which is rendered ahead of time, and a cached product record used when the catalog is unreachable
Replayed, labeledbackend/scripts/demo_replay.py replays a scripted earlier-in-the-stream sequence to age the graph. Every replayed event is flagged replay in the UI, and the latency readout shows replay rather than an invented millisecond count
Modeled, not measuredMonthly running-cost figures. They come from projected provider usage, not from a billed month of operation
Not builtReal platform integrations (the shopper page stands in for a live chat feed; the pipeline behind it is unchanged). Purchase attribution beyond the click. Multi-stream isolation

No video is generated at runtime. Body, pose, and lighting are rendered ahead of time; only the mouth region is ever synthesized live, and only on the lip-sync tier.


Run it

Prerequisites — Python 3.11+, Node 18+, and a .env built from .env.example. At minimum: CHANNEL3_API_KEY for ingestion, ELEVENLABS_API_KEY + ELEVENLABS_VOICE_ID for voice, and one LLM credential. The provider chain tries Anthropic, Bedrock, OpenAI, and Gemini in order, then falls back to a deterministic rule path — so the loop never hard-fails on a missing key, it just gets less fluent.

make bootstrap     # one-time: venv, dependencies, checks
make start         # backend :8000 + dashboard :5173
make stop
SurfaceURLWhat it's for
Dashboardlocalhost:5173Onboarding, the stage, the operator view
Control roomlocalhost:8000/brainConstellation, script posture, tickers, live prompt
Shopper pagelocalhost:8000/watchWhat a viewer sees — chat, DMs, buy
API docslocalhost:8000/docs

Quick check — onboard a product, then ask it something:

curl -X POST localhost:8000/api/resonant/onboard \
  -H 'Content-Type: application/json' \
  -d '{"url":"https://<retailer>/<product-page>"}'

curl -X POST localhost:8000/api/resonant/event \
  -H 'Content-Type: application/json' \
  -d '{"channel":"chat","client_id":"c1","username":"alex","text":"is it real leather?"}'

curl "localhost:8000/api/resonant/query?intent=price_objection"

That last call returns the selected strategy, the score of every alternative, the confidence, and the interactions that produced it — the same deterministic explanation the UI shows.

pytest backend/tests -q

Repo map

PathWhat's in it
backend/agents/graph_engine.pyThe commerce graph — vocabulary, scoring, policy shifts, persistence
backend/agents/brain_llm.pyThe classify-and-draft call, prompt construction, provider chain
backend/agents/channel3.pyProduct ingestion, URL resolution, category → archetype mapping
backend/resonant_routes.pyEvent pipeline, graph endpoints, page routes
backend/agents/avatar_director.pyTwo-tier stage orchestration
backend/static/brain.htmlControl room — constellation, posture panel, prompt modal
backend/static/watch.htmlShopper page and the clip stage
backend/priors.jsonHand-authored starting weights, with sources
dashboard/Operator dashboard (Vite + React)
backend/tests/Graph, route, and endpoint smoke tests

The graph is the place to start reading — graph_engine.py is small, has no framework in it, and every claim above about determinism is checkable in select_strategy.


License

Source-available, not open sourcePolyForm Noncommercial 1.0.0.

  • ✅ Personal use, research, education, evaluation, hobby projects
  • ❌ Any commercial use, including competing products, internal business use, hosting Resonant as a paid service, or training models on this codebase commercially

For commercial licensing, contact the repo owner.

Copyright 2026 Aditya Singh. All rights reserved.

Contributors

adityasingh2400

25 commits

Languages

Python

51.7%

JavaScript

26.5%

Swift

9.7%

HTML

5.8%

Shell

5.5%