Developers
Use the engine outside the browser.
The browser tools at Verify and Infer are the fastest way to check AI data transformations. For pipelines, scripts, and AI agents, the same engine is live today as a hosted MCP/HTTP endpoint. The npm package, local MCP server, and CLI are implemented in the repo and documented below as the public release target.
All four interfaces run the same deterministic program synthesis engine. No LLM. Same input, same rule, same result.
Availability: the hosted MCP/HTTP endpoint is live today. The npm package, local MCP package, and CLI are implemented and verified in the repo; the commands below are the public release target and will work after the npm packages are published.
npm package
Availability: implemented and prepared for npm publishing. Use the hosted MCP/HTTP endpoint below until @latentmachine/verify is available on npm.
@latentmachine/verify is a zero-dependency, ESM-only Node.js package.
It exposes verify, infer, transform, fingerprint, canonicalize, structuralDiff, and profileStructure,
plus format utilities for JSON, CSV, YAML, TOML, XML, .env, and SQL INSERT input.
Install
npm install @latentmachine/verify
Verify a batch
Pass the original records and the AI-generated output. The engine infers the majority transformation rule and flags every row that does not follow it.
import { verify } from "@latentmachine/verify";
const result = verify({
original: [
{ first: "Ana", last: "Meyer", joined: "2026-03-02" },
{ first: "Bo", last: "Singh", joined: "2026-03-04" },
{ first: "Clara", last: "Diaz", joined: "2026-03-05" },
],
transformed: [
{ name: "Ana Meyer", joinedDate: "2026-03-02" },
{ name: "Bo Singh", joinedDate: "March 4, 2026" },
{ name: "Clara Diaz", joinedDate: "2026-03-05" },
],
});
console.log(result.verdict);
// "inconsistent"
console.log(result.flaggedRows);
// [{ index: 1, input: {...}, expected: {...}, actual: {...} }]
Infer a rule
Show input/output pairs. The engine infers the simplest deterministic rule that explains the examples, or reports ambiguity, contradictions, or insufficient evidence.
import { infer } from "@latentmachine/verify";
const result = infer({
examples: [
{ input: { first: "Ana", last: "Meyer" }, output: { name: "Ana Meyer" } },
{ input: { first: "Bo", last: "Singh" }, output: { name: "Bo Singh" } },
],
});
console.log(result.status);
// "safe"
Apply a rule
Once you have a safe rule, apply it to new input. The transformation is deterministic: same input, same rule, same output.
import { infer, transform } from "@latentmachine/verify";
const { rule } = infer({
examples: [
{ input: { first: "Ana", last: "Meyer" }, output: { name: "Ana Meyer" } },
{ input: { first: "Bo", last: "Singh" }, output: { name: "Bo Singh" } },
],
});
const output = transform({
rule,
input: { first: "Clara", last: "Diaz" },
});
console.log(output);
// { name: "Clara Diaz" }
Fingerprint data
Compute a deterministic, non-cryptographic identity hash for parsed data, profile its structure, or compare two values path by path. Object key order is ignored; array order is significant.
import { fingerprint, structuralDiff } from "@latentmachine/verify";
const left = { a: 1, b: [2, 3] };
const right = { b: [2, 4], a: 1 };
console.log(fingerprint(left).hex);
console.log(structuralDiff(left, right).counts);
// { added: 0, changed: 1, removed: 0, same: 1 }
Trace analysis contracts
The stable Trace product uses deterministic analyzeTrace(value, options) and compareTrace(baseline, candidate, options) contracts for field profiles, ranked evidence, sampling, and single or compound keyed row comparison. These website-source contracts are versioned but are not exported by @latentmachine/verify yet. The package's existing fingerprint exports above remain stable and unchanged.
String input and formats
verify also accepts raw strings. The format can be auto-detected, and the
package exposes the same parsers used by the browser tool.
import { detectFormat, parseWithFormat, serializeWithFormat } from "@latentmachine/verify";
detectFormat('[{"id": 1}]'); // "json"
detectFormat('id,name\n1,Ada'); // "csv"
detectFormat('key: value'); // "yaml"
const data = parseWithFormat('[{"id": 1}]', "auto");
const csv = serializeWithFormat(data, "csv");
// "id\n1"
Return values
verify() returns:
verdict:"consistent"or"inconsistent".totalRows: number of rows checked.matchedRows: rows that followed the majority rule.flaggedRows:{ index, input, expected, actual }for rows that broke the pattern.ruleStatus:safe,ambiguous,contradictory,unsafe, orinsufficient.
infer() returns:
status: the evidence state for the inferred rule.rule: the symbolic program to pass totransform().confidence: evidentiary confidence assessment.diagnosis: contradictions, ambiguities, guardrails, and suggested examples.warnings: runtime or inference risks.
MCP server
The Latentmachine engine is available as a Model Context Protocol server. When connected, AI assistants can call the verification engine directly inside a conversation: the AI transforms data, then Latentmachine checks whether every row is consistent.
Remote server
Connect any MCP client that supports remote HTTP MCP servers to the hosted endpoint. No install required.
Remote MCP config for clients that accept a URL:
{
"mcpServers": {
"latentmachine": {
"url": "https://latentmachine.com/api/mcp"
}
}
}
Claude Code when HTTP transport is enabled:
claude mcp add --transport http latentmachine https://latentmachine.com/api/mcp
Workspace config for clients that read .cursor/mcp.json-style files:
{
"mcpServers": {
"latentmachine": {
"url": "https://latentmachine.com/api/mcp"
}
}
}
Local server
Availability: implemented and prepared for npm publishing. Use the remote MCP server above until @latentmachine/mcp is available on npm.
Run the MCP server locally over stdio. Data stays on your machine.
npm install -g @latentmachine/mcp
Then add to your MCP client config:
{
"mcpServers": {
"latentmachine": {
"command": "latentmachine-mcp"
}
}
}
Or without a global install:
{
"mcpServers": {
"latentmachine": {
"command": "npx",
"args": ["@latentmachine/mcp"]
}
}
}
Available tools
- verify_data_transformation: check whether a batch of transformed rows all follow one rule.
- infer_transformation_rule: infer a rule from input/output examples.
- apply_transformation_rule: apply a previously inferred rule to new data.
- detect_data_format: detect JSON, CSV, YAML, TOML, XML, .env, SQL INSERT, or unknown data.
- fingerprint_data: compute a deterministic structural fingerprint, or compare two datasets path by path.
Example conversation
You: I asked ChatGPT to transform these customer records. Can you check
if it got every row right?
[paste original + transformed data]
Claude: I checked 200 rows against the majority rule. 197 followed
the pattern, but 3 rows have inconsistencies: rows 44, 89,
and 156 show date format drift. The rule expects ISO dates,
but those rows switched to US format.
CLI
Availability: implemented and prepared for npm publishing. The command below is the public release target and will work after @latentmachine/verify is published.
Verify data transformations from the command line. Useful in shell scripts, CI pipelines, and pre-commit hooks.
Usage
npx @latentmachine/verify original.json transformed.json
npx @latentmachine/verify fingerprint data.json
npx @latentmachine/verify fingerprint before.json after.json
Prints the verification result as JSON. Exits with code 0 if consistent,
code 1 if inconsistent. Pipe to jq for specific fields:
npx @latentmachine/verify original.json ai-output.json | jq '.verdict'
# "consistent"
The fingerprint subcommand prints a deterministic, non-cryptographic identity hash and exits with code 1 when two compared files differ.
In CI
# GitHub Actions example
- name: Verify data transformation
run: npx @latentmachine/verify fixtures/input.json fixtures/expected.json
The step fails if any row breaks the pattern.
HTTP API
The MCP endpoint at https://latentmachine.com/api/mcp also works
as a standard JSON-RPC API. You can call it from any HTTP client.
List available tools
curl -X POST https://latentmachine.com/api/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'
Verify a batch
curl -X POST https://latentmachine.com/api/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "verify_data_transformation",
"arguments": {
"original": "[{\"id\":1,\"date\":\"2026-01-01\"},{\"id\":2,\"date\":\"2026-01-02\"}]",
"transformed": "[{\"id\":1,\"date\":\"2026-01-01\"},{\"id\":2,\"date\":\"01/02/2026\"}]"
}
}
}'
Fingerprint data
curl -X POST https://latentmachine.com/api/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "fingerprint_data",
"arguments": {
"data": "{\"a\":1,\"b\":[2,3]}",
"compare_to": "{\"b\":[2,4],\"a\":1}"
}
}
}'
Server info
curl https://latentmachine.com/api/mcp
Returns the server name, version, and list of available tool names.
Privacy
The browser tools process data entirely on your device. Nothing is uploaded. This is an architectural decision, not a policy.
The local MCP server (@latentmachine/mcp via stdio)
and the npm package also process data locally. Your data never
leaves your machine.
The remote MCP endpoint and HTTP API at
latentmachine.com/api/mcp process data on Vercel infrastructure.
No data is stored, logged, or persisted by the function. It is stateless and returns
the result immediately, but the data does travel over the network. If that matters for
your use case, use the local MCP server or the npm package instead.
Links
- npm package links will appear after the packages are published.
- Source on GitHub
- About Latentmachine
- Case Study