System

chat-quality

Every disliked answer becomes a test

The chat-quality skill is the loop that reads the thumbs visitors leave on the site chat’s answers. It is set to run twice a month, runs on demand for now, and ends with changes waiting on a branch for the owner. Below are the steps, then one pass of the loop traced from a verdict to that branch. The full skill file is on Skills.

The steps

  1. Close the last loop
    Read the previous run’s report and check whether its branch was merged, so a case already written is not proposed twice.
  2. Pull the verdicts and the log
    Read the thumbs verdicts and the logged exchanges from the live store, and join each verdict to the exchange it rates by its id. The agent only reads; it never writes there. Without read access it stops and asks.
  3. Triage
    Every thumbs down is a candidate. The unrated answers get a skim too, for silent failures such as an invented path or a limit notice where a real answer was possible. A window with no real failures is a valid result, and the loop stops there.
  4. Makes the golden-set casesWrite the cases first
    Each failure becomes a case in evals/chat/golden-set.json before it is fixed: the question in other words, the facts a good answer needs, the cheapest check that would have caught it, and the rules it covers in evals/chat/SPEC.md. A fact missing from the chat’s sources is the real bug, and the source is what gets fixed.
  5. Run the eval once
    npm run eval:chat runs the whole set through the real chat route on a local dev server. It spends real API budget, so it runs once per loop. The answers are read one by one: the new cases should fail before the fix and pass after, and nothing that passed before should break.
  6. Makes the local branchFix on a branch
    The new cases and the fixes they called for go on one fresh local branch. Fixes stay inside the chat’s answer pipeline: page prose, the persona and the lookup tools. A fix in the package’s chat engine changes every consumer’s chat, so it is flagged as such.
  7. Makes the reportReport and hand off
    A plain-English report: the window, the verdict counts, each disliked answer and its cause, what was encoded and the eval result. Merging the branch approves it; deleting it rejects it. Nothing is pushed or deployed.

One loop, end to end

A visitor rates an answer with a thumb. /api/chat/feedback stores the verdict in Redis under the exchange’s id, beside the exchange that /api/chat logged, and both are deleted after 30 days. The agent reads the two and joins them. The disliked answer becomes a golden-set case written in other words, the eval runs against a dev server, and the fix waits on a local branch. The visitor’s own words stay in a local report that is never committed.

1 · On the live sitekept for 30 days
2 · Read, never writtenthe agent observes
3 · Encode, then testthe case comes before the fix
4 · For approvalnothing is pushed
Site chata thumb on each answer
Chat route/api/chat
Feedback route/api/chat/feedback
Redisexchanges and verdicts
Joinverdict to exchange, by id
Triageevery dislike, plus silent failures
Local reportnever committed
Spec ruleevals/chat/SPEC.md
Golden-set caseevals/chat/golden-set.json
Coverage checkscripts/validate-chat-coverage.mjs
Dev servernpm run dev:eval -w website
Eval runnpm run eval:chat, once
Ownermerge approves, delete rejects
Local branchchat/YYYY-MM-DD-<slug>
Fix the causepage prose · persona · lookup tools
read onlyparaphrased, never quotedfails before, passes after
Read from the live site, encoded as a test, fixed on a branch.

What the loop may touch

The live data is read, never written. Only a paraphrase of the failure and its fix reach the repo, and only on a branch the owner approves.

What each part of the loop may touch
PartWhat the loop doesAccess
Verdicts and exchange log
Reads and joins them
Read only
Visitors’ own words
Quotes them in the local report only
Stays local
Golden set and spec
Adds paraphrased cases and any new rule
On a branch
Page prose, persona, lookup tools
Fixes the cause a case found
On a branch
The package’s chat engine
Fixes it only when the site cannot
Flagged
UI, components, spend limits
Proposes, never edits
Off limits