Recipe catalog / corrective-action-fit
Check a corrective action against its root cause
Does action address the cause stated in rootCause rather than only the symptom or the affected items?
You review corrective action plans in a CAPA or nonconformance workflow and want to flag actions that rework parts, add inspection, or retrain people while leaving the stated cause in place.
Explore this recipe interactively ยท Source and implementation guide
Use corrective-action-fit in TypeScript
Install with npm install jev-recipes. Requires Node.js 22.9 or newer and ES modules. Set TYPESAFE_API_KEY in your server environment for live calls, which send input to TypeSafe and use API quota. See the installation guide.
import { correctiveActionFit } from 'jev-recipes/corrective-action-fit';
const result = await correctiveActionFit({
"rootCause": "The torque wrench at station 4 was reading 15% low because the tooling register lists a 24-month calibration interval for this wrench model while the manufacturer specifies 12 months. The wrench passed its last register-scheduled check and drifted out of tolerance eight months later, so every assembly torqued at station 4 since then is suspect.",
"action": "Rework the 340 assemblies built since the last calibration to the specified torque and verify with a calibrated reference wrench. Send the station 4 wrench for recalibration and return it to service once it passes. Brief operators on checking the calibration sticker before each shift.",
"minConfidence": 0.8
});
console.log(result);
Input contract
| Field | Type | Needed |
|---|---|---|
| rootCause | string | Required |
| action | string | Required |
| minConfidence | number | Optional |
Full input and result schemas
{
"input": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"rootCause": {
"type": "string"
},
"action": {
"type": "string"
},
"minConfidence": {
"type": "number",
"minimum": 0,
"maximum": 1
}
},
"required": [
"rootCause",
"action"
]
},
"result": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"model": {
"type": "string"
},
"usage": {
"type": "object",
"properties": {
"input_tokens": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"output_tokens": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
}
},
"required": [
"input_tokens",
"output_tokens"
],
"additionalProperties": false
},
"status": {
"type": "string",
"enum": [
"ready",
"review"
]
},
"probability": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"confidence": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"verdict": {
"type": "string",
"enum": [
"addresses",
"misses"
]
}
},
"required": [
"model",
"usage",
"status",
"probability",
"confidence",
"verdict"
],
"additionalProperties": false
}
}Saved example result
This hand-authored response demonstrates the contract. It is not a model accuracy measurement. Run it without an API key: npx jev-recipes demo corrective-action-fit.
{
"model": "demo-fixture",
"usage": {
"input_tokens": 0,
"output_tokens": 0
},
"status": "ready",
"probability": 0.08,
"confidence": 0.92,
"verdict": "misses"
}
Evaluation evidence
No verified live accuracy measurement is available. Evaluate representative cases before using this decision in your workflow.
Use the evaluation guide to measure this decision on your own labeled cases.
Limitations
- Judges the fit between two texts as written. It does not know whether rootCause is the true cause or whether action will work in practice.
- An action can address the cause and still be incomplete, unowned, or late. Owners, due dates, and effectiveness checks belong in application code.
- A misses verdict is a flag for a reviewer, not a rejection.
Related recipes
- workaround-fit: Use workaround-fit to check whether a temporary workaround addresses an issue within stated constraints, rather than whether a permanent action removes a cause.
- troubleshooting-fit: Use troubleshooting-fit to assess a diagnostic procedure rather than a proposed fix.