Files
CatoandClaude 757d1b3a1d feat(chat): the answer feedback loop — thumbs, transcript export, nightly review (#198)
Substrata was the product whose Ask answered "nothing in our database" with
no way forward, and nobody knew until the owner said so. From here every
turn is in the loop:

- chatkit 0.14: thumbs under every answer (ChatThread onFeedback); a thumb
  down asks why. POST /api/chat/feedback (zod, same-origin, rate limited)
  keeps it in chat_feedback.
- chat_turns: /api/chat logs the question and, when the loop ends, the
  answer with the status and tool labels the reader watched, the page it was
  asked from and whether it failed. Ids are random uuids the browser mints
  per thread and per answer; no reader, no IP, no key.
- GET /api/chat/review-export: bearer CHAT_REVIEW_TOKEN (constant-time; 401
  otherwise, 503 while unset), {product, scope, transcripts} in chatkit's
  ChatTranscript shape — at most 50 conversations since `since`, 30 turns
  each, 4,000 characters a turn, with their feedback. The scope is built
  from the system prompt's role line and the tool registry, never typed
  twice.
- scripts/db/015-chat-review.sql, .env.example, docs/INFRASTRUCTURE.md
  "Chat review", test/chat-review.test.ts.


Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-22 19:02:13 +02:00
..