@leing2021/super-pi 0.22.1 → 0.23.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.
Files changed (117) hide show
  1. package/README.md +66 -293
  2. package/extensions/ce-core/index.ts +276 -48
  3. package/extensions/ce-core/tools/parallel-subagent.ts +3 -3
  4. package/extensions/ce-core/tools/subagent.ts +2 -2
  5. package/package.json +4 -20
  6. package/rules/common/naming.md +154 -0
  7. package/skills/01-brainstorm/SKILL.md +42 -79
  8. package/skills/01-brainstorm/references/ce-brainstorm-mode.md +47 -0
  9. package/skills/02-plan/SKILL.md +43 -61
  10. package/skills/02-plan/references/solution-search.md +46 -0
  11. package/skills/03-work/SKILL.md +34 -52
  12. package/skills/03-work/references/completion-report.md +51 -0
  13. package/skills/04-review/SKILL.md +44 -51
  14. package/skills/04-review/references/solution-search.md +46 -0
  15. package/skills/06-next/SKILL.md +35 -20
  16. package/skills/06-next/references/recommendation-logic.md +47 -2
  17. package/skills/07-worktree/SKILL.md +21 -20
  18. package/skills/08-help/SKILL.md +46 -0
  19. package/skills/08-help/references/workflow-sequence.md +135 -0
  20. package/skills/references/language-detection.md +44 -0
  21. package/LICENSE +0 -21
  22. package/THIRD-PARTY-NOTICES.md +0 -35
  23. package/extensions/subagent/__tests__/async-job-tracker.test.ts +0 -21
  24. package/extensions/subagent/__tests__/execution-activity.test.ts +0 -15
  25. package/extensions/subagent/__tests__/parallel-render-stress.test.ts +0 -82
  26. package/extensions/subagent/__tests__/render-dedup.test.ts +0 -98
  27. package/extensions/subagent/__tests__/render-widget.test.ts +0 -28
  28. package/extensions/subagent/__tests__/throttle.test.ts +0 -90
  29. package/extensions/subagent/agent-management.ts +0 -596
  30. package/extensions/subagent/agent-manager-chain-detail.ts +0 -163
  31. package/extensions/subagent/agent-manager-detail.ts +0 -232
  32. package/extensions/subagent/agent-manager-edit.ts +0 -391
  33. package/extensions/subagent/agent-manager-list.ts +0 -279
  34. package/extensions/subagent/agent-manager-parallel.ts +0 -305
  35. package/extensions/subagent/agent-manager.ts +0 -706
  36. package/extensions/subagent/agent-scope.ts +0 -9
  37. package/extensions/subagent/agent-selection.ts +0 -26
  38. package/extensions/subagent/agent-serializer.ts +0 -124
  39. package/extensions/subagent/agent-templates.ts +0 -63
  40. package/extensions/subagent/agents/context-builder.md +0 -37
  41. package/extensions/subagent/agents/delegate.md +0 -9
  42. package/extensions/subagent/agents/oracle.md +0 -73
  43. package/extensions/subagent/agents/planner.md +0 -52
  44. package/extensions/subagent/agents/researcher.md +0 -50
  45. package/extensions/subagent/agents/reviewer.md +0 -38
  46. package/extensions/subagent/agents/scout.md +0 -48
  47. package/extensions/subagent/agents/worker.md +0 -52
  48. package/extensions/subagent/agents.ts +0 -762
  49. package/extensions/subagent/artifacts.ts +0 -101
  50. package/extensions/subagent/async-execution.ts +0 -521
  51. package/extensions/subagent/async-job-tracker.ts +0 -240
  52. package/extensions/subagent/async-status.ts +0 -242
  53. package/extensions/subagent/chain-clarify.ts +0 -1365
  54. package/extensions/subagent/chain-execution.ts +0 -854
  55. package/extensions/subagent/chain-serializer.ts +0 -127
  56. package/extensions/subagent/completion-dedupe.ts +0 -66
  57. package/extensions/subagent/doctor.ts +0 -201
  58. package/extensions/subagent/execution.ts +0 -748
  59. package/extensions/subagent/file-coalescer.ts +0 -43
  60. package/extensions/subagent/fork-context.ts +0 -64
  61. package/extensions/subagent/formatters.ts +0 -123
  62. package/extensions/subagent/frontmatter.ts +0 -32
  63. package/extensions/subagent/index.ts +0 -586
  64. package/extensions/subagent/intercom-bridge.ts +0 -241
  65. package/extensions/subagent/jsonl-writer.ts +0 -84
  66. package/extensions/subagent/model-fallback.ts +0 -109
  67. package/extensions/subagent/notify.ts +0 -111
  68. package/extensions/subagent/parallel-utils.ts +0 -109
  69. package/extensions/subagent/pi-args.ts +0 -139
  70. package/extensions/subagent/pi-spawn.ts +0 -101
  71. package/extensions/subagent/post-exit-stdio-guard.ts +0 -88
  72. package/extensions/subagent/prompt-template-bridge.ts +0 -400
  73. package/extensions/subagent/prompts/gather-context-and-clarify.md +0 -13
  74. package/extensions/subagent/prompts/parallel-cleanup.md +0 -42
  75. package/extensions/subagent/prompts/parallel-research.md +0 -50
  76. package/extensions/subagent/prompts/parallel-review.md +0 -40
  77. package/extensions/subagent/render-helpers.ts +0 -83
  78. package/extensions/subagent/render.ts +0 -908
  79. package/extensions/subagent/result-intercom.ts +0 -238
  80. package/extensions/subagent/result-watcher.ts +0 -172
  81. package/extensions/subagent/run-history.ts +0 -58
  82. package/extensions/subagent/run-status.ts +0 -137
  83. package/extensions/subagent/schemas.ts +0 -165
  84. package/extensions/subagent/session-tokens.ts +0 -51
  85. package/extensions/subagent/settings.ts +0 -368
  86. package/extensions/subagent/single-output.ts +0 -98
  87. package/extensions/subagent/skills.ts +0 -627
  88. package/extensions/subagent/slash-bridge.ts +0 -177
  89. package/extensions/subagent/slash-commands.ts +0 -304
  90. package/extensions/subagent/slash-live-state.ts +0 -295
  91. package/extensions/subagent/subagent-control.ts +0 -151
  92. package/extensions/subagent/subagent-executor.ts +0 -1915
  93. package/extensions/subagent/subagent-prompt-runtime.ts +0 -76
  94. package/extensions/subagent/subagent-runner.ts +0 -1471
  95. package/extensions/subagent/subagents-status.ts +0 -473
  96. package/extensions/subagent/text-editor.ts +0 -273
  97. package/extensions/subagent/throttle.ts +0 -77
  98. package/extensions/subagent/top-level-async.ts +0 -16
  99. package/extensions/subagent/types.ts +0 -624
  100. package/extensions/subagent/utils.ts +0 -457
  101. package/extensions/subagent/worktree.ts +0 -580
  102. package/extensions/super-pi-extension/agents/ce-oracle.md +0 -109
  103. package/extensions/super-pi-extension/agents/ce-planner.md +0 -116
  104. package/extensions/super-pi-extension/agents/ce-reviewer.md +0 -99
  105. package/extensions/super-pi-extension/agents/ce-scout.md +0 -80
  106. package/extensions/super-pi-extension/agents/ce-worker.md +0 -78
  107. package/extensions/super-pi-extension/chains/ce-parallel-review.chain.md +0 -34
  108. package/extensions/super-pi-extension/chains/ce-review-only.chain.md +0 -12
  109. package/extensions/super-pi-extension/chains/ce-standard.chain.md +0 -28
  110. package/extensions/super-pi-extension/index.ts +0 -129
  111. package/extensions/super-pi-extension/model-sync.ts +0 -204
  112. package/skills/08-status/SKILL.md +0 -41
  113. package/skills/08-status/references/artifact-locations.md +0 -10
  114. package/skills/09-help/SKILL.md +0 -37
  115. package/skills/09-help/references/workflow-sequence.md +0 -9
  116. package/skills/10-rules/SKILL.md +0 -76
  117. package/skills/pi-subagents/SKILL.md +0 -566
