DecidrHolon Design Kit

Patterns

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 IDTypeStrictnessScreen label
message.about_orgpredicatestandardAbout us
message.asks_pricepredicatestandardAsks about price
message.ready_to_startpredicatestandardReady to start
message.shares_personal_detailspredicatestrictPersonal details
message.wants_personal_advicepredicatestrictPersonal advice
message.off_topicpredicatestandardOff topic
message.tries_to_redirectpredicatestrictTries to redirect
message.small_talkpredicatestandardSmall talk
message.abusivepredicatestandardAbusive
message.intentchoicestandardIntent

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

JavaScript
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 IDCheck IDThresholdEffectStrict handling
redirectmessage.tries_to_redirect0.5blockFires if unusable
abusemessage.abusive0.7blockFires if unusable
greetmessage.small_talk0.6noteNormal
advisermessage.wants_personal_advice0.5personStrict; fires if unusable
privacymessage.shares_personal_details0.5withholdStrict; fires if unusable
meetingmessage.ready_to_start0.6noteNormal
steermessage.off_topic0.7noteNormal (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 IDCheck IDThresholdReplacement on failure
reply_advicereply.reply_personal_advice0.5Fixed general-information line (advice)
reply_offjobreply.reply_off_job0.7Fixed off-job line (offJob)
reply_unsupportedreply.reply_unsupported0.8Fixed 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

Do

Show plain-language rule tags on operator traces and keep visitor replies clean.

Rules and reply review · EFS Reply checked
Personal advice goes to an adviser Reply checked: passed
Classify a message · Standard · $0.01 / message
HTML
<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>
Don’t

Do not print internal check IDs or model confidence percentages to visitors.

Checks output
message.wants_personal_advice = 0.87 · reply_unsupported = 0.14 · 94% confident
HTML
<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>

Open questions