@jaybeeuu/agent-cortex 1.20.0 → 1.38.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 (103) hide show
  1. package/.agents/skills/style-versioning/SKILL.md +102 -0
  2. package/.changeset/README.md +8 -0
  3. package/.changeset/config.json +11 -0
  4. package/.github/workflows/ci.yml +227 -6
  5. package/AGENTS.md +29 -24
  6. package/CHANGELOG.md +119 -5
  7. package/README.md +132 -33
  8. package/agents/README.md +47 -13
  9. package/agents/plan/agent.md +51 -0
  10. package/agents/plan/claude/frontmatter.json +6 -0
  11. package/agents/plan/copilot/frontmatter.json +6 -0
  12. package/agents/plan/pi/frontmatter.json +6 -0
  13. package/agents/plan.agent.md +3 -0
  14. package/agents/ralph/agent.md +262 -0
  15. package/agents/ralph/claude/frontmatter.json +6 -0
  16. package/agents/ralph/claude/polling.md +31 -0
  17. package/agents/ralph/copilot/frontmatter.json +6 -0
  18. package/agents/ralph/copilot/polling.md +62 -0
  19. package/agents/ralph/pi/frontmatter.json +6 -0
  20. package/agents/ralph/pi/polling.md +74 -0
  21. package/agents/ralph-plan/agent.md +114 -0
  22. package/agents/ralph-plan/claude/frontmatter.json +6 -0
  23. package/agents/ralph-plan/copilot/frontmatter.json +6 -0
  24. package/agents/ralph-plan/pi/frontmatter.json +6 -0
  25. package/agents/ralph-plan.agent.md +5 -2
  26. package/agents/ralph.agent.md +83 -57
  27. package/agents/strategy/agent.md +104 -0
  28. package/agents/strategy/claude/frontmatter.json +6 -0
  29. package/agents/strategy/copilot/frontmatter.json +6 -0
  30. package/agents/strategy/pi/frontmatter.json +6 -0
  31. package/agents/strategy.agent.md +3 -0
  32. package/bin/agent-cortex.mjs +68 -1
  33. package/bin/installers/claude.mjs +262 -0
  34. package/bin/installers/copilot.mjs +129 -0
  35. package/bin/installers/pi.mjs +197 -0
  36. package/claude/.claude-plugin/plugin.json +1 -1
  37. package/claude/agents/plan.md +3 -1
  38. package/claude/agents/ralph-plan.md +5 -3
  39. package/claude/agents/strategy.md +3 -1
  40. package/claude/hooks/scripts/notify.mjs +54 -0
  41. package/claude/hooks.json +15 -0
  42. package/docs/claude-hooks.md +115 -0
  43. package/docs/ideas/unified-ci-pipeline.md +28 -0
  44. package/docs/skills/skill-anatomy.md +9 -0
  45. package/extensions/agent-modes/README.md +54 -0
  46. package/extensions/agent-modes/discover.test.ts +241 -0
  47. package/extensions/agent-modes/discover.ts +458 -0
  48. package/extensions/agent-modes/index.ts +13 -224
  49. package/extensions/agent-modes/node_modules/.bin/pi +21 -0
  50. package/extensions/agent-modes/node_modules/.bin/tsc +21 -0
  51. package/extensions/agent-modes/node_modules/.bin/tsserver +21 -0
  52. package/extensions/agent-modes/node_modules/.bin/tsx +21 -0
  53. package/extensions/agent-modes/package.json +20 -0
  54. package/extensions/agent-modes/tsconfig.json +12 -0
  55. package/extensions/session-start.ts +1 -1
  56. package/extensions/skill-stats/context-loader.test.ts +1 -1
  57. package/extensions/skill-stats/node_modules/.bin/pi +21 -0
  58. package/extensions/skill-stats/node_modules/.bin/tsc +21 -0
  59. package/extensions/skill-stats/node_modules/.bin/tsserver +21 -0
  60. package/extensions/skill-stats/node_modules/.bin/tsx +21 -0
  61. package/extensions/subagent/README.md +19 -0
  62. package/extensions/subagent/index.ts +131 -45
  63. package/extensions/subagent/node_modules/.bin/pi +21 -0
  64. package/extensions/subagent/node_modules/.bin/pi-ai +21 -0
  65. package/extensions/subagent/node_modules/.bin/tsc +21 -0
  66. package/extensions/subagent/node_modules/.bin/tsserver +21 -0
  67. package/extensions/subagent/node_modules/.bin/tsx +21 -0
  68. package/extensions/subagent/package.json +23 -0
  69. package/extensions/subagent/tsconfig.json +12 -0
  70. package/extensions/subagent/wait.test.ts +202 -0
  71. package/extensions/subagent/wait.ts +118 -0
  72. package/hooks/claude/hooks.json +38 -0
  73. package/hooks/claude/scripts/notify.mjs +54 -0
  74. package/lib/cli.mjs +62 -3
  75. package/package.json +10 -7
  76. package/plugin.json +1 -1
  77. package/pnpm-workspace.yaml +1 -0
  78. package/scripts/build-copilot-agents.mjs +30 -0
  79. package/scripts/lib/compose-agent.mjs +241 -0
  80. package/scripts/sync-plugin-version.sh +17 -0
  81. package/skills/engineering/design-an-interface/SKILL.md +1 -1
  82. package/skills/engineering/improve-codebase-architecture/SKILL.md +1 -1
  83. package/skills/workflow/ralph/REFERENCE.md +2 -2
  84. package/skills/workflow/ralph/SKILL.md +6 -6
  85. package/skills/workflow/run-pipeline-stage/scripts/generate-progress.ts +4 -2
  86. package/skills/workflow/using-agent-skills/SKILL.md +15 -2
  87. package/test/cli.test.mjs +115 -2
  88. package/test/copilot-installer.test.mjs +298 -0
  89. package/test/installer.test.mjs +179 -0
  90. package/test/notify-hook.test.mjs +63 -0
  91. package/test/pi-installer.test.mjs +371 -0
  92. package/token-map.README.md +128 -0
  93. package/token-map.json +106 -0
  94. package/.beads/README.md +0 -81
  95. package/.beads/config.yaml +0 -1
  96. package/.beads/issues.jsonl +0 -236
  97. package/.beads/metadata.json +0 -7
  98. package/.github/workflows/ci.test.ts +0 -217
  99. package/.github/workflows/publish.yml +0 -36
  100. package/scripts/build-claude-agents.mjs +0 -179
  101. package/skills/workflow/using-agent-skills/scripts/validate-skill-structure.test.ts +0 -73
  102. /package/extensions/{context-loader.md → lib/context-loader.md} +0 -0
  103. /package/extensions/{context-loader.ts → lib/context-loader.ts} +0 -0
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Agent Modes Extension
3
3
  *
