@leing2021/super-pi 0.22.0 → 0.23.0

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 (101) hide show
  1. package/README.md +38 -209
  2. package/extensions/ce-core/index.ts +190 -7
  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 -18
  6. package/rules/common/naming.md +154 -0
  7. package/skills/02-plan/SKILL.md +3 -2
  8. package/skills/03-work/SKILL.md +9 -6
  9. package/skills/04-review/SKILL.md +3 -2
  10. package/skills/06-next/SKILL.md +38 -10
  11. package/skills/06-next/references/recommendation-logic.md +2 -2
  12. package/skills/07-worktree/SKILL.md +9 -8
  13. package/skills/{09-help → 08-help}/SKILL.md +3 -3
  14. package/skills/{09-help → 08-help}/references/workflow-sequence.md +2 -1
  15. package/skills/references/language-detection.md +44 -0
  16. package/extensions/subagent/agent-management.ts +0 -595
  17. package/extensions/subagent/agent-manager-chain-detail.ts +0 -162
  18. package/extensions/subagent/agent-manager-detail.ts +0 -231
  19. package/extensions/subagent/agent-manager-edit.ts +0 -390
  20. package/extensions/subagent/agent-manager-list.ts +0 -278
  21. package/extensions/subagent/agent-manager-parallel.ts +0 -304
  22. package/extensions/subagent/agent-manager.ts +0 -705
  23. package/extensions/subagent/agent-scope.ts +0 -8
  24. package/extensions/subagent/agent-selection.ts +0 -25
  25. package/extensions/subagent/agent-serializer.ts +0 -123
  26. package/extensions/subagent/agent-templates.ts +0 -62
  27. package/extensions/subagent/agents/context-builder.md +0 -37
  28. package/extensions/subagent/agents/delegate.md +0 -9
  29. package/extensions/subagent/agents/oracle.md +0 -73
  30. package/extensions/subagent/agents/planner.md +0 -52
  31. package/extensions/subagent/agents/researcher.md +0 -50
  32. package/extensions/subagent/agents/reviewer.md +0 -38
  33. package/extensions/subagent/agents/scout.md +0 -48
  34. package/extensions/subagent/agents/worker.md +0 -52
  35. package/extensions/subagent/agents.ts +0 -761
  36. package/extensions/subagent/artifacts.ts +0 -100
  37. package/extensions/subagent/async-execution.ts +0 -520
  38. package/extensions/subagent/async-job-tracker.ts +0 -216
  39. package/extensions/subagent/async-status.ts +0 -241
  40. package/extensions/subagent/chain-clarify.ts +0 -1364
  41. package/extensions/subagent/chain-execution.ts +0 -853
  42. package/extensions/subagent/chain-serializer.ts +0 -126
  43. package/extensions/subagent/completion-dedupe.ts +0 -65
  44. package/extensions/subagent/doctor.ts +0 -200
  45. package/extensions/subagent/execution.ts +0 -738
  46. package/extensions/subagent/file-coalescer.ts +0 -42
  47. package/extensions/subagent/fork-context.ts +0 -63
  48. package/extensions/subagent/formatters.ts +0 -122
  49. package/extensions/subagent/frontmatter.ts +0 -31
  50. package/extensions/subagent/index.ts +0 -585
  51. package/extensions/subagent/intercom-bridge.ts +0 -240
  52. package/extensions/subagent/jsonl-writer.ts +0 -83
  53. package/extensions/subagent/model-fallback.ts +0 -108
  54. package/extensions/subagent/notify.ts +0 -110
  55. package/extensions/subagent/parallel-utils.ts +0 -108
  56. package/extensions/subagent/pi-args.ts +0 -138
  57. package/extensions/subagent/pi-spawn.ts +0 -100
  58. package/extensions/subagent/post-exit-stdio-guard.ts +0 -87
  59. package/extensions/subagent/prompt-template-bridge.ts +0 -399
  60. package/extensions/subagent/prompts/gather-context-and-clarify.md +0 -13
  61. package/extensions/subagent/prompts/parallel-cleanup.md +0 -42
  62. package/extensions/subagent/prompts/parallel-research.md +0 -50
  63. package/extensions/subagent/prompts/parallel-review.md +0 -40
  64. package/extensions/subagent/render-helpers.ts +0 -82
  65. package/extensions/subagent/render.ts +0 -836
  66. package/extensions/subagent/result-intercom.ts +0 -237
  67. package/extensions/subagent/result-watcher.ts +0 -171
  68. package/extensions/subagent/run-history.ts +0 -57
  69. package/extensions/subagent/run-status.ts +0 -136
  70. package/extensions/subagent/schemas.ts +0 -164
  71. package/extensions/subagent/session-tokens.ts +0 -50
  72. package/extensions/subagent/settings.ts +0 -367
  73. package/extensions/subagent/single-output.ts +0 -97
  74. package/extensions/subagent/skills.ts +0 -626
  75. package/extensions/subagent/slash-bridge.ts +0 -176
  76. package/extensions/subagent/slash-commands.ts +0 -303
  77. package/extensions/subagent/slash-live-state.ts +0 -294
  78. package/extensions/subagent/subagent-control.ts +0 -150
  79. package/extensions/subagent/subagent-executor.ts +0 -1899
  80. package/extensions/subagent/subagent-prompt-runtime.ts +0 -75
  81. package/extensions/subagent/subagent-runner.ts +0 -1470
  82. package/extensions/subagent/subagents-status.ts +0 -472
  83. package/extensions/subagent/text-editor.ts +0 -272
  84. package/extensions/subagent/top-level-async.ts +0 -15
  85. package/extensions/subagent/types.ts +0 -623
  86. package/extensions/subagent/utils.ts +0 -456
  87. package/extensions/subagent/worktree.ts +0 -579
  88. package/extensions/super-pi-extension/agents/ce-oracle.md +0 -109
  89. package/extensions/super-pi-extension/agents/ce-planner.md +0 -116
  90. package/extensions/super-pi-extension/agents/ce-reviewer.md +0 -99
  91. package/extensions/super-pi-extension/agents/ce-scout.md +0 -80
  92. package/extensions/super-pi-extension/agents/ce-worker.md +0 -78
  93. package/extensions/super-pi-extension/chains/ce-parallel-review.chain.md +0 -34
  94. package/extensions/super-pi-extension/chains/ce-review-only.chain.md +0 -12
  95. package/extensions/super-pi-extension/chains/ce-standard.chain.md +0 -28
  96. package/extensions/super-pi-extension/index.ts +0 -129
  97. package/extensions/super-pi-extension/model-sync.ts +0 -204
  98. package/skills/08-status/SKILL.md +0 -41
  99. package/skills/08-status/references/artifact-locations.md +0 -10
  100. package/skills/10-rules/SKILL.md +0 -76
  101. 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,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