diff --git a/README.md b/README.md index 7783997..83e77f1 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,12 @@ A working prototype that scores customer-support conversations (RU / KZ / EN, chat and voice) against a **changeable, versioned checklist**, shows the evidence for every score, and lets a reviewer correct or appeal any criterion without losing the original AI result. Built for the CQA hackathon. +## Start here as a reviewer + +**[Five-minute demo and proof guide →](docs/REVIEWER_GUIDE.md)** Start with a stored evaluation, follow its evidence, change the checklist, then review or appeal a result. The guide explains what each step demonstrates and how to test a genuinely new input. + +The committed DEV snapshot contains **65 conversations, 65 completed evaluations, one failed attempt and five recordings**. [DEV](results/dev/results.json) and [control](results/prod/results.json) submission files contain 65 and 10 records respectively. These are model predictions, not reference labels or an accuracy measurement. No human-reference agreement report is linked in the current repository; [validation protocol and tooling](docs/VALIDATION.md) describe how to produce one. + ## What it does 1. **Imports** conversations from the organizer's dataset API (server-side) and keeps transcript text, order, roles, timestamps and audio link intact, adding a stable zero-based index per message. @@ -11,9 +17,31 @@ A working prototype that scores customer-support conversations (RU / KZ / EN, ch 5. **Reviews**: reviewers correct a criterion or decide an appeal; the final total is recalculated by code, the initial AI result and the audit history are preserved. 6. **Measures itself**: a CLI compares model output with human labels per criterion and measures run-to-run stability. +## See the product + +### Review a conversation and its evidence + +![CQA review workspace with a searchable conversation queue, indexed transcript and criterion scores](docs/images/review-workspace.png) + +The queue, transcript and evaluation sit side by side. Expand a criterion to follow its evidence; the panel explains lost points and serious violations. **Из прошлой оценки** identifies a reused judgment. + +### Change the checklist without changing code + +![Checklist editor showing criterion instructions, answer type, weight and N/A condition](docs/images/checklist-editor.png) + +Edit the instructions, answer scale, weight and applicability, then save a new checklist version. Previous versions and evaluations remain available. + +### See where review is needed + +![Statistics page with criterion distributions, language breakdown, evaluation failures and appeal counts](docs/images/quality-statistics.png) + +Summarize scores, serious flags, uncertain judgments and review progress across languages. **These figures describe the evaluated conversations; they are not model accuracy against reference labels.** + +Screenshots show the supplied running demo, including navigation and data beyond the committed DEV seed. Counts and available sections depend on the revision and local database. + ## Run it (5 minutes) -Needs Node ≥ 22 (CI uses 24, `.nvmrc` pins it) and pnpm 10. No API key or `.env` is needed to look around; stored evaluations open without a model, a new evaluation needs `ANTHROPIC_API_KEY`. +Needs Node ≥ 22 (CI uses 24, `.nvmrc` pins it) and pnpm 10. No API key or `.env` is needed to inspect stored evaluations. Fresh semantic evaluation needs `ANTHROPIC_API_KEY`; rules and compatible reused results can complete an evaluation without a model call. **Install prerequisites (once)** @@ -25,9 +53,8 @@ exec $SHELL -l && nvm install 24 && nvm use 24 # Windows (PowerShell): Node 24 winget install OpenJS.NodeJS # then open a new terminal -# pnpm: Corepack ships with Node 24 and picks the exact version pinned in package.json -corepack enable -# without Corepack: npm install -g pnpm@10 +# pnpm: install the version pinned in package.json +npm install -g pnpm@10.33.2 git clone https://github.com/unsound-mint/cqa-hackathon.git && cd cqa-hackathon pnpm install # also fetches the prebuilt better-sqlite3 binary @@ -44,19 +71,36 @@ pnpm dev # web http://localhost:5173 with fictional mock data, API on Full local build, one process on one URL (what the demo uses): ```bash -pnpm seed # installs the committed DEV snapshot: 65 conversations, 66 evaluations, 5 recordings +pnpm seed # installs the DEV snapshot; keeps an existing database unchanged cp .env.example .env # optional: ANTHROPIC_API_KEY to evaluate new conversations pnpm start # builds, then serves web + API at http://127.0.0.1:8787 ``` Checks: `pnpm typecheck && pnpm test && pnpm build` (no test needs a network or a model). Details, backup advice and troubleshooting: [`docs/RUNBOOK.md`](docs/RUNBOOK.md). -## Reading guide for reviewers +## Model and API cost + +The default is **Claude Haiku 5.5** (`claude-haiku-5-5`) through Anthropic's API, with `medium` effort. All 65 completed evaluations in the committed DEV seed record this model; `CQA_MODEL` and `CQA_EFFORT` can override it for new runs. + +Standard API prices in **USD per million tokens**, checked **8 November 2026** against [Anthropic's official model pricing](https://platform.claude.com/docs/en/models/haiku-5-5/overview): + +| Token category | Prompt up to 100,000 tokens | Prompt over 100,000 tokens | +|---|---:|---:| +| Uncached input | $0.10 | $0.50 | +| Output | $0.50 | $2.50 | +| Cache write (5 minutes) | $0.125 | $0.625 | +| Cache read | $0.01 | $0.05 | + +For example, **10,000 uncached input + 2,000 output tokens cost $0.002** at the lower tier (one fifth of a US cent). This illustrates the rate, not a measured cost per conversation. A conversation can require multiple requests and a repair attempt; token counts, caching and retries determine the bill. Rules and compatible reused results avoid model calls. Viewing stored results incurs no model cost. + +Each evaluation records token usage and model provenance. The [comparison CLI](evaluation/README.md#3-compare-with-the-model) can estimate cost using supplied input/output rates; treat it as an estimate, not a provider invoice. + +## Technical reading guide | If you want to check… | Look at | |---|---| | The big picture, data flow, decisions | [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) | -| That scores are not hardcoded and new input is really analyzed | `apps/api/src/services/evaluation/evaluator.ts` (`planCriteria`, `evaluateConversation`); no code references a conversation id | +| That scores are not hardcoded and new input is really analyzed | [Reviewer proof steps](docs/REVIEWER_GUIDE.md#test-a-new-input); `apps/api/src/services/evaluation/evaluator.ts` (`planCriteria`, `evaluateConversation`) | | That the model cannot invent evidence or totals | `validateModelOutput` in `evaluator.ts`; `packages/contracts/src/evidence.ts`; `scoring.ts` | | Arbitrary checklist support | `packages/contracts/src/checklist.ts` (schema, criterion signature), `apps/web/src/features/ChecklistEditor.tsx`, `scoring.ts` (id-agnostic) | | Original-vs-final, appeals, audit | `apps/api/src/services/appeals.ts`, table `appeals`/`evaluations` in `db/schema.ts` | @@ -65,15 +109,7 @@ Checks: `pnpm typecheck && pnpm test && pnpm build` (no test needs a network or | UI rules | [`docs/DESIGN.md`](docs/DESIGN.md) (a test enforces the 4/8 px grid) | | Shared types and API | `packages/contracts/src`, [`docs/INTERFACES.md`](docs/INTERFACES.md) | -### Try the main flow - -The interface is in Russian; labels below are given as `Russian (English)`. - -1. Open **Диалоги (Dialogs)**, pick a conversation. If it has no stored evaluation, press **Оценить диалог (Evaluate dialog)** (needs a model key; the mock data already has results). -2. Click a criterion → the transcript jumps to the exact evidence message; for a call, click the waveform to seek. -3. Open **Чек-лист (Checklist)**, change a criterion's instructions or add one, save, then evaluate again → a new checklist version appears in the version bar; the old evaluation stays. -4. Override a criterion with a reason, or file and decide an appeal in **Апелляции (Appeals)**: the final total changes while the original total and the AI explanation remain visible. -5. Download CSV or print/save PDF from the evaluation panel footer. +The [reviewer guide](docs/REVIEWER_GUIDE.md) provides the UI walkthrough, role changes, expected outcomes and limitations. [RUNBOOK](docs/RUNBOOK.md) covers setup, recovery, submission and Dynamics embedding. ## Architecture in one picture @@ -91,7 +127,7 @@ Design principles (each is enforced by code or a test, not only by convention): - **Deterministic first.** Facts (hold windows, recording pauses, verification events, timings), applicability, tiers, N/A, weighting, rounding and totals are code. The model supplies only semantic judgments and cannot compute a total. - **Evidence or it did not happen.** A positive verdict needs a verbatim quote from a client-facing operator message; indices and quotes are verified against the stored transcript. -- **Nothing is overwritten.** Conversations, checklist versions, AI results and appeals are immutable/append-only; reviewer actions only change the *final* result. +- **Original and reviewed scores stay separate.** Source conversations and used checklist versions remain stable; original AI results are preserved. Decisions are recorded in appeal/correction history and update the final result. - **Transcripts are untrusted data**, passed to the model as an inert payload; secrets stay on the server. ## Repository map @@ -101,8 +137,11 @@ apps/api/ Fastify API, SQLite (Drizzle), import, evaluation pipeline, a apps/web/ React + Vite review app (works offline against MockCqaApi) packages/contracts Zod schemas, shared types, scoring, evidence validation evaluation/ Human-label sheets, model-vs-human comparison, stability CLI -fixtures/ Fictional demo conversation (only conversation data in git) -data/ git-ignored contents: SQLite, raw dataset, recordings +fixtures/ Fictional demo conversation for mock mode and tests +data/seed/ Published organizer DEV database and five recordings +data/raw/ Ignored raw imports; runtime SQLite is also ignored +data/private/ Ignored runtime recordings +results/ Committed DEV/control predictions in organizer JSON format docs/ Architecture, rubric, interfaces, design, validation, runbook, workflow handoffs/ Per-owner onboarding notes from the hackathon kickoff AGENTS.md Rules the team's coding agents follow (CLAUDE.md imports it) @@ -114,8 +153,8 @@ Denis: API, contracts, scoring, providers, integration. Sofia: web app. Eldana: ## Data handling -No signed organizer URL, API key, raw transcript, real audio URL, recording or private label file is committed (`.gitignore` covers `data/`, `.env*`, `evaluation/private/`, `*.sqlite`). Git holds only fabricated fixtures. Real conversations are sent to a hosted model only with confirmed permission. +The organizer-cleared publication exception is `data/seed/`: the DEV database (including transcripts and audio references) and recordings. Submission predictions are in `results/`. Signed import credentials, model keys, other raw imports, control transcripts, runtime recordings and private labels stay in ignored local storage (`.env*`, `data/raw/`, `data/private/`, `*.sqlite`, `evaluation/private/`). Real conversations are sent to a hosted model only with confirmed permission. ## Known limits -Agreement figures in our reports are against team-written human labels, not the organizer's hidden reference. Rounding of halfway cases and the semantic relevance of a quoted operator message are judgment calls documented in [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md#13-known-limits). There is no authentication. +The comparison CLI can measure agreement with independently human-authored labels; its existence alone does not demonstrate accuracy against the organizer's hidden reference. Rounding of halfway cases and the semantic relevance of a quoted operator message are judgment calls documented in [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md#13-known-limits). There is no authentication. diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 2b340f8..a9a325e 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -43,8 +43,10 @@ flowchart LR | `apps/api` | Fastify routes, SQLite/Drizzle storage, import, evaluation pipeline, jobs, appeals, audio. | contracts | | `apps/web` | Review workspace, checklist editor, appeals queue, print/export. Talks only to the `CqaApi` interface. | contracts | | `evaluation` | Human-label sheets, comparison and run-to-run stability reports. A CLI that reads the running API. **Never imported by production code.** | contracts | -| `fixtures/demo.json` | Fictional conversation for the mock client and tests. The only conversation data in git. | – | -| `data/` (contents git-ignored) | SQLite file, raw dataset download, call recordings. Real data lives only here. | – | +| `fixtures/demo.json` | Fictional conversation for mock mode and tests; published DEV data is separate in `data/seed/`. | – | +| `data/seed/` | Published organizer DEV snapshot: database and five recordings. `pnpm seed` copies it into runtime storage. | – | +| Runtime data (git-ignored) | `data/cqa.sqlite`, `data/raw/`, `data/private/`: working database, raw imports and recordings. | – | +| `results/` | DEV/control model predictions in organizer JSON format; not reference labels. | – | | `docs/` | This documentation. `docs/official/` (organizer PDFs, local only, git-ignored) is not in the repository. | – | Rule of thumb: contracts ← api, web, evaluation. api and web never import each other. @@ -207,7 +209,7 @@ Bumping either invalidates cached results; legacy rows without a cache context a - Transcripts are untrusted data: sent to the model as a JSON payload field, never concatenated into instructions; model output is validated, never executed. - Secrets (`DATASET_IMPORT_URL`, `ANTHROPIC_API_KEY`) are unprefixed server env vars; `VITE_*` is public and holds no secret. The importer never logs or returns the URL. -- Raw transcripts, real audio URLs, recordings and the SQLite file are git-ignored (`data/`, `evaluation/private/`). Git contains only fabricated fixtures. +- `data/seed/` is the organizer-cleared publication exception: the DEV database and recordings are committed. Runtime SQLite, other raw imports, recordings and private labels remain ignored (`*.sqlite`, `data/raw/`, `data/private/`, `evaluation/private/`). `results/` contains submitted predictions, not control transcripts or reference labels. - Real calls are not sent to a hosted model without confirmed permission. Only an Anthropic adapter exists; another provider means one new class implementing `LlmProvider`. - No hardcoded outputs: nothing keys on conversation id, language or DEV content. Calibration examples are fictional and chosen by criterion signature. @@ -229,7 +231,7 @@ Bumping either invalidates cached results; legacy rows without a cache context a ## 13. Known limits -- Reference agreement reported by the tooling is agreement with human labels written by the team (see `docs/VALIDATION.md`), not with the organizer's hidden ground truth. +- The tooling can report agreement with human labels (see [validation protocol](VALIDATION.md)); no human-reference report is linked in the current repository. Stored predictions and format validation do not measure accuracy against the organizer's hidden ground truth. - Semantic relevance of an operator quote still depends on model judgment; the validators prove the quote is real and operator-authored, not that it is the right quote. - Voice transcripts are speech-recognition output; absence claims inside recording pauses are capped at medium confidence and flagged for human review. - Rounding of halfway cases is provisional (§5.3). No authentication: the role is a demo switch that any client can spoof. diff --git a/docs/REVIEWER_GUIDE.md b/docs/REVIEWER_GUIDE.md new file mode 100644 index 0000000..5c35d31 --- /dev/null +++ b/docs/REVIEWER_GUIDE.md @@ -0,0 +1,103 @@ +# Review CQA in five minutes + +CQA turns a support conversation into an explainable checklist evaluation, then gives a human a way to inspect and challenge it. The same workflow handles RU/KZ/EN transcripts, voice-call evidence and a changed checklist. The main technical choice is to use code for scoring and verifiable rules, and the model for semantic judgments that code cannot settle. + +## Choose what you want to verify + +| Path | What you can establish | Needs | +|---|---|---| +| Stored DEV demo | Evidence navigation, audio, original/final results, checklist editing, review and exports | `pnpm install`, `pnpm seed`, `pnpm start`; no model key | +| Fictional mock preview | UI interactions against a mock adapter; results are simulated | `pnpm dev`; no model key | +| New semantic evaluation | The running system interprets a new transcript or new criterion | HTTP mode, model key, internet and permission for any real data sent | +| Reference comparison | Agreement with independently human-authored grades | Human labels plus evaluated conversations; [comparison CLI](../evaluation/README.md) | + +A stored result demonstrates inspection; a mock result demonstrates interaction. To prove fresh inference, use the new-input or new-criterion steps below. Changing only a weight may legitimately reuse previous judgments. + +## Five-minute demonstration + +Start with [README setup](../README.md#run-it-5-minutes). Open `http://127.0.0.1:8787`. The UI is Russian; labels below match the interface. Use **Руководитель (Lead)** in the role picker for checklist editing and assignment. This is a demo role selector, not an authenticated login. + +| Time | Action | What to point out | +|---|---|---| +| 0:00–1:00 | In **Диалоги**, open a completed conversation; expand a criterion and click its evidence. | The quote belongs to the original message index. Bot/system turns remain visible as context, but only operator behavior is scored. An absence claim has an inspected range instead of invented speech. | +| 1:00–1:30 | Open a voice conversation, play it and seek on the timeline. | Transcript/audio navigation, retained recording URL, and visible recording gaps. Text evidence does not establish vocal tone. | +| 1:30–3:00 | In **Чек-лист**, add the criterion below, save a new version, then return and **Пересчитать по версии …**. | New instructions produce a new result without code edits. Show the old evaluation in the version selector. This step needs a model key; saving alone does not prove new scoring. | +| 3:00–4:00 | Expand a scored criterion and submit a direct correction with a reason. | Final score is recalculated; the initial answer, explanation and original total remain available. Review state is separate from scoring. | +| 4:00–5:00 | Open **Статистика**, then return to an evaluation and export CSV or print PDF. | Criterion distributions, language breakdown, flags and review workload summarize current results. These are operational figures, not measured model accuracy. | + +If model latency exceeds the slot, show progress and continue to review/export while it runs; return to the completed result before claiming the new criterion worked. Rehearse the live step on the presentation machine first. + +### Add a criterion the application has not seen + +In **Чек-лист → Добавить критерий**, use: + +- **Название:** `Конкретный следующий шаг` (Concrete next step). +- **Тип ответа:** `Да / Нет`; **Вес:** `10`; N/A disabled; serious-violation flag disabled. +- **Как оценивать:** `Да, если оператор явно назвал конкретное действие, которое клиент или оператор должен выполнить дальше. Нет, если такого действия нет. Оценивай только сообщения оператора клиенту. Для «Да» приведи точную цитату; для «Нет» укажи проверенный диапазон сообщений.` + +Save with **Сохранить как новую версию**. The generated criterion ID does not need to match any original rubric ID. Apply it to a conversation selected by the reviewer and inspect both its answer and evidence. Ideally use a newly imported conversation as well. Editing an existing criterion's instructions is another way to demonstrate changed semantics. + +The weights need not sum to 100: applicable weights are normalized. Unchanged criteria may show **Из прошлой оценки** (reused from a prior evaluation); the new semantic criterion must be evaluated from its own instructions. Renaming a criterion or changing only its weight does not require a fresh semantic judgment. + +### Demonstrate the appeal path separately + +A direct correction and an operator appeal are different actions. As lead, assign a conversation to a demo operator. Switch to **Оператор** with that assigned name, open a criterion and file an appeal with a reason. Switch to **Проверяющий (Reviewer)** or lead, open **Апелляции**, and uphold or override it. Show the recorded comment, decision and original-versus-final result. Marking the whole dialog reviewed is an explicit separate action. + +## Test a new input + +The backend imports organizer-compatible groups through the server's configured `DATASET_IMPORT_URL`. It preserves message order, roles, timestamps, text and audio URL, adding stable zero-based indices. The default browser workflow reviews imported data; it is not a free-text transcript upload form. + +With the HTTP server running and the signed source configured privately, import the reviewer-provided group: + +```bash +curl -X POST http://127.0.0.1:8787/api/datasets/import \ + -H 'content-type: application/json' \ + -d '{"groupId":""}' +``` + +Then open a newly imported dialog and choose **Оценить диалог**. Verify that the returned evidence quotes the new transcript and that provenance records provider, model, prompt and checklist version. Import conflicts for an existing ID with different content are rejected so old evidence cannot drift. + +For repeated model runs on already imported inputs, the [evaluation CLI](../evaluation/README.md#4-run-to-run-stability) uses `fresh: true` to bypass result reuse. Fresh still allows deterministic rules: it does not force the model to decide facts code can prove. + +For the organizer's fixed eight-criterion control submission, [RUNBOOK](RUNBOOK.md#submitting-results-organizer-appendix-json-10) covers export. The exporter targets original checklist version 1; arbitrary-checklist UI evaluation is a separate capability. + +## How a score is produced + +```mermaid +flowchart LR + A[Transcript + saved checklist] --> B[Rules establish provable answers] + B --> C[Reuse compatible original judgments] + C --> D[Model supplies remaining semantic facts or answers] + D --> E[Validate values, indices, quotes and roles] + E --> F[Code computes weighted score] + F --> G[Preserve original; review updates final] +``` + +For unchanged original criteria 02, 03, 04 and 06, the model extracts semantic facts and code applies rubric decisions. User-added or semantically edited criteria use their saved instructions through the generic model path. Invalid model output gets one repair attempt; unresolved failures are stored as failures, not zero-quality conversations. + +**Example arithmetic (fictional):** applicable criteria with weights 10 and 20 receive Yes and 10/20. Earned points are `10 + 20 × (10/20) = 20`; the total is `100 × 20/30 = 66.67`. An N/A criterion contributes neither earned nor possible points. A serious-violation flag is reported separately, without an invented score penalty. See the [rubric](RUBRIC.md) for exact original scales and provisional rounding policy. + +A validated quotation proves the text exists in the right message. Whether it actually justifies the judgment still needs semantic evaluation and can be challenged by a reviewer. + +## Requirement → evidence + +| Requirement | Implementation and durable checks | +|---|---| +| General scoring with exact weights, tiers and N/A | [Single application scorer](../packages/contracts/src/scoring.ts), [scoring tests](../packages/contracts/test/scoring.test.ts) | +| New inputs, operator attribution and grounded evidence | [Evaluator](../apps/api/src/services/evaluation/evaluator.ts), [operator-safety tests](../apps/api/test/operator-safety.test.ts), [evidence validator](../packages/contracts/src/evidence.ts) | +| Arbitrary versioned checklist | [Editor](../apps/web/src/features/ChecklistEditor.tsx), [checklist API tests](../apps/api/test/checklists.test.ts), live new-criterion demonstration above | +| Original result survives correction/appeal | [Appeals service](../apps/api/src/services/appeals.ts), [appeals tests](../apps/api/test/appeals.test.ts) | +| Recording gaps, holds and voice evidence | [Transcript facts](../apps/api/src/services/evaluation/facts.ts), [facts tests](../apps/api/test/facts.test.ts), [audio tests](../apps/api/test/audio.test.ts) | +| Repeatability and measured agreement | [Comparison and stability tooling](../evaluation/README.md), [human-label protocol](VALIDATION.md) | +| Organizer submission artifacts | [DEV predictions](../results/dev/results.json), [control predictions](../results/prod/results.json), [exporter/format validator](../scripts/export-results.mjs) | +| Embeddable UI preparation | [Dynamics setup](RUNBOOK.md#dynamics-365-html-web-resource); not verified in a Dynamics organization | + +Tests demonstrate the behavior they exercise. They do not replace live inference, human labels or an organizer-reference comparison. + +## What the current evidence does and does not establish + +- The committed DEV seed has 65 conversations, 65 completed evaluations, one failed attempt and five recordings. These are stored demo artifacts, not a record of this guide's live rehearsal. +- The DEV/control JSON files hold 65/10 predictions. Format checks establish structure and score consistency; they do not establish agreement with reference answers. +- No independently human-adjudicated accuracy report is linked in the current repository. The next validation deliverable is per-criterion agreement, total-score error, N/A confusion and critical-flag errors, with sample size, provenance and failures reported. Model-to-model comparison must be labeled as such. +- Screenshot counts reflect the supplied running demo, which includes additional data and navigation. A fresh DEV seed can show different totals and fewer sections. Follow the functionality of the checked-out revision. +- There is no production authentication. Voice ASR errors and recording pauses can limit confidence. A Dynamics deployment and the new-input/new-criterion stage sequence require their own live verification. diff --git a/docs/RUNBOOK.md b/docs/RUNBOOK.md index a1dde20..575aaf2 100644 --- a/docs/RUNBOOK.md +++ b/docs/RUNBOOK.md @@ -3,21 +3,23 @@ The demo runs on one laptop (Fedora or Windows), as one process on one URL. No Docker. ## One-time setup -1. Install Node 24 and pnpm 10: commands for Linux, macOS and Windows are in the README ("Install prerequisites"). Short form: `nvm install 24 && corepack enable` (Windows: `winget install OpenJS.NodeJS`, then `corepack enable`). +1. Install Node 24 and pnpm 10: commands for Linux, macOS and Windows are in the README ("Install prerequisites"). After installing Node, run `npm install -g pnpm@10.33.2` (the version pinned in `package.json`). 2. `pnpm install` 3. Copy `.env.example` to `.env`. Put `DATASET_IMPORT_URL` (server-only) and, once chosen, the model key there. Quote the URL if you source the file in a shell; the apps read it themselves and do not need quoting. -4. `pnpm start` builds everything and serves the web app and the API at http://127.0.0.1:8787 (`PORT`/`HOST` to change). -4b. Or skip the import: `pnpm seed` installs the committed DEV snapshot (`data/seed/`: database with 65 conversations and their evaluations, plus the 5 call recordings) without overwriting an existing database. The snapshot is the organizer's DEV data, published with Denis's decision (2026-11-08). -5. Import the data once (not needed after `pnpm seed`): `curl -X POST localhost:8787/api/datasets/import -H "content-type: application/json" -d '{"groupId":"DEV"}'` (PowerShell: `Invoke-RestMethod -Method Post -Uri http://localhost:8787/api/datasets/import -ContentType application/json -Body '{"groupId":"DEV"}'`). +4. For a ready-to-inspect demo, run `pnpm seed`. It installs the committed DEV snapshot (`data/seed/`: database with 65 conversations and their evaluations, plus the 5 call recordings) without overwriting an existing database. It contains 65 completed evaluations and one failed attempt. The snapshot is the organizer-cleared DEV publication (2026-11-08). +5. `pnpm start` builds everything and serves web + API at http://127.0.0.1:8787 (`PORT`/`HOST` to change). +6. Alternatively, import the data once (not needed after `pnpm seed`): `curl -X POST localhost:8787/api/datasets/import -H "content-type: application/json" -d '{"groupId":"DEV"}'` (PowerShell: `Invoke-RestMethod -Method Post -Uri http://localhost:8787/api/datasets/import -ContentType application/json -Body '{"groupId":"DEV"}'`). Production uses the HTTP backend and the evaluations already stored in `DATABASE_PATH`; it does not substitute mock results or automatically regenerate existing evaluations. Development instead: `pnpm dev` (web on :5173 with hot reload, API on :8787), defaulting to fictional mock data. Set `VITE_API_MODE=http` for integrated development or `mock` for an explicit fictional preview. Leave it unset/empty for the normal defaults. ## State -Everything lives in one SQLite file (`DATABASE_PATH`, default `data/cqa.sqlite`; the raw download is in `data/raw/`). Both are git-ignored. **Copy `data/cqa.sqlite` before the demo**: restoring it brings back conversations, checklist versions, evaluations and appeals. Call recordings are stored next to it in `data/private/audio/` (`AUDIO_DIR` overrides; git-ignored, real calls), fetched after an import, on every server start for any that are missing, and on first play, so a demo does not depend on the organizer's signed links; copy that folder too. +Working application state lives in one SQLite file (`DATABASE_PATH`, default `data/cqa.sqlite`; the raw download is in `data/raw/`). Both are git-ignored. **Copy `data/cqa.sqlite` before the demo**: restoring it brings back conversations, checklist versions, evaluations and appeals. Call recordings are stored next to it in `data/private/audio/` (`AUDIO_DIR` overrides; git-ignored, real calls), fetched after an import, on every server start for any that are missing, and on first play, so a demo does not depend on the organizer's signed links; copy that folder too. + +The [reviewer guide](REVIEWER_GUIDE.md) is the presentation path; this runbook covers operations. ## Before going on stage - Run the whole flow once on the stage laptop and screenshot it (backup). -- Decide the model path ahead of time. The configured hosted provider needs working internet and a funded key; no local-model adapter is included. Evaluations already stored in the database show without any model call, but a NEW conversation needs the model. +- Decide the model path ahead of time. The configured hosted provider needs working internet and a funded key; no local-model adapter is included. Evaluations already stored in the database show without any model call, but new semantic judgments need the model. A checklist edit may reuse unchanged judgments; follow the [reviewer guide](REVIEWER_GUIDE.md) to demonstrate a new semantic criterion. - Disable sleep and notifications; close heavy apps. - Keep a second browser tab on `/health`. - Freeze `main` at a green commit before the control round (see `docs/WORKFLOW.md`). @@ -33,6 +35,8 @@ Everything lives in one SQLite file (`DATABASE_PATH`, default `data/cqa.sqlite`; ## Submitting results (organizer appendix, JSON 1.0) Two files must be pushed to the public repo before the stop-code: `results/dev/results.json` (65 DEV records) and `results/prod/results.json` (exactly 10 control chats, errors included). The exporter writes the immutable initial AI result (never reviewer overrides) in the required format and validates it (eight criteria once each, allowed values, 1-based evidence turns, score recomputed from weights, unique IDs). +Export from the evaluation snapshot **before rehearsing critical-flag corrections or appeals**. Current exporter limitation: criterion values come from the original result, but `critical_flag` reads the mutable reviewed flag. If review changes that flag, validation rejects the inconsistent export. Keep the submission snapshot separate from the review demonstration until the exporter is corrected. + 1. Import and evaluate the control set in the app (all 10 conversations; an evaluation that fails is exported as `status: "error"`, never as a zero). 2. `node scripts/export-results.mjs --group --out results/prod/results.json --team "" --expect 10` (DEV: `--group DEV --expect 65`). 3. `pnpm results:check results/prod/results.json --expect 10`, then commit, push, and confirm the file is visible on GitHub. Local commit without push does not count. diff --git a/docs/WORKFLOW.md b/docs/WORKFLOW.md index 5f7f8be..57823f1 100644 --- a/docs/WORKFLOW.md +++ b/docs/WORKFLOW.md @@ -1,5 +1,9 @@ # Six-person workflow: three humans + three supervised agents +## Current authorization + +The standing authorization in [AGENTS.md](../AGENTS.md#github-collaboration-contract) supersedes older per-action approval language below: owner agents may create/update issues, push owner branches, open PRs and merge after green CI within the stated scope. Contract/scoring/privacy/deployment changes require a documented self-review note. Human owners retain architecture, model-choice and ground-truth decisions. Never merge during an announced freeze. + ## Human decision makers - Denis — technical integrator; owns backend, shared contracts, scorer, external model/data calls, security, CI/deploy. - Sofia — frontend owner; owns UX and frontend implementation and tests. She can self-merge owner-scoped low-risk changes after CI. diff --git a/docs/images/checklist-editor.png b/docs/images/checklist-editor.png new file mode 100644 index 0000000..f4cfe95 Binary files /dev/null and b/docs/images/checklist-editor.png differ diff --git a/docs/images/quality-statistics.png b/docs/images/quality-statistics.png new file mode 100644 index 0000000..d99b98e Binary files /dev/null and b/docs/images/quality-statistics.png differ diff --git a/docs/images/review-workspace.png b/docs/images/review-workspace.png new file mode 100644 index 0000000..c085297 Binary files /dev/null and b/docs/images/review-workspace.png differ