@minhduydev/mdpi 0.6.0 → 0.7.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/README.md CHANGED
@@ -54,4 +54,4 @@ npx mdpi init
54
54
 
55
55
  ## What's in the kit
56
56
 
57
- `agents/` (7) · `prompts/` (11) · `skills/` (67 + INDEX) · `templates/` (11) · `workflows/` (6) · `context/` (2) · `extensions/` (2 TS) · `settings.json` · `packages.json` · `AGENTS.md` · `README.md` · `QUALITY.md` · `.env.example` · `guard.example.json` · `subagents.json` · `artifacts/example/` (template examples).
57
+ `agents/` (7) · `prompts/` (12) · `skills/` (67 + INDEX) · `templates/` (11) · `workflows/` (6) · `context/` (2) · `extensions/` (2 TS) · `settings.json` · `packages.json` · `AGENTS.md` · `README.md` · `QUALITY.md` · `.env.example` · `guard.example.json` · `subagents.json` · `artifacts/example/` (template examples).
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ import { spawn, spawnSync } from "node:child_process";
10
10
  import { fileURLToPath } from "node:url";
11
11
  import { mkdir, readdir } from "node:fs/promises";
12
12
  //#region package.json
13
- var version = "0.6.0";
13
+ var version = "0.7.0";
14
14
  //#endregion
15
15
  //#region src/utils/manifest.ts
