Add a task type
Define a priced task type from canonical action types, validate it in task-types.json, display its variant price and record its run as events.
Time: 30 minutes · You need: Node, a copy of the reference console folder, and a working local holon from Build your first holon.
A task type is Decidr's atomic wholesale unit of work: one goal, bounded ordered context, one output cell, one evaluation criterion, a repeating frequency, and a Product -> Variant price in dollars and cents. Doctrine §5 Doctrine §10 Wireframe spec B Ruling 52 In this tutorial you will walk through the worked Profile an organisation task type (profile_organisation) from the specification and task-types.json, register its flow step, pass startup validation, render its price correctly, record its run as immutable events, and check it against the review guidelines. Wireframe spec B Reference: task-types.json Reference: task-types.mjs
Section 1: Choose the action chain and the one output
Follow the engineer's loop: start from the flow rather than a table, decompose until the task type is atomic, and declare the context shape generically so the same task type runs for any organisation supplying that shape. Doctrine §6 Doctrine §10
Every task type chains canonical verb-tense action types across three deterministic slots: intake (read, watch, listen, or observe), deliberation (consider), and commitment (select, enter, upload, or count). Wireframe spec A1 Wireframe spec B Human approvals use confirm and stop at hold_for_review because holons never approve. Constitution 1.7 Wireframe review B17 Wireframe review C2
- Map the action chain for Profile an organisation (
profile_organisation), assigned to the Organisation holon for EFS in Greenwich NSW. Intake pulls only the minimum required context under the Tail-Light Rule; deliberation evaluates the closed question bank with zero public confidence scores; commitment records controlled linked values rather than naked strings. Wireframe spec B Ruling 17 Ruling 18 Schema rules §3.1
{
"task_type": "profile_organisation",
"name": "Profile an organisation",
"context_shape": {
"entity_type": "org",
"inputs": ["public website snapshot", "ABN record"]
},
"action_chain": [
{ "slot": "intake", "action": "read", "event": "read" },
{ "slot": "deliberation", "action": "consider", "event": "considered" },
{ "slot": "commitment", "action": "select", "event": "selected" }
],
"output": "Controlled organisation profile attributes (sector, customers, offer clarity, and verified predicates); missing required fields logged as unknown for a person"
}- Check the closed evaluation questions that back the
considerandselectslots. Inbattery.mjs,ORG_SEEDdeclares 13 atomic checks (10predicates,2controlled choicessectorandcustomers, and1four-level scoreoffer_clarity). Each question checks one observable fact from evidence, and any missing required attribute becomesunknownrather than a guess. Reference: battery.mjs Constitution, article 2
// Excerpt from battery.mjs (ORG_SEED):
t('org', 'standard', {
type: 'choice',
name: 'sector',
instructions: 'Which sector does the organisation mainly work in?',
choices: [
{ value: 'financial_services', description: 'Advice, lending, insurance, banking, superannuation.' },
{ value: 'professional_services', description: 'Accounting, legal, consulting, engineering, design.' },
{ value: 'other', description: 'None of these.' },
],
}),
t('org', 'standard', {
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.' },
],
})- Choose the execution kind and check how work splits between code, model, and people. Pure rule and storage steps run as
code_onlyat$0.00(zero model tokens); model-backed classification or profiling steps run as a priced variant whose draft price clears measured raw model costs; steps needing human sign-off hand off to a person with a companion text reasoning box beside logical-reasoning answers. Ruling 4 Ruling 27 Wireframe review C2
Task kind mapping (from function-holon specification):
- Rule step: Read -> Consider (rule) -> Select / Send ($0.00 code_only)
- AI Specialist step: Read -> Consider (checks) -> Select (priced variant, e.g. $0.02)
- AI Specialist, person confirms: Read -> Consider -> Select -> hold_for_review (holon draft + person confirm)
- Person step (including approvals): Read / Watch / Listen -> Consider -> Confirm (human only, never holon)Section 2: Add the entry to task-types.json
Task types and their prices live in console/task-types.json as data, not code. Each task type has one product (the holon's service for that work) and one or more variants, each carrying a non-negative integer price_cents and a unit. Reference: task-types.json Reference: task-types.mjs
- Add (or inspect) the
profile_organisationentry inconsole/task-types.json. Notice howstepslinks the task type to the exactflow.steppairprofile.checks, and how theStandardvariant setsprice_cents: 2($0.02) withunit: "organisation". Reference: task-types.json Wireframe spec B
{
"id": "profile_organisation",
"name": "Profile an organisation",
"kind": "model",
"steps": ["profile.checks"],
"product": {
"id": "profile_organisation.service",
"name": "Profile an organisation",
"variants": [
{
"id": "standard",
"name": "Standard",
"price_cents": 2,
"unit": "organisation"
}
]
}
}- Map the deterministic storage step (
profile.stored) tostore_recordatprice_cents: 0(code_only). Deterministic lookups, counts, rules and storage steps always bill$0.00and consume zero model tokens. Reference: task-types.json Ruling 4
{
"id": "store_record",
"name": "Store the record",
"kind": "code",
"steps": ["message.stored", "profile.stored"],
"product": {
"id": "store_record.service",
"name": "Store the record",
"variants": [
{
"id": "code_only",
"name": "Code only",
"price_cents": 0,
"unit": "run"
}
]
}
}- Check every
name,product.nameand variantnameagainst Decidr's canonical vocabulary before saving. Use plain Australian English, avoid retired or banned verbs, and never include internal IDs or vendor names. Ruling 40 Ruling 41 Ruling 42 Wireframe review C2
{
"status": "draft",
"note": "Whole-cent draft prices set above measured raw model costs. A person approves production prices.",
"task_types": [
{
"id": "profile_organisation",
"name": "Profile an organisation",
"kind": "model",
"steps": ["profile.checks"],
"product": {
"id": "profile_organisation.service",
"name": "Profile an organisation",
"variants": [
{ "id": "standard", "name": "Standard", "price_cents": 2, "unit": "organisation" }
]
}
}
]
}Section 3: Register the step and pass validateTaskTypes
flow.mjs calls loadTaskTypes() at module import time, which runs validateTaskTypes(data) against FLOW_STEPS in task-types.mjs. Any missing mapping, duplicate ID or invalid price stops the server at startup before a single request is served. Reference: task-types.mjs Reference: flow.mjs
- Confirm every
(flow.step)pair your task type handles is declared inFLOW_STEPSinconsole/task-types.mjsalongside the exact variant IDs that deterministic code may choose for it. Reference: task-types.mjs
export const FLOW_STEPS = Object.freeze({
'message.receive': ['code_only'],
'message.screen': ['code_only'],
'message.checks': ['standard'],
'message.rules': ['code_only'],
'message.reply': ['reviewed', 'live', 'fixed'],
'message.review': ['standard', 'code_only'],
'message.stored': ['code_only'],
'profile.checks': ['standard'],
'profile.stored': ['code_only'],
'explore.explore': ['standard'],
'explore.review': ['code_only'],
});- Verify your entry satisfies every check enforced by
validateTaskTypes()intask-types.mjs:- The file parses as an object with a non-empty
statusstring and atask_typesarray. - Each task type has a non-empty, unique
id, a non-emptyname, and a non-emptykind. - Each task type has a
productobject with a non-empty, uniqueproduct.idand a non-emptyvariantslist. - Each variant has a non-empty
id(unique within its product), a non-emptyname, a non-emptyunit, and aprice_centsvalue that is a non-negative integer (0or higher, whole cents only). stepsis a list where every entry exists inFLOW_STEPS, and no step pair is claimed by two task types.- Every
(flow.step)pair inFLOW_STEPSmaps to one task type, and every allowed variant listed for that pair exists on that task type's product. Reference: task-types.mjs
- The file parses as an object with a non-empty
node -e "import('./console/task-types.mjs').then(m => { const c = m.loadTaskTypes(); console.log(c.status, c.price('profile', 'checks', 'standard')); })"
# -> draft { task_type: 'profile_organisation', variant: 'standard', price_cents: 2 }- Check endpoint coverage before adding a brand-new flow beyond
profile. In the current referenceserver.mjs,POST /api/profile-checksis live forprofile_organisation. The general per-step runner endpoints specified for function holons (POST /api/task-stepfor intake, consider and select, andPOST /api/task-confirmfor human confirmation with reasoning) are not yet built inserver.mjs; see Console endpoints for what is live versus specified. Reference: server.mjs Wireframe review C3
// Live in server.mjs today for profile_organisation:
if (p === '/api/profile-checks') {
if (paused()) return send(res, 200, { ok: false, paused: true });
if (publicMode && (!limiter.hit(`profile:s:${sid}`, limits.sessionProfile) || !limiter.hit('profile:day', limits.dayProfile))) {
return send(res, 429, { ok: false, limited: 'profile' });
}
return await admitAndRun(s, req, res, addr, () => s.flows.profileChecks());
}Section 4: Show the price on screen
Customer and operator interfaces never display a bare parent Product and never display an unlabelled bare price. Always format every priced task type as Product · Variant · $X.XX / unit, using whole cents rendered to dollars and cents. Ruling 52 Wireframe review B12 Reference: money.js
- Format
price_centswithformatCents()fromconsole/ui/money.jsso$0.02always renders with two decimal places (0renders as$0.00). Note thattask-types.mjs'spublic()summary currently returnsnameandprice_centswithoutunit; to show the full unit label on screen, readunitfrom the task-type definition or includeunitin your catalogue serializer. Reference: money.js Reference: task-types.mjs
import { formatCents } from './console/ui/money.js';
function formatVariantPrice(productName, variant) {
return `${productName} · ${variant.name} · ${formatCents(variant.price_cents)} / ${variant.unit}`;
}
// formatVariantPrice('Profile an organisation', { name: 'Standard', price_cents: 2, unit: 'organisation' })
// -> "Profile an organisation · Standard · $0.02 / organisation"- Render the task type card cleanly on a single light surface with its level glyph, action chain, and formatted
Product · Variant · $X.XX / unitline. Keep raw model cost (raw_cost_micro) off public edge ports; raw cost telemetry belongs strictly on the internal loopback port. Holon rules §1.3 Wireframe review C6 Wireframe review B12
<div class="hx-card hx-stack">
<div class="hx-spread">
<div class="hx-row">
<img class="hx-glyph" src="assets/glyphs/organisation.svg" alt="Organisation holon">
<span class="hx-title">Profile an organisation</span>
</div>
<span class="hx-chip">Model</span>
</div>
<div class="hx-steps hx-small hx-muted">1. Read · 2. Consider · 3. Select</div>
<div class="hx-field">
<span class="hx-small hx-muted">Entity</span>
<span>EFS (Greenwich NSW)</span>
</div>
<div class="hx-price">Profile an organisation · Standard · $0.02 / organisation</div>
</div>Section 5: Record the run as events
The append-only event log is the source of truth; projections and UI summaries are rebuilt from events. Ruling 15 Doctrine §10 In flow.mjs, deterministic code selects the step's variant from the run's path (never by a model), computes its whole-cent price via taskTypes.price(), bills $0.00 if a step fails (while retaining internal raw cost), and appends an immutable event to the local decision store. Reference: flow.mjs Reference: decision-store.mjs
- Inspect
step()andprofileChecks()inconsole/flow.mjs. Whenprofile.checkscompletes,flow.mjscallsstore?.addRun()(recording the run and each individual decision row) andstore?.addEvent()(recording each finished step payload intoholon_flow_events), then sums finished step prices inendRun(). Reference: flow.mjs Reference: decision-store.mjs
// From flow.mjs: variant pricing and append-only event emission
function step(run, name, data, flow, variant = 'code_only', rawMicro = 0) {
const tt = taskTypes.price(flow, name, variant);
const s = {
name,
...data,
task_type: tt.task_type,
variant: tt.variant,
price_cents: data.status === 'failed' ? 0 : tt.price_cents,
raw_cost_micro: Math.max(0, Math.round(Number(rawMicro) || 0)),
};
const i = run.steps.findIndex(x => x.name === name);
if (i >= 0) run.steps[i] = s; else run.steps.push(s);
emit({ type: 'run.step', runId: run.id, step: s });
if (s.status === 'done' || s.status === 'failed' || s.status === 'stopped') {
store?.addEvent({ runId: run.id, holon: holonName, flow, step: name, payload: s });
}
}- Trigger
POST /api/profile-checksagainst your local console on127.0.0.1:4981and watch the streamed events. Reference: server.mjs Reference: flow.mjs
curl -N -X POST http://127.0.0.1:4981/api/profile-checks \
-H 'content-type: application/json' \
-H 'accept: text/event-stream' \
-d '{}'- Inspect the recorded
run.doneand step events.profile.checksbills2cents ($0.02) on success (0cents on failure),profile.storedbills0cents ($0.00), and every step lands inholon_flow_eventskeyed byrun_idso the entire run is replayable. Reference: flow.mjs Reference: decision-store.mjs
{
"type": "run.done",
"runId": "00000000-0000-4000-8000-000000000001",
"run": {
"status": "done",
"ms": 1420,
"price_cents": 2
}
}Section 6: Check it against the review guidelines
Before your task type ships, verify both its flow contract (section 2) and its commerce and operations contract (section 8) in the Review guidelines.
- Run an automated catalogue check in Node confirming
validateTaskTypes()succeeds, every variant has a positive or zero whole-cent price and non-empty unit, and every formatted price line matchesProduct · Variant · $X.XX / unit. Reference: task-types.mjs Reference: money.js Wireframe review B12
node -e "
import('./console/task-types.mjs').then(async ({ loadTaskTypes }) => {
const { formatCents } = await import('./console/ui/money.js');
const cat = loadTaskTypes();
for (const t of cat.taskTypes) {
for (const v of t.product.variants) {
console.log(\`\${t.product.name} · \${v.name} · \${formatCents(v.price_cents)} / \${v.unit}\`);
}
}
});
"- Walk every applicable rule in Review guidelines before sign-off:
- Flow (section 2): 2.1 Deterministic container, 2.3 Action-type triad composition, 2.4 Generic to context shape, 2.5 Zero model tokens for deterministic maths, 2.6 Every question terminates in an explicit answer, and 2.7 Structured output and immutable event storage. Doctrine §5 Doctrine §8 Ruling 4
- Authority and data (sections 4 and 7): 4.2 A holon never approves and 7.1 Reference attributes store linked entity IDs. Constitution 1.7 Schema rules §3.1
- Commerce and operations (section 8): 8.1 Price task types as Product and Variant in whole cents, 8.2 Never discount, fund outputs only, and enforce flat legal fees, and 8.3 Persistent spend meter with worst-case holds and PAUSE switch. Ruling 51 Ruling 52 Reference: meter.mjs
Task-type sign-off summary:
- Action chain declared (intake -> consider -> commitment)
- Single output cell, linked entity IDs for reference values
- Validated by loadTaskTypes() at startup
- Displayed as Product · Variant · $X.XX / unit (no discounts, flat legal fees)
- Failed steps bill $0.00; completed steps append immutable eventsCheck your understanding
- Who chooses which variant applies when a flow step runs: the model or deterministic code?
Answer: Deterministic code in
flow.mjsalways selects the variant from the run's path (such asstandard,reviewed,fixed, orcode_only) and validates it throughtaskTypes.price(flow, step, variant). A model never picks a variant or a price. Reference: task-types.mjs Reference: flow.mjs - What happens if
profile.checksfails because the decisions service is unavailable?Answer:
flow.mjsrecords the step asfailed, setsprice_centsto0so the failed step bills$0.00, retains any internalraw_cost_micro, and still emits the step event to the append-only store. Reference: flow.mjs - Why is displaying
$0.02alone on a task-type card rejected in review?Answer: Every priced surface must identify the Product, the Variant, and the unit price in dollars and cents (
Profile an organisation · Standard · $0.02 / organisation). Showing a bare price or a bare parent Product violates the commerce guidelines. Ruling 52 Wireframe review B12
Next
Read the full file schema in task-types.json reference and the action-type composition rules in Task types. When you are ready to wire new routes, check Console endpoints and the Review guidelines.