Check an answer against a policy
Flag unsupported statements before a draft reply reaches the customer.
Start with a short explicit rule
Install the SDK and set NULLPROTOCOL_KEY as in the quickstart. Create an agent with ID policy-reviewer and instructions: “Compare the draft with the supplied policy. Identify contradictions and missing information. Do not invent exceptions.”
Validate the draft
policy.mjs
import { NullProtocol } from 'nullprotocol';
const agent = await NullProtocol.load({
key: process.env.NULLPROTOCOL_KEY,
agentId: 'policy-reviewer'
});
const result = await agent.validate(
'The draft must agree with the policy. Flag unsupported promises.',
'We will refund your gift card in full.',
{ reference: 'Unused goods may be returned within 30 days. Gift cards are not refundable.' }
);
if (!result.success) throw new Error(result.error);
if (result.recommendation !== 'pass') {
console.log('Needs review:', result.reasoning);
} else {
console.log('Passed the model review; apply application checks next.');
}Treat it as a review signal
For the supplied rule, the draft contradicts the gift-card exception. Inspect the recommendation and reasoning, then try a supported statement and a statement the policy does not answer.
This is a reasoning task, even when the policy is short. Test the selected model on your real examples. Keep hard eligibility checks and financial decisions in code; a model recommendation does not authorize a refund.