# Unmuddle developer guide
Unmuddle turns voice into evidence-backed fields for your application. The speech stage captures the words. A private profile defines the business question and vocabulary. A verified lookup supplies the records visible in the active interaction. A result includes the spoken values, record matches, derived fields and any remaining question.

## First request without a key

Fetch the public examples from the beta or set `UNMUDDLE_ORIGIN` to your local server. This read-only request uses fixed observations and calls no model. You need curl and jq.

```sh
export UNMUDDLE_ORIGIN=https://unmuddle.noodleseed.dev
curl -fsS "$UNMUDDLE_ORIGIN/demo/cases" | jq '
  .scenarios[] | select(.profile == "retail/order")
  | .languages[] | select(.language == "ur-PK")
  | .states | {heard: .current.source, one_match: .current.interpretation.result,
               two_matches: .competing.interpretation.next}'
```

Look for `boxes: 2` and `product_id: "B"` with one matching offer. With two matching offers the next step is `clarify`. The [context lab](/examples#lab) shows the names and underlying records.

## Walk through a work order

Open [Guided examples](/console#demo), choose Field service and select English. Keep the technician’s words on screen while you change the approval from Current records to Updated records. Compare the reported labor, the excess time and the record used as evidence. Choose Lookup unavailable to see which field still has support. These examples run on published fixtures.

Open [Profiles](/console#profiles) to explore the same work order. Expand the field for reported time, then the field that calculates excess time. Add your team's vocabulary and save a private version. In [Evaluations](/console#evaluations), choose **Use four sample cases** or **Build a labeled dataset**. Select a reference and an optional comparison version. Hosted evaluation uses the spending limit you enter. For an integration demonstration without inference, use **Send test request** under [SDKs & API](/console#integrate).

## Market examples

Try the same business task in English, Urdu, Arabic, Spanish or Canadian French. In the lab, switch the speaker’s language or expand the English reading. Device playback uses the speech voices available on your computer. These scripted examples exercise the resolver. For a live rollout, evaluate regional vocabulary, code-switching, accents and noise with recordings representative of your customers.

## Quickstart

For a live audio request, sign in to an enabled project, connect the project's ordinary OpenRouter inference key and verify an approvals context binding. Create a backend key with `assets:write`, `runs:write` and `runs:read`. Set `UNMUDDLE_PROJECT_KEY` and `UNMUDDLE_BINDING` on your backend. Save a short WAV file as `note.wav`. Running a live example can spend provider credits. [Open integration tools](/console#integrate).

## Run your first project request
Open your private invite at the beta origin and enroll a passkey. In the console, go to Model connection and save an ordinary OpenRouter inference key. Your beta operator must also enable the project budget and a tested route. In Context endpoints, verify a lookup that returns your application’s records. In the Playground select a profile, set the record scope and binding, and submit a short audio note. Compare the request JSON with the returned claims and their evidence.

For a backend integration, issue a scoped Unmuddle key in Project & access. An audio example needs `assets:write`, `runs:write` and `runs:read`. Keep this key in your backend secret store. The SDKs & MCP tab has copyable examples for TypeScript, Python, cURL and remote MCP. Signed-in owners handle provider credentials, team access and production profile promotion.

## Run locally
Use Node 24.16.0 and pnpm 11.5.2. From the service directory run `pnpm install --frozen-lockfile`, `pnpm ops:init`, then `pnpm dev:up`. Open the loopback console with the project key from the private .state directory. The default fixture mode handles example text offline. Live mode requires NSI_MODE=openrouter and explicit speech and field model settings.

## Submit a note
POST raw audio to /v1/assets with a project bearer, an Idempotency-Key, and Content-Type. Submit POST /v1/interpretations with another Idempotency-Key, profile "field-service/labor@1" and a source such as {"id":"s1","role":"input","media_type":"audio/ogg","asset":"<asset ID>"}. Supply context.scope_ref, context.as_of and context.bindings.approvals. Poll the Location header until succeeded or failed. Inspect each claim’s state and evidence before taking a business action.

## Register a context endpoint
POST /v1/context-bindings with {"url":"https://your-service.example/approval","bearer":"<dedicated credential>"}. Save the returned challenge at that handler. When the service sends {"purpose":"verify","challenge_id":"…"}, respond with {"proof":"<challenge>"}. POST /v1/context-bindings/{id}/verify. Normal read requests contain scope_ref, as_of, purpose, query and request_id. Return scope_ref, revision, effective_at, valid_until and rows such as [{"id":"A","approved_minutes":120}]. Missing, inconsistent, or unauthorized records cannot resolve the variance.

## Revisions, profiles and evaluation
POST /v1/interpretations/{id}/revisions with parent_revision and additional sources. GET /v1/interpretations/{id}/revisions/{n} for the immutable earlier result. GET /v1/profile-templates for complete examples of field manifests. POST /v1/profiles to freeze a custom definition and receive a versioned reference. POST /v1/datasets and /v1/evaluations to compare registered profiles on private snapshot fixtures. Supply a JSON array of cases, each with id, scope, as_of, sources, snapshots and expect.fields. POST /v1/evaluations with dataset, candidates and an optional split (holdout or development). It returns 202. Poll GET /v1/evaluations/{id} for per-case and per-language results. Both supplied and private profiles use the same frozen inputs. A live evaluation can spend the project’s OpenRouter credits once per case per candidate. An owner can POST a version, evaluation ID and expected_current to /v1/profiles/{domain}/{name}/promotions to move @production. The first promotion uses null for expected_current. A rollback uses the same endpoint and a qualifying evaluation for the target version.

## Errors and scope
Foreign project resources return 404. Paid call outcomes that cannot be determined are failures. Reuse your Idempotency-Key only with the same request. The console includes the request ID in error messages for operator troubleshooting.

## SDK downloads and MCP
Run `pnpm sdk:build` before starting the local download service. GET /downloads/manifest.json for versioned filenames and SHA-256 digests. Install the verified tarball with npm install or the verified wheel with python -m pip install. The public endpoints are /downloads/noodleseed-interpret-0.2.0.tgz and /downloads/noodleseed_interpret-0.2.1-py3-none-any.whl.

A local MCP client can use Streamable HTTP at /mcp with the separate MCP bearer generated by ops:init. It supports list_profiles, interpret, get_interpretation, clarify_interpretation, run_evaluation, get_evaluation and interpret://docs/guide. It enforces the same project authorization as REST. The hosted endpoint uses owner consent and audience-bound OAuth tokens. See Hosted comparisons, notifications and MCP below.

## Receive completion events
Register a project subscription with POST /v1/webhooks using url and events, e.g. ["interpretation.succeeded","revision.failed","evaluation.succeeded"]. Save the one-time signing_secret securely. Install the challenge at your receiver and POST /v1/webhooks/{id}/verify. The verification POST to your receiver contains only purpose and challenge_id. Respond with a JSON proof as for context bindings.

For each delivery, verify the HMAC-SHA256 of the timestamp, a period and the exact raw request body using the signing secret. Compare the hex digest to Nsi-Signature after removing v1= using a constant-time comparison. Reject timestamps farther than five minutes from the current time. Verify the event ID in the signed body, deduplicate it before processing, and return 2xx to acknowledge. Poll /v1/webhook-deliveries for attempts. A project owner can POST /v1/webhook-deliveries/{id}/redeliver with an idempotency key; the signed event ID persists across attempts.

## Project vocabulary
A private profile can set voice.vocabulary (up to 50 phrases) and voice.refinement to "uncertain". An operator can pin NSI_OPENROUTER_REVIEW_MODEL alongside the speech and field models. A qualifying voice note can then make one additional project-funded audio review call. The service rejects proposed transcript changes that alter digits or substitute a business name for ordinary words without supporting evidence.

## Correct an observation
Include corrects in a revision body, e.g. {"parent_revision":1,"sources":[{"id":"clarification","role":"input","media_type":"text/plain","text":"Actually three hours"}],"corrects":["reported_minutes"]}. Use an observed claim ID. The revised result links changes to the prior revision and recomputes dependent values against the original snapshot by default. If the new evidence is insufficient the targeted field becomes unresolved. The previous result remains readable under its original revision number.

## Hosted owner access

Open your private invitation at the beta origin and enroll a passkey. Returning members can open [Sign in](/signin) directly. To enable Google sign-in, open [Project & access](/console#access), choose **Link Google account**, verify your passkey and select your Google account. On later visits choose **Sign in with Google**. Sensitive settings still ask for your passkey. Disconnecting Google in Project & access ends existing Google-backed sessions. If your membership is removed, contact your project owner. The project requires an authorized budget and tested route before paid processing.

The self-service flow uses the owner’s ordinary inference key. Managed OpenRouter consent is coordinated with your beta operator. A freshly verified passkey is required to start and finish the exchange. The provider callback returns to the console after the service validates and encrypts the ordinary key. For app access the owner can POST `{"scopes":["runs:read"]}` to `/v1/keys` with the session cookie and the CSRF token from `GET /auth/session`. Capture the returned token privately. DELETE `/v1/keys/{id}` with a fresh owner session to revoke it.

## Hosted comparisons, notifications and MCP

Create a private dataset from labeled cases with a development or holdout split. Import copies referenced audio into project-private dataset retention. POST an evaluation with immutable candidate versions, dataset ID, optional split and a positive integer `budget_micro_usd`. The service rejects a budget below the sum of the pinned per-job bounds. Evaluation jobs use frozen context. A successful holdout report can authorize an owner to promote an eligible private version. Supply the expected current alias, target version, evaluation ID and an idempotency key. Rollback uses the same checks on a prior version.

Register interpretation success or failure subscriptions at `/v1/webhooks`. Keep the returned signing secret privately and answer the ownership challenge before delivery. Inspect attempts at `/v1/webhook-deliveries`. To retry a completed or dead delivery, POST its `/redeliver` operation. Receivers should deduplicate using Nsi-Event-Id.

The primary hosted MCP endpoint is `https://unmuddle.noodleseed.com/mcp`. The developer hostname `unmuddle.noodleseed.dev` serves the REST API, SDK downloads and this guide. Console sign-in and OAuth consent use the product hostname. Register a named public client through `pnpm ops:mcp-client --manifest /secure/nsi-beta.json --client NAME --name LABEL --redirect EXACT_CALLBACK`. Discovery advertises the S256 authorization-code flow. The signed-in owner reviews the project, client, scopes and paid permissions and follows the return link. Send the same resource when exchanging or refreshing a token. Refresh tokens rotate and a reused refresh token revokes its family. MCP tokens are audience-specific.

## Usage export

With a key scoped to `usage:read`, request `GET /v1/usage` for a page of platform records or `GET /v1/usage.csv?month=2026-11` for a UTC calendar month. A blank provider amount with cost source `unknown` means the provider did not report a usable charge. The platform unit identifies an interpretation revision or evaluation case/candidate. Use the customer's OpenRouter statement for billing reconciliation.

## Measuring accuracy

The [public resolver report](/demo/quality) reruns twelve labeled regression cases through the claim resolver. Each of three profiles has a standard case, another language, competing records and a missing lookup. A case passes when every labeled field has the expected state, each resolved value meets its label with evidence, and the next step matches. These fixtures supply their observations. The sixty interactive lab variations are demonstrations and do not increase the benchmark sample size.

To measure real voice accuracy, reserve consented held-out audio before tuning. Have reviewers familiar with the locale label the words, target record, required parameters and whether a decision was possible with the records at that moment. Freeze the audio, schema, context snapshot, profile version, label revision and scoring rules.

Compare transcript word error against a human transcript. For the business comparison, give a transcription-plus-extraction baseline and Unmuddle the same audio, task schema and authorized records. Score the final fields and next step against the same labels. A transcript alone has no business decision to grade.

The private evaluation console groups results by profile and language. It shows cases passed and graded, ungraded cases and wrong critical fields. The first candidate is the reference. Each other candidate shows gains, regressions, paired sample size and the percentage-point change on cases graded for both. A failed or unfinished call stays visible in the evaluation status.

Publish paired case-pass counts and percentage-point differences by task and locale, sample sizes, uncertainty intervals, wrong critical record IDs, correct abstentions and regressions. Report latency and cost separately. No held-out audio result or comparative accuracy lift has been published here. [Open private evaluations](/console#evaluations).

## Troubleshooting a first run

**No product or deployment matched.** Inspect the claim’s reason and coverage. Verify that the binding belongs to this project and returned a snapshot covering the same scope and timestamp. A partial result can still contain usable spoken fields.

**Two records fit.** Use the returned next step. Ask the speaker to disambiguate, submit a revision against the current parent and keep the earlier result for audit.

**Access or funding error.** Check the active project and key scopes. The OpenRouter key funds inference. A separate Unmuddle project key authorizes your backend. The owner manages the connection and your operator enables a tested route and spending ceiling.

**Request timed out.** Keep the resource ID and poll the existing run. For a transport retry, reuse the original idempotency key with exactly the same body. Include the request ID when contacting your operator.


## Build a voice operator

Separate the spoken request, the actions currently available and the records the user is allowed to see. For “Call Sami,” return the spoken name and a proposed call action. The phone checks its local contact directory, asks which person when several names match, and presents the call for confirmation. Check permissions again immediately before acting. Keep the address book on the device.

For “What’s the score?” identify the team and competition before looking up the answer. A sports score, business address or market quote needs an authorized source, a timestamp and a valid observation window. Supply those through a verified context binding scoped to this interaction. Missing or stale records should produce an unresolved field. The application supplies the information provider and displays attribution.
