Skip to content

Commit 00e204c

Browse files
committed
motivation-traps: prompt-engineering uplift (#9)
OUTPUT SCHEMA literals + DO NOT rules + one-shot example demonstrating Weiner-1985 maladaptive attribution triple (internal + stable + uncontrollable) with verbatim "I'm not good at math problems" quote. Trap-to-intervention mapping kept load-bearing as a DO NOT rule: do not propose a VALUES intervention when the dominant trap is ATTRIBUTION; the four traps require FOUR DIFFERENT fixes. Generic "try harder" prompts explicitly forbidden. Motivation_quality calibration explicit in SAXBERG_SYSTEM_PROMPT (motivated / at-risk / abandoning thresholds). Canonical trap order enforced (values, self_efficacy, emotions, attribution). Wire format unchanged. All Motivation Traps tests + 84 diagnose tests still pass.
1 parent de69bc3 commit 00e204c

1 file changed

Lines changed: 205 additions & 95 deletions

File tree

  • module-1-individual/09-motivation-traps/lib

module-1-individual/09-motivation-traps/lib/prompts.py

Lines changed: 205 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
"""LLM prompt templates for the 4 Motivation Traps Detector.
22
33
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.
58
"""
69

710
from __future__ import annotations
@@ -11,22 +14,22 @@
1114
from vstack.aar import fence, sanitize_for_prompt
1215

1316

14-
SAXBERG_SYSTEM_PROMPT = """You are a motivation-diagnostic agent grounded in:
17+
SAXBERG_SYSTEM_PROMPT = """You are a motivation-diagnostician grounded in:
1518
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.
1720
2. **Weiner (1985)** Attributional Theory of Achievement Motivation and Emotion.
1821
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.
2023
5. **Pekrun (2006)** Control-Value Theory of Achievement Emotions.
2124
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.)
2326
2427
Four discrete traps that cause a learner / agent to abandon a task:
2528
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:
2730
indifference; refusal that cites task-irrelevance.
2831
29-
SELF_EFFICACY the agent doesn't believe it can succeed. Signature:
32+
SELF_EFFICACY the agent does not believe it can succeed. Signature:
3033
hedged outputs; refusal citing capability uncertainty;
3134
premature surrender.
3235
@@ -42,29 +45,22 @@
4245
These four traps require FOUR DIFFERENT interventions. Generic "try harder"
4346
prompts are explicitly ineffective.
4447
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.
5752
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.
6358
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+
"""
6561

6662

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.
6864
6965
Task: {task}
7066
Task class: {task_class}
@@ -77,27 +73,44 @@
7773
Self-reports: {self_reports}
7874
Prior failures: {prior_failures}
7975
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):
8189
{{
8290
"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)
8799
],
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",
90102
"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>"
97109
}}
98110
}}
99111
100-
Return only the JSON object."""
112+
Return only the JSON object.
113+
"""
101114

102115

103116
STANDARD_TRAPS_PROMPT = """STANDARD mode -- score each of the four motivation traps.
@@ -113,88 +126,173 @@
113126
Self-reports: {self_reports}
114127
Prior failures: {prior_failures}
115128
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+
}}
121166
122-
Return only the JSON object."""
167+
Return only the JSON object.
168+
"""
123169

124170

125171
STANDARD_INTERVENTIONS_PROMPT = """STANDARD mode -- propose 2-4 ranked interventions targeted at the dominant trap.
126172
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-
151173
Dominant trap: {dominant_trap}
152174
Motivation quality: {motivation_quality}
153175
Task class: {task_class}
154176
All trap evidence: {evidence}
155177
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+
]
157224
225+
Return only the JSON array.
226+
"""
158227

159-
FORENSIC_WEINER_PROMPT = """FORENSIC mode -- Weiner (1985) 3-axis attribution audit.
160228

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.
168230
169231
Self-reports: {self_reports}
170232
Prior failures: {prior_failures}
171233
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.
173240
241+
DO NOT:
242+
- Do not classify external + unstable + uncontrollable ("the API was
243+
flaky today") as maladaptive; it is adaptive when accurate.
174244
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+
"""
176257

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.
183260
184261
Abandonment signal: {abandonment_signal}
185262
Observed behaviors: {observed_behaviors}
186263
Self-reports: {self_reports}
187264
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+
"""
189287

190288

191289
FORENSIC_INTERVENTIONS_PROMPT = """FORENSIC mode -- propose 4-8 ranked interventions with composition targets.
192290
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
198296
199297
Dominant trap: {dominant_trap}
200298
Motivation quality: {motivation_quality}
@@ -204,8 +302,20 @@
204302
Abandonment chain: {abandonment_chain}
205303
Trap evidence: {evidence}
206304
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+
"""
209319

210320

211321
def assemble_prompt(template: str, **fields: Any) -> str:

0 commit comments

Comments
 (0)