Skip to content

Usage

Every call takes the state you already have. None of these functions read the clock, the filesystem, or the network.

evaluatePolicy returns one overall action. Precedence is deny, then quarantine, then require-human-review, then allow. A matched rule with severity block is what stops the call.

import { evaluatePolicy } from "@cognate/policy";
const result = evaluatePolicy(policy, context);
if (result.overall === "deny") {
// do not call the model
}

context.timestamp is yours. Pass an ISO 8601 string. The engine will not call Date.now().

Create a registry, register the model, register a version, then transition it. The legal states are registered, evaluated, approved, deployed, rejected, and retired.

import {
createRegistry,
registerModel,
registerVersion,
transitionVersion,
getCurrentDeployedVersion,
} from "@cognate/model-registry";

A version stores three hashes: weights, config, and manifest. getCurrentDeployedVersion is the deployed version, which is not automatically the newest one. RegistryError carries code, message, and hint.

On the HTTP server, approved → deployed calls verifyRelease on the repo and release recorded when the version was registered. A release that does not pass does not deploy, and neither does a request that names a different release. The refusal is recorded. transitionVersion stays the state machine: a caller who holds a snapshot moves it without that check.

GET /events/:eventId reads the log the server already writes and returns that event with an Attestia inclusion proof and the root. The caller sends the same agent headers as a write. An id that is not in this tenant’s log is a miss, and the body has no proof. Prompt and output text stay out of the event. The route does not call RepoMesh.

The grant sequence is request, then approve or reject. Revocation is its own call.

import {
registerAgent,
requestGrant,
approveGrant,
rejectGrant,
revokeCapability,
isCapabilityActive,
} from "@cognate/agent-identity";

isCapabilityActive answers from the registry state you pass. It does not ask a server.

Log, then encrypt. The tenant key stays with the caller.

import { createStore, logPrompt, logOutput, encrypt, decrypt, hashPlaintext } from "@cognate/prompt-store";

logPrompt and logOutput append. encrypt is AES-256-GCM. hashPlaintext is SHA-256 for integrity. The hash is not a substitute for encryption.