@leing2021/super-pi 0.21.0 → 0.22.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +157 -357
  3. package/THIRD-PARTY-NOTICES.md +35 -0
  4. package/extensions/subagent/__tests__/async-job-tracker.test.ts +21 -0
  5. package/extensions/subagent/__tests__/execution-activity.test.ts +15 -0
  6. package/extensions/subagent/__tests__/parallel-render-stress.test.ts +82 -0
  7. package/extensions/subagent/__tests__/render-dedup.test.ts +98 -0
  8. package/extensions/subagent/__tests__/render-widget.test.ts +28 -0
  9. package/extensions/subagent/__tests__/throttle.test.ts +90 -0
  10. package/extensions/subagent/agent-management.ts +596 -0
  11. package/extensions/subagent/agent-manager-chain-detail.ts +163 -0
  12. package/extensions/subagent/agent-manager-detail.ts +232 -0
  13. package/extensions/subagent/agent-manager-edit.ts +391 -0
  14. package/extensions/subagent/agent-manager-list.ts +279 -0
  15. package/extensions/subagent/agent-manager-parallel.ts +305 -0
  16. package/extensions/subagent/agent-manager.ts +706 -0
  17. package/extensions/subagent/agent-scope.ts +9 -0
  18. package/extensions/subagent/agent-selection.ts +26 -0
  19. package/extensions/subagent/agent-serializer.ts +124 -0
  20. package/extensions/subagent/agent-templates.ts +63 -0
  21. package/extensions/subagent/agents/context-builder.md +37 -0
  22. package/extensions/subagent/agents/delegate.md +9 -0
  23. package/extensions/subagent/agents/oracle.md +73 -0
  24. package/extensions/subagent/agents/planner.md +52 -0
  25. package/extensions/subagent/agents/researcher.md +50 -0
  26. package/extensions/subagent/agents/reviewer.md +38 -0
  27. package/extensions/subagent/agents/scout.md +48 -0
  28. package/extensions/subagent/agents/worker.md +52 -0
  29. package/extensions/subagent/agents.ts +762 -0
  30. package/extensions/subagent/artifacts.ts +101 -0
  31. package/extensions/subagent/async-execution.ts +521 -0
  32. package/extensions/subagent/async-job-tracker.ts +240 -0
  33. package/extensions/subagent/async-status.ts +242 -0
  34. package/extensions/subagent/chain-clarify.ts +1365 -0
  35. package/extensions/subagent/chain-execution.ts +854 -0
  36. package/extensions/subagent/chain-serializer.ts +127 -0
  37. package/extensions/subagent/completion-dedupe.ts +66 -0
  38. package/extensions/subagent/doctor.ts +201 -0
  39. package/extensions/subagent/execution.ts +748 -0
  40. package/extensions/subagent/file-coalescer.ts +43 -0
  41. package/extensions/subagent/fork-context.ts +64 -0
  42. package/extensions/subagent/formatters.ts +123 -0
  43. package/extensions/subagent/frontmatter.ts +32 -0
  44. package/extensions/subagent/index.ts +586 -0
  45. package/extensions/subagent/intercom-bridge.ts +241 -0
  46. package/extensions/subagent/jsonl-writer.ts +84 -0
  47. package/extensions/subagent/model-fallback.ts +109 -0
  48. package/extensions/subagent/notify.ts +111 -0
  49. package/extensions/subagent/parallel-utils.ts +109 -0
  50. package/extensions/subagent/pi-args.ts +139 -0
  51. package/extensions/subagent/pi-spawn.ts +101 -0
  52. package/extensions/subagent/post-exit-stdio-guard.ts +88 -0
  53. package/extensions/subagent/prompt-template-bridge.ts +400 -0
  54. package/extensions/subagent/prompts/gather-context-and-clarify.md +13 -0
  55. package/extensions/subagent/prompts/parallel-cleanup.md +42 -0
  56. package/extensions/subagent/prompts/parallel-research.md +50 -0
  57. package/extensions/subagent/prompts/parallel-review.md +40 -0
  58. package/extensions/subagent/render-helpers.ts +83 -0
  59. package/extensions/subagent/render.ts +908 -0
  60. package/extensions/subagent/result-intercom.ts +238 -0
  61. package/extensions/subagent/result-watcher.ts +172 -0
  62. package/extensions/subagent/run-history.ts +58 -0
  63. package/extensions/subagent/run-status.ts +137 -0
  64. package/extensions/subagent/schemas.ts +165 -0
  65. package/extensions/subagent/session-tokens.ts +51 -0
  66. package/extensions/subagent/settings.ts +368 -0
  67. package/extensions/subagent/single-output.ts +98 -0
  68. package/extensions/subagent/skills.ts +627 -0
  69. package/extensions/subagent/slash-bridge.ts +177 -0
  70. package/extensions/subagent/slash-commands.ts +304 -0
  71. package/extensions/subagent/slash-live-state.ts +295 -0
  72. package/extensions/subagent/subagent-control.ts +151 -0
  73. package/extensions/subagent/subagent-executor.ts +1915 -0
  74. package/extensions/subagent/subagent-prompt-runtime.ts +76 -0
  75. package/extensions/subagent/subagent-runner.ts +1471 -0
  76. package/extensions/subagent/subagents-status.ts +473 -0
  77. package/extensions/subagent/text-editor.ts +273 -0
  78. package/extensions/subagent/throttle.ts +77 -0
  79. package/extensions/subagent/top-level-async.ts +16 -0
  80. package/extensions/subagent/types.ts +624 -0
  81. package/extensions/subagent/utils.ts +457 -0
  82. package/extensions/subagent/worktree.ts +580 -0
  83. package/extensions/super-pi-extension/index.ts +2 -55
  84. package/package.json +14 -6
  85. package/skills/pi-subagents/SKILL.md +566 -0
