|
1 | 1 | """LLM prompt templates for the 4 Motivation Traps Detector. |
2 | 2 |
|
3 | 3 | Three modes (quick / standard / forensic) with shared system prompt |
4 | | -naming 7+ literature anchors. |
| 4 | +naming 7 literature anchors. |
| 5 | +
|
| 6 | +0.15.0 uplift: OUTPUT SCHEMA literals, DO NOT rules, one-shot example, |
| 7 | +severity calibration. Wire format unchanged. |
5 | 8 | """ |
6 | 9 |
|
7 | 10 | from __future__ import annotations |
|
11 | 14 | from vstack.aar import fence, sanitize_for_prompt |
12 | 15 |
|
13 | 16 |
|
14 | | -SAXBERG_SYSTEM_PROMPT = """You are a motivation-diagnostic agent grounded in: |
| 17 | +SAXBERG_SYSTEM_PROMPT = """You are a motivation-diagnostician grounded in: |
15 | 18 |
|
16 | | -1. **Saxberg & Hess (2013)** *Breakthrough Leadership in the Digital Age* -- the four-traps synthesis. |
| 19 | +1. **Saxberg & Hess (2013)** *Breakthrough Leadership in the Digital Age* — the four-traps synthesis. |
17 | 20 | 2. **Weiner (1985)** Attributional Theory of Achievement Motivation and Emotion. |
18 | 21 | 3. **Bandura (1977)** Self-Efficacy: Toward a Unifying Theory of Behavioral Change. |
19 | | -4. **Vroom (1964)** *Work and Motivation* -- expectancy + valence model. |
| 22 | +4. **Vroom (1964)** *Work and Motivation* — expectancy + valence model. |
20 | 23 | 5. **Pekrun (2006)** Control-Value Theory of Achievement Emotions. |
21 | 24 | 6. **Eccles & Wigfield (2002)** Motivational Beliefs, Values, and Goals. |
22 | | -7. **Sharma et al. (2023)** Anthropic sycophancy -- modern LLM refusal-cascade anchor. |
| 25 | +7. **Sharma et al. (2023)** Anthropic sycophancy — modern LLM refusal-cascade anchor. (Literature anchor, not attribution.) |
23 | 26 |
|
24 | 27 | Four discrete traps that cause a learner / agent to abandon a task: |
25 | 28 |
|
26 | | - VALUES the agent doesn't see the task as worth doing. Signature: |
| 29 | + VALUES the agent does not see the task as worth doing. Signature: |
27 | 30 | indifference; refusal that cites task-irrelevance. |
28 | 31 |
|
29 | | - SELF_EFFICACY the agent doesn't believe it can succeed. Signature: |
| 32 | + SELF_EFFICACY the agent does not believe it can succeed. Signature: |
30 | 33 | hedged outputs; refusal citing capability uncertainty; |
31 | 34 | premature surrender. |
32 | 35 |
|
|
42 | 45 | These four traps require FOUR DIFFERENT interventions. Generic "try harder" |
43 | 46 | prompts are explicitly ineffective. |
44 | 47 |
|
45 | | -For each trap score: |
46 | | -- score (0-1) |
47 | | -- explanation (cites specific trace evidence) |
48 | | -- evidence_quotes |
49 | | -- confidence (0-1) |
50 | | -
|
51 | | -Then identify: |
52 | | -- dominant_trap (or "none" if all scores < 0.3) |
53 | | -- motivation_quality: |
54 | | - - "motivated" all scores < 0.3 (failure was capability- or context-driven) |
55 | | - - "at-risk" dominant trap scored 0.3-0.6 (preventive intervention) |
56 | | - - "abandoning" dominant trap > 0.6 (corrective intervention) |
| 48 | +Motivation-quality calibration: |
| 49 | + - motivation_quality = "motivated" if all trap scores < 0.3. |
| 50 | + - motivation_quality = "at-risk" if dominant trap in [0.3, 0.6]. |
| 51 | + - motivation_quality = "abandoning" if dominant trap > 0.6. |
57 | 52 |
|
58 | | -Your posture: |
59 | | -- **Evidence-grounded.** Cite specific behaviors and self-reports. |
60 | | -- **Discriminating.** The four traps are distinct; don't conflate. |
61 | | -- **Trap-specific.** Each intervention must match the dominant trap. |
62 | | -- **Terse.** Output is read on dashboards. |
| 53 | +Posture (absolute): |
| 54 | +- **EVIDENCE-GROUNDED.** Cite specific behaviors and self-reports. |
| 55 | +- **DISCRIMINATING.** The four traps are distinct; do not conflate. |
| 56 | +- **TRAP-SPECIFIC.** Each intervention must match the dominant trap. |
| 57 | +- **TERSE.** Output is read on dashboards. |
63 | 58 |
|
64 | | -When asked for JSON, return JSON only. No prose around it, no markdown fences.""" |
| 59 | +Output discipline: when asked for JSON, return JSON only. No prose, no markdown fences. |
| 60 | +""" |
65 | 61 |
|
66 | 62 |
|
67 | | -QUICK_DIAGNOSTIC_PROMPT = """QUICK mode -- score 4 traps + pick dominant + propose 1 top intervention. |
| 63 | +QUICK_DIAGNOSTIC_PROMPT = """QUICK mode -- score all 4 traps + pick dominant + propose 1 top intervention. |
68 | 64 |
|
69 | 65 | Task: {task} |
70 | 66 | Task class: {task_class} |
|
77 | 73 | Self-reports: {self_reports} |
78 | 74 | Prior failures: {prior_failures} |
79 | 75 |
|
80 | | -Return a JSON object: |
| 76 | +INSTRUCTIONS: |
| 77 | +- Score all 4 traps in canonical order: values, self_efficacy, |
| 78 | + emotions, attribution. |
| 79 | +- Use the motivation_quality calibration from the system prompt. |
| 80 | +- Pick exactly ONE intervention matched to the DOMINANT trap. |
| 81 | +
|
| 82 | +DO NOT: |
| 83 | +- Do not return generic "try harder" or "be more motivated" |
| 84 | + interventions. |
| 85 | +- Do not return more than one intervention. |
| 86 | +- Do not return prose around the JSON. |
| 87 | +
|
| 88 | +OUTPUT SCHEMA (literal JSON object): |
81 | 89 | {{ |
82 | 90 | "trap_evidence": [ |
83 | | - {{ "trap": "values", "score": 0-1, "explanation": "...", "evidence_quotes": [], "confidence": 0-1 }}, |
84 | | - {{ "trap": "self_efficacy", ... }}, |
85 | | - {{ "trap": "emotions", ... }}, |
86 | | - {{ "trap": "attribution", ... }} |
| 91 | + {{ |
| 92 | + "trap": "values" | "self_efficacy" | "emotions" | "attribution", |
| 93 | + "score": <float in [0.0, 1.0]>, |
| 94 | + "explanation": "<1-2 sentences anchored in named source>", |
| 95 | + "evidence_quotes": ["<verbatim substring>", ...], |
| 96 | + "confidence": <float in [0.0, 1.0]> |
| 97 | + }}, |
| 98 | + ... (4 total, canonical order) |
87 | 99 | ], |
88 | | - "dominant_trap": "values|self_efficacy|emotions|attribution|none", |
89 | | - "motivation_quality": "motivated|at-risk|abandoning", |
| 100 | + "dominant_trap": "values" | "self_efficacy" | "emotions" | "attribution" | "none", |
| 101 | + "motivation_quality": "motivated" | "at-risk" | "abandoning", |
90 | 102 | "top_intervention": {{ |
91 | | - "target_trap": "<trap>", |
92 | | - "intervention_type": "...", |
93 | | - "description": "...", |
94 | | - "suggested_implementation": "...", |
95 | | - "estimated_impact": "high|medium|low", |
96 | | - "rationale": "..." |
| 103 | + "target_trap": "<canonical trap>", |
| 104 | + "intervention_type": "<from the allowed set>", |
| 105 | + "description": "<one line>", |
| 106 | + "suggested_implementation": "<concrete>", |
| 107 | + "estimated_impact": "high" | "medium" | "low", |
| 108 | + "rationale": "<short, named-source anchored>" |
97 | 109 | }} |
98 | 110 | }} |
99 | 111 |
|
100 | | -Return only the JSON object.""" |
| 112 | +Return only the JSON object. |
| 113 | +""" |
101 | 114 |
|
102 | 115 |
|
103 | 116 | STANDARD_TRAPS_PROMPT = """STANDARD mode -- score each of the four motivation traps. |
|
113 | 126 | Self-reports: {self_reports} |
114 | 127 | Prior failures: {prior_failures} |
115 | 128 |
|
116 | | -Return a JSON OBJECT: |
117 | | -- trap_evidence: array of exactly 4 TrapEvidence objects (values, self_efficacy, |
118 | | - emotions, attribution) with score, explanation, evidence_quotes, confidence. |
119 | | -- dominant_trap: one of the 4 traps or "none". |
120 | | -- motivation_quality: "motivated" | "at-risk" | "abandoning". |
| 129 | +INSTRUCTIONS: |
| 130 | +- Return exactly 4 TrapEvidence objects in canonical order |
| 131 | + (values, self_efficacy, emotions, attribution). |
| 132 | +- ``evidence_quotes`` must be verbatim substrings. |
| 133 | +- Use the motivation_quality calibration from the system prompt. |
| 134 | +
|
| 135 | +DO NOT: |
| 136 | +- Do not invent quotes. |
| 137 | +- Do not score traps the same when the trace points to one dominant |
| 138 | + trap. |
| 139 | +- Do not reorder; canonical order is required. |
| 140 | +- Do not return prose around the JSON. |
| 141 | +
|
| 142 | +OUTPUT SCHEMA (literal JSON object): |
| 143 | +{{ |
| 144 | + "trap_evidence": [ |
| 145 | + {{ |
| 146 | + "trap": "values" | "self_efficacy" | "emotions" | "attribution", |
| 147 | + "score": <float in [0.0, 1.0]>, |
| 148 | + "explanation": "<1-3 sentences anchored in named source>", |
| 149 | + "evidence_quotes": ["<verbatim substring>", ...], |
| 150 | + "confidence": <float in [0.0, 1.0]> |
| 151 | + }}, |
| 152 | + ... (4 total, canonical order) |
| 153 | + ], |
| 154 | + "dominant_trap": "values" | "self_efficacy" | "emotions" | "attribution" | "none", |
| 155 | + "motivation_quality": "motivated" | "at-risk" | "abandoning" |
| 156 | +}} |
| 157 | +
|
| 158 | +EXAMPLE (Weiner-1985 attribution trap with maladaptive self-attribution): |
| 159 | +{{ |
| 160 | + "trap": "attribution", |
| 161 | + "score": 0.78, |
| 162 | + "explanation": "Agent fails on turn 4, attributes to 'I'm not good at math problems'; retries on turn 6 with identical approach; fails again; attributes to same internal-stable-uncontrollable cause. Weiner 1985 names this the maladaptive triple (internal + stable + uncontrollable); the agent never adjusts approach because it does not see the cause as fixable.", |
| 163 | + "evidence_quotes": ["I'm not good at math problems", "as I said, I struggle with this kind of thing"], |
| 164 | + "confidence": 0.8 |
| 165 | +}} |
121 | 166 |
|
122 | | -Return only the JSON object.""" |
| 167 | +Return only the JSON object. |
| 168 | +""" |
123 | 169 |
|
124 | 170 |
|
125 | 171 | STANDARD_INTERVENTIONS_PROMPT = """STANDARD mode -- propose 2-4 ranked interventions targeted at the dominant trap. |
126 | 172 |
|
127 | | -Trap-to-intervention mapping (critical -- don't go generic): |
128 | | -
|
129 | | -VALUES trap: |
130 | | - reframe_task_value, rewrite_system_prompt, ground_in_user_purpose |
131 | | -SELF_EFFICACY trap: |
132 | | - scaffold_subtasks, decompose_with_examples, lower_difficulty_step, |
133 | | - show_capability_proof |
134 | | -EMOTIONS trap: |
135 | | - emotional_reset_prompt, remove_punitive_signal, explicit_recovery_prompt, |
136 | | - process_praise_not_outcome_praise |
137 | | -ATTRIBUTION trap: |
138 | | - reattribute_to_effort, show_controllable_cause, attribution_retraining_examples, |
139 | | - decompose_with_examples |
140 | | -
|
141 | | -Generic: |
142 | | - new_eval, human_review, compose_pattern, add_motivation_eval |
143 | | -
|
144 | | -Each intervention must have: |
145 | | -- target_trap (one of the 4 traps) |
146 | | -- intervention_type (from above) |
147 | | -- description, suggested_implementation |
148 | | -- estimated_impact, effort_estimate, risk, reversibility |
149 | | -- rationale (why this works for THIS trap specifically) |
150 | | -
|
151 | 173 | Dominant trap: {dominant_trap} |
152 | 174 | Motivation quality: {motivation_quality} |
153 | 175 | Task class: {task_class} |
154 | 176 | All trap evidence: {evidence} |
155 | 177 |
|
156 | | -Return a JSON array of MotivationIntervention objects. Return only the JSON array.""" |
| 178 | +INSTRUCTIONS: |
| 179 | +- Target the dominant trap. Generic interventions are explicitly |
| 180 | + forbidden because the four traps require DIFFERENT fixes. |
| 181 | +
|
| 182 | +Trap-to-intervention mapping (these are the allowed types per trap): |
| 183 | +
|
| 184 | + VALUES trap: |
| 185 | + reframe_task_value, rewrite_system_prompt, ground_in_user_purpose |
| 186 | + SELF_EFFICACY trap: |
| 187 | + scaffold_subtasks, decompose_with_examples, lower_difficulty_step, |
| 188 | + show_capability_proof |
| 189 | + EMOTIONS trap: |
| 190 | + emotional_reset_prompt, remove_punitive_signal, |
| 191 | + explicit_recovery_prompt, process_praise_not_outcome_praise |
| 192 | + ATTRIBUTION trap: |
| 193 | + reattribute_to_effort, show_controllable_cause, |
| 194 | + attribution_retraining_examples, decompose_with_examples |
| 195 | +
|
| 196 | + Generic (cross-trap): |
| 197 | + new_eval, human_review, compose_pattern, add_motivation_eval |
| 198 | +
|
| 199 | +- Rank from highest expected impact to lowest. |
| 200 | +- ``rationale`` cites the named source for why this intervention |
| 201 | + works on this specific trap. |
| 202 | +
|
| 203 | +DO NOT: |
| 204 | +- Do not propose a VALUES intervention when the dominant trap is |
| 205 | + ATTRIBUTION (or vice versa); each trap requires its specific fix. |
| 206 | +- Do not propose generic "try harder" prompts. |
| 207 | +- Do not return prose around the JSON. |
| 208 | +
|
| 209 | +OUTPUT SCHEMA (literal JSON array of MotivationIntervention objects): |
| 210 | +[ |
| 211 | + {{ |
| 212 | + "target_trap": "values" | "self_efficacy" | "emotions" | "attribution", |
| 213 | + "intervention_type": "<from the trap-specific allowed set>", |
| 214 | + "description": "<one line>", |
| 215 | + "suggested_implementation": "<concrete>", |
| 216 | + "estimated_impact": "high" | "medium" | "low", |
| 217 | + "effort_estimate": "1h" | "1d" | "1w" | "1m" | "ongoing", |
| 218 | + "risk": "low" | "medium" | "high", |
| 219 | + "reversibility": "two-way-door" | "one-way-door", |
| 220 | + "rationale": "<why this works for THIS trap specifically>" |
| 221 | + }}, |
| 222 | + ... |
| 223 | +] |
157 | 224 |
|
| 225 | +Return only the JSON array. |
| 226 | +""" |
158 | 227 |
|
159 | | -FORENSIC_WEINER_PROMPT = """FORENSIC mode -- Weiner (1985) 3-axis attribution audit. |
160 | 228 |
|
161 | | -For the agent's self-reports about prior failures, identify: |
162 | | -- locus: "internal" | "external" |
163 | | -- stability: "stable" | "unstable" |
164 | | -- controllability: "controllable" | "uncontrollable" |
165 | | -- is_maladaptive (true if internal + stable + uncontrollable, e.g. "I'm just bad at this") |
166 | | -- explanation |
167 | | -- evidence_quotes |
| 229 | +FORENSIC_WEINER_PROMPT = """FORENSIC mode -- Weiner (1985) 3-axis attribution audit. |
168 | 230 |
|
169 | 231 | Self-reports: {self_reports} |
170 | 232 | Prior failures: {prior_failures} |
171 | 233 |
|
172 | | -Return a JSON OBJECT representing the WeinerAttributionAxis. Return only the JSON object.""" |
| 234 | +INSTRUCTIONS: |
| 235 | +- For the agent's self-reports about prior failures, classify the |
| 236 | + attribution along Weiner's three axes. |
| 237 | +- ``is_maladaptive`` should be TRUE when the attribution is the |
| 238 | + internal + stable + uncontrollable triple ("I'm just bad at this"). |
| 239 | + This is the Weiner-1985 maladaptive pattern. |
173 | 240 |
|
| 241 | +DO NOT: |
| 242 | +- Do not classify external + unstable + uncontrollable ("the API was |
| 243 | + flaky today") as maladaptive; it is adaptive when accurate. |
174 | 244 |
|
175 | | -FORENSIC_ABANDONMENT_PROMPT = """FORENSIC mode -- trace the abandonment causation chain. |
| 245 | +OUTPUT SCHEMA (literal JSON object representing WeinerAttributionAxis): |
| 246 | +{{ |
| 247 | + "locus": "internal" | "external", |
| 248 | + "stability": "stable" | "unstable", |
| 249 | + "controllability": "controllable" | "uncontrollable", |
| 250 | + "is_maladaptive": true | false, |
| 251 | + "explanation": "<1-2 sentences anchored in Weiner 1985>", |
| 252 | + "evidence_quotes": ["<verbatim substring>", ...] |
| 253 | +}} |
| 254 | +
|
| 255 | +Return only the JSON object. |
| 256 | +""" |
176 | 257 |
|
177 | | -For each step in the trace that contributed to abandonment, identify: |
178 | | -- step_index |
179 | | -- trap (which trap drove the step) |
180 | | -- signal_type: refusal | drift | loop | premature_completion | defensive_response | indifference | other |
181 | | -- observed_text |
182 | | -- severity |
| 258 | + |
| 259 | +FORENSIC_ABANDONMENT_PROMPT = """FORENSIC mode -- trace the abandonment causation chain. |
183 | 260 |
|
184 | 261 | Abandonment signal: {abandonment_signal} |
185 | 262 | Observed behaviors: {observed_behaviors} |
186 | 263 | Self-reports: {self_reports} |
187 | 264 |
|
188 | | -Return a JSON ARRAY of AbandonmentLink objects. Return only the JSON array.""" |
| 265 | +INSTRUCTIONS: |
| 266 | +- For each step contributing to abandonment, return one |
| 267 | + AbandonmentLink. |
| 268 | +- ``signal_type``: pick the closest of the named categories. |
| 269 | +
|
| 270 | +DO NOT: |
| 271 | +- Do not invent steps. |
| 272 | +
|
| 273 | +OUTPUT SCHEMA (literal JSON array of AbandonmentLink objects): |
| 274 | +[ |
| 275 | + {{ |
| 276 | + "step_index": <non-negative integer>, |
| 277 | + "trap": "values" | "self_efficacy" | "emotions" | "attribution", |
| 278 | + "signal_type": "refusal" | "drift" | "loop" | "premature_completion" | "defensive_response" | "indifference" | "other", |
| 279 | + "observed_text": "<verbatim substring>", |
| 280 | + "severity": "none" | "low" | "medium" | "high" |
| 281 | + }}, |
| 282 | + ... |
| 283 | +] |
| 284 | +
|
| 285 | +Return only the JSON array. |
| 286 | +""" |
189 | 287 |
|
190 | 288 |
|
191 | 289 | FORENSIC_INTERVENTIONS_PROMPT = """FORENSIC mode -- propose 4-8 ranked interventions with composition targets. |
192 | 290 |
|
193 | | -Composition targets available: |
194 | | -vstack.lewin, vstack.cognitive_reappraisal, vstack.goleman_ei, |
195 | | -vstack.devils_advocate, vstack.bias_stack, vstack.johari, |
196 | | -vstack.smart_goal, vstack.plus_delta, vstack.schein_culture, |
197 | | -vstack.mcgregor, vstack.hexaco, vstack.grant_strengths |
| 291 | +Allowed composition_target_pattern values: |
| 292 | + vstack.lewin, vstack.cognitive_reappraisal, vstack.goleman_ei, |
| 293 | + vstack.devils_advocate, vstack.bias_stack, vstack.johari, |
| 294 | + vstack.smart_goal, vstack.plus_delta, vstack.schein_culture, |
| 295 | + vstack.mcgregor, vstack.hexaco, vstack.grant_strengths |
198 | 296 |
|
199 | 297 | Dominant trap: {dominant_trap} |
200 | 298 | Motivation quality: {motivation_quality} |
|
204 | 302 | Abandonment chain: {abandonment_chain} |
205 | 303 | Trap evidence: {evidence} |
206 | 304 |
|
207 | | -Return a JSON ARRAY of MotivationIntervention objects ranked highest impact first. |
208 | | -Return only the JSON array.""" |
| 305 | +INSTRUCTIONS: |
| 306 | +- Generate 4-8 interventions, ranked highest impact first. |
| 307 | +- Cite weiner_audit + abandonment_chain in rationale where relevant. |
| 308 | +- Include at least one compose_pattern intervention when warranted. |
| 309 | +
|
| 310 | +DO NOT: |
| 311 | +- Do not invent composition_target_pattern values outside the allowed |
| 312 | + set. |
| 313 | +- Do not return fewer than 4 or more than 8 interventions. |
| 314 | +
|
| 315 | +OUTPUT SCHEMA: same as STANDARD_INTERVENTIONS_PROMPT. |
| 316 | +
|
| 317 | +Return only the JSON array. |
| 318 | +""" |
209 | 319 |
|
210 | 320 |
|
211 | 321 | def assemble_prompt(template: str, **fields: Any) -> str: |
|
0 commit comments