@leing2021/super-pi 0.18.2 → 0.19.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
@@ -29,12 +29,44 @@ Super Pi's answers:
29
29
  ## The Five-Step Loop
30
30
 
31
31
  ```
32
- 01-brainstorm → 02-plan → 03-work → 04-review → 05-compound
33
- think plan build review compound
32
+ 01-brainstorm → 02-plan → 03-work → 04-review → 05-learn
33
+ think plan build review learn
34
34
  ```
35
35
 
36
36
  Each step has a dedicated skill + tool pair. Not just prompts — structured toolchains.
37
37
 
38
+ ### New: Stage model routing + optional auto-continue
39
+
40
+ Configure once in `.pi/settings.json`:
41
+
42
+ ```json
43
+ {
44
+ "modelStrategy": {
45
+ "01-brainstorm": "claude-sonnet-4-20250514",
46
+ "02-plan": "claude-opus-4-20250115",
47
+ "03-work": "claude-sonnet-4-20250514",
48
+ "04-review": "claude-sonnet-4-20250514",
49
+ "05-learn": "claude-haiku-4-20250414",
50
+ "default": "claude-sonnet-4-20250514"
51
+ },
52
+ "pipeline": {
53
+ "autoContinue": false
54
+ }
55
+ }
56
+ ```
57
+
58
+ How it works:
59
+ - Each stage picks `modelStrategy[stage]`, or `modelStrategy.default` as fallback.
60
+ - Every stage prints a `📊 Pipeline Status` block with `Current / Output / Next`.
61
+ - If `pipeline.autoContinue=true`, super-pi can trigger the next stage automatically.
62
+ - Auto-continue is gate-aware: it will NOT skip required approvals (brainstorm approval, plan/review A/B/C choices).
63
+
64
+ Quick example:
65
+ 1. Run `/skill:01-brainstorm`
66
+ 2. Approve the design
67
+ 3. If `autoContinue=true`, it moves to `/skill:02-plan` automatically
68
+ 4. If `autoContinue=false`, it stops after status output and waits for your command
69
+
38
70
  ---
39
71
 
40
72
  ## What Each Step Does
@@ -73,7 +105,7 @@ Breaks requirements into implementation units, each following strict **RED → G
73
105
 
74
106
  **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.
75
107
 
76
- ### 05-compound: Compound Learnings
108
+ ### 05-learn: Compound Learnings
77
109
 
78
110
  `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/`.
79
111
 
@@ -93,7 +125,7 @@ Next time `02-plan` or `04-review` runs, a grep-first search strategy automatica
93
125
  | `02-plan` | Break into units, TDD gates, incremental updates | `plan_diff` |
94
126
  | `03-work` | Parallel execution, checkpoint resume, error recovery | `session_checkpoint`, `task_splitter`, `parallel_subagent` |
95
127
  | `04-review` | Persona-routed review + live browser testing | `review_router` |
96
- | `05-compound` | Pattern extraction → knowledge card compounding | `pattern_extractor` |
128
+ | `05-learn` | Pattern extraction → knowledge card compounding | `pattern_extractor` |
97
129
  | `06-next` | Not sure what to do next? Ask this | `workflow_state`, `session_history` |
98
130
  | `07-worktree` | Git worktree isolated development | `worktree_manager` |
99
131
  | `08-status` | Scan artifacts, report progress | `workflow_state`, `session_history` |
@@ -174,7 +206,7 @@ You: continue
174
206
 
175
207
  → 03-work parallel execution, checkpoint resume
176
208
  → 04-review code review + optional browser QA
177
- → 05-compound knowledge compounding
209
+ → 05-learn knowledge compounding
178
210
  ```
179
211
 
180
212
  ### Adding a feature
@@ -183,7 +215,7 @@ You: continue
183
215
  You: I want to add user authentication to the project
184
216
 
185
217
  → 01-brainstorm CE mode, multi-round dialog: OAuth2? JWT? MFA?
186
- → Requirements doc → 02-plan → 03-work → 04-review → 05-compound
218
+ → Requirements doc → 02-plan → 03-work → 04-review → 05-learn
187
219
  ```
