Sorshorsh · Integration guide

Sorsh integration guide

Add trust scoring to your labeling tool in a few lines. Sorsh records how a task is produced and returns a trust assessment your team can review.

New to Sorsh? Start with the six-step walkthrough for engineers. It covers what the free audit needs from you (nothing), the two-line setup, what gets sent and what comes back.

What Sorsh does

Sorsh watches the process of an annotation (typing cadence, paste events, focus changes, time on task) and scores how likely the work is genuine versus pasted from an LLM or rushed. A text-only AI detector or a screenshot of the final answer cannot see this signal; the behavior can.

You add a small script to your existing labeling UI, point it at the field workers type into, and call submit() when they finish. Sorsh returns a trust score and the reasons behind it.

Data & privacy

Isolation. Each customer runs on its own Sorsh instance and database, access-controlled and separate from every other customer and from the public demo.

Quick start

Two lines: load the SDK, then call Sorsh.embed with the selector of your answer field. copy & adapt

<!-- 1. load the SDK (served by your Sorsh instance) -->
<script src="https://pilot.sorsh.in/sdk/sorsh-sdk.js"></script>

<!-- 2. wire it to your existing field + submit button -->
<script>
  Sorsh.embed({
    endpoint:    "https://pilot.sorsh.in",
    pilotKey:    "pk_xxx",                 // worker access code (from Sorsh)
    contributor: function(){ return CURRENT_USER_ID; }, // who is doing the task
    answer:      "#answer",                // CSS selector of the answer field
    submit:      "#submit"                 // optional: send telemetry on this click
  });
</script>

That is the whole integration for a text task. If you have no obvious submit button, omit submit and call Sorsh._session.submit() yourself when the worker is done.

No-JS variant (data attributes)

Add data-sorsh-answer to your field and data-sorsh-submit to your button, then call Sorsh.embed({endpoint, pilotKey, contributor}) with no selectors.

Sorsh.embed(options)

OptionTypeNotes
endpointstringBase URL of your Sorsh instance. Required.
pilotKeystringWorker access code; appended as ?pk=. Required for a pilot instance.
contributorstring | fnStable ID for the worker. A function is called at instrument time. Defaults to a data-sorsh-contributor attribute or "worker".
answerCSS selectorThe text field. Default [data-sorsh-answer]. SPA-safe: Sorsh waits for it to render.
submitCSS selectorOptional. Clicking it sends telemetry. Default [data-sorsh-submit].
taskId, project, promptstringLabels shown to reviewers. Optional.
modalitystring"text" (default) or "transcription".

Returns an object with submit(). The live session is also at Sorsh._session.

Sorsh.instrument(element, options): full control

For custom flows, instrument an element yourself and submit explicitly.

const session = Sorsh.instrument(
  document.querySelector("#answer"),
  { contributorId: userId, taskId: "ticket-sum", project: "acme",
    prompt: "Summarize the ticket", modality: "text",
    endpoint: "https://pilot.sorsh.in/api/ingest?pk=pk_xxx" }
);
// ...worker types...
const result = await session.submit();   // returns the trust assessment

Session methods: submit() → Promise of the assessment; payload() → the raw payload (inspect/forward); detach() → stop listening; recordPlay() / recordSeek() for audio transcription tasks.

Behavior-only mode: to avoid sending answer content, call session.payload(), set final_text="", and POST it yourself. Behavioral scoring still works; quality/AI-text signals simply won't.

Non-text tasks

For classification, A/B preference, or bounding-box work, use Sorsh.instrumentInteraction(containerEl, options). It records pointer movement, scroll, media playback, and box draws. Record the choice with session.choose(value) (or setSelection), then session.submit(). Set modality to "classification", "preference", or "bbox".

The trust response

submit() resolves to JSON like:

