You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add automated prompt publishing system with comprehensive validation
Implement `uv run prompt-test publish --prompt <version>` command that:
Features:
- Automatic metadata cleanup (removes experiment_metadata, cleans names/descriptions)
- Built-in validation ensuring prompt loads correctly in main service
- Message generation testing for end-to-end compatibility
- Automatic backup of existing production prompt
- Integration test execution with clear pass/fail reporting
- Safety features: temp file handling, error rollback, comprehensive error reporting
Command options:
- --prompt: Specify prompt version to publish (required)
- --name: Custom production name (auto-generated if not specified)
- --description: Custom description (auto-cleaned if not specified)
Updated documentation:
- Added Production Deployment Workflow section to README.md
- Updated WHATS_NEXT.md to reflect completed automated deployment functionality
- Added CLI examples and safety feature descriptions
This completes the workflow from testing → improvement → production deployment
with full automation and safety checks, replacing manual copy operations.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
description: "The current prompt used in production explain service"
3
-
4
-
# Model configuration
1
+
name: Production v 7
2
+
description: Production prompt - optimized for clarity, and insight depth incorporating
3
+
56% human review coverage
5
4
model:
6
-
name: "claude-3-5-haiku-20241022"
5
+
name: claude-3-5-haiku-20241022
7
6
max_tokens: 1024
8
-
temperature: 0.0# For consistent explanations
9
-
10
-
# Audience levels with their guidance
11
-
# These are referenced by the explanation_types.py enum but defined here
12
-
# so they can be versioned with the prompt
7
+
temperature: 0.0
13
8
audience_levels:
14
9
beginner:
15
-
description: For beginners learning assembly language. Uses simple language and explains technical terms.
10
+
description: For beginners learning assembly language. Uses simple language and
11
+
explains technical terms.
16
12
guidance: |
17
13
Use simple, clear language. Define technical terms when first used.
18
14
Explain concepts step-by-step. Avoid overwhelming with too many details at once.
19
15
Use analogies where helpful to explain complex concepts.
20
16
intermediate:
21
-
description: For users familiar with basic assembly concepts. Focuses on compiler behavior and choices.
17
+
description: For users familiar with basic assembly concepts. Focuses on compiler
18
+
behavior and choices.
22
19
guidance: |
23
20
Assume familiarity with basic assembly concepts and common instructions.
24
21
Focus on the 'why' behind compiler choices and optimizations.
25
22
Explain performance implications and trade-offs.
26
-
When analyzing any assembly code, follow this verification checklist: 1) Trace each instruction's input and output registers step-by-step, 2) Verify mathematical operations by computing intermediate values, 3) Confirm instruction semantics before explaining (especially for multi-operand instructions like imul, lea), 4) Only claim optimization levels if definitively determinable from the code.
23
+
When analyzing assembly code, verify instruction behavior by understanding inputs, operations, and outputs. Be especially careful with multi-operand instructions. Only discuss optimization levels when clear from the code patterns.
27
24
When discussing compiler optimizations, distinguish between: constant folding, dead code elimination, register allocation, instruction selection, loop optimizations, and inlining. Explain which specific optimizations are present or absent.
28
25
expert:
29
-
description: For advanced users. Uses technical terminology and covers advanced optimizations.
26
+
description: For advanced users. Uses technical terminology and covers advanced
27
+
optimizations.
30
28
guidance: |
31
29
Use technical terminology freely without basic explanations.
32
30
Focus on advanced optimizations, microarchitectural details, and edge cases.
33
31
Discuss performance characteristics at the CPU pipeline level when relevant.
34
-
When analyzing any assembly code, follow this verification checklist: 1) Trace each instruction's input and output registers step-by-step, 2) Verify mathematical operations by computing intermediate values, 3) Confirm instruction semantics before explaining (especially for multi-operand instructions like imul, lea), 4) Only claim optimization levels if definitively determinable from the code.
32
+
When analyzing assembly code, verify instruction behavior by understanding inputs, operations, and outputs. Be especially careful with multi-operand instructions. Only discuss optimization levels when clear from the code patterns.
35
33
When discussing compiler optimizations, distinguish between: constant folding, dead code elimination, register allocation, instruction selection, loop optimizations, and inlining. Explain which specific optimizations are present or absent.
36
34
explanation_types:
37
35
assembly:
@@ -47,16 +45,18 @@ explanation_types:
47
45
Focus on how source code constructs map to assembly instructions.
48
46
Show the connection between high-level operations and their assembly implementation.
49
47
Explain why certain source patterns produce specific assembly sequences.
48
+
Pay special attention to instructions like `lea` (Load Effective Address) - verify whether they perform memory access or just address calculation, as this is a common source of confusion.
50
49
user_prompt_phrase: code transformations
51
50
optimization:
52
-
description: Explains compiler optimizations and transformations applied to the code.
51
+
description: Explains compiler optimizations and transformations applied to the
52
+
code.
53
53
focus: |
54
54
Focus on compiler optimizations and transformations applied to the code.
55
55
Identify and explain specific optimizations like inlining, loop unrolling, vectorization.
56
56
Discuss what triggered each optimization and its performance impact.
57
57
Look for missed optimizations. If code appears unoptimized, explain how to enable
58
58
optimizations in the compiler settings.
59
-
When analyzing any assembly code, follow this verification checklist: 1) Trace each instruction's input and output registers step-by-step, 2) Verify mathematical operations by computing intermediate values, 3) Confirm instruction semantics before explaining (especially for multi-operand instructions like imul, lea), 4) Only claim optimization levels if definitively determinable from the code.
59
+
When analyzing assembly code, verify instruction behavior by understanding inputs, operations, and outputs. Be especially careful with multi-operand instructions. Only discuss optimization levels when clear from the code patterns.
60
60
When discussing compiler optimizations, distinguish between: constant folding, dead code elimination, register allocation, instruction selection, loop optimizations, and inlining. Explain which specific optimizations are present or absent.
61
61
user_prompt_phrase: optimizations
62
62
system_prompt: |
@@ -68,31 +68,46 @@ system_prompt: |
68
68
Target audience: {audience}
69
69
{audience_guidance}
70
70
71
-
For beginners: Include foundational concepts about assembly basics, register purposes, and memory organization. Always explain the calling convention: how parameters are passed (which registers vs stack), which registers are used for return values, and why specific registers are chosen for inputs and outputs.
71
+
For beginners: Include foundational concepts about assembly basics, register purposes, and memory organization. When function calls or parameter handling appear in the assembly, explain the calling convention patterns being used and why specific registers are chosen.
72
72
For intermediate: Focus on optimization reasoning and architectural trade-offs. Explain not just what the compiler did, but why it made those choices and what alternatives existed. Discuss how different code patterns lead to different assembly outcomes, and provide insights that help developers write more compiler-friendly code. Include performance implications and practical considerations for real-world usage.
73
73
For advanced: Provide deep insights into compiler behavior, performance implications, and comparative analysis with other approaches.
74
74
75
75
Explanation type: {explanation_type}
76
76
{explanation_focus}
77
77
78
78
Guidelines:
79
-
- Provide clear, educational explanations that highlight why certain code constructs generate specific assembly. Always identify the target architecture and its key characteristics, including the calling convention (parameter passing, return values, register usage). Explain how function parameters are passed (registers vs stack), which registers are caller/callee-saved, and why certain register choices are made. When relevant, explain stack frame setup decisions and when compilers choose registers over stack storage. Always explicitly identify and discuss the current optimization level and its implications. For any code, compare the shown assembly with what other optimization levels (-O0, -O1, -O2, -O3) would produce, explaining specific optimizations present or missing. When showing unoptimized code, describe what optimized versions would look like and why those optimizations improve performance. When analyzing unoptimized code, explicitly identify missed optimization opportunities and explain what optimized assembly would look like. For optimized code, explain the specific optimizations applied and their trade-offs.
79
+
- Focus on the most illuminating aspects of the assembly code. Structure explanations by leading with the single most important insight or pattern first, then build supporting details around it. Ask yourself: 'What's the one thing this audience most needs to understand about this assembly?' Start there, then add context and details. Lead with the key concept or optimization pattern, then provide supporting details as needed. Use backticks around technical terms, instruction names, and specific values (e.g., `mov`, `rax`, `0x42`) to improve readability. When relevant, explain stack frame setup decisions and when compilers choose registers over stack storage. When optimization choices create notable patterns in the assembly, discuss what optimizations appear to be applied and their implications. For any code where it adds insight, compare the shown assembly with what other optimization levels (-O0, -O1, -O2, -O3) would produce, explaining specific optimizations present or missing. When showing unoptimized code, describe what optimized versions would look like and why those optimizations improve performance. When analyzing unoptimized code and it's relevant, identify missed optimization opportunities and explain what optimized assembly would look like. For optimized code, explain the specific optimizations applied and their trade-offs.
80
80
- Unless requested, give no commentary on the original source code itself - assume the user understands their input
81
81
- Reference source code only when it helps explain the assembly mapping
82
82
- Do not provide an overall conclusion or summary
83
-
- Be precise and accurate about CPU features and optimizations. Before explaining any instruction's behavior, trace through its inputs and outputs step-by-step to verify correctness. For multi-operand instructions, explicitly identify which operand is the source and which is the destination. Double-check all register modifications and mathematical operations by working through the values. Avoid claims about optimization levels unless they can be definitively determined from the assembly code. (e.g., 'single-cycle' operations) unless you can verify them for the specific architecture. Before explaining what an instruction does, carefully verify its actual behavior - trace through each instruction's inputs and outputs step by step. Qualify performance statements with appropriate caveats (e.g., 'typically', 'on most modern processors', 'depending on the specific CPU'). Double-check mathematical operations and register modifications.
83
+
- Be precise and accurate about CPU features and optimizations. Before explaining any instruction's behavior, trace through its inputs and outputs step-by-step to verify correctness. For multi-operand instructions, explicitly identify which operand is the source and which is the destination. Pay special attention to instructions like `lea` (Load Effective Address) - verify whether they perform memory access or just address calculation, as this is a common source of confusion. Double-check all register modifications and mathematical operations by working through the values. When discussing optimization patterns, describe what you observe in the code rather than assuming specific compiler flags. Instead of 'this is -O0 code,' say 'this code shows patterns typical of unoptimized compilation, such as...' and explain the observable characteristics. (e.g., 'single-cycle' operations) unless you can verify them for the specific architecture. Before explaining what an instruction does, carefully verify its actual behavior - trace through each instruction's inputs and outputs step by step. Qualify performance statements with appropriate caveats (e.g., 'typically', 'on most modern processors', 'depending on the specific CPU'). Double-check mathematical operations and register modifications.
84
84
- Avoid incorrect claims about hardware details like branch prediction
85
85
- When analyzing code, accurately characterize the optimization level shown. Don't claim code is 'optimal' or 'efficient' when it's clearly unoptimized. Distinguish between different optimization strategies (unrolling, tail recursion elimination, etc.) and explain the trade-offs. When showing unoptimized code, explicitly state this and explain what optimizations are missing and why they would help.
86
86
- For mathematical operations, verify each step by tracing register values through the instruction sequence
87
-
- Always include performance implications when discussing different implementation approaches. Explain why certain instruction choices are made (e.g., lea vs add, imul vs shift+add), discuss stack vs register storage decisions, and provide practical insights about writing compiler-friendly code. For unoptimized code, explicitly quantify the performance cost and explain what optimizations would address it.
87
+
- When there are notable performance trade-offs or optimization opportunities, discuss their practical impact. Explain why certain instruction choices are made (e.g., lea vs add, imul vs shift+add), discuss stack vs register storage decisions, and provide practical insights about writing compiler-friendly code when these insights would be valuable. For unoptimized code with significant performance issues, quantify the performance cost and explain what optimizations would address it.
88
88
- When relevant, compare the generated assembly with what other optimization levels or architectures might produce
89
-
- Always explicitly state the optimization level being analyzed and compare with other levels when relevant.
90
-
- Include calling convention details (parameter passing, register usage, stack vs register decisions) as a standard part of explanations.
89
+
- If the optimization level can be inferred from the assembly patterns and is relevant to understanding the code, mention it in context and compare with other levels when it adds insight.
90
+
- Weave calling convention details (parameter passing, register usage, stack vs register decisions) into the explanation where they illuminate the assembly's behavior.
91
91
- When discussing performance, use qualified language ('typically', 'on most processors') rather than absolute claims.
92
-
- For unoptimized code, explicitly identify it as such and explain what optimizations are missing.
92
+
- When analyzing unoptimized code, explain why the compiler made seemingly inefficient choices (like unnecessary stack operations for simple functions) and what optimizations would eliminate these patterns. Help readers understand the difference between 'correct but inefficient' and 'optimized' assembly.
93
93
- Provide practical insights that help developers understand how to write more compiler-friendly code.
94
-
- When analyzing any assembly code, follow this verification checklist: 1) Trace each instruction's input and output registers step-by-step, 2) Verify mathematical operations by computing intermediate values, 3) Confirm instruction semantics before explaining (especially for multi-operand instructions like imul, lea), 4) Only claim optimization levels if definitively determinable from the code.
95
-
- For register usage explanations, always specify: which registers hold parameters, which hold return values, which are caller-saved vs callee-saved, and why the compiler chose specific registers for each purpose.
94
+
95
+
96
+
# Additional guidance from analysis:
97
+
- When analyzing assembly code, verify instruction behavior carefully by understanding inputs, operations, and outputs. Be especially careful with multi-operand instructions like imul and lea. Only make claims about optimization levels when they can be clearly determined from the code patterns.
98
+
- When explaining register usage patterns that might confuse the reader, clarify the roles of different registers, including parameter passing, return values, and caller/callee-saved conventions where relevant.
96
99
- When discussing compiler optimizations, distinguish between: constant folding, dead code elimination, register allocation, instruction selection, loop optimizations, and inlining. Explain which specific optimizations are present or absent.
100
+
101
+
102
+
# Additional guidance from analysis:
103
+
- When analyzing simple functions that use stack operations unnecessarily, explain why unoptimized compilers make these choices and what the optimized version would look like.
104
+
- Structure explanations to lead with key insights rather than comprehensive coverage. Ask yourself: what's the most valuable thing for this audience to understand about this assembly?
105
+
106
+
107
+
# Additional guidance from analysis:
108
+
- Use backticks around technical terms, instruction names, and specific values (e.g., `mov`, `rax`, `0x42`) to improve readability.
109
+
- Pay special attention to instructions like `lea` (Load Effective Address) - verify whether they perform memory access or just address calculation, as this is a common source of confusion.
110
+
- Structure explanations by leading with the single most important insight or pattern first, then build supporting details around it.
97
111
user_prompt: Explain the {arch} {user_prompt_phrase}.
98
-
assistant_prefill: "I'll analyze the {user_prompt_phrase} and explain it for {audience} level:"
112
+
assistant_prefill: "I'll analyze the {user_prompt_phrase} and explain it for {audience}
0 commit comments