188
220
 
189
221
  ### Resume after interruption
@@ -219,7 +251,7 @@ your-project/
219
251
  ├── docs/
220
252
  │ ├── brainstorms/ # Requirements (01-brainstorm)
221
253
  │ ├── plans/ # Execution plans (02-plan)
222
- │ └── solutions/ # Knowledge cards (05-compound)
254
+ │ └── solutions/ # Knowledge cards (05-learn)
223
255
  └── .context/
224
256
  └── compound-engineering/
225
257
  ├── checkpoints/ # Breakpoint files (session_checkpoint)
@@ -351,6 +383,12 @@ Not a fork. Not a wrapper. Methodologies extracted and rebuilt with Pi's native
351
383
 
352
384
  ## Changelog
353
385
 
386
+ ### 0.19.0 — 0.69.0 alignment + learn rename
387
+ - TypeBox migration: `@sinclair/typebox` → `typebox` (zero old-path imports)
388
+ - Peer/dev dependency upgrade: pi-coding-agent `0.67.6` → `0.69.0`
389
+ - Tool termination: 6 pure-query tools now return `terminate: true` to reduce unnecessary LLM rounds
390
+ - Skill rename: `05-compound` → `05-learn` for clarity
391
+
354
392
  ### 0.18.0 — Progressive rules
355
393
  - Built-in `rules/` directory with 13 language layers + common + web (78 Markdown files)
356
394
  - New `10-rules` skill: progressive on-demand loading, zero waste
@@ -1,5 +1,5 @@
1
1
  import type { ExtensionAPI } from "@mariozechner/pi-coding-agent"
2
- import { Type } from "@sinclair/typebox"
2
+ import { Type } from "typebox"
3
3
  import { createArtifactHelperTool, type ArtifactType } from "./tools/artifact-helper"
4
4
  import { createAskUserQuestionTool } from "./tools/ask-user-question"
5
5
  import { createSubagentTool } from "./tools/subagent"
@@ -282,8 +282,8 @@ export default function ceCoreExtension(pi: ExtensionAPI) {
282
282
  allowCustom: params.allowCustom,
283
283
  },
284
284
  {
285
- input: async (question) => ctx.ui.input(question),
286
- select: async (question, options) => ctx.ui.select(question, options),
285
+ input: async (question) => (await ctx.ui.input(question)) ?? null,
286
+ select: async (question, options) => (await ctx.ui.select(question, options)) ?? null,
287
287
  },
288
288
  )
289
289
 
@@ -338,6 +338,7 @@ export default function ceCoreExtension(pi: ExtensionAPI) {
338
338
  return {
339
339
  content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
340
340
  details: result,
341
+ terminate: true,
341
342
  }
342
343
  },
343
344
  })
@@ -392,6 +393,7 @@ export default function ceCoreExtension(pi: ExtensionAPI) {
392
393
  return {
393
394
  content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
394
395
  details: result,
396
+ terminate: true,
395
397
  }
396
398
  },
397
399
  })
@@ -447,6 +449,7 @@ export default function ceCoreExtension(pi: ExtensionAPI) {
447
449
  return {
448
450
  content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
449
451
  details: result,
452
+ terminate: true,
450
453
  }
451
454
  },
452
455
  })
@@ -486,6 +489,7 @@ export default function ceCoreExtension(pi: ExtensionAPI) {
486
489
  return {
487
490
  content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
488
491
  details: result,
492
+ terminate: true,
489
493
  }
490
494
  },
491
495
  })
@@ -527,6 +531,7 @@ export default function ceCoreExtension(pi: ExtensionAPI) {
527
531
  return {
528
532
  content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
529
533
  details: result,
534
+ terminate: true,
530
535
  }
531
536
  },
532
537
  })
