@minhduydev/mdpi 0.5.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 +1 -1
- package/dist/index.js +4 -2
- package/dist/template/.pi/AGENTS.md +1 -1
- package/dist/template/.pi/README.md +6 -6
- package/dist/template/.pi/agents/explore.md +1 -1
- package/dist/template/.pi/agents/scout.md +1 -1
- package/dist/template/.pi/prompts/INDEX.md +17 -12
- package/dist/template/.pi/prompts/clarify.md +238 -0
- package/dist/template/.pi/prompts/gc.md +2 -1
- package/dist/template/.pi/prompts/verify.md +24 -0
- package/dist/template/.pi/skills/INDEX.md +1 -0
- package/package.json +1 -1
- package/dist/template/.pi/context/fallow.md +0 -137
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/` (
|
|
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.
|
|
13
|
+
var version = "0.7.0";
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region src/utils/manifest.ts
|
|
16
16
|
/**
|
|
@@ -950,12 +950,14 @@ async function initCommand(options = {}) {
|
|
|
950
950
|
if (only) adaptSettingsJson(piDir, only);
|
|
951
951
|
const manifest = generateManifest(piDir, version);
|
|
952
952
|
const fileCount = Object.keys(manifest.files).length;
|
|
953
|
+
const hasSkills = !only || only.has("skills");
|
|
953
954
|
if (quiet) {
|
|
954
955
|
const subset = only ? ` subset=[${[...only].join(",")}]` : "";
|
|
955
956
|
console.log(`mdpi: installed ${fileCount} files to ${piDir} (v${version})${subset}`);
|
|
956
957
|
} else {
|
|
957
958
|
const subsetNote = only ? `Subset: ${[...only].join(", ")} (+ always-on config).\n\nsettings.json trimmed to drop references to excluded\nskills/prompts/extensions dirs.\n\nNote: mdpi upgrade compares against the FULL template —\nrun \`mdpi upgrade --check\` before applying.\n\n` : "";
|
|
958
|
-
|
|
959
|
+
const fallowHint = hasSkills ? "Fallow skill included (codebase intelligence: dead code,\nduplication, complexity). For JS/TS projects, run `/init`\nin a pi session to generate `.fallowrc.json`; other stacks skip it.\n\n" : "";
|
|
960
|
+
p.note(`Pi kit installed at:\n${piDir}\n\n${fileCount} template files tracked via manifest.\n\n` + subsetNote + fallowHint + `Next: run ${color.cyan("mdpi install")} to install the kit's npm packages,\nthen open pi in this repo to use the kit.`, "Installation complete");
|
|
959
961
|
p.outro(color.green("Ready!"));
|
|
960
962
|
}
|
|
961
963
|
}
|
|
@@ -21,7 +21,7 @@ For project-wide rules (kernel, drift signals, hard constraints, output style),
|
|
|
21
21
|
| `prompts/` | slash commands | Dispatched by primary agent |
|
|
22
22
|
| `workflows/` | DAG workflows | Executed via subagent tool |
|
|
23
23
|
| `templates/` | project context templates | Referenced via auto-inject |
|
|
24
|
-
| `context/` | reference docs (architecture
|
|
24
|
+
| `context/` | reference docs (architecture) | Manual reference only, never auto-injected |
|
|
25
25
|
| `extensions/` | TypeScript extensions | Compiled JS code, gated by pi extension SDK |
|
|
26
26
|
|
|
27
27
|
---
|
|
@@ -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 +
|
|
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/ #
|
|
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
|
|
@@ -95,9 +95,8 @@ pi
|
|
|
95
95
|
├── scripts/ # 1 utility script
|
|
96
96
|
│ └── gc-check.sh # Structural invariants for /gc
|
|
97
97
|
│
|
|
98
|
-
├── context/ #
|
|
99
|
-
│
|
|
100
|
-
│ └── fallow.md # Fallow CLI reference
|
|
98
|
+
├── context/ # 1 reference doc
|
|
99
|
+
│ └── architecture.md # Pi 5-layer architecture
|
|
101
100
|
│
|
|
102
101
|
├── state/ # Runtime state (gitignored)
|
|
103
102
|
│ └── session-summary.{json,md}
|
|
@@ -115,11 +114,12 @@ pi
|
|
|
115
114
|
|
|
116
115
|
## Slash commands
|
|
117
116
|
|
|
118
|
-
|
|
117
|
+
12 pi-native slash commands (full detail + lifecycle in [`prompts/INDEX.md`](./prompts/INDEX.md)):
|
|
119
118
|
|
|
120
119
|
| Command | Purpose |
|
|
121
120
|
|---------|---------|
|
|
122
121
|
| `/init` | Bootstrap project context (AGENTS.md + templates + user profile) |
|
|
122
|
+
| `/clarify` | Discuss + clarify + stress-test a vague idea into a hardened spec |
|
|
123
123
|
| `/create` | Create spec (PRD) + workspace + task outline |
|
|
124
124
|
| `/plan` | Detailed implementation plan + tasks.json |
|
|
125
125
|
| `/ship` | Execute tasks, verify, review, close |
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: explore
|
|
3
3
|
description: "Fast read-only codebase cartographer — locate files, symbols, and usage patterns with file:line evidence"
|
|
4
4
|
tools: read, grep, find, ls, bash, semantic_query, semantic_inspect, semantic_grep, semantic_show
|
|
5
|
-
model:
|
|
5
|
+
model: opencode-go/deepseek-v4-flash
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
You are Pi — a read-only codebase explorer.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: scout
|
|
3
3
|
description: External research specialist for library docs, API references, and real-world code patterns
|
|
4
4
|
tools: read, bash, find, ls, websearch, codesearch, context7, grepsearch, web_fetch
|
|
5
|
-
model:
|
|
5
|
+
model: opencode-go/deepseek-v4-flash
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
You are Pi — an external research specialist.
|
|
@@ -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
|
-
|
|
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 → /
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
**
|
|
24
|
+
**Two Define-phase entries:** `/clarify` (vague/complex ask — discussion pipeline: interview → brainstorm/refine → grill → doubt → 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
|
-
| `/
|
|
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
|
|
@@ -41,8 +41,9 @@ This command delegates to the `garbage-collection` workflow via the `run_workflo
|
|
|
41
41
|
|
|
42
42
|
1. **Run Fallow scan:**
|
|
43
43
|
```bash
|
|
44
|
-
npx fallow --format json --quiet
|
|
44
|
+
npx fallow --format json --quiet || true
|
|
45
45
|
```
|
|
46
|
+
> Append `|| true`: exit 1 means "issues found" (normal for GC), not a runtime error. Only exit 2 (invalid config/parse) is a real failure — see `fallow` skill Agent Rule 2.
|
|
46
47
|
2. Extract findings: dead code, duplication, complexity hotspots, unused exports
|
|
47
48
|
|
|
48
49
|
### Phase 2: Quality Grade Update
|
|
@@ -41,6 +41,7 @@ Check implementation against PRD before shipping.
|
|
|
41
41
|
| `verification-before-completion` | Always | Evidence-before-claims; phantom detection; verification cache protocol; Worker Distrust Protocol |
|
|
42
42
|
| `code-review-and-quality` | Phase 4 coherence check | Cross-reference artifacts for correctness |
|
|
43
43
|
| `testing-anti-patterns` | Phase 3 after tests pass | Detect mock-only tests, production pollution, and fragile assertions |
|
|
44
|
+
| `fallow` | Phase 2b (advisory) | Changed-file structural risk — dead code, complexity, duplication introduced by this change. Non-blocking. |
|
|
44
45
|
| `dcp-hygiene` | Phase 5 Report | Compress the closed gate output (typecheck/lint/test) when `compress` is available |
|
|
45
46
|
|
|
46
47
|
## Phase 0: Verification Cache
|
|
@@ -84,6 +85,7 @@ Report results with mode column:
|
|
|
84
85
|
| Lint | PASS | incremental | 0.3s |
|
|
85
86
|
| Test | PASS | incremental | 1.2s |
|
|
86
87
|
| Build | SKIP | — | — |
|
|
88
|
+
| Fallow | ADVISORY | new-only | 0.8s |
|
|
87
89
|
```
|
|
88
90
|
|
|
89
91
|
After all gates pass, load `testing-anti-patterns` skill and audit tests for mock-only coverage, fragile assertions, and production code pollution.
|
|
@@ -92,6 +94,27 @@ If `--fix` flag provided, run the project's auto-fix command (e.g., `npm run lin
|
|
|
92
94
|
|
|
93
95
|
**After all gates pass**, record to verification cache per `verification-before-completion` skill's cache protocol.
|
|
94
96
|
|
|
97
|
+
### Phase 2b: Structural Risk Advisory (fallow)
|
|
98
|
+
|
|
99
|
+
After the hard gates pass, run a **non-blocking** structural-risk scan over the change set. This surfaces dead code, complexity, and duplication **introduced by this change** — it never blocks `/verify` or `/ship`.
|
|
100
|
+
|
|
101
|
+
Load the `fallow` skill. Determine the PR base, then run the changed-file audit:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
BASE=$(git merge-base HEAD origin/main 2>/dev/null || git merge-base HEAD main 2>/dev/null || echo "HEAD~1")
|
|
105
|
+
npx fallow audit --base "$BASE" --gate new-only --format json --quiet 2>/dev/null || true
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
> `--gate new-only` restricts to issues introduced since `$BASE` so pre-existing findings don't noise the report. `|| true` + `2>/dev/null`: exit 1 = issues found (normal), exit 2 = real error. If fallow is not installed, the project is not JS/TS, or there is no git base, this step is a **silent no-op** — never block on it.
|
|
109
|
+
|
|
110
|
+
Parse the JSON `verdict` (`pass` | `warn` | `fail`) and `issues[]`. Report as the **ADVISORY** row in the Phase 2 table above.
|
|
111
|
+
|
|
112
|
+
**Blocking policy — never blocks:**
|
|
113
|
+
- Fallow findings are logged to `.pi/artifacts/$SLUG/progress.md` as advisory and surfaced in the Phase 5 Report under "Structural risk (advisory)".
|
|
114
|
+
- They are candidates for a follow-up `/gc --scope <path>` or `/fix` — NOT a ship blocker.
|
|
115
|
+
|
|
116
|
+
**Escalate (agent judgment, still no auto-block):** if verdict is `fail` with >5 NEW issues or any NEW circular dependency / architecture boundary violation, surface it prominently to the user and suggest running `/gc --scope <path>` before shipping.
|
|
117
|
+
|
|
95
118
|
## Phase 3: Coherence (skip with --quick)
|
|
96
119
|
|
|
97
120
|
Cross-reference artifacts for contradictions:
|
|
@@ -155,3 +178,4 @@ Append to `.pi/artifacts/$SLUG/progress.md`: `Verification: [PASS|PARTIAL|FAIL]
|
|
|
155
178
|
- `verification-before-completion` — evidence gate, cache protocol, phantom detection, Worker Distrust Protocol (all phases)
|
|
156
179
|
- `code-review-and-quality` — coherence cross-reference (Phase 3)
|
|
157
180
|
- `testing-anti-patterns` — mock-only test detection (Phase 2 post-gate)
|
|
181
|
+
- `fallow` — changed-file structural risk advisory, non-blocking (Phase 2b)
|
|
@@ -47,6 +47,7 @@ When the user's prompt contains these keywords (case-insensitive), the listed sk
|
|
|
47
47
|
| performance, slow, latency, optimize, profile, bundle size | `performance-optimization` |
|
|
48
48
|
| bug, fix, error, crash, broken, debug, trace | `debugging-and-error-recovery`, `root-cause-tracing` |
|
|
49
49
|
| refactor, cleanup, simplify, clean code, complex | `code-cleanup`, `code-simplification`, `deep-module-design` |
|
|
50
|
+
| dead code, duplication, circular dependency, unused exports, unused dependencies, complexity hotspot, codebase health, fallow | `fallow` |
|
|
50
51
|
| test, spec, verify, assert, coverage, TDD | `test-driven-development`, `testing-anti-patterns` |
|
|
51
52
|
| review, audit, quality, check, PR | `code-review-and-quality`, `agent-code-quality-gate` |
|
|
52
53
|
| design, UI, component, style, layout, CSS, tailwind, DESIGN.md, design identity, design token, brand identity | `frontend-design`, `design-taste-frontend` |
|
package/package.json
CHANGED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
purpose: Fallow codebase intelligence commands for AI agents — dead code, duplication, complexity, and audit gating
|
|
3
|
-
updated: 2026-06-04
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Fallow — Codebase Intelligence Reference
|
|
7
|
-
|
|
8
|
-
## Overview
|
|
9
|
-
|
|
10
|
-
Fallow is a Rust-native, deterministic static analysis tool for TypeScript/JavaScript codebases.
|
|
11
|
-
**No AI inside the analyzer** — same input always produces the same output.
|
|
12
|
-
It builds a complete module graph to find issues no linter or type checker can see.
|
|
13
|
-
|
|
14
|
-
---
|
|
15
|
-
|
|
16
|
-
## Commands
|
|
17
|
-
|
|
18
|
-
### Full Analysis (single pass)
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
npx fallow # All analyses: dead code + duplication + health
|
|
22
|
-
npx fallow --format json # Structured output for agent parsing
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
### Dead Code
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
npx fallow dead-code # Full dead code report
|
|
29
|
-
npx fallow dead-code --format json --quiet # JSON for agents
|
|
30
|
-
npx fallow dead-code --unused-exports # Only unused exports
|
|
31
|
-
npx fallow dead-code --unused-dependencies # Only unused deps
|
|
32
|
-
npx fallow dead-code --circular # Only circular deps
|
|
33
|
-
npx fallow fix --dry-run # Preview safe auto-fixes
|
|
34
|
-
npx fallow fix --yes # Apply auto-fixes
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
### Trace (investigate before deleting)
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
npx fallow dead-code --trace FILE:EXPORT_NAME # Why is this export flagged?
|
|
41
|
-
npx fallow dead-code --trace-dependency PACKAGE_NAME # Where is this dep imported?
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
### Duplication
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
npx fallow dupes # Find code clones
|
|
48
|
-
npx fallow dupes --mode strict # Exact matches only
|
|
49
|
-
npx fallow dupes --mode weak # Structural matches
|
|
50
|
-
npx fallow dupes --trace FILE:LINE # Deep-dive a specific clone group
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### Health (complexity)
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
npx fallow health # Complexity hotspots + refactoring targets
|
|
57
|
-
npx fallow health --format json # Structured output
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
### Audit Gate (for CI / pre-commit)
|
|
61
|
-
|
|
62
|
-
```bash
|
|
63
|
-
npx fallow audit # Check changed files (verdict: pass/warn/fail)
|
|
64
|
-
npx fallow audit --format json # Structured verdict for agents
|
|
65
|
-
npx fallow audit --gate new-only # Only flag new issues, not pre-existing
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
---
|
|
69
|
-
|
|
70
|
-
## Workflow Patterns
|
|
71
|
-
|
|
72
|
-
### Post-Edit Verification Loop
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
# 1. Make changes
|
|
76
|
-
# 2. Run audit
|
|
77
|
-
npx fallow audit --format json --quiet
|
|
78
|
-
# 3. If verdict is "fail", inspect findings
|
|
79
|
-
# 4. Fix or investigate with --trace
|
|
80
|
-
# 5. Re-run audit until pass
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
### Codebase Cleanup
|
|
84
|
-
|
|
85
|
-
```bash
|
|
86
|
-
npx fallow # Full picture
|
|
87
|
-
npx fallow dead-code --format json # Find unused code
|
|
88
|
-
npx fallow fix --dry-run # Preview auto-removals
|
|
89
|
-
npx fallow fix --yes # Apply auto-fixes
|
|
90
|
-
npx fallow dupes # Find duplication
|
|
91
|
-
npx fallow health # Find complexity hotspots
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
### Monorepo / Workspace
|
|
95
|
-
|
|
96
|
-
```bash
|
|
97
|
-
npx fallow --workspace # Analyze all workspaces
|
|
98
|
-
npx fallow --workspace packages/pkg # Analyze specific workspace
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
---
|
|
102
|
-
|
|
103
|
-
## Understanding Output
|
|
104
|
-
|
|
105
|
-
Every finding in `--format json` includes:
|
|
106
|
-
|
|
107
|
-
```json
|
|
108
|
-
{
|
|
109
|
-
"path": "src/utils/example.ts:42",
|
|
110
|
-
"issue_type": "unused-exports",
|
|
111
|
-
"actions": [
|
|
112
|
-
{
|
|
113
|
-
"type": "delete-export",
|
|
114
|
-
"auto_fixable": true,
|
|
115
|
-
"description": "Remove unused export"
|
|
116
|
-
}
|
|
117
|
-
]
|
|
118
|
-
}
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
The `actions[]` array is machine-actionable. Agents can inspect `auto_fixable` flags and apply safe fixes programmatically.
|
|
122
|
-
|
|
123
|
-
---
|
|
124
|
-
|
|
125
|
-
## Config
|
|
126
|
-
|
|
127
|
-
Fallow auto-detects your project. For custom config, run:
|
|
128
|
-
|
|
129
|
-
```bash
|
|
130
|
-
npx fallow init # Generates .fallow/config.yaml with auto-detected settings
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
Common config patterns:
|
|
134
|
-
- `ignorePatterns` — exclude directories from analysis (e.g., `.pi/`)
|
|
135
|
-
- `entry` — declare additional entry points
|
|
136
|
-
- `publicPackages` — packages with public API surface
|
|
137
|
-
- `rules` — custom issue severity rules
|