monomind 1.10.46 → 1.10.54

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.
@@ -196,6 +196,32 @@ All agents run concurrently via `run_in_background: true`.
196
196
  You have N tasks to execute in order. Complete each one before moving to the next.
197
197
  Tasks share context — knowledge from earlier tasks applies to later ones.
198
198
 
199
+ == AGENT DELEGATION CAPABILITY ==
200
+ You have full access to the Agent tool (Claude Code: Task tool) to spawn
201
+ sub-agents for any specialized subtask. This capability is recursive —
202
+ sub-agents you spawn also receive it.
203
+
204
+ Available agent categories:
205
+ CORE coder · reviewer · tester · planner · researcher
206
+ BACKEND backend-dev · Backend Architect · DB Optimizer · API Tester
207
+ FRONTEND Frontend Developer · mobile-dev · Mobile App Builder
208
+ ARCH Software Architect · system-architect
209
+ SECURITY Security Engineer · security-architect
210
+ AI/ML AI Engineer · ml-developer · Data Engineer
211
+ DEVOPS DevOps Automator · SRE · cicd-engineer
212
+ DOCS Technical Writer · api-docs
213
+ PRODUCT Product Manager · Launch Strategist · CRO Specialist
214
+ MARKETING Content Creator · SEO Specialist · Growth Hacker
215
+ SOCIAL TikTok · LinkedIn · Twitter · Instagram Strategist
216
+ SALES Deal Strategist · Sales Coach · Outbound Strategist
217
+ BUSINESS Finance Tracker · Legal Compliance Checker · Analytics Reporter
218
+ DESIGN Monodesign (UI/UX · brand · CSS · animation · design systems)
219
+
220
+ Delegate when: a subtask needs deeper expertise, parallel work speeds things up,
221
+ or a subtask is outside your domain but blocks your progress.
222
+ How: Agent({ subagent_type: "slug", prompt: `full briefing + this delegation block`, run_in_background: true })
223
+ =================================
224
+
199
225
  TASK 1 of N: <title>
200
226
  <full task context, checklist, acceptance criteria>
201
227
 