4
- * Makes the agent-cortex agents (ralph, ralph-plan, strategy) available as
4
+ * Makes the agent-cortex agents (ralph, ralph-plan, plan, strategy) available as
5
5
  * switchable PI modes. Each mode:
6
6
  * - Injects the agent's full system prompt into the running context
7
7
  * - Restricts tools based on the agent's declared tool set
@@ -9,6 +9,10 @@
9
9
  *
10
10
  * Modeled on Pi's built-in preset.ts example and R-Dson/pi-modes.
11
11
  *
12
+ * Agents are discovered from the composable source format (`agents/<name>/` +
13
+ * `agents/<name>/pi/frontmatter.json`) — see agents/README.md. Discovery and
14
+ * PI-prompt composition live in discover.ts.
15
+ *
12
16
  * Commands:
13
17
  * /agent — show mode selector
14
18
  * /agent <name> — switch to agent mode directly
@@ -16,242 +20,27 @@
16
20
  * --agent <name> — start in a specific agent mode
17
21
  */
18
22
 
19
- import { readFileSync, readdirSync, statSync, existsSync } from "node:fs";
20
23
  import { join, dirname } from "node:path";
21
24
  import { fileURLToPath } from "node:url";
22
25
  import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
23
26
  import { Key } from "@earendil-works/pi-tui";
