Kappa: coding open-ended survey answers with AI

  • prototype
  • Synthetic data

AI codes every survey answer with the quote that justifies it, routes the doubtful ones to an analyst, and gets scored against a golden set.

Type
Prototype
Role
Solo, with AI coding agents
Date
October 2026
Stack
JavaScript, Node.js, Claude API
Coding run: each synthetic survey answer with the text supporting every code highlighted, and one chip per code with its confidence
Every code carries the exact quote that justifies it.

The problem

Open-ended survey answers carry the why. Before anyone can count them, someone has to code each answer against a code frame, by hand. It's slow, two coders disagree, and one coder disagrees with themselves by Friday. And it sits right on the path to the client report.

It's also hard to automate. One answer can carry several codes. People are sarcastic or wander off the frame, and some answers weren't written by a person at all.

What I did

I wrote the agent the way I'd write a job description for a junior coder. It reports to the analyst who owns the code frame, and it assigns codes on its own only when it's confident and the evidence checks out. Everything else goes to a review queue.

Every code needs an exact quote from the answer, and Kappa verifies the quote is really there. Codes at 0.8 confidence or higher are accepted. The rest wait for a person, along with anything flagged as machine-written or as a near-duplicate. The model can suggest new codes for the frame, and only the analyst can add them. A reviewer's decision sticks across every later run.

I built an offline keyword coder alongside it, so there's a baseline to beat.

What came out of it

Kappa codes 200 answers in about 90 seconds. Against a synthetic golden set of 200 answers and 307 codes, three Claude runs landed at a pooled Cohen's kappa of about 0.92 to 0.935. The keyword baseline scored 0.53. Kappa caught all 8 machine-written answers on every run.

The caveat matters more than the score. An AI model wrote that golden set, and it shares habits with the coder, so these numbers show the pipeline works and say little about agreement with human coders. It also over-codes a little: recall was 97%, precision around 90%.

Before production: a golden set coded by two people, with their agreement as the bar; confidence scores calibrated against it; personal information redacted before any model call; and an audit trail of who decided what, under which frame version.

What I'd do differently

I'd build the golden set first, and have people code it. Mine was written by an AI from the same model family as the coder, which is why the kappa scores prove the plumbing and not much else. Two human coders and their agreement rate would have given the model a real bar to clear.

The 0.8 auto-accept line is a default right now. I'd calibrate it against that human-coded set, because where the line sits decides how much of an analyst's time Kappa actually saves.

Screenshots