@leing2021/super-pi 0.23.7 → 0.23.9

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
@@ -8,6 +8,8 @@
8
8
 
9
9
  **Turn your AI coding agent into a reliable engineer.**
10
10
 
11
+ Super Pi is a Pi-native engineering workflow layer: it adds stage discipline, durable artifacts, TDD gates, checkpoints, review, and learning loops on top of your coding agent. It is not a general-purpose multi-agent executor; subagents are optional helpers for bounded leaf tasks.
12
+
11
13
  Install, describe what you want to build, then keep saying "continue." Super Pi drives the full loop:
12
14
 
13
15
  **think → plan → build → review → compound learnings.**
@@ -23,7 +25,7 @@ pi install npm:@leing2021/super-pi
23
25
  - **Five-step loop** — brainstorm → plan → work → review → learn, with automatic skill routing
24
26
  - **Checkpoint resume** — interrupted? Resume from the exact unit you left off
25
27
  - **TDD enforcement** — every unit follows RED → GREEN → REFACTOR with hard gates
26
- - **Parallel execution** — independent units run concurrently via `ce_parallel_subagent`
28
+ - **Controlled subagents** — inline execution by default; subagents are limited to bounded, non-interactive leaf tasks
27
29
  - **Evidence-first review** — auto-assigned reviewers across five axes, autofix loop
28
30
  - **Knowledge compounding** — solved problems become searchable solution artifacts
29
31
  - **Token-efficient** — ~2,600 tokens new-conversation overhead; progressive loading
@@ -43,7 +45,7 @@ You: I want to build a CLI tool that helps indie devs find early users
43
45
 
44
46
  → 01-brainstorm: structured discovery → requirements artifact
45
47
  → 02-plan: TDD-gated implementation units → plan artifact
46
- → 03-work: parallel execution, checkpoint resume
48
+ → 03-work: inline-first execution, bounded subagents, checkpoint resume
47
49
  → 04-review: five-axis findings, autofix loop
48
50
  → 05-learn: knowledge compounding
49
51
 
@@ -71,7 +73,7 @@ You: /skill:03-work docs/plans/plan.md
71
73
  |-------|-------------|-----------|
72
74
  | **01-brainstorm** | Structured multi-round discovery | `brainstorm_dialog` |
73
75
  | **02-plan** | TDD-gated implementation units, optional CEO Review | `plan_diff` |
74
- | **03-work** | Parallel execution, checkpoint resume, strict TDD, stop-the-line | `ce_subagent`, `ce_parallel_subagent` |
76
+ | **03-work** | Inline-first execution, bounded subagents, checkpoint resume, strict TDD, stop-the-line | `ce_subagent`, `ce_parallel_subagent` |
75
77
  | **04-review** | Auto-assigned reviewers, five-axis findings, autofix loop | `review_router` |
76
78
  | **05-learn** | Pattern extraction → searchable solution artifacts | `pattern_extractor` |
77
79
  | **06-next** | Next-step recommendation + workflow status | `workflow_state` |
@@ -82,6 +84,8 @@ You: /skill:03-work docs/plans/plan.md
82
84
 
83
85
  Super Pi ships CE-specific tools named `ce_subagent` and `ce_parallel_subagent`. They are intentionally namespaced so they can coexist with the compatible third-party `pi-subagents` extension without tool-name collisions.
84
86
 
87
+ These tools are helpers, not the core workflow. Use inline execution by default. Use CE subagents only for bounded, non-interactive, easily verifiable leaf tasks. Do not use them to invoke pipeline-stage skills (`01-brainstorm` through `05-learn`); run those stages directly with `/skill:<stage>`.
88
+
85
89
  ### Model & Thinking Routing
86
90
 
87
91
  Configure in `.pi/settings.json`:
@@ -114,6 +118,7 @@ Super Pi is not a fork or wrapper. It extracts useful methods from the projects
114
118
  |---------|------------------------|
