@leing2021/super-pi 0.23.11 → 0.23.12

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
@@ -71,7 +71,7 @@ You: /skill:03-work docs/plans/plan.md
71
71
 
72
72
  | Skill | What it does | Core tool |
73
73
  |-------|-------------|-----------|
74
- | **01-brainstorm** | Structured multi-round discovery | `brainstorm_dialog` |
74
+ | **01-brainstorm** | Structured multi-round discovery, domain vocabulary persistence | `brainstorm_dialog` |
75
75
  | **02-plan** | TDD-gated implementation units, optional CEO Review | `plan_diff` |
76
76
  | **03-work** | Inline-first execution, bounded subagents, checkpoint resume, strict TDD, stop-the-line | `ce_subagent`, `ce_parallel_subagent` |
77
77
  | **04-review** | Auto-assigned reviewers, five-axis findings, autofix loop | `review_router` |
@@ -122,6 +122,7 @@ Super Pi is not a fork or wrapper. It extracts useful methods from the projects
122
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. |
123
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. |
124
124
  | [gstack](https://github.com/garrytan/gstack) | YC-style forcing questions, CEO Review cognitive frameworks, browser QA patterns, failure maps, and evidence-first validation. |
125
+ | [mattpocock/skills](https://github.com/mattpocock/skills) | Context glossary (`CONTEXT.md`) for cross-session term persistence, lightweight ADR with three-condition threshold, and feedback-loop-first debug discipline. Adopted as reference templates embedded into existing skills — no new skills or tools. |
125
126
 
126
127
  ---
127
128
 
@@ -133,8 +134,8 @@ When an unexpected failure occurs during `03-work`:
133
134
 
134
135
  1. **STOP** adding features
135
136
  2. **PRESERVE** evidence
136
- 3. **DIAGNOSE** root cause
137
- 4. **FIX** the root cause
137
+ 3. **DIAGNOSE** root cause — build a feedback loop first, then reproduce → hypothesise → instrument → fix
138
+ 4. **FIX** the root cause, not the symptom
138
139
  5. **GUARD** with a regression test
139
140
  6. **RESUME** only after verification passes
140
141
 
@@ -173,6 +174,7 @@ your-project/
173
174
  ├── docs/
174
175
  │ ├── brainstorms/ # Requirements
175
176
  │ ├── plans/ # Execution plans
177
+ │ ├── adr/ # Architecture decisions (lazy)
176
178
  │ └── solutions/ # Knowledge cards
177
179
  └── .context/
178
180
  └── compound-engineering/
@@ -130,7 +130,7 @@ function createSubagentRunner(
130
130
  prompt,
131
131
  agent: "",
132
132
  task: "",
133
- cwd: pi.cwd ?? process.cwd(),
133
+ cwd: (pi as any).cwd ?? process.cwd(),
134
134
  extraFlags: options?.extraFlags,
135
135
  extraEnv: options?.extraEnv,
136
136
  signal,
@@ -503,7 +503,7 @@ export default function ceCoreExtension(pi: ExtensionAPI) {
503
503
  inheritSkills: params.inheritSkills,
504
504
  },
505
505
  createSubagentRunner(pi, signal),
506
- { onUpdate },
506
+ { onUpdate: onUpdate ? (details) => onUpdate({ content: [], details }) : undefined },
507
507
  )
508
508
 
509
509
  // Build final content from results
@@ -623,7 +623,7 @@ export default function ceCoreExtension(pi: ExtensionAPI) {
623
623
  inheritSkills: params.inheritSkills,
624
624
  },
625
625
  createSubagentRunner(pi, signal),
626
- { onUpdate },
626
+ { onUpdate: onUpdate ? (details) => onUpdate({ content: [], details }) : undefined },
627
627
  )
628
628
 
629
629
  // Build compact summary content for LLM consumption
@@ -654,12 +654,14 @@ export default function ceCoreExtension(pi: ExtensionAPI) {
654
654
  }
655
655
  },
656
656
  renderCall(args, theme, _context) {
657
- return renderSubagentCall(args, theme)
657
+ return renderSubagentCall({
658
+ tasks: typeof args.tasks === "string" ? [] : args.tasks,
659
+ }, theme)
658
660
  },
