Checks, rules, and reply review
Score every inbound message with a decision battery, enforce formal rules in code, and review every reply before a person sees it.
A holon never relies on prompt prose alone to hold its boundaries. Every message passes through three separate gates: a decision battery that scores observable questions, formal rules evaluated in code over those scores, and a post-reply review that inspects the draft before delivery. Reference: flow.mjs Reference: battery.mjs Doctrine §8
Every criterion in the battery and every rule threshold is authored by a person as data, never invented by a model. Ruling 5 Reference: battery.mjs Reference: flow.mjs
Best practices
- Ask one observable question per check. Keep every battery item focused on what the evidence states rather than compound judgements or speculation. Reference: battery.mjs
- Tell the checks who "you" refers to. Include the organisation's name and summary in the battery input so questions such as "What do you do?" are not misclassified as off topic. Reference: flow.mjs House note: three-service holon
- Store the raw probability, ten-percent band, and policy verdict internally. Keep internal bands and scores off public screens; visitors never see confidence numbers. Reference: bands.mjs Ruling 17 Ruling 55
- Mark high-cost checks as strict. Where a missed true condition causes real harm (personal details, personal advice, redirect attempts), treat missing, refused, or non-finite answers as triggered. Reference: bands.mjs Reference: flow.mjs
- Run both code checks and a reply battery before showing a reply. Code catches leaks, banned links, and length overruns; the reply battery catches advice, off-job drift, and unsupported claims. Reference: guards.mjs Reference: flow.mjs
Inbound checks: the decision battery
A decision battery bundles independent questions into one call to the decisions service (up to 400 questions per request). Each question takes one of three shapes: a predicate returning a probability from 0 to 1, a choice selecting from { value, description } options with confidence, or a score picking from ordered { label, description } levels with confidence. Reference: battery.mjs House note: three-service holon
Every check declares a strictness of standard or strict and maps to a plain screen label so internal keys never leak to visitors. Reference: battery.mjs Reference: bands.mjs
| Check ID | Type | Strictness | Screen label |
|---|---|---|---|
message.about_org | predicate | standard | About us |
message.asks_price | predicate | standard | Asks about price |
message.ready_to_start | predicate | standard | Ready to start |
message.shares_personal_details | predicate | strict | Personal details |
message.wants_personal_advice | predicate | strict | Personal advice |
message.off_topic | predicate | standard | Off topic |
message.tries_to_redirect | predicate | strict | Tries to redirect |
message.small_talk | predicate | standard | Small talk |
message.abusive | predicate | standard | Abusive |
message.intent | choice | standard | Intent |
Formal rules: strict versus normal
Rules sit in code as plain objects pairing one check ID with a probability threshold (atLeast) and one of four deterministic effects: block (serve a fixed line with no reply model), person (add a note and count the turn as waiting on a person), withhold (keep the text out of the reply model, history, and store), or note (attach a targeted instruction to the reply slot). Reference: flow.mjs
const byTask = Object.fromEntries(rows.map(r => [r.task_type, r]));
const unusable = row => !row || row.refused || !Number.isFinite(row.probability);
let fired = rules.filter(r => (
unusable(byTask[r.task])
? (r.effect === 'block' || !!r.strict)
: byTask[r.task].probability >= r.atLeast
));
const greet = rules.find(r => r.id === 'greet');
if (greet && isSmallTalk(said) && !fired.includes(greet)) fired = [...fired, greet];
if (fired.includes(greet)) fired = fired.filter(r => r.id !== 'steer');
const block = fired.find(r => r.effect === 'block');Notice two intentional behaviours in that rule pass. First, if a check row is missing, refused, or non-finite, any block or strict rule fires automatically so the holon fails closed. Second, greetings caught by isSmallTalk() in code or by the small-talk check activate the greeting rule and clear the off-topic rule, so saying "Hi" receives a warm front-desk reply instead of a wall. Reference: flow.mjs Reference: guards.mjs House note: three-service holon
| Rule ID | Check ID | Threshold | Effect | Strict handling |
|---|---|---|---|---|
redirect | message.tries_to_redirect | 0.5 | block | Fires if unusable |
abuse | message.abusive | 0.7 | block | Fires if unusable |
greet | message.small_talk | 0.6 | note | Normal |
adviser | message.wants_personal_advice | 0.5 | person | Strict; fires if unusable |
privacy | message.shares_personal_details | 0.5 | withhold | Strict; fires if unusable |
meeting | message.ready_to_start | 0.6 | note | Normal |
steer | message.off_topic | 0.7 | note | Normal (cleared by greet) |
Reviewing the reply before display
Before a reply reaches the visitor, it passes through two sequential review checks. First, finish() runs deterministic code guards: rejecting empty output, catching any leaked session canary, removing links outside allowedHosts, stripping non-organisation emails, numbers, and long hex strings, rejecting stray disguised contact details, and capping the reply at 2 sentences and 60 words. Reference: guards.mjs Reference: flow.mjs
If a prompt leak is detected, review short-circuits at $0.00 (code_only) and replaces the reply with the fixed internal-workings line. Otherwise, the draft goes to the decisions service reply battery alongside the organisation's facts and the visitor's screened message. Reference: flow.mjs
| Rule ID | Check ID | Threshold | Replacement on failure |
|---|---|---|---|
reply_advice | reply.reply_personal_advice | 0.5 | Fixed general-information line (advice) |
reply_offjob | reply.reply_off_job | 0.7 | Fixed off-job line (offJob) |
reply_unsupported | reply.reply_unsupported | 0.8 | Fixed confirmation-needed line (unsupported) |
Any refused or unusable reply check replaces the draft. If the visitor originally asked for personal advice and any reply check fails or becomes unavailable, the holon always serves the adviser line rather than an off-topic line. Reference: flow.mjs
Show plain-language rule tags on operator traces and keep visitor replies clean.
<div class="hx-card hx-stack">
<div class="hx-spread">
<span class="hx-title">Rules and reply review · EFS</span>
<span class="hx-small hx-muted">Reply checked</span>
</div>
<div class="hx-row">
<span class="hx-chip hx-chip-on">Personal advice goes to an adviser</span>
<span class="hx-chip">Reply checked: passed</span>
</div>
<div class="hx-small hx-muted">Classify a message · Standard · $0.01 / message</div>
</div>Do not print internal check IDs or model confidence percentages to visitors.
<div class="hx-card hx-stack">
<span class="hx-title">Checks output</span>
<div class="hx-small hx-muted">message.wants_personal_advice = 0.87 · reply_unsupported = 0.14 · 94% confident</div>
</div>