cawdex 1.35.65 → 1.35.67

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 (59) hide show
  1. package/README.md +186 -186
  2. package/bin/anycode.js +2 -2
  3. package/bin/cawdex.js +408 -408
  4. package/bin/ecc-hooks.cjs +11 -11
  5. package/dist/agents.js +1424 -1424
  6. package/dist/autonomous-loops.js +287 -287
  7. package/dist/command-palette.js +1 -1
  8. package/dist/command-palette.js.map +1 -1
  9. package/dist/compaction.js +8 -8
  10. package/dist/content-engine.js +543 -543
  11. package/dist/coverage.js +39 -39
  12. package/dist/docs-sync.js +98 -98
  13. package/dist/evaluation.js +452 -452
  14. package/dist/git-workflow.js +49 -49
  15. package/dist/index.js +75 -46
  16. package/dist/index.js.map +1 -1
  17. package/dist/instant-answer.js +10 -0
  18. package/dist/instant-answer.js.map +1 -1
  19. package/dist/modes.js +355 -355
  20. package/dist/orchestration.js +15 -15
  21. package/dist/pm2-manager.js +26 -26
  22. package/dist/prompt-buffer.d.ts +7 -0
  23. package/dist/prompt-buffer.js +31 -0
  24. package/dist/prompt-buffer.js.map +1 -1
  25. package/dist/query.d.ts +4 -0
  26. package/dist/query.js +79 -64
  27. package/dist/query.js.map +1 -1
  28. package/dist/refactor.js +87 -87
  29. package/dist/search-first.js +92 -92
  30. package/dist/session-picker.d.ts +44 -0
  31. package/dist/session-picker.js +227 -0
  32. package/dist/session-picker.js.map +1 -0
  33. package/dist/skill-create.js +100 -100
  34. package/dist/stitch.js +1 -1
  35. package/dist/swarm.d.ts +34 -54
  36. package/dist/swarm.js +175 -63
  37. package/dist/swarm.js.map +1 -1
  38. package/dist/system-prompt.js +10 -10
  39. package/dist/verification.js +55 -55
  40. package/dist/walkthrough.js +5 -5
  41. package/package.json +1 -1
  42. package/resources/__init__.py +1 -1
  43. package/resources/exgentic/cawdex_agent/README.md +114 -114
  44. package/resources/exgentic/cawdex_agent/__init__.py +5 -5
  45. package/resources/exgentic/cawdex_agent/agent.py +605 -605
  46. package/resources/exgentic/cawdex_agent/requirements.txt +2 -2
  47. package/resources/exgentic/cawdex_agent/setup.sh +21 -21
  48. package/resources/exgentic/cawdex_agent/utils.py +1061 -1061
  49. package/resources/hal/cawdex_agent/README.md +24 -24
  50. package/resources/hal/cawdex_agent/__init__.py +1 -1
  51. package/resources/hal/cawdex_agent/main.py +550 -550
  52. package/resources/hal/cawdex_agent/requirements.txt +2 -2
  53. package/resources/kbench/cawdex_agent/README.md +107 -107
  54. package/resources/kbench/cawdex_agent/adapter.manifest.json +19 -19
  55. package/resources/kbench/cawdex_agent/runner.mjs +753 -753
  56. package/resources/open_agent_leaderboard/cawdex-agent-card.md +119 -119
  57. package/resources/terminal_bench/__init__.py +1 -1
  58. package/resources/terminal_bench/cawdex_agent.py +174 -174
  59. package/resources/terminal_bench/setup.sh +121 -121