659
661
  renderResult(result, renderContext, theme, _context) {
660
662
  // Handle partial updates where data is at top level (from onUpdate)
661
663
  // rather than nested in .details (from final result return value)
662
- const data = (result.details || result) as SubagentLiveDetails
664
+ const data = (result.details || result) as ParallelSubagentLiveDetails
663
665
  return renderSubagentResult(data, renderContext, theme)
664
666
  },
665
667
  })
@@ -20,11 +20,13 @@ import {
20
20
  getFinalOutput,
21
21
  makeFailedResult,
22
22
  invokeRunner,
23
+ type AnyRunner,
23
24
  } from "./subagent-events"
24
25
  import {
25
26
  assertNonPipelineStageSkill,
26
27
  type SubagentLiveRunner,
27
28
  type SubagentLiveExecOptions,
29
+ type SubagentRunner,
28
30
  } from "./subagent"
29
31
 
30
32
  // ---------------------------------------------------------------------------
@@ -88,7 +90,7 @@ export function createParallelSubagentTool() {
88
90
 
89
91
  async execute(
90
92
  input: ParallelSubagentInput,
91
- runner: SubagentLiveRunner,
93
+ runner: SubagentLiveRunner | SubagentRunner,
92
94
  toolCtx?: { onUpdate?: (details: ParallelSubagentLiveDetails) => void },
93
95
  ): Promise<ParallelSubagentLiveDetails> {
94
96
  // Recursion depth guard
@@ -381,8 +381,8 @@ function renderParallelResult(
381
381
  const icon = theme.fg("warning", "⏳")
382
382
  const bar = renderProgressBar(doneCount, results.length, theme)
383
383
  const doneLabel = failCount > 0
384
- ? theme.fg("success", `${successCount}✓`) + " " + theme.fg("error", `${failCount}✗`)
385
- : theme.fg("success", `${successCount}✓`)
384
+ ? theme.fg("success", `${doneCount}/${results.length}✓`) + " " + theme.fg("error", `${failCount}✗`)
385
+ : theme.fg("success", `${doneCount}/${results.length}✓`)
386
386
  const runningLabel = theme.fg("dim", `, ${running} running...`)
387
387
  return new Text(`${icon} ${bar} ${doneLabel}${runningLabel}`, 0, 0)
388
388
  }
@@ -35,7 +35,7 @@ export interface SubagentInput {
35
35
  }
36
36
 
37
37
  export interface SubagentLiveDetails {
38
- mode: "single" | "chain"
38
+ mode: "single" | "chain" | "parallel"
39
39
  results: SingleResult[]
40
40
  }
41
41
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leing2021/super-pi",
3
- "version": "0.23.11",
3
+ "version": "0.23.12",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Pi-native Compound Engineering package for iterative development workflows",
@@ -59,6 +59,15 @@ Before summarizing, ensure the design answers:
59
59
  - What can fail, and how?
60
60
  - How will we verify success?
61
61
 
62
+ ## Domain vocabulary (optional)
63
+
64
+ After mode-specific questions, check if the project has a `CONTEXT.md` at root.
65
+ If not, and the brainstorm reveals 3+ domain-specific terms with ambiguous meanings,
66
+ offer to create one using `references/context-glossary.md`. Update it inline during
67
+ the session — don't batch. If it exists, cross-reference and flag conflicts:
68
+
69
+ > "Your CONTEXT.md defines 'cancellation' as X, but you seem to mean Y — which is it?"
70
+
62
71
  ## Stop conditions
63
72
 
64
73
  Stop and ask instead of guessing when: requirements conflict, success criteria unclear, task spans multiple systems, or user hasn't approved design.
@@ -70,15 +79,17 @@ Stop and ask instead of guessing when: requirements conflict, success criteria u
70
79
  ## Workflow
71
80
 
72
81
  1. Scan repository for nearby context
73
- 2. Determine mode (Startup / Builder / CE)
74
- 3. Run mode-specific questions (use reference files)
75
- 4. Run Premise Challenge
76
- 5. Generate 2-3 alternatives (minimal viable + ideal architecture)
77
- 6. Validate against design checklist
78
- 7. Use `brainstorm_dialog` `summarize` to finalize
79
- 8. Capture requirements in `docs/brainstorms/`
80
- 9. Get explicit user approval
81
- 10. Handoff to `02-plan` using `references/handoff.md`
82
+ 2. Check for existing `CONTEXT.md` at repo root
83
+ 3. Determine mode (Startup / Builder / CE)
84
+ 4. Run mode-specific questions (use reference files)
85
+ 5. Run Premise Challenge
86
+ 6. Generate 2-3 alternatives (minimal viable + ideal architecture)
87
+ 7. Validate against design checklist
88
+ 8. Offer to create/update `CONTEXT.md` if domain terms emerged
89
+ 9. Use `brainstorm_dialog` `summarize` to finalize
90
+ 10. Capture requirements in `docs/brainstorms/`
91
+ 11. Get explicit user approval
92
+ 12. Handoff to `02-plan` using `references/handoff.md`
82
93
 
83
94
  ## Artifact contract
84
95
 
@@ -0,0 +1,46 @@
1
+ # Context Glossary
2
+
3
+ An optional project vocabulary file that persists domain terms across sessions.
4
+
5
+ ## When to create
6
+
7
+ Create `CONTEXT.md` at repo root **only when** the brainstorm reveals 3+ domain-specific terms
8
+ that have ambiguous or overloaded meanings. Skip for trivial features.
9
+
10
+ ## Format
11
+
12
+ ```md
13
+ # {Project Name}
14
+
15
+ ## Language
16
+
17
+ **Term**: One-sentence definition.
18
+ _Avoid_: aliases to discourage
19
+
20
+ **Term2**: One-sentence definition.
21
+ _Avoid_: aliases to discourage
22
+
23
+ ## Relationships
24
+
25
+ - **Term** contains many **Term2**
26
+
27
+ ## Example
28
+
29
+ > Dev: "The materialization cascade is failing."
30
+ > Domain expert: "You mean when a lesson gets a filesystem path?"
31
+ > Dev: "Yes — 'materialization cascade' is our term for that flow."
32
+ ```
33
+
34
+ ## Rules
35
+
36
+ - One definition per term, 1-2 sentences max. Define what it IS, not what it does.
37
+ - Pick one canonical term, list alternatives as _Avoid_.
38
+ - Only project-specific concepts — general programming terms don't belong.
39
+ - Flag ambiguities explicitly.
40
+ - No implementation details. This is a glossary, not a spec.
41
+
42
+ ## Multiple bounded contexts
43
+
44
+ If the project has clearly separated domains (e.g. ordering vs billing), create a
45
+ `CONTEXT-MAP.md` at root that lists each context and its `CONTEXT.md` location.
46
+ Most projects need only a single root `CONTEXT.md`.
@@ -23,3 +23,8 @@ Describe the chosen direction and why it is the best fit.
23
23
  ## Success criteria
24
24
 
25
25
  List the concrete outcomes that would mean this work succeeded.
26
+
27
+ ## Domain vocabulary
28
+
29
+ List any canonical terms established during this session.
30
+ If a `CONTEXT.md` was created or updated, link it here.
@@ -0,0 +1,43 @@
1
+ # ADR Template
2
+
3
+ Lightweight Architecture Decision Records. Only create when ALL THREE are true:
4
+
5
+ 1. **Hard to reverse** — changing your mind later costs meaningfully
6
+ 2. **Surprising without context** — a future reader will wonder "why this way?"
7
+ 3. **Real trade-off** — genuine alternatives existed and you picked one for a reason
8
+
9
+ If any is missing, skip the ADR.
10
+
11
+ ## File location
12
+
13
+ `docs/adr/0001-slug.md`, sequential numbering. Create `docs/adr/` lazily.
14
+
15
+ ## Template
16
+
17
+ ```md
18
+ # {Short title}
19
+
20
+ {1-3 sentences: context, decision, and why.}
21
+ ```
22
+
23
+ That's it. A single paragraph is fine. The value is recording THAT a decision was made and WHY.
24
+
25
+ ## Optional sections
26
+
27
+ Only when they add genuine value:
28
+ - **Considered Options** — when rejected alternatives are worth remembering
29
+ - **Consequences** — when downstream effects are non-obvious
30
+
31
+ ## What qualifies
32
+
33
+ - Architectural shape (monorepo, event-sourced, etc.)
34
+ - Technology choices with lock-in (database, message bus, auth provider)
35
+ - Boundary/scope decisions
36
+ - Deliberate deviations from the obvious path
37
+ - Constraints not visible in code (compliance, latency SLA)
38
+
39
+ ## What doesn't qualify
40
+
41
+ - Easy-to-reverse decisions — just reverse them
42
+ - Obvious choices — nobody will wonder why
43
+ - No real alternative — nothing to record
@@ -12,6 +12,11 @@ List the relevant prior artifacts from `docs/solutions/`.
12
12
 
13
13
  Define what is in and out of scope.
14
14
 
15
+ ## Architecture decisions
16
+
17
+ List any decisions that meet the ADR threshold (see `references/adr-template.md`).
18
+ Link to `docs/adr/XXXX-slug.md` if created. If none qualify, state "No ADR-worthy decisions."
19
+
15
20
  ## Implementation units
16
21
 
17
22
  Break the work into execution-ready units.
@@ -46,7 +46,7 @@ When any unexpected failure occurs during execution:
46
46
 
47
47
  1. **STOP** adding features or making changes
48
48
  2. **PRESERVE** evidence (error output, repro steps)
49
- 3. **DIAGNOSE** root cause — reproduce, localize, reduce
49
+ 3. **DIAGNOSE** root cause — follow debug discipline (`references/debug-discipline.md`): build feedback loop first, then reproduce → hypothesise → instrument → fix
50
50
  4. **FIX** the root cause, not the symptom
51
51
  5. **GUARD** with a regression test
52
52
  6. **RESUME** only after verification passes
@@ -0,0 +1,53 @@
1
+ # Debug Discipline
2
+
3
+ When stop-the-line triggers, follow this order. Skip phases only when explicitly justified.
4
+
5
+ ## Phase 1 — Build a feedback loop
6
+
7
+ **This is the skill. Everything else is mechanical.**
8
+
9
+ If you have a fast, deterministic, agent-runnable pass/fail signal, you will find the cause.
10
+ If you don't, no amount of staring at code will save you. Spend disproportionate effort here.
11
+
12
+ ### Strategies (try in order)
13
+
14
+ 1. **Failing test** at the seam closest to the bug
15
+ 2. **CLI invocation** with fixture input, diff against known-good output
16
+ 3. **Curl/HTTP script** against running dev server
17
+ 4. **Throwaway harness** — minimal subset exercising the bug path
18
+ 5. **Bisection** — `git bisect run` between known-good and known-bad states
19
+
20
+ ### Iterate on the loop itself
21
+
22
+ - Faster? (Skip unrelated setup, narrow scope)
23
+ - Sharper signal? (Assert the specific symptom, not "didn't crash")
24
+ - More deterministic? (Pin time, seed RNG, isolate filesystem)
25
+
26
+ A 2-second deterministic loop is a debugging superpower.
27
+ A 30-second flaky loop is barely better than no loop.
28
+
29
+ ## Phase 2 — Reproduce
30
+
31
+ Confirm the loop produces the **user-described** failure, not a different nearby failure.
32
+
33
+ ## Phase 3 — Hypothesise
34
+
35
+ Generate 3-5 ranked hypotheses. Each must be falsifiable:
36
+
37
+ > "If <X> is the cause, then <Y> will make the bug disappear."
38
+
39
+ Show the ranked list to the user before testing. They often have domain knowledge
40
+ that re-ranks instantly.
41
+
42
+ ## Phase 4 — Instrument
43
+
44
+ One probe per hypothesis. Change one variable at a time.
45
+
46
+ Tag debug logs with unique prefixes (e.g. `[DEBUG-a4f2]`) so cleanup is a single grep.
47
+
48
+ ## Phase 5 — Fix + regression test
49
+
50
+ Write regression test BEFORE the fix — but only if a correct seam exists.
51
+ If no correct seam exists, that itself is the finding. Note it.
52
+
53
+ After fix: remove all debug instrumentation (grep for tags).