TM-13Duplex

A website that talks back.

Every website talks. Almost none of them listen. Duplex opens a line between your site's brain and whoever is on the other end, so your site can hold a real conversation and do something about it.

A person on your home page. A customer in your inbox. A kiosk in your lobby. Another company's software. They all get the same thing: a brain that knows your business, answers as it writes, and works only within the rules you set.

The brain at a switchboard, connecting calls
  1. Part 1What it isIn plain words, for anyone.
  2. Part 2What it's forEight jobs a line can do.
  3. Part 3How it worksSettings, protocol, safety, code.

Part 1 · In plain words

A phone line to your site's brain.

On flff, every site has a brain: the AI that built the site with you and knows its pages, prices and facts. A duplex line is a way in. You open one, say who may use it and what the brain may do on it, and from then on anyone you allow can talk to your brain directly, at any hour, without you in the room.

"Duplex" is an old telephone word. A one-way radio lets one side speak at a time. A duplex line carries both voices at once. That's the difference between a website that broadcasts and one that converses.

Why it matters.

Most of what a business does online is still one-way. A page says what you do. A form drops a message in a pile. An email waits until Monday. Every one of those is a moment where a customer had a question, and nobody was there to answer it.

It talks back

Questions get answers while the customer is still interested, written for them, from your facts. Not a menu of canned replies. Not "we'll get back to you".

It gets things done

A line can check stock, book a table, take an order or file a request: the jobs you allow, the way your site already does them. Talking turns into doing.

It stays yours

You set what it may do and what it may spend. You can step into any conversation. And the record of every conversation is kept by your site, where you can read it, search it and delete it.

The usual websiteWith a duplex line
A question at 11 pmWaits for the morningAnswered now, from your facts
A contact formA message in a pileRead, sorted and answered, or drafted for your OK
"Do you have it in stock?"Call usChecked against your stock, then and there
Other softwareNeeds a developer and an APITalks to your brain in plain words, or in JSON
The chatbot vendorAnother subscription, another copy of your factsBuilt in. The same brain that runs your site

It isn't a chat widget you rent. A chat button is one thing a line can power. The line itself is the part that matters: the same one can answer a visitor, an email and a machine.

Part 2 · Applications

One line, many jobs.

You don't build these. You describe them to your brain, it writes the line and the commands it needs, and you approve the line once. Under each one: what's doing the work.

For visitors

A support chat that answers first

A chat button on every page. The brain answers from your page of facts and fetches a person when someone asks for one or is unhappy.

The support chat → (with a live demo)

A public line, a facts file, one handover command, and a chat button: chat.js.

For visitors

A sales funnel written for each visitor

Every answer is a small slide made for the person asking: a mock-up of their idea, the price that fits, a button to start. It's how our own guide works.

The brain at work →

A line with rich replies: the brain builds each answer out of your site's own parts and styles.

For customers

A shop or booking assistant

"Is the walnut table in stock in the long size?" "Can six of us come at 7 on Friday?" The brain checks, answers, and books when they say yes.

Your commands as its tools, such as check_stock and book_table. Each is checked by your site exactly as if a person had pressed the button.

For members

A helper only members can reach

A portal assistant that knows who's asking: their orders, their class schedule, their account. Members sign in with flff, and every command the brain runs knows which member is asking.

A members line: only signed-in members get through, and your commands see the member's id.

For your inbox

Email that sorts itself

Every new message is read, labelled, summarised and marked urgent or not, with a suggested reply waiting for you. You read the five that matter first.

A command step, duplex, hands each new email to a line that answers in a fixed shape: category, summary, urgency, draft.

For your forms

Forms that follow up

A quote request comes in and gets a priced draft. An application gets a first read. A booking gets a welcome written for what they told you.

Forms that think →

The form's command asks a line one question and uses the answer in its next steps.

For machines

Devices, kiosks and scripts

A lobby kiosk that answers questions. A sensor that asks "is this reading normal?". A nightly script that asks your brain to summarise the day. They send a sentence, and get back plain words or JSON they can act on.

A key line with an output schema. Each machine gets its own key, kept in your site's secrets, so you can revoke it alone.

For other AIs

Your business, open to agents

As more people send AI assistants to shop, book and ask on their behalf, those assistants need someone to talk to. A line gives them your brain: it answers from your facts and acts only through your commands.

A public or key line. To the other AI it's an ordinary web address that answers in text or JSON.

On your desk, or in the cloud.

A line can think on your own computer: with fluffrl and a model running in Ollama, answers cost nothing, and your callers' words go from our servers to your computer and back, never to an AI company. When your computer is off or busy, the backup level you picked answers instead, and a caller who has to wait is told their place in line.