@@ -203,23 +203,23 @@ export function analyzeGitPatterns(cwd, limit = 50) {
203
203
  export function buildSkillCreatePrompt(cwd, pattern) {
204
204
  const patterns = analyzeGitPatterns(cwd);
205
205
  if (patterns.length === 0) {
206
- return `# Skill Creation from Git History
207
-
208
- The repository has no clear git history patterns to extract skills from.
209
-
210
- Please help generate reusable skill templates for common development workflows in this project.
211
-
212
- Consider:
213
- 1. What repetitive tasks appear in the commit history?
214
- 2. What are the standard steps for common operations?
215
- 3. What conventions does the team follow?
216
- 4. What could be automated with skills/workflows?
217
-
218
- For each skill, provide:
219
- - **Name**: Concise skill identifier
220
- - **Description**: What it does
221
- - **Steps**: Numbered workflow steps with {{placeholders}}
222
- - **Commands**: Specific tool calls or scripts
206
+ return `# Skill Creation from Git History
207
+
208
+ The repository has no clear git history patterns to extract skills from.
209
+
210
+ Please help generate reusable skill templates for common development workflows in this project.
211
+
212
+ Consider:
213
+ 1. What repetitive tasks appear in the commit history?
214
+ 2. What are the standard steps for common operations?
215
+ 3. What conventions does the team follow?
216
+ 4. What could be automated with skills/workflows?
217
+
218
+ For each skill, provide:
219
+ - **Name**: Concise skill identifier
220
+ - **Description**: What it does
221
+ - **Steps**: Numbered workflow steps with {{placeholders}}
222
+ - **Commands**: Specific tool calls or scripts
223
223
  - **Validation**: How to verify success`;
224
224
  }
225
225
  // Filter patterns if requested
@@ -235,56 +235,56 @@ For each skill, provide:
235
235
  patternsSummary += ` Files: ${p.files.slice(0, 3).join(', ')}\n`;
236
236
  }
237
237
  }
238
- return `# Skill Creation from Git History
239
-
240
- ## Discovered Patterns
241
-
242
- Based on analyzing the last 50 commits, these patterns emerged:
243
- ${patternsSummary}
244
-
245
- ## Workflow
246
-
247
- 1. **Analyze Patterns** — I've identified ${patterns.length} patterns from git history
248
- 2. **Extract Skills** — Convert recurring patterns into reusable skills
249
- 3. **Create Templates** — Generate skill templates with {{placeholders}}
250
- 4. **Validate** — Ensure each skill solves a real workflow
251
-
252
- ## Skill Template Format
253
-
254
- For each skill, create a file with:
255
- \`\`\`
256
- # {{SKILL_NAME}}
257
-
258
- ## Description
259
- {{What this skill does}}
260
-
261
- ## Trigger Pattern
262
- {{When to use this skill}}
263
-
264
- ## Steps
265
- 1. {{Step 1 with {{placeholders}}}}
266
- 2. {{Step 2}}
267
- ...
268
-
269
- ## Validation
270
- {{How to verify success}}
271
-
272
- ## Example Usage
273
- \`\`\`bash
274
- {{Example command}}
275
- \`\`\`
276
- \`\`\`
277
-
278
- ## Task
279
-
280
- Based on the patterns above, please:
281
-
282
- 1. **Identify** the top 3 most valuable skills to create
283
- 2. **Design** skill workflows with clear steps and placeholders
284
- 3. **Include** validation checks for each skill
285
- 4. **Provide** example invocations
286
- 5. **Export** as reusable templates
287
-
238
+ return `# Skill Creation from Git History
239
+
240
+ ## Discovered Patterns
241
+
242
+ Based on analyzing the last 50 commits, these patterns emerged:
243
+ ${patternsSummary}
244
+
245
+ ## Workflow
246
+
247
+ 1. **Analyze Patterns** — I've identified ${patterns.length} patterns from git history
248
+ 2. **Extract Skills** — Convert recurring patterns into reusable skills
249
+ 3. **Create Templates** — Generate skill templates with {{placeholders}}
250
+ 4. **Validate** — Ensure each skill solves a real workflow
251
+
252
+ ## Skill Template Format
253
+
254
+ For each skill, create a file with:
255
+ \`\`\`
256
+ # {{SKILL_NAME}}
257
+
258
+ ## Description
259
+ {{What this skill does}}
260
+
261
+ ## Trigger Pattern
262
+ {{When to use this skill}}
263
+
264
+ ## Steps
265
+ 1. {{Step 1 with {{placeholders}}}}
266
+ 2. {{Step 2}}
267
+ ...
268
+
269
+ ## Validation
270
+ {{How to verify success}}
271
+
272
+ ## Example Usage
273
+ \`\`\`bash
274
+ {{Example command}}
275
+ \`\`\`
276
+ \`\`\`
277
+
278
+ ## Task
279
+
280
+ Based on the patterns above, please:
281
+
282
+ 1. **Identify** the top 3 most valuable skills to create
283
+ 2. **Design** skill workflows with clear steps and placeholders
284
+ 3. **Include** validation checks for each skill
285
+ 4. **Provide** example invocations
286
+ 5. **Export** as reusable templates
287
+
288
288
  Focus on the most frequent patterns ({{${filteredPatterns[0]?.pattern || 'feature development'}}})`;
289
289
  }
290
290
  /**
@@ -321,39 +321,39 @@ export function exportPatternsToJSON(patterns, outputPath) {
321
321
  */
322
322
  export function generateSkillFromPattern(pattern, cwd) {
323
323
  const skillName = pattern.pattern.replace(/[^a-z0-9-]/gi, '-').toLowerCase();
324
- const content = `# ${pattern.pattern}
325
-
326
- ${pattern.description}
327
-
328
- Frequency in recent history: ${pattern.frequency} occurrences
329
-
330
- ## When to Use
331
-
332
- This pattern appears in commits that:
333
- - Modify: ${pattern.files.slice(0, 3).join(', ') || 'multiple files'}
334
- - Pattern: ${pattern.pattern}
335
-
336
- ## Workflow Steps
337
-
338
- 1. {{TODO: Define workflow step 1}}
339
- 2. {{TODO: Define workflow step 2}}
340
- 3. {{TODO: Define validation}}
341
-
342
- ## Files Involved
343
-
344
- ${pattern.files.map((f) => `- \`${f}\``).join('\n')}
345
-
346
- ## Example
347
-
348
- \`\`\`bash
349
- # {{Example command}}
350
- \`\`\`
351
-
352
- ## Notes
353
-
354
- - Generated from git history analysis
355
- - ${pattern.frequency} instances found in recent commits
356
- - Suggested for automation/skill creation
324
+ const content = `# ${pattern.pattern}
325
+
326
+ ${pattern.description}
327
+
328
+ Frequency in recent history: ${pattern.frequency} occurrences
329
+
330
+ ## When to Use
331
+
332
+ This pattern appears in commits that:
333
+ - Modify: ${pattern.files.slice(0, 3).join(', ') || 'multiple files'}
334
+ - Pattern: ${pattern.pattern}
335
+
336
+ ## Workflow Steps
337
+
338
+ 1. {{TODO: Define workflow step 1}}
339
+ 2. {{TODO: Define workflow step 2}}
340
+ 3. {{TODO: Define validation}}
341
+
342
+ ## Files Involved
343
+
344
+ ${pattern.files.map((f) => `- \`${f}\``).join('\n')}
345
+
346
+ ## Example
347
+
348
+ \`\`\`bash
349
+ # {{Example command}}
350
+ \`\`\`
351
+
352
+ ## Notes
353
+
354
+ - Generated from git history analysis
355
+ - ${pattern.frequency} instances found in recent commits
356
+ - Suggested for automation/skill creation
357
357
  `;
358
358
  return { name: skillName, content };
359
359
  }
