Recipe catalog / corrective-action-fit
Check a corrective action against its root cause
corrective-action-fit is a Jev recipe from the jev-recipes TypeScript package. Does action address the cause stated in rootCause rather than only the symptom or the affected items? Use it when 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.
Last updated .
Explore this recipe interactively · Source and implementation guide · Markdown version
How do I 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);
What input does corrective-action-fit take?
| 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
}
}What does a corrective-action-fit result look like?
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"
}
Input
See shared options and behavior for client configuration, validation, and errors. Types are inferred from this folder's Zod 4 schemas.
Result
verdict is addresses when Jev's yes probability is at least 0.5 and misses otherwise. probability is that yes probability. confidence is the probability of the chosen side, so a 0.1 yes probability yields misses with 0.9 confidence.
A result is ready when confidence meets minConfidence. Otherwise it is review. Treat a review result as unknown and fall back to your safe default.
Reuse and calls
Uses the shared gate helper, a single yes/no question. This folder owns the question wording, the outcome descriptions, and the review policy. A live invocation makes one logical Jev request.
Limits
The verdict compares two texts: it takes rootCause as given and does not know whether that cause is real, whether action is feasible, or whether it will prove effective once implemented. An action that addresses the cause can still lack an owner, a due date, or an effectiveness check, and an action that misses the cause can still be a necessary containment step, so the verdict is one input to a reviewer rather than a decision to accept or reject the plan. Tracking action completion, verifying effectiveness, and closing the CAPA record belong in application code.
Example input
demo.json contains editable input and a hand-authored response. After installing jev-recipes, npx jev-recipes demo corrective-action-fit shows an offline illustration, not an accuracy measurement. Use npx jev-recipes describe corrective-action-fit to inspect the input and result schemas.
How accurate is corrective-action-fit?
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.
What are the limits of corrective-action-fit?
- 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.
Which recipes are related to corrective-action-fit?
- 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.