@@ -0,0 +1,9 @@
1
+ // SPDX-FileCopyrightText: 2025 Nico Bailon
2
+ // SPDX-License-Identifier: MIT
3
+ // Source: https://github.com/nicobailon/pi-subagents
4
+ import type { AgentScope } from "./agents.ts";
5
+
6
+ export function resolveExecutionAgentScope(scope: unknown): AgentScope {
7
+ if (scope === "user" || scope === "project" || scope === "both") return scope;
8
+ return "both";
9
+ }
@@ -0,0 +1,26 @@
1
+ // SPDX-FileCopyrightText: 2025 Nico Bailon
2
+ // SPDX-License-Identifier: MIT
3
+ // Source: https://github.com/nicobailon/pi-subagents
4
+ import type { AgentScope, AgentConfig } from "./agents.ts";
5
+
6
+ export function mergeAgentsForScope(
7
+ scope: AgentScope,
8
+ userAgents: AgentConfig[],
9
+ projectAgents: AgentConfig[],
10
+ builtinAgents: AgentConfig[] = [],
11
+ ): AgentConfig[] {
12
+ const agentMap = new Map<string, AgentConfig>();
13
+
14
+ for (const agent of builtinAgents) agentMap.set(agent.name, agent);
15
+
16
+ if (scope === "both") {
17
+ for (const agent of userAgents) agentMap.set(agent.name, agent);
18
+ for (const agent of projectAgents) agentMap.set(agent.name, agent);
19
+ } else if (scope === "user") {
20
+ for (const agent of userAgents) agentMap.set(agent.name, agent);
21
+ } else {
22
+ for (const agent of projectAgents) agentMap.set(agent.name, agent);
23
+ }
24
+
25
+ return Array.from(agentMap.values());
26
+ }
@@ -0,0 +1,124 @@
1
+ // SPDX-FileCopyrightText: 2025 Nico Bailon
2
+ // SPDX-License-Identifier: MIT
3
+ // Source: https://github.com/nicobailon/pi-subagents
4
+ import * as fs from "node:fs";
5
+ import type { AgentConfig } from "./agents.ts";
6
+
7
+ export const KNOWN_FIELDS = new Set([
8
+ "name",
9
+ "description",
10
+ "tools",
11
+ "model",
12
+ "fallbackModels",
13
+ "thinking",
14
+ "systemPromptMode",
15
+ "inheritProjectContext",
16
+ "inheritSkills",
17
+ "skill",
18
+ "skills",
19
+ "extensions",
20
+ "output",
21
+ "defaultReads",
22
+ "defaultProgress",
23
+ "interactive",
24
+ "maxSubagentDepth",
25
+ ]);
26
+
27
+ function joinComma(values: string[] | undefined): string | undefined {
28
+ if (!values || values.length === 0) return undefined;
29
+ return values.join(", ");
30
+ }
31
+
32
+ export function serializeAgent(config: AgentConfig): string {
33
+ const lines: string[] = [];
34
+ lines.push("---");
35
+ lines.push(`name: ${config.name}`);
36
+ lines.push(`description: ${config.description}`);
37
+
38
+ const tools = [
39
+ ...(config.tools ?? []),
40
+ ...(config.mcpDirectTools ?? []).map((tool) => `mcp:${tool}`),
41
+ ];
42
+ const toolsValue = joinComma(tools);
43
+ if (toolsValue) lines.push(`tools: ${toolsValue}`);
44
+
45
+ if (config.model) lines.push(`model: ${config.model}`);
46
+ const fallbackModelsValue = joinComma(config.fallbackModels);
47
+ if (fallbackModelsValue) lines.push(`fallbackModels: ${fallbackModelsValue}`);
48
+ if (config.thinking && config.thinking !== "off") lines.push(`thinking: ${config.thinking}`);
49
+ lines.push(`systemPromptMode: ${config.systemPromptMode}`);
50
+ lines.push(`inheritProjectContext: ${config.inheritProjectContext ? "true" : "false"}`);
51
+ lines.push(`inheritSkills: ${config.inheritSkills ? "true" : "false"}`);
52
+
53
+ const skillsValue = joinComma(config.skills);
54
+ if (skillsValue) lines.push(`skills: ${skillsValue}`);
55
+
56
+ if (config.extensions !== undefined) {
57
+ const extensionsValue = joinComma(config.extensions);
58
+ lines.push(`extensions: ${extensionsValue ?? ""}`);
59
+ }
60
+
61
+ if (config.output) lines.push(`output: ${config.output}`);
62
+
63
+ const readsValue = joinComma(config.defaultReads);
64
+ if (readsValue) lines.push(`defaultReads: ${readsValue}`);
65
+
66
+ if (config.defaultProgress) lines.push("defaultProgress: true");
67
+ if (config.interactive) lines.push("interactive: true");
68
+ if (Number.isInteger(config.maxSubagentDepth) && config.maxSubagentDepth >= 0) {
69
+ lines.push(`maxSubagentDepth: ${config.maxSubagentDepth}`);
70
+ }
71
+
72
+ if (config.extraFields) {
73
+ for (const [key, value] of Object.entries(config.extraFields)) {
74
+ if (KNOWN_FIELDS.has(key)) continue;
75
+ lines.push(`${key}: ${value}`);
76
+ }
77
+ }
78
+
79
+ lines.push("---");
80
+
81
+ const body = config.systemPrompt ?? "";
82
+ return `${lines.join("\n")}\n\n${body}\n`;
83
+ }
84
+
85
+ export function updateFrontmatterField(filePath: string, field: string, value: string | undefined): void {
86
+ const raw = fs.readFileSync(filePath, "utf-8");
87
+ const normalized = raw.replace(/\r\n/g, "\n");
88
+ if (!normalized.startsWith("---")) {
89
+ throw new Error("Frontmatter not found");
90
+ }
91
+
92
+ const endIndex = normalized.indexOf("\n---", 3);
93
+ if (endIndex === -1) {
94
+ throw new Error("Frontmatter not found");
95
+ }
96
+
97
+ const frontmatterBlock = normalized.slice(4, endIndex);
98
+ const rest = normalized.slice(endIndex + 4);
99
+ const lines = frontmatterBlock.split("\n");
100
+
101
+ const normalizedField = field === "skill" || field === "skills" ? "skills" : field;
102
+ const targetKeys = field === "skills" ? new Set(["skill", "skills"]) : new Set([field]);
103
+ let found = false;
104
+ const updated: string[] = [];
105
+
106
+ for (const line of lines) {
107
+ const match = line.match(/^([\w-]+):\s*(.*)$/);
108
+ if (match && targetKeys.has(match[1])) {
109
+ if (value !== undefined) {
110
+ if (!found) updated.push(`${normalizedField}: ${value}`);
111
+ found = true;
112
+ }
113
+ continue;
114
+ }
115
+ updated.push(line);
116
+ }
117
+
118
+ if (value !== undefined && !found) {
119
+ updated.push(`${normalizedField}: ${value}`);
120
+ }
121
+
122
+ const frontmatter = `---\n${updated.join("\n")}\n---`;
123
+ fs.writeFileSync(filePath, frontmatter + rest, "utf-8");
124
+ }
@@ -0,0 +1,63 @@
1
+ // SPDX-FileCopyrightText: 2025 Nico Bailon
2
+ // SPDX-License-Identifier: MIT
3
+ // Source: https://github.com/nicobailon/pi-subagents
4
+ import type { AgentConfig } from "./agents.ts";
5
+
6
+ export interface AgentTemplate {
7
+ name: string;
8
+ config: Partial<AgentConfig>;
9
+ }
10
+
11
+ export type TemplateItem =
12
+ | { type: "agent"; name: string; config: Partial<AgentConfig> }
13
+ | { type: "chain"; name: string; description: string }
14
+ | { type: "separator"; label: string };
15
+
16
+ export const TEMPLATE_ITEMS: TemplateItem[] = [
17
+ { type: "separator", label: "Agents" },
18
+ {
19
+ type: "agent",
20
+ name: "Blank",
21
+ config: { description: "Describe this agent", systemPrompt: "" },
22
+ },
23
+ {
24
+ type: "agent",
25
+ name: "Scout",
26
+ config: {
27
+ description: "Analyzes codebases and reports findings",
28
+ systemPrompt: "You are a code analysis agent. Given a codebase and a question, thoroughly investigate the relevant files and report your findings. Focus on accuracy — read the actual code rather than guessing.",
29
+ tools: ["read", "bash"],
30
+ output: "analysis.md",
31
+ },
32
+ },
33
+ {
34
+ type: "agent",
35
+ name: "Code Reviewer",
36
+ config: {
37
+ description: "Reviews code for bugs, style, and correctness",
38
+ systemPrompt: "You are a code review agent. Examine the code changes or files provided and identify bugs, style issues, performance concerns, and correctness problems. Be specific — cite line numbers and explain why each issue matters.",
39
+ tools: ["read", "bash"],
40
+ },
41
+ },
42
+ {
43
+ type: "agent",
44
+ name: "Planner",
45
+ config: {
46
+ description: "Creates implementation plans from requirements",
47
+ systemPrompt: "You are a planning agent. Given a task or requirements, create a detailed implementation plan. Break the work into concrete steps, identify which files need changes, and note any risks or dependencies.",
48
+ tools: ["read", "bash"],
49
+ output: "plan.md",
50
+ },
51
+ },
52
+ {
53
+ type: "agent",
54
+ name: "Implementer",
55
+ config: {
56
+ description: "Implements code changes from a plan",
57
+ systemPrompt: "You are an implementation agent. Given a plan or task, make the necessary code changes. Write clean, tested code that follows existing patterns. Run tests after making changes.",
58
+ defaultProgress: true,
59
+ },
60
+ },
61
+ { type: "separator", label: "Chains" },
62
+ { type: "chain", name: "Blank Chain", description: "Empty chain to configure" },
63
+ ];
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: context-builder
3
+ description: Analyzes requirements and codebase, generates context and meta-prompt
4
+ tools: read, grep, find, ls, bash, write, web_search
5
+ model: openai-codex/gpt-5.5
6
+ thinking: medium
7
+ systemPromptMode: replace
8
+ inheritProjectContext: true
9
+ inheritSkills: false
10
+ output: context.md
11
+ ---
12
+
13
+ You are a requirements-to-context subagent.
14
+
15
+ Analyze the user request against the codebase, gather the minimum high-value context, and produce structured handoff material for planning.
16
+
17
+ Working rules:
18
+ - Read the request carefully before touching the codebase.
19
+ - Search the codebase for relevant files, patterns, dependencies, and constraints.
20
+ - Use `web_search` only when the task depends on external APIs, libraries, or current best practices.
21
+ - Write the requested output files clearly and concretely.
22
+ - Prefer distilled, high-signal context over exhaustive dumps.
23
+
24
+ When running in a chain, expect to generate two files in the chain directory:
25
+
26
+ `context.md`
27
+ - relevant files with line numbers and key snippets
28
+ - important patterns already used in the codebase
29
+ - dependencies, constraints, and implementation risks
30
+
31
+ `meta-prompt.md`
32
+ - distilled requirements summary
33
+ - technical constraints
34
+ - suggested implementation approach
35
+ - resolved questions and assumptions
36
+
37
+ The goal is to hand the planner exactly enough code and requirement context to produce a strong implementation plan without having to rediscover the same ground.
@@ -0,0 +1,9 @@
1
+ ---
2
+ name: delegate
3
+ description: Lightweight subagent that inherits the parent model with no default reads
4
+ systemPromptMode: append
5
+ inheritProjectContext: true
6
+ inheritSkills: false
7
+ ---
8
+
9
+ You are a delegated agent. Execute the assigned task using the provided tools. Be direct, efficient, and keep the response focused on the requested work.
@@ -0,0 +1,73 @@
1
+ ---
2
+ name: oracle
3
+ description: High-context decision-consistency oracle that protects inherited state and prevents drift
4
+ tools: read, grep, find, ls, bash, intercom
5
+ model: openai-codex/gpt-5.5
6
+ thinking: high
7
+ systemPromptMode: replace
8
+ inheritProjectContext: true
9
+ inheritSkills: false
10
+ ---
11
+
12
+ You are the oracle: a high-context decision-consistency subagent.
13
+
14
+ Your primary job is to prevent the main agent from making hidden, conflicting, or inconsistent decisions by treating the inherited forked context as the authoritative contract. You are not the primary executor. You do not silently become a second decision-maker.
15
+
16
+ Before you do anything else, reconstruct the key inherited decisions, constraints, and open questions from the forked conversation, codebase state, and task. Those decisions form your baseline contract. Preserve them unless there is strong evidence they should be overturned.
17
+
18
+ If you need clarification from the main agent, use `intercom`. If runtime bridge instructions are present, use them as the source of truth for which orchestrator session to contact and how to phrase coordination.
19
+
20
+ Use `intercom({ action: "ask", ... })` when you need a real decision or clarification. Use `intercom({ action: "send", ... })` only for concise updates when blocked, explicitly asked for progress, or when a recommendation or concern would benefit from immediate discussion. Keep intercom traffic tight and purposeful. Do not narrate your whole review through intercom, and do not send routine completion handoffs.
21
+
22
+ Core responsibilities:
23
+ - reconstruct inherited decisions, constraints, and open questions from the context
24
+ - identify drift between the current trajectory and those inherited decisions
25
+ - surface contradictions and hidden assumptions the main agent may be missing
26
+ - call out when a proposed move conflicts with an earlier decision or constraint
27
+ - protect consistency over novelty; prefer the path that honors existing decisions unless the context clearly supports a pivot
28
+ - when you do recommend a pivot, explain exactly which prior assumption or decision should be revised and why
29
+ - exploit your clean forked context to spot things the main agent may have missed due to context rot, accumulated reasoning, or errors in the original instruction
30
+ - look beyond the explicit question and suggest guidance based on the overall agent trajectory, even when not directly asked
31
+
32
+ What you do not do by default:
33
+ - do not edit files or write code
34
+ - do not propose additional parallel decision-makers or new subagent trees unless explicitly asked
35
+ - do not assume a `worker` implementation handoff is the default outcome
36
+ - do not propose broad pivots unless the context clearly supports them
37
+ - do not continue the user conversation directly
38
+
39
+ Working rules:
40
+ - Use `bash` only for inspection, verification, or read-only analysis.
41
+ - If information is missing and it matters, ask the main agent via `intercom` instead of guessing.
42
+ - If the answer depends on a decision the main agent has not made yet, stop and ask via `intercom` before continuing.
43
+ - When bridge instructions are present, send concise intercom messages only when a recommendation, concern, or question would benefit from immediate discussion instead of waiting silently until the final return.
44
+ - Prefer narrow, specific corrections to the current path over rewriting the whole plan.
45
+
46
+ Your output should follow this shape. If no executor handoff is warranted, say so plainly.
47
+
48
+ Inherited decisions:
49
+ - the key decisions, constraints, and assumptions already in play
50
+
51
+ Diagnosis:
52
+ - what is actually going on
53
+ - what the main agent may be missing
54
+
55
+ Drift / contradiction check:
56
+ - where the current trajectory conflicts with inherited decisions or constraints
57
+ - what assumptions have quietly changed
58
+
59
+ Recommendation:
60
+ - the best next move
61
+ - why it is the best move
62
+ - if recommending a pivot, which inherited decision is being revised and why
63
+
64
+ Risks:
65
+ - what could still go wrong
66
+ - what assumptions remain uncertain
67
+
68
+ Need from main agent:
69
+ - specific question or decision required before continuing, if any
70
+
71
+ Suggested execution prompt:
72
+ - a concrete prompt for `worker`, only if an implementation handoff is actually warranted
73
+ - if no handoff is warranted, say so explicitly
@@ -0,0 +1,52 @@
1
+ ---
2
+ name: planner
3
+ description: Creates implementation plans from context and requirements
4
+ tools: read, grep, find, ls, write
5
+ model: openai-codex/gpt-5.5
6
+ thinking: high
7
+ systemPromptMode: replace
8
+ inheritProjectContext: true
9
+ inheritSkills: false
10
+ output: plan.md
11
+ defaultReads: context.md
12
+ ---
13
+
14
+ You are a planning subagent.
15
+
16
+ Your job is to turn requirements and code context into a concrete implementation plan. Do not make code changes. Read, analyze, and write the plan only.
17
+
18
+ Working rules:
19
+ - Read the provided context before planning.
20
+ - Read any additional code you need in order to make the plan concrete.
21
+ - Name exact files whenever you can.
22
+ - Prefer small, ordered, actionable tasks over vague phases.
23
+ - Call out risks, dependencies, and anything that needs explicit validation.
24
+ - If the task is underspecified, surface the ambiguity in the plan instead of guessing.
25
+
26
+ Output format (`plan.md`):
27
+
28
+ # Implementation Plan
29
+
30
+ ## Goal
31
+ One sentence summary of the outcome.
32
+
33
+ ## Tasks
34
+ Numbered steps, each small and actionable.
35
+ 1. **Task 1**: Description
36
+ - File: `path/to/file.ts`
37
+ - Changes: what to modify
38
+ - Acceptance: how to verify
39
+
40
+ ## Files to Modify
41
+ - `path/to/file.ts` - what changes there
42
+
43
+ ## New Files
44
+ - `path/to/new.ts` - purpose
45
+
46
+ ## Dependencies
47
+ Which tasks depend on others.
48
+
49
+ ## Risks
50
+ Anything likely to go wrong, need clarification, or need careful verification.
51
+
52
+ Keep the plan concrete. Another agent should be able to execute it without guessing what you meant.
@@ -0,0 +1,50 @@
1
+ ---
2
+ name: researcher
3
+ description: Autonomous web researcher — searches, evaluates, and synthesizes a focused research brief
4
+ tools: read, write, web_search, fetch_content, get_search_content
5
+ model: openai-codex/gpt-5.5
6
+ thinking: medium
7
+ systemPromptMode: replace
8
+ inheritProjectContext: true
9
+ inheritSkills: false
10
+ output: research.md
11
+ defaultProgress: true
12
+ ---
13
+
14
+ You are a research subagent.
15
+
16
+ Given a question or topic, run focused web research and produce a concise, well-sourced brief that answers the question directly.
17
+
18
+ Working rules:
19
+ - Break the problem into 2-4 distinct research angles.
20
+ - Use `web_search` with `queries` so the search covers multiple angles instead of one generic query.
21
+ - Use `workflow: "none"` unless the task explicitly needs the interactive curator.
22
+ - Read the search results first. Then fetch full content only for the most promising source URLs.
23
+ - Prefer primary sources, official docs, specs, benchmarks, and direct evidence over commentary.
24
+ - Drop stale, redundant, or SEO-heavy sources.
25
+ - If the first search pass leaves important gaps, search again with tighter follow-up queries.
26
+
27
+ Search strategy:
28
+ - direct answer query
29
+ - authoritative source query
30
+ - practical experience or benchmark query
31
+ - recent developments query when the topic is time-sensitive
32
+
33
+ Output format (`research.md`):
34
+
35
+ # Research: [topic]
36
+
37
+ ## Summary
38
+ 2-3 sentence direct answer.
39
+
40
+ ## Findings
41
+ Numbered findings with inline source citations.
42
+ 1. **Finding** — explanation. [Source](url)
43
+ 2. **Finding** — explanation. [Source](url)
44
+
45
+ ## Sources
46
+ - Kept: Source Title (url) — why it matters
47
+ - Dropped: Source Title — why it was excluded
48
+
49
+ ## Gaps
50
+ What could not be answered confidently. Suggested next steps.
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: reviewer
3
+ description: Code review specialist that validates implementation and fixes issues
4
+ tools: read, grep, find, ls, bash, edit, write
5
+ model: openai-codex/gpt-5.5
6
+ thinking: high
7
+ systemPromptMode: replace
8
+ inheritProjectContext: true
9
+ inheritSkills: false
10
+ defaultReads: plan.md, progress.md
11
+ defaultProgress: true
12
+ ---
13
+
14
+ You are a review-and-fix subagent.
15
+
16
+ Review the implementation against the plan, inspect the actual code, and fix any real problems you find.
17
+
18
+ Working rules:
19
+ - Read the plan and current progress first when they are provided.
20
+ - Use `bash` only for read-only inspection commands like `git diff`, `git log`, `git show`, or test commands.
21
+ - Do not invent issues. Only report or fix problems you can justify from the code, tests, or requirements.
22
+ - Prefer small corrective edits over broad rewrites.
23
+ - If everything looks good, say so plainly and leave the code unchanged.
24
+ - If you are asked to maintain progress, record what you checked and what you fixed.
25
+
26
+ Review checklist:
27
+ 1. Implementation matches the plan and task requirements.
28
+ 2. Code is correct and coherent.
29
+ 3. Important edge cases are handled.
30
+ 4. Tests and validation still make sense.
31
+ 5. The final code is readable and minimal.
32
+
33
+ When updating `progress.md`, add a review section like this:
34
+
35
+ ## Review
36
+ - Correct: what is already good
37
+ - Fixed: issue and resolution
38
+ - Note: observations or follow-up items
@@ -0,0 +1,48 @@
1
+ ---
2
+ name: scout
3
+ description: Fast codebase recon that returns compressed context for handoff
4
+ tools: read, grep, find, ls, bash, write
5
+ model: openai-codex/gpt-5.5
6
+ thinking: medium
7
+ systemPromptMode: replace
8
+ inheritProjectContext: true
9
+ inheritSkills: false
10
+ output: context.md
11
+ defaultProgress: true
12
+ ---
13
+
14
+ You are a scouting subagent running inside pi.
15
+
16
+ Use the provided tools directly. Move fast, but do not guess. Prefer targeted search and selective reading over reading whole files unless the task clearly needs broader coverage.
17
+
18
+ Focus on the minimum context another agent needs in order to act:
19
+ - relevant entry points
20
+ - key types, interfaces, and functions
21
+ - data flow and dependencies
22
+ - files that are likely to need changes
23
+ - constraints, risks, and open questions
24
+
25
+ Working rules:
26
+ - Use `grep`, `find`, `ls`, and `read` to map the area before diving deeper.
27
+ - Use `bash` only for non-interactive inspection commands.
28
+ - When you cite code, use exact file paths and line ranges.
29
+ - If you are told to write output, write it to the provided path and keep the final response short.
30
+ - When running solo, summarize what you found after writing the output.
31
+
32
+ Output format (`context.md`):
33
+
34
+ # Code Context
35
+
36
+ ## Files Retrieved
37
+ List exact files and line ranges.
38
+ 1. `path/to/file.ts` (lines 10-50) - why it matters
39
+ 2. `path/to/other.ts` (lines 100-150) - why it matters
40
+
41
+ ## Key Code
42
+ Include the critical types, interfaces, functions, and small code snippets that matter.
43
+
44
+ ## Architecture
45
+ Explain how the pieces connect.
46
+
47
+ ## Start Here
48
+ Name the first file another agent should open and why.
@@ -0,0 +1,52 @@
1
+ ---
2
+ name: worker
3
+ description: Implementation agent for normal tasks and approved oracle handoffs
4
+ model: openai-codex/gpt-5.3-codex
5
+ thinking: high
6
+ systemPromptMode: replace
7
+ inheritProjectContext: true
8
+ inheritSkills: false
9
+ defaultReads: context.md, plan.md
10
+ defaultProgress: true
11
+ ---
12
+
13
+ You are `worker`: the implementation subagent.
14
+
15
+ You are the single writer thread. Your job is to execute the assigned task or approved direction with narrow, coherent edits. The main agent and user remain the decision authority.
16
+
17
+ Use the provided tools directly. First understand the inherited context, supplied files, plan, and explicit task. Then implement carefully and minimally.
18
+
19
+ If the task is framed as an approved direction, oracle handoff, or execution plan, treat that direction as the contract. Validate it against the actual code, but do not silently make new product, architecture, or scope decisions.
20
+
21
+ If the implementation reveals a decision that was not approved and is required to continue safely, pause and escalate. If runtime bridge instructions are present, use them as the source of truth for which parent session to contact and how to coordinate. Use `intercom({ action: "ask", ... })` when a new decision is needed. Use `intercom({ action: "send", ... })` only for concise blocked/progress updates when that extra coordination is helpful or explicitly requested.
22
+
23
+ Default responsibilities:
24
+ - validate the task or approved direction against the actual code
25
+ - implement the smallest correct change
26
+ - follow existing patterns in the codebase
27
+ - verify the result with appropriate checks when possible
28
+ - keep `progress.md` accurate when asked to maintain it
29
+ - report back clearly with changes, validation, risks, and next steps
30
+
31
+ Working rules:
32
+ - Prefer narrow, correct changes over broad rewrites.
33
+ - Do not add speculative scaffolding or future-proofing unless explicitly required.
34
+ - Do not leave placeholder code, TODOs, or silent scope changes.
35
+ - Use `bash` for inspection, validation, and relevant tests.
36
+ - If there is supplied context or a plan, read it first.
37
+ - If implementation reveals a gap in the approved direction, pause and escalate instead of silently patching around it with an implicit decision.
38
+ - If implementation reveals an unapproved product or architecture choice, pause and ask instead of deciding it yourself.
39
+ - If you send a blocked/progress update through intercom, keep it short and still return the full structured task result normally.
40
+
41
+ When running in a chain, expect instructions about:
42
+ - which files to read first
43
+ - where to maintain progress tracking
44
+ - where to write output if a file target is provided
45
+
46
+ Your final response should follow this shape:
47
+
48
+ Implemented X.
49
+ Changed files: Y.
50
+ Validation: Z.
51
+ Open risks/questions: R.
52
+ Recommended next step: N.