@yemi33/minions 0.1.145 → 0.1.146
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.
- package/CHANGELOG.md +11 -1
- package/dashboard/js/render-work-items.js +5 -5
- package/dashboard/styles.css +2 -0
- package/engine/lifecycle.js +135 -0
- package/engine/shared.js +2 -0
- package/engine.js +65 -0
- package/package.json +1 -1
- package/playbooks/evaluate.md +114 -0
- package/playbooks/fix.md +2 -0
- package/playbooks/implement.md +2 -0
- package/routing.md +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 0.1.
|
|
3
|
+
## 0.1.146 (2026-04-01)
|
|
4
4
|
|
|
5
5
|
### Engine
|
|
6
6
|
- engine.js
|
|
@@ -12,13 +12,23 @@
|
|
|
12
12
|
- engine/meeting.js
|
|
13
13
|
- engine/playbook.js
|
|
14
14
|
- engine/routing.js
|
|
15
|
+
- engine/shared.js
|
|
15
16
|
- engine/timeout.js
|
|
16
17
|
|
|
17
18
|
### Dashboard
|
|
18
19
|
- dashboard/js/render-other.js
|
|
20
|
+
- dashboard/js/render-work-items.js
|
|
19
21
|
- dashboard/pages/engine.html
|
|
22
|
+
- dashboard/styles.css
|
|
23
|
+
|
|
24
|
+
### Playbooks
|
|
25
|
+
- evaluate.md
|
|
26
|
+
- fix.md
|
|
27
|
+
- implement.md
|
|
20
28
|
|
|
21
29
|
### Other
|
|
30
|
+
- CLAUDE.md
|
|
31
|
+
- routing.md
|
|
22
32
|
- test/unit.test.js
|
|
23
33
|
|
|
24
34
|
## 0.1.143 (2026-04-01)
|
|
@@ -6,7 +6,7 @@ const WI_PER_PAGE = 20;
|
|
|
6
6
|
|
|
7
7
|
function wiRow(item) {
|
|
8
8
|
const statusBadge = (s) => {
|
|
9
|
-
const cls = s === 'failed' ? 'rejected' : s === 'dispatched' ? 'building' : s === 'pending' || s === 'queued' ? 'active' : s === 'done' ? 'approved' : 'draft';
|
|
9
|
+
const cls = s === 'failed' ? 'rejected' : s === 'needs-human-review' ? 'needs-review' : s === 'dispatched' ? 'building' : s === 'pending' || s === 'queued' ? 'active' : s === 'done' ? 'approved' : 'draft';
|
|
10
10
|
return '<span class="pr-badge ' + cls + '">' + escHtml(s) + '</span>';
|
|
11
11
|
};
|
|
12
12
|
const typeBadge = (t) => '<span class="dispatch-type ' + (t || 'implement') + '">' + escHtml(t || 'implement') + '</span>';
|
|
@@ -38,9 +38,9 @@ function wiRow(item) {
|
|
|
38
38
|
(item.acceptanceCriteria && item.acceptanceCriteria.length ? '<span title="' + item.acceptanceCriteria.length + ' acceptance criteria">☑' + item.acceptanceCriteria.length + '</span>' : '') +
|
|
39
39
|
'</td>' +
|
|
40
40
|
'<td style="white-space:nowrap">' +
|
|
41
|
-
((item.status === 'pending' || item.status === 'failed') ? '<button class="pr-pager-btn" style="font-size:9px;padding:1px 6px;color:var(--blue);border-color:var(--blue);margin-right:4px" onclick="event.stopPropagation();editWorkItem(\'' + escHtml(item.id) + '\',\'' + escHtml(item._source || '') + '\')" title="Edit work item">✎</button>' : '') +
|
|
42
|
-
((item.status === 'done' || item.status === 'failed') ? '<button class="pr-pager-btn" style="font-size:9px;padding:1px 6px;color:var(--muted);border-color:var(--border);margin-right:4px" onclick="event.stopPropagation();archiveWorkItem(\'' + escHtml(item.id) + '\',\'' + escHtml(item._source || '') + '\')" title="Archive work item">📦</button>' : '') +
|
|
43
|
-
((item.status === 'done' || item.status === 'failed') && !item._humanFeedback ? '<button class="pr-pager-btn" style="font-size:9px;padding:1px 6px;color:var(--green);border-color:var(--green);margin-right:4px" onclick="event.stopPropagation();feedbackWorkItem(\'' + escHtml(item.id) + '\',\'' + escHtml(item._source || '') + '\')" title="Give feedback">👍👎</button>' : (item._humanFeedback ? '<span style="font-size:9px" title="Feedback given">' + (item._humanFeedback.rating === 'up' ? '👍' : '👎') + '</span> ' : '')) +
|
|
41
|
+
((item.status === 'pending' || item.status === 'failed' || item.status === 'needs-human-review') ? '<button class="pr-pager-btn" style="font-size:9px;padding:1px 6px;color:var(--blue);border-color:var(--blue);margin-right:4px" onclick="event.stopPropagation();editWorkItem(\'' + escHtml(item.id) + '\',\'' + escHtml(item._source || '') + '\')" title="Edit work item">✎</button>' : '') +
|
|
42
|
+
((item.status === 'done' || item.status === 'failed' || item.status === 'needs-human-review') ? '<button class="pr-pager-btn" style="font-size:9px;padding:1px 6px;color:var(--muted);border-color:var(--border);margin-right:4px" onclick="event.stopPropagation();archiveWorkItem(\'' + escHtml(item.id) + '\',\'' + escHtml(item._source || '') + '\')" title="Archive work item">📦</button>' : '') +
|
|
43
|
+
((item.status === 'done' || item.status === 'failed' || item.status === 'needs-human-review') && !item._humanFeedback ? '<button class="pr-pager-btn" style="font-size:9px;padding:1px 6px;color:var(--green);border-color:var(--green);margin-right:4px" onclick="event.stopPropagation();feedbackWorkItem(\'' + escHtml(item.id) + '\',\'' + escHtml(item._source || '') + '\')" title="Give feedback">👍👎</button>' : (item._humanFeedback ? '<span style="font-size:9px" title="Feedback given">' + (item._humanFeedback.rating === 'up' ? '👍' : '👎') + '</span> ' : '')) +
|
|
44
44
|
'<button class="pr-pager-btn" style="font-size:9px;padding:1px 6px;color:var(--red);border-color:var(--red)" onclick="event.stopPropagation();deleteWorkItem(\'' + escHtml(item.id) + '\',\'' + escHtml(item._source || '') + '\')" title="Delete work item and kill agent">✕</button>' +
|
|
45
45
|
'</td>' +
|
|
46
46
|
'</tr>';
|
|
@@ -49,7 +49,7 @@ function wiRow(item) {
|
|
|
49
49
|
function renderWorkItems(items) {
|
|
50
50
|
items = items.filter(function(w) { return !isDeleted('wi:' + w.id); });
|
|
51
51
|
// Sort: active/dispatched first, then by most recent activity
|
|
52
|
-
const statusOrder = { dispatched: 0, pending: 1, queued: 1, failed: 2, done: 3 };
|
|
52
|
+
const statusOrder = { dispatched: 0, pending: 1, queued: 1, 'needs-human-review': 2, failed: 2, done: 3 };
|
|
53
53
|
items.sort((a, b) => {
|
|
54
54
|
const sa = statusOrder[a.status] ?? 2, sb = statusOrder[b.status] ?? 2;
|
|
55
55
|
if (sa !== sb) return sa - sb;
|
package/dashboard/styles.css
CHANGED
|
@@ -186,6 +186,7 @@
|
|
|
186
186
|
.prd-item-row.st-in-progress { border-left-color: var(--yellow); animation: prdWipPulse 2s infinite; }
|
|
187
187
|
@keyframes prdWipPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(210,153,34,0); } 50% { box-shadow: 0 0 0 4px rgba(210,153,34,0.2); } }
|
|
188
188
|
.prd-item-row.st-failed { border-left-color: var(--red); }
|
|
189
|
+
.prd-item-row.st-needs-human-review { border-left-color: var(--orange); }
|
|
189
190
|
.prd-item-row.st-paused { border-left-color: var(--muted); opacity: 0.5; }
|
|
190
191
|
.prd-item-id { font-family: Consolas, monospace; color: var(--muted); min-width: 36px; font-size: 0.9em; }
|
|
191
192
|
.prd-item-name { flex: 1; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
@@ -232,6 +233,7 @@
|
|
|
232
233
|
.pr-badge.active { background: rgba(88,166,255,0.15); color: var(--blue); border: 1px solid var(--blue); }
|
|
233
234
|
.pr-badge.approved { background: rgba(63,185,80,0.15); color: var(--green); border: 1px solid var(--green); }
|
|
234
235
|
.pr-badge.rejected { background: rgba(248,81,73,0.15); color: var(--red); border: 1px solid var(--red); }
|
|
236
|
+
.pr-badge.needs-review { background: rgba(227,179,65,0.15); color: var(--orange); border: 1px solid var(--orange); }
|
|
235
237
|
.pr-badge.merged { background: rgba(188,140,255,0.15); color: var(--purple); border: 1px solid var(--purple); }
|
|
236
238
|
.pr-badge.building { background: rgba(210,153,34,0.15); color: var(--yellow); border: 1px solid var(--yellow); animation: pulse 1.5s infinite; }
|
|
237
239
|
.pr-badge.build-pass { background: rgba(63,185,80,0.15); color: var(--green); border: 1px solid var(--green); }
|
package/engine/lifecycle.js
CHANGED
|
@@ -1025,6 +1025,40 @@ function parseAgentOutput(stdout) {
|
|
|
1025
1025
|
return { resultSummary: text, taskUsage: usage, sessionId, model };
|
|
1026
1026
|
}
|
|
1027
1027
|
|
|
1028
|
+
/**
|
|
1029
|
+
* Resolve work-items.json path from dispatch meta.
|
|
1030
|
+
* Central items → MINIONS_DIR/work-items.json; project items → projects/<name>/work-items.json.
|
|
1031
|
+
*/
|
|
1032
|
+
function resolveWiPath(meta) {
|
|
1033
|
+
if (meta.source === 'central-work-item' || meta.source === 'central-work-item-fanout') {
|
|
1034
|
+
return path.join(MINIONS_DIR, 'work-items.json');
|
|
1035
|
+
}
|
|
1036
|
+
if (meta.project?.name) {
|
|
1037
|
+
return path.join(MINIONS_DIR, 'projects', meta.project.name, 'work-items.json');
|
|
1038
|
+
}
|
|
1039
|
+
return null;
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
/**
|
|
1043
|
+
* Parse structured eval verdict from evaluate agent output.
|
|
1044
|
+
* Looks for a JSON block with { pass, build, tests, criteria_met, criteria_failed, feedback }.
|
|
1045
|
+
* Returns parsed object or null if not found.
|
|
1046
|
+
*/
|
|
1047
|
+
function parseEvalVerdict(text) {
|
|
1048
|
+
if (!text) return null;
|
|
1049
|
+
// Look for JSON fenced block first, then bare JSON
|
|
1050
|
+
const fenced = text.match(/```(?:json)?\s*\n(\{[\s\S]*?"pass"\s*:[\s\S]*?\})\s*\n```/);
|
|
1051
|
+
if (fenced) {
|
|
1052
|
+
try { return JSON.parse(fenced[1]); } catch { /* fall through */ }
|
|
1053
|
+
}
|
|
1054
|
+
// Try bare JSON with "pass" key
|
|
1055
|
+
const bare = text.match(/(\{[\s\S]*?"pass"\s*:[\s\S]*?\})/);
|
|
1056
|
+
if (bare) {
|
|
1057
|
+
try { return JSON.parse(bare[1]); } catch { /* ignore */ }
|
|
1058
|
+
}
|
|
1059
|
+
return null;
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1028
1062
|
/**
|
|
1029
1063
|
* Handle decomposition result — parse sub-items from agent output and create child work items.
|
|
1030
1064
|
* Called from runPostCompletionHooks when type === 'decompose'.
|
|
@@ -1145,6 +1179,106 @@ function runPostCompletionHooks(dispatchItem, agentId, code, stdout, config) {
|
|
|
1145
1179
|
}
|
|
1146
1180
|
|
|
1147
1181
|
if (isSuccess && meta?.item?.id && !skipDoneStatus) updateWorkItemStatus(meta, 'done', '');
|
|
1182
|
+
|
|
1183
|
+
// Auto-dispatch evaluate work item after implement completes successfully
|
|
1184
|
+
if (isSuccess && !skipDoneStatus && type === 'implement' && meta?.item?.id) {
|
|
1185
|
+
const evalLoop = config.engine?.evalLoop ?? shared.ENGINE_DEFAULTS.evalLoop;
|
|
1186
|
+
if (evalLoop) {
|
|
1187
|
+
try {
|
|
1188
|
+
const wiPath = resolveWiPath(meta);
|
|
1189
|
+
if (wiPath) {
|
|
1190
|
+
const items = safeJson(wiPath) || [];
|
|
1191
|
+
// Dedup: skip if an evaluate item already exists for this parent
|
|
1192
|
+
const existing = items.find(i => i._evalParentId === meta.item.id && i.type === 'evaluate');
|
|
1193
|
+
if (existing) {
|
|
1194
|
+
log('info', `Eval loop: evaluate item ${existing.id} already exists for ${meta.item.id}, skipping`);
|
|
1195
|
+
} else {
|
|
1196
|
+
const parentItem = items.find(i => i.id === meta.item.id);
|
|
1197
|
+
const evalItem = {
|
|
1198
|
+
id: 'W-' + shared.uid(),
|
|
1199
|
+
title: `Evaluate: ${meta.item.title || meta.item.id}`,
|
|
1200
|
+
type: 'evaluate',
|
|
1201
|
+
priority: meta.item.priority || 'high',
|
|
1202
|
+
status: 'pending',
|
|
1203
|
+
created: ts(),
|
|
1204
|
+
createdBy: 'engine:eval-loop',
|
|
1205
|
+
project: meta.project?.name || meta.item.project,
|
|
1206
|
+
branch_name: parentItem?.branch_name || meta.branch || null,
|
|
1207
|
+
pr_url: parentItem?.pr_url || null,
|
|
1208
|
+
acceptance_criteria: parentItem?.acceptance_criteria || meta.item.acceptance_criteria || null,
|
|
1209
|
+
_evalParentId: meta.item.id,
|
|
1210
|
+
};
|
|
1211
|
+
if (parentItem?.sourcePlan) evalItem.sourcePlan = parentItem.sourcePlan;
|
|
1212
|
+
// Mark parent as eval-dispatched before writing to prevent duplicates on re-run
|
|
1213
|
+
if (parentItem) parentItem._evalDispatched = true;
|
|
1214
|
+
items.push(evalItem);
|
|
1215
|
+
shared.safeWrite(wiPath, items);
|
|
1216
|
+
log('info', `Eval loop: created ${evalItem.id} for completed implement ${meta.item.id}`);
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
} catch (err) {
|
|
1220
|
+
log('warn', `Eval loop dispatch error: ${err.message}`);
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
// Evaluate completion: parse verdict and handle eval→fix iteration loop
|
|
1226
|
+
if (isSuccess && type === 'evaluate' && meta?.item?._evalParentId) {
|
|
1227
|
+
try {
|
|
1228
|
+
const verdict = parseEvalVerdict(resultSummary || stdout);
|
|
1229
|
+
const evalLoop = config.engine?.evalLoop ?? shared.ENGINE_DEFAULTS.evalLoop;
|
|
1230
|
+
const maxIter = config.engine?.evalMaxIterations ?? shared.ENGINE_DEFAULTS.evalMaxIterations;
|
|
1231
|
+
|
|
1232
|
+
if (verdict && !verdict.pass && evalLoop) {
|
|
1233
|
+
const wiPath = resolveWiPath(meta);
|
|
1234
|
+
if (wiPath) {
|
|
1235
|
+
const items = safeJson(wiPath) || [];
|
|
1236
|
+
const parent = items.find(i => i.id === meta.item._evalParentId);
|
|
1237
|
+
if (parent) {
|
|
1238
|
+
const iterations = (parent._evalIterations || 0) + 1;
|
|
1239
|
+
parent._evalIterations = iterations;
|
|
1240
|
+
|
|
1241
|
+
if (iterations >= maxIter) {
|
|
1242
|
+
// Max iterations reached — escalate to human review
|
|
1243
|
+
parent.status = 'needs-human-review';
|
|
1244
|
+
parent._evalEscalatedAt = ts();
|
|
1245
|
+
shared.safeWrite(wiPath, items);
|
|
1246
|
+
log('info', `Eval loop: ${parent.id} reached ${iterations}/${maxIter} iterations — escalated to needs-human-review`);
|
|
1247
|
+
} else {
|
|
1248
|
+
// Create fix work item with evaluator feedback
|
|
1249
|
+
const fixItem = {
|
|
1250
|
+
id: 'W-' + shared.uid(),
|
|
1251
|
+
title: `Fix: ${parent.title || parent.id} (eval iteration ${iterations})`,
|
|
1252
|
+
type: 'fix',
|
|
1253
|
+
priority: parent.priority || 'high',
|
|
1254
|
+
status: 'pending',
|
|
1255
|
+
created: ts(),
|
|
1256
|
+
createdBy: 'engine:eval-loop',
|
|
1257
|
+
project: meta.project?.name || meta.item.project,
|
|
1258
|
+
branch_name: parent.branch_name || meta.item.branch_name || null,
|
|
1259
|
+
pr_url: parent.pr_url || meta.item.pr_url || null,
|
|
1260
|
+
acceptance_criteria: parent.acceptance_criteria || null,
|
|
1261
|
+
_evalParentId: parent.id,
|
|
1262
|
+
_evalFeedback: verdict.feedback || null,
|
|
1263
|
+
_evalCriteriaFailed: verdict.criteria_failed || null,
|
|
1264
|
+
};
|
|
1265
|
+
if (parent.sourcePlan) fixItem.sourcePlan = parent.sourcePlan;
|
|
1266
|
+
// Clear eval-dispatched flag so next fix→eval cycle can dispatch
|
|
1267
|
+
parent._evalDispatched = false;
|
|
1268
|
+
// Parent stays 'done' — fix item picks up from here
|
|
1269
|
+
parent.status = 'done';
|
|
1270
|
+
items.push(fixItem);
|
|
1271
|
+
shared.safeWrite(wiPath, items);
|
|
1272
|
+
log('info', `Eval loop: created fix ${fixItem.id} for failed eval on ${parent.id} (iteration ${iterations}/${maxIter})`);
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
} catch (err) {
|
|
1278
|
+
log('warn', `Eval verdict processing error: ${err.message}`);
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1148
1282
|
if (!isSuccess && meta?.item?.id) {
|
|
1149
1283
|
// Auto-retry: read fresh _retryCount from file (not stale dispatch-time snapshot)
|
|
1150
1284
|
let retries = (meta.item._retryCount || 0);
|
|
@@ -1346,6 +1480,7 @@ module.exports = {
|
|
|
1346
1480
|
updateMetrics,
|
|
1347
1481
|
recordContextPressureOnWorkItem,
|
|
1348
1482
|
parseAgentOutput,
|
|
1483
|
+
parseEvalVerdict,
|
|
1349
1484
|
runPostCompletionHooks,
|
|
1350
1485
|
syncPrdFromPrs,
|
|
1351
1486
|
};
|
package/engine/shared.js
CHANGED
|
@@ -356,6 +356,8 @@ const ENGINE_DEFAULTS = {
|
|
|
356
356
|
autoApprovePlans: false, // auto-approve PRDs without waiting for human approval
|
|
357
357
|
autoReview: true, // auto-dispatch review agents for new PRs (disable for manual review workflow)
|
|
358
358
|
meetingRoundTimeout: 600000, // 10min per meeting round before auto-advance
|
|
359
|
+
evalLoop: true, // enable evaluate→fix loop after implementation completes
|
|
360
|
+
evalMaxIterations: 3, // max evaluate→fix cycles before escalating to human
|
|
359
361
|
};
|
|
360
362
|
|
|
361
363
|
const DEFAULT_AGENTS = {
|
package/engine.js
CHANGED
|
@@ -1474,6 +1474,38 @@ function discoverFromWorkItems(config, project) {
|
|
|
1474
1474
|
const ac = (item.acceptanceCriteria || []).map(c => '- [ ] ' + c).join('\n');
|
|
1475
1475
|
vars.acceptance_criteria = ac ? '## Acceptance Criteria\n\n' + ac : '';
|
|
1476
1476
|
|
|
1477
|
+
// Inject checkpoint context if agent left a checkpoint.json from a prior run
|
|
1478
|
+
vars.checkpoint_context = '';
|
|
1479
|
+
try {
|
|
1480
|
+
const wtPath = vars.worktree_path || root;
|
|
1481
|
+
const cpPath = path.join(wtPath, 'checkpoint.json');
|
|
1482
|
+
if (fs.existsSync(cpPath)) {
|
|
1483
|
+
const cpData = JSON.parse(fs.readFileSync(cpPath, 'utf8'));
|
|
1484
|
+
const cpCount = (item._checkpointCount || 0) + 1;
|
|
1485
|
+
if (cpCount > 3) {
|
|
1486
|
+
log('warn', `Work item ${item.id} exceeded 3 checkpoint-resumes — marking as needs-human-review`);
|
|
1487
|
+
item.status = 'needs-human-review';
|
|
1488
|
+
item._checkpointCount = cpCount;
|
|
1489
|
+
needsWrite = true;
|
|
1490
|
+
continue;
|
|
1491
|
+
}
|
|
1492
|
+
item._checkpointCount = cpCount;
|
|
1493
|
+
needsWrite = true;
|
|
1494
|
+
const cpSummary = [
|
|
1495
|
+
`## Checkpoint (Resume #${cpCount}/3)`,
|
|
1496
|
+
'',
|
|
1497
|
+
'A previous agent run timed out but left a checkpoint. Continue from where it left off.',
|
|
1498
|
+
'',
|
|
1499
|
+
cpData.completed && cpData.completed.length > 0 ? `### Completed\n${cpData.completed.map(s => '- ' + s).join('\n')}` : '',
|
|
1500
|
+
cpData.remaining && cpData.remaining.length > 0 ? `### Remaining\n${cpData.remaining.map(s => '- ' + s).join('\n')}` : '',
|
|
1501
|
+
cpData.blockers && cpData.blockers.length > 0 ? `### Blockers\n${cpData.blockers.map(s => '- ' + s).join('\n')}` : '',
|
|
1502
|
+
cpData.branch_state ? `### Branch State\n${cpData.branch_state}` : '',
|
|
1503
|
+
].filter(Boolean).join('\n');
|
|
1504
|
+
vars.checkpoint_context = cpSummary;
|
|
1505
|
+
log('info', `Injecting checkpoint context for ${item.id} (resume #${cpCount})`);
|
|
1506
|
+
}
|
|
1507
|
+
} catch (e) { log('warn', `checkpoint read for ${item.id}: ${e.message}`); }
|
|
1508
|
+
|
|
1477
1509
|
// Inject ask-specific variables for the ask playbook
|
|
1478
1510
|
if (workType === 'ask') {
|
|
1479
1511
|
vars.question = item.title + (item.description ? '\n\n' + item.description : '');
|
|
@@ -1859,6 +1891,39 @@ function discoverCentralWorkItems(config) {
|
|
|
1859
1891
|
const normAc = (item.acceptanceCriteria || []).map(c => '- [ ] ' + c).join('\n');
|
|
1860
1892
|
vars.acceptance_criteria = normAc ? '## Acceptance Criteria\n\n' + normAc : '';
|
|
1861
1893
|
|
|
1894
|
+
// Inject checkpoint context if agent left a checkpoint.json from a prior run
|
|
1895
|
+
vars.checkpoint_context = '';
|
|
1896
|
+
try {
|
|
1897
|
+
const centralBranch = item.branch || `work/${item.id}`;
|
|
1898
|
+
const centralWtPath = firstProject?.localPath
|
|
1899
|
+
? path.resolve(firstProject.localPath, config.engine?.worktreeRoot || '../worktrees', centralBranch)
|
|
1900
|
+
: '';
|
|
1901
|
+
const cpPath = centralWtPath ? path.join(centralWtPath, 'checkpoint.json') : '';
|
|
1902
|
+
if (cpPath && fs.existsSync(cpPath)) {
|
|
1903
|
+
const cpData = JSON.parse(fs.readFileSync(cpPath, 'utf8'));
|
|
1904
|
+
const cpCount = (item._checkpointCount || 0) + 1;
|
|
1905
|
+
if (cpCount > 3) {
|
|
1906
|
+
log('warn', `Work item ${item.id} exceeded 3 checkpoint-resumes — marking as needs-human-review`);
|
|
1907
|
+
item.status = 'needs-human-review';
|
|
1908
|
+
item._checkpointCount = cpCount;
|
|
1909
|
+
continue;
|
|
1910
|
+
}
|
|
1911
|
+
item._checkpointCount = cpCount;
|
|
1912
|
+
const cpSummary = [
|
|
1913
|
+
`## Checkpoint (Resume #${cpCount}/3)`,
|
|
1914
|
+
'',
|
|
1915
|
+
'A previous agent run timed out but left a checkpoint. Continue from where it left off.',
|
|
1916
|
+
'',
|
|
1917
|
+
cpData.completed && cpData.completed.length > 0 ? `### Completed\n${cpData.completed.map(s => '- ' + s).join('\n')}` : '',
|
|
1918
|
+
cpData.remaining && cpData.remaining.length > 0 ? `### Remaining\n${cpData.remaining.map(s => '- ' + s).join('\n')}` : '',
|
|
1919
|
+
cpData.blockers && cpData.blockers.length > 0 ? `### Blockers\n${cpData.blockers.map(s => '- ' + s).join('\n')}` : '',
|
|
1920
|
+
cpData.branch_state ? `### Branch State\n${cpData.branch_state}` : '',
|
|
1921
|
+
].filter(Boolean).join('\n');
|
|
1922
|
+
vars.checkpoint_context = cpSummary;
|
|
1923
|
+
log('info', `Injecting checkpoint context for ${item.id} (resume #${cpCount})`);
|
|
1924
|
+
}
|
|
1925
|
+
} catch (e) { log('warn', `checkpoint read for ${item.id}: ${e.message}`); }
|
|
1926
|
+
|
|
1862
1927
|
// Inject plan-specific variables for the plan playbook
|
|
1863
1928
|
if (workType === 'plan') {
|
|
1864
1929
|
// Ensure plans directory exists before agent tries to write
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yemi33/minions",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.146",
|
|
4
4
|
"description": "Multi-agent AI dev team that runs from ~/.minions/ — five autonomous agents share a single engine, dashboard, and knowledge base",
|
|
5
5
|
"bin": {
|
|
6
6
|
"minions": "bin/minions.js"
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Evaluate: {{item_name}}
|
|
2
|
+
|
|
3
|
+
> Agent: {{agent_name}} ({{agent_role}}) | Team root: {{team_root}}
|
|
4
|
+
|
|
5
|
+
## Context
|
|
6
|
+
|
|
7
|
+
Project: {{project_name}}
|
|
8
|
+
Repo: {{repo_name}} | Org: {{ado_org}} | ADO Project: {{ado_project}}
|
|
9
|
+
PR: {{pr_url}}
|
|
10
|
+
Work Item: {{item_id}}
|
|
11
|
+
|
|
12
|
+
## Acceptance Criteria
|
|
13
|
+
|
|
14
|
+
{{acceptance_criteria}}
|
|
15
|
+
|
|
16
|
+
## Task Description
|
|
17
|
+
|
|
18
|
+
{{task_description}}
|
|
19
|
+
|
|
20
|
+
## Your Task
|
|
21
|
+
|
|
22
|
+
You are the **Evaluator** in the Planner-Generator-Evaluator pattern. Your job is to independently verify whether the implementation in the PR branch meets the acceptance criteria. You are NOT the implementer — you are the skeptic.
|
|
23
|
+
|
|
24
|
+
**Mindset: Do not pass unless build succeeds AND all acceptance criteria are demonstrably met.** Assume the implementation is incomplete or wrong until proven otherwise. Look for edge cases, missing requirements, and silent failures.
|
|
25
|
+
|
|
26
|
+
## Step 1: Check Out the PR Branch
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
cd {{project_path}}
|
|
30
|
+
git fetch origin
|
|
31
|
+
git checkout {{branch_name}}
|
|
32
|
+
git pull origin {{branch_name}}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Step 2: Build
|
|
36
|
+
|
|
37
|
+
Run the project build. Check `CLAUDE.md`, `package.json`, or `README` for build instructions.
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Typical:
|
|
41
|
+
npm install && npm run build
|
|
42
|
+
# Or whatever the project uses
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Record: **PASS** or **FAIL** with error output.
|
|
46
|
+
|
|
47
|
+
If the build fails, **stop here** — the verdict is `pass: false`. Include the build error in feedback.
|
|
48
|
+
|
|
49
|
+
## Step 3: Run Tests
|
|
50
|
+
|
|
51
|
+
Run the full test suite:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npm test
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Record: **X passed / Y failed / Z skipped**.
|
|
58
|
+
|
|
59
|
+
If any tests fail, note which ones and whether they are related to the changes.
|
|
60
|
+
|
|
61
|
+
## Step 4: Diff Review Against Acceptance Criteria
|
|
62
|
+
|
|
63
|
+
Review the actual code changes:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
git diff {{main_branch}}...{{branch_name}} --stat
|
|
67
|
+
git diff {{main_branch}}...{{branch_name}}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
For **each** acceptance criterion, determine:
|
|
71
|
+
- **Met**: The diff demonstrably satisfies this criterion. Cite the specific file/line.
|
|
72
|
+
- **Not met**: The diff does not satisfy this criterion, or satisfies it only partially. Explain what's missing.
|
|
73
|
+
|
|
74
|
+
Be precise. "Looks good" is not an evaluation — cite file paths and line numbers.
|
|
75
|
+
|
|
76
|
+
## Step 5: Output Structured Verdict
|
|
77
|
+
|
|
78
|
+
After completing your evaluation, output the following JSON block as your final output. This MUST be valid JSON wrapped in a `json` fenced code block:
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"pass": false,
|
|
83
|
+
"build": true,
|
|
84
|
+
"tests": "42/42",
|
|
85
|
+
"criteria_met": [
|
|
86
|
+
"criterion 1 — met because X (source: path/to/file.js:42)"
|
|
87
|
+
],
|
|
88
|
+
"criteria_failed": [
|
|
89
|
+
"criterion 2 — not met because Y is missing"
|
|
90
|
+
],
|
|
91
|
+
"feedback": "Summary of what needs to change for this to pass. Be specific — file names, line numbers, what to add/fix."
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Field definitions:
|
|
96
|
+
- `pass`: `true` only if build succeeds AND **all** acceptance criteria are met. Otherwise `false`.
|
|
97
|
+
- `build`: `true` if the build completed without errors, `false` otherwise.
|
|
98
|
+
- `tests`: String in format `"passed/total"` (e.g., `"38/40"`). Use `"N/A"` if no test suite exists.
|
|
99
|
+
- `criteria_met`: Array of strings — one per criterion that IS met. Include source references.
|
|
100
|
+
- `criteria_failed`: Array of strings — one per criterion that is NOT met. Explain why.
|
|
101
|
+
- `feedback`: Actionable feedback for the implementer. Be specific about what to fix. If `pass` is `true`, use this for minor suggestions or "LGTM".
|
|
102
|
+
|
|
103
|
+
## Rules
|
|
104
|
+
|
|
105
|
+
- **No Playwright / browser testing** — this phase evaluates build, tests, and code review only.
|
|
106
|
+
- **Do NOT fix code** — only evaluate and report. You are the evaluator, not the implementer.
|
|
107
|
+
- **Do NOT rubber-stamp** — if a criterion is ambiguous, evaluate conservatively (fail it and explain).
|
|
108
|
+
- **Build failure is an automatic fail** — do not evaluate criteria if the build doesn't pass.
|
|
109
|
+
- **Every criterion must be addressed** — `criteria_met` + `criteria_failed` should cover all acceptance criteria.
|
|
110
|
+
- **Cite sources** — reference file paths and line numbers for every met/failed criterion.
|
|
111
|
+
|
|
112
|
+
{{references}}
|
|
113
|
+
|
|
114
|
+
**Note:** Do NOT write to `agents/*/status.json` — the engine manages your status automatically.
|
package/playbooks/fix.md
CHANGED
package/playbooks/implement.md
CHANGED
|
@@ -18,6 +18,8 @@ Implement PRD item **{{item_id}}: {{item_name}}**
|
|
|
18
18
|
- Complexity: {{item_complexity}}
|
|
19
19
|
- Description: {{item_description}}
|
|
20
20
|
|
|
21
|
+
{{checkpoint_context}}
|
|
22
|
+
|
|
21
23
|
## Projects
|
|
22
24
|
|
|
23
25
|
Primary repo: **{{repo_name}}** ({{ado_org}}/{{ado_project}}) at `{{project_path}}`
|
package/routing.md
CHANGED
|
@@ -17,6 +17,7 @@ How the engine decides who handles what. Parsed by engine.js — keep the table
|
|
|
17
17
|
| test | dallas | ralph |
|
|
18
18
|
| ask | ripley | rebecca |
|
|
19
19
|
| verify | dallas | ralph |
|
|
20
|
+
| evaluate | ripley | lambert |
|
|
20
21
|
| decompose | ripley | rebecca |
|
|
21
22
|
| meeting | ripley | rebecca |
|
|
22
23
|
|