package/dist/stitch.js CHANGED
@@ -163,7 +163,7 @@ export function buildStitchPrompt(query) {
163
163
  const safeQuery = query.replace(/`/g, '\\`');
164
164
  return `# Stitch Intelligent Interface
165
165
 
166
- You are the Stitch interface inside Cawdex. Stitch is Google's AI
166
+ You are the Stitch interface inside Cawdex. Stitch is Google's AI
167
167
  UI/UX design and code generation tool (https://stitch.withgoogle.com/).
168
168
  Connect via the \`stitch\` tool, which wraps the Stitch MCP server at
169
169
  https://stitch.googleapis.com/mcp.
package/dist/swarm.d.ts CHANGED
@@ -1,70 +1,50 @@
1
1
  /**
2
- * Agentic swarming fan out N specialized agents on the same task
3
- * concurrently and merge their outputs.
2
+ * Agentic swarming: run several specialized ECC agents against a task,
3
+ * then return their role-scoped findings to the main agent/user.
4
4
  *
5
- * Inspired by LangGraph's `Send` map-reduce primitive and OpenAI Agents
6
- * SDK's handoff pattern. The audit ranked these as the two most-portable
7
- * concepts from the swarming-framework ecosystem; this is the map-reduce
8
- * half (Send-style fan-out). Sequential handoff stays on the roadmap
9
- * for /multi-execute.
10
- *
11
- * Usage:
12
- * /swarm code-architect,silent-failure-hunter,type-design-analyzer audit the auth flow
13
- *
14
- * Each agent receives:
15
- * - System prompt: its own ECC agent prompt (the role-specific persona)
16
- * - User message: the task verbatim
17
- * - Empty tool list: swarm runs are analysis-only; no file edits or
18
- * bash commands. If you want a swarm to make changes, /architect (or
19
- * other agent slash) first, then act on the synthesis manually.
20
- *
21
- * Concurrency: Promise.allSettled — one agent failing doesn't kill the
22
- * others. Errors surface in the result block.
23
- *
24
- * Key pool: every concurrent agent uses streamChat which goes through
25
- * the key rotation pool from v1.23.0. Users with multiple OpenRouter
26
- * accounts get true parallel throughput across keys.
27
- *
28
- * Cost note: N agents = N model calls. The orchestrator's /help text
29
- * surfaces this so it isn't surprising.
5
+ * Filesystem writes stay centralized in the main agent. Swarm workers are
6
+ * analysis-only unless a later coordinator adds explicit write locking.
30
7
  */
31
8
  import type { CawdexConfig } from './types.js';
9
+ export declare const SWARM_SENTINEL = "__SWARM__";
32
10
  export interface SwarmAgent {
33
- /** Display name (matches the ECC slug like 'code-architect') */
34
11
  name: string;
35
- /** The system prompt the agent runs with — usually the ECC skill body */
36
12
  prompt: string;
37
13
  }
38
14
  export interface SwarmResult {
39
15
  agent: string;
40
16
  text: string;
41
17
  durationMs: number;
42
- /** Set when this agent's call threw — others may still have succeeded */
43
18
  error?: string;
44
19
  }
45
- /**
46
- * Look up agents by slug and return their full prompts. Throws on the
47
- * first unknown slug so the caller can correct + retry rather than
48
- * partially running.
49
- *
50
- * Accepts both bare slugs ("code-architect") and the "agent: <slug>"
51
- * form that listSkills() returns.
52
- */
20
+ export interface SwarmCommandPayload {
21
+ mode: 'auto' | 'legacy';
22
+ task: string;
23
+ agents?: string[];
24
+ }
25
+ export interface SwarmPlan {
26
+ task: string;
27
+ agents: string[];
28
+ phases: string[];
29
+ setup: {
30
+ goal: string;
31
+ budget: string;
32
+ target: string;
33
+ assets: string;
34
+ quality: string;
35
+ };
36
+ }
37
+ export declare function parseSwarmCommandArgs(args: string): {
38
+ payload: SwarmCommandPayload;
39
+ } | {
40
+ error: string;
41
+ };
42
+ export declare function encodeSwarmSentinel(payload: SwarmCommandPayload): string;
43
+ export declare function decodeSwarmSentinel(value: string): SwarmCommandPayload | null;
44
+ export declare function chooseSwarmAgentSlugs(task: string): string[];
45
+ export declare function buildSwarmPlan(payload: SwarmCommandPayload): SwarmPlan;
46
+ export declare function buildSwarmAgentTask(plan: SwarmPlan): string;
53
47
  export declare function resolveAgents(slugs: string[]): SwarmAgent[];
54
- /**
55
- * Run all agents concurrently against the same task. Each agent gets a
56
- * private message history (its prompt + the task); they don't see each
57
- * other's output. Merging is the caller's job — usually print-with-
58
- * attribution + an optional synthesis prompt.
59
- *
60
- * No tools available to swarm agents — analysis only. If we exposed
61
- * tools we'd need lock coordination on the filesystem + permission
62
- * prompts for every parallel write, which defeats the purpose.
63
- */
64
48
  export declare function runSwarm(agents: SwarmAgent[], task: string, config: CawdexConfig): Promise<SwarmResult[]>;
65
- /**
66
- * Format swarm results for stdout — attribution headers + clear visual
67
- * separation between agents. The caller can pipe this into a follow-up
68
- * synthesis prompt if they want consensus or comparison.
69
- */
70
- export declare function formatSwarmResults(results: SwarmResult[]): string;
49
+ export declare function formatSwarmResults(results: SwarmResult[], plan?: SwarmPlan): string;
50
+ export declare function buildSwarmHandoffPrompt(plan: SwarmPlan, results: SwarmResult[]): string;
package/dist/swarm.js CHANGED
@@ -1,68 +1,152 @@
1
1
  /**
2
- * Agentic swarming fan out N specialized agents on the same task
3
- * concurrently and merge their outputs.
2
+ * Agentic swarming: run several specialized ECC agents against a task,
3
+ * then return their role-scoped findings to the main agent/user.
4
4
  *
5
- * Inspired by LangGraph's `Send` map-reduce primitive and OpenAI Agents
6
- * SDK's handoff pattern. The audit ranked these as the two most-portable
7
- * concepts from the swarming-framework ecosystem; this is the map-reduce
8
- * half (Send-style fan-out). Sequential handoff stays on the roadmap
9
- * for /multi-execute.
10
- *
11
- * Usage:
12
- * /swarm code-architect,silent-failure-hunter,type-design-analyzer audit the auth flow
13
- *
14
- * Each agent receives:
15
- * - System prompt: its own ECC agent prompt (the role-specific persona)
16
- * - User message: the task verbatim
17
- * - Empty tool list: swarm runs are analysis-only; no file edits or
18
- * bash commands. If you want a swarm to make changes, /architect (or
19
- * other agent slash) first, then act on the synthesis manually.
20
- *
21
- * Concurrency: Promise.allSettled — one agent failing doesn't kill the
22
- * others. Errors surface in the result block.
23
- *
24
- * Key pool: every concurrent agent uses streamChat which goes through
25
- * the key rotation pool from v1.23.0. Users with multiple OpenRouter
26
- * accounts get true parallel throughput across keys.
27
- *
28
- * Cost note: N agents = N model calls. The orchestrator's /help text
29
- * surfaces this so it isn't surprising.
5
+ * Filesystem writes stay centralized in the main agent. Swarm workers are
6
+ * analysis-only unless a later coordinator adds explicit write locking.
30
7
  */
31
8
  import { streamChat } from './api.js';
32
9
  import { findEccSkillByName } from './ecc.js';
33
- /**
34
- * Look up agents by slug and return their full prompts. Throws on the
35
- * first unknown slug so the caller can correct + retry rather than
36
- * partially running.
37
- *
38
- * Accepts both bare slugs ("code-architect") and the "agent: <slug>"
39
- * form that listSkills() returns.
40
- */
10
+ export const SWARM_SENTINEL = '__SWARM__';
11
+ export function parseSwarmCommandArgs(args) {
12
+ const text = args.trim();
13
+ if (!text) {
14
+ return { error: 'Usage: /swarm <task> or /swarm <agent1,agent2> <task>' };
15
+ }
16
+ const legacy = text.match(/^([a-z0-9-]+(?:,[a-z0-9-]+)+)\s+([\s\S]+)$/i);
17
+ if (legacy) {
18
+ const agents = legacy[1].split(',').map((item) => item.trim()).filter(Boolean);
19
+ const task = legacy[2].trim();
20
+ if (!task)
21
+ return { error: 'Usage: /swarm <agent1,agent2> <task>' };
22
+ return { payload: { mode: 'legacy', agents, task } };
23
+ }
24
+ return { payload: { mode: 'auto', task: text } };
25
+ }
26
+ export function encodeSwarmSentinel(payload) {
27
+ return SWARM_SENTINEL + encodeURIComponent(JSON.stringify(payload));
28
+ }
29
+ export function decodeSwarmSentinel(value) {
30
+ if (!value.startsWith(SWARM_SENTINEL))
31
+ return null;
32
+ const raw = value.slice(SWARM_SENTINEL.length);
33
+ try {
34
+ const parsed = JSON.parse(decodeURIComponent(raw));
35
+ if (parsed.mode !== 'auto' && parsed.mode !== 'legacy')
36
+ return null;
37
+ if (!parsed.task || typeof parsed.task !== 'string')
38
+ return null;
39
+ if (parsed.agents !== undefined && !Array.isArray(parsed.agents))
40
+ return null;
41
+ return {
42
+ mode: parsed.mode,
43
+ task: parsed.task,
44
+ agents: parsed.agents?.map(String),
45
+ };
46
+ }
47
+ catch {
48
+ return null;
49
+ }
50
+ }
51
+ export function chooseSwarmAgentSlugs(task) {
52
+ const t = task.toLowerCase();
53
+ const agents = new Set(['planner', 'code-architect']);
54
+ if (/\b(game|web[- ]?game|frontend|ui|ux|react|vite|browser|canvas|three\.?js|css|html)\b/.test(t)) {
55
+ agents.add('typescript-reviewer');
56
+ agents.add('e2e-runner');
57
+ agents.add('performance-optimizer');
58
+ }
59
+ else if (/\b(research|compare|survey|paper|papers|source|sources|docs|documentation)\b/.test(t)) {
60
+ agents.add('docs-lookup');
61
+ agents.add('code-explorer');
62
+ agents.add('chief-of-staff');
63
+ }
64
+ else if (/\b(test|build|ci|error|failing|failure|debug|fix|bug|regression)\b/.test(t)) {
65
+ agents.add('build-error-resolver');
66
+ agents.add('silent-failure-hunter');
67
+ agents.add('pr-test-analyzer');
68
+ }
69
+ else {
70
+ agents.add('type-design-analyzer');
71
+ agents.add('silent-failure-hunter');
72
+ }
73
+ if (/\b(auth|login|oauth|token|secret|permission|security|payment|admin)\b/.test(t)) {
74
+ agents.add('security-reviewer');
75
+ }
76
+ if (/\b(api|database|sql|schema|backend|server|endpoint)\b/.test(t)) {
77
+ agents.add('database-reviewer');
78
+ }
79
+ return Array.from(agents).slice(0, 5);
80
+ }
81
+ export function buildSwarmPlan(payload) {
82
+ const task = payload.task.trim();
83
+ const agents = payload.mode === 'legacy' && payload.agents?.length
84
+ ? payload.agents
85
+ : chooseSwarmAgentSlugs(task);
86
+ return {
87
+ task,
88
+ agents,
89
+ phases: [
90
+ 'setup: infer the five setup fields and call out blockers only if they materially change execution',
91
+ 'role pass: each agent produces role-specific risks, decisions, and concrete next actions',
92
+ 'coordination: compare overlapping concerns and surface conflicts',
93
+ 'handoff: provide a main-agent implementation prompt with verification criteria',
94
+ ],
95
+ setup: inferSwarmSetup(task),
96
+ };
97
+ }
98
+ function inferSwarmSetup(task) {
99
+ const t = task.toLowerCase();
100
+ return {
101
+ goal: task,
102
+ budget: /\b(hour|day|week|budget|\$|token|cheap|fast|quick|mvp)\b/.test(t)
103
+ ? 'use the stated task constraints; keep extra model calls bounded'
104
+ : 'default to a compact MVP pass with focused verification',
105
+ target: /\b(react|vite|typescript|node|python|rust|go|browser|web|mobile|desktop|cli)\b/.test(t)
106
+ ? 'infer from named platform/stack in the task'
107
+ : 'infer from the current repository and state assumptions explicitly',
108
+ assets: /\b(asset|screenshot|design|figma|repo|file|image|data|dataset|api|docs?)\b/.test(t)
109
+ ? 'use named assets/resources from the task and current workspace'
110
+ : 'start from the current workspace; request assets only if missing assets block execution',
111
+ quality: /\b(production|ship|release|polish|test|verified|qa|accessible|a11y)\b/.test(t)
112
+ ? 'meet the stated release/quality bar and verify it directly'
113
+ : 'working, reviewable, tested where risk justifies it',
114
+ };
115
+ }
116
+ export function buildSwarmAgentTask(plan) {
117
+ return [
118
+ `Swarm task: ${plan.task}`,
119
+ '',
120
+ 'Setup wizard snapshot:',
121
+ `- Goal: ${plan.setup.goal}`,
122
+ `- Budget/time: ${plan.setup.budget}`,
123
+ `- Target platform/stack: ${plan.setup.target}`,
124
+ `- Starting assets/resources: ${plan.setup.assets}`,
125
+ `- Quality bar/release target: ${plan.setup.quality}`,
126
+ '',
127
+ 'Coordination rules:',
128
+ '- Do not write files or claim changes were made.',
129
+ '- Produce the best role-specific plan/review/spec for the main agent.',
130
+ '- If a setup field is unclear, state the assumption and continue unless it blocks execution.',
131
+ '- Prefer concrete files, commands, checks, interfaces, and acceptance criteria over generic advice.',
132
+ '',
133
+ 'You are a swarm worker. Your system prompt defines your role. Return concise findings under: Role focus, Key decisions, Risks, Recommended actions, Verification.',
134
+ ].join('\n');
135
+ }
41
136
  export function resolveAgents(slugs) {
42
137
  const out = [];
43
138
  for (const raw of slugs) {
44
139
  const slug = raw.trim();
45
140
  if (!slug)
46
141
  continue;
47
- // Try direct name match first ("agent: <slug>"), then bare slug
48
142
  const skill = findEccSkillByName(`agent: ${slug}`) ?? findEccSkillByName(slug);
49
143
  if (!skill) {
50
- throw new Error(`Unknown agent: "${slug}". Run /ecc-guide agents to see what's available.`);
144
+ throw new Error(`Unknown agent: "${slug}". Run /ecc-guide agents to see available agents.`);
51
145
  }
52
146
  out.push({ name: slug, prompt: skill.prompt });
53
147
  }
