@leing2021/super-pi 0.23.0 → 0.23.2
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 +55 -324
- package/extensions/ce-core/index.ts +96 -41
- package/extensions/ce-core/tools/context-handoff.ts +115 -1
- package/extensions/ce-core/tools/workflow-state.ts +68 -1
- package/package.json +1 -1
- package/skills/01-brainstorm/SKILL.md +42 -79
- package/skills/01-brainstorm/references/ce-brainstorm-mode.md +47 -0
- package/skills/02-plan/SKILL.md +43 -62
- package/skills/02-plan/references/solution-search.md +46 -0
- package/skills/03-work/SKILL.md +34 -55
- package/skills/03-work/references/completion-report.md +51 -0
- package/skills/04-review/SKILL.md +44 -52
- package/skills/04-review/references/solution-search.md +46 -0
- package/skills/06-next/SKILL.md +15 -28
- package/skills/06-next/references/recommendation-logic.md +45 -0
- package/skills/07-worktree/SKILL.md +20 -20
- package/skills/08-help/SKILL.md +37 -28
- package/skills/08-help/references/workflow-sequence.md +128 -3
- package/skills/references/pipeline-config.md +15 -0
package/README.md
CHANGED
|
@@ -10,22 +10,6 @@ pi install npm:@leing2021/super-pi
|
|
|
10
10
|
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
-
## Why Super Pi
|
|
14
|
-
|
|
15
|
-
Using a bare AI agent to write code has three common failure modes:
|
|
16
|
-
|
|
17
|
-
1. **Builds before thinking** — you finish and realize it's not what you wanted
|
|
18
|
-
2. **Loses context on interruption** — close the terminal, lose the progress
|
|
19
|
-
3. **Repeats the same mistakes** — every session starts from zero
|
|
20
|
-
|
|
21
|
-
Super Pi's answers:
|
|
22
|
-
|
|
23
|
-
- **Forces clarity before action** — not a form to fill out, but an AI that interrogates you like a YC partner demanding specific evidence
|
|
24
|
-
- **Auto-resume from checkpoints** — restart after interruption, skip completed work, continue from where you left off
|
|
25
|
-
- **Auto-compounds experience** — every solved problem becomes a searchable knowledge card; next time, the agent finds and reuses it
|
|
26
|
-
|
|
27
|
-
---
|
|
28
|
-
|
|
29
13
|
## The Five-Step Loop
|
|
30
14
|
|
|
31
15
|
```
|
|
@@ -33,360 +17,109 @@ Super Pi's answers:
|
|
|
33
17
|
think plan build review learn
|
|
34
18
|
```
|
|
35
19
|
|
|
36
|
-
|
|
20
|
+
| Skill | Does | Core Tool |
|
|
21
|
+
|-------|------|-----------|
|
|
22
|
+
| **01-brainstorm** | YC-style interrogation, three modes (Startup/Builder/CE) | `brainstorm_dialog` |
|
|
23
|
+
| **02-plan** | RED→GREEN→REFACTOR, incremental updates, optional CEO Review | `plan_diff` |
|
|
24
|
+
| **03-work** | Parallel execution, checkpoint resume, strict TDD | `ce_subagent`, `ce_parallel_subagent` |
|
|
25
|
+
| **04-review** | Auto-assigned reviewers, structured findings, browser QA | `review_router` |
|
|
26
|
+
| **05-learn** | Pattern extraction → searchable knowledge cards | `pattern_extractor` |
|
|
27
|
+
| **06-next** | Next-step recommendation + full status report | `workflow_state` |
|
|
28
|
+
| **07-worktree** | Isolated git worktree development | `worktree_manager` |
|
|
29
|
+
| **08-help** | Phase 1 skill explainer and usage guide | — |
|
|
37
30
|
|
|
38
|
-
###
|
|
31
|
+
### Model & Thinking Routing
|
|
39
32
|
|
|
40
|
-
Configure
|
|
33
|
+
Configure in `.pi/settings.json`:
|
|
41
34
|
|
|
42
35
|
```json
|
|
43
36
|
{
|
|
44
37
|
"modelStrategy": {
|
|
45
|
-
"01-brainstorm": "claude-sonnet-4-20250514",
|
|
46
|
-
"02-plan": "claude-opus-4-20250115"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
"
|
|
38
|
+
"01-brainstorm": "anthropic/claude-sonnet-4-20250514",
|
|
39
|
+
"02-plan": "anthropic/claude-opus-4-20250115"
|
|
40
|
+
},
|
|
41
|
+
"thinkingStrategy": {
|
|
42
|
+
"01-brainstorm": "high",
|
|
43
|
+
"02-plan": "high",
|
|
44
|
+
"03-work": "medium"
|
|
51
45
|
}
|
|
52
46
|
}
|
|
53
47
|
```
|
|
54
48
|
|
|
55
|
-
|
|
56
|
-
- Model switching is handled automatically by the ce-core extension `input` hook — no manual `/model` needed.
|
|
57
|
-
- When you type `/skill:01-brainstorm` through `/skill:05-learn`, the extension reads `modelStrategy[stage]` (or `modelStrategy.default`) and switches before the skill runs.
|
|
58
|
-
- Supported formats: full reference (`"anthropic/claude-opus-4-1"`) or bare model id (`"claude-opus-4-1"`, reuses current provider).
|
|
59
|
-
- Every stage prints a `📊 Pipeline Status` block with `Current / Output / Next`.
|
|
60
|
-
- A `Switched model for <stage>: <provider>/<model>` notification appears when the model changes.
|
|
61
|
-
|
|
62
|
-
Quick example:
|
|
63
|
-
1. Run `/skill:01-brainstorm` — model auto-switches to the configured brainstorm model
|
|
64
|
-
2. Approve the design
|
|
65
|
-
3. Run `/skill:02-plan` — model auto-switches to the configured plan model
|
|
66
|
-
4. Continue through each stage — model switches automatically at each step
|
|
67
|
-
|
|
68
|
-
---
|
|
69
|
-
|
|
70
|
-
## What Each Step Does
|
|
71
|
-
|
|
72
|
-
### 01-brainstorm: Think First
|
|
73
|
-
|
|
74
|
-
Not "describe your requirements." Three modes for three scenarios:
|
|
75
|
-
|
|
76
|
-
| Mode | For | What it does |
|
|
77
|
-
|------|-----|-------------|
|
|
78
|
-
| **Startup Diagnostic** | Startup ideas, new products | Six YC-style forcing questions, pushed until you produce specific evidence (not "people are interested" — "who would freak out if this disappeared tomorrow?") |
|
|
79
|
-
| **Builder Mode** | Side projects, hackathons | Only focused on building the coolest thing. If you accidentally mention revenue, it auto-upgrades to Startup Diagnostic |
|
|
80
|
-
| **CE Brainstorm** | Adding features to existing projects | Multi-round dialog to clarify scope boundaries, generates a structured requirements doc |
|
|
81
|
-
|
|
82
|
-
All three modes run a **premise challenge** (are your assumptions valid?) and **alternatives generation** (at least one minimal + one ideal approach) before you're allowed to move on.
|
|
83
|
-
|
|
84
|
-
### 02-plan: Plan Well
|
|
85
|
-
|
|
86
|
-
Breaks requirements into implementation units, each following strict **RED → GREEN → REFACTOR** (no production code without a failing test first).
|
|
87
|
-
|
|
88
|
-
**Incremental updates**: Requirements changed? `plan_diff` detects added/removed/modified units and patches the plan instead of rewriting it.
|
|
89
|
-
|
|
90
|
-
**CEO Review (optional)**: After planning, you can request a CEO Review. It challenges your plan using Bezos reversible-decision frameworks, Munger inversion, Jobs subtraction, forces alternative approaches, and draws error maps. Like having a demanding CTO review your proposal for free.
|
|
91
|
-
|
|
92
|
-
### 03-work: Build Right
|
|
93
|
-
|
|
94
|
-
**Parallel execution**: `task_splitter` uses a Union-Find algorithm to analyze file dependencies, feeds conflict-free units to `ce_parallel_subagent` for concurrent execution.
|
|
95
|
-
|
|
96
|
-
**Checkpoint resume**: After each unit, a checkpoint is saved. Interrupted? Next startup auto-loads, skips completed work, continues from the breakpoint. Failed? `fail` records the error → `retry` suggests a recovery strategy (timeout? extend timeout. Permission issue? check permissions first. Code error? fix then retry).
|
|
97
|
-
|
|
98
|
-
**Strict TDD**: Run failing test → write minimal implementation → test passes → refactor. Every step requires command output as evidence. No skipping.
|
|
99
|
-
|
|
100
|
-
### 04-review: Review Thoroughly
|
|
101
|
-
|
|
102
|
-
**Structured code review**: `review_router` auto-assigns reviewer personas based on diff metadata (changed payment code? bring in the security reviewer). Review discipline is technical evaluation, not theater — every finding must cite specific code, YAGNI checks, no performative agreement.
|
|
103
|
-
|
|
104
|
-
**Browser QA (optional)**: Uses `agent-browser` to open your app, click through pages, screenshot bugs, fix by severity, up to 3 auto-fix iterations. Can auto-generate regression tests. Like having a QA engineer run acceptance tests.
|
|
105
|
-
|
|
106
|
-
### 05-learn: Compound Learnings
|
|
107
|
-
|
|
108
|
-
`pattern_extractor` scans existing artifacts, extracts and categorizes patterns. Turns "the pitfall we hit this time" into a YAML-tagged solution card in `docs/solutions/`.
|
|
109
|
-
|
|
110
|
-
Two-level storage: project-specific → inside the project; cross-project → `~/.pi/agent/docs/solutions/` globally searchable.
|
|
111
|
-
|
|
112
|
-
Next time `02-plan` or `04-review` runs, a grep-first search strategy automatically retrieves relevant past experience.
|
|
113
|
-
|
|
114
|
-
---
|
|
115
|
-
|
|
116
|
-
## Technical Architecture
|
|
117
|
-
|
|
118
|
-
### 8 Skills (workflow nodes)
|
|
119
|
-
|
|
120
|
-
| Skill | One-liner | Core Tool |
|
|
121
|
-
|-------|-----------|-----------|
|
|
122
|
-
| `01-brainstorm` | Deep requirements mining in three modes | `brainstorm_dialog` |
|
|
123
|
-
| `02-plan` | Break into units, TDD gates, incremental updates | `plan_diff` |
|
|
124
|
-
| `03-work` | Parallel execution, checkpoint resume, error recovery | `session_checkpoint`, `task_splitter`, `ce_parallel_subagent` |
|
|
125
|
-
| `04-review` | Persona-routed review + live browser testing | `review_router` |
|
|
126
|
-
| `05-learn` | Pattern extraction → knowledge card compounding | `pattern_extractor` |
|
|
127
|
-
| `06-next` | What to do next + full status report | `workflow_state`, `session_history` |
|
|
128
|
-
| `07-worktree` | Git worktree isolated development | `worktree_manager` |
|
|
129
|
-
| `08-help` | Usage guide | — |
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
### 14 Tools + 2 Helpers (underlying capabilities)
|
|
133
|
-
|
|
134
|
-
| Tool | What it does |
|
|
135
|
-
|------|-------------|
|
|
136
|
-
| `task_splitter` | Union-Find algorithm analyzes file dependencies, auto-groups parallel-safe units |
|
|
137
|
-
| `session_checkpoint` | JSON-persisted checkpoints with save/load/fail/retry operations |
|
|
138
|
-
| `plan_diff` | Incremental plans: compare detects diffs, patch applies changes |
|
|
139
|
-
| `ce_parallel_subagent` | `Promise.allSettled`-style CE parallel skill-based subagent execution with context slimming |
|
|
140
|
-
| `review_router` | Auto-assign reviewer personas from diff metadata |
|
|
141
|
-
| `pattern_extractor` | Extract and categorize patterns from artifacts |
|
|
142
|
-
| `brainstorm_dialog` | Multi-round dialog state machine (start → refine × N → summarize) |
|
|
143
|
-
| `session_history` | Cross-session execution history recording and querying |
|
|
144
|
-
| `workflow_state` | Scan docs/ and .context/ to summarize workflow state |
|
|
145
|
-
| `worktree_manager` | Full git worktree lifecycle management |
|
|
146
|
-
| `artifact_helper` | Artifact path resolution and directory creation |
|
|
147
|
-
| `ask_user_question` | Structured user prompts (choices / free input) |
|
|
148
|
-
| `ce_subagent` | CE serial skill-based subagent chain with depth guard and context control |
|
|
149
|
-
| `context_handoff` | Cross-stage context handoffs with evidence-first templates (save/load/latest/status) |
|
|
150
|
-
| `subagent-depth-guard` | Helper: env-based recursion depth tracking (prevents runaway nesting) |
|
|
151
|
-
| `async-mutex` | Helper: serializes `process.env` mutation for concurrency-safe child process spawning |
|
|
152
|
-
|
|
153
|
-
### Compatibility with pi-subagents
|
|
49
|
+
Model and thinking level switch automatically — no manual `/model` needed.
|
|
154
50
|
|
|
155
|
-
|
|
51
|
+
### pi-subagents Compatibility
|
|
156
52
|
|
|
157
|
-
|
|
158
|
-
- **Generic `subagent`**: reserved for third-party agent extensions like [pi-subagents](https://www.npmjs.com/package/pi-subagents)
|
|
159
|
-
|
|
160
|
-
Both extensions can be installed simultaneously without tool collision. super-pi manages the CE pipeline (brainstorm → plan → work → review → learn); pi-subagents provides general-purpose multi-agent execution. No configuration needed — install both and each keeps its own tool namespace.
|
|
161
|
-
|
|
162
|
-
---
|
|
163
|
-
|
|
164
|
-
## Token Cost
|
|
165
|
-
|
|
166
|
-
New conversation overhead: **~2,600 tokens** (1.3% of Claude Sonnet 4's 200K context).
|
|
167
|
-
|
|
168
|
-
| Component | Tokens | When loaded |
|
|
169
|
-
|-----------|--------|-------------|
|
|
170
|
-
| 8 skill registrations | ~490 | Every conversation (fixed) |
|
|
171
|
-
| 14 tool registrations | ~2,055 | Every conversation (fixed) |
|
|
172
|
-
| Hooks & filters | 0 | Runtime interception, zero prompt cost |
|
|
173
|
-
| Single skill trigger | ~1,000–4,000 | On-demand via `read` |
|
|
174
|
-
| Rules minimal (2 files) | ~900 | Before plan/work |
|
|
175
|
-
| Rules + language (7 files) | ~2,600 | Before work with specific language |
|
|
176
|
-
|
|
177
|
-
| vs bare Pi | vs global rules injection | vs super-pi |
|
|
178
|
-
|-----------|----------------------|------------|
|
|
179
|
-
| No rules | All rules loaded upfront | Progressive on-demand |
|
|
180
|
-
| No output filtering | No output filtering | Auto-compress (bash ~65–98%, read ~30–60%) |
|
|
181
|
-
| No TDD gate | No TDD gate | Hard gate prevents rework |
|
|
182
|
-
| 0 tokens | ~5,000–36,000 tokens | **~2,600 tokens** |
|
|
183
|
-
|
|
184
|
-
Single `npm install` output filtered once pays for the entire overhead. Full evaluation → [`docs/token-cost-evaluation.md`](docs/token-cost-evaluation.md)
|
|
185
|
-
|
|
186
|
-
---
|
|
187
|
-
|
|
188
|
-
## Code Scale
|
|
189
|
-
|
|
190
|
-
~2800 lines of TypeScript implementing 14 registered tools + 2 helpers, 23 Markdown reference files + 79 rule files driving 8 skills, 175 tests covering all tool logic.
|
|
191
|
-
|
|
192
|
-
Not a heavy framework. Each tool has a single responsibility, each skill works independently, and together they form a complete workflow.
|
|
53
|
+
CE skill tools use a dedicated namespace (`ce_subagent`, `ce_parallel_subagent`) to avoid conflicts with third-party extensions like [pi-subagents](https://www.npmjs.com/package/pi-subagents). Both can coexist without configuration.
|
|
193
54
|
|
|
194
55
|
---
|
|
195
56
|
|
|
196
57
|
## Quick Start
|
|
197
58
|
|
|
198
|
-
### New idea
|
|
199
|
-
|
|
200
59
|
```
|
|
201
60
|
You: I want to build a tool that helps indie devs find users
|
|
202
61
|
|
|
203
|
-
→
|
|
204
|
-
→
|
|
205
|
-
→
|
|
62
|
+
→ 01-brainstorm: YC-style interrogation → docs/brainstorms/requirements.md
|
|
63
|
+
→ 02-plan: RED→GREEN→REFACTOR units → docs/plans/plan.md
|
|
64
|
+
→ 03-work: parallel execution, checkpoint resume
|
|
65
|
+
→ 04-review: structured findings, optional browser QA
|
|
66
|
+
→ 05-learn: knowledge compounding
|
|
206
67
|
|
|
207
68
|
You: continue
|
|
208
|
-
|
|
209
|
-
→ 02-plan breaks into units, optional CEO Review
|
|
210
|
-
→ Generates docs/plans/2026-04-18-find-users-plan.md
|
|
211
|
-
|
|
212
|
-
You: continue
|
|
213
|
-
|
|
214
|
-
→ 03-work parallel execution, checkpoint resume
|
|
215
|
-
→ 04-review code review + optional browser QA
|
|
216
|
-
→ 05-learn knowledge compounding
|
|
69
|
+
→ Next skill recommended automatically via /skill:06-next
|
|
217
70
|
```
|
|
218
71
|
|
|
219
|
-
|
|
220
|
-
|
|
72
|
+
**After interruption:**
|
|
221
73
|
```
|
|
222
|
-
You:
|
|
223
|
-
|
|
224
|
-
→ 01-brainstorm CE mode, multi-round dialog: OAuth2? JWT? MFA?
|
|
225
|
-
→ Requirements doc → 02-plan → 03-work → 04-review → 05-learn
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
### Resume after interruption
|
|
229
|
-
|
|
230
|
-
```
|
|
231
|
-
You: /skill:03-work docs/plans/auth-plan.md
|
|
232
|
-
|
|
74
|
+
You: /skill:03-work docs/plans/plan.md
|
|
233
75
|
→ Auto-loads checkpoint, skips completed units, resumes from breakpoint
|
|
234
76
|
```
|
|
235
77
|
|
|
236
|
-
|
|
78
|
+
---
|
|
237
79
|
|
|
238
|
-
|
|
239
|
-
You: Requirements changed, need to add SSO support
|
|
80
|
+
## Token Cost
|
|
240
81
|
|
|
241
|
-
|
|
242
|
-
```
|
|
82
|
+
New conversation overhead: **~2,600 tokens** (1.3% of 200K context).
|
|
243
83
|
|
|
244
|
-
|
|
84
|
+
| Component | Tokens |
|
|
85
|
+
|-----------|--------|
|
|
86
|
+
| 8 skill registrations | ~490 |
|
|
87
|
+
| System prompt (skills) | ~1,400 |
|
|
88
|
+
| Skill inlining (per invocation) | ~500-800 |
|
|
245
89
|
|
|
246
|
-
|
|
247
|
-
You: /skill:06-next
|
|
90
|
+
Progressive loading: only needed skills loaded on-demand.
|
|
248
91
|
|
|
249
|
-
|
|
250
|
-
```
|
|
92
|
+
Full evaluation → [`docs/token-cost-evaluation.md`](docs/token-cost-evaluation.md)
|
|
251
93
|
|
|
252
94
|
---
|
|
253
95
|
|
|
254
|
-
## Generated
|
|
96
|
+
## Generated Structure
|
|
255
97
|
|
|
256
98
|
```
|
|
257
99
|
your-project/
|
|
258
100
|
├── docs/
|
|
259
|
-
│ ├── brainstorms/
|
|
260
|
-
│ ├── plans/
|
|
261
|
-
│ └── solutions/
|
|
101
|
+
│ ├── brainstorms/ # Requirements
|
|
102
|
+
│ ├── plans/ # Execution plans
|
|
103
|
+
│ └── solutions/ # Knowledge cards
|
|
262
104
|
└── .context/
|
|
263
105
|
└── compound-engineering/
|
|
264
|
-
├── checkpoints/
|
|
265
|
-
├── dialogs/
|
|
266
|
-
└── history/
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
**Recommendation: commit everything to git** — these files are the project's traceable memory.
|
|
270
|
-
|
|
271
|
-
### Progressive Rule Loading
|
|
272
|
-
|
|
273
|
-
Built-in coding rules live under `rules/` in the package. Rules are loaded **progressively** by each skill — never all at once, only what the current task needs.
|
|
274
|
-
|
|
275
|
-
**How it works:**
|
|
276
|
-
|
|
277
|
-
```
|
|
278
|
-
system prompt (30 tokens: skill name + description)
|
|
279
|
-
→ skill SKILL.md (~200 tokens: loading decision tree)
|
|
280
|
-
→ specific rule files via read tool (on-demand, 900–2600 tokens)
|
|
106
|
+
├── checkpoints/ # Breakpoint files
|
|
107
|
+
├── dialogs/ # Dialog state
|
|
108
|
+
└── history/ # Execution history
|
|
281
109
|
```
|
|
282
110
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
| Skill | Rules pre-loaded |
|
|
286
|
-
|-------|-----------------|
|
|
287
|
-
| `02-plan` | `common/` rules + language detection + matching language rules (e.g. `rules/typescript/`) |
|
|
288
|
-
| `03-work` | `common/` rules + language detection + matching language rules + `web/` if frontend |
|
|
289
|
-
| `04-review` | `common/code-review.md` + language detection + matching language rules + `web/` if frontend |
|
|
290
|
-
|
|
291
|
-
Language detection uses file heuristics (see `skills/references/language-detection.md`): `tsconfig.json` → TypeScript, `Cargo.toml` → Rust, `go.mod` → Go, etc.
|
|
292
|
-
|
|
293
|
-
**Rule precedence** (when layers overlap on the same topic):
|
|
294
|
-
|
|
295
|
-
```
|
|
296
|
-
language-specific > web > common
|
|
297
|
-
```
|
|
298
|
-
|
|
299
|
-
No rules are loaded when you brainstorm, check status, or do non-code tasks. Zero waste.
|
|
300
|
-
|
|
301
|
-
#### Included rule layers
|
|
302
|
-
|
|
303
|
-
| Layer | Files | When loaded |
|
|
304
|
-
|-------|-------|------------|
|
|
305
|
-
| `common/` | 11 files (includes `naming.md`) | Always (baseline for all tasks) |
|
|
306
|
-
| `typescript/`, `python/`, `cpp/`, `csharp/`, `dart/`, `golang/`, `java/`, `kotlin/`, `perl/`, `php/`, `rust/`, `swift/` | 5 files each | When the task touches that language |
|
|
307
|
-
| `web/` | 7 files (includes `design-quality.md`, `performance.md`) | When frontend/browser is relevant |
|
|
308
|
-
|
|
309
|
-
#### Customizing rules for your project
|
|
310
|
-
|
|
311
|
-
Two rule sources exist, with project-level taking priority:
|
|
312
|
-
|
|
313
|
-
| Source | Location | Survives `pi update`? |
|
|
314
|
-
|--------|----------|----------------------|
|
|
315
|
-
| **Project-level** | `{your-project-root}/rules/` | ✅ Yes |
|
|
316
|
-
| Package-level | Inside `node_modules/@leing2021/super-pi/rules/` | ❌ No |
|
|
317
|
-
|
|
318
|
-
To customize, create a `rules/` directory in your project root. Skills check it first — if a file exists there, it overrides the package default for that topic.
|
|
319
|
-
|
|
320
|
-
**Add a language** — create a new directory with the 5 standard topics:
|
|
321
|
-
|
|
322
|
-
```bash
|
|
323
|
-
mkdir rules/elixir
|
|
324
|
-
touch rules/elixir/{coding-style,testing,patterns,security,hooks}.md
|
|
325
|
-
```
|
|
326
|
-
|
|
327
|
-
Each file should start with:
|
|
328
|
-
|
|
329
|
-
```markdown
|
|
330
|
-
> This file extends [common/xxx.md](../common/xxx.md) with Elixir-specific content.
|
|
331
|
-
```
|
|
332
|
-
|
|
333
|
-
**Remove unused languages** — just delete the directory:
|
|
334
|
-
|
|
335
|
-
```bash
|
|
336
|
-
rm -rf rules/perl rules/cpp # don't need these? remove them
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
**Tweak a rule** — edit the `.md` file directly:
|
|
340
|
-
|
|
341
|
-
```bash
|
|
342
|
-
# Override testing conventions for your team
|
|
343
|
-
vim rules/common/testing.md
|
|
344
|
-
|
|
345
|
-
# Override for a specific language
|
|
346
|
-
vim rules/typescript/testing.md
|
|
347
|
-
```
|
|
348
|
-
|
|
349
|
-
**Add a new topic** — create a new `.md` in the appropriate layer:
|
|
350
|
-
|
|
351
|
-
```bash
|
|
352
|
-
# Common topic
|
|
353
|
-
vim rules/common/api-design.md
|
|
354
|
-
|
|
355
|
-
# Language-specific override
|
|
356
|
-
vim rules/python/api-design.md
|
|
357
|
-
```
|
|
358
|
-
|
|
359
|
-
Skills will pick up any `.md` file in `rules/` — no configuration needed. If a language directory exists, it's available for loading. If it's gone, it's simply never loaded.
|
|
111
|
+
**Commit everything to git** — these files are the project's traceable memory.
|
|
360
112
|
|
|
361
113
|
---
|
|
362
114
|
|
|
363
|
-
##
|
|
364
|
-
|
|
365
|
-
**80% planning and review, 20% execution.**
|
|
366
|
-
|
|
367
|
-
The goal isn't making AI write code faster — it's making AI think before writing, review after writing, and compound learnings after reviewing. Speed comes from fewer rewrites, not from skipping steps.
|
|
368
|
-
|
|
369
|
-
The following projects directly inspired this work:
|
|
115
|
+
## Architecture
|
|
370
116
|
|
|
371
|
-
- **
|
|
372
|
-
- **
|
|
373
|
-
- **
|
|
374
|
-
- **
|
|
117
|
+
- **8 skills** with dedicated tools
|
|
118
|
+
- **14 tools** + 2 helpers
|
|
119
|
+
- **~2800 lines** TypeScript, **175 tests**
|
|
120
|
+
- **Progressive rule loading** — only what each task needs
|
|
375
121
|
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
---
|
|
379
|
-
|
|
380
|
-
## Best Practices
|
|
381
|
-
|
|
382
|
-
| Tip | Why |
|
|
383
|
-
|-----|-----|
|
|
384
|
-
| Start with 01-brainstorm | Whatever the scenario, thinking first never hurts |
|
|
385
|
-
| Use 07-worktree for big features | Isolated dev, no impact on main branch |
|
|
386
|
-
| Use CEO Review on plans | Like having a demanding CTO review for free |
|
|
387
|
-
| Use browser QA for acceptance | Code review can't catch layout breaks and blank screens |
|
|
388
|
-
| Don't panic on interruption | Next 03-work auto-resumes from checkpoint |
|
|
389
|
-
| Use 06-next when lost | One glance shows where you are and what to do next |
|
|
122
|
+
Rules in `rules/` (11 common + language-specific). Project-level overrides take priority.
|
|
390
123
|
|
|
391
124
|
---
|
|
392
125
|
|
|
@@ -394,8 +127,6 @@ Not a fork. Not a wrapper. Methodologies extracted and rebuilt with Pi's native
|
|
|
394
127
|
|
|
395
128
|
See [CHANGELOG.md](./CHANGELOG.md) for full version history.
|
|
396
129
|
|
|
397
|
-
---
|
|
398
|
-
|
|
399
130
|
## Repository
|
|
400
131
|
|
|
401
132
|
- **GitHub**: https://github.com/leing2021/super-pi
|
|
@@ -406,4 +137,4 @@ See [CHANGELOG.md](./CHANGELOG.md) for full version history.
|
|
|
406
137
|
```bash
|
|
407
138
|
bun test
|
|
408
139
|
npm publish --dry-run
|
|
409
|
-
```
|
|
140
|
+
```
|
|
@@ -31,15 +31,46 @@ const PIPELINE_STAGE_KEYS = new Set([
|
|
|
31
31
|
"05-learn",
|
|
32
32
|
])
|
|
33
33
|
|
|
34
|
-
interface
|
|
34
|
+
interface StrategySettings {
|
|
35
35
|
modelStrategy?: Record<string, string>
|
|
36
|
+
thinkingStrategy?: Record<string, string>
|
|
36
37
|
}
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Read settings from two locations:
|
|
41
|
+
* 1. Project-level: {cwd}/.pi/settings.json (highest priority)
|
|
42
|
+
* 2. Global-level: ~/.pi/agent/settings.json (fallback)
|
|
43
|
+
*
|
|
44
|
+
* Project-level takes precedence; global-level is used as fallback.
|
|
45
|
+
*/
|
|
46
|
+
async function readSettings(cwd: string): Promise<StrategySettings | null> {
|
|
47
|
+
// Try project-level first
|
|
48
|
+
const projectPath = path.join(cwd, ".pi", "settings.json")
|
|
40
49
|
try {
|
|
41
|
-
const content = await readFile(
|
|
42
|
-
|
|
50
|
+
const content = await readFile(projectPath, "utf8")
|
|
51
|
+
const projectSettings = JSON.parse(content) as StrategySettings
|
|
52
|
+
// If project has modelStrategy or thinkingStrategy, use it
|
|
53
|
+
if (projectSettings.modelStrategy || projectSettings.thinkingStrategy) {
|
|
54
|
+
return projectSettings
|
|
55
|
+
}
|
|
56
|
+
} catch {
|
|
57
|
+
// Project settings not found, continue to global
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Fallback to global-level
|
|
61
|
+
const globalPath = path.join(process.env.HOME || "~", ".pi", "agent", "settings.json")
|
|
62
|
+
try {
|
|
63
|
+
const content = await readFile(globalPath, "utf8")
|
|
64
|
+
return JSON.parse(content) as StrategySettings
|
|
65
|
+
} catch {
|
|
66
|
+
// Global settings not found either
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Try ~/.pi/settings.json as another fallback
|
|
70
|
+
const altGlobalPath = path.join(process.env.HOME || "~", ".pi", "settings.json")
|
|
71
|
+
try {
|
|
72
|
+
const content = await readFile(altGlobalPath, "utf8")
|
|
73
|
+
return JSON.parse(content) as StrategySettings
|
|
43
74
|
} catch {
|
|
44
75
|
return null
|
|
45
76
|
}
|
|
@@ -295,6 +326,11 @@ const contextHandoffParams = Type.Object({
|
|
|
295
326
|
artifacts: Type.Optional(Type.Record(Type.String(), Type.Optional(Type.String()), { description: "Artifact paths (requirements, plan, checkpoint, proof)" })),
|
|
296
327
|
handoffMarkdown: Type.Optional(Type.String({ description: "Custom handoff markdown content" })),
|
|
297
328
|
handoffPath: Type.Optional(Type.String({ description: "Specific handoff file path to load" })),
|
|
329
|
+
currentTruth: Type.Optional(Type.Array(Type.String(), { description: "Known true statements validated during session" })),
|
|
330
|
+
invalidatedAssumptions: Type.Optional(Type.Array(Type.String(), { description: "Assumptions proven wrong during session" })),
|
|
331
|
+
openDecisions: Type.Optional(Type.Array(Type.String(), { description: "Pending decisions that affect next steps" })),
|
|
332
|
+
recentlyAccessedFiles: Type.Optional(Type.Array(Type.String(), { description: "Files recently read or edited (defaults to activeFiles)" })),
|
|
333
|
+
compressionRisk: Type.Optional(Type.Array(Type.String(), { description: "Context compression risks to watch for" })),
|
|
298
334
|
})
|
|
299
335
|
|
|
300
336
|
const patternExtractorParams = Type.Object({
|
|
@@ -319,47 +355,61 @@ export default function ceCoreExtension(pi: ExtensionAPI) {
|
|
|
319
355
|
return { action: "continue" as const }
|
|
320
356
|
}
|
|
321
357
|
|
|
322
|
-
const settings = await
|
|
358
|
+
const settings = await readSettings(ctx.cwd)
|
|
323
359
|
const modelStrategy = settings?.modelStrategy
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
360
|
+
const thinkingStrategy = settings?.thinkingStrategy
|
|
361
|
+
|
|
362
|
+
// Model switching
|
|
363
|
+
if (modelStrategy) {
|
|
364
|
+
const targetModelRef = modelStrategy[stageKey] ?? modelStrategy.default
|
|
365
|
+
if (targetModelRef) {
|
|
366
|
+
const parsed = parseModelRef(targetModelRef, ctx.model?.provider)
|
|
367
|
+
if (parsed) {
|
|
368
|
+
// Skip if already using the same model
|
|
369
|
+
if (ctx.model?.provider !== parsed.provider || ctx.model?.id !== parsed.id) {
|
|
370
|
+
const model = ctx.modelRegistry.find(parsed.provider, parsed.id)
|
|
371
|
+
if (model) {
|
|
372
|
+
const switched = await pi.setModel(model)
|
|
373
|
+
if (switched) {
|
|
374
|
+
if (ctx.hasUI) {
|
|
375
|
+
ctx.ui.notify(`Switched model for ${stageKey}: ${model.provider}/${model.id}`, "info")
|
|
376
|
+
}
|
|
377
|
+
} else {
|
|
378
|
+
if (ctx.hasUI) {
|
|
379
|
+
ctx.ui.notify(`No API key for ${stageKey}: ${model.provider}/${model.id}`, "warning")
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
} else if (ctx.hasUI) {
|
|
383
|
+
ctx.ui.notify(`Model not found for ${stageKey}: ${targetModelRef}`, "warning")
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
} else if (ctx.hasUI) {
|
|
387
|
+
ctx.ui.notify(`Invalid modelStrategy for ${stageKey}: ${targetModelRef}`, "warning")
|
|
388
|
+
}
|
|
349
389
|
}
|
|
350
|
-
return { action: "continue" as const }
|
|
351
390
|
}
|
|
352
391
|
|
|
353
|
-
|
|
354
|
-
if (
|
|
355
|
-
|
|
356
|
-
|
|
392
|
+
// Thinking level switching
|
|
393
|
+
if (thinkingStrategy) {
|
|
394
|
+
const targetThinking = thinkingStrategy[stageKey] ?? thinkingStrategy.default
|
|
395
|
+
if (targetThinking) {
|
|
396
|
+
const levelMap: Record<string, "low" | "medium" | "high"> = {
|
|
397
|
+
low: "low",
|
|
398
|
+
medium: "medium",
|
|
399
|
+
high: "high",
|
|
400
|
+
"0": "low",
|
|
401
|
+
"1": "medium",
|
|
402
|
+
"2": "high",
|
|
403
|
+
}
|
|
404
|
+
const normalized = levelMap[targetThinking.toLowerCase()] ?? "medium"
|
|
405
|
+
const currentLevel = ctx.getThinkingLevel?.() ?? "medium"
|
|
406
|
+
if (currentLevel !== normalized) {
|
|
407
|
+
ctx.setThinkingLevel?.(normalized)
|
|
408
|
+
if (ctx.hasUI) {
|
|
409
|
+
ctx.ui.notify(`Switched thinking level for ${stageKey}: ${normalized}`, "info")
|
|
410
|
+
}
|
|
411
|
+
}
|
|
357
412
|
}
|
|
358
|
-
return { action: "continue" as const }
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
if (ctx.hasUI) {
|
|
362
|
-
ctx.ui.notify(`No API key available for configured model: ${model.provider}/${model.id}`, "warning")
|
|
363
413
|
}
|
|
364
414
|
|
|
365
415
|
return { action: "continue" as const }
|
|
@@ -713,6 +763,11 @@ export default function ceCoreExtension(pi: ExtensionAPI) {
|
|
|
713
763
|
artifacts: params.artifacts as Record<string, string | undefined> | undefined,
|
|
714
764
|
handoffMarkdown: params.handoffMarkdown,
|
|
715
765
|
handoffPath: params.handoffPath,
|
|
766
|
+
currentTruth: params.currentTruth,
|
|
767
|
+
invalidatedAssumptions: params.invalidatedAssumptions,
|
|
768
|
+
openDecisions: params.openDecisions,
|
|
769
|
+
recentlyAccessedFiles: params.recentlyAccessedFiles,
|
|
770
|
+
compressionRisk: params.compressionRisk,
|
|
716
771
|
})
|
|
717
772
|
|
|
718
773
|
return {
|