24
-
25
- // ─── Types ───────────────────────────────────────────────────────────────────
26
-
27
- interface AgentDef {
28
- /** Lowercase id derived from filename (e.g. "ralph", "ralph-plan") */
29
- id: string;
30
- /** Display name from frontmatter or prettified id */
31
- name: string;
32
- /** Description from frontmatter */
33
- description: string;
34
- /** Colour for status indicator */
35
- color: string;
36
- /** PI tool names to enable (empty = all tools) */
37
- tools: string[];
38
- /** Full agent body (the system prompt to inject) */
39
- prompt: string;
40
- }
41
-
42
- interface OriginalState {
43
- tools: string[];
44
- }
45
-
46
- // ─── Discovery ───────────────────────────────────────────────────────────────
27
+ import { discoverAgents, DEFAULT_TOOLS, type AgentDef } from "./discover.ts";
28
+ import type { ThemeColor } from "@earendil-works/pi-coding-agent";
47
29
 
48
30
  const __dirname = dirname(fileURLToPath(import.meta.url));
49
31
  // Agents dir is <extension-root>/../../agents/ — two levels up from extensions/agent-modes/
50
32
  const AGENTS_DIR = join(__dirname, "..", "..", "agents");
51
33
 
52
- /**
53
- * Copilot CLI tool names to PI built-in tool names.
54
- * Tools not in this map are left as-is (they may be custom tools).
55
- */
56
- const COPILOT_TO_PI: Record<string, string[]> = {
57
- bash: ["bash"],
58
- view: ["read"],
59
- read: ["read"],
60
- edit: ["edit"],
61
- create: ["write"],
62
- write: ["write"],
63
- grep: ["grep"],
64
- rg: ["grep", "find"],
65
- glob: ["find", "ls"],
66
- find: ["find"],
67
- ls: ["ls"],
68
- };
69
-
70
- /**
71
- * Mapping from agent id → colour for the status indicator.
72
- */
73
- const AGENT_COLORS: Record<string, string> = {
74
- ralph: "accent",
75
- "ralph-plan": "warning",
76
- strategy: "accent",
77
- };
78
-
79
- const PERSIST_KEY = "agent-modes-state";
80
-
81
- /** Modes with no tool restriction gets the full default set. */
82
- const DEFAULT_TOOLS = ["read", "bash", "edit", "write", "grep", "find", "ls"];
83
-
84
- // ─── Agent file parsing ──────────────────────────────────────────────────────
85
-
86
- function parseFrontmatter(raw: string): {
87
- name?: string;
88
- description?: string;
89
- tools?: string[];
90
- prompt: string;
91
- } {
92
- const lines = raw.split(/\r?\n/);
93
- if (lines[0] !== "---") return { prompt: raw };
94
-
95
- // Find closing ---
96
- let sep = -1;
97
- for (let i = 1; i < lines.length; i++) {
98
- if (lines[i].trim() === "---") {
99
- sep = i;
100
- break;
101
- }
102
- }
103
- if (sep === -1) return { prompt: raw };
104
-
105
- const yamlLines = lines.slice(1, sep);
106
- const prompt = lines.slice(sep + 1).join("\n").trim();
107
-
108
- let name: string | undefined;
109
- let description: string | undefined;
110
- let tools: string[] | undefined;
111
-
112
- for (const line of yamlLines) {
113
- const trimmed = line.trim();
114
- const colonIdx = trimmed.indexOf(":");
115
- if (colonIdx === -1) continue;
116
-
117
- const key = trimmed.slice(0, colonIdx).trim().toLowerCase();
118
- const val = trimmed.slice(colonIdx + 1).trim();
119
-
120
- if (key === "name") {
121
- // Strip surrounding quotes
122
- name = val.replace(/^["']|["']$/g, "");
123
- } else if (key === "description") {
124
- description = val.replace(/^["']|["']$/g, "");
125
- }
126
- }
127
-
128
- // Parse tools from the tools frontmatter.
129
- // Supports two formats:
130
- // tools: ["bash", "view"] (JSON array, single line)
131
- // tools: (YAML list, subsequent lines)
132
- // - bash
133
- // - view
134
- let inToolsBlock = false;
135
- for (const line of yamlLines) {
136
- const trimmed = line.trim();
137
-
138
- // Check for inline JSON array: tools: ["foo", "bar"]
139
- const colonIdx = trimmed.indexOf(":");
140
- if (colonIdx !== -1) {
141
- const key = trimmed.slice(0, colonIdx).trim().toLowerCase();
142
- const val = trimmed.slice(colonIdx + 1).trim();
143
- if (key === "tools") {
144
- if (val.startsWith("[")) {
145
- // Inline JSON array
146
- try {
147
- tools = JSON.parse(val);
148
- } catch {
149
- // Malformed JSON — fall through
150
- }
151
- continue;
152
- }
153
- if (val === "[]" || val === "") {
154
- // Empty tools — explicit
155
- tools = [];
156
- continue;
157
- }
158
- }
159
- }
160
-
161
- // YAML block format: "tools:" on its own line, items on subsequent lines
162
- if (trimmed === "tools:") {
163
- inToolsBlock = true;
164
- if (!tools) tools = [];
165
- continue;
166
- }
167
- if (inToolsBlock) {
168
- // Check if this line is still part of the tools block (indented or starts with -)
169
- if (line.startsWith(" ") || line.startsWith("\t") || trimmed.startsWith("- ")) {
170
- const item = trimmed.replace(/^- /, "").trim().replace(/^["']|["']$/g, "");
171
- if (item) {
172
- if (!tools) tools = [];
173
- tools.push(item);
174
- }
175
- } else if (trimmed !== "") {
176
- // Non-empty, non-indented line → tools block ended
177
- inToolsBlock = false;
178
- }
179
- }
180
- }
181
-
182
- return { name, description, tools, prompt };
183
- }
184
-
185
- function mapCopilotToolsToPi(copilotTools: string[] | undefined): string[] | undefined {
186
- if (!copilotTools || copilotTools.length === 0) return undefined;
187
-
188
- const piTools = new Set<string>();
189
- for (const ct of copilotTools) {
190
- const mapped = COPILOT_TO_PI[ct];
191
- if (mapped) {
192
- for (const t of mapped) piTools.add(t);
193
- } else {
194
- // Pass through unknown tool names (could be custom tools)
195
- piTools.add(ct);
196
- }
197
- }
198
- return [...piTools].sort();
199
- }
200
-
201
- function discoverAgents(): AgentDef[] {
202
- if (!existsSync(AGENTS_DIR)) {
203
- console.warn(`[agent-modes] Agents directory not found: ${AGENTS_DIR}`);
204
- return [];
205
- }
206
-
207
- const files = readdirSync(AGENTS_DIR)
208
- .filter((f) => f.endsWith(".agent.md"))
209
- .sort();
210
-
211
- const agents: AgentDef[] = [];
212
-
213
- for (const file of files) {
214
- const filePath = join(AGENTS_DIR, file);
215
- if (!statSync(filePath).isFile()) continue;
216
-
217
- let raw: string;
218
- try {
219
- raw = readFileSync(filePath, "utf-8");
220
- } catch (err) {
221
- console.warn(`[agent-modes] Failed to read ${file}: ${err}`);
222
- continue;
223
- }
224
-
225
- const parsed = parseFrontmatter(raw);
226
- const id = file.replace(/\.agent\.md$/i, "").toLowerCase();
227
- const name = parsed.name || prettifyId(id);
228
- const tools = mapCopilotToolsToPi(parsed.tools);
229
- const color = AGENT_COLORS[id] || "accent";
230
-
231
- agents.push({
232
- id,
233
- name,
234
- description: parsed.description || "",
235
- color,
236
- tools: tools || [...DEFAULT_TOOLS],
237
- prompt: parsed.prompt || `You are ${name}. ${parsed.description || ""}`,
238
- });
239
- }
240
-
241
- return agents;
34
+ interface OriginalState {
35
+ tools: string[];
242
36
  }
243
37
 
244
- function prettifyId(id: string): string {
245
- return id
246
- .split("-")
247
- .map((w) => w.charAt(0).toUpperCase() + w.slice(1))
248
- .join(" ");
249
- }
38
+ const PERSIST_KEY = "agent-modes-state";
250
39
 
251
40
  // ─── Extension ───────────────────────────────────────────────────────────────
252
41
 
253
42
  export default function agentModesExtension(pi: ExtensionAPI): void {
254
- const agents = discoverAgents();
43
+ const agents = discoverAgents(AGENTS_DIR);
255
44
 
256
45
  if (agents.length === 0) {
257
46
  console.warn("[agent-modes] No agents found. Extension disabled.");
@@ -270,7 +59,7 @@ export default function agentModesExtension(pi: ExtensionAPI): void {
270
59
  return agents[activeAgentIndex].name;
271
60
  }
272
61
 
273
- function getActiveColor(): string {
62
+ function getActiveColor(): ThemeColor {
274
63
  if (activeAgentIndex >= agents.length || activeAgentIndex < 0) return "accent";
275
64
  return agents[activeAgentIndex].color;
276
65
  }
@@ -504,4 +293,4 @@ export default function agentModesExtension(pi: ExtensionAPI): void {
504
293
  }
505
294
  }
506
295
  });
507
- }
296
+ }
@@ -0,0 +1,21 @@
1
+ #!/bin/sh
2
+ basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
+
4
+ case `uname` in
5
+ *CYGWIN*|*MINGW*|*MSYS*)
6
+ if command -v cygpath > /dev/null 2>&1; then
7
+ basedir=`cygpath -w "$basedir"`
8
+ fi
9
+ ;;
10
+ esac
11
+
12
+ if [ -z "$NODE_PATH" ]; then
13
+ export NODE_PATH="/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/@earendil-works+pi-coding-agent@0.78.1_ws@8.21.0_zod@4.4.3/node_modules/@earendil-works/pi-coding-agent/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/@earendil-works+pi-coding-agent@0.78.1_ws@8.21.0_zod@4.4.3/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/node_modules"
14
+ else
15
+ export NODE_PATH="/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/@earendil-works+pi-coding-agent@0.78.1_ws@8.21.0_zod@4.4.3/node_modules/@earendil-works/pi-coding-agent/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/@earendil-works+pi-coding-agent@0.78.1_ws@8.21.0_zod@4.4.3/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/node_modules:$NODE_PATH"
16
+ fi
17
+ if [ -x "$basedir/node" ]; then
18
+ exec "$basedir/node" "$basedir/../@earendil-works/pi-coding-agent/dist/cli.js" "$@"
19
+ else
20
+ exec node "$basedir/../@earendil-works/pi-coding-agent/dist/cli.js" "$@"
21
+ fi
@@ -0,0 +1,21 @@
1
+ #!/bin/sh
2
+ basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
+
4
+ case `uname` in
5
+ *CYGWIN*|*MINGW*|*MSYS*)
6
+ if command -v cygpath > /dev/null 2>&1; then
7
+ basedir=`cygpath -w "$basedir"`
8
+ fi
9
+ ;;
10
+ esac
11
+
12
+ if [ -z "$NODE_PATH" ]; then
13
+ export NODE_PATH="/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/typescript@5.9.3/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/node_modules"
14
+ else
15
+ export NODE_PATH="/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/typescript@5.9.3/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/node_modules:$NODE_PATH"
16
+ fi
17
+ if [ -x "$basedir/node" ]; then
18
+ exec "$basedir/node" "$basedir/../typescript/bin/tsc" "$@"
19
+ else
20
+ exec node "$basedir/../typescript/bin/tsc" "$@"
21
+ fi
@@ -0,0 +1,21 @@
1
+ #!/bin/sh
2
+ basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
+
4
+ case `uname` in
5
+ *CYGWIN*|*MINGW*|*MSYS*)
6
+ if command -v cygpath > /dev/null 2>&1; then
7
+ basedir=`cygpath -w "$basedir"`
8
+ fi
9
+ ;;
10
+ esac
11
+
12
+ if [ -z "$NODE_PATH" ]; then
13
+ export NODE_PATH="/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/typescript@5.9.3/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/node_modules"
14
+ else
15
+ export NODE_PATH="/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/typescript@5.9.3/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/node_modules:$NODE_PATH"
16
+ fi
17
+ if [ -x "$basedir/node" ]; then
18
+ exec "$basedir/node" "$basedir/../typescript/bin/tsserver" "$@"
19
+ else
20
+ exec node "$basedir/../typescript/bin/tsserver" "$@"
21
+ fi
@@ -0,0 +1,21 @@
1
+ #!/bin/sh
2
+ basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
+
4
+ case `uname` in
5
+ *CYGWIN*|*MINGW*|*MSYS*)
6
+ if command -v cygpath > /dev/null 2>&1; then
7
+ basedir=`cygpath -w "$basedir"`
8
+ fi
9
+ ;;
10
+ esac
11
+
12
+ if [ -z "$NODE_PATH" ]; then
13
+ export NODE_PATH="/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/tsx@4.22.4/node_modules/tsx/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/tsx@4.22.4/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/node_modules"
14
+ else
15
+ export NODE_PATH="/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/tsx@4.22.4/node_modules/tsx/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/tsx@4.22.4/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/node_modules:$NODE_PATH"
16
+ fi
17
+ if [ -x "$basedir/node" ]; then
18
+ exec "$basedir/node" "$basedir/../tsx/dist/cli.mjs" "$@"
19
+ else
20
+ exec node "$basedir/../tsx/dist/cli.mjs" "$@"
21
+ fi
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@agent-cortex/agent-modes",
3
+ "version": "1.0.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "test": "node --test --import tsx/esm discover.test.ts",
8
+ "typecheck": "tsc --noEmit"
9
+ },
10
+ "devDependencies": {
11
+ "@earendil-works/pi-coding-agent": "^0.78.1",
12
+ "@earendil-works/pi-tui": "^0.78.1",
13
+ "@types/node": "^22.0.0",
14
+ "tsx": "^4.0.0",
15
+ "typescript": "^5.0.0"
16
+ },
17
+ "peerDependencies": {
18
+ "@earendil-works/pi-coding-agent": "^0.78.1"
19
+ }
20
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "Node16",
5
+ "moduleResolution": "Node16",
6
+ "strict": true,
7
+ "noEmit": true,
8
+ "allowImportingTsExtensions": true,
9
+ "skipLibCheck": true
10
+ },
11
+ "include": ["*.ts"]
12
+ }
@@ -1,5 +1,5 @@
1
1
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
- import { loadSessionContext } from "./context-loader.js";
2
+ import { loadSessionContext } from "./lib/context-loader.js";
3
3
 