54
148
  return out;
55
149
  }
56
- /**
57
- * Run all agents concurrently against the same task. Each agent gets a
58
- * private message history (its prompt + the task); they don't see each
59
- * other's output. Merging is the caller's job — usually print-with-
60
- * attribution + an optional synthesis prompt.
61
- *
62
- * No tools available to swarm agents — analysis only. If we exposed
63
- * tools we'd need lock coordination on the filesystem + permission
64
- * prompts for every parallel write, which defeats the purpose.
65
- */
66
150
  export async function runSwarm(agents, task, config) {
67
151
  const results = await Promise.allSettled(agents.map(async (agent) => {
68
152
  const start = Date.now();
@@ -87,33 +171,61 @@ export async function runSwarm(agents, task, config) {
87
171
  };
88
172
  }
89
173
  }));
90
- // Promise.allSettled always resolves; un-pack the values.
91
- return results.map((r) => (r.status === 'fulfilled' ? r.value : {
174
+ return results.map((result) => (result.status === 'fulfilled' ? result.value : {
92
175
  agent: 'unknown',
93
176
  text: '',
94
177
  durationMs: 0,
95
- error: `swarm task crashed: ${r.reason}`,
178
+ error: `swarm task crashed: ${result.reason}`,
96
179
  }));
97
180
  }
98
- /**
99
- * Format swarm results for stdout — attribution headers + clear visual
100
- * separation between agents. The caller can pipe this into a follow-up
101
- * synthesis prompt if they want consensus or comparison.
102
- */
103
- export function formatSwarmResults(results) {
181
+ export function formatSwarmResults(results, plan) {
104
182
  const lines = [];
105
- for (const r of results) {
183
+ if (plan) {
184
+ lines.push('Swarm setup');
185
+ lines.push(`Task: ${plan.task}`);
186
+ lines.push(`Agents: ${plan.agents.join(', ')}`);
187
+ lines.push(`Quality: ${plan.setup.quality}`);
188
+ }
189
+ for (const result of results) {
106
190
  lines.push('');
107
- lines.push(`══════════════════════════════════════════════`);
108
- lines.push(` ${r.agent} (${(r.durationMs / 1000).toFixed(1)}s${r.error ? ', ERROR' : ''})`);
109
- lines.push(`──────────────────────────────────────────────`);
110
- if (r.error) {
111
- lines.push(` error: ${r.error}`);
191
+ lines.push('='.repeat(72));
192
+ lines.push(`${result.agent} (${(result.durationMs / 1000).toFixed(1)}s${result.error ? ', ERROR' : ''})`);
193
+ lines.push('-'.repeat(72));
194
+ if (result.error) {
195
+ lines.push(`error: ${result.error}`);
112
196
  }
113
197
  else {
114
- lines.push(r.text.trim() || '(no output)');
198
+ lines.push(result.text.trim() || '(no output)');
115
199
  }
116
200
  }
201
+ if (plan) {
202
+ lines.push('');
203
+ lines.push('='.repeat(72));
204
+ lines.push('Main-agent handoff prompt');
205
+ lines.push('-'.repeat(72));
206
+ lines.push(buildSwarmHandoffPrompt(plan, results));
207
+ }
117
208
  return lines.join('\n');
118
209
  }
210
+ export function buildSwarmHandoffPrompt(plan, results) {
211
+ const successful = results.filter((result) => !result.error);
212
+ const failed = results.filter((result) => result.error);
213
+ return [
214
+ `Use the swarm findings to execute: ${plan.task}`,
215
+ '',
216
+ 'Honor these setup assumptions unless the user corrects them:',
217
+ `- Budget/time: ${plan.setup.budget}`,
218
+ `- Target platform/stack: ${plan.setup.target}`,
219
+ `- Assets/resources: ${plan.setup.assets}`,
220
+ `- Quality bar: ${plan.setup.quality}`,
221
+ '',
222
+ 'Execution phases:',
223
+ ...plan.phases.map((phase, index) => `${index + 1}. ${phase}`),
224
+ '',
225
+ `Swarm coverage: ${successful.map((result) => result.agent).join(', ') || 'none'}.`,
226
+ failed.length ? `Failed workers to compensate for: ${failed.map((result) => result.agent).join(', ')}.` : 'No worker failures reported.',
227
+ '',
228
+ 'Before editing, turn the findings into a short checklist. Keep filesystem writes in the main agent, run focused verification, and summarize any assumptions that remain unresolved.',
229
+ ].join('\n');
230
+ }
119
231
  //# sourceMappingURL=swarm.js.map
package/dist/swarm.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"swarm.js","sourceRoot":"","sources":["../src/swarm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAiB9C;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,KAAe;IAC3C,MAAM,GAAG,GAAiB,EAAE,CAAC;IAC7B,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC;QACxB,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;QACxB,IAAI,CAAC,IAAI;YAAE,SAAS;QACpB,gEAAgE;QAChE,MAAM,KAAK,GAAG,kBAAkB,CAAC,UAAU,IAAI,EAAE,CAAC,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAC;QAC/E,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,mDAAmD,CAAC,CAAC;QAC9F,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IACjD,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,MAAoB,EACpB,IAAY,EACZ,MAAoB;IAEpB,MAAM,OAAO,GAAG,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