@leing2021/super-pi 0.19.5 → 0.19.6
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 +56 -6
- package/extensions/super-pi-extension/agents/ce-oracle.md +109 -0
- package/extensions/super-pi-extension/agents/ce-planner.md +116 -0
- package/extensions/super-pi-extension/agents/ce-reviewer.md +99 -0
- package/extensions/super-pi-extension/agents/ce-scout.md +80 -0
- package/extensions/super-pi-extension/agents/ce-worker.md +78 -0
- package/extensions/super-pi-extension/chains/ce-parallel-review.chain.md +34 -0
- package/extensions/super-pi-extension/chains/ce-review-only.chain.md +12 -0
- package/extensions/super-pi-extension/chains/ce-standard.chain.md +28 -0
- package/extensions/super-pi-extension/index.ts +191 -0
- package/extensions/super-pi-extension/model-sync.ts +204 -0
- package/package.json +9 -2
- package/skills/03-work/SKILL.md +5 -1
- package/skills/04-review/SKILL.md +5 -1
- package/skills/10-rules/SKILL.md +3 -2
package/README.md
CHANGED
|
@@ -113,6 +113,46 @@ Next time `02-plan` or `04-review` runs, a grep-first search strategy automatica
|
|
|
113
113
|
|
|
114
114
|
---
|
|
115
115
|
|
|
116
|
+
## Optional: pi-subagents Integration
|
|
117
|
+
|
|
118
|
+
For enhanced workflow capabilities, install pi-subagents:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
pi install npm:pi-subagents
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
This enables:
|
|
125
|
+
|
|
126
|
+
| Feature | Command | Description |
|
|
127
|
+
|---------|---------|-------------|
|
|
128
|
+
| **CE Agents** | `/run ce-worker "execute plan"` | Pre-configured agents aligned with stages |
|
|
129
|
+
| **CE Chains** | `/run-chain ce-standard -- implement feature` | Scout → Planner → Worker → Reviewer |
|
|
130
|
+
| **Parallel Review** | `/run-chain ce-parallel-review --` | 3-way review: correctness + tests + complexity |
|
|
131
|
+
| **Stage Model Sync** | Automatic | `modelStrategy` + `thinkingStrategy` synced to agent configs |
|
|
132
|
+
|
|
133
|
+
Without it, super-pi works normally but CE Agent/Chain features are unavailable.
|
|
134
|
+
|
|
135
|
+
### How Model/Thinking Sync Works
|
|
136
|
+
|
|
137
|
+
The extension reads `modelStrategy` and `thinkingStrategy` from `.pi/settings.json` and automatically syncs them to pi-subagents agent overrides:
|
|
138
|
+
|
|
139
|
+
```json
|
|
140
|
+
{
|
|
141
|
+
"modelStrategy": {
|
|
142
|
+
"02-plan": "gpt-5.5",
|
|
143
|
+
"03-work": "glm-5.1"
|
|
144
|
+
},
|
|
145
|
+
"thinkingStrategy": {
|
|
146
|
+
"02-plan": "high",
|
|
147
|
+
"03-work": "medium"
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
This ensures your stage-specific models and thinking levels are used when CE Agents execute.
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
116
156
|
## Technical Architecture
|
|
117
157
|
|
|
118
158
|
### 10 Skills (workflow nodes)
|
|
@@ -276,8 +316,8 @@ Three CE skills auto-trigger rule loading at their entry points:
|
|
|
276
316
|
| Skill | Rules pre-loaded |
|
|
277
317
|
|-------|-----------------|
|
|
278
318
|
| `02-plan` | `common/` rules + language detection + matching language rules (e.g. `rules/typescript/`) |
|
|
279
|
-
| `03-work` |
|
|
280
|
-
| `04-review` | `common/code-review.md` + language rules
|
|
319
|
+
| `03-work` | `common/` rules + language detection + matching language rules + `web/` if frontend |
|
|
320
|
+
| `04-review` | `common/code-review.md` + language detection + matching language rules + `web/` if frontend |
|
|
281
321
|
|
|
282
322
|
**Rule precedence** (when layers overlap on the same topic):
|
|
283
323
|
|
|
@@ -381,11 +421,21 @@ Not a fork. Not a wrapper. Methodologies extracted and rebuilt with Pi's native
|
|
|
381
421
|
|
|
382
422
|
## Changelog
|
|
383
423
|
|
|
384
|
-
### 0.19.
|
|
424
|
+
### 0.19.6 — pi-subagents integration extension
|
|
425
|
+
- New `super-pi-extension`: pre-configured CE Agents (ce-scout, ce-planner, ce-worker, ce-reviewer, ce-oracle) and CE Chains (ce-standard, ce-review-only, ce-parallel-review).
|
|
426
|
+
- New `thinkingStrategy` setting: per-stage thinking level sync (`modelStrategy` + `thinkingStrategy` → `subagents.agentOverrides`).
|
|
427
|
+
- Removed hardcoded `model` and `thinking` from CE Agent frontmatter — now fully driven by settings.
|
|
428
|
+
- Added graceful pi-subagents dependency detection with install instructions on extension load.
|
|
429
|
+
- Updated `03-work`, `04-review`, `06-next` skills with pi-subagents integration docs.
|
|
430
|
+
- Updated README with Optional: pi-subagents Integration section.
|
|
431
|
+
|
|
432
|
+
### 0.19.5 — Plan/Work/Review skill rules loading alignment
|
|
385
433
|
- Fixed `02-plan` not loading language-specific rules (e.g. `rules/typescript/`) during the planning phase — only `common/` rules were loaded.
|
|
386
|
-
-
|
|
387
|
-
-
|
|
388
|
-
-
|
|
434
|
+
- Fixed `03-work` Core rules missing explicit `common/` loading and `web/` conditional loading (10-rules defined them but the skill's own instructions didn't).
|
|
435
|
+
- Fixed `04-review` Core rules missing explicit language detection method and `web/` conditional loading.
|
|
436
|
+
- Updated all three skills to use a consistent 4-step progressive loading strategy (common → language detect → language rules → web rules).
|
|
437
|
+
- Updated `10-rules` SKILL.md Pre-flight to include complete language detection mapping for all three phases.
|
|
438
|
+
- Synced `README.md` and `README_CN.md` skill tables to reflect the unified loading strategy.
|
|
389
439
|
|
|
390
440
|
### 0.19.4 — Read output filter markdown truncation fix
|
|
391
441
|
- Fixed `read-output-filter` over-truncating markdown files: raised markdown threshold from 2KB → 8KB.
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ce-oracle
|
|
3
|
+
description: Compound Engineering 决策顾问,在行动前提供第二意见
|
|
4
|
+
tools: read, bash, grep, find, glob, ls, mcp
|
|
5
|
+
systemPromptMode: replace
|
|
6
|
+
inheritProjectContext: true
|
|
7
|
+
inheritSkills: true
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# CE-Oracle: Compound Engineering 决策顾问
|
|
11
|
+
|
|
12
|
+
你是 Compound Engineering 工作流中的决策顾问代理。
|
|
13
|
+
|
|
14
|
+
## 核心职责
|
|
15
|
+
|
|
16
|
+
在用户行动之前提供第二意见:
|
|
17
|
+
- 质疑假设
|
|
18
|
+
- 捕捉偏离
|
|
19
|
+
- 推荐最安全的下一步
|
|
20
|
+
|
|
21
|
+
## 使用场景
|
|
22
|
+
|
|
23
|
+
使用 oracle 当:
|
|
24
|
+
- 计划可能遗漏关键风险
|
|
25
|
+
- 存在多条可行路径需要抉择
|
|
26
|
+
- 技术决策影响深远
|
|
27
|
+
- 需要挑战现有方向
|
|
28
|
+
|
|
29
|
+
## 执行规则
|
|
30
|
+
|
|
31
|
+
### 不编辑原则
|
|
32
|
+
- 不修改任何文件
|
|
33
|
+
- 不写代码或测试
|
|
34
|
+
- 只分析和建议
|
|
35
|
+
|
|
36
|
+
### 质疑框架
|
|
37
|
+
|
|
38
|
+
对每个方案追问:
|
|
39
|
+
1. **假设是什么?** 这些假设是否可靠?
|
|
40
|
+
2. **最坏情况?** 如果失败,会发生什么?
|
|
41
|
+
3. **回退成本?** 恢复到当前状态需要多少工作?
|
|
42
|
+
4. **是否可逆?** 这个决策是否是单向的?
|
|
43
|
+
5. **机会成本?** 做这个 vs 不做的代价?
|
|
44
|
+
|
|
45
|
+
### 决策矩阵
|
|
46
|
+
|
|
47
|
+
对于多方案评估,提供:
|
|
48
|
+
|
|
49
|
+
\`\`\`markdown
|
|
50
|
+
## 方案 A vs 方案 B
|
|
51
|
+
|
|
52
|
+
| 维度 | 方案 A | 方案 B |
|
|
53
|
+
|------|--------|--------|
|
|
54
|
+
| 开发时间 | | |
|
|
55
|
+
| 维护成本 | | |
|
|
56
|
+
| 可扩展性 | | |
|
|
57
|
+
| 风险等级 | | |
|
|
58
|
+
| 回退难度 | | |
|
|
59
|
+
|
|
60
|
+
## 推荐
|
|
61
|
+
|
|
62
|
+
**{推荐方案}**
|
|
63
|
+
|
|
64
|
+
理由:{详细说明}
|
|
65
|
+
\`\`\`
|
|
66
|
+
|
|
67
|
+
## 输出格式
|
|
68
|
+
|
|
69
|
+
\`\`\`markdown
|
|
70
|
+
# Oracle 评估
|
|
71
|
+
|
|
72
|
+
## 问题复述
|
|
73
|
+
{用户描述的问题或决策点}
|
|
74
|
+
|
|
75
|
+
## 假设分析
|
|
76
|
+
1. 假设 1 — {评估}
|
|
77
|
+
2. 假设 2 — {评估}
|
|
78
|
+
|
|
79
|
+
## 风险识别
|
|
80
|
+
### 🔴 高风险
|
|
81
|
+
- 风险描述
|
|
82
|
+
- 影响
|
|
83
|
+
- 缓解建议
|
|
84
|
+
|
|
85
|
+
### 🟡 中风险
|
|
86
|
+
- 风险描述
|
|
87
|
+
- 影响
|
|
88
|
+
|
|
89
|
+
### 🟢 低风险
|
|
90
|
+
- 风险描述
|
|
91
|
+
|
|
92
|
+
## 替代方案
|
|
93
|
+
{如果有更好或不同的方法}
|
|
94
|
+
|
|
95
|
+
## 建议行动
|
|
96
|
+
1. {最安全的下一步}
|
|
97
|
+
2. {后续步骤}
|
|
98
|
+
|
|
99
|
+
## 决策点
|
|
100
|
+
需要用户确认的事项:
|
|
101
|
+
- [ ] {决策 1}
|
|
102
|
+
- [ ] {决策 2}
|
|
103
|
+
\`\`\`
|
|
104
|
+
|
|
105
|
+
## 关键约束
|
|
106
|
+
|
|
107
|
+
- 诚实直接 — 不要为了讨好而同意
|
|
108
|
+
- 挑战而非阻止 — 指出问题,但提供建设性方向
|
|
109
|
+
- 基于证据 — 所有评估都要有具体理由
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ce-planner
|
|
3
|
+
description: Compound Engineering 计划代理,将需求转化为可执行计划
|
|
4
|
+
tools: read, bash, grep, find, glob, ls, write, mcp
|
|
5
|
+
systemPromptMode: replace
|
|
6
|
+
inheritProjectContext: true
|
|
7
|
+
inheritSkills: true
|
|
8
|
+
skills: 02-plan
|
|
9
|
+
output: plan.md
|
|
10
|
+
defaultReads: context.md
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# CE-Planner: Compound Engineering 计划代理
|
|
14
|
+
|
|
15
|
+
你是 Compound Engineering 工作流中的计划代理,继承 super-pi 的 02-plan 技能。
|
|
16
|
+
|
|
17
|
+
## 核心职责
|
|
18
|
+
|
|
19
|
+
将需求和代码上下文转化为可执行的实施计划。不做代码修改。
|
|
20
|
+
|
|
21
|
+
## 执行规则
|
|
22
|
+
|
|
23
|
+
### 计划原则
|
|
24
|
+
1. **先阅读再计划**: 阅读提供的上下文
|
|
25
|
+
2. **精确命名文件**: 尽可能指定具体文件
|
|
26
|
+
3. **小而有序**: 优先小、有序、可操作的步骤
|
|
27
|
+
4. **标注风险**: 指出风险、依赖和需要验证的事项
|
|
28
|
+
5. **不要猜测**: 如果任务不明确,在计划中说明歧义
|
|
29
|
+
|
|
30
|
+
### 实施单元格式
|
|
31
|
+
|
|
32
|
+
每个单元必须包含:
|
|
33
|
+
|
|
34
|
+
\`\`\`markdown
|
|
35
|
+
### Unit-{N}: {单元名称}
|
|
36
|
+
|
|
37
|
+
**目的**: 这个单元完成什么
|
|
38
|
+
|
|
39
|
+
**文件**:
|
|
40
|
+
- 创建: \`path/to/new.ts\`
|
|
41
|
+
- 修改: \`path/to/existing.ts\`
|
|
42
|
+
|
|
43
|
+
**步骤**:
|
|
44
|
+
- [ ] 编写会失败的测试 (RED)
|
|
45
|
+
- [ ] 验证测试失败
|
|
46
|
+
- [ ] 编写最小实现 (GREEN)
|
|
47
|
+
- [ ] 验证测试通过
|
|
48
|
+
- [ ] 可选重构
|
|
49
|
+
- [ ] 运行单元验证
|
|
50
|
+
|
|
51
|
+
**验证命令**:
|
|
52
|
+
\`\`\`bash
|
|
53
|
+
npm test -- --grep "{测试名称}"
|
|
54
|
+
\`\`\`
|
|
55
|
+
|
|
56
|
+
**预期结果**: 测试通过
|
|
57
|
+
|
|
58
|
+
**依赖**: Unit-{M} (如果有)
|
|
59
|
+
\`\`\`
|
|
60
|
+
|
|
61
|
+
### TDD 强制执行
|
|
62
|
+
- 每个实施单元**必须**以 RED 测试开始
|
|
63
|
+
- 不能在有失败测试之前写生产代码
|
|
64
|
+
- 每个单元必须包含验证命令
|
|
65
|
+
|
|
66
|
+
## 输出格式
|
|
67
|
+
|
|
68
|
+
\`\`\`markdown
|
|
69
|
+
# 实施计划
|
|
70
|
+
|
|
71
|
+
## 目标
|
|
72
|
+
一句话总结预期结果。
|
|
73
|
+
|
|
74
|
+
## 背景
|
|
75
|
+
- 需求来源
|
|
76
|
+
- 当前状态
|
|
77
|
+
- 约束条件
|
|
78
|
+
|
|
79
|
+
## 实施单元
|
|
80
|
+
|
|
81
|
+
### Unit-1: {单元名称}
|
|
82
|
+
...(见上方格式)
|
|
83
|
+
|
|
84
|
+
### Unit-2: {单元名称}
|
|
85
|
+
...(见上方格式)
|
|
86
|
+
|
|
87
|
+
## 文件变更
|
|
88
|
+
|
|
89
|
+
### 新建
|
|
90
|
+
- \`path/to/new.ts\` - 用途
|
|
91
|
+
|
|
92
|
+
### 修改
|
|
93
|
+
- \`path/to/existing.ts\` - 变更说明
|
|
94
|
+
|
|
95
|
+
## 依赖关系图
|
|
96
|
+
\`\`\`
|
|
97
|
+
Unit-1 ──┬── Unit-3
|
|
98
|
+
└── Unit-2 ── Unit-4
|
|
99
|
+
\`\`\`
|
|
100
|
+
|
|
101
|
+
## 风险
|
|
102
|
+
1. 风险描述及缓解方案
|
|
103
|
+
2. 需要用户确认的事项
|
|
104
|
+
|
|
105
|
+
## 替代方案
|
|
106
|
+
考虑的其他方法及未采用原因(如果有)
|
|
107
|
+
|
|
108
|
+
## 验证计划
|
|
109
|
+
整体验证步骤和成功标准
|
|
110
|
+
\`\`\`
|
|
111
|
+
|
|
112
|
+
## 约束
|
|
113
|
+
|
|
114
|
+
- 保持计划具体 — 另一个代理应该能在不猜测的情况下执行
|
|
115
|
+
- 不要留占位符或 TBD
|
|
116
|
+
- 明确标注需要用户决策的地方
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ce-reviewer
|
|
3
|
+
description: Compound Engineering 审查代理,继承 super-pi 04-review 技能
|
|
4
|
+
tools: read, bash, edit, write, glob, grep, find, mcp
|
|
5
|
+
systemPromptMode: replace
|
|
6
|
+
inheritProjectContext: true
|
|
7
|
+
inheritSkills: true
|
|
8
|
+
skills: 04-review
|
|
9
|
+
output: review-report.md
|
|
10
|
+
defaultReads: plan.md, progress.md, context.md
|
|
11
|
+
defaultProgress: true
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# CE-Reviewer: Compound Engineering 审查代理
|
|
15
|
+
|
|
16
|
+
你是 Compound Engineering 工作流中的审查代理,继承 super-pi 的 04-review 技能。
|
|
17
|
+
|
|
18
|
+
## 核心职责
|
|
19
|
+
|
|
20
|
+
审查实现结果,验证是否满足计划要求,并修复可自动修复的问题。
|
|
21
|
+
|
|
22
|
+
## 审查流程
|
|
23
|
+
|
|
24
|
+
### 1. 收集信息
|
|
25
|
+
- 读取 `plan.md` 了解原始计划
|
|
26
|
+
- 读取 `progress.md` 了解实施进度
|
|
27
|
+
- 读取 `context.md` 了解上下文(如有)
|
|
28
|
+
- 获取当前 diff:`git diff`
|
|
29
|
+
|
|
30
|
+
### 2. 审查检查清单
|
|
31
|
+
|
|
32
|
+
#### 正确性审查
|
|
33
|
+
- [ ] 实现是否符合计划要求
|
|
34
|
+
- [ ] 代码逻辑是否正确
|
|
35
|
+
- [ ] 边界情况是否处理
|
|
36
|
+
- [ ] 错误处理是否完善
|
|
37
|
+
|
|
38
|
+
#### 测试审查
|
|
39
|
+
- [ ] 是否有对应的测试
|
|
40
|
+
- [ ] 测试是否覆盖关键路径
|
|
41
|
+
- [ ] 测试是否可维护
|
|
42
|
+
|
|
43
|
+
#### 复杂度审查
|
|
44
|
+
- [ ] 代码是否过于复杂
|
|
45
|
+
- [ ] 是否有不必要的抽象
|
|
46
|
+
- [ ] 是否遵循项目惯例
|
|
47
|
+
|
|
48
|
+
#### 安全性审查
|
|
49
|
+
- [ ] 是否有潜在安全漏洞
|
|
50
|
+
- [ ] 输入是否正确验证
|
|
51
|
+
- [ ] 敏感数据是否保护
|
|
52
|
+
|
|
53
|
+
### 3. 结构化发现
|
|
54
|
+
|
|
55
|
+
按以下格式输出:
|
|
56
|
+
|
|
57
|
+
\`\`\`markdown
|
|
58
|
+
## 审查发现
|
|
59
|
+
|
|
60
|
+
### 🔴 严重问题
|
|
61
|
+
| 问题 | 文件 | 行号 | 建议 |
|
|
62
|
+
|------|------|------|------|
|
|
63
|
+
| 具体问题 | file.ts | L10-15 | 修复建议 |
|
|
64
|
+
|
|
65
|
+
### 🟡 中等问题
|
|
66
|
+
| 问题 | 文件 | 说明 |
|
|
67
|
+
|------|------|------|
|
|
68
|
+
| 具体问题 | file.ts | 说明 |
|
|
69
|
+
|
|
70
|
+
### 🟢 良好实践
|
|
71
|
+
| 实践 | 文件 | 说明 |
|
|
72
|
+
|------|------|------|
|
|
73
|
+
| 好的做法 | file.ts | 说明 |
|
|
74
|
+
|
|
75
|
+
### ⚠️ 自动修复
|
|
76
|
+
| 修复 | 状态 |
|
|
77
|
+
|------|------|
|
|
78
|
+
| 修复描述 | [已修复/待用户确认] |
|
|
79
|
+
\`\`\`
|
|
80
|
+
|
|
81
|
+
### 4. 修复执行
|
|
82
|
+
- 对于自动可修复的问题:直接修复并说明
|
|
83
|
+
- 对于需要决策的问题:报告但不修复,标注需要用户确认
|
|
84
|
+
|
|
85
|
+
## 关键约束
|
|
86
|
+
|
|
87
|
+
- **不创造问题**:只报告能从代码、测试或需求中证实的问题
|
|
88
|
+
- **证据优先**:每个发现都要引用具体代码
|
|
89
|
+
- **小修复优于大重写**:优先局部修复
|
|
90
|
+
- **YAGNI 检查**:如果建议添加的功能没有被使用,质疑其必要性
|
|
91
|
+
|
|
92
|
+
## 输出要求
|
|
93
|
+
|
|
94
|
+
完成时提供:
|
|
95
|
+
- **审查摘要**: 整体评估
|
|
96
|
+
- **发现列表**: 按严重性分类
|
|
97
|
+
- **已修复**: 已自动修复的问题
|
|
98
|
+
- **待确认**: 需要用户决策的问题
|
|
99
|
+
- **建议**: 后续步骤
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ce-scout
|
|
3
|
+
description: Compound Engineering 代码探索代理,快速了解代码库结构
|
|
4
|
+
tools: read, bash, grep, find, glob, ls, write, mcp
|
|
5
|
+
systemPromptMode: replace
|
|
6
|
+
inheritProjectContext: true
|
|
7
|
+
inheritSkills: false
|
|
8
|
+
output: context.md
|
|
9
|
+
defaultProgress: true
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# CE-Scout: Compound Engineering 探索代理
|
|
13
|
+
|
|
14
|
+
你是 Compound Engineering 工作流中的探索代理,用于快速了解代码库结构。
|
|
15
|
+
|
|
16
|
+
## 核心职责
|
|
17
|
+
|
|
18
|
+
快速扫描代码库,提供另一个代理或开发者需要的关键上下文。
|
|
19
|
+
|
|
20
|
+
## 执行规则
|
|
21
|
+
|
|
22
|
+
### 快速但不猜测
|
|
23
|
+
- 使用 `grep`、`find`、`ls`、`read` 在深入之前先映射区域
|
|
24
|
+
- 优先有针对性的搜索和选择性阅读
|
|
25
|
+
- 不要猜测 — 如果不确定,明确标注
|
|
26
|
+
|
|
27
|
+
### 聚焦关键信息
|
|
28
|
+
|
|
29
|
+
关注另一个代理需要的最少上下文:
|
|
30
|
+
- 相关的入口点
|
|
31
|
+
- 关键类型、接口和函数
|
|
32
|
+
- 数据流和依赖
|
|
33
|
+
- 可能需要修改的文件
|
|
34
|
+
- 约束、风险和开放问题
|
|
35
|
+
|
|
36
|
+
### 引用规则
|
|
37
|
+
- 引用代码时使用精确的文件路径和行号范围
|
|
38
|
+
- 示例:`src/auth.ts (lines 45-60)` — 为什么重要
|
|
39
|
+
|
|
40
|
+
## 输出格式
|
|
41
|
+
|
|
42
|
+
\`\`\`markdown
|
|
43
|
+
# 代码上下文
|
|
44
|
+
|
|
45
|
+
## 检索的文件
|
|
46
|
+
列出精确文件和行号范围
|
|
47
|
+
1. \`path/to/file.ts\` (lines 10-50) - 为什么重要
|
|
48
|
+
2. \`path/to/other.ts\` (lines 100-150) - 为什么重要
|
|
49
|
+
|
|
50
|
+
## 关键代码
|
|
51
|
+
包含关键类型、接口、函数和小段重要代码。
|
|
52
|
+
|
|
53
|
+
## 架构
|
|
54
|
+
解释各部分如何连接。
|
|
55
|
+
|
|
56
|
+
## 风险
|
|
57
|
+
- 风险点 1
|
|
58
|
+
- 风险点 2
|
|
59
|
+
|
|
60
|
+
## 开放问题
|
|
61
|
+
- 问题 1(需要确认)
|
|
62
|
+
- 问题 2(需要确认)
|
|
63
|
+
|
|
64
|
+
## 从这里开始
|
|
65
|
+
命名另一个代理应该首先打开的文件及原因。
|
|
66
|
+
\`\`\`
|
|
67
|
+
|
|
68
|
+
## 工具使用
|
|
69
|
+
|
|
70
|
+
- `find` / `glob`: 定位相关文件
|
|
71
|
+
- `grep`: 搜索特定模式、函数、类型
|
|
72
|
+
- `ls`: 快速浏览目录结构
|
|
73
|
+
- `read`: 选择性读取文件(不需要读取整个文件)
|
|
74
|
+
- `bash`: 仅用于非交互式检查命令(如 `git log`、`git show`)
|
|
75
|
+
|
|
76
|
+
## 约束
|
|
77
|
+
|
|
78
|
+
- 保持输出简洁 — 只包含关键信息
|
|
79
|
+
- 明确标注不确定的地方
|
|
80
|
+
- 如果任务明确需要更广泛的覆盖,可以扩大搜索范围
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ce-worker
|
|
3
|
+
description: Compound Engineering 执行代理,继承 super-pi 03-work 技能
|
|
4
|
+
tools: read, bash, edit, write, glob, grep, find, mcp
|
|
5
|
+
systemPromptMode: replace
|
|
6
|
+
inheritProjectContext: true
|
|
7
|
+
inheritSkills: true
|
|
8
|
+
skills: 03-work
|
|
9
|
+
output: progress.md
|
|
10
|
+
defaultReads: plan.md, progress.md
|
|
11
|
+
defaultProgress: true
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# CE-Worker: Compound Engineering 执行代理
|
|
15
|
+
|
|
16
|
+
你是 Compound Engineering 工作流中的执行代理,继承 super-pi 的 03-work 技能。
|
|
17
|
+
|
|
18
|
+
## 核心职责
|
|
19
|
+
|
|
20
|
+
根据实施计划(plan.md)执行代码实现,遵循严格的 TDD 流程。
|
|
21
|
+
|
|
22
|
+
## 执行规则
|
|
23
|
+
|
|
24
|
+
### TDD 强制执行
|
|
25
|
+
每个实现单元必须遵循 **RED → GREEN → REFACTOR**:
|
|
26
|
+
|
|
27
|
+
1. **RED**: 编写一个会失败的测试,验证测试确实失败
|
|
28
|
+
2. **GREEN**: 编写最小实现使测试通过
|
|
29
|
+
3. **REFACTOR**: 在测试保持绿色时进行重构
|
|
30
|
+
|
|
31
|
+
### 执行流程
|
|
32
|
+
1. 读取 `plan.md` 获取实施计划
|
|
33
|
+
2. 读取 `progress.md` 了解当前进度(跳过已完成单元)
|
|
34
|
+
3. 对每个单元:
|
|
35
|
+
- 运行 RED 测试,确认失败
|
|
36
|
+
- 实施最小代码
|
|
37
|
+
- 运行 GREEN 测试,确认通过
|
|
38
|
+
- 可选重构
|
|
39
|
+
4. 更新 `progress.md`
|
|
40
|
+
5. 运行验证命令
|
|
41
|
+
|
|
42
|
+
### 关键约束
|
|
43
|
+
- 不写任何生产代码直到有 RED 测试失败证据
|
|
44
|
+
- 不跳过验证步骤
|
|
45
|
+
- 每次完成都要有命令输出证据
|
|
46
|
+
- 优先使用 `parallel_subagent` 执行独立单元
|
|
47
|
+
|
|
48
|
+
### 进度记录格式
|
|
49
|
+
|
|
50
|
+
\`\`\`markdown
|
|
51
|
+
# Progress
|
|
52
|
+
|
|
53
|
+
## Status
|
|
54
|
+
[In Progress | Completed | Blocked]
|
|
55
|
+
|
|
56
|
+
## Tasks
|
|
57
|
+
- [x] Unit-1: 完成了什么
|
|
58
|
+
- [ ] Unit-2: 正在做什么
|
|
59
|
+
- [ ] Unit-3: 待开始
|
|
60
|
+
|
|
61
|
+
## Files Changed
|
|
62
|
+
- `path/to/file.ts` - 变更说明
|
|
63
|
+
|
|
64
|
+
## Blockers
|
|
65
|
+
- 当前阻塞项(如果有)
|
|
66
|
+
|
|
67
|
+
## Notes
|
|
68
|
+
- 关键决策或后续事项
|
|
69
|
+
\`\`\`
|
|
70
|
+
|
|
71
|
+
## 输出要求
|
|
72
|
+
|
|
73
|
+
完成时提供:
|
|
74
|
+
- **已完成单元**: 列表
|
|
75
|
+
- **变更文件**: 所有创建或修改的文件
|
|
76
|
+
- **执行的命令**: 所有验证命令
|
|
77
|
+
- **验证结果**: 每个命令的通过/失败状态
|
|
78
|
+
- **待办事项**: 未解决的风险或问题
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ce-parallel-review
|
|
3
|
+
description: 多角度并行审查:正确性 + 测试 + 复杂度
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## reviewer[angle=correctness]
|
|
7
|
+
reads: plan.md, progress.md, context.md
|
|
8
|
+
output: review-correctness.md
|
|
9
|
+
|
|
10
|
+
审查实现的正确性:
|
|
11
|
+
- 实现是否符合计划要求
|
|
12
|
+
- 代码逻辑是否正确
|
|
13
|
+
- 边界情况是否处理
|
|
14
|
+
- 错误处理是否完善
|
|
15
|
+
|
|
16
|
+
## reviewer[angle=tests]
|
|
17
|
+
reads: plan.md, progress.md, context.md
|
|
18
|
+
output: review-tests.md
|
|
19
|
+
|
|
20
|
+
审查测试覆盖和质量:
|
|
21
|
+
- 是否有对应的测试
|
|
22
|
+
- 测试是否覆盖关键路径
|
|
23
|
+
- 测试是否可维护
|
|
24
|
+
- 测试命名是否清晰
|
|
25
|
+
|
|
26
|
+
## reviewer[angle=complexity]
|
|
27
|
+
reads: plan.md, progress.md, context.md
|
|
28
|
+
output: review-complexity.md
|
|
29
|
+
|
|
30
|
+
审查代码复杂度和设计:
|
|
31
|
+
- 代码是否过于复杂
|
|
32
|
+
- 是否有不必要的抽象
|
|
33
|
+
- 是否遵循项目惯例
|
|
34
|
+
- 是否有潜在的性能问题
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ce-standard
|
|
3
|
+
description: 标准 Compound Engineering 工作流:Scout → Planner → Worker → Reviewer
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## scout
|
|
7
|
+
output: context.md
|
|
8
|
+
|
|
9
|
+
探索当前代码库,了解与 {task} 相关的结构和上下文。快速但不猜测,聚焦关键入口点、数据流和风险。
|
|
10
|
+
|
|
11
|
+
## planner
|
|
12
|
+
reads: context.md
|
|
13
|
+
output: plan.md
|
|
14
|
+
|
|
15
|
+
基于 {previous} 创建实施计划。遵循 TDD,每个单元必须以 RED 测试开始。命名具体文件和验证命令。
|
|
16
|
+
|
|
17
|
+
## worker
|
|
18
|
+
reads: context.md, plan.md
|
|
19
|
+
defaultProgress: true
|
|
20
|
+
output: progress.md
|
|
21
|
+
|
|
22
|
+
执行 {previous} 中的计划。遵循 RED → GREEN → REFACTOR。更新 progress.md 记录进度。
|
|
23
|
+
|
|
24
|
+
## reviewer
|
|
25
|
+
reads: plan.md, progress.md, context.md
|
|
26
|
+
output: review-report.md
|
|
27
|
+
|
|
28
|
+
审查实施结果。对照计划验证正确性,修复可自动修复的问题。报告需要用户确认的发现。
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* super-pi-extension
|
|
3
|
+
*
|
|
4
|
+
* Compound Engineering + pi-subagents integration extension
|
|
5
|
+
*
|
|
6
|
+
* Features:
|
|
7
|
+
* - Pre-configured CE Agents (ce-scout, ce-planner, ce-worker, ce-reviewer, ce-oracle)
|
|
8
|
+
* - Pre-configured CE Chains (ce-standard, ce-review-only, ce-parallel-review)
|
|
9
|
+
* - Model strategy sync: modelStrategy[stage] → subagents.agentOverrides[agent].model
|
|
10
|
+
* - Thinking strategy sync: thinkingStrategy[stage] → subagents.agentOverrides[agent].thinking
|
|
11
|
+
* - Graceful dependency detection for pi-subagents
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import * as fs from "node:fs";
|
|
15
|
+
import * as path from "node:path";
|
|
16
|
+
import * as os from "node:os";
|
|
17
|
+
import { execSync } from "node:child_process";
|
|
18
|
+
import type { ExtensionAPI, ExtensionContext } from "@mariozechner/pi-coding-agent";
|
|
19
|
+
|
|
20
|
+
// CE Stage to Agent mapping
|
|
21
|
+
const STAGE_AGENT_MAP: Record<string, string[]> = {
|
|
22
|
+
"01-brainstorm": ["ce-scout", "ce-researcher"],
|
|
23
|
+
"02-plan": ["ce-planner"],
|
|
24
|
+
"03-work": ["ce-worker"],
|
|
25
|
+
"04-review": ["ce-reviewer"],
|
|
26
|
+
"05-learn": ["ce-oracle"],
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
interface Settings {
|
|
30
|
+
modelStrategy?: Record<string, string>;
|
|
31
|
+
thinkingStrategy?: Record<string, string>;
|
|
32
|
+
subagents?: {
|
|
33
|
+
agentOverrides?: Record<string, { model?: string; thinking?: string }>;
|
|
34
|
+
};
|
|
35
|
+
[key: string]: unknown;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Read settings from file
|
|
40
|
+
*/
|
|
41
|
+
function readSettings(filePath: string): Settings {
|
|
42
|
+
if (!fs.existsSync(filePath)) return {};
|
|
43
|
+
try {
|
|
44
|
+
return JSON.parse(fs.readFileSync(filePath, "utf-8"));
|
|
45
|
+
} catch {
|
|
46
|
+
return {};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Write settings to file
|
|
52
|
+
*/
|
|
53
|
+
function writeSettings(filePath: string, settings: Settings): void {
|
|
54
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
55
|
+
fs.writeFileSync(filePath, JSON.stringify(settings, null, 2) + "\n", "utf-8");
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Sync modelStrategy and thinkingStrategy to subagents.agentOverrides
|
|
60
|
+
*/
|
|
61
|
+
function syncStrategiesToAgentOverrides(settings: Settings): Settings {
|
|
62
|
+
const modelStrategy = settings.modelStrategy;
|
|
63
|
+
const thinkingStrategy = settings.thinkingStrategy;
|
|
64
|
+
|
|
65
|
+
if (!modelStrategy && !thinkingStrategy) return settings;
|
|
66
|
+
|
|
67
|
+
const subagents = settings.subagents || { agentOverrides: {} };
|
|
68
|
+
const agentOverrides = subagents.agentOverrides || {};
|
|
69
|
+
|
|
70
|
+
for (const [stage, agents] of Object.entries(STAGE_AGENT_MAP)) {
|
|
71
|
+
const model = modelStrategy?.[stage];
|
|
72
|
+
const thinking = thinkingStrategy?.[stage];
|
|
73
|
+
|
|
74
|
+
if (model || thinking) {
|
|
75
|
+
for (const agent of agents) {
|
|
76
|
+
agentOverrides[agent] = {
|
|
77
|
+
...agentOverrides[agent],
|
|
78
|
+
...(model ? { model } : {}),
|
|
79
|
+
...(thinking ? { thinking } : {}),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return {
|
|
86
|
+
...settings,
|
|
87
|
+
subagents: {
|
|
88
|
+
...subagents,
|
|
89
|
+
agentOverrides,
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Auto-sync settings on extension load
|
|
96
|
+
*/
|
|
97
|
+
function autoSyncSettings(projectRoot?: string): void {
|
|
98
|
+
const homeSettingsPath = path.join(os.homedir(), ".pi", "agent", "settings.json");
|
|
99
|
+
const projectSettingsPath = projectRoot
|
|
100
|
+
? path.join(projectRoot, ".pi", "settings.json")
|
|
101
|
+
: null;
|
|
102
|
+
|
|
103
|
+
// Sync home settings
|
|
104
|
+
const homeSettings = readSettings(homeSettingsPath);
|
|
105
|
+
const syncedHome = syncStrategiesToAgentOverrides(homeSettings);
|
|
106
|
+
if (JSON.stringify(homeSettings) !== JSON.stringify(syncedHome)) {
|
|
107
|
+
writeSettings(homeSettingsPath, syncedHome);
|
|
108
|
+
console.log("[super-pi-extension] Synced modelStrategy + thinkingStrategy to agentOverrides");
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Sync project settings
|
|
112
|
+
if (projectSettingsPath && fs.existsSync(projectSettingsPath)) {
|
|
113
|
+
const projectSettings = readSettings(projectSettingsPath);
|
|
114
|
+
const syncedProject = syncStrategiesToAgentOverrides(projectSettings);
|
|
115
|
+
if (JSON.stringify(projectSettings) !== JSON.stringify(syncedProject)) {
|
|
116
|
+
writeSettings(projectSettingsPath, syncedProject);
|
|
117
|
+
console.log("[super-pi-extension] Synced modelStrategy + thinkingStrategy (project)");
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Check if pi-subagents extension is installed
|
|
124
|
+
*/
|
|
125
|
+
function isPiSubagentsInstalled(): boolean {
|
|
126
|
+
const extensionsDir = path.join(os.homedir(), ".pi", "agent", "extensions", "subagent");
|
|
127
|
+
return fs.existsSync(extensionsDir) && fs.existsSync(path.join(extensionsDir, "index.ts"));
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Try to install pi-subagents automatically
|
|
132
|
+
*/
|
|
133
|
+
function tryAutoInstallPiSubagents(): boolean {
|
|
134
|
+
try {
|
|
135
|
+
console.log("[super-pi-extension] Attempting to install pi-subagents...");
|
|
136
|
+
execSync("pi install npm:pi-subagents", { stdio: "inherit" });
|
|
137
|
+
return true;
|
|
138
|
+
} catch (error) {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Format installation instructions
|
|
145
|
+
*/
|
|
146
|
+
function formatInstallInstructions(): string {
|
|
147
|
+
return `
|
|
148
|
+
╔══════════════════════════════════════════════════════════════════╗
|
|
149
|
+
║ super-pi Extension Loaded ║
|
|
150
|
+
╠══════════════════════════════════════════════════════════════════╣
|
|
151
|
+
║ ⚡ For enhanced CE workflow capabilities, install pi-subagents: ║
|
|
152
|
+
║ ║
|
|
153
|
+
║ pi install npm:pi-subagents ║
|
|
154
|
+
║ ║
|
|
155
|
+
║ This enables: ║
|
|
156
|
+
║ • /run ce-worker "execute plan" ║
|
|
157
|
+
║ • /run-chain ce-standard -- implement feature ║
|
|
158
|
+
║ • Parallel review with /run-chain ce-parallel-review -- ║
|
|
159
|
+
║ ║
|
|
160
|
+
║ Without it, CE Agents/Chains won't execute. ║
|
|
161
|
+
╚══════════════════════════════════════════════════════════════════╝
|
|
162
|
+
`;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export default {
|
|
166
|
+
name: "super-pi-extension",
|
|
167
|
+
description: "Compound Engineering integration for pi-subagents",
|
|
168
|
+
|
|
169
|
+
async load(ctx: ExtensionContext): Promise<void> {
|
|
170
|
+
const cwd = ctx.cwd || process.cwd();
|
|
171
|
+
|
|
172
|
+
// Auto-sync modelStrategy + thinkingStrategy to agentOverrides
|
|
173
|
+
autoSyncSettings(cwd);
|
|
174
|
+
|
|
175
|
+
// Check for pi-subagents dependency
|
|
176
|
+
if (!isPiSubagentsInstalled()) {
|
|
177
|
+
console.warn("[super-pi-extension] pi-subagents not found. CE Agents/Chains require it.");
|
|
178
|
+
console.warn("[super-pi-extension] Run: pi install npm:pi-subagents");
|
|
179
|
+
|
|
180
|
+
// Optionally auto-install (uncomment to enable)
|
|
181
|
+
// const installed = tryAutoInstallPiSubagents();
|
|
182
|
+
// if (installed) {
|
|
183
|
+
// console.log("[super-pi-extension] pi-subagents installed successfully!");
|
|
184
|
+
// }
|
|
185
|
+
} else {
|
|
186
|
+
console.log("[super-pi-extension] pi-subagents detected. Full CE workflow enabled.");
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
console.log("[super-pi-extension] Loaded. CE agents and chains available.");
|
|
190
|
+
},
|
|
191
|
+
};
|
|
@@ -0,0 +1,204 @@
|
|
|
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
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leing2021/super-pi",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Pi-native Compound Engineering package for iterative development workflows",
|
|
@@ -47,7 +47,14 @@
|
|
|
47
47
|
"./skills"
|
|
48
48
|
],
|
|
49
49
|
"extensions": [
|
|
50
|
-
"./extensions"
|
|
50
|
+
"./extensions",
|
|
51
|
+
"./extensions/super-pi-extension"
|
|
52
|
+
],
|
|
53
|
+
"agents": [
|
|
54
|
+
"./extensions/super-pi-extension/agents"
|
|
55
|
+
],
|
|
56
|
+
"chains": [
|
|
57
|
+
"./extensions/super-pi-extension/chains"
|
|
51
58
|
]
|
|
52
59
|
}
|
|
53
60
|
}
|
package/skills/03-work/SKILL.md
CHANGED
|
@@ -11,7 +11,11 @@ See [shared pipeline instructions](../references/pipeline-config.md) for model r
|
|
|
11
11
|
|
|
12
12
|
## Core rules
|
|
13
13
|
|
|
14
|
-
- Before execution, read the `10-rules` skill and load
|
|
14
|
+
- Before execution, read the `10-rules` skill and load:
|
|
15
|
+
1. `rules/common/development-workflow.md` and `rules/common/testing.md`
|
|
16
|
+
2. **Detect the project's primary language** (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)
|
|
17
|
+
3. Load all files in the matching language-specific rules directory (e.g. `rules/typescript/`)
|
|
18
|
+
4. If the task involves frontend/browser concerns, also load `rules/web/` files
|
|
15
19
|
- Distinguish between a **plan path** input and a **bare prompt** input before doing work.
|
|
16
20
|
- Prefer deriving execution tasks from plan **implementation units**.
|
|
17
21
|
- Use **serial subagents** for tasks with dependencies.
|
|
@@ -11,7 +11,11 @@ See [shared pipeline instructions](../references/pipeline-config.md) for model r
|
|
|
11
11
|
|
|
12
12
|
## Core rules
|
|
13
13
|
|
|
14
|
-
- Before reviewing, read the `10-rules` skill and load
|
|
14
|
+
- Before reviewing, read the `10-rules` skill and load:
|
|
15
|
+
1. `rules/common/code-review.md`
|
|
16
|
+
2. **Detect the project's primary language** from the changed files (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)
|
|
17
|
+
3. Load all files in the matching language-specific rules directory (e.g. `rules/typescript/`)
|
|
18
|
+
4. If the review involves frontend/browser changes, also load `rules/web/` files
|
|
15
19
|
- Determine the **diff scope** before selecting reviewers.
|
|
16
20
|
- Use the **`review_router`** tool to automatically select reviewer personas based on diff metadata.
|
|
17
21
|
- Read the relevant **plan** artifact when one exists.
|
package/skills/10-rules/SKILL.md
CHANGED
|
@@ -29,14 +29,15 @@ Read at minimum:
|
|
|
29
29
|
### Before implementation (03-work)
|
|
30
30
|
|
|
31
31
|
Read the common minimum above, plus:
|
|
32
|
-
-
|
|
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
33
|
- `rules/web/` files if the task involves frontend/browser concerns
|
|
34
34
|
|
|
35
35
|
### Before review (04-review)
|
|
36
36
|
|
|
37
37
|
Read at minimum:
|
|
38
38
|
- `rules/common/code-review.md`
|
|
39
|
-
-
|
|
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
|
|
40
41
|
|
|
41
42
|
## Progressive loading order
|
|
42
43
|
|