@nmzpy/pi-ember-stack 0.1.5 → 0.2.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.
@@ -259,6 +259,7 @@ export function registerQuestionnaireTool(pi: any): void {
259
259
  renderCall(args: { questions?: QuestionnaireQuestion[] }, theme: any): any {
260
260
  const count = args.questions?.length ?? 0;
261
261
  return new Text(
262
+ theme.fg("muted", "• ") +
262
263
  theme.fg("toolTitle", theme.bold("questionnaire ")) +
263
264
  theme.fg("muted", `${count} question${count === 1 ? "" : "s"}`),
264
265
  0,
@@ -1,4 +1,5 @@
1
1
  ---
2
+ model: devin/glm-5-2
2
3
  name: coder
3
4
  description: Implementation agent for writing, editing, testing, and verifying code. Spawn this for focused implementation tasks — bug fixes, feature additions, refactors, file edits. Full tool access.
4
5
  tools: read, bash, edit, write, grep, find, ls
@@ -1,44 +1,23 @@
1
1
  ---
2
+ thinking: high
3
+ model: devin/glm-5-2
2
4
  name: scout
3
- description: Fast codebase recon that returns compressed context for handoff. Use for finding files, understanding structure, locating symbols.
4
- tools: read, grep, find, ls
5
- thinking: low
5
+ description: Fast agent specialized for exploring codebases. Use when you need to quickly find files by patterns, search code for keywords, or answer questions about the codebase.
6
+ tools: read, bash, grep, find, ls
6
7
  ---
7
8
 
8
- You are a scout. Quickly investigate a codebase and return structured findings that another agent can use without re-reading everything.
9
+ You are a file search specialist. You excel at thoroughly navigating and exploring codebases.
9
10
 
10
- Your output will be passed to an agent who has NOT seen the files you explored.
11
+ Your strengths:
12
+ - Rapidly finding files using glob patterns
13
+ - Searching code and text with powerful regex patterns
14
+ - Reading and analyzing file contents
11
15
 
12
- Thoroughness (infer from task, default medium):
13
- - Quick: Targeted lookups, key files only
14
- - Medium: Follow imports, read critical sections
15
- - Thorough: Trace all dependencies, check tests/types
16
+ Guidelines:
17
+ - Use Glob for broad file pattern matching
18
+ - Use Grep for searching file contents with regex
19
+ - Use Read when you know the specific file path you need to read
20
+ - Use Bash for file operations like copying, moving, or listing directory contents
21
+ - Return file paths as absolute paths in your final response
16
22
 
17
- Strategy:
18
- 1. grep/find to locate relevant code
19
- 2. Read key sections (not entire files)
20
- 3. Identify types, interfaces, key functions
21
- 4. Note dependencies between files
22
-
23
- Output format:
24
-
25
- ## Evidence
26
- List exact file/symbol anchors and relevant line ranges:
27
- 1. `path/to/file.ts` (lines 10-50) - Description of what's here
28
- 2. `path/to/other.ts` (lines 100-150) - Description
29
- 3. ...
30
-
31
- ## Key Code
32
- Critical types, interfaces, or functions:
33
-
34
- ```typescript
35
- interface Example {
36
- // actual code from the files
37
- }
38
- ```
39
-
40
- ## Architecture
41
- Brief explanation of how the pieces connect.
42
-
43
- ## Start Here
44
- Which file to look at first and why.
23
+ Complete the user's search request efficiently and report your findings clearly.
@@ -149,11 +149,11 @@ export default function (pi: ExtensionAPI) {
149
149
  // Proactively steer agents toward sub-agent delegation when users mention it
150
150
  pi.on("before_agent_start", async (event) => {
151
151
  const prompt = event.prompt.toLowerCase();
152
- if (/\b(delegate to|use a subagent|run in parallel|spawn an agent|scout|review this|chain|worker agent)\b/.test(prompt)) {
152
+ if (/\b(delegate to|use a subagent|run in parallel|spawn an agent|scout|explore|review this|chain|worker agent)\b/.test(prompt)) {
153
153
  return {
154
154
  systemPrompt:
155
155
  event.systemPrompt +
156
- "\n\nThe subagent tool is available for delegating tasks to specialized agents with isolated context. Use /subagent to list available agents. Bundled: scout (fast recon), reviewer (code review), worker (implementation), general-purpose (fallback). Modes: single, parallel (max 8), chain.",
156
+ "\n\nThe subagent tool is available for delegating tasks to specialized agents with isolated context. Use /subagent to list available agents. Bundled: scout (fast codebase exploration), coder (implementation), reviewer (code review), worker (general implementation), general-purpose (fallback). Modes: single, parallel (max 8), chain.",
157
157
  };
158
158
  }
159
159
  });
@@ -756,6 +756,7 @@ export default function (pi: ExtensionAPI) {
756
756
  // Chain
757
757
  if (args.chain && args.chain.length > 0) {
758
758
  let text =
759
+ fg("muted", "• ") +
759
760
  fg("toolTitle", theme.bold("subagent ")) +
760
761
  fg("accent", `chain (${args.chain.length} steps)`) +
761
762
  fg("muted", ` [${scope}]`);
@@ -778,6 +779,7 @@ export default function (pi: ExtensionAPI) {
778
779
  // Parallel
779
780
  if (args.tasks && args.tasks.length > 0) {
780
781
  let text =
782
+ fg("muted", "• ") +
781
783
  fg("toolTitle", theme.bold("subagent ")) +
782
784
  fg("accent", `parallel (${args.tasks.length} tasks)`) +
783
785
  fg("muted", ` [${scope}]`);
@@ -798,6 +800,7 @@ export default function (pi: ExtensionAPI) {
798
800
  : args.task
799
801
  : "...";
800
802
  let text =
803
+ fg("muted", "• ") +
801
804
  fg("toolTitle", theme.bold("subagent ")) +
802
805
  fg("accent", agentName) +
803
806
  fg("muted", ` [${scope}]`);
@@ -1215,4 +1218,4 @@ export default function (pi: ExtensionAPI) {
1215
1218
  }
1216
1219
  }, { overlay: true, overlayOptions: { maxHeight: "70%" } }); // Overlay: editor stays visible below
1217
1220
  }
1218
- }
1221
+ }
@@ -5,8 +5,10 @@
5
5
  * separate `pi` process. This eliminates cold-start overhead and allows
6
6
  * fine-grained control over token budget:
7
7
  *
8
- * - Only the agent's system prompt is used (no pi defaults).
9
- * - No AGENTS.md, no extensions, no skills, no prompt templates loaded.
8
+ * - The agent's system prompt is prepended with project context files
9
+ * (AGENTS.md from cwd and ancestors) so sub-agents share the same
10
+ * codebase conventions as the main agent.
11
+ * - No extensions, no skills, no prompt templates loaded.
10
12
  * - Thinking disabled, compaction disabled, retry disabled.
11
13
  * - In-memory session (no disk I/O).
12
14
  * - Shared auth/model infrastructure (no re-connection).
@@ -20,12 +22,28 @@ import {
20
22
  AuthStorage,
21
23
  createAgentSession,
22
24
  createExtensionRuntime,
25
+ getAgentDir,
26
+ loadProjectContextFiles,
23
27
  ModelRegistry,
24
28
  type ResourceLoader,
25
29
  SessionManager,
26
30
  SettingsManager,
27
31
  } from "@earendil-works/pi-coding-agent";
28
32
 
33
+ // ---------------------------------------------------------------------------
34
+ // Constants
35
+ // ---------------------------------------------------------------------------
36
+
37
+ const PARALLEL_TOOL_CALL_GUIDANCE = `
38
+
39
+ ## Tool Call Efficiency
40
+
41
+ When multiple independent tool calls are needed (e.g. reading several files,
42
+ searching for different patterns), emit them all in a single response rather
43
+ than one at a time. The runtime executes independent tool calls in parallel,
44
+ so batching them saves round-trips and reduces latency.
45
+ `;
46
+
29
47
  // ---------------------------------------------------------------------------
30
48
  // Types
31
49
  // ---------------------------------------------------------------------------
@@ -95,15 +113,23 @@ export async function runSubAgent(options: {
95
113
  model: `${model.provider}/${model.id}`,
96
114
  };
97
115
 
98
- // Build a minimal resource loader. The sub-agent sees ONLY the agent's
99
- // system prompt no pi defaults, no AGENTS.md, no extensions, no skills.
116
+ // Load project context files (AGENTS.md from cwd and ancestors) so the
117
+ // sub-agent has the same codebase conventions as the main agent.
118
+ const contextFiles = loadProjectContextFiles({ cwd, agentDir: getAgentDir() });
119
+ const contextPrefix = contextFiles.length > 0
120
+ ? contextFiles.map((f) => f.content).join("\n\n---\n\n") + "\n\n---\n\n"
121
+ : "";
122
+ const fullSystemPrompt = contextPrefix + systemPrompt + PARALLEL_TOOL_CALL_GUIDANCE;
123
+
124
+ // Build a minimal resource loader. The sub-agent sees the agent's system
125
+ // prompt plus project context files (AGENTS.md) — no extensions, no skills.
100
126
  const resourceLoader: ResourceLoader = {
101
127
  getExtensions: () => ({ extensions: [], errors: [], runtime: createExtensionRuntime() }),
102
128
  getSkills: () => ({ skills: [], diagnostics: [] }),
103
129
  getPrompts: () => ({ prompts: [], diagnostics: [] }),
104
130
  getThemes: () => ({ themes: [], diagnostics: [] }),
105
131
  getAgentsFiles: () => ({ agentsFiles: [] }),
106
- getSystemPrompt: () => systemPrompt,
132
+ getSystemPrompt: () => fullSystemPrompt,
107
133
  getAppendSystemPrompt: () => [],
108
134
  extendResources: () => {},
109
135
  reload: async () => {},