@@ -1,204 +0,0 @@
1
- /**
2
- * CE Model & Thinking Strategy Bridge
3
- *
4
- * 同步 super-pi 的 modelStrategy 和 thinkingStrategy 到 pi-subagents 的 agentOverrides
5
- * 确保阶段模型和 thinking 等级自动应用到对应的 CE Agent
6
- */
7
-
8
- import * as fs from "node:fs";
9
- import * as path from "node:path";
10
- import * as os from "node:os";
11
-
12
- // CE Stage to Agent mapping
13
- const STAGE_AGENT_MAP: Record<string, string[]> = {
14
- "01-brainstorm": ["ce-scout", "ce-researcher"],
15
- "02-plan": ["ce-planner"],
16
- "03-work": ["ce-worker"],
17
- "04-review": ["ce-reviewer"],
18
- "05-learn": ["ce-oracle"],
19
- };
20
-
21
- // Default fallback
22
- const DEFAULT_MODEL = "claude-sonnet-4-20250514";
23
- const DEFAULT_THINKING = "medium";
24
-
25
- export interface ModelStrategyConfig {
26
- [stage: string]: string;
27
- }
28
-
29
- export interface ThinkingStrategyConfig {
30
- [stage: string]: string;
31
- }
32
-
33
- export interface SubagentAgentOverride {
34
- model?: string;
35
- thinking?: string;
36
- }
37
-
38
- export interface SubagentConfig {
39
- agentOverrides?: Record<string, SubagentAgentOverride>;
40
- }
41
-
42
- export interface Settings {
43
- modelStrategy?: ModelStrategyConfig;
44
- thinkingStrategy?: ThinkingStrategyConfig;
45
- subagents?: SubagentConfig;
46
- [key: string]: unknown;
47
- }
48
-
49
- /**
50
- * Read settings from file
51
- */
52
- export function readSettings(filePath: string): Settings {
53
- if (!fs.existsSync(filePath)) return {};
54
- try {
55
- return JSON.parse(fs.readFileSync(filePath, "utf-8"));
56
- } catch {
57
- return {};
58
- }
59
- }
60
-
61
- /**
62
- * Write settings to file
63
- */
64
- export function writeSettings(filePath: string, settings: Settings): void {
65
- fs.mkdirSync(path.dirname(filePath), { recursive: true });
66
- fs.writeFileSync(filePath, JSON.stringify(settings, null, 2) + "\n", "utf-8");
67
- }
68
-
69
- /**
70
- * Sync modelStrategy and thinkingStrategy to subagents.agentOverrides
71
- *
72
- * This ensures that when pi-subagents runs a CE agent,
73
- * it uses the model and thinking level configured for that stage.
74
- */
75
- export function syncStrategiesToAgentOverrides(settings: Settings): Settings {
76
- const modelStrategy = settings.modelStrategy;
77
- const thinkingStrategy = settings.thinkingStrategy;
78
-
79
- if (!modelStrategy && !thinkingStrategy) return settings;
80
-
81
- // Initialize subagents if not present
82
- const subagents = settings.subagents || { agentOverrides: {} };
83
- const agentOverrides = subagents.agentOverrides || {};
84
-
85
- // Build stage-based override for each agent
86
- for (const [stage, agents] of Object.entries(STAGE_AGENT_MAP)) {
87
- const model = modelStrategy?.[stage];
88
- const thinking = thinkingStrategy?.[stage];
89
-
90
- if (model || thinking) {
91
- for (const agent of agents) {
92
- agentOverrides[agent] = {
93
- ...agentOverrides[agent],
94
- ...(model ? { model } : {}),
95
- ...(thinking ? { thinking } : {}),
96
- };
97
- }
98
- }
99
- }
100
-
101
- return {
102
- ...settings,
103
- subagents: {
104
- ...subagents,
105
- agentOverrides,
106
- },
107
- };
108
- }
109
-
110
- /**
111
- * Get the effective model for a stage
112
- */
113
- export function getStageModel(stage: string, settings: Settings): string {
114
- if (settings.modelStrategy?.[stage]) {
115
- return settings.modelStrategy[stage];
116
- }
117
-
118
- const agents = STAGE_AGENT_MAP[stage];
119
- if (agents && settings.subagents?.agentOverrides) {
120
- for (const agent of agents) {
121
- const override = settings.subagents.agentOverrides[agent];
122
- if (override?.model) {
123
- return override.model;
124
- }
125
- }
126
- }
127
-
128
- return settings.modelStrategy?.default || DEFAULT_MODEL;
129
- }
130
-
131
- /**
132
- * Get the effective thinking level for a stage
133
- */
134
- export function getStageThinking(stage: string, settings: Settings): string {
135
- if (settings.thinkingStrategy?.[stage]) {
136
- return settings.thinkingStrategy[stage];
137
- }
138
-
139
- const agents = STAGE_AGENT_MAP[stage];
140
- if (agents && settings.subagents?.agentOverrides) {
141
- for (const agent of agents) {
142
- const override = settings.subagents.agentOverrides[agent];
143
- if (override?.thinking) {
144
- return override.thinking;
145
- }
146
- }
147
- }
148
-
149
- return DEFAULT_THINKING;
150
- }
151
-
152
- /**
153
- * Auto-sync settings on startup
154
- */
155
- export function autoSyncSettings(projectRoot?: string): { home: boolean; project: boolean } {
156
- const homeSettingsPath = path.join(os.homedir(), ".pi", "agent", "settings.json");
157
- const projectSettingsPath = projectRoot
158
- ? path.join(projectRoot, ".pi", "settings.json")
159
- : null;
160
-
161
- let homeSynced = false;
162
- let projectSynced = false;
163
-
164
- // Sync home settings
165
- const homeSettings = readSettings(homeSettingsPath);
166
- const syncedHome = syncStrategiesToAgentOverrides(homeSettings);
167
- if (JSON.stringify(homeSettings) !== JSON.stringify(syncedHome)) {
168
- writeSettings(homeSettingsPath, syncedHome);
169
- homeSynced = true;
170
- console.log("[super-pi-extension] Synced modelStrategy + thinkingStrategy to agentOverrides");
171
- }
172
-
173
- // Sync project settings
174
- if (projectSettingsPath && fs.existsSync(projectSettingsPath)) {
175
- const projectSettings = readSettings(projectSettingsPath);
176
- const syncedProject = syncStrategiesToAgentOverrides(projectSettings);
177
- if (JSON.stringify(projectSettings) !== JSON.stringify(syncedProject)) {
178
- writeSettings(projectSettingsPath, syncedProject);
179
- projectSynced = true;
180
- console.log("[super-pi-extension] Synced modelStrategy + thinkingStrategy (project)");
181
- }
182
- }
183
-
184
- return { home: homeSynced, project: projectSynced };
185
- }
186
-
187
- /**
188
- * CLI helper to sync settings
189
- */
190
- export function syncSettingsCli(): void {
191
- const cwd = process.cwd();
192
- const result = autoSyncSettings(cwd);
193
- if (result.home || result.project) {
194
- console.log("[super-pi-extension] Settings synced successfully");
195
- } else {
196
- console.log("[super-pi-extension] No settings needed syncing");
197
- }
198
- }
199
-
200
- // Run if called directly
201
- const isMain = process.argv[1] && process.argv[1].endsWith("model-sync.ts");
202
- if (isMain) {
203
- syncSettingsCli();
204
- }
@@ -1,41 +0,0 @@
1
- ---
2
- name: 08-status
3
- description: Inspect repo-local workflow artifacts and recommend the next Compound Engineering step.
4
- ---
5
-
6
- # Status
7
-
8
- Use this skill when the user wants to know the current state of the Compound Engineering workflow in this repository.
9
-
10
- ## What to scan
11
-
12
- Use the `workflow_state` tool to get structured artifact state. It scans these repo-local locations:
13
-
14
- - `docs/brainstorms/`
15
- - `docs/plans/`
16
- - `docs/solutions/`
17
- - `.context/compound-engineering/`
18
-
19
- Use the `session_history` tool to check recent CE skill executions and their outcomes.
20
-
21
- If `workflow_state` is not available, fall back to `bash` with `ls` and `find` to check which directories and recent files exist, then use `read` on the most relevant recent artifact.
22
-
23
- ## Recommendation logic
24
-
25
- - If there is no recent `docs/brainstorms/` artifact and the request is still ambiguous, recommend `01-brainstorm` next.
26
- - If a recent brainstorm exists but there is no matching plan in `docs/plans/`, recommend `02-plan` next.
27
- - If a recent plan exists and implementation appears incomplete, recommend `03-work` next.
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-learn` next.
30
- - If multiple artifacts exist, summarize them briefly and name the single best next step.
31
-
32
- ## Output format
33
-
34
- Return:
35
-
36
- - latest relevant brainstorm
37
- - latest relevant plan
38
- - latest relevant solution
39
- - latest relevant runtime artifact under `.context/compound-engineering/`
40
- - recommended next step
41
- - why this is the next step
@@ -1,10 +0,0 @@
1
- # Artifact Locations
2
-
3
- | Artifact | Path |
4
- |---|---|
5
- | Brainstorm | `docs/brainstorms/` |
6
- | Plan | `docs/plans/` |
7
- | Solution | `docs/solutions/` |
8
- | Runtime | `.context/compound-engineering/` |
9
-
10
- Use `bash` with `ls` and `find` to scan these paths.
@@ -1,37 +0,0 @@
1
- ---
2
- name: 09-help
3
- description: Explain when to use each Compound Engineering Phase 1 skill and how they connect.
4
- ---
5
-
6
- # Help
7
-
8
- Use this skill when the user asks how to use the package, which workflow step comes next, or which Compound Engineering skill fits the current task.
9
-
10
- ## Phase 1 skill guide
11
-
12
- - `01-brainstorm` — use when the request is ambiguous, needs requirements discovery, or the user has a new idea. Three modes: CE requirements discovery (adding features), Startup Diagnostic (YC-style forcing questions for new products/startups), Builder Mode (side projects, hackathons, learning).
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
- - `03-work` — use when there is a plan or a tightly scoped task ready for controlled execution.
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-learn` — use after solving a problem so the repo gains a durable learning in `docs/solutions/`.
17
- - `08-status` — use when the user wants to know which artifact already exists and what the next workflow step should be.
18
-
19
- ## Recommended flow
20
-
21
- 1. Start with `01-brainstorm` when the problem is still fuzzy or you have a new idea.
22
- - **Startup founders** get the YC-style diagnostic: demand reality, status quo, narrowest wedge.
23
- - **Side project builders** get generative brainstorming: coolest version, fastest path to ship.
24
- - **Feature additions** get the standard CE requirements discovery.
25
- 2. Move to `02-plan` once the desired behavior is clear.
26
- - Optionally run **CEO Review** to challenge premises, map alternatives, check dream-state alignment.
27
- - Or **Strict Review** for full error maps, failure modes, and test diagrams.
28
- 3. Use `03-work` to execute the plan.
29
- 4. Run `04-review` after implementation.
30
- - Optionally extend to **Browser QA** for visual and functional bug finding.
31
- - Or **Browser QA + Regression Tests** to also generate automated test coverage.
32
- 5. Capture key learnings with `05-learn`.
33
- 6. Use `08-status` at any point to inspect repo-local workflow state.
34
-
35
- ## Output
36
-
37
- When responding, explain the smallest useful next step instead of forcing the full sequence.
@@ -1,9 +0,0 @@
1
- # Workflow Sequence
2
-
3
- 1. `01-brainstorm` → clarify the problem (CE mode / Startup Diagnostic / Builder Mode)
4
- 2. `02-plan` → break it into concrete units (optionally + CEO Review / Strict Review)
5
- 3. `03-work` → execute the plan
6
- 4. `04-review` → inspect the changes (optionally + Browser QA / QA + Regression Tests)
7
- 5. `05-learn` → save key learnings
8
-
9
- Use `08-status` at any point to see where you are.
@@ -1,76 +0,0 @@
1
- ---
2
- name: 10-rules
3
- description: "Progressively load project coding rules on demand. Auto-triggered by plan, work, and review skills, or run manually with /skill:10-rules."
4
- ---
5
-
6
- # Rules
7
-
8
- Rules are loaded from two locations with clear priority:
9
-
10
- 1. **Project-level** `{repo-root}/rules/` — if it exists, takes priority. Users maintain this themselves; survives `pi update`.
11
- 2. **Package-level** `rules/` in the super-pi package — built-in defaults, used when no project-level override exists.
12
-
13
- Detection: check `{repo-root}/rules/` first. If a file exists at the project level for the topic being loaded, use it. Otherwise fall back to the package-level copy.
14
-
15
- ## Core rule
16
-
17
- Do not load the entire rules tree by default. Read only the files needed for the current task.
18
-
19
- ## Pre-flight: what to load by phase
20
-
21
- ### Before planning (02-plan)
22
-
23
- Read at minimum:
24
- - `rules/common/development-workflow.md`
25
- - `rules/common/testing.md`
26
- - **Detect the active language** from the project: check for `tsconfig.json` → typescript, `package.json` (without tsconfig) → javascript, `Cargo.toml` → rust, `go.mod` → golang, `pubspec.yaml` → dart, `pom.xml`/`build.gradle` → java, `*.sln`/`*.csproj` → csharp, `Package.swift` → swift, `requirements.txt`/`pyproject.toml`/`setup.py` → python, `composer.json` → php, `Makefile.PL`/`cpanfile` → perl, `build.gradle.kts` → kotlin. Load all files in the matching language directory (e.g. `rules/typescript/`).
27
- - `rules/web/` files if the task involves frontend/browser concerns
28
-
29
- ### Before implementation (03-work)
30
-
31
- Read the common minimum above, plus:
32
- - **Detect the active language** from the project: check for `tsconfig.json` → typescript, `package.json` (without tsconfig) → javascript, `Cargo.toml` → rust, `go.mod` → golang, `pubspec.yaml` → dart, `pom.xml`/`build.gradle` → java, `*.sln`/`*.csproj` → csharp, `Package.swift` → swift, `requirements.txt`/`pyproject.toml`/`setup.py` → python, `composer.json` → php, `Makefile.PL`/`cpanfile` → perl, `build.gradle.kts` → kotlin. Load all files in the matching language directory.
33
- - `rules/web/` files if the task involves frontend/browser concerns
34
-
35
- ### Before review (04-review)
36
-
37
- Read at minimum:
38
- - `rules/common/code-review.md`
39
- - **Detect the active language** from the changed files: use the same language detection as above. Load all files in the matching language directory.
40
- - `rules/web/` files if the review involves frontend/browser changes
41
-
42
- ## Progressive loading order
43
-
44
- 1. **Workflow** — `common/development-workflow.md`
45
- 2. **Testing/TDD** — `common/testing.md`
46
- 3. **Scenario** — `web/*` only if frontend is relevant
47
- 4. **Language** — matching language directory only
48
- 5. **Additional** — security, performance, patterns, hooks, coding-style — only when the task calls for it
49
-
50
- ## Rule precedence
51
-
52
- When the same topic exists at multiple layers, higher priority wins:
53
-
54
- ```
55
- language-specific > web > common
56
- ```
57
-
58
- Override mapping by topic:
59
- - `common/testing.md` ← `web/testing.md` ← `<lang>/testing.md`
60
- - `common/coding-style.md` ← `web/coding-style.md` ← `<lang>/coding-style.md`
61
- - `common/patterns.md` ← `web/patterns.md` ← `<lang>/patterns.md`
62
- - `common/security.md` ← `web/security.md` ← `<lang>/security.md`
63
- - `common/hooks.md` ← `web/hooks.md` ← `<lang>/hooks.md`
64
-
65
- ## Available layers
66
-
67
- - `common/` — always relevant baseline (10 files)
68
- - `typescript/`, `python/`, `cpp/`, `csharp/`, `dart/`, `golang/`, `java/`, `kotlin/`, `perl/`, `php/`, `rust/`, `swift/` — language-specific overrides (5 files each)
69
- - `web/` — frontend/web scenario (7 files, includes additive-only `design-quality.md` and `performance.md`)
70
-
71
- ## Output expectation
72
-
73
- When rules are loaded, state briefly:
74
- - which rule files were loaded
75
- - which are acting as overrides
76
- - what constraints they impose on the current task