16
16
  /**
@@ -39,7 +39,7 @@ pi
39
39
  ├── VERSION # Kit version (0.2.0)
40
40
  ├── .env.example # Environment variables (none required)
41
41
  ├── guard.example.json # pi-guard ruleset example
42
- ├── settings.json # 4 extensions + 67 skills + 11 prompts
42
+ ├── settings.json # 4 extensions + 67 skills + 12 prompts
43
43
 
44
44
  ├── agents/ # 7 subagent personas
45
45
  │ ├── INDEX.md # Agent index + routing table
@@ -55,7 +55,7 @@ pi
55
55
  │ ├── workflows-runner.ts # DAG workflow executor
56
56
  │ └── templates-injector.ts # Auto-inject project templates
57
57
 
58
- ├── prompts/ # 11 slash commands (pi-native)
58
+ ├── prompts/ # 12 slash commands (pi-native)
59
59
  │ ├── INDEX.md # Command index + lifecycle diagram
60
60
  │ ├── init.md # Bootstrap project context
61
61
  │ ├── create.md # Create spec + task outline
@@ -114,11 +114,12 @@ pi
114
114
 
115
115
  ## Slash commands
116
116
 
117
- 11 pi-native slash commands (full detail + lifecycle in [`prompts/INDEX.md`](./prompts/INDEX.md)):
117
+ 12 pi-native slash commands (full detail + lifecycle in [`prompts/INDEX.md`](./prompts/INDEX.md)):
118
118
 
119
119
  | Command | Purpose |
120
120
  |---------|---------|
121
121
  | `/init` | Bootstrap project context (AGENTS.md + templates + user profile) |
122
+ | `/clarify` | Discuss + clarify + stress-test a vague idea into a hardened spec |
122
123
  | `/create` | Create spec (PRD) + workspace + task outline |
123
124
  | `/plan` | Detailed implementation plan + tasks.json |
124
125
  | `/ship` | Execute tasks, verify, review, close |
@@ -4,32 +4,34 @@ purpose: Index of slash commands with purpose, when-to-use, and lifecycle positi
4
4
 
5
5
  # Prompts Index
6
6
 
7
- 11 slash commands. Lifecycle is canonical; utilities attach at any phase.
7
+ 12 slash commands. Lifecycle is canonical; utilities attach at any phase.
8
8
 
9
9
  ## Canonical Lifecycle
10
10
 
11
11
  ```
12
- ┌──── /init ────┐
13
-
14
- /init → /create /plan? → /ship ⇄ /verify
15
- │ │
16
- ▼ │
17
- (tasks.json) │
18
- │ │
19
- └──── /close ←─────────────────┘
20
-
12
+ ┌──── /init ──────────────────────┐
13
+
14
+ /init → /clarify (vague) /plan? → /ship ⇄ /verify
15
+ \ │ │
16
+ → /create (clear) ┘ ▼ │
17
+ (tasks.json) │
18
+ ┌──── /close ←────────────────────────────┘
19
+
21
20
  Utilities (any phase): /research /audit /fix /gc
22
21
  Status: /status
23
22
  ```
24
23
 
25
- **Artifact chain:** `/init` templates · `/create``spec.md` · `/plan``plan.md` + `tasks.json` · `/ship` implementation + `progress.md` · `/verify` `verify.log` · `/close` → clears `.active`.
24
+ **Two Define-phase entries:** `/clarify` (vague/complex ask discussion pipeline: interview brainstorm/refine grilldoubt spec) · `/create` (clear ask fast path to spec + workspace + branch).
25
+
26
+ **Artifact chain:** `/init` → templates · `/clarify`|`/create` → `spec.md` · `/plan` → `plan.md` + `tasks.json` · `/ship` → implementation + `progress.md` · `/verify` → `verify.log` · `/close` → clears `.active`.
26
27
 
27
28
  ## Commands
28
29
 
29
30
  | Command | Purpose | When to use | Arg-hint | Lifecycle |
30
31
  |---------|---------|-------------|----------|-----------|
31
32
  | `/init` | Bootstrap project: AGENTS.md + planning context + user profile | Once per project (or after stack change) | `[--deep] [--context\|--user\|--all] [--dry-run]` | Setup |
32
- | `/create` | Create spec (PRD) + workspace + task outline | Starting a feature/fix with a description | `<desc> [--lite] [--dry-run]` | Define |
33
+ | `/clarify` | Discuss + clarify + stress-test a vague idea into a hardened spec | Vague/underspecified/high-stakes ask needing structured discussion | `[<topic>] [--grill] [--spec <path>] [--dry-run]` | Define (deep) |
34
+ | `/create` | Create spec (PRD) + workspace + task outline | Starting a feature/fix with a clear description | `<desc> [--lite] [--dry-run]` | Define (fast) |
33
35
  | `/plan` | Detailed implementation plan + tasks.json (optional, between create and ship) | Complex tasks needing TDD-step guidance | `[--level 0-3] [--dry-run]` | Plan |
34
36
  | `/ship` | Execute tasks, verify, review, close | Ready to implement the spec | `[--skip-review] [--dry-run]` | Build/Ship |
35
37
  | `/verify` | Check completeness/correctness/coherence against PRD | Before shipping, or anytime mid-implementation | `[path\|all] [--quick] [--full] [--fix] [--no-cache]` | Verify |
@@ -46,6 +48,9 @@ Status: /status
46
48
  |-----------|---------|
47
49
  | Fresh repo, first session | `/init --all` |
48
50
  | Existing repo, want codebase map | `/init --deep` then `/research` |
51
+ | "Build X" but I'm not sure what X really is | `/clarify "X"` → `/plan` |
52
+ | Vague idea needs discussion before spec | `/clarify` (interactive) |
53
+ | Stress-test an existing idea/ADR/PRD | `/clarify --grill` or `/clarify --spec path/to/adr.md` |
49
54
  | "Build X" with a clear description | `/create "X"` → `/ship` |
50
55
  | "Build X" but complex/multi-step | `/create "X"` → `/plan` → `/ship` |
51
56
  | "Fix this bug / failing test" | `/fix "..."` |
@@ -0,0 +1,238 @@
1
+ ---
2
+ description: Discuss, clarify, and stress-test a vague idea into a hardened spec
3
+ argument-hint: "[<topic>] [--grill] [--spec <path>] [--dry-run] [--help]"
4
+ ---
5
+
6
+ # Clarify: $ARGUMENTS
7
+
8
+ Orchestrate the full Define-phase discussion pipeline — extract intent, explore options, adversarially stress-test, and write a hardened spec. One command, five sequenced skills, one artifact.
9
+
10
+ > **Workflow:** `/init` → **`/clarify`** (vague/complex ask) **or** `/create` (clear ask) → `/plan` → `/ship`
11
+ >
12
+ > **When to use:** The ask is vague, underspecified, high-stakes, or you need to discuss and clarify many things before a spec exists. Skip for clear/mechanical asks — use `/create` instead.
13
+
14
+ ## Parse Arguments
15
+
16
+ | Argument | Default | Description |
17
+ | ------------- | -------- | ------------------------------------------------------------ |
18
+ | `<topic>` | optional | What to discuss/clarify (quoted string) |
19
+ | `--grill` | false | Skip exploration; enter adversarial phase on an existing idea |
20
+ | `--spec <path>` | false | Stress-test an existing spec/ADR/PRD document at `<path>` |
21
+ | `--dry-run` | false | Preview the discussion plan and entry routing without writing |
22
+ | `--help` | false | Show this usage |
23
+
24
+ If `<topic>` is omitted, open with: *"What would you like to clarify?"* and run Phase 2 from a blank slate.
25
+
26
+ ## Guard Phase
27
+
28
+ Before discussing:
29
+ - Check `.pi/artifacts/.active` — if an active slug exists with `spec.md`, ask: **continue/refine** the existing spec, or **start new**?
30
+ - Check `git status --porcelain` — if uncommitted changes, ask: stash, commit, or continue?
31
+ - `vcc_recall` for prior session decisions on this topic — avoid re-exploring rejected approaches
32
+ - `memory_search({ project: "<active slug or empty>" })` for durable prior decisions across sessions
33
+
34
+ ## Load Skills (Sequenced Orchestration)
35
+
36
+ This command **sequences** skills — each hands off to the next at an explicit gate. Do **not** load all at once; load a skill only when its phase opens.
37
+
38
+ | Skill | Phase | Trigger | Role |
39
+ | --------------------------- | ------ | ----------------------------------------- | ---------------------------------------------------------- |
40
+ | `interview-me` | 2 | Ask missing who/why/success/constraint | Extract real intent, one question at a time, w/ guesses |
41
+ | `brainstorming` | 3a | Intent clear, need options/trade-offs | Collaborative exploration, 2-3 approaches |
42
+ | `idea-refine` | 3b | Need structured divergent→convergent | One-pager: direction + assumptions + Not Doing list |
43
+ | `grill-me` | 4 | Refined direction exists | Adversarial interrogation — destroy weak options |
44
+ | `doubt-driven-development` | 5 | High-stakes / unfamiliar / irreversible | Optional fresh-context adversarial review |
45
+ | `spec-driven-development` | 6 | Idea hardened, blockers resolved | Write `spec.md` via locked SPECIFY gate |
46
+ | `source-driven-development` | 3-4 | Touching unfamiliar tech/API | Ground decisions in official docs/source |
47
+ | `dcp-hygiene` | Report | Compress closed exploration work-stream | Keep context bounded when `compress` is available |
48
+
49
+ ## Entry Routing
50
+
51
+ Detect where the user is starting and enter at the right phase. Do not force everyone through Phase 2.
52
+
53
+ | Signal in the ask | Entry phase |
54
+ | ------------------------------------------------- | ---------------------------- |
55
+ | "build me X" with no who / why / success / constraint | **Phase 2** (interview-me) |
56
+ | Rough idea, but missing options and trade-offs | **Phase 3** (brainstorming) |
57
+ | Existing idea/ADR/PRD to stress-test | **Phase 4** (grill-me) |
58
+ | `--grill` flag | **Phase 4** directly |
59
+ | `--spec <path>` flag | **Phase 4** grill-with-docs on that file |
60
+ | Clear, bounded ask | **Exit**: tell user to run `/create` instead |
61
+
62
+ If routing is ambiguous, ask the user one question: *"Do you want to explore what to build, or stress-test an idea you already have?"*
63
+
64
+ ## Phase 1: Entry Assessment
65
+
66
+ 1. Read the topic + any referenced docs + relevant repo context (`semantic_query` for related patterns, `vcc_recall` for prior decisions).
67
+ 2. Write a one-line **HYPOTHESIS** with a confidence number (per `interview-me` Step 1), even if entering at Phase 3+. This surfaces your starting assumption visibly.
68
+ 3. Determine entry phase from the table above. Announce: *"Entering at Phase N because [signal]."*
69
+ 4. If `--dry-run`: report the entry phase + planned skill sequence + estimated turns, then stop.
70
+
71
+ ## Phase 2: Intent Extraction (`interview-me`)
72
+
73
+ Load `interview-me`. Run its 5-step process:
74
+
75
+ 1. **HYPOTHESIS + CONFIDENCE** (already drafted in Phase 1; refine if needed)
76
+ 2. **Ask one question at a time, each with a GUESS attached** — never batch
77
+ 3. **Listen for want-vs-should-want** — probe sophistication-signaling answers ("scalable", "modern", "clean") with: *"If you didn't have to justify this to anyone, what would you actually want?"*
78
+ 4. **Restate intent** in the user's words: Outcome / User / Why now / Success / Constraint / **Out of scope**
79
+ 5. **Confirm with an explicit yes** — "whatever you think" / "sounds good" / silence are NOT yes
80
+
81
+ **Stop when** you can predict the user's reaction to the next three questions (the 95% confidence test). Then hand off to Phase 3.
82
+
83
+ **Blocker rule:** if the user cannot answer a foundational question, flag it as a blocker — do not proceed to spec.
84
+
85
+ ## Phase 3: Exploration & Refinement (`brainstorming` → `idea-refine`)
86
+
87
+ ### 3a: Collaborative Exploration (`brainstorming`)
88
+
89
+ Load `brainstorming`. One question at a time (multiple choice preferred). Generate **2-3 distinct approaches** with explicit trade-offs. Lead with your recommendation + reasoning. YAGNI ruthlessly.
90
+
91
+ If running inside a codebase, ground options in real patterns — cite `file:line` for existing architecture that constrains the design.
92
+
93
+ ### 3b: Structured Converge (`idea-refine`)
94
+
95
+ If the idea needs a structured artifact (most non-trivial cases), load `idea-refine` and run its 3 phases:
96
+
97
+ - **Divergent:** restate as a "How Might We", 5-8 idea variations via lenses (inversion, constraint removal, audience shift, simplification, 10x, expert lens)
98
+ - **Converge:** cluster into 2-3 directions, stress-test on user value / feasibility / differentiation, **surface hidden assumptions** (what you're betting is true, what could kill it, what you're ignoring)
99
+ - **Sharpen:** produce a one-pager: Problem Statement · Recommended Direction · Key Assumptions · MVP Scope · **Not Doing** (the most valuable part)
100
+
101
+ Be honest, not supportive. A good ideation partner is not a yes-machine — push back on weak ideas with specificity.
102
+
103
+ **Gate:** user confirms the chosen direction before Phase 4.
104
+
105
+ ## Phase 4: Adversarial Stress-Test (`grill-me`)
106
+
107
+ Load `grill-me`. This is adversarial, not collaborative. Do not be polite. Interrogate the refined direction across all five categories:
108
+
109
+ | Category | Push on |
110
+ | ---------------------- | ------------------------------------------------------------ |
111
+ | **Ambiguity** | Terms that could mean different things; concrete behavior examples |
112
+ | **Hidden assumptions** | What this assumes about the system, users, data, failure modes, team capacity |
113
+ | **Missing constraints** | Implicit perf/security/compat/observability constraints; codebase patterns that bind |
114
+ | **Hand-waving** | "We'll figure that out later"; "obviously" / "simply" / "just" statements; the hardest part |
115
+ | **Integration & blast radius** | Existing code touched; what breaks on deploy; tests/docs that change |
116
+
117
+ For each question: present with a concrete example → let the user answer → record the resolution. Unanswerable questions become **blockers**, not "we'll fix it later."
118
+
119
+ **If `--spec <path>`:** apply the same interrogation to the document content and propose concrete edits for each gap.
120
+
121
+ **Stop when** questions start repeating or precision stops changing the plan. Then assess:
122
+ - Ready to proceed? → Phase 5 (optional) then Phase 6
123
+ - Fundamentally flawed? → say so directly, suggest alternatives, stop
124
+ - Too many unresolved? → recommend another Phase 3 round or `/research`, stop
125
+
126
+ ## Phase 5: Fresh-Context Doubt (`doubt-driven-development`, optional)
127
+
128
+ **Triggered only when** the decision is non-trivial per `doubt-driven-development`'s definition: crosses module boundaries, asserts unverifiable properties, or has irreversible blast radius. Skip for ordinary decisions — doubting every keystroke ships nothing.
129
+
130
+ 1. **CLAIM** — name the decision in 2-3 lines + why it matters
131
+ 2. **EXTRACT** — smallest reviewable unit (artifact + contract, stripped of your reasoning)
132
+ 3. **DOUBT** — spawn `review` subagent with an **adversarial** prompt ("find issues", not "is it good"). Pass ARTIFACT + CONTRACT only, **never the CLAIM**
133
+ 4. **RECONCILE** — classify each finding: contract misread → valid+actionable → valid trade-off → noise. Re-read the artifact before classifying; don't rubber-stamp
134
+ 5. **STOP** — trivial findings, 3 cycles, or user override
135
+
136
+ **Cross-model:** in interactive mode, always **offer** a second opinion (Gemini CLI / Codex CLI / manual / skip). Never silently skip. Each external CLI invocation needs explicit user authorization.
137
+
138
+ > **Note:** do not run `doubt-driven-development` from inside a subagent (no nested doubt). The main session orchestrates.
139
+
140
+ ## Phase 6: Write Spec (`spec-driven-development`)
141
+
142
+ Load `spec-driven-development`. Run its **SPECIFY** gate using everything hardened in Phases 2-5:
143
+
144
+ 1. State the goal as an **outcome**, not a task
145
+ 2. **Establish vocabulary** — every concept has one name, mapped to exactly one code symbol (ubiquitous language)
146
+ 3. Derive **3-7 observable truths** from the user's perspective
147
+ 4. Identify **constraints**: technical, UX, security, performance, compatibility
148
+ 5. Define **non-goals** explicitly (pull from `idea-refine`'s "Not Doing" list)
149
+ 6. List **affected surfaces**: files, APIs, commands, UI, data models
150
+ 7. **Check vocabulary consistency** — no overloaded terms, no synonyms
151
+ 8. Reframe instructions as **success criteria** ("X is true when…", with a `Verify:` command)
152
+ 9. Define the **three-tier boundaries**: always do / ask first / never do
153
+
154
+ **Gate:** spec approved by the user, or assumptions explicitly accepted.
155
+
156
+ Choose PRD rigor from the same signals `/create` uses:
157
+
158
+ | Signal | Lite PRD | Full PRD |
159
+ | ------------------------------- | -------- | -------- |
160
+ | Scope | Single-concern | Cross-cutting |
161
+ | Files affected | 1-3 | 4+ |
162
+ | Logic complexity | Low | High (multi-step, stateful) |
163
+ | Discussion depth (this session) | Phase 2-3 only | Phase 4-5 ran |
164
+
165
+ Use `.pi/templates/prd.md` for Full; the Lite format from `/create` for simple cases.
166
+
167
+ **Validate before saving** (per `/create` Phase 5):
168
+ - No placeholder text remaining
169
+ - Success criteria include `Verify:` commands
170
+ - Technical context references real `src/` paths
171
+ - No implementation code in the spec
172
+ - No unresolved `[NEEDS CLARIFICATION]` markers — if any, return to Phase 2 or 4
173
+
174
+ ## Phase 7: Workspace & Report
175
+
176
+ ### Workspace (minimal)
177
+
178
+ `/clarify` does **not** create a branch or install deps — that's `/create`'s territory. It only sets up what downstream commands need:
179
+
180
+ ```bash
181
+ SLUG=$(echo "$TITLE" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9 ]//g' | tr ' ' '-' | sed 's/--*/-/g; s/^-//; s/-$//')
182
+ mkdir -p ".pi/artifacts/$SLUG"
183
+ echo "$SLUG" > ".pi/artifacts/.active"
184
+ ```
185
+
186
+ Write the spec to `.pi/artifacts/$SLUG/spec.md`. Optionally save the `idea-refine` one-pager to `.pi/artifacts/$SLUG/design.md` if the user wants the discussion trail preserved.
187
+
188
+ > **DCP hygiene:** if `compress` is available, compress the closed Phase 2-5 exploration work-stream per the `dcp-hygiene` skill — the hardened decisions are captured in `spec.md`. Skip if unavailable.
189
+
190
+ ### Report
191
+
192
+ 1. **Entry phase** + rationale (where the discussion started)
193
+ 2. **Skills run** — which phases executed, which were skipped
194
+ 3. **Key decisions** — direction chosen, assumptions hardened, ideas killed
195
+ 4. **Blockers** — unresolved questions, if any (with flags)
196
+ 5. **Spec:** Lite or Full, success criteria count, affected files count
197
+ 6. **Doubt cycle** — ran/skipped, findings classification summary (if ran)
198
+ 7. **Artifact location:** `.pi/artifacts/$SLUG/spec.md`
199
+ 8. **Next step:** `/plan` (complex → produces `plan.md` + `tasks.json`) or `/ship` (simple Lite → derives `tasks.json` on the fly). If the user wants full workspace setup (branch + deps), suggest `/create` with the now-hardened topic.
200
+
201
+ ## Stop Conditions
202
+
203
+ - User confirms spec at the SPECIFY gate → write spec, report, stop
204
+ - `interview-me` blocker unresolved → stop, flag blocker, do not write spec
205
+ - `grill-me` assesses idea as fundamentally flawed → say so, stop, do not write spec
206
+ - Verification/validation fails 2x on same approach → stop, escalate
207
+ - `--dry-run` → report plan, stop before any writing
208
+
209
+ ## Failure Handling
210
+
211
+ | Scenario | Action |
212
+ | ------------------------------------- | ------------------------------------------------------------------- |
213
+ | Active spec already exists | Ask: continue/refine existing, or start new? |
214
+ | `interview-me` can't reach 95% conf. | Stop after several rounds, tell user something foundational is missing |
215
+ | `grill-me` produces a kill verdict | Report why, suggest alternatives, do not write spec |
216
+ | `doubt-driven-development` 3 unresolved cycles | Surface to user — artifact may not be ready |
217
+ | Spec validation fails | Fix inline, re-validate, max 2 retries; then return to Phase 2/4 |
218
+ | External CLI missing/errors (Phase 5) | Surface failure, let user redirect; never silently fall back |
219
+
220
+ ## Related Commands
221
+
222
+ | Need | Command |
223
+ | ------------------------------------- | ----------- |
224
+ | Fast path for a clear ask (+ branch) | `/create` |
225
+ | Detail tasks from the spec | `/plan` |
226
+ | Execute the spec | `/ship` |
227
+ | Need external info mid-discussion | `/research` |
228
+
229
+ ## Related Skills
230
+
231
+ - `interview-me` — Phase 2 intent extraction (one question + guess at a time)
232
+ - `brainstorming` — Phase 3a collaborative exploration (2-3 approaches)
233
+ - `idea-refine` — Phase 3b structured divergent/convergent (one-pager + Not Doing)
234
+ - `grill-me` — Phase 4 adversarial interrogation (destroy weak options)
235
+ - `doubt-driven-development` — Phase 5 fresh-context review (high-stakes only)
236
+ - `spec-driven-development` — Phase 6 spec writing (SPECIFY gate + vocabulary)
237
+ - `source-driven-development` — ground decisions in official docs (Phases 3-4)
238
+ - `dcp-hygiene` — compress closed exploration work-stream at report
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minhduydev/mdpi",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "CLI to scaffold and manage a Pi coding-agent kit (.pi/) in any repo",
5
5
  "keywords": [
6
6
  "pi",