Tell HxNexus "auto-approve claims under $500 that pass KYC" and get back a reviewable draft rule card — not applied, but ready to Apply under your own permissions, to simulate against last quarter's real cases with HxReplay, or to stage in HxBranch for a reviewer to merge. HxDraft turns descriptions into case-types, rules, forms, SLA policies, escalation trees, routing changes, and users — and can modify existing components as diff cards, with a built-in lint that spots rules that can never fire — always as drafts, never as surprises.
Drafting is explicit only: the ✎ draft toggle or a /draft message. A normal chat message can never accidentally become a component, and nothing is ever created until a human clicks Apply.
| Component | Behaviour |
|---|---|
| Case-type | Full structure — stages, steps, and forms — using the same engine as the NLP Builder. Works offline via the heuristic fallback. |
| WHEN rule | Conditions and actions, strictly validated (see below). No fallback: if AI is unavailable you get an honest error — a guessed rule is a wrong rule. |
| Form | Field list with a whitelisted type vocabulary. Degrades to a small, clearly-labelled template when AI is down. |
| SLA policy | Goal + deadline durations on a case type (/draft sla: resolve in 48h, goal 24h). Rendered as a diff on the case type; a policy with a matching id becomes a before/after replace card. AI down: a deterministic parser uses only durations you typed — no durations, honest error. |
| User account | /draft user: create jdoe for login — username, email, roles from a closed allowlist (never admin). The AI never produces a password: Apply (admin-only) generates a temp password server-side, shows it once, and forces a change at first login. |
| Escalation tree | /draft escalation: page the manager at 80% of deadline, reassign to ops at breach. Closed trigger and action vocabularies, targets limited to what the escalation engine can actually resolve, at most 10 strictly-ordered levels. Stage it like a rule: created inactive, a reviewer's merge activates it. |
| Routing change | /draft routing <case-type-id>: route approvals to the least-loaded agent. The AI proposes only which step and which strategy (from the production assignment registry); the platform surgically patches that one step — a routing draft can never rewrite the rest of the process. |
| Modify existing | Pass a target id (or /draft modify rule <id>: …) — rules, case types, forms, escalation trees, and connector config (never credentials). You review a red/green diff card, and Apply refuses stale drafts if the component changed since drafting. |
Staging is the governed path: any authenticated user can propose a rule or an escalation tree, because nothing can go live without a reviewer's approval — the artifact is created disabled (rules) or inactive (trees) and only the branch merge turns it on. Direct rule Apply remains admin/designer-only.
A valid rule draft scoped to a case type is also linted deterministically against that case type — no AI involved. The card shows advisory findings such as:
claim.amount is text on this case-type and lt needs an orderable value"claim.owner is not a declared variable or form field on this case-type — the condition may never match"advance_stage targets done, which is not a stage of this case-type"Lint is advisory: it renders as its own list on the card and never blocks a reviewed Apply.
A draft that fails validation is shown as a list of reasons — never as an applyable card. For rules the gate is the security boundary:
set_value, auto_approve, advance_stage, skip_stage, send_notification, assign_to, log. Nothing that touches security, authorization, credentials, namespaces, or grants is even expressible.set_value may only write case variables; forbidden surfaces (security, tokens, roles, grants, tenant, …) are rejected outright.A drafted rule doesn't have to be trusted — it can be tested against reality. The card's Simulate on history button runs the draft as an HxReplay counterfactual over recent real cases of a case-type: cycle-time delta, auto-vs-manual shift, manual work removed, and the cost figure — before the rule exists anywhere. Describe the policy in English, see what it would have done last quarter, apply with evidence.
Open Studio > HxNexus, enable the ✎ draft toggle and pick a kind — or just type /draft rule: auto-approve claims under 500 where kyc.status is passed.
Review the card: WHEN/THEN lines for rules, the stage chain for case-types, the field list for forms. Validation problems appear in amber instead of buttons.
For a rule, paste a case-type id and click Simulate on history; open HxReplay to read the run (coverage, deltas, cost).
Click Apply — the card flips to Created ✓ and the transcript doubles as your authoring audit trail. Or Discard, and nothing ever happened.
# Draft a rule (generation only — creates nothing) curl -s -X POST http://localhost:8200/api/v1/hxnexus/draft \ -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \ -d '{"kind":"rule","description":"auto-approve claims under 500 where kyc.status is passed"}' # Apply the reviewed draft (re-validated server-side; admin/designer for rules) curl -s -X POST http://localhost:8200/api/v1/hxnexus/draft/apply \ -H "Authorization: Bearer $TOKEN" \ -d '{"kind":"rule","draft":{ ...the draft from the previous call... }}' # Simulate a drafted rule on real history first (HxReplay, zero persistence) curl -s -X POST http://localhost:8200/api/v1/hxreplay/runs \ -H "Authorization: Bearer $TOKEN" \ -d '{"kind":"cohort","candidate":{"rules":[ ...draft... ]}, "cohort_filter":{"case_type_id":"...","max_cases":500}}' # Stage a drafted rule in HxBranch (created disabled; a reviewer's merge enables it) curl -s -X POST http://localhost:8200/api/v1/hxnexus/draft/stage \ -H "Authorization: Bearer $TOKEN" \ -d '{"kind":"rule","draft":{ ...the draft... }}' # Modify an existing component as a diff card (target_id = modify mode) curl -s -X POST http://localhost:8200/api/v1/hxnexus/draft \ -H "Authorization: Bearer $TOKEN" \ -d '{"kind":"rule","target_id":"<rule-uuid>", "description":"also require kyc.status = passed"}' # Draft an escalation tree / a routing change curl -s -X POST http://localhost:8200/api/v1/hxnexus/draft \ -H "Authorization: Bearer $TOKEN" \ -d '{"kind":"escalation","description":"page the manager at 80% of deadline"}' curl -s -X POST http://localhost:8200/api/v1/hxnexus/draft \ -H "Authorization: Bearer $TOKEN" \ -d '{"kind":"routing","target_id":"<case-type-uuid>", "description":"route approvals to the least-loaded agent"}'