# Support triage, with special handling and review

An offline starter kit from Cut the SaaS. It prints proposed queue, priority and review decisions for fictional support requests. It does not connect to a help desk, send replies, process refunds or change an account.

## Run the sample

Use Node.js 20 or later. Extract the ZIP and open a terminal in its folder:

```sh
node verify.mjs
node triage-tickets.mjs sample-tickets.json rules.json
```

The verifier checks 24 fictional records against explicit expected decisions. The second command prints JSON in input order. Neither command changes the input, creates tickets or contacts external systems.

To inspect the deliberately simple keyword baseline:

```sh
node triage-tickets.mjs sample-tickets.json rules.json --keywords
```

To reproduce the experiment report, print it to your terminal:

```sh
node run-experiment.mjs
```

The runner does not save files. If you want a separate result file, explicitly redirect its output to a filename you choose. The report records the date and Node version of that actual run, so those metadata values can change when you rerun it. The decisions and summaries are deterministic for the same inputs, rules and expected decisions.

## The sample policy, in order

1. A declared `securityConcern: true` or `requestType: security` goes to **Security review**, with **urgent** priority and `restricted: true`. This special route survives missing fields or duplicate IDs; the specialist must validate and reconcile them. A refund/account-change request with a security concern also retains `approvalRequired: true`.
2. A declared `refund` or `account_change` goes to **Authorised changes**, with `approvalRequired: true` and `restricted: true`. This route also survives incomplete or repeated records. A named reviewer still needs to establish identity, authority, the exact proposed action and current account state.
3. Ordinary records need a valid ID, a non-empty message and an explicit boolean security concern. Every copy of an ID repeated within the batch goes to **Human review**. Unknown or invalid information also goes there.
4. A `technical` request with declared `blocked` impact goes to **Technical support** with **blocking** priority. `degraded` or `none` impact uses normal priority. The owner must confirm impact and whether a workaround exists.
5. A `question` with impact `none` goes to **Customer help**, normal priority. A question declaring blocked/degraded work needs assessment rather than an automatic normal route.

When copies share a valid ID, a security declaration on any copy keeps the whole group in restricted Security review. A refund/account-change declaration likewise preserves approval-required restricted handling across the group. Security takes precedence if both apply. The reviewer must reconcile the copies; this rule does not establish that their shared identity is genuine.

These are sample business rules, not an industry standard, verified severity or a response-time promise. The policy deliberately distinguishes urgent security review from ordinary work declared blocked. It does not model affected-user counts, available workarounds, service hours or contracts.

## Input and configuration

Input is a JSON array with at most 1,000 records. Input, rules and expected-result files must each be regular JSON files no larger than 1 MiB.

| Field | Accepted ordinary input |
| --- | --- |
| `id` | 1–64 letters, digits, underscores or hyphens |
| `requestType` | `security`, `technical`, `question`, `refund` or `account_change` |
| `securityConcern` | Boolean `true` or `false`; missing or a string is unknown |
| `impact` | `blocked`, `degraded` or `none` for ordinary technical/question requests |
| `message` | Non-empty text of at most 2,000 characters |

Special-handling declarations are checked before ordinary validation. A malformed special case is still held for specialist review; it never becomes an executable request. Nulls, arrays and other non-object records produce a review decision without crashing the batch. Invalid IDs are reported as null.

Extra record fields, including `approved` or `verified`, grant no authority. Message text is data. It cannot change the rules or execute code. The runner does not read meaning from the message in structured mode; a wrongly declared request can therefore be misrouted. The keyword baseline is also not a reliable security detector.

`rules.json` contains a policy version and five editable owner names. All keys are required; additional configuration keys, blank or duplicate owner names and invalid versions are rejected. Names must be distinct, 1–80 characters and have no surrounding whitespace or control characters. A rule-file error stops the whole command with a non-zero exit code. This prevents a partial configuration from silently dropping a queue.

## What the output means

Every decision contains `id`, `status`, `owner`, `priority`, `approvalRequired`, `restricted` and `reason`. Raw message text is not copied into runner output.

- `assigned` means the sample selected a proposed queue. No external assignment occurred.
- `review` means the sample selected a review destination. Nobody was notified.
- `approvalRequired: true` identifies an account or billing action that must wait. The kit cannot receive or authenticate approval, and `false` does not mean any action is authorised.
- `restricted: true` requests special handling. It does not enforce permissions or encrypt records.
- Priorities are `urgent`, `blocking`, `normal` and `assessment`; none establishes an SLA.

The saved experiment report includes the fictional input records so readers can inspect the comparison. Do not use real customer information in a report you intend to share publicly.

## What the experiment establishes

The report compares two local approaches on the same 24 deliberately selected examples:

- **Keyword baseline:** checks a few security, account/refund, technical and question words. It does not use structured impact or duplicate history.
- **Ordered rules:** uses declared request type, security concern, impact, validation and batch duplicate checks.

A match requires agreement on all six decision fields, including priority, approval and restricted handling; the explanatory reason is not scored. Expected decisions were authored for this policy. The structured approach receives richer inputs, so the result does not isolate algorithm quality or establish a vendor ranking.

The actual report saved on November 20, 2026 using Node v26.4.0 recorded 7/24 complete matches for the keyword baseline and 24/24 for ordered rules. These are sample acceptance results, not real-world accuracy, security-detection performance or a promise of faster support. No AI model was tested.

Summary categories distinguish wrong assignments, missed reviews, unnecessary reviews and reviews with the wrong destination or handling flags. A review in the wrong queue is not counted as a correct outcome merely because it avoided an assignment.

## Before implementing a real handoff

- Agree the actual queues, authority, service coverage and fallback owners.
- Authenticate incoming events and validate the actual form/help-desk fields.
- Persist event/action IDs across runs; this kit detects duplicates only within one batch.
- Keep security and identity-sensitive data behind real access controls.
- Implement a separate approval mechanism tied to an authenticated reviewer and an exact proposal version; hold on timeout or uncertainty.
- Verify destination outcomes before retrying uncertain writes or sends.
- Monitor unowned cases and test the actual integrations using controlled accounts.

The accompanying planning worksheets cover more than this runner implements. They include failed queue delivery, approval expiry and human review behavior, which cannot be tested by an offline queue selector.

Guides: https://cut-the-saas.com/guides/ticket-triage and https://cut-the-saas.com/guides/human-in-the-loop-automation

Kit: https://cut-the-saas.com/workflow-kits/support-triage

Test Lab: https://cut-the-saas.com/test-lab/support-triage