115
119
  | [addyosmani/agent-skills](https://github.com/addyosmani/agent-skills) | "Use when" skill trigger conditions, source-driven verification, stop-the-line hard gate, anti-rationalization, and the five-axis review baseline. Adopted as embedded micro-patterns only — no new skills, tools, commands, or agents. |
116
120
  | [everything-claude-code](https://github.com/affaan-m/everything-claude-code) | Parallel subagent orchestration, checkpoint resume, continuous learning loops, and token-conscious agent workflow design. |
121
+ | [humanlayer/12-factor-agents](https://github.com/humanlayer/12-factor-agents) | Context window ownership, compacting resolved errors, retry caps, and pre-fetching obvious prerequisites. Adopted as lightweight context hygiene rules inside the existing Phase 1 pipeline. |
117
122
  | [superpowers](https://github.com/obra/superpowers) | Strict TDD gates, design checklists, review discipline, and the idea that agents need hard gates instead of gentle suggestions. |
118
123
  | [compound-engineering-plugin](https://github.com/EveryInc/compound-engineering-plugin) | The five-step think → plan → build → review → learn loop and the knowledge-compounding backbone. |
119
124
  | [gstack](https://github.com/garrytan/gstack) | YC-style forcing questions, CEO Review cognitive frameworks, browser QA patterns, failure maps, and evidence-first validation. |
@@ -10,7 +10,7 @@ import {
10
10
  checkSubagentDepth,
11
11
  getChildDepthEnv,
12
12
  } from "./subagent-depth-guard"
13
- import type { SubagentExecOptions, SubagentRunner } from "./subagent"
13
+ import { assertNonPipelineStageSkill, type SubagentExecOptions, type SubagentRunner } from "./subagent"
14
14
 
15
15
  export interface ParallelSubagentTask {
16
16
  agent: string
@@ -52,6 +52,10 @@ export function createParallelSubagentTool() {
52
52
  throw new Error("ce_parallel_subagent requires at least one task")
53
53
  }
54
54
 
55
+ for (const task of input.tasks) {
56
+ assertNonPipelineStageSkill(task.agent, "ce_parallel_subagent")
57
+ }
58
+
55
59
  // Default: parallel workers get a slim context (no inherited skills)
56
60
  const inheritSkills = input.inheritSkills ?? false
57
61
  const execOptions = buildParallelExecOptions(inheritSkills)
@@ -41,6 +41,23 @@ export type SubagentRunner = (
41
41
  options?: SubagentExecOptions,
42
42
  ) => Promise<string>
43
43
 
44
+ const PIPELINE_STAGE_SKILLS = new Set([
45
+ "01-brainstorm",
46
+ "02-plan",
47
+ "03-work",
48
+ "04-review",
49
+ "05-learn",
50
+ ])
51
+
52
+ export function assertNonPipelineStageSkill(agent: string, toolName: string): void {
53
+ if (PIPELINE_STAGE_SKILLS.has(agent)) {
54
+ throw new Error(
55
+ `Pipeline-stage skill "${agent}" cannot run through ${toolName}. ` +
56
+ `Run it directly with /skill:${agent} instead.`,
57
+ )
58
+ }
59
+ }
60
+
44
61
  export function createSubagentTool() {
45
62
  return {
46
63
  name: "ce_subagent",
@@ -61,6 +78,7 @@ export function createSubagentTool() {
61
78
  const execOptions = buildExecOptions(input.inheritSkills)
62
79
 
63
80
  if (hasSingle) {
81
+ assertNonPipelineStageSkill(input.agent!, "ce_subagent")
64
82
  const prompt = buildPrompt(input.agent!, input.task!)
65
83
  const output = await runner(prompt, execOptions)
66
84
  return {
@@ -73,6 +91,7 @@ export function createSubagentTool() {
73
91
  let previous = ""
74
92
 
75
93
  for (const task of input.chain ?? []) {
94
+ assertNonPipelineStageSkill(task.agent, "ce_subagent")
76
95
  const prompt = buildPrompt(task.agent, task.task.replace(/\{previous\}/g, previous))
77
96
  const output = await runner(prompt, execOptions)
78
97
  outputs.push(output)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leing2021/super-pi",
3
- "version": "0.23.7",
3
+ "version": "0.23.9",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Pi-native Compound Engineering package for iterative development workflows",
@@ -20,9 +20,10 @@ See [shared pipeline instructions](../references/pipeline-config.md) for model r
20
20
  3. **Distinguish input:** plan path vs bare prompt
21
21
  4. Derive tasks from plan **implementation units**
22
22
  5. **Execution mode:**
23
- - **Inline mode** for small/scoped units
24
- - **`ce_parallel_subagent`** for independent CE skill units
25
- - **`ce_subagent`** only for dependent serial chains
23
+ - **Inline mode** is the default execution path
24
+ - **`ce_parallel_subagent`** only for bounded, non-interactive, easily verifiable leaf tasks
25
+ - **`ce_subagent`** only for rare dependent serial chains of leaf tasks
26
+ - Never use either tool to invoke pipeline-stage skills (`01-brainstorm through 05-learn`). Run those stages directly with `/skill:<stage>`.
26
27
  6. Use **`session_checkpoint`** to track progress and enable resume
27
28
  7. Use **`task_splitter`** to analyze dependencies before execution
28
29
  8. If in **worktree** (via `07-worktree`), execute inside it
@@ -57,6 +58,17 @@ Anti-rationalization — when a gate fails or evidence is missing:
57
58
 
58
59
  This is a hard gate — do not push past a failing test or broken build to continue implementation. Errors compound.
59
60
 
61
+ ## Error compaction after recovery
62
+
63
+ After a stop-the-line failure is diagnosed, fixed, and verified:
64
+
65
+ 1. Replace full traces in handoff/context with `ERROR(resolved): <root cause>`
66
+ 2. Keep only the final repro, root cause, fix summary, and verification result
67
+ 3. Remove intermediate debug output and failed exploratory runs that are no longer relevant
68
+ 4. Update `session_checkpoint` with the compacted state only
69
+
70
+ If the same tool, command, or implementation unit fails 3 consecutive times, stop retrying and ask the user for direction with a concise evidence summary.
71
+
60
72
  ## Workflow
61
73
 
62
74
  1. **Load context**: consume latest handoff before any broad file reads — `context_handoff load` or read `.context/compound-engineering/handoffs/latest.md`. If found, use `activeFiles`, `blocker`, `verification`, `activeRules` as starting point. If not found, proceed normally.
@@ -64,7 +76,7 @@ This is a hard gate — do not push past a failing test or broken build to conti
64
76
  3. Read implementation units if plan path
65
77
  4. Load `session_checkpoint` to skip completed units
66
78
  5. Use `task_splitter` for dependency analysis
67
- 6. Execute: **inline mode** by default, `ce_parallel_subagent` for independent units
79
+ 6. Execute: **inline mode** by default; use subagents only for bounded, non-interactive, easily verifiable leaf tasks
68
80
  7. Follow TDD per unit: RED → minimal code → GREEN → refactor → unit-level **verification**
69
81
  8. **Source-driven gate:** Before implementing framework/library-specific code, verify the API or pattern against official documentation. Flag unverified patterns as UNVERIFIED in output.
70
82
  9. Record progress via `references/progress-update-format.md`
@@ -29,6 +29,15 @@ Before reading any project files or running repository-wide scans, load the most
29
29
 
30
30
  Core principle: **consume handoff before broad project file reads** — a single handoff read (~500 tokens) avoids 5-10 project file scans (~5K-10K tokens).
31
31
 
32
+ ## Context hygiene rules
33
+
34
+ Applies to all Phase 1 skills when preparing context or saving handoff.
35
+
36
+ 1. **Compact resolved errors** — Once an error is diagnosed, fixed, and verified, do not carry the full trace forward. Replace it with `ERROR(resolved): <root cause>` and keep repro/verification only if still relevant.
37
+ 2. **Fetch obvious prerequisites** — If the next step has an obvious deterministic prerequisite, fetch it before reasoning further instead of spending an LLM round trip asking for it.
38
+ 3. **Cap repeated failures** — After 3 consecutive failures on the same tool, command, or implementation unit, stop retrying. Summarize evidence and ask the user for direction.
39
+ 4. **Prune before handoff** — Before saving handoff, keep only what the next stage needs. Move broad history to artifact paths; remove intermediate debug output that is no longer relevant.
40
+
32
41
  ## End of skill: save handoff + status + context
33
42
 
34
43
  Every Phase 1 skill (02-plan through 05-learn) must save context handoff at completion: