DecidrHolon Design Kit

Technologies and APIs

Decision battery

Structure of decision task-type batteries, question kinds, probability bands, verdicts, and append-only event storage.

JavaScript
// Task type shape:
// { id: '<entity_type>.<name>', entity_type, strictness, status, label, question }

// 1. Predicate (from ORG_SEED)
{
  id: 'org.private_personal_details',
  entity_type: 'org',
  strictness: 'strict',
  status: 'draft',
  label: 'Private details',
  question: {
    type: 'predicate',
    name: 'private_personal_details',
    instructions: 'Does the evidence contain personal details of a private individual: a personal mobile number, a home address, a personal email address, a date of birth or a government ID number? Business contact details of the organisation do not count.'
  }
}

// 2. Choice (from MESSAGE_SEED)
{
  id: 'message.intent',
  entity_type: 'message',
  strictness: 'standard',
  status: 'draft',
  label: 'Intent',
  question: {
    type: 'choice',
    name: 'intent',
    instructions: 'What does the visitor mainly want from their new message?',
    choices: [
      { value: 'learn', description: 'To understand what the organisation does.' },
      { value: 'compare', description: 'To weigh the organisation against others or check fit.' },
      { value: 'start', description: 'To book, meet or begin working together.' },
      { value: 'help', description: 'Help with something already under way, or a complaint.' },
      { value: 'other', description: 'Anything else.' }
    ]
  }
}

// 3. Score (from ORG_SEED)
{
  id: 'org.offer_clarity',
  entity_type: 'org',
  strictness: 'standard',
  status: 'draft',
  label: 'Clear offer',
  question: {
    type: 'score',
    name: 'offer_clarity',
    instructions: 'How clearly does the evidence say what a customer gets and on what terms?',
    levels: [
      { label: 'Not stated', description: 'No offer is described.' },
      { label: 'Vague', description: 'Offerings are named but not what they include.' },
      { label: 'Clear', description: 'What each offering includes is described.' },
      { label: 'Clear with terms', description: 'What each includes is described, with price or how it is charged.' }
    ]
  }
}

Overview

A decision battery is a data list of atomic decision task types that a holon runs against one entity's evidence through the decisions service (DECISIONS_MODEL). Reference: battery.mjs Reference: holon.mjs Calling batteryFor(entityType) returns the frozen list for that entity type, or an empty list if none is registered. Reference: battery.mjs

Every question in a battery obeys three structural constraints: it asks one thing only (no compound questions), it tests observable facts in the supplied evidence rather than model opinion, and its wording is a formal criterion set by a person, never invented by a model. Reference: battery.mjs Ruling 5 Up to 400 questions can be evaluated in a single decisions-service call, billed on input tokens only with output tokens free. House note: three-service holon Reference: holon.mjs

All seed batteries in battery.mjs carry status: 'draft' so the pipeline can be exercised end to end until the canonical entity-type battery replaces them. Reference: battery.mjs

Inputs

Seed batteries

SEED_BATTERIES registers four draft batteries keyed by entity type: Reference: battery.mjs

BatteryEntity typeQuestionsComposition
ORG_SEEDorg139 standard predicates (is_organisation, states_purpose, states_vision, states_values, states_principles, lists_offerings, states_prices, holds_licence, names_people), 1 strict predicate (private_personal_details), 2 choices (sector, customers), 1 score (offer_clarity)
IMAGE_SEEDimage32 strict predicates (nudity, personal_details), 1 standard predicate (shows_logo)
MESSAGE_SEEDmessage106 standard predicates (about_org, asks_price, ready_to_start, off_topic, small_talk, abusive), 3 strict predicates (shares_personal_details, wants_personal_advice, tries_to_redirect), 1 choice (intent)
REPLY_SEEDreply31 strict predicate (reply_personal_advice), 2 standard predicates (reply_off_job, reply_unsupported)

Each entry maps id to <entity_type>.<question.name> (its key in the event store) and carries a human-readable label so screens never display raw question names or schema codes. Reference: battery.mjs

Question kinds and strictness

KindExtra question fieldsRaw answer fields
predicateNone beyond name and instructionsprobability (0..1), or refused: true
choicechoices: array of { value, description }choice, confidence (0..1), probabilities map, or refused: true
scorelevels: 2 to 10 ordered { label, description } objectsscore, confidence (0..1), probabilities map, or refused: true

