@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,399 +0,0 @@
1
- // Based on pi-subagents by Nico Bailon (https://github.com/nicobailon/pi-subagents)
2
- // MIT License
3
- export const PROMPT_TEMPLATE_SUBAGENT_REQUEST_EVENT = "prompt-template:subagent:request";
4
- export const PROMPT_TEMPLATE_SUBAGENT_STARTED_EVENT = "prompt-template:subagent:started";
5
- export const PROMPT_TEMPLATE_SUBAGENT_RESPONSE_EVENT = "prompt-template:subagent:response";
6
- export const PROMPT_TEMPLATE_SUBAGENT_UPDATE_EVENT = "prompt-template:subagent:update";
7
- export const PROMPT_TEMPLATE_SUBAGENT_CANCEL_EVENT = "prompt-template:subagent:cancel";
8
-
9
- export interface PromptTemplateDelegationTask {
10
- agent: string;
11
- task: string;
12
- model?: string;
13
- cwd?: string;
14
- }
15
-
16
- export interface PromptTemplateDelegationParallelResult {
17
- agent: string;
18
- messages: unknown[];
19
- isError: boolean;
20
- errorText?: string;
21
- }
22
-
23
- export interface PromptTemplateDelegationRequest {
24
- requestId: string;
25
- agent: string;
26
- task: string;
27
- tasks?: PromptTemplateDelegationTask[];
28
- context: "fresh" | "fork";
29
- model: string;
30
- cwd: string;
31
- worktree?: boolean;
32
- }
33
-
34
- export interface PromptTemplateDelegationResponse extends PromptTemplateDelegationRequest {
35
- messages: unknown[];
36
- parallelResults?: PromptTemplateDelegationParallelResult[];
37
- contentText?: string;
38
- isError: boolean;
39
- errorText?: string;
40
- }
41
-
42
- export interface PromptTemplateDelegationTaskProgress {
43
- index?: number;
44
- agent: string;
45
- status?: string;
46
- currentTool?: string;
47
- currentToolArgs?: string;
48
- recentOutput?: string;
49
- recentOutputLines?: string[];
50
- recentTools?: Array<{ tool: string; args: string }>;
51
- model?: string;
52
- toolCount?: number;
53
- durationMs?: number;
54
- tokens?: number;
55
- }
56
-
57
- export interface PromptTemplateDelegationUpdate {
58
- requestId: string;
59
- currentTool?: string;
60
- currentToolArgs?: string;
61
- recentOutput?: string;
62
- recentOutputLines?: string[];
63
- recentTools?: Array<{ tool: string; args: string }>;
64
- model?: string;
65
- toolCount?: number;
66
- durationMs?: number;
67
- tokens?: number;
68
- taskProgress?: PromptTemplateDelegationTaskProgress[];
69
- }
70
-
71
- export interface PromptTemplateBridgeEvents {
72
- on(event: string, handler: (data: unknown) => void): (() => void) | void;
73
- emit(event: string, data: unknown): void;
74
- }
75
-
76
- interface PromptTemplateBridgeResult {
77
- isError?: boolean;
78
- content?: unknown;
79
- details?: {
80
- results?: Array<{
81
- agent?: string;
82
- messages?: unknown[];
83
- finalOutput?: string;
84
- exitCode?: number;
85
- error?: string;
86
- model?: string;
87
- }>;
88
- progress?: Array<{
89
- index?: number;
90
- agent?: string;
91
- status?: string;
92
- currentTool?: string;
93
- currentToolArgs?: string;
94
- recentOutput?: string[];
95
- recentTools?: Array<{ tool?: string; args?: string }>;
96
- toolCount?: number;
97
- durationMs?: number;
98
- tokens?: number;
99
- }>;
100
- };
101
- }
102
-
103
- export interface PromptTemplateBridgeOptions<Ctx extends { cwd?: string }> {
104
- events: PromptTemplateBridgeEvents;
105
- getContext: () => Ctx | null;
106
- execute: (
107
- requestId: string,
108
- request: PromptTemplateDelegationRequest,
109
- signal: AbortSignal,
110
- ctx: Ctx,
111
- onUpdate: (result: PromptTemplateBridgeResult) => void,
112
- ) => Promise<PromptTemplateBridgeResult>;
113
- }
114
-
115
- function parseDelegationTasks(tasks: unknown): PromptTemplateDelegationTask[] {
116
- if (!Array.isArray(tasks)) return [];
117
- const parsed: PromptTemplateDelegationTask[] = [];
118
- for (const item of tasks) {
119
- if (!item || typeof item !== "object") return [];
120
- const value = item as Partial<PromptTemplateDelegationTask>;
121
- if (typeof value.agent !== "string" || !value.agent.trim()) return [];
122
- if (typeof value.task !== "string" || !value.task.trim()) return [];
123
- const model = typeof value.model === "string" && value.model.trim().length > 0 ? value.model : undefined;
124
- const cwd = typeof value.cwd === "string" && value.cwd.trim().length > 0 ? value.cwd : undefined;
125
- parsed.push({
126
- agent: value.agent,
127
- task: value.task,
128
- ...(model ? { model } : {}),
129
- ...(cwd ? { cwd } : {}),
130
- });
131
- }
132
- return parsed;
133
- }
134
-
135
- export function parsePromptTemplateRequest(data: unknown): PromptTemplateDelegationRequest | undefined {
136
- if (!data || typeof data !== "object") return undefined;
137
- const value = data as Partial<PromptTemplateDelegationRequest> & { tasks?: unknown };
138
- if (typeof value.requestId !== "string" || !value.requestId) return undefined;
139
- if (typeof value.model !== "string" || !value.model) return undefined;
140
- if (typeof value.cwd !== "string" || !value.cwd) return undefined;
141
- if (value.context !== "fresh" && value.context !== "fork") return undefined;
142
- const tasks = parseDelegationTasks(value.tasks);
143
- const worktree = value.worktree === true ? true : undefined;
144
- const hasSingle =
145
- typeof value.agent === "string" &&
146
- value.agent.length > 0 &&
147
- typeof value.task === "string" &&
148
- value.task.length > 0;
149
- if (!hasSingle && tasks.length === 0) return undefined;
150
-
151
- const fallbackTask = tasks[0];
152
- return {
153
- requestId: value.requestId,
154
- agent: hasSingle ? value.agent : fallbackTask!.agent,
155
- task: hasSingle ? value.task : fallbackTask!.task,
156
- ...(tasks.length > 0 ? { tasks } : {}),
157
- context: value.context,
158
- model: value.model,
159
- cwd: value.cwd,
160
- ...(worktree ? { worktree } : {}),
161
- };
162
- }
163
-
164
- export function firstTextContent(content: unknown): string | undefined {
165
- if (!Array.isArray(content)) return undefined;
166
- for (const part of content) {
167
- if (!part || typeof part !== "object") continue;
168
- if ((part as { type?: string }).type !== "text") continue;
169
- const text = (part as { text?: unknown }).text;
170
- if (typeof text === "string" && text.trim()) return text.trim();
171
- }
172
- return undefined;
173
- }
174
-
175
- function filterRecentOutput(lines: string[] | undefined): string[] | undefined {
176
- if (!lines || lines.length === 0) return undefined;
177
- const filtered = lines.filter((line) => typeof line === "string" && line.trim() && line.trim() !== "(running...)");
178
- if (filtered.length === 0) return undefined;
179
- return filtered;
180
- }
181
-
182
- function sanitizeRecentTools(
183
- tools: Array<{ tool?: string; args?: string }> | undefined,
184
- ): Array<{ tool: string; args: string }> | undefined {
185
- if (!tools || tools.length === 0) return undefined;
186
- const sanitized = tools.flatMap((entry) => {
187
- if (typeof entry.tool !== "string" || entry.tool.trim().length === 0) return [];
188
- return [{
189
- tool: entry.tool,
190
- args: typeof entry.args === "string" ? entry.args : String(entry.args ?? ""),
191
- }];
192
- });
193
- return sanitized.length > 0 ? sanitized : undefined;
194
- }
195
-
196
- function resolveProgressModel(
197
- update: PromptTemplateBridgeResult,
198
- entry: { index?: number; agent?: string },
199
- ): string | undefined {
200
- const results = update.details?.results;
201
- if (!results || results.length === 0) return undefined;
202
- if (typeof entry.index === "number" && entry.index >= 0) {
203
- const byIndex = results[entry.index];
204
- if (typeof byIndex?.model === "string") return byIndex.model;
205
- }
206
- if (entry.agent) {
207
- const byAgent = results.find((result) => result.agent === entry.agent && typeof result.model === "string");
208
- if (byAgent?.model) return byAgent.model;
209
- }
210
- const firstWithModel = results.find((result) => typeof result.model === "string");
211
- return firstWithModel?.model;
212
- }
213
-
214
- function buildDelegationMessages(result: { messages?: unknown[]; finalOutput?: string }, fallbackText?: string): unknown[] {
215
- if (Array.isArray(result.messages) && result.messages.length > 0) return result.messages;
216
- const text = typeof result.finalOutput === "string" && result.finalOutput.trim().length > 0
217
- ? result.finalOutput.trim()
218
- : fallbackText;
219
- if (!text) return [];
220
- return [{ role: "assistant", content: [{ type: "text", text }] }];
221
- }
222
-
223
- function toDelegationUpdate(requestId: string, update: PromptTemplateBridgeResult): PromptTemplateDelegationUpdate | undefined {
224
- const progress = update.details?.progress?.[0];
225
- const taskProgress = update.details?.progress?.map((entry) => {
226
- const lastOutput = entry.recentOutput?.[entry.recentOutput.length - 1];
227
- const safeLastOutput =
228
- typeof lastOutput === "string" && lastOutput.trim() && lastOutput !== "(running...)"
229
- ? lastOutput
230
- : undefined;
231
- return {
232
- index: entry.index,
233
- agent: entry.agent ?? "delegate",
234
- status: entry.status,
235
- currentTool: entry.currentTool,
236
- currentToolArgs: entry.currentToolArgs,
237
- recentOutput: safeLastOutput,
238
- recentOutputLines: filterRecentOutput(entry.recentOutput),
239
- recentTools: sanitizeRecentTools(entry.recentTools),
240
- model: resolveProgressModel(update, entry),
241
- toolCount: entry.toolCount,
242
- durationMs: entry.durationMs,
243
- tokens: entry.tokens,
244
- };
245
- });
246
- if (!progress && (!taskProgress || taskProgress.length === 0)) return undefined;
247
- const lastOutput = progress?.recentOutput?.[progress.recentOutput.length - 1];
248
- const safeLastOutput =
249
- typeof lastOutput === "string" && lastOutput.trim() && lastOutput !== "(running...)"
250
- ? lastOutput
251
- : undefined;
252
- return {
253
- requestId,
254
- currentTool: progress?.currentTool,
255
- currentToolArgs: progress?.currentToolArgs,
256
- recentOutput: safeLastOutput,
257
- recentOutputLines: filterRecentOutput(progress?.recentOutput),
258
- recentTools: sanitizeRecentTools(progress?.recentTools),
259
- model: progress ? resolveProgressModel(update, progress) : undefined,
260
- toolCount: progress?.toolCount,
261
- durationMs: progress?.durationMs,
262
- tokens: progress?.tokens,
263
- taskProgress,
264
- };
265
- }
266
-
267
- export function registerPromptTemplateDelegationBridge<Ctx extends { cwd?: string }>(
268
- options: PromptTemplateBridgeOptions<Ctx>,
269
- ): {
270
- cancelAll: () => void;
271
- dispose: () => void;
272
- } {
273
- const controllers = new Map<string, AbortController>();
274
- const pendingCancels = new Set<string>();
275
- const subscriptions: Array<() => void> = [];
276
-
277
- const subscribe = (event: string, handler: (data: unknown) => void): void => {
278
- const unsubscribe = options.events.on(event, handler);
279
- if (typeof unsubscribe === "function") subscriptions.push(unsubscribe);
280
- };
281
-
282
- subscribe(PROMPT_TEMPLATE_SUBAGENT_CANCEL_EVENT, (data) => {
283
- if (!data || typeof data !== "object") return;
284
- const requestId = (data as { requestId?: unknown }).requestId;
285
- if (typeof requestId !== "string") return;
286
- const controller = controllers.get(requestId);
287
- if (controller) {
288
- controller.abort();
289
- return;
290
- }
291
- pendingCancels.add(requestId);
292
- });
293
-
294
- subscribe(PROMPT_TEMPLATE_SUBAGENT_REQUEST_EVENT, async (data) => {
295
- const request = parsePromptTemplateRequest(data);
296
- if (!request) return;
297
-
298
- const ctx = options.getContext();
299
- if (!ctx) {
300
- const response: PromptTemplateDelegationResponse = {
301
- ...request,
302
- messages: [],
303
- isError: true,
304
- errorText: "No active extension context for delegated subagent execution.",
305
- };
306
- options.events.emit(PROMPT_TEMPLATE_SUBAGENT_RESPONSE_EVENT, response);
307
- return;
308
- }
309
-
310
- const controller = new AbortController();
311
- controllers.set(request.requestId, controller);
312
-
313
- if (pendingCancels.delete(request.requestId)) {
314
- controller.abort();
315
- const response: PromptTemplateDelegationResponse = {
316
- ...request,
317
- messages: [],
318
- isError: true,
319
- errorText: "Delegated prompt cancelled.",
320
- };
321
- options.events.emit(PROMPT_TEMPLATE_SUBAGENT_RESPONSE_EVENT, response);
322
- controllers.delete(request.requestId);
323
- return;
324
- }
325
-
326
- options.events.emit(PROMPT_TEMPLATE_SUBAGENT_STARTED_EVENT, { requestId: request.requestId });
327
-
328
- try {
329
- const result = await options.execute(
330
- request.requestId,
331
- request,
332
- controller.signal,
333
- ctx,
334
- (update) => {
335
- const payload = toDelegationUpdate(request.requestId, update);
336
- if (!payload) return;
337
- options.events.emit(PROMPT_TEMPLATE_SUBAGENT_UPDATE_EVENT, payload);
338
- },
339
- );
340
- const contentText = firstTextContent(result.content);
341
- const messages = buildDelegationMessages(result.details?.results?.[0] ?? {}, contentText);
342
- const parallelResults = request.tasks
343
- ? request.tasks.map<PromptTemplateDelegationParallelResult>((task, index) => {
344
- const step = result.details?.results?.[index];
345
- if (!step) {
346
- return {
347
- agent: task.agent,
348
- messages: [],
349
- isError: true,
350
- errorText: "Missing result for delegated parallel task.",
351
- };
352
- }
353
- const exitCode = typeof step.exitCode === "number" ? step.exitCode : undefined;
354
- const errorText = step.error;
355
- return {
356
- agent: step.agent ?? task.agent,
357
- messages: buildDelegationMessages(step),
358
- isError: (exitCode !== undefined && exitCode !== 0) || !!errorText,
359
- errorText: errorText || undefined,
360
- };
361
- })
362
- : undefined;
363
- const response: PromptTemplateDelegationResponse = {
364
- ...request,
365
- messages,
366
- ...(parallelResults ? { parallelResults } : {}),
367
- ...(contentText ? { contentText } : {}),
368
- isError: result.isError === true,
369
- errorText: result.isError ? contentText : undefined,
370
- };
371
- options.events.emit(PROMPT_TEMPLATE_SUBAGENT_RESPONSE_EVENT, response);
372
- } catch (error) {
373
- const response: PromptTemplateDelegationResponse = {
374
- ...request,
375
- messages: [],
376
- isError: true,
377
- errorText: error instanceof Error ? error.message : String(error),
378
- };
379
- options.events.emit(PROMPT_TEMPLATE_SUBAGENT_RESPONSE_EVENT, response);
380
- } finally {
381
- controllers.delete(request.requestId);
382
- }
383
- });
384
-
385
- return {
386
- cancelAll: () => {
387
- for (const controller of controllers.values()) {
388
- controller.abort();
389
- }
390
- controllers.clear();
391
- pendingCancels.clear();
392
- },
393
- dispose: () => {
394
- for (const unsubscribe of subscriptions) unsubscribe();
395
- subscriptions.length = 0;
396
- pendingCancels.clear();
397
- },
398
- };
399
- }
@@ -1,13 +0,0 @@
1
- ---
2
- description: Use subagents to gather context, then ask clarifying questions
3
- ---
4
-
5
- Based on our discussion and my intent, launch focused context-gathering subagents before planning or implementing.
6
-
7
- Use `scout` to inspect the relevant local files, existing patterns, constraints, tests, and likely integration points. Use `researcher` when external docs, recent sources, ecosystem context, or primary evidence would improve the answer.
8
-
9
- Give each subagent a specific meta prompt. Ask them to return concise findings plus the remaining clarification questions that matter for implementation confidence.
10
-
11
- After they return, synthesize what we know and use the `interview` tool to ask me the unresolved questions needed to reach a shared understanding.
12
-
13
- $@
@@ -1,42 +0,0 @@
1
- ---
2
- description: Parallel cleanup review
3
- ---
4
-
5
- Launch two fresh-context reviewer subagents for an adversarial cleanup review of the current work. Reviewers must inspect the repository, relevant instructions, and current diff directly from files and commands. Do not rely on this prompt as a substitute for reading the code.
6
-
7
- Reviewer 1: deslop pass.
8
-
9
- Ask this reviewer to look for AI-slop patterns in the changed scope:
10
- - comments that restate code, placeholder text, stale rationale, or debug leftovers;
11
- - defensive checks that hide useful errors, return vague defaults, or validate trusted internal data after a real boundary was already crossed;
12
- - type escapes, broad casts, duplicated type definitions, or object-bag typing where a local source-of-truth type exists;
13
- - style drift from nearby non-slop code and project instructions;
14
- - generated-sounding docs, changelog text, UI copy, status text, or test names;
15
- - pass-through wrappers, dead helpers, duplicate helper signatures, duplicated test harness setup, or abstractions that do not enforce an invariant;
16
- - UI or CLI copy that is noisy, vague, brittle, or makes the user do extra interpretation.
17
-
18
- Tell this reviewer to treat tool output and slop-scan-style findings as leads, not verdicts. It should flag only concrete issues in the requested scope with evidence, severity, file/line references, and the smallest safe fix.
19
-
20
- Reviewer 2: verbosity pass.
21
-
22
- Ask this reviewer to look for needless verbosity in code, tests, docs, status text, grouped messages, receipts, and changelog wording:
23
- - single-use helpers that merely paraphrase an expression;
24
- - temporary variables that only name obvious expressions;
25
- - nested returns or branches that can become direct returns without hiding intent;
26
- - multi-line cleanup scaffolding that can use a local direct pattern while preserving cleanup semantics;
27
- - repeated boilerplate that can use an existing local fixture or a small local helper;
28
- - tests that restate formatter details already covered at a cheaper layer;
29
- - prose that says the same thing twice, sounds generic, or buries the important rule.
30
-
31
- Tell this reviewer that shorter is only better when it is clearer and preserves behavior, error signals, cleanup semantics, useful invariants, and local style.
32
-
33
- Both reviewers are review-only. They must not edit files unless I explicitly ask for a writer pass. Their response should be review feedback, not a context summary. Ask them to return concise, evidence-backed findings with file/line references and suggested fixes.
34
-
35
- While reviewers run, do your own narrow inspection if useful. After they return, synthesize the feedback into:
36
- - fixes worth doing now;
37
- - optional improvements;
38
- - feedback to ignore or defer, with a short reason.
39
-
40
- Do not blindly apply every reviewer suggestion. Ask before applying fixes unless I already told you to address review feedback.
41
-
42
- $@
@@ -1,50 +0,0 @@
1
- ---
2
- description: Parallel subagents research
3
- ---
4
-
5
- Launch parallel research subagents to build a grounded answer to the current question or decision.
6
-
7
- Use fresh context, not forked context, unless I explicitly ask for forked context. Researchers and scouts should inspect sources directly instead of relying on the main conversation history.
8
-
9
- Use a combination of `researcher` and `scout` subagents:
10
- - Use `researcher` for web, docs, standards, ecosystem, recent changes, benchmarks, and primary-source evidence.
11
- - Use `scout` for local codebase context, existing implementation patterns, repo constraints, and files that would be affected.
12
-
13
- Give each subagent a distinct angle. Unless I specify angles, use these three:
14
-
15
- 1. External evidence
16
- Use `researcher` to find current, authoritative sources: official docs, specs, release notes, benchmarks, issue threads, or primary explanations.
17
-
18
- 2. Local code context
19
- Use `scout` to inspect the repository for relevant files, existing patterns, constraints, tests, and likely integration points.
20
-
21
- 3. Practical tradeoffs
22
- Use `researcher` or `scout`, whichever fits the question, to compare options, risks, edge cases, maintenance cost, and what would be easiest to validate.
23
-
24
- Adapt the angles when the question calls for it:
25
- - Library/API questions: include official docs and recent examples.
26
- - Architecture decisions: include local module boundaries, dependency direction, and migration cost.
27
- - Debugging questions: include likely failure modes, local call paths, and exact error evidence.
28
- - UI/product questions: include user flow, accessibility, design precedent, and implementation constraints.
29
- - Time-sensitive topics: include a recent-developments angle and prefer 2026/2025 sources.
30
-
31
- Prefer two or three strong subagents over many vague ones. The parent agent should frame the question and assign angles; the child agents should research or scout, not invent broad plans.
32
-
33
- Ask each subagent to return concise findings with evidence:
34
- - file paths and line ranges for local findings
35
- - source links for external findings
36
- - confidence level and gaps
37
- - recommended next step or decision implication
38
-
39
- Do not ask subagents to edit files. This is a research pass only unless I explicitly ask for implementation.
40
-
41
- After the subagents return, synthesize the answer into:
42
- - what we know
43
- - what the local codebase implies
44
- - tradeoffs and risks
45
- - gaps or assumptions
46
- - the recommended next move
47
-
48
- If findings disagree, call out the disagreement instead of smoothing it over.
49
-
50
- $@
@@ -1,40 +0,0 @@
1
- ---
2
- description: Parallel subagents review
3
- ---
4
-
5
- Launch parallel reviewers for an adversarial review of the current work.
6
-
7
- Use fresh context, not forked context, unless I explicitly ask for forked context. Reviewers should inspect the repository, relevant instructions, and current diff directly from files and commands. Do not rely on the main conversation history.
8
-
9
- Give each reviewer a distinct angle. Generate the angles dynamically from the user's intent, the plan, the implemented code, and the current diff. If I specify angles, use mine. Otherwise, choose the highest-value review angles for this specific work.
10
-
11
- These are examples, not fixed defaults:
12
-
13
- 1. Correctness and regressions
14
- Check whether the change satisfies the request, preserves existing behavior, handles edge cases, and avoids hidden runtime failures.
15
-
16
- 2. Tests and validation
17
- Check whether tests or validation were added at the right layer, whether assertions are meaningful, and whether the chosen verification commands are enough.
18
-
19
- 3. Simplicity and maintainability
20
- Check for unnecessary complexity, duplicate structure, single-use wrappers, brittle abstractions, confusing names, verbosity, and cleanup that is clearly worth doing.
21
-
22
- Choose or adapt angles when the work calls for it:
23
- - TypeScript-heavy changes: include type safety, source-of-truth types, casts, and error-boundary discipline.
24
- - UI-heavy changes: include UX, accessibility, copy, and visual quality.
25
- - Security-sensitive changes: include unsafe input/output handling, auth boundaries, privacy, and data exposure.
26
- - Docs-heavy changes: include clarity, accuracy, completeness, reader flow, and non-robotic prose.
27
- - Large multi-file changes: consider a fourth reviewer for structural friction, module boundaries, and testability.
28
-
29
- Prefer three strong reviewers over many vague reviewers.
30
-
31
- Give every reviewer a specific task prompt naming its angle. Ask reviewers to return concise, evidence-backed findings with file/line references and suggested fixes. The response should be review feedback, not a context summary. Reviewers must not edit files unless I explicitly ask for a writer pass.
32
-
33
- While reviewers run, do your own narrow inspection if useful. After they return, synthesize the feedback into:
34
- - fixes worth doing now
35
- - optional improvements
36
- - feedback to ignore or defer, with a short reason
37
-
38
- Do not blindly apply every reviewer suggestion. Ask before applying fixes unless I already told you to address review feedback.
39
-
40
- $@
@@ -1,82 +0,0 @@
1
- // Based on pi-subagents by Nico Bailon (https://github.com/nicobailon/pi-subagents)
2
- // MIT License
3
- import type { Theme } from "@mariozechner/pi-coding-agent";
4
- import { truncateToWidth, visibleWidth } from "@mariozechner/pi-tui";
5
-
6
- function fuzzyScore(query: string, text: string): number {
7
- const lq = query.toLowerCase();
8
- const lt = text.toLowerCase();
9
- if (lt.includes(lq)) return 100 + (lq.length / lt.length) * 50;
10
- let score = 0;
11
- let qi = 0;
12
- let consecutive = 0;
13
- for (let i = 0; i < lt.length && qi < lq.length; i++) {
14
- if (lt[i] === lq[qi]) {
15
- score += 10 + consecutive;
16
- consecutive += 5;
17
- qi++;
18
- } else {
19
- consecutive = 0;
20
- }
21
- }
22
- return qi === lq.length ? score : 0;
23
- }
24
-
25
- export function fuzzyFilter<T extends { name: string; description: string; model?: string }>(items: T[], query: string): T[] {
26
- const q = query.trim();
27
- if (!q) return items;
28
- return items
29
- .map((item) => ({ item, score: Math.max(fuzzyScore(q, item.name), fuzzyScore(q, item.description) * 0.8, fuzzyScore(q, item.model ?? "") * 0.6) }))
30
- .filter((x) => x.score > 0)
31
- .sort((a, b) => b.score - a.score)
32
- .map((x) => x.item);
33
- }
34
-
35
- export function pad(s: string, len: number): string {
36
- const vis = visibleWidth(s);
37
- return s + " ".repeat(Math.max(0, len - vis));
38
- }
39
-
40
- export function row(content: string, width: number, theme: Theme): string {
41
- const innerW = width - 2;
42
- const singleLine = content.replace(/[\r\n]+/g, " ").replace(/\t/g, " ");
43
- const clipped = truncateToWidth(singleLine, innerW);
44
- return theme.fg("border", "│") + pad(clipped, innerW) + theme.fg("border", "│");
45
- }
46
-
47
- export function renderHeader(text: string, width: number, theme: Theme): string {
48
- const innerW = width - 2;
49
- const padLen = Math.max(0, innerW - visibleWidth(text));
50
- const padLeft = Math.floor(padLen / 2);
51
- const padRight = padLen - padLeft;
52
- return (
53
- theme.fg("border", "╭" + "─".repeat(padLeft)) +
54
- theme.fg("accent", text) +
55
- theme.fg("border", "─".repeat(padRight) + "╮")
56
- );
57
- }
58
-
59
- export function formatPath(filePath: string): string {
60
- const home = process.env.HOME;
61
- if (home && filePath.startsWith(home)) return `~${filePath.slice(home.length)}`;
62
- return filePath;
63
- }
64
-
65
- export function formatScrollInfo(above: number, below: number): string {
66
- let info = "";
67
- if (above > 0) info += `↑ ${above} more`;
68
- if (below > 0) info += `${info ? " " : ""}↓ ${below} more`;
69
- return info;
70
- }
71
-
72
- export function renderFooter(text: string, width: number, theme: Theme): string {
73
- const innerW = width - 2;
74
- const padLen = Math.max(0, innerW - visibleWidth(text));
75
- const padLeft = Math.floor(padLen / 2);
76
- const padRight = padLen - padLeft;
77
- return (
78
- theme.fg("border", "╰" + "─".repeat(padLeft)) +
79
- theme.fg("dim", text) +
80
- theme.fg("border", "─".repeat(padRight) + "╯")
81
- );
82
- }