Skip to content

[PUBLISHED ON NPMJS] @takk/tribunal@1.0.0

Latest

Choose a tag to compare

@github-actions github-actions released this 30 Jun 18:46

STATUS: PUBLISHED ON NPMJS. This version was published to the npm registry on 2026-06-30T18:54:49Z with provenance attestation. View on npm: https://www.npmjs.com/package/@takk/tribunal/v/1.0.0

STATUS: REVIEW REQUIRED, NOT YET ON NPMJS. This GitHub Release was created by the release.yml workflow. The Creator must review the contents (tag, changelog, attached commit, pack-smoke result in the workflow logs) and then explicitly run npm-publish.yml to publish this version to the npm registry.

1.0.0 - 2026-06-30T18:40:38Z

Initial stable release. Tribunal is a universal, zero-runtime-dependency NPM library and CLI that governs the verification and synthesis of Massive Intelligence (IM) outputs, the open, local-first, provider-agnostic trust layer for non-human entities. It runs configurable Thinker, Worker, and Verifier roles, deterministic evaluators, and a model-as-judge over an injectable client, folds their findings into a governed verdict under a developer-defined policy with a seven-level severity ladder, and signs the verdict with Ed25519 and seals it into a tamper-evident SHA-256 audit chain. The core never speaks a provider API; it is verification logic over an injectable judge, which keeps it provider-agnostic, node-free, and testable offline.

Added

Tribunal facade

  • Tribunal (@takk/tribunal/tribunal): the facade most callers use. It exposes addEvaluator, evaluatorCount, hasPanel, and listEvaluators for configuration, tryCandidate (verify one candidate into a governed verdict), tryCase (verify several candidates and synthesize a final answer with provenance), sealedVerdict (verify, sign with Ed25519, and seal into an audit chain), and snapshot (a descriptive view of the configured evaluators, judges, and policy). A clock is injectable so verdicts are fully deterministic in tests.

Evaluators

  • latencyEvaluator, schemaEvaluator, regexEvaluator, exactMatchEvaluator, validateSchema, runEvaluators, and EvaluatorRegistry (@takk/tribunal/evaluators): the cheap, deterministic checks that run offline with no network and fold into the same verdict as the model-as-judge. Each returns a typed Evaluation with a boolean passed, a score in [0, 1], a severity, and a reason. schemaEvaluator carries a minimal, dependency-free JSON shape validator.

Model-as-judge

  • createHeuristicJudge, createConstantJudge, and judgeEvaluator (@takk/tribunal/judge): the injectable model-as-judge. createHeuristicJudge is a deterministic, dependency-free judge that scores a candidate against a rubric's own mustInclude/mustAvoid hints, so tests, examples, and the CLI run a real deliberation offline with reproducible numbers. judgeEvaluator adapts any JudgeClient into an Evaluator. The JudgeClient.judge(request) contract is the seam that keeps the core provider-agnostic; the real LLM-as-a-judge is the caller's concern.

Panel

  • deliberatePanel and quorumNeeded (@takk/tribunal/panel): mixture-of-agents cross-verification. A panel runs several judges over the same candidate concurrently and folds their votes under a configurable quorum (majority, unanimous, any, or { atLeast: n }), reporting passes, the quorum needed, the mean score, and the agreement fraction.

Rubric

  • defineRubric, scoreRubric, summarizeRubric, and totalWeight (@takk/tribunal/rubric): a weighted set of criteria plus the weighted score a candidate must reach to pass. defineRubric validates a non-empty id, at least one criterion, unique criterion ids, positive weights, and a pass threshold in [0, 1].

Verdict

  • buildVerdict, renderVerdict, verdictLine, and DEFAULT_POLICY (@takk/tribunal/verdict): the governance core. A seven-level severity ladder (info, low, minor, moderate, major, critical, blocker) and a developer-defined policy decide the outcome: a verdict fails when any finding lands at or above failAtOrAbove, or when the aggregate score drops below an optional minScore. The verdict's severity is the worst of its findings, and it records the provenance of every evaluator and judge that contributed.

Synthesis

  • governedSynthesis (@takk/tribunal/synthesis): selects a final answer from judged candidates under an explicit strategy (best-passing, highest-score, or unanimous-pass), recording every candidate considered. It never invents content; the chosen answer is always one of the judged candidates, and ties break by lower severity.

Signing

  • generateSigningKeyPair, signVerdict, and verifyVerdictSignature (@takk/tribunal/signing): Ed25519 verdict signing over the Web Crypto API, so the surface stays node-free. A signed verdict carries a base64url signature over the canonical JSON of the verdict plus the public key needed to verify it. verifyVerdictSignature returns false (never throws) on a mismatch.

Audit trail

  • AuditChain, sealVerdict, verifyChain, and GENESIS_HASH (@takk/tribunal/audit): an append-only, SHA-256 hash-chained log over the Web Crypto API. Each entry binds to the previous hash, so altering any past entry breaks every hash after it, and verifyChain reports the first broken index. The seal proves a log was not altered after sealing (integrity); the Ed25519 signature proves who issued a verdict (authenticity).