STRICTNESS allows 'standard' or 'strict'. Reference: bands.mjs Mark a task type 'strict' whenever a false negative is costly, such as missed personal details, nudity, personal advice, or prompt redirection. Reference: bands.mjs Reference: battery.mjs In flow.mjs, a missing, refused, or non-finite answer on any strict or block rule is treated as fired so the flow fails closed. Reference: flow.mjs

Outputs

answerRow(taskType, answer) in holon.mjs converts each decisions-service answer into a uniform row ready for storage and rule evaluation: Reference: holon.mjs

  • Missing or refused answers: always yield verdict: 'check' (missing: true or refused: true), routing the item to a person. Reference: holon.mjs
  • Predicate answers: carry probability, band: band(probability), and verdict: verdictFor(probability, strictness). Reference: holon.mjs
  • Choice and score answers: carry choice or score, confidence, band: band(confidence), probabilities, and verdict: confidenceVerdict(confidence, strictness). Reference: holon.mjs

Bands and verdicts (bands.mjs)

Every stored answer keeps both its raw estimate and its mechanical 10% band, computed as the lower edge in percent (0, 10, up to 90): Reference: bands.mjs

JavaScript
export function band(probability) {
  const p = Number(probability);
  if (probability == null || !Number.isFinite(p) || p < 0 || p > 1) return null;
  return Math.min(90, Math.floor(p * 10) * 10);
}

export function confidenceVerdict(confidence, strictness = 'standard') {
  const c = Number(confidence);
  if (confidence == null || !Number.isFinite(c)) return 'check';
  return c >= (strictness === 'strict' ? 0.9 : 0.7) ? 'act' : 'check';
}

Probabilities from 0.90 through 1.0 land in band 90. Reference: bands.mjs For choices and scores, confidenceVerdict returns 'act' at or above 0.9 (strict) or 0.7 (standard), and 'check' below that. Reference: bands.mjs

For predicates, verdictFor(probability, strictness) is specified to return 'yes', 'no', or 'check', but currently returns null while thresholds await sign-off. In the live console, DEFAULT_RULES and REPLY_RULES in flow.mjs apply explicit draft atLeast probability cut-offs (0.5 to 0.8) directly against predicate rows. Reference: bands.mjs Reference: flow.mjs

Remember that raw probabilities and confidence numbers are internal control signals; never expose confidence numbers on public customer pages. Ruling 17 Vocabulary §1

Topics

Append-only decision storage (decision-store.mjs)

openDecisionStore(path) persists every decision run, answer row, frontier proposal, and flow-step event into the local append-only store (a single-file SQL store whose holon_ table names mirror the backend schema). Reference: decision-store.mjs

SQL
CREATE TABLE IF NOT EXISTS holon_decision_runs (
  run_id TEXT PRIMARY KEY, at TEXT NOT NULL, holon TEXT NOT NULL,
  entity_type TEXT NOT NULL, entity_id TEXT NOT NULL, model TEXT,
  questions INTEGER NOT NULL, requests INTEGER, input_tokens INTEGER,
  cost_micro_usd INTEGER, ms INTEGER, ok INTEGER NOT NULL, error TEXT
);
CREATE TABLE IF NOT EXISTS holon_decisions (
  run_id TEXT NOT NULL REFERENCES holon_decision_runs(run_id),
  task_type TEXT NOT NULL, strictness TEXT NOT NULL, type TEXT NOT NULL,
  probability REAL, choice TEXT, score REAL, confidence REAL,
  band INTEGER, verdict TEXT, refused INTEGER NOT NULL DEFAULT 0,
  probabilities TEXT, PRIMARY KEY (run_id, task_type)
);
CREATE TABLE IF NOT EXISTS holon_frontier_runs (
  run_id TEXT PRIMARY KEY, at TEXT NOT NULL, holon TEXT NOT NULL,
  entity_type TEXT NOT NULL, purpose TEXT NOT NULL, model TEXT,
  session_id TEXT, cost_micro_usd INTEGER, ms INTEGER,
  ok INTEGER NOT NULL, error TEXT, output TEXT,
  review TEXT NOT NULL DEFAULT 'proposed'
);
CREATE TABLE IF NOT EXISTS holon_flow_events (
  event_id TEXT PRIMARY KEY, run_id TEXT NOT NULL, at TEXT NOT NULL,
  holon TEXT NOT NULL, flow TEXT NOT NULL, step TEXT NOT NULL,
  payload TEXT NOT NULL
);

Open questions

See also