pi-ask-user 0.2.0 → 0.2.1
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/README.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
A Pi package that adds an interactive `ask_user` tool for collecting user decisions during an agent run.
|
|
4
4
|
|
|
5
|
+
## Demo
|
|
6
|
+
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
High-quality video: [ask-user-demo.mp4](./media/ask-user-demo.mp4)
|
|
10
|
+
|
|
5
11
|
## Features
|
|
6
12
|
|
|
7
13
|
- Single-select option lists
|
|
@@ -28,12 +34,6 @@ The skill follows a "decision handshake" flow:
|
|
|
28
34
|
|
|
29
35
|
See: `skills/ask-user/references/ask-user-skill-extension-spec.md`.
|
|
30
36
|
|
|
31
|
-
## Demo
|
|
32
|
-
|
|
33
|
-

|
|
34
|
-
|
|
35
|
-
High-quality video: [ask-user-demo.mp4](./media/ask-user-demo.mp4)
|
|
36
|
-
|
|
37
37
|
## Install
|
|
38
38
|
|
|
39
39
|
```bash
|
|
@@ -60,4 +60,3 @@ The registered tool name is:
|
|
|
60
60
|
"allowFreeform": true
|
|
61
61
|
}
|
|
62
62
|
```
|
|
63
|
-
|
package/package.json
CHANGED
|
@@ -2,72 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
## Purpose
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This document defines a minimal decision-gating protocol for using the `ask-user` skill with the `ask_user` tool.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- explicit user control at decision boundaries
|
|
9
|
-
- low-friction interactive UX
|
|
10
|
-
- minimal context bloat (progressive disclosure)
|
|
11
|
-
- deterministic behavior across high-stakes workflows
|
|
7
|
+
Goal: require explicit user decisions at high-impact or ambiguous boundaries before implementation continues.
|
|
12
8
|
|
|
13
9
|
---
|
|
14
10
|
|
|
15
|
-
## 1)
|
|
16
|
-
|
|
17
|
-
This design intentionally follows three emerging patterns used by modern agent systems.
|
|
18
|
-
|
|
19
|
-
### A. Progressive Disclosure
|
|
20
|
-
|
|
21
|
-
The skill uses layered loading:
|
|
22
|
-
|
|
23
|
-
1. **Metadata layer** (`name`, `description`) always in prompt.
|
|
24
|
-
2. **Core protocol layer** (`SKILL.md`) loaded only when relevant.
|
|
25
|
-
3. **Detailed reference layer** (`references/*.md`) loaded only when needed.
|
|
26
|
-
|
|
27
|
-
Implication: keep `SKILL.md` concise and decision-focused; move large examples and policy details into references.
|
|
28
|
-
|
|
29
|
-
### B. Agent Protocol Handshakes
|
|
30
|
-
|
|
31
|
-
High-impact actions require a handshake:
|
|
32
|
-
|
|
33
|
-
`detect boundary -> summarize evidence -> ask -> explicit user choice -> commit -> execute`
|
|
34
|
-
|
|
35
|
-
The handshake prevents implicit assumptions from silently becoming implementation decisions.
|
|
36
|
-
|
|
37
|
-
### C. Context-Aware Loading
|
|
38
|
-
|
|
39
|
-
Questions must be formed from current evidence (repo state, docs, logs, external research), not from generic prompts.
|
|
40
|
-
|
|
41
|
-
The `context` field in `ask_user` is the transport for this condensed evidence.
|
|
42
|
-
|
|
43
|
-
---
|
|
44
|
-
|
|
45
|
-
## 2) System Model
|
|
46
|
-
|
|
47
|
-
### Components
|
|
48
|
-
|
|
49
|
-
1. **Skill layer (`skills/ask-user/SKILL.md`)**
|
|
50
|
-
- decides *when* user interaction is mandatory
|
|
51
|
-
- enforces handshake behavior
|
|
52
|
-
|
|
53
|
-
2. **Extension layer (`index.ts`, tool `ask_user`)**
|
|
54
|
-
- renders question UX (single-select, multi-select, freeform)
|
|
55
|
-
- returns normalized answer text to the agent
|
|
56
|
-
|
|
57
|
-
3. **Model runtime**
|
|
58
|
-
- interprets skill guidance
|
|
59
|
-
- calls `ask_user` with structured payload
|
|
60
|
-
- resumes execution after explicit user response
|
|
61
|
-
|
|
62
|
-
### Contract boundary
|
|
63
|
-
|
|
64
|
-
- Skill controls policy and decision gating.
|
|
65
|
-
- Extension controls interaction mechanics.
|
|
66
|
-
- Model must not bypass skill policy for high-stakes/ambiguous decisions.
|
|
67
|
-
|
|
68
|
-
---
|
|
69
|
-
|
|
70
|
-
## 3) Trigger Matrix (When to Call `ask_user`)
|
|
11
|
+
## 1) Trigger Matrix (When to Call `ask_user`)
|
|
71
12
|
|
|
72
13
|
| Scenario | Must Ask? | Why |
|
|
73
14
|
|---|---:|---|
|
|
@@ -82,122 +23,35 @@ The `context` field in `ask_user` is the transport for this condensed evidence.
|
|
|
82
23
|
|
|
83
24
|
---
|
|
84
25
|
|
|
85
|
-
##
|
|
86
|
-
|
|
87
|
-
```text
|
|
88
|
-
DISCOVER -> CLASSIFY -> (CLEAR -> EXECUTE)
|
|
89
|
-
-> (AMBIGUOUS/HIGH_STAKES -> EVIDENCE -> ASK -> WAIT -> COMMIT -> EXECUTE)
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
### State definitions
|
|
26
|
+
## 2) Decision Handshake
|
|
93
27
|
|
|
94
|
-
|
|
95
|
-
- **CLASSIFY**: decide whether decision gate is required.
|
|
96
|
-
- **EVIDENCE**: gather and compress decision context.
|
|
97
|
-
- **ASK**: invoke `ask_user` with a single focused decision.
|
|
98
|
-
- **WAIT**: pause implementation until response arrives.
|
|
99
|
-
- **COMMIT**: restate chosen option and intended next action.
|
|
100
|
-
- **EXECUTE**: implement according to confirmed decision.
|
|
28
|
+
Use this protocol whenever the trigger matrix says to ask.
|
|
101
29
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
-
|
|
106
|
-
|
|
107
|
-
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
-
|
|
112
|
-
|
|
113
|
-
---
|
|
114
|
-
|
|
115
|
-
## 5) `ask_user` Payload Design Standard
|
|
116
|
-
|
|
117
|
-
### Field mapping
|
|
118
|
-
|
|
119
|
-
| Field | Required | Rule |
|
|
120
|
-
|---|---:|---|
|
|
121
|
-
| `question` | Yes | One decision only, concrete and action-bound |
|
|
122
|
-
| `context` | Recommended | 3-7 bullets or short paragraph with evidence and trade-offs |
|
|
123
|
-
| `options` | Optional | Prefer 2-5 choices when stable alternatives exist |
|
|
124
|
-
| `allowMultiple` | Optional | `true` only for independent selections |
|
|
125
|
-
| `allowFreeform` | Optional | Usually `true`; set `false` only when strict menu required |
|
|
30
|
+
1. **Detect boundary**
|
|
31
|
+
- classify as `high_stakes`, `ambiguous`, `both`, or `clear`
|
|
32
|
+
2. **Gather evidence**
|
|
33
|
+
- read code/docs/logs first; do not ask blindly
|
|
34
|
+
3. **Summarize context**
|
|
35
|
+
- prepare concise trade-off context (3–7 bullets or short paragraph)
|
|
36
|
+
4. **Ask one focused question**
|
|
37
|
+
- call `ask_user` for one decision at a time
|
|
38
|
+
5. **Commit and proceed**
|
|
39
|
+
- restate chosen option and implement accordingly
|
|
126
40
|
|
|
127
|
-
###
|
|
41
|
+
### Retry/cancel policy
|
|
128
42
|
|
|
129
|
-
-
|
|
130
|
-
-
|
|
131
|
-
-
|
|
132
|
-
-
|
|
43
|
+
- Max **2** `ask_user` attempts for the same decision boundary.
|
|
44
|
+
- Attempt 1: normal structured question.
|
|
45
|
+
- Attempt 2: narrower question with recommendation and explicit options.
|
|
46
|
+
- After attempt 2:
|
|
47
|
+
- `high_stakes` / `both`: stop and report blocked.
|
|
48
|
+
- `ambiguous` only: proceed only if user delegates (e.g., “your call”), using the most reversible default.
|
|
133
49
|
|
|
134
50
|
---
|
|
135
51
|
|
|
136
|
-
##
|
|
52
|
+
## 3) Example Payloads
|
|
137
53
|
|
|
138
|
-
###
|
|
139
|
-
|
|
140
|
-
1. Agent summarizes known constraints.
|
|
141
|
-
2. Agent asks one clear question.
|
|
142
|
-
3. User selects an option quickly (or writes freeform).
|
|
143
|
-
4. Agent confirms and proceeds.
|
|
144
|
-
|
|
145
|
-
### Avoid
|
|
146
|
-
|
|
147
|
-
- long speculative context dumps
|
|
148
|
-
- “What do you want?” without options
|
|
149
|
-
- repeated confirmation of unchanged decisions
|
|
150
|
-
- more than two attempts for the same decision boundary
|
|
151
|
-
- hidden assumptions after user response
|
|
152
|
-
|
|
153
|
-
### Recommended defaults
|
|
154
|
-
|
|
155
|
-
- `allowFreeform: true`
|
|
156
|
-
- `allowMultiple: false`
|
|
157
|
-
- `options`: include concise titles + descriptions for trade-offs
|
|
158
|
-
|
|
159
|
-
---
|
|
160
|
-
|
|
161
|
-
## 7) Runtime and Fallback Semantics
|
|
162
|
-
|
|
163
|
-
The extension already provides these behavior guarantees:
|
|
164
|
-
|
|
165
|
-
1. **Interactive mode with UI**
|
|
166
|
-
- single-select list, multi-select list, or freeform editor
|
|
167
|
-
|
|
168
|
-
2. **No options provided**
|
|
169
|
-
- freeform input prompt is used
|
|
170
|
-
|
|
171
|
-
3. **No interactive UI available**
|
|
172
|
-
- tool returns an error-style textual fallback that includes question/context/options
|
|
173
|
-
|
|
174
|
-
Design implication:
|
|
175
|
-
- skill should prefer structured options when ambiguity is high
|
|
176
|
-
- but always permit freeform for unanticipated requirements
|
|
177
|
-
|
|
178
|
-
---
|
|
179
|
-
|
|
180
|
-
## 8) Quality Rubric
|
|
181
|
-
|
|
182
|
-
A decision-gated interaction is successful when all are true:
|
|
183
|
-
|
|
184
|
-
- [ ] High-stakes or ambiguous boundary was detected
|
|
185
|
-
- [ ] Context was gathered before asking
|
|
186
|
-
- [ ] At most two decision questions were asked for the same boundary (normally one)
|
|
187
|
-
- [ ] User response was explicit
|
|
188
|
-
- [ ] Agent restated decision before execution
|
|
189
|
-
- [ ] Implementation followed the selected path
|
|
190
|
-
|
|
191
|
-
Failure signals:
|
|
192
|
-
- agent made architectural choice without user decision
|
|
193
|
-
- question lacked trade-off context
|
|
194
|
-
- user answer ignored or overwritten
|
|
195
|
-
|
|
196
|
-
---
|
|
197
|
-
|
|
198
|
-
## 9) Example Protocol Templates
|
|
199
|
-
|
|
200
|
-
### Template: architecture fork
|
|
54
|
+
### Architecture decision
|
|
201
55
|
|
|
202
56
|
```json
|
|
203
57
|
{
|
|
@@ -212,7 +66,7 @@ Failure signals:
|
|
|
212
66
|
}
|
|
213
67
|
```
|
|
214
68
|
|
|
215
|
-
###
|
|
69
|
+
### Requirement-priority decision
|
|
216
70
|
|
|
217
71
|
```json
|
|
218
72
|
{
|
|
@@ -227,24 +81,3 @@ Failure signals:
|
|
|
227
81
|
"allowFreeform": true
|
|
228
82
|
}
|
|
229
83
|
```
|
|
230
|
-
|
|
231
|
-
---
|
|
232
|
-
|
|
233
|
-
## 10) Packaging + Distribution Notes
|
|
234
|
-
|
|
235
|
-
To ship this skill with the extension package:
|
|
236
|
-
|
|
237
|
-
- include `skills/` in npm package files
|
|
238
|
-
- register skills in `package.json` under `pi.skills`
|
|
239
|
-
|
|
240
|
-
This ensures the skill is discoverable at startup and available for implicit invocation.
|
|
241
|
-
|
|
242
|
-
---
|
|
243
|
-
|
|
244
|
-
## 11) Future Enhancements (Optional)
|
|
245
|
-
|
|
246
|
-
- **Decision memory log**: append chosen options to a lightweight session decision ledger.
|
|
247
|
-
- **Adaptive option generation**: tailor options by repo language/framework context.
|
|
248
|
-
- **Confidence thresholding**: auto-trigger ask gate when model confidence in requirements is low.
|
|
249
|
-
|
|
250
|
-
These are optional and not required for initial rollout.
|