--- spec: openflange.org/pipe/v0.1 id: classify-feedback-rules version: 0.1.0 title: Classify feedback (rules) description: Routes feedback to positive, negative or uncertain with a deterministic decision tree. Same contract as classify-feedback-llm. license: Apache-2.0 keywords: [classification, sentiment, decision-tree, rules, routing, starlark, example] maturity: experimental scope: record deterministic: true inputs: feedback: description: 'Feedback records: {"id", "text"}. Other members are passed through.' schema: format: json-schema definition: type: object required: [text] outputs: positive: description: Feedback classified as positive. schema: format: json-schema definition: type: object required: [text, label, confidence, reason] properties: label: {const: positive} confidence: {type: number, minimum: 0, maximum: 1} reason: {type: string} negative: description: Feedback classified as negative. schema: format: json-schema definition: type: object required: [text, label, confidence, reason] properties: label: {const: negative} confidence: {type: number, minimum: 0, maximum: 1} reason: {type: string} uncertain: description: Feedback the classifier could not decide. Explicit data for a human or another pipe; never dropped, never guessed. schema: format: json-schema definition: type: object required: [text, label, confidence, reason] properties: label: {const: uncertain} confidence: {type: number, minimum: 0, maximum: 1} reason: {type: string} implementation: type: script language: starlark path: classify.star --- # Classify feedback (rules) Implements the [OpenFlange](https://openflange.org/) specification. A deterministic decision tree in Starlark ([`classify.star`](classify.star)). It has **the same contract** as `../classify-feedback-llm` — the same input, the same three outputs, the same record shape — so either can be put in a pipeline without changing anything else. See [../README.md](../README.md). Every input record leaves on exactly one of the three outputs, with `label`, `confidence` (0–1) and `reason` added: | the text has | output | |---|---| | positive words only | `positive` | | negative words only | `negative` | | both, neither, a negation next to a positive word, or no text | `uncertain` | **`uncertain` is a required output.** A consumer must connect it or discard it explicitly; the pipe never guesses and never drops a record. Permissions: none (in-process Starlark, no I/O). The word lists are a toy — the point of the example is the contract, not the linguistics.