{
  "trust_score": 18,            // 0–100, higher = more trustworthy
  "verdict": "high_risk",      // "clear" | "review" | "high_risk"
  "behavioral_risk": 0.92,
  "quality_risk": 0.3,
  "ai_likelihood": 0.88,
  "reasons": ["Answer appeared in one paste with no typing", ...],
  "detector": "groq-judge (...)",
  "signals": { "time_on_task_s": 4, ... }
}

You can ignore the response in the worker UI (recommended, so workers can't see whether they were flagged) and review everything in the Sorsh operator console instead.

Effort signals

Alongside the risk signals, each assessment carries a timing-only breakdown of the wall-clock time (all in seconds, derived from event timing, never content). They are additive: active_s + idle_s + away_s = time_on_task_s.

signalmeaning
active_shands-on, in-field time (gaps between events while focused, each capped at 30s so a long think is not counted as work).
idle_sfocused-but-idle time (long pauses with the field still focused).
away_stime tabbed out of the answer field (blur to focus). Never billed as active.
first_activity_stime from task start to the first event.
longest_gap_sthe single longest focused pause.

Experimental: retype signal

Text answers also carry experimental.retype: a 0 to 1 score, a likely flag, the evidence behind it and the timing features it uses. It estimates whether an answer was typed by hand while reading it from another tab or a phone, which paste detection cannot see. It is not part of trust_score or verdict while we validate it with a labeled accuracy benchmark; the field may change.

Telemetry events (reference)

Each event is { t: ms_since_start, type, ... }. Text/transcription:

typemeaning
char / backspacea keystroke (printable / delete). No character stored.
nav ka non-printing key, reported only by class: arrow, home_end, page, enter, tab, mod (shift/ctrl/alt/cmd) or other.
careta click or drag left the cursor inside the text (going back to edit). No position stored.
paste lena paste, with the pasted length only.
insert lena large programmatic insertion (autofill/drag) that didn't fire a paste.
focus / blurfield gained / lost focus (tab-away to copy is a tell).
play / seekaudio playback for transcription tasks.

Interaction tasks add move, down, up, scroll, click, box.

Authentication

A pilot instance requires a worker access code on every submission, supplied as ?pk=CODE on the endpoint (what pilotKey sets) or an X-Sorsh-Pilot: CODE header. Submissions without it are rejected with 403. The code throttles who can post; rotate it by asking Sorsh to change it.

CORS & hosting

No-code option: the browser extension

If you would rather not touch your tool at all for a pilot, workers can install the Sorsh Trust Capture browser extension. It captures the same telemetry from your existing pages with zero code changes: each worker just sets the answer-field selector once. Ask your Sorsh contact for it. The SDK above is the better long-term integration.

FAQ

Will this slow down our tool?

No. The SDK adds passive event listeners and one POST per submission. No polling, no blocking.

What if a worker never clicks submit?

No telemetry is sent for that task. Wire submit to your real "done" action, or call Sorsh._session.submit() from your own handler.

Does it work in a single-page app?

Yes. Sorsh.embed waits for the answer field to appear, so it works when your UI renders the field after navigation.

Can a worker fake the telemetry?

The events are produced in the browser, so a sophisticated scripted client could forge realistic timing. Sorsh raises the cost of crude forgery and is layered with quality and AI-text signals; per-event signing is on the roadmap for stronger guarantees.

Can Sorsh replace my time tracker?

For the part that matters to a data-labeling team, yes: Sorsh reports genuine hands-on effort per task and per contributor (active vs idle vs away time, and an exportable timesheet) so you can pay fairly and show a client verifiable effort. What Sorsh deliberately does not do is device-level monitoring: no screenshots, no screen recording, no application or website tracking. That is a design choice, not a gap. It keeps the data minimal and defensible, and it avoids the surveillance that regulators and works councils increasingly reject. Two honest caveats on the numbers: a submission with no captured events reports its active time as a floor (up to 30s), not measured work; and for very long sessions (over 8,000 events) the client keeps only the start and end, so a dropped middle reads as idle, never as inflated active time.