Or run it in the cloud at Level 1, 2 or 3, paid from your site's brainpower like everything else your brain does. Level 1 is the cheapest, and fine for most questions.

A person, whenever you want one.

Any conversation can be taken over from your admin. Write in it and the brain goes quiet; the caller sees your name, live. Hand it back and the brain picks up knowing what you said. Don't want an AI at all? The same line works with only people answering.

Part 3 · Technical details

Under the hood.

For developers, and for anyone who wants to know exactly what they're turning on. Your brain writes all of this for you. You only need it if you're curious, or connecting your own code.

3.1Anatomy of a line

A line is a small settings file your brain writes, shown to you as a card you approve once. Change it later the same way. The main settings:

SettingWhat it doesChoices
whoWho may callpublic (anyone, after a proof-of-work check, on by default), members (signed in with flff), key (a machine with a key your site checks)
instructionsWhat the brain is for on this line, and how it should soundYour words
digestA file of your facts, kept ready so each turn is cheapAny file on your site
level, fallbackWhich brain answers0 (your computer) to 3; a backup level for when your computer is off or busy
commandsThe site commands the brain may run, as its toolsUp to 12; at most 6 runs in one turn
memoryWhether a conversation carries onconversation (kept until idle for idle_hours: a day by default, 30 days at most) or none (each message stands alone)
fields, outputThe shape of what comes in and goes outChecked input fields; a JSON schema the answers follow
replyPlain or rich answerstext, or rich: words plus pieces of page built from the design files you name
on_turn, on_endWhere the record goesA site command: a CSV line in your data, a table row, a notice on the first turn, or nothing
originsYour other websites that may embed the lineUp to 20 addresses
CapsHow far one conversation, and one day, may goTurns and brainpower per conversation and per day; new conversations per address an hour
3.2The protocol

A line is an HTTPS address, https://flff.fi/d/YOUR-SITE/LINE. Everything is plain HTTP: no WebSocket, no SDK required, no sticky sessions, so it works through proxies, from browsers on other domains (CORS for your origins), and from any language.

RequestDoes
GET /d/SITE/LINEThe line: who may call, its fields, and a proof-of-work challenge when it has one
POST /d/SITE/LINEStarts a conversation: {id, token}. On a memory: none line, the message itself, answered at once
POST /d/SITE/LINE/IDOne turn. With Accept: text/event-stream the answer streams as server-sent events (delta, tool, queued, done or error); with application/json, one answer when it's done
GET /d/SITE/LINE/ID/eventsWhat happens between turns: a person writing, taking over, handing back. Resumes with Last-Event-ID
GET / DELETE /d/SITE/LINE/IDThe conversation so far; end it now

From a page

<script src="https://flff.fi/d/duplex.js"></script>
<script>
const c = await Duplex.connect('https://flff.fi/d/YOUR-SITE/helper');
const r = await c.say('Do you deliver on Sundays?', {
  onDelta: (t) => out.textContent += t,   // as it's written
});
// r.reply: the whole answer
// c.listen({ onMessage, onMode }): a person joining
</script>

connect() solves the proof-of-work check for you. Or skip the code: chat.js is a finished chat button, one line on any site (see the support chat).

From a machine

curl https://flff.fi/d/YOUR-SITE/kiosk \
  -H "Authorization: Bearer $KIOSK_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"message": "Is the 10 mm bit in stock?"}'

{"ok": true, "reply": "Yes: 14 in stock, aisle 6.",
 "output": {"in_stock": true, "count": 14, "aisle": "6"},
 "n": 1, "credit": 0.0012}

A key line with memory: none and an output schema: one request, one answer your code can parse, and what it cost.

From your site's own commands

{"duplex": {"line": "triage",
            "message": "Sort this email: {{email.text}}"},
 "as": "t"},
{"when": "t.output.urgent",
 "notify": {"title": "Urgent: {{t.output.summary}}",
            "body": "{{t.output.draft}}"}}

A duplex step asks a line one question and hands the answer to the next steps. A duplex_post step posts a person's reply into a conversation, or takes it over and hands it back. See commands and their steps.

What a line looks like

{"kind": "duplex", "name": "helper",
 "who": "public", "level": 0, "fallback": 1,
 "digest": "_u/facts.md",
 "commands": ["check_stock", "book_table", "handover"],
 "memory": "conversation", "idle_hours": 24,
 "on_turn": "chat_log",
 "origins": ["https://shop.example.com"],
 "instructions": "Answer questions about the shop…"}

Your brain writes it from what you asked for; you see it as a card and approve it.

3.3Safety

A line puts your brain in front of strangers, so it's built on the assumption that some of them will try to misuse it.

3.4Cost and limits

Open a line.

Talk to the one on our support chat page, then ask your own brain: "Open a line so customers can ask about stock and book a table."