@@ -226,6 +252,32 @@ Report which task is blocked and list the remaining unstarted tasks.
226
252
  ```
227
253
  Execute this single task:
228
254
 
255
+ == AGENT DELEGATION CAPABILITY ==
256
+ You have full access to the Agent tool (Claude Code: Task tool) to spawn
257
+ sub-agents for any specialized subtask. This capability is recursive —
258
+ sub-agents you spawn also receive it.
259
+
260
+ Available agent categories:
261
+ CORE coder · reviewer · tester · planner · researcher
262
+ BACKEND backend-dev · Backend Architect · DB Optimizer · API Tester
263
+ FRONTEND Frontend Developer · mobile-dev · Mobile App Builder
264
+ ARCH Software Architect · system-architect
265
+ SECURITY Security Engineer · security-architect
266
+ AI/ML AI Engineer · ml-developer · Data Engineer
267
+ DEVOPS DevOps Automator · SRE · cicd-engineer
268
+ DOCS Technical Writer · api-docs
269
+ PRODUCT Product Manager · Launch Strategist · CRO Specialist
270
+ MARKETING Content Creator · SEO Specialist · Growth Hacker
271
+ SOCIAL TikTok · LinkedIn · Twitter · Instagram Strategist
272
+ SALES Deal Strategist · Sales Coach · Outbound Strategist
273
+ BUSINESS Finance Tracker · Legal Compliance Checker · Analytics Reporter
274
+ DESIGN Monodesign (UI/UX · brand · CSS · animation · design systems)
275
+
276
+ Delegate when: a subtask needs deeper expertise, parallel work speeds things up,
277
+ or a subtask is outside your domain but blocks your progress.
278
+ How: Agent({ subagent_type: "slug", prompt: `full briefing + this delegation block`, run_in_background: true })
279
+ =================================
280
+
229
281
  TASK: <title>
230
282
  <full task context, checklist, acceptance criteria>
231
283
 
@@ -61,6 +61,8 @@ Collect ALL of the following in parallel (skip any that error):
61
61
 
62
62
  Bundle all gathered information into a single `PROJECT_CONTEXT` string for downstream agents.
63
63
 
64
+ **DELEGATION RULE:** Every agent spawned in this command MUST include the `== AGENT DELEGATION CAPABILITY ==` block (from `mastermind/_delegation.md`) in its prompt, immediately before `YOUR GOAL:`. This lets each agent spawn its own sub-agents when needed — delegation is recursive.
65
+
64
66
  ---
65
67
 
66
68
  ## Step 2: Deep Component Analysis
@@ -76,10 +76,13 @@ module.exports = {
76
76
  var resConf = (result.confidence != null ? result.confidence : 0);
77
77
  var resReason = String(result.reason || '');
78
78
  var fromKeywordStage = resReason.indexOf('Keyword 2-stage') !== -1;
79
- var promptIsDevish = /\b(improve|refactor|fix|bug|optimi[sz]e|implement|build|debug|deploy|test|feature|system|performance|architecture|memory|hook|graph|statusline|monograph|api|cli|skill|hooks|agent|workflow|init|module|package|registry|server|client|route|handler)\b/i.test(prompt);
79
+ var promptIsDevish = /\b(develop(?:ment|er)?|routing|improve|refactor|fix|bug|optimi[sz]e|implement|build|debug|deploy|test|feature|system|performance|architecture|memory|hook|graph|statusline|monograph|api|cli|skill|hooks|agent|workflow|init|module|package|registry|server|client|route|handler|localhost|dashboard|sidebar|layout|component|function|class|config|port|script|parse|compile|lint|build)\b/i.test(prompt);
80
80
 
81
+ // Align with the 90% primary-panel threshold: any non-dev pick below
82
+ // 90% confidence gets overridden via the graph, unless the prompt
83
+ // explicitly uses non-dev domain language (nonDevPrompt guard).
81
84
  var shouldOverride = !nonDevPrompt && (
82
- (!pickedDev && resConf < 0.85) ||
85
+ (!pickedDev && resConf < 0.90) ||
83
86
  (fromKeywordStage && promptIsDevish)
84
87
  );
85
88
  if (shouldOverride) {
@@ -117,33 +120,80 @@ module.exports = {
117
120
  var output = [];
118
121
  output.push('[INFO] Routing task: ' + (prompt.substring(0, 80) || '(no prompt)'));
119
122
  output.push('');
120
- // Suppress the agent recommendation panel for low-confidence routes on
121
- // short prompts the recommendation is almost always wrong (e.g.
122
- // "what else can we do" marketing China E-Commerce). Saves ~150
123
- // tokens per prompt. Skill matches and specific agents still render
124
- // below when confidence is decent.
123
+ // Routing panel strategy:
124
+ // conf >= 0.90 show primary recommendation (router is confident, trust it)
125
+ // conf < 0.90 show category picker so Claude uses its own context to
126
+ // pick the right agent category + agent from a menu.
127
+ // Specific-agent panel is suppressed (category menu replaces it).
125
128
  var conf = result.confidence != null ? result.confidence : 0;
126
129
  var promptShort = (prompt || '').trim().length < 60;
127
130
  var lowConf = conf < 0.70;
128
131
  var suppressPanel = lowConf && promptShort;
129
- if (!suppressPanel) {
132
+
133
+ // Agent category menu — shown when conf < 0.90 so Claude picks with context.
134
+ var AGENT_CATEGORIES = [
135
+ { label: 'CORE', agents: 'coder · reviewer · tester · planner · researcher' },
136
+ { label: 'BACKEND', agents: 'backend-dev · Backend Architect · DB Optimizer' },
137
+ { label: 'FRONTEND', agents: 'Frontend Developer · mobile-dev' },
138
+ { label: 'ARCH', agents: 'Software Architect · system-architect' },
139
+ { label: 'SECURITY', agents: 'Security Engineer · security-architect' },
140
+ { label: 'AI/ML', agents: 'AI Engineer · ml-developer · Data Engineer' },
141
+ { label: 'DEVOPS', agents: 'DevOps Automator · SRE · cicd-engineer' },
142
+ { label: 'DOCS', agents: 'Technical Writer · api-docs' },
143
+ { divider: 'Non-Coding Agents' },
144
+ { label: 'PRODUCT', agents: 'Product Manager · Launch Strategist · CRO Spec.' },
145
+ { label: 'MARKETING', agents: 'Content Creator · SEO Specialist · Growth Hacker' },
146
+ { label: 'SOCIAL', agents: 'TikTok · LinkedIn · Twitter · Instagram Strat.' },
147
+ { label: 'SALES', agents: 'Deal Strategist · Sales Coach · Outbound Strat.' },
148
+ { label: 'BUSINESS', agents: 'Finance Tracker · Legal Compliance · Analytics' },
149
+ { label: 'DESIGN', agents: 'Monodesign (UI/UX · brand · CSS · animation)' },
150
+ ];
151
+
152
+ if (conf >= 0.90) {
130
153
  output.push('+------------- monomind | Primary Recommendation --------------+');
131
154
  output.push('| Agent: ' + (result.agent || 'unknown').substring(0, 54).padEnd(54) + '|');
132
155
  output.push('| Confidence: ' + ((result.confidence != null ? (result.confidence * 100).toFixed(1) : '?') + '%').padEnd(49) + '|');
133
156
  output.push('| Reason: ' + (result.reason || '').substring(0, 53).padEnd(53) + '|');
134
157
  output.push('+--------------------------------------------------------------+');
158
+ } else if (!suppressPanel) {
159
+ output.push('+------- monomind | Agent Category Picker ---------------------+');
160
+ output.push('| ' + ('Conf: ' + (conf * 100).toFixed(0) + '% — router uncertain. YOU choose using context.').padEnd(60) + ' |');
161
+ output.push('+--------------------------------------------------------------+');
162
+ AGENT_CATEGORIES.forEach(function(cat) {
163
+ if (cat.divider) {
164
+ var d = '- ' + cat.divider + ' ';
165
+ output.push('|' + d.padEnd(31, '-') + ''.padEnd(31, '-') + '|');
166
+ } else {
167
+ output.push('| ' + cat.label.padEnd(10) + cat.agents.substring(0, 50).padEnd(50) + ' |');
168
+ }
169
+ });
170
+ output.push('+--------------------------------------------------------------+');
171
+ output.push('| INSTRUCTION: Read your conversation context. Identify the |');
172
+ output.push('| best-fit category above, then pick one agent from it and |');
173
+ output.push('| spawn it via Task({ subagent_type: "name" }). If no agent |');
174
+ output.push('| fits the task, skip and proceed directly. Do this now. |');
175
+ output.push('+--------------------------------------------------------------+');
135
176
  }
136
177
 
137
178
  // ── Persist routing result for statusline display ─────────────
138
179
  try {
139
180
  var routeDir = path.join(CWD, '.monomind');
140
181
  fs.mkdirSync(routeDir, { recursive: true });
141
- // Always use the resolved agent name never persist "extras"
182
+ // When confidence < 90% and the router picked a non-dev agent without
183
+ // a graph override, don't persist the wrong specialist — show "AI" instead.
184
+ var confForPersist = result.confidence != null ? result.confidence : 0;
185
+ var devAgentsForPersist = /^(coder|tester|reviewer|planner|researcher|system-architect|backend-dev|backend-architect|mobile-dev|ml-developer|cicd-engineer|api-docs|code-analyzer|production-validator|Technical Writer|Software Architect|Frontend Developer|AI Engineer|Data Engineer|Security Engineer|DevOps Automator|SRE)$/i;
186
+ var persistedIsNonDev = !devAgentsForPersist.test(String(result.agent || '').trim());
142
187
  var resolvedAgent = result.agent;
143
188
  if (!resolvedAgent || resolvedAgent === 'extras') {
144
189
  var topExtra = result.extrasMatches && result.extrasMatches[0];
145
190
  resolvedAgent = topExtra ? topExtra.name : 'Specialist Agent';
146
191
  }
192
+ // If router was uncertain (< 90%) and picked a non-dev specialist,
193
+ // show "AI selecting" in statusline rather than the wrong agent.
194
+ if (confForPersist < 0.90 && persistedIsNonDev && !String(result.reason || '').startsWith('Graph fallback')) {
195
+ resolvedAgent = 'AI selecting';
196
+ }
147
197
  var routePayload = {
148
198
  agent: resolvedAgent,
149
199
  agentSlug: result.agentSlug || null,
@@ -213,7 +263,7 @@ module.exports = {
213
263
  // ── Specific agent panel ──────────────────────────────────────────────────
214
264
  // Skip entirely on suppressed (low-confidence + short) prompts.
215
265
  var specificAgents = result.specificAgents || [];
216
- if (specificAgents.length > 0 && !suppressPanel) {
266
+ if (specificAgents.length > 0 && !suppressPanel && conf >= 0.90) {
217
267
  output.push('');
218
268
  var saHdr = '------- Specific Agents (' + specificAgents.length + ' available) ';
219
269
  output.push('+' + saHdr + '-'.repeat(Math.max(1, 62 - saHdr.length)) + '+');
@@ -232,7 +282,7 @@ module.exports = {
232
282
 
233
283
  // ── Specialist agents (non-dev domain) — only shown when specificAgents panel wasn't shown ──
234
284
  var extras = result.extrasMatches || [];
235
- var specificAgentsShown = (result.specificAgents || []).length > 0;
285
+ var specificAgentsShown = (result.specificAgents || []).length > 0 && conf >= 0.90;
236
286
  if (extras.length > 0 && !specificAgentsShown && !suppressPanel) {
237
287
  output.push('');
238
288
  var spHdr = '------- Specialist Agents (' + extras.length + ' matched) ';