Roles

  • Thinker, Worker, and Verifier (@takk/tribunal/roles): ROLES, ROLE_DEFINITIONS, describeRole, isRole, and composeVerifierSystem. The role-prompt scaffolds are plain strings a caller can feed to a real model-as-judge, exported and overridable, the deliberate opposite of an endpoint that hides who reasoned, who produced, and who checked.

Adapters and the tool

  • judgeClientFromChat, judgeClientFromVercel, buildJudgePrompt, parseJudgeReply, createVerifyTool, parseVerifyInput, and toJsonSafe (@takk/tribunal/adapter). Two-line bridges wrap an OpenAI-style chat function or a Vercel AI SDK call as a JudgeClient by building a Verifier prompt from the rubric and parsing strict JSON back into a typed reply. The tribunal is exposed as a framework-agnostic tool (name tribunal_verify) with a JSON Schema and a JSON-safe handler, ready to register with an MCP server or any tool-calling API. Model-supplied input is parsed defensively; the evaluators and policy are fixed by the host, never the caller.

Node loaders and the edge mirror

  • readJsonFile, writeJsonFile, loadCase, loadRubric, loadKeyPair, loadVerdict, and loadChain (@takk/tribunal/node): the only entry that touches a Node built-in, reading and validating a case, a rubric, a signing key pair, a verdict, or a saved audit chain from JSON. @takk/tribunal/edge re-exports the node-free core for Cloudflare Workers, Vercel Edge, Bun, Deno, and the browser.

CLI

  • The tribunal binary: verify <case.json> --rubric <rubric.json> (run a verifier panel over a case and synthesize), judge <candidate.txt> --rubric <rubric.json> (one candidate against a rubric), keygen [--out <keypair.json>] (generate an Ed25519 key pair), audit-verify <chain.json> (verify a sealed chain), and verdict <verdict.json> [--pubkey <key.json>] (render a verdict and verify its signature). Exit codes: 0 ok or pass, 2 usage or input error, 10 verdict failed, 20 a broken audit chain, 21 an invalid signature. The CLI runs offline with the deterministic heuristic judge; real runs use the library API with an injected judge.

Errors

  • TribunalError with a stable, machine-readable code (@takk/tribunal): INVALID_CONFIG, INVALID_EVALUATOR, INVALID_CANDIDATE, INVALID_CASE, INVALID_ROLE, INVALID_RUBRIC, INVALID_PANEL, INVALID_VERDICT, INVALID_SEVERITY, INVALID_SIGNATURE, INVALID_STATE, INVALID_SNAPSHOT, NUMERIC. Callers branch on error.code, never on the message.

Examples and the composition benchmark

  • Six runnable examples that verify against the built dist: verifying a candidate with evaluators and a panel, mixture-of-agents cross-verification under each quorum, Ed25519 signing with tamper detection, an auditable trail with tamper detection, governed synthesis with provenance, and a chat-judge adapter plus the verify tool.
  • A composition benchmark (benchmarks/composition-benchmark.mjs) that runs the built panel over a controlled error model with known ground truth, 4000 trials per regime on a fixed seed. It measures the error reduction a majority panel contributes: independent judge errors, five judges, single 71.4% to panel 84.5% (error cut 46.1%, the Condorcet effect); seven judges, 69.6% to 87.5% (58.7%); correlated errors, 70.2% to 70.2% (no gain, the honest limit). It is a mechanism demonstration, not an LLM quality claim.

Engineering

  • Zero required runtime dependencies; a node-free core (both the Ed25519 signatures and the audit seal use the Web Crypto API, not node:crypto); dual ESM and CJS distribution with separate .d.ts and .d.cts per subpath; fourteen subpath import surfaces (the root barrel plus thirteen focused subpaths) and ./package.json.
  • TypeScript 6 in maximum strict mode (exactOptionalPropertyTypes, useUnknownInCatchVariables, noUncheckedIndexedAccess, noPropertyAccessFromIndexSignature, verbatimModuleSyntax, isolatedModules). Biome 2.5 lint clean.
  • 117 tests across 18 suites passing under Vitest 4 on Node 20, 22, and 24. Coverage: statements 96.43%, branches 88.67%, functions 99.28%, lines 96.34%, above the 80/80/80/80 thresholds.
  • publint clean and @arethetypeswrong/cli green across all subpaths. size-limit under budget on every bundle (brotli core 6.35 kB). A distribution smoke test exercises the compiled ESM and CJS artifacts, a full verification with a panel, Ed25519 sign, seal, and verify, tamper detection, and the compiled CLI spawned as a single Node process.
  • SLSA provenance attestation on every published version via GitHub Actions OIDC.

Not in 1.0 (documented non-goals)

  • A built-in provider transport (Tribunal never speaks a provider API; you inject the judge).
  • A learned or calibrated judge (the built-in judge is deterministic, not an LLM; calibration of a real model-as-judge is mitigated by panels and rubrics, not promised by the library).
  • Key management (you generate, store, and protect your signing keys; Tribunal signs and verifies only).
  • A networked or distributed audit log, a runnable MCP server binary, a browser verdict playground, and selective confidence-gated verification, all planned for later releases.