4
4
  /**
5
5
  * Session-start extension.
@@ -7,7 +7,7 @@ import { tmpdir } from "node:os";
7
7
  import {
8
8
  loadContextFile,
9
9
  loadSessionContext,
10
- } from "../context-loader.ts";
10
+ } from "../lib/context-loader.ts";
11
11
 
12
12
  // ─── loadContextFile ─────────────────────────────────────────────────────────
13
13
 
@@ -0,0 +1,21 @@
1
+ #!/bin/sh
2
+ basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
+
4
+ case `uname` in
5
+ *CYGWIN*|*MINGW*|*MSYS*)
6
+ if command -v cygpath > /dev/null 2>&1; then
7
+ basedir=`cygpath -w "$basedir"`
8
+ fi
9
+ ;;
10
+ esac
11
+
12
+ if [ -z "$NODE_PATH" ]; then
13
+ export NODE_PATH="/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/@earendil-works+pi-coding-agent@0.78.1_ws@8.21.0_zod@4.4.3/node_modules/@earendil-works/pi-coding-agent/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/@earendil-works+pi-coding-agent@0.78.1_ws@8.21.0_zod@4.4.3/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/node_modules"
14
+ else
15
+ export NODE_PATH="/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/@earendil-works+pi-coding-agent@0.78.1_ws@8.21.0_zod@4.4.3/node_modules/@earendil-works/pi-coding-agent/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/@earendil-works+pi-coding-agent@0.78.1_ws@8.21.0_zod@4.4.3/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/node_modules:$NODE_PATH"
16
+ fi
17
+ if [ -x "$basedir/node" ]; then
18
+ exec "$basedir/node" "$basedir/../@earendil-works/pi-coding-agent/dist/cli.js" "$@"
19
+ else
20
+ exec node "$basedir/../@earendil-works/pi-coding-agent/dist/cli.js" "$@"
21
+ fi
@@ -0,0 +1,21 @@
1
+ #!/bin/sh
2
+ basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
+
4
+ case `uname` in
5
+ *CYGWIN*|*MINGW*|*MSYS*)
6
+ if command -v cygpath > /dev/null 2>&1; then
7
+ basedir=`cygpath -w "$basedir"`
8
+ fi
9
+ ;;
10
+ esac
11
+
12
+ if [ -z "$NODE_PATH" ]; then
13
+ export NODE_PATH="/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/typescript@5.9.3/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/node_modules"
14
+ else
15
+ export NODE_PATH="/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/typescript@5.9.3/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/node_modules:$NODE_PATH"
16
+ fi
17
+ if [ -x "$basedir/node" ]; then
18
+ exec "$basedir/node" "$basedir/../typescript/bin/tsc" "$@"
19
+ else
20
+ exec node "$basedir/../typescript/bin/tsc" "$@"
21
+ fi
@@ -0,0 +1,21 @@
1
+ #!/bin/sh
2
+ basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
+
4
+ case `uname` in
5
+ *CYGWIN*|*MINGW*|*MSYS*)
6
+ if command -v cygpath > /dev/null 2>&1; then
7
+ basedir=`cygpath -w "$basedir"`
8
+ fi
9
+ ;;
10
+ esac
11
+
12
+ if [ -z "$NODE_PATH" ]; then
13
+ export NODE_PATH="/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/typescript@5.9.3/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/node_modules"
14
+ else
15
+ export NODE_PATH="/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/typescript@5.9.3/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/node_modules:$NODE_PATH"
16
+ fi
17
+ if [ -x "$basedir/node" ]; then
18
+ exec "$basedir/node" "$basedir/../typescript/bin/tsserver" "$@"
19
+ else
20
+ exec node "$basedir/../typescript/bin/tsserver" "$@"
21
+ fi
@@ -0,0 +1,21 @@
1
+ #!/bin/sh
2
+ basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
+
4
+ case `uname` in
5
+ *CYGWIN*|*MINGW*|*MSYS*)
6
+ if command -v cygpath > /dev/null 2>&1; then
7
+ basedir=`cygpath -w "$basedir"`
8
+ fi
9
+ ;;
10
+ esac
11
+
12
+ if [ -z "$NODE_PATH" ]; then
13
+ export NODE_PATH="/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/tsx@4.22.4/node_modules/tsx/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/tsx@4.22.4/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/node_modules"
14
+ else
15
+ export NODE_PATH="/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/tsx@4.22.4/node_modules/tsx/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/tsx@4.22.4/node_modules:/home/runner/work/agent-cortex/agent-cortex/node_modules/.pnpm/node_modules:$NODE_PATH"
16
+ fi
17
+ if [ -x "$basedir/node" ]; then
18
+ exec "$basedir/node" "$basedir/../tsx/dist/cli.mjs" "$@"
19
+ else
20
+ exec node "$basedir/../tsx/dist/cli.mjs" "$@"
21
+ fi
@@ -96,6 +96,25 @@ Use a chain: first have scout find the read tool, then have planner suggest impr
96
96
  | Parallel | `{ tasks: [...] }` | Multiple agents run concurrently (max 8, 4 concurrent) |
97
97
  | Chain | `{ chain: [...] }` | Sequential with `{previous}` placeholder |
98
98
 
99
+ ## Background subagents (task / wait_for_agents / read_agent)
100
+
101
+ Beyond the all-in-one `subagent` tool, the extension ships three bottom-up tools for
102
+ fire-and-forget orchestration:
103
+
104
+ - **`task`** — spawn a background sub-agent and return its agent ID immediately. The
105
+ agent runs detached from the current tool call.
106
+ - **`wait_for_agents`** — block until at least one background sub-agent completes.
107
+ Pass the `agentIds` (plus optional `timeout` in seconds, default 120); it returns the
108
+ results of every agent that has finished and `STILL RUNNING` for the rest. This is the
109
+ event-driven way to run parallel orchestration: dispatch 5 tasks, then one
110
+ `wait_for_agents` call returns as soon as any of them finishes.
111
+ - **`read_agent`** — fallback: read one specific agent's output once you know it has
112
+ finished (or query its `STILL RUNNING` state directly).
113
+
114
+ These mirror Copilot CLI's `task`/`read_agent` model; `wait_for_agents` adds the
115
+ blocking wait that Copilot's poll loop does manually. Abort (Ctrl+C) propagates: a
116
+ pending `wait_for_agents` returns immediately with whatever is known so far.
117
+
99
118
  ## Output Display
100
119
 
101
120
  **Collapsed view** (default):