Back to Prompt Library
implementation
Build the application
Inspect the original prompt language first, then copy or adapt it once you know how it fits your workflow.
Linked challenge: Build an OPC UA Tooling Wear and Calibration Alert Queue
Format
Code-aware
Lines
74
Sections
11
Linked challenge
Build an OPC UA Tooling Wear and Calibration Alert Queue
Prompt source
Original prompt text with formatting preserved for inspection.
74 lines
11 sections
No variables
1 code block
## Build
Aggregate cutting tool cycle counts and spindle vibration metrics from open62541 OPC UA servers. Queue worn tooling for dimensional recalibration or tool changer carousel replacement.
## User
Tooling and CNC Cell Specialist
## Workflow
1. Subscribe to open62541 spindle telemetry nodes including cumulative engagement time and vibration RMS.
2. Compare live tool operating cycles against manufacturer life expectancy and regrinding thresholds.
3. Identify high-wear cutting tools at risk of causing dimensional part out-of-tolerance errors.
4. Generate tool exchange queues with rack pocket identifiers and replacement insert numbers.
## Interface
Browser-based tool crib queue showing pocket wear status, remaining cycles, and swap instructions.
## Data
Simulate open62541 node dictionaries containing spindle tool cycle counts and vibration telemetry in JSON.
Starter examples below are synthetic. They are not downloaded records.
## Source
[open62541 OPC UA](https://raw.githubusercontent.com/open62541/open62541/master/README.md)
Utilizes open62541 node information structures to monitor spindle and tooling status variables.
## Tools
dspy, pydantic, pytest.
DSPy provides declarative prompt optimization to systematically map noisy vibration readings into maintenance classifications.
Local or remote LLM supported by DSPy modules.
## Deliverables
Submit runnable source, pinned dependencies, setup commands, a working interface, example outputs, and a recorded end-to-end demo. Include tests and an action log.
## Acceptance
- Accurately calculates tool life percentage from OPC UA cycle telemetry.
- Generates carousel exchange alerts when vibration exceeds degradation limits.
- Produces valid structured swap orders specifying tool pocket ID and insert model.
- Correctly flags missing spindle vibration node data as unverified tool state.
## Starter Examples
```json
[
{
"input": {
"cell_id": "CNC-MILL-04",
"tool_pocket": 7,
"tool_type": "END_MILL_12MM",
"cycles_completed": 1280,
"max_rated_cycles": 1200,
"spindle_vibration_rms": 4.8,
"vibration_threshold": 3.5
},
"expected_output": {
"cell_id": "CNC-MILL-04",
"tool_pocket": 7,
"tool_state": "CRITICAL_WEAR",
"cycles_remaining": 0,
"action": "IMMEDIATE_SWAP",
"replacement_insert": "INSERT-12MM-CR4"
}
},
{
"input": {
"cell_id": "CNC-MILL-04",
"tool_pocket": 2,
"tool_type": "DRILL_BIT_8MM",
"cycles_completed": 200,
"max_rated_cycles": 800,
"spindle_vibration_rms": null,
"vibration_threshold": 3.5
},
"expected_output": {
"cell_id": "CNC-MILL-04",
"tool_pocket": 2,
"tool_state": "VIBRATION_TELEMETRY_MISSING",
"cycles_remaining": 600,
"action": "CONTINUE_WITH_OBSERVATION",
"replacement_insert": null
}
}
]
```
## Safety
Maintains passive logging and triage advice; does not send machine stop commands or alter CNC offsets.
Use mock external writes. Require human review before any real deployment.Adaptation plan
Keep the source stable, then change the prompt in a predictable order so the next run is easier to evaluate.
Keep stable
Hold the task contract and output shape stable so generated implementations remain comparable.
Tune next
Update libraries, interfaces, and environment assumptions to match the stack you actually run.
Verify after
Test failure handling, edge cases, and any code paths that depend on hidden context or secrets.