@ckelsoe/prompt-architect 3.3.1 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +3 -3
- package/.claude-plugin/plugin.json +2 -2
- package/CHANGELOG.md +34 -0
- package/README.md +7 -3
- package/adapters/system-prompt.md +96 -55
- package/package.json +6 -4
- package/scripts/test.js +32 -0
- package/skills/prompt-architect/SKILL.md +74 -41
- package/skills/prompt-architect/assets/templates/ape_template.txt +14 -3
- package/skills/prompt-architect/assets/templates/bab_template.txt +23 -10
- package/skills/prompt-architect/assets/templates/broke_template.txt +31 -6
- package/skills/prompt-architect/assets/templates/cai-critique-revise_template.txt +16 -8
- package/skills/prompt-architect/assets/templates/care_template.txt +4 -0
- package/skills/prompt-architect/assets/templates/chain-of-density_template.txt +30 -31
- package/skills/prompt-architect/assets/templates/chain-of-thought_template.txt +8 -0
- package/skills/prompt-architect/assets/templates/chain-of-verification_template.txt +26 -0
- package/skills/prompt-architect/assets/templates/co-star_template.txt +8 -0
- package/skills/prompt-architect/assets/templates/crispe_template.txt +6 -0
- package/skills/prompt-architect/assets/templates/ctf_template.txt +8 -0
- package/skills/prompt-architect/assets/templates/devils-advocate_template.txt +7 -0
- package/skills/prompt-architect/assets/templates/hybrid_template.txt +44 -24
- package/skills/prompt-architect/assets/templates/iterative-compression_template.txt +43 -28
- package/skills/prompt-architect/assets/templates/least-to-most_template.txt +4 -0
- package/skills/prompt-architect/assets/templates/plan-and-solve_template.txt +4 -0
- package/skills/prompt-architect/assets/templates/pre-mortem_template.txt +24 -14
- package/skills/prompt-architect/assets/templates/race_template.txt +9 -0
- package/skills/prompt-architect/assets/templates/rcot_template.txt +8 -0
- package/skills/prompt-architect/assets/templates/react_template.txt +38 -16
- package/skills/prompt-architect/assets/templates/rise-ie_template.txt +4 -0
- package/skills/prompt-architect/assets/templates/rise-ix_template.txt +3 -3
- package/skills/prompt-architect/assets/templates/risen_template.txt +7 -0
- package/skills/prompt-architect/assets/templates/rpef_template.txt +16 -11
- package/skills/prompt-architect/assets/templates/rtf_template.txt +9 -0
- package/skills/prompt-architect/assets/templates/self-consistency_template.txt +12 -0
- package/skills/prompt-architect/assets/templates/skeleton-of-thought_template.txt +18 -10
- package/skills/prompt-architect/assets/templates/step-back_template.txt +4 -0
- package/skills/prompt-architect/assets/templates/tidd-ec_template.txt +54 -31
- package/skills/prompt-architect/assets/templates/tree-of-thought_template.txt +37 -21
- package/skills/prompt-architect/references/frameworks/ape.md +143 -57
- package/skills/prompt-architect/references/frameworks/bab.md +137 -58
- package/skills/prompt-architect/references/frameworks/broke.md +157 -57
- package/skills/prompt-architect/references/frameworks/cai-critique-revise.md +183 -75
- package/skills/prompt-architect/references/frameworks/care.md +67 -36
- package/skills/prompt-architect/references/frameworks/chain-of-density.md +49 -27
- package/skills/prompt-architect/references/frameworks/chain-of-thought.md +28 -7
- package/skills/prompt-architect/references/frameworks/chain-of-verification.md +231 -0
- package/skills/prompt-architect/references/frameworks/co-star.md +100 -44
- package/skills/prompt-architect/references/frameworks/crispe.md +7 -5
- package/skills/prompt-architect/references/frameworks/ctf.md +73 -37
- package/skills/prompt-architect/references/frameworks/devils-advocate.md +105 -58
- package/skills/prompt-architect/references/frameworks/iterative-compression.md +236 -269
- package/skills/prompt-architect/references/frameworks/least-to-most.md +35 -13
- package/skills/prompt-architect/references/frameworks/plan-and-solve.md +38 -9
- package/skills/prompt-architect/references/frameworks/pre-mortem.md +176 -66
- package/skills/prompt-architect/references/frameworks/race.md +91 -38
- package/skills/prompt-architect/references/frameworks/rcot.md +1 -1
- package/skills/prompt-architect/references/frameworks/react.md +230 -97
- package/skills/prompt-architect/references/frameworks/reverse-role.md +22 -15
- package/skills/prompt-architect/references/frameworks/rise.md +94 -70
- package/skills/prompt-architect/references/frameworks/risen.md +80 -28
- package/skills/prompt-architect/references/frameworks/rpef.md +227 -58
- package/skills/prompt-architect/references/frameworks/rtf.md +2 -2
- package/skills/prompt-architect/references/frameworks/self-consistency.md +195 -0
- package/skills/prompt-architect/references/frameworks/self-refine.md +4 -2
- package/skills/prompt-architect/references/frameworks/skeleton-of-thought.md +67 -21
- package/skills/prompt-architect/references/frameworks/step-back.md +47 -15
- package/skills/prompt-architect/references/frameworks/tidd-ec.md +110 -45
- package/skills/prompt-architect/references/frameworks/tree-of-thought.md +112 -37
- package/skills/prompt-architect/references/techniques/few-shot.md +121 -0
|
@@ -6,15 +6,17 @@ ReAct (Reasoning + Acting) is an agentic prompting framework that interleaves re
|
|
|
6
6
|
|
|
7
7
|
ReAct is the framework of choice when the task requires using tools, querying external sources, writing and executing code, or navigating a multi-step process where each step's result informs the next.
|
|
8
8
|
|
|
9
|
-
**Research basis:** Introduced in "ReAct: Synergizing Reasoning and Acting in Language Models" (Yao et al., arXiv 2210.03629, 2022; ICLR 2023).
|
|
9
|
+
**Research basis:** Introduced in "ReAct: Synergizing Reasoning and Acting in Language Models" (Yao et al., arXiv 2210.03629, 2022; ICLR 2023), where grounding a reasoning trace in executed tool calls beat action-only baselines and reduced the fabrication that reasoning-only prompting produced. Those results come from *executed* trajectories — a live tool backend (Wikipedia search and lookup, among others) returned every Observation, and a controller dispatched each Action and fed the real result back into the next step. What this framework ships is a prompt that *specifies* that protocol: it does not implement the tool dispatch, the Observation source, or the loop that carries results forward, and all three must already exist in the environment where the prompt is pasted. Where they do not, there is nothing to act on and the cycle degrades to formatted reasoning — the case the "Avoid ReAct when" guidance below routes away from.
|
|
10
10
|
|
|
11
11
|
## Components
|
|
12
12
|
|
|
13
13
|
### Goal
|
|
14
14
|
**Purpose:** Define what needs to be achieved — the end state the agent should reach.
|
|
15
15
|
|
|
16
|
-
### Tools
|
|
17
|
-
**Purpose:** List what the agent can use to accomplish the goal. This tells the model what actions are possible.
|
|
16
|
+
### Available Tools
|
|
17
|
+
**Purpose:** List what the agent can use to accomplish the goal. This tells the model what actions are possible, and — because the template forbids calling anything not on the list — what it may not do.
|
|
18
|
+
|
|
19
|
+
Describe each tool only from what the user actually told you. Do not invent inputs or return values they did not state; a tool described with a return value it does not have produces a plan that fails at the first call.
|
|
18
20
|
|
|
19
21
|
**Common tool types:**
|
|
20
22
|
- Search / web lookup
|
|
@@ -24,83 +26,147 @@ ReAct is the framework of choice when the task requires using tools, querying ex
|
|
|
24
26
|
- Calculator / computation
|
|
25
27
|
- Database queries
|
|
26
28
|
|
|
29
|
+
### Constraints
|
|
30
|
+
**Purpose:** Bound every action with requirements and prohibitions, and — mandatory in this template — name the stop condition.
|
|
31
|
+
|
|
32
|
+
The `CONSTRAINTS:` block always carries a "Stop and deliver your Final Answer when …" line naming the observable situation that means the goal is reached or cannot be. Without it an agent loop has no terminating condition. An optional hard ceiling on tool calls can be added; delete that line when there is no limit.
|
|
33
|
+
|
|
27
34
|
### ReAct Cycle
|
|
28
35
|
**Purpose:** The repeating Thought → Action → Observation loop.
|
|
29
36
|
|
|
30
37
|
- **Thought:** Reason about the current state and what to do next
|
|
31
38
|
- **Action:** Take a specific, concrete action using an available tool
|
|
32
|
-
- **Observation:**
|
|
39
|
+
- **Observation:** The result the tool actually returned — the one component the emitted prompt never authors (see below)
|
|
33
40
|
- *(Repeat until goal is reached)*
|
|
34
41
|
|
|
42
|
+
**The model filling this template must never write an Observation.** An Observation is the output of an executed tool call, produced by the environment at run time. It is not a slot to fill. Writing one produces a fabricated investigation that reads as though it happened — a plausible trace, a confident Final Answer, and no execution behind either.
|
|
43
|
+
|
|
44
|
+
This overrides the "fill missing elements with reasonable defaults" instruction in SKILL.md step 5. An unfilled Observation is not a missing element awaiting a sensible default; it is a result that cannot exist until something runs. `react_template.txt` carries this ban explicitly. Emit the `Observation:` label with the template's description of what the tool will return, and leave the value to the run.
|
|
45
|
+
|
|
35
46
|
### Final Answer
|
|
36
47
|
**Purpose:** Once the goal is achieved, provide the answer or deliverable.
|
|
37
48
|
|
|
38
49
|
## Template Structure
|
|
39
50
|
|
|
51
|
+
Two rules govern this template's labels, and they point in opposite directions:
|
|
52
|
+
|
|
53
|
+
Section headers (`GOAL:`, `AVAILABLE TOOLS:`, `CONSTRAINTS:`, `APPROACH:`) are stripped at emission, so every header's meaning is carried by the unbracketed prose that ships beneath it. Do not reintroduce header-only structure.
|
|
54
|
+
|
|
55
|
+
The cycle labels (`Thought:`, `Action:`, `Observation:`, `Final Answer:`) are the exception — they are literal tokens of the ReAct protocol, not headings, and they survive into the emitted prompt exactly as written. Stripping them breaks the loop.
|
|
56
|
+
|
|
57
|
+
This is the template as shipped in `assets/templates/react_template.txt`:
|
|
58
|
+
|
|
40
59
|
```
|
|
60
|
+
You are an agent that reaches a goal by calling tools, not by answering in one pass from what
|
|
61
|
+
you already know. Work in a Thought → Action → Observation loop, letting each real tool result
|
|
62
|
+
decide your next step. If the tools below are not actually callable here, stop and say so —
|
|
63
|
+
without live tools this protocol is only formatted guesswork, and plain step-by-step reasoning
|
|
64
|
+
fits better.
|
|
65
|
+
|
|
41
66
|
GOAL:
|
|
42
|
-
|
|
67
|
+
The end state you must reach before you stop:
|
|
68
|
+
[A full sentence naming what must be produced or determined. Write it as an outcome, not an
|
|
69
|
+
activity.]
|
|
43
70
|
|
|
44
71
|
AVAILABLE TOOLS:
|
|
45
|
-
|
|
46
|
-
- [
|
|
47
|
-
|
|
72
|
+
Do not call any tool that is not named here:
|
|
73
|
+
- [tool_name]: [Full sentence on what this tool does and what input it takes, drawn only from
|
|
74
|
+
what the user actually told you — do not invent inputs or return values they did not state.]
|
|
75
|
+
- [tool_name]: [Same form, one line per tool the user named. Delete any unused line rather
|
|
76
|
+
than inventing a tool to fill it.]
|
|
48
77
|
|
|
49
78
|
CONSTRAINTS:
|
|
50
|
-
|
|
79
|
+
Every action is bound by these rules — each is a requirement or a prohibition, not a
|
|
80
|
+
suggestion:
|
|
81
|
+
- [A self-contained imperative, e.g. "Base every conclusion on data you actually retrieved."
|
|
82
|
+
Phrase restrictions as "Do not…" or "Never…" so each prohibition stands on its own line.]
|
|
83
|
+
- Stop and deliver your Final Answer when [full clause naming the observable situation that
|
|
84
|
+
means the goal is reached, or that it cannot be].
|
|
85
|
+
- [Optional — a hard ceiling as a full sentence, e.g. "Make no more than 8 tool calls in
|
|
86
|
+
total." Delete this line if there is no limit.]
|
|
51
87
|
|
|
52
88
|
APPROACH:
|
|
53
|
-
|
|
89
|
+
Repeat this cycle until the goal is reached, each step on its own line starting with its
|
|
90
|
+
label. Replace each description below with your actual content:
|
|
91
|
+
|
|
92
|
+
Thought: your reasoning about where things stand and what to do next
|
|
93
|
+
Action: the tool name, then an em dash, then the exact input you are passing to that tool
|
|
94
|
+
Observation: the exact result that tool returned
|
|
95
|
+
|
|
96
|
+
When the cycle has stopped, write this one line, one time only:
|
|
97
|
+
|
|
98
|
+
Final Answer: the deliverable the goal asked for, supported by what your Observations showed
|
|
99
|
+
|
|
100
|
+
Rules for the cycle:
|
|
101
|
+
- Every Action must name one tool from the list above, never prose — e.g. Action:
|
|
102
|
+
search_docs — "token refresh policy"
|
|
103
|
+
- Take ONE action at a time, then wait for its real Observation before continuing; each
|
|
104
|
+
Thought must respond to the Observation directly before it.
|
|
105
|
+
- Never write an Observation yourself. An Observation is the actual output of an actual tool
|
|
106
|
+
call. Inventing one produces a fabricated investigation that reads as though it happened.
|
|
107
|
+
- "Thought:", "Action:", "Observation:" and "Final Answer:" are literal labels in this
|
|
108
|
+
protocol, not headings — keep them exactly as written.
|
|
109
|
+
```
|
|
54
110
|
|
|
55
|
-
|
|
56
|
-
Action: [Tool name] — [specific query or operation]
|
|
57
|
-
Observation: [Result of the action]
|
|
111
|
+
Note what the emitted prompt ends with: the cycle *instructions*. It does not contain a filled-in cycle. The three lines under `APPROACH:` are descriptions of what each label should carry once the agent runs — they are not a first turn to be completed on the user's behalf.
|
|
58
112
|
|
|
59
|
-
|
|
60
|
-
Action: [Tool name] — [next operation]
|
|
61
|
-
Observation: [Result]
|
|
113
|
+
## Complete Examples
|
|
62
114
|
|
|
63
|
-
|
|
115
|
+
**Read these as two separate things.** Each example shows the prompt that gets emitted, and then — separately — a transcript of a run that already happened in an environment with live tools. The transcripts are illustrations of a completed run, not part of the deliverable. Every `Observation:` in them is a value a real tool returned; none was written by the model that composed the prompt.
|
|
64
116
|
|
|
65
|
-
|
|
66
|
-
```
|
|
117
|
+
When you emit a ReAct prompt, you emit the first block only. The trace is what the run produces afterward. Writing a trace into the prompt is the failure mode the template's Observation ban exists to prevent.
|
|
67
118
|
|
|
68
|
-
|
|
119
|
+
The `APPROACH:` bodies below are abbreviated for readability — the real emitted prompt carries the full cycle instructions and "Rules for the cycle" block verbatim from Template Structure above.
|
|
69
120
|
|
|
70
121
|
### Example 1: Research Task (Agentic)
|
|
71
122
|
|
|
72
123
|
**Before ReAct:**
|
|
73
124
|
"Find out which JavaScript framework is most popular right now."
|
|
74
125
|
|
|
75
|
-
**After ReAct:**
|
|
126
|
+
**After ReAct — the emitted prompt:**
|
|
76
127
|
```
|
|
128
|
+
You are an agent that reaches a goal by calling tools, not by answering in one pass from
|
|
129
|
+
what you already know. [...framing paragraph as in Template Structure...]
|
|
130
|
+
|
|
77
131
|
GOAL:
|
|
78
|
-
|
|
79
|
-
|
|
132
|
+
The end state you must reach before you stop:
|
|
133
|
+
Determine which JavaScript frontend framework has the highest current adoption, and
|
|
134
|
+
produce a brief evidence-based recommendation for a new project.
|
|
80
135
|
|
|
81
136
|
AVAILABLE TOOLS:
|
|
82
|
-
|
|
83
|
-
-
|
|
137
|
+
Do not call any tool that is not named here:
|
|
138
|
+
- web_search: Searches the web for a query string and returns result snippets with their
|
|
139
|
+
source URLs.
|
|
140
|
+
- fetch_page: Retrieves the full text content of a single URL you pass to it.
|
|
84
141
|
|
|
85
142
|
CONSTRAINTS:
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
-
|
|
143
|
+
Every action is bound by these rules — each is a requirement or a prohibition, not a
|
|
144
|
+
suggestion:
|
|
145
|
+
- Base every conclusion on data you actually retrieved.
|
|
146
|
+
- Prioritize data published within the last 12 months.
|
|
147
|
+
- Never rely on a single survey.
|
|
148
|
+
- Stop and deliver your Final Answer when at least two independent sources agree on a
|
|
149
|
+
ranking, or when you have established that they disagree irreconcilably.
|
|
89
150
|
|
|
90
151
|
APPROACH:
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
Action: web_search — "JavaScript framework popularity 2024 Stack Overflow survey"
|
|
95
|
-
Observation: [Search results]
|
|
152
|
+
[...cycle instructions and "Rules for the cycle" block, verbatim from the template...]
|
|
153
|
+
```
|
|
96
154
|
|
|
97
|
-
|
|
98
|
-
|
|
155
|
+
**The run that followed** — transcript, tools live; each Observation is what the tool returned:
|
|
156
|
+
```
|
|
157
|
+
Thought: I need current data on JS framework popularity. I'll start with the Stack
|
|
158
|
+
Overflow Developer Survey and corroborate against npm download stats.
|
|
159
|
+
Action: web_search — "JavaScript framework popularity Stack Overflow developer survey"
|
|
160
|
+
Observation: Snippets from the survey's web-frameworks section, with React ahead of
|
|
161
|
+
Angular and Vue among all respondents, plus the survey methodology page.
|
|
99
162
|
|
|
100
|
-
|
|
101
|
-
|
|
163
|
+
Thought: That is one source, and the constraint forbids relying on a single survey.
|
|
164
|
+
Download volume is an independent signal, so I will check npm next.
|
|
165
|
+
Action: web_search — "React vs Vue vs Angular npm downloads"
|
|
166
|
+
Observation: npm trends comparison showing weekly download counts for the three
|
|
167
|
+
packages over the trailing year.
|
|
102
168
|
|
|
103
|
-
Thought:
|
|
169
|
+
Thought: Two independent sources now agree on the ordering. The stop condition is met.
|
|
104
170
|
|
|
105
171
|
Final Answer: Based on [sources], React leads in adoption at X%, followed by...
|
|
106
172
|
```
|
|
@@ -110,52 +176,64 @@ Final Answer: Based on [sources], React leads in adoption at X%, followed by...
|
|
|
110
176
|
**Before ReAct:**
|
|
111
177
|
"Debug why the tests are failing."
|
|
112
178
|
|
|
113
|
-
**After ReAct:**
|
|
179
|
+
**After ReAct — the emitted prompt:**
|
|
114
180
|
```
|
|
181
|
+
You are an agent that reaches a goal by calling tools, not by answering in one pass from
|
|
182
|
+
what you already know. [...framing paragraph as in Template Structure...]
|
|
183
|
+
|
|
115
184
|
GOAL:
|
|
116
|
-
|
|
117
|
-
|
|
185
|
+
The end state you must reach before you stop:
|
|
186
|
+
Identify and fix the root cause of the 3 failing unit tests in auth.test.js, which began
|
|
187
|
+
failing after the auth module refactor.
|
|
118
188
|
|
|
119
189
|
AVAILABLE TOOLS:
|
|
120
|
-
|
|
121
|
-
-
|
|
122
|
-
-
|
|
190
|
+
Do not call any tool that is not named here:
|
|
191
|
+
- read_file: Takes a path and returns the full contents of that file from the codebase.
|
|
192
|
+
- run_tests: Takes a test file path, executes that suite, and returns the pass/fail
|
|
193
|
+
output with error text.
|
|
194
|
+
- search_code: Takes a string and returns every location in the codebase where it appears.
|
|
123
195
|
|
|
124
196
|
CONSTRAINTS:
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
-
|
|
197
|
+
Every action is bound by these rules — each is a requirement or a prohibition, not a
|
|
198
|
+
suggestion:
|
|
199
|
+
- Fix the root cause, not the symptom.
|
|
200
|
+
- Do not change test code unless you have established the tests themselves are wrong.
|
|
201
|
+
- Never report a fix you have not verified by re-running the suite.
|
|
202
|
+
- Stop and deliver your Final Answer when run_tests reports all 3 tests passing, or when
|
|
203
|
+
you have determined the fix requires information not available through these tools.
|
|
128
204
|
|
|
129
205
|
APPROACH:
|
|
130
|
-
|
|
206
|
+
[...cycle instructions and "Rules for the cycle" block, verbatim from the template...]
|
|
207
|
+
```
|
|
131
208
|
|
|
209
|
+
**The run that followed** — transcript, tools live; each Observation is what the tool returned:
|
|
210
|
+
```
|
|
211
|
+
Thought: I need to understand what the tests expect before I look at the implementation.
|
|
132
212
|
Action: read_file — auth.test.js
|
|
133
|
-
Observation:
|
|
134
|
-
|
|
135
|
-
Thought: Tests are calling `auth.validateToken(token)` but based on the refactor
|
|
136
|
-
PR description, the function was renamed. Let me check the new implementation.
|
|
213
|
+
Observation: The three test cases, each calling auth.validateToken(token) with a
|
|
214
|
+
different fixture.
|
|
137
215
|
|
|
216
|
+
Thought: The tests call `auth.validateToken(token)`. The refactor PR description
|
|
217
|
+
mentions a rename, so I should check what the implementation exports now.
|
|
138
218
|
Action: read_file — auth.js
|
|
139
|
-
Observation:
|
|
140
|
-
|
|
141
|
-
Thought: Confirmed — function was renamed to `auth.verifyToken()`. Tests use old name.
|
|
142
|
-
Let me check if this was an intentional API change or a mistake.
|
|
219
|
+
Observation: The module exports verifyToken; no validateToken export remains.
|
|
143
220
|
|
|
221
|
+
Thought: Confirmed — the function was renamed to `auth.verifyToken()` and the tests use
|
|
222
|
+
the old name. I need to know whether this was an intentional API change or an oversight,
|
|
223
|
+
which depends on whether other callers were updated.
|
|
144
224
|
Action: search_code — "validateToken"
|
|
145
|
-
Observation:
|
|
146
|
-
|
|
147
|
-
Thought: validateToken is used in 3 other places too. This is a breaking rename.
|
|
148
|
-
The tests are correct — the implementation changed names without updating callers.
|
|
149
|
-
I'll restore the original name in the implementation and add an alias if needed.
|
|
150
|
-
|
|
151
|
-
[Apply fix]
|
|
225
|
+
Observation: Three call sites outside the test file, all still using the old name.
|
|
152
226
|
|
|
227
|
+
Thought: validateToken is used in 3 other places that were never updated. This is a
|
|
228
|
+
breaking rename, not an intentional API change — the tests are correct and the
|
|
229
|
+
implementation changed names without updating its callers. I will restore the original
|
|
230
|
+
name and add the new one as an alias, then verify.
|
|
153
231
|
Action: run_tests — auth.test.js
|
|
154
|
-
Observation:
|
|
232
|
+
Observation: 3 passed, 0 failed.
|
|
155
233
|
|
|
156
|
-
Final Answer: Root cause was function rename in auth.js that broke all callers.
|
|
157
|
-
Restored original function name and added `verifyToken` as an alias for forward
|
|
158
|
-
compatibility.
|
|
234
|
+
Final Answer: Root cause was a function rename in auth.js that broke all callers.
|
|
235
|
+
Restored the original function name and added `verifyToken` as an alias for forward
|
|
236
|
+
compatibility. Verified by run_tests: all 3 tests pass.
|
|
159
237
|
```
|
|
160
238
|
|
|
161
239
|
### Example 3: Data Investigation
|
|
@@ -163,46 +241,77 @@ compatibility.
|
|
|
163
241
|
**Before ReAct:**
|
|
164
242
|
"Why are sales down this month?"
|
|
165
243
|
|
|
166
|
-
**After ReAct:**
|
|
244
|
+
**After ReAct — the emitted prompt:**
|
|
167
245
|
```
|
|
246
|
+
You are an agent that reaches a goal by calling tools, not by answering in one pass from
|
|
247
|
+
what you already know. [...framing paragraph as in Template Structure...]
|
|
248
|
+
|
|
168
249
|
GOAL:
|
|
169
|
-
|
|
170
|
-
|
|
250
|
+
The end state you must reach before you stop:
|
|
251
|
+
Produce a ranked list of the factors driving the 23% month-over-month sales decline this
|
|
252
|
+
quarter, each supported by the data that establishes it.
|
|
171
253
|
|
|
172
254
|
AVAILABLE TOOLS:
|
|
173
|
-
|
|
174
|
-
-
|
|
175
|
-
|
|
255
|
+
Do not call any tool that is not named here:
|
|
256
|
+
- query_database: Takes a SQL query and runs it against the sales database, returning the
|
|
257
|
+
result rows.
|
|
258
|
+
- fetch_analytics: Takes a metric name and date range and returns that series from the
|
|
259
|
+
analytics dashboard.
|
|
260
|
+
- read_file: Takes a path and returns the contents of an exported report or CSV.
|
|
176
261
|
|
|
177
262
|
CONSTRAINTS:
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
-
|
|
263
|
+
Every action is bound by these rules — each is a requirement or a prohibition, not a
|
|
264
|
+
suggestion:
|
|
265
|
+
- Base every conclusion on data you actually retrieved.
|
|
266
|
+
- Consider at least 3 potential causes before concluding.
|
|
267
|
+
- Do not present a cause as established when the data only makes it plausible; say which
|
|
268
|
+
it is.
|
|
269
|
+
- If the available data is insufficient to conclude, state exactly what additional data
|
|
270
|
+
is needed rather than closing the gap with an assumption.
|
|
271
|
+
- Stop and deliver your Final Answer when you can rank the causes by supported effect
|
|
272
|
+
size, or when you have established which data you are missing.
|
|
181
273
|
|
|
182
274
|
APPROACH:
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
or concentrated.
|
|
275
|
+
[...cycle instructions and "Rules for the cycle" block, verbatim from the template...]
|
|
276
|
+
```
|
|
186
277
|
|
|
278
|
+
**The run that followed** — transcript, tools live; each Observation is what the tool returned:
|
|
279
|
+
```
|
|
280
|
+
Thought: A 23% decline is large enough to have a dominant cause. I should first
|
|
281
|
+
establish whether it is volume, order value, or both, and whether it is spread across
|
|
282
|
+
segments or concentrated in one.
|
|
187
283
|
Action: query_database — "SELECT COUNT(*), AVG(order_value), segment FROM orders
|
|
188
|
-
WHERE month
|
|
189
|
-
Observation:
|
|
190
|
-
|
|
191
|
-
Thought: Volume is down 18% but average order value is down only 5%. The decline
|
|
192
|
-
is concentrated in the Enterprise segment. Let me check acquisition vs. churn.
|
|
284
|
+
WHERE month IN (current, previous) GROUP BY segment, month"
|
|
285
|
+
Observation: Order count down 18% overall; average order value down 5%; the drop is
|
|
286
|
+
concentrated in the Enterprise segment, with SMB roughly flat.
|
|
193
287
|
|
|
288
|
+
Thought: So this is mostly a volume problem in one segment, not a pricing problem
|
|
289
|
+
across the book. Fewer Enterprise orders could be lost acquisition or lost accounts, and
|
|
290
|
+
those have different fixes, so I need to separate them.
|
|
194
291
|
Action: query_database — "SELECT new_customers, churned_customers, segment FROM
|
|
195
292
|
customer_events WHERE period = last_30_days"
|
|
196
|
-
Observation:
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
293
|
+
Observation: Enterprise churn roughly 3x the trailing average; new Enterprise customers
|
|
294
|
+
near normal.
|
|
295
|
+
|
|
296
|
+
Thought: Churn, not acquisition. Before ranking causes I need to know whether the weakness
|
|
297
|
+
is confined to existing Enterprise accounts or also shows at the top of the funnel, so I
|
|
298
|
+
will pull conversion over a window wide enough to place the churn spike inside it.
|
|
299
|
+
Action: fetch_analytics — "trial_to_paid_conversion, last 90 days"
|
|
300
|
+
Observation: Conversion down 12% over the window, with the decline beginning in the same
|
|
301
|
+
week as the churn spike.
|
|
302
|
+
|
|
303
|
+
Final Answer: Ranked by supported effect size.
|
|
304
|
+
1. Enterprise churn — established. Churn ran roughly 3x the trailing average while new
|
|
305
|
+
Enterprise customers stayed near normal, and the order-count drop is concentrated in
|
|
306
|
+
that same segment. This is the bulk of the 18% volume decline.
|
|
307
|
+
2. Trial-to-paid conversion — established. Down 12% across the 90-day window.
|
|
308
|
+
3. Average order value — established but minor. Down 5% overall; too small to account for
|
|
309
|
+
a 23% total decline on its own. I did not break this figure out by segment.
|
|
310
|
+
|
|
311
|
+
The churn spike and the conversion decline begin in the same week. That timing makes a
|
|
312
|
+
single underlying cause plausible, not established: nothing I retrieved identifies what
|
|
313
|
+
changed in that window. Confirming it requires the product and pricing change log for
|
|
314
|
+
those dates joined to the churned account list, which none of these three tools expose.
|
|
206
315
|
```
|
|
207
316
|
|
|
208
317
|
## Best Use Cases
|
|
@@ -259,10 +368,17 @@ reduced trial-to-paid conversion, down 12%.
|
|
|
259
368
|
```
|
|
260
369
|
|
|
261
370
|
### Tools Should Be Named and Described
|
|
371
|
+
|
|
372
|
+
A full sentence naming what the tool does *and what input it takes*. A verb fragment omits the
|
|
373
|
+
input, so the agent has to guess how to call it:
|
|
262
374
|
```
|
|
263
|
-
✅ - run_tests:
|
|
375
|
+
✅ - run_tests: Takes a test file path, executes that suite, and returns the pass/fail output
|
|
376
|
+
with error text.
|
|
377
|
+
❌ - run_tests: Execute the test suite and return pass/fail results with error output
|
|
264
378
|
❌ - testing tool
|
|
265
379
|
```
|
|
380
|
+
Draw the description only from what the user actually told you. A tool documented with an input
|
|
381
|
+
or a return value it does not have produces a plan that fails at the first call.
|
|
266
382
|
|
|
267
383
|
### Constraints Prevent Loops
|
|
268
384
|
```
|
|
@@ -271,9 +387,15 @@ reduced trial-to-paid conversion, down 12%.
|
|
|
271
387
|
```
|
|
272
388
|
|
|
273
389
|
### Include a Stop Condition
|
|
390
|
+
|
|
391
|
+
Write it as the template's mandatory line — the full imperative, not a label standing in for one:
|
|
274
392
|
```
|
|
275
|
-
✅ "Stop
|
|
393
|
+
✅ "Stop and deliver your Final Answer when run_tests reports the suite passing, or when you
|
|
394
|
+
have determined the fix requires information not available through these tools."
|
|
395
|
+
❌ "Stop when: fix confirmed or blocked"
|
|
276
396
|
```
|
|
397
|
+
The ❌ form leaves the label carrying the meaning. `Stop when:` is a heading; the agent needs a
|
|
398
|
+
sentence it can act on, naming the observable situation that ends the loop.
|
|
277
399
|
|
|
278
400
|
## Common Mistakes
|
|
279
401
|
|
|
@@ -292,13 +414,24 @@ reduced trial-to-paid conversion, down 12%.
|
|
|
292
414
|
4. **Using ReAct for Static Tasks**
|
|
293
415
|
- If no tools are needed, Chain of Thought is simpler and more effective
|
|
294
416
|
|
|
417
|
+
5. **Writing Observations Into the Prompt**
|
|
418
|
+
- The single most damaging mistake this framework invites, because the result looks like success
|
|
419
|
+
- An Observation is a returned value, not a slot — filling one in fabricates a run
|
|
420
|
+
- The output reads as an executed investigation: real-looking results, a confident Final Answer, nothing behind either
|
|
421
|
+
- Emit the `Observation:` label and its description; the value belongs to the run
|
|
422
|
+
|
|
423
|
+
6. **Emitting a Completed Cycle**
|
|
424
|
+
- The prompt ends with the cycle *instructions*, not a worked first turn
|
|
425
|
+
- A pre-filled Thought/Action pair also pre-commits the agent to a path before it has seen any real result, which is the opposite of what ReAct is for
|
|
426
|
+
|
|
295
427
|
## Quick Reference
|
|
296
428
|
|
|
297
429
|
| Component | Focus | Key Question |
|
|
298
430
|
|-----------|-------|--------------|
|
|
299
431
|
| Goal | End state | "What does success look like?" |
|
|
300
432
|
| Tools | Available actions | "What can the agent do?" |
|
|
433
|
+
| Constraints | Rules and stop condition | "What is forbidden, and when does it stop?" |
|
|
301
434
|
| Thought | Reasoning | "What should I do next and why?" |
|
|
302
435
|
| Action | Tool use | "What specific action to take?" |
|
|
303
|
-
| Observation |
|
|
436
|
+
| Observation | Returned result — **never authored by the prompt** | "What did the tool actually return?" |
|
|
304
437
|
| Final Answer | Deliverable | "Goal achieved — what's the answer?" |
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Overview
|
|
4
4
|
|
|
5
|
-
Reverse Role Prompting flips the traditional prompting dynamic: instead of you constructing a detailed prompt, you provide a minimal intent statement and the AI interviews you — asking targeted clarifying questions — until it has enough information to execute the task well. This is the framework for when you know what you want but struggle to articulate all the details needed for a good prompt.
|
|
5
|
+
Reverse Role Prompting flips the traditional prompting dynamic: instead of you constructing a detailed prompt, you provide a minimal intent statement and the AI interviews you — asking targeted clarifying questions — until it has enough information to execute the task well. This is the framework for when you know what you want but struggle to articulate all the details needed for a good prompt. A complete Reverse Role prompt emits as a short block of prose — an intent statement plus an instruction to run an interview — and carries no source-material block, because the interview is how it gathers everything it needs; SKILL.md exempts it from the material question for exactly that reason. The scaffolding is minimal, but the emission rule still holds: each line has to carry its own meaning in the sentence around it, since there is no header to lean on once the prompt is pasted.
|
|
6
6
|
|
|
7
7
|
**Research basis:** Widely circulated as "reverse prompting" in practitioner communities (2023–2024). Formalized academically as **FATA** (First Ask Then Answer), arXiv 2508.08308, August 2025 — showing ~40% improvement over standard prompting. Related to **Socratic Prompting** (Chang, arXiv 2303.08769, IEEE CCWC 2023).
|
|
8
8
|
|
|
@@ -17,10 +17,10 @@ Reverse Role Prompting flips the traditional prompting dynamic: instead of you c
|
|
|
17
17
|
## Components
|
|
18
18
|
|
|
19
19
|
### Intent Statement
|
|
20
|
-
**Purpose:** Your minimal starting point — what you want to achieve in 1-2 sentences. Intentionally brief; the AI will fill in the gaps through questions.
|
|
20
|
+
**Purpose:** Your minimal starting point — what you want to achieve in 1-2 sentences. Intentionally brief; the AI will fill in the gaps through questions. Because the prompt has no separate task block, the intent line is the only thing telling the AI what the interview is in service of, so write it as a complete "My goal: …" statement rather than a bare topic — it still has to read as the objective once any surrounding scaffolding is gone.
|
|
21
21
|
|
|
22
22
|
### Interview Trigger
|
|
23
|
-
**Purpose:** The instruction that activates the AI-led interview mode.
|
|
23
|
+
**Purpose:** The instruction that activates the AI-led interview mode. This is the load-bearing sentence of the whole prompt, and it must ship as a complete imperative ("Before you begin, interview me to…"), because nothing else — no header, no format cue — tells the model to run an interview instead of answering immediately. The sentence has to say so itself.
|
|
24
24
|
|
|
25
25
|
**Core triggers:**
|
|
26
26
|
- Minimal: *"Before responding, ask me all the questions you need to give me the best possible answer."*
|
|
@@ -28,16 +28,18 @@ Reverse Role Prompting flips the traditional prompting dynamic: instead of you c
|
|
|
28
28
|
- Expert mode: *"You are an expert in [X]. Before beginning, conduct a discovery interview to understand my specific situation. Ask one question at a time."*
|
|
29
29
|
|
|
30
30
|
### Domain Scope
|
|
31
|
-
**Purpose:** Optionally specify the domain of expertise the AI should bring to the interview. This shapes the quality and relevance of its questions.
|
|
31
|
+
**Purpose:** Optionally specify the domain of expertise the AI should bring to the interview. This shapes the quality and relevance of its questions. It ships as a complete opening sentence ("You are an expert [X] consultant"), which both sets the lens and, standing on its own line, needs no header to announce what it is.
|
|
32
32
|
|
|
33
33
|
### Interview Mode
|
|
34
|
-
**Purpose:** Single-batch (FATA: all questions at once) vs. conversational (one question at a time). FATA is faster; conversational is more natural.
|
|
34
|
+
**Purpose:** Single-batch (FATA: all questions at once) vs. conversational (one question at a time). FATA is faster; conversational is more natural. The choice ships inside the carrier sentence "Ask your questions [one at a time / all at once]," so the bracketed slot can stay a fragment while the sentence around it carries the instruction.
|
|
35
35
|
|
|
36
36
|
### Synthesis Instruction (optional)
|
|
37
|
-
**Purpose:** After the interview, instruct the AI to either (a) execute the task directly, or (b) first produce a written prompt you can reuse.
|
|
37
|
+
**Purpose:** After the interview, instruct the AI to either (a) execute the task directly, or (b) first produce a written prompt you can reuse. It ships as a complete closing sentence — the template's optional final line — and, like every other slot here, carries its own meaning in prose because there is no "SYNTHESIS:" header in the emitted prompt to carry it.
|
|
38
38
|
|
|
39
39
|
## Template Structure
|
|
40
40
|
|
|
41
|
+
Reverse Role has no framework section headers of the kind the emitter strips — the shipped template is already a short block of prose, and it carries no source-material block because the interview elicits everything it needs. What the emission contract still asks of it is that every slot carry its own meaning in the sentence around it: the intent line reads as an objective, the interview trigger reads as an instruction to run an interview, and the batch-versus-conversational choice rides inside a carrier sentence rather than a header. The one place a header appears — the two-stage version's `STAGE 1` / `STAGE 2` labels — is written so each stage's directive survives on its own if the label is removed.
|
|
42
|
+
|
|
41
43
|
### Minimal Version
|
|
42
44
|
```
|
|
43
45
|
[Your 1-2 sentence intent statement]
|
|
@@ -48,16 +50,17 @@ best possible answer. Then, once I've answered, [execute the task / generate the
|
|
|
48
50
|
|
|
49
51
|
### Structured Expert Version
|
|
50
52
|
```
|
|
51
|
-
You are an expert [
|
|
53
|
+
You are an expert [DOMAIN] consultant / specialist.
|
|
52
54
|
|
|
53
|
-
My goal: [1-2 sentence
|
|
55
|
+
My goal: [1-2 sentence description of what you want to achieve]
|
|
54
56
|
|
|
55
|
-
Before you begin, interview me to understand my specific context,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
Before you begin, interview me to understand my specific context, constraints,
|
|
58
|
+
goals, and any relevant background. Ask your questions [one at a time / all at once].
|
|
59
|
+
Only proceed with [the task / generating the full prompt] once you are confident
|
|
60
|
+
you have everything you need.
|
|
59
61
|
|
|
60
|
-
After the interview
|
|
62
|
+
[Optional: After the interview, synthesize my responses into a complete structured
|
|
63
|
+
prompt using the most appropriate framework, then confirm before executing.]
|
|
61
64
|
```
|
|
62
65
|
|
|
63
66
|
### Two-Stage Version (Interview → Prompt Generation)
|
|
@@ -76,16 +79,18 @@ Show me the prompt before executing it.
|
|
|
76
79
|
|
|
77
80
|
## Complete Examples
|
|
78
81
|
|
|
82
|
+
Every example below is shown in emitted form: the prompt is a short block of prose, and each line carries its own role — intent, interview trigger, mode — without relying on a header. Where an example also shows the AI's questions, read those as the model's response to the prompt, not as part of the deliverable you paste.
|
|
83
|
+
|
|
79
84
|
### Example 1: Minimal Trigger
|
|
80
85
|
|
|
81
|
-
**
|
|
86
|
+
**The emitted prompt:**
|
|
82
87
|
```
|
|
83
88
|
I want to create a training program for new customer success managers.
|
|
84
89
|
Before responding, ask me all the questions you need to give me the
|
|
85
90
|
best possible answer.
|
|
86
91
|
```
|
|
87
92
|
|
|
88
|
-
**AI
|
|
93
|
+
**What the AI produces in response (FATA style — its output, not part of the prompt):**
|
|
89
94
|
```
|
|
90
95
|
1. What is the typical background of your CSM hires? (e.g., sales background,
|
|
91
96
|
support, fresh graduates, industry-specific experience)
|
|
@@ -104,6 +109,7 @@ best possible answer.
|
|
|
104
109
|
|
|
105
110
|
### Example 2: Expert Domain Interview
|
|
106
111
|
|
|
112
|
+
**The emitted prompt:**
|
|
107
113
|
```
|
|
108
114
|
You are an expert in B2B SaaS pricing strategy.
|
|
109
115
|
|
|
@@ -117,6 +123,7 @@ Only advise once you have a full picture.
|
|
|
117
123
|
|
|
118
124
|
### Example 3: Two-Stage Prompt Builder
|
|
119
125
|
|
|
126
|
+
**The emitted prompt:**
|
|
120
127
|
```
|
|
121
128
|
STAGE 1 — INTERVIEW:
|
|
122
129
|
You are an expert prompt engineer and technical writer.
|