@@ -548,6 +553,7 @@ export default function ceCoreExtension(pi: ExtensionAPI) {
548
553
  return {
549
554
  content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
550
555
  details: result,
556
+ terminate: true,
551
557
  }
552
558
  },
553
559
  })
@@ -580,7 +586,7 @@ export default function ceCoreExtension(pi: ExtensionAPI) {
580
586
  return {
581
587
  content: [{ type: "text", text: result.output }],
582
588
  details: {
583
- ...event.details,
589
+ ...(event.details && typeof event.details === "object" ? event.details : {}),
584
590
  bashFilter: {
585
591
  strategy: result.strategy,
586
592
  originalBytes: result.originalBytes,
@@ -617,7 +623,7 @@ export default function ceCoreExtension(pi: ExtensionAPI) {
617
623
  return {
618
624
  content: [{ type: "text", text: result.output }],
619
625
  details: {
620
- ...event.details,
626
+ ...(event.details && typeof event.details === "object" ? event.details : {}),
621
627
  readFilter: {
622
628
  strategy: result.strategy,
623
629
  originalBytes: result.originalBytes,
@@ -627,10 +633,11 @@ export default function ceCoreExtension(pi: ExtensionAPI) {
627
633
  }
628
634
  })
629
635
 
630
- // Compaction prompt optimizer — makes summaries more focused and useful
631
- pi.on("session_before_compact", async (_event, _ctx) => {
636
+ // Tree summary prompt optimizer — keeps branch summaries focused
637
+ pi.on("session_before_tree", async (_event, _ctx) => {
632
638
  return {
633
639
  customInstructions: COMPACTION_FOCUS_INSTRUCTIONS,
640
+ replaceInstructions: false,
634
641
  }
635
642
  })
636
643
  }
@@ -1,4 +1,4 @@
1
- import { Type } from "@sinclair/typebox"
1
+ import { Type } from "typebox"
2
2
 
3
3
  // ============================================================================
4
4
  // Types
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leing2021/super-pi",
3
- "version": "0.18.2",
3
+ "version": "0.19.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Pi-native Compound Engineering package for iterative development workflows",
@@ -36,11 +36,10 @@
36
36
  },
37
37
  "peerDependencies": {
38
38
  "@mariozechner/pi-coding-agent": "*",
39
- "@sinclair/typebox": "*"
39
+ "typebox": "*"
40
40
  },
41
41
  "devDependencies": {
42
- "@mariozechner/pi-coding-agent": "0.67.6",
43
- "@sinclair/typebox": "0.34.41",
42
+ "@mariozechner/pi-coding-agent": "0.69.0",
44
43
  "bun-types": "^1.3.12"
45
44
  },
46
45
  "pi": {
@@ -7,6 +7,8 @@ description: "Brainstorm requirements with three modes: CE discovery, Startup Di
7
7
 
8
8
  Use this skill when the request is ambiguous, needs requirements discovery before planning, or the user describes a new idea/product.
9
9
 
10
+ See [shared pipeline instructions](../references/pipeline-config.md) for model routing and pipeline behavior.
11
+
10
12
  ## Core rules
11
13
 
12
14
  - Use **`brainstorm_dialog`** to manage multi-round conversations.
@@ -118,3 +120,5 @@ Before handing off to `02-plan`:
118
120
  ## Artifact contract
119
121
 
120
122
  Use `references/requirements-template.md` to structure the requirements document. Keep implementation details out unless the brainstorm is specifically about architecture or technical direction.
123
+
124
+ Before finishing this skill, apply the completion checklist in [shared pipeline instructions](../references/pipeline-config.md).
@@ -7,6 +7,8 @@ description: "Turn requirements into a plan. Optional CEO-style strategic review
7
7
 
8
8
  Use this skill when requirements are ready to become an execution-ready plan.
9
9
 
10
+ See [shared pipeline instructions](../references/pipeline-config.md) for model routing and pipeline behavior.
11
+
10
12
  ## Core rules
11
13
 
12
14
  - Before planning, read the `10-rules` skill and load `rules/common/development-workflow.md` and `rules/common/testing.md` for coding standards context.
@@ -76,3 +78,5 @@ Every unit must include:
76
78
  6. Run unit-level verification
77
79
  - **Verification commands**: exact commands to run
78
80
  - **Expected results**: what success looks like
81
+
82
+ Before finishing this skill, apply the completion checklist in [shared pipeline instructions](../references/pipeline-config.md).
@@ -7,6 +7,8 @@ description: Execute plan-driven work in a controlled Phase 1 workflow.
7
7
 
8
8
  Use this skill when there is a plan path or a tightly scoped bare prompt ready for execution.
9
9
 
10
+ See [shared pipeline instructions](../references/pipeline-config.md) for model routing and pipeline behavior.
11
+
10
12
  ## Core rules
11
13
 
12
14
  - Before execution, read the `10-rules` skill and load language-specific rules matching the active codebase (e.g. `rules/typescript/` for TS work).
@@ -64,3 +66,5 @@ When all units are done, provide:
64
66
  - **Commands run**: all verification commands executed
65
67
  - **Verification results**: pass/fail status for each
66
68
  - **Follow-up work**: any remaining risks or open questions
69
+
70
+ Before finishing this skill, apply the completion checklist in [shared pipeline instructions](../references/pipeline-config.md).
@@ -7,6 +7,8 @@ description: "Review code with structured findings. Optional browser QA and regr
7
7
 
8
8
  Use this skill after implementation to review changes against the diff, the relevant plan, and prior learnings.
9
9
 
10
+ See [shared pipeline instructions](../references/pipeline-config.md) for model routing and pipeline behavior.
11
+
10
12
  ## Core rules
11
13
 
12
14
  - Before reviewing, read the `10-rules` skill and load `rules/common/code-review.md` plus language-specific rules matching the changed files.
@@ -16,7 +18,7 @@ Use this skill after implementation to review changes against the diff, the rele
16
18
  - Search solutions with grep-first strategy: extract keywords from the task → `bash grep -rl "tags:.*keyword" docs/solutions/ ~/.pi/agent/docs/solutions/` → read only frontmatter (first 15 lines) of matching files → score by severity + tag relevance → fully read top 3. Search both project-level (`docs/solutions/`) and global-level (`~/.pi/agent/docs/solutions/`). If no matches, report "No relevant solutions found" and proceed.
17
19
  - Produce **structured findings** using `references/findings-schema.md`.
18
20
  - When findings are **autofixable**, apply fixes and re-review (max 3 iterations).
19
- - End with a handoff that can point toward fixes, re-review, or `05-compound`.
21
+ - End with a handoff that can point toward fixes, re-review, or `05-learn`.
20
22
 
21
23
  ## Review discipline — technical evaluation
22
24
 
@@ -69,5 +71,7 @@ After QA:
69
71
  After review (and optional QA) is complete, hand off using `references/handoff.md`:
70
72
  1. Summarize all findings (code review + QA if run).
71
73
  2. Note fix commits if any were applied.
72
- 3. Recommend `05-compound` if learnings are worth capturing.
74
+ 3. Recommend `05-learn` if learnings are worth capturing.
73
75
  4. Recommend `03-work` if fixes need further implementation.
76
+
77
+ Before finishing this skill, apply the completion checklist in [shared pipeline instructions](../references/pipeline-config.md).
@@ -6,7 +6,7 @@ When the review is complete:
6
6
  2. State whether fixes or re-review are needed.
7
7
  3. If findings are **autofixable**, apply the fixes and re-review the changes.
8
8
  4. After autofix, report what was changed and whether re-review confirms the fix.
9
- 5. Recommend `05-compound` when the review surfaced a reusable learning or newly solved problem.
9
+ 5. Recommend `05-learn` when the review surfaced a reusable learning or newly solved problem.
10
10
  6. Mention any relevant plan or solution artifacts referenced during review.
11
11
 
12
12
  ## Autofix loop
@@ -1,12 +1,14 @@
1
1
  ---
2
- name: 05-compound
2
+ name: 05-learn
3
3
  description: Capture solved problems as reusable solution artifacts.
4
4
  ---
5
5
 
6
- # Compound
6
+ # Learn
7
7
 
8
8
  Use this skill after solving a problem so the repository gains a reusable learning in `docs/solutions/`.
9
9
 
10
+ See [shared pipeline instructions](../references/pipeline-config.md) for model routing and pipeline behavior.
11
+
10
12
  ## Core rules
11
13
 
12
14
  - Every solution MUST include YAML frontmatter per `references/solution-schema.yaml` (title, category, severity, tags, applies_when).
@@ -30,3 +32,5 @@ Use this skill after solving a problem so the repository gains a reusable learni
30
32
  5. Choose the correct category using `references/category-map.md`.
31
33
  6. Write or update the solution artifact under `docs/solutions/<category>/`.
32
34
  7. Mention how future `02-plan` and `04-review` runs should benefit from the new learning.
35
+
36
+ Before finishing this skill, apply the completion checklist in [shared pipeline instructions](../references/pipeline-config.md).
@@ -34,4 +34,4 @@ Use this skill when the user wants to know what to run next in the Compound Engi
34
34
  - `02-plan` — turn requirements into implementation units
35
35
  - `03-work` — execute the plan
36
36
  - `04-review` — review changes with structured findings
37
- - `05-compound` — capture learnings as solution artifacts
37
+ - `05-learn` — capture learnings as solution artifacts
@@ -26,18 +26,18 @@ If code changes have been made (detected by git diff) and no recent review exist
26
26
  - Recommend `04-review`
27
27
  - Reason: Implementation is done. Review the changes with structured findings.
28
28
 
29
- ## Rule 5: After review, compound
29
+ ## Rule 5: After review, learn
30
30
 
31
31
  If a review has been completed and `solutions.count` has not increased since the last workflow cycle:
32
- - Recommend `05-compound`
32
+ - Recommend `05-learn`
33
33
  - Reason: A review was completed. Capture key learnings as a durable solution artifact.
34
34
 
35
35
  ## Rule 6: All artifacts exist
36
36
 
37
37
  If brainstorm, plan, and solution all exist:
38
- - Recommend `05-compound` if no recent solution was added
38
+ - Recommend `05-learn` if no recent solution was added
39
39
  - Otherwise recommend `01-brainstorm` for a new cycle
40
- - Reason: A full loop may be complete. Either compound learnings or start a new cycle.
40
+ - Reason: A full loop may be complete. Either learn learnings or start a new cycle.
41
41
 
42
42
  ## Fallback
43
43
 
@@ -26,7 +26,7 @@ If `workflow_state` is not available, fall back to `bash` with `ls` and `find` t
26
26
  - If a recent brainstorm exists but there is no matching plan in `docs/plans/`, recommend `02-plan` next.
27
27
  - If a recent plan exists and implementation appears incomplete, recommend `03-work` next.
28
28
  - If code has changed after planning, recommend `04-review` next.
29
- - If a problem was just solved and there is no matching learning in `docs/solutions/`, recommend `05-compound` next.
29
+ - If a problem was just solved and there is no matching learning in `docs/solutions/`, recommend `05-learn` next.
30
30
  - If multiple artifacts exist, summarize them briefly and name the single best next step.
31
31
 
32
32
  ## Output format
@@ -13,7 +13,7 @@ Use this skill when the user asks how to use the package, which workflow step co
13
13
  - `02-plan` — use when requirements are clear enough to turn into implementation units. After planning, user can optionally run a CEO-style strategic review or strict review (error maps, failure modes, test diagrams).
14
14
  - `03-work` — use when there is a plan or a tightly scoped task ready for controlled execution.
15
15
  - `04-review` — use after code changes to produce structured findings. After code review, user can optionally extend to browser-based QA testing (find visual/functional bugs with agent-browser) and regression test generation.
16
- - `05-compound` — use after solving a problem so the repo gains a durable learning in `docs/solutions/`.
16
+ - `05-learn` — use after solving a problem so the repo gains a durable learning in `docs/solutions/`.
17
17
  - `08-status` — use when the user wants to know which artifact already exists and what the next workflow step should be.
18
18
 
19
19
  ## Recommended flow
@@ -29,7 +29,7 @@ Use this skill when the user asks how to use the package, which workflow step co
29
29
  4. Run `04-review` after implementation.
30
30
  - Optionally extend to **Browser QA** for visual and functional bug finding.
31
31
  - Or **Browser QA + Regression Tests** to also generate automated test coverage.
32
- 5. Capture key learnings with `05-compound`.
32
+ 5. Capture key learnings with `05-learn`.
33
33
  6. Use `08-status` at any point to inspect repo-local workflow state.
34
34
 
35
35
  ## Output
@@ -4,6 +4,6 @@
4
4
  2. `02-plan` → break it into concrete units (optionally + CEO Review / Strict Review)
5
5
  3. `03-work` → execute the plan
6
6
  4. `04-review` → inspect the changes (optionally + Browser QA / QA + Regression Tests)
7
- 5. `05-compound` → save key learnings
7
+ 5. `05-learn` → save key learnings
8
8
 
9
9
  Use `08-status` at any point to see where you are.
@@ -0,0 +1,49 @@
1
+ # Shared pipeline instructions
2
+
3
+ Use these rules in all Phase 1 skills: `01-brainstorm` → `02-plan` → `03-work` → `04-review` → `05-learn`.
4
+
5
+ ## Start of skill: model routing
6
+
7
+ Run this checklist before normal skill workflow:
8
+
9
+ 1. Read `.pi/settings.json` from the project root.
10
+ 2. Parse `modelStrategy` (if missing, skip switching).
11
+ 3. Resolve current stage key:
12
+ - `01-brainstorm`
13
+ - `02-plan`
14
+ - `03-work`
15
+ - `04-review`
16
+ - `05-learn`
17
+ 4. Pick `targetModel = modelStrategy[stageKey] ?? modelStrategy.default`.
18
+ 5. If `targetModel` exists and differs from the current model, run `/model <targetModel>`.
19
+ 6. If switching fails, continue with current model and mention the failure once.
20
+
21
+ ## End of skill: status + optional auto-continue
22
+
23
+ Before final completion, always output this block (replace placeholders with real values, never output angle-bracket placeholders literally):
24
+
25
+ ```
26
+ ---
27
+ 📊 Pipeline Status
28
+ - Current: <stageKey>
29
+ - Output: <main artifact path or N/A>
30
+ - Next: <next skill command or Completed>
31
+ ---
32
+ ```
33
+
34
+ Next step mapping:
35
+ - `01-brainstorm` → `/skill:02-plan`
36
+ - `02-plan` → `/skill:03-work`
37
+ - `03-work` → `/skill:04-review`
38
+ - `04-review` → `/skill:05-learn`
39
+ - `05-learn` → `Completed`
40
+
41
+ Then read `.pi/settings.json` → `pipeline.autoContinue`:
42
+ - If `false` or missing, stop after the status block and wait for user input.
43
+ - If current stage is `05-learn`, stop after status block.
44
+ - If `true` and current stage is not `05-learn`, auto-continue is allowed only after stage-specific gates are satisfied:
45
+ - `01-brainstorm`: user has explicitly approved the design handoff.
46
+ - `02-plan`: review choice is resolved (A/B/C flow completed) and user confirmed to proceed.
47
+ - `04-review`: optional QA choice is resolved (A/B/C flow completed) and user confirmed to proceed.
48
+ - Any unclear/ambiguous state: do not auto-continue; stop and ask.
49
+ - When gates are satisfied, automatically trigger the mapped next skill command.