monomind 1.18.13 → 1.19.0
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/.claude/agents/core/researcher.md +29 -24
- package/.claude/agents/github/code-review-swarm.md +1 -1
- package/.claude/agents/github/github-modes.md +1 -1
- package/.claude/agents/github/issue-tracker.md +1 -1
- package/.claude/agents/github/multi-repo-swarm.md +1 -1
- package/.claude/agents/github/pr-manager.md +1 -1
- package/.claude/agents/github/project-board-sync.md +1 -1
- package/.claude/agents/github/release-manager.md +1 -1
- package/.claude/agents/github/repo-architect.md +1 -1
- package/.claude/agents/github/swarm-issue.md +1 -1
- package/.claude/agents/github/swarm-pr.md +1 -1
- package/.claude/agents/github/sync-coordinator.md +1 -1
- package/.claude/agents/github/workflow-automation.md +1 -1
- package/.claude/agents/goal/goal-planner.md +1 -1
- package/.claude/agents/specialized/specialized-workflow-architect.md +11 -14
- package/.claude/agents/testing/production-validator.md +8 -7
- package/.claude/agents/testing/testing-evidence-collector.md +3 -1
- package/.claude/commands/mastermind/_repeat.md +22 -3
- package/.claude/commands/mastermind/architect.md +1 -1
- package/.claude/commands/mastermind/autodev.md +1 -1
- package/.claude/commands/mastermind/build.md +1 -1
- package/.claude/commands/mastermind/code-review.md +5 -5
- package/.claude/commands/mastermind/debug.md +1 -1
- package/.claude/commands/mastermind/help.md +2 -2
- package/.claude/commands/mastermind/idea.md +1 -1
- package/.claude/commands/mastermind/improve.md +1 -1
- package/.claude/commands/mastermind/okf-export.md +14 -0
- package/.claude/commands/mastermind/okf-import.md +15 -0
- package/.claude/commands/mastermind/plan.md +1 -1
- package/.claude/commands/mastermind/research.md +1 -1
- package/.claude/commands/mastermind/review.md +12 -1
- package/.claude/commands/mastermind/runorg.md +1 -1
- package/.claude/commands/mastermind/taskdev.md +1 -1
- package/.claude/commands/mastermind/tdd.md +1 -1
- package/.claude/commands/mastermind/verify.md +1 -1
- package/.claude/helpers/graphify-freshen.cjs +16 -20
- package/.claude/helpers/handlers/agent-start-handler.cjs +11 -36
- package/.claude/helpers/handlers/capture-handler.cjs +110 -0
- package/.claude/helpers/handlers/route-handler.cjs +180 -256
- package/.claude/helpers/handlers/session-handler.cjs +139 -142
- package/.claude/helpers/handlers/session-restore-handler.cjs +15 -10
- package/.claude/helpers/handlers/task-handler.cjs +8 -155
- package/.claude/helpers/hook-handler.cjs +89 -5
- package/.claude/helpers/intelligence.cjs +164 -15
- package/.claude/helpers/learning-service.mjs +1 -0
- package/.claude/helpers/mastermind-activate.cjs +33 -51
- package/.claude/helpers/monolean-activate.cjs +13 -3
- package/.claude/helpers/monolean-propagate.cjs +7 -3
- package/.claude/helpers/router.cjs +47 -9
- package/.claude/helpers/utils/monograph.cjs +37 -20
- package/.claude/settings.json +0 -20
- package/.claude/skills/mastermind-skills/_repeat.md +29 -4
- package/.claude/skills/mastermind-skills/architect.md +5 -6
- package/.claude/skills/mastermind-skills/autodev.md +8 -5
- package/.claude/skills/mastermind-skills/review.md +25 -11
- package/.claude/skills/mastermind-skills/techport.md +37 -3
- package/.claude/skills/monodesign/document.md +9 -6
- package/.claude/skills/monodesign/extract.md +1 -1
- package/.claude/skills/monodesign/reference/document.md +1 -1
- package/.claude/skills/monodesign/reference/live.md +1 -1
- package/.claude/skills/monolean/SKILL.md +1 -1
- package/package.json +1 -1
- package/packages/@monomind/cli/.claude/agents/core/researcher.md +29 -24
- package/packages/@monomind/cli/.claude/agents/github/code-review-swarm.md +1 -1
- package/packages/@monomind/cli/.claude/agents/github/github-modes.md +1 -1
- package/packages/@monomind/cli/.claude/agents/github/issue-tracker.md +1 -1
- package/packages/@monomind/cli/.claude/agents/github/multi-repo-swarm.md +1 -1
- package/packages/@monomind/cli/.claude/agents/github/pr-manager.md +1 -1
- package/packages/@monomind/cli/.claude/agents/github/project-board-sync.md +1 -1
- package/packages/@monomind/cli/.claude/agents/github/release-manager.md +1 -1
- package/packages/@monomind/cli/.claude/agents/github/repo-architect.md +1 -1
- package/packages/@monomind/cli/.claude/agents/github/swarm-issue.md +1 -1
- package/packages/@monomind/cli/.claude/agents/github/swarm-pr.md +1 -1
- package/packages/@monomind/cli/.claude/agents/github/sync-coordinator.md +1 -1
- package/packages/@monomind/cli/.claude/agents/github/workflow-automation.md +1 -1
- package/packages/@monomind/cli/.claude/agents/goal/goal-planner.md +1 -1
- package/packages/@monomind/cli/.claude/agents/specialized/specialized-workflow-architect.md +11 -14
- package/packages/@monomind/cli/.claude/agents/testing/production-validator.md +8 -7
- package/packages/@monomind/cli/.claude/agents/testing/testing-evidence-collector.md +3 -1
- package/packages/@monomind/cli/.claude/commands/mastermind/_repeat.md +22 -3
- package/packages/@monomind/cli/.claude/commands/mastermind/architect.md +1 -1
- package/packages/@monomind/cli/.claude/commands/mastermind/autodev.md +1 -1
- package/packages/@monomind/cli/.claude/commands/mastermind/build.md +1 -1
- package/packages/@monomind/cli/.claude/commands/mastermind/code-review.md +5 -5
- package/packages/@monomind/cli/.claude/commands/mastermind/debug.md +1 -1
- package/packages/@monomind/cli/.claude/commands/mastermind/help.md +2 -2
- package/packages/@monomind/cli/.claude/commands/mastermind/idea.md +1 -1
- package/packages/@monomind/cli/.claude/commands/mastermind/improve.md +1 -1
- package/packages/@monomind/cli/.claude/commands/mastermind/okf-export.md +14 -0
- package/packages/@monomind/cli/.claude/commands/mastermind/okf-import.md +15 -0
- package/packages/@monomind/cli/.claude/commands/mastermind/plan.md +1 -1
- package/packages/@monomind/cli/.claude/commands/mastermind/research.md +1 -1
- package/packages/@monomind/cli/.claude/commands/mastermind/review.md +12 -1
- package/packages/@monomind/cli/.claude/commands/mastermind/runorg.md +1 -1
- package/packages/@monomind/cli/.claude/commands/mastermind/taskdev.md +1 -1
- package/packages/@monomind/cli/.claude/commands/mastermind/tdd.md +1 -1
- package/packages/@monomind/cli/.claude/commands/mastermind/verify.md +1 -1
- package/packages/@monomind/cli/.claude/helpers/graphify-freshen.cjs +16 -20
- package/packages/@monomind/cli/.claude/helpers/handlers/agent-start-handler.cjs +11 -36
- package/packages/@monomind/cli/.claude/helpers/handlers/capture-handler.cjs +110 -0
- package/packages/@monomind/cli/.claude/helpers/handlers/route-handler.cjs +180 -256
- package/packages/@monomind/cli/.claude/helpers/handlers/session-handler.cjs +139 -142
- package/packages/@monomind/cli/.claude/helpers/handlers/session-restore-handler.cjs +15 -10
- package/packages/@monomind/cli/.claude/helpers/handlers/task-handler.cjs +8 -155
- package/packages/@monomind/cli/.claude/helpers/hook-handler.cjs +89 -5
- package/packages/@monomind/cli/.claude/helpers/intelligence.cjs +164 -15
- package/packages/@monomind/cli/.claude/helpers/learning-service.mjs +1 -0
- package/packages/@monomind/cli/.claude/helpers/mastermind-activate.cjs +33 -51
- package/packages/@monomind/cli/.claude/helpers/monolean-activate.cjs +13 -3
- package/packages/@monomind/cli/.claude/helpers/monolean-propagate.cjs +7 -3
- package/packages/@monomind/cli/.claude/helpers/router.cjs +47 -9
- package/packages/@monomind/cli/.claude/helpers/utils/monograph.cjs +37 -20
- package/packages/@monomind/cli/.claude/skills/mastermind-skills/_repeat.md +29 -4
- package/packages/@monomind/cli/.claude/skills/mastermind-skills/architect.md +5 -6
- package/packages/@monomind/cli/.claude/skills/mastermind-skills/autodev.md +8 -5
- package/packages/@monomind/cli/.claude/skills/mastermind-skills/review.md +25 -11
- package/packages/@monomind/cli/.claude/skills/mastermind-skills/techport.md +37 -3
- package/packages/@monomind/cli/.claude/skills/monodesign/document.md +9 -6
- package/packages/@monomind/cli/.claude/skills/monodesign/extract.md +1 -1
- package/packages/@monomind/cli/.claude/skills/monodesign/reference/document.md +1 -1
- package/packages/@monomind/cli/.claude/skills/monodesign/reference/live.md +1 -1
- package/packages/@monomind/cli/.claude/skills/monolean/SKILL.md +1 -1
- package/packages/@monomind/cli/bin/mcp-server.js +11 -1
- package/packages/@monomind/cli/dist/src/commands/agent-ops.d.ts +1 -2
- package/packages/@monomind/cli/dist/src/commands/agent-ops.js +1 -59
- package/packages/@monomind/cli/dist/src/commands/agent.js +2 -3
- package/packages/@monomind/cli/dist/src/commands/analyze-diff.js +1 -1
- package/packages/@monomind/cli/dist/src/commands/browse-action.js +94 -2
- package/packages/@monomind/cli/dist/src/commands/completions.js +11 -56
- package/packages/@monomind/cli/dist/src/commands/doctor-project-checks.d.ts +1 -1
- package/packages/@monomind/cli/dist/src/commands/doctor-project-checks.js +1 -1
- package/packages/@monomind/cli/dist/src/commands/hive-mind-helpers.js +2 -2
- package/packages/@monomind/cli/dist/src/commands/hive-mind-ops.d.ts +1 -3
- package/packages/@monomind/cli/dist/src/commands/hive-mind-ops.js +2 -116
- package/packages/@monomind/cli/dist/src/commands/hive-mind.js +2 -5
- package/packages/@monomind/cli/dist/src/commands/hooks-coverage-commands.js +8 -7
- package/packages/@monomind/cli/dist/src/commands/hooks-coverage-gaps.js +1 -1
- package/packages/@monomind/cli/dist/src/commands/hooks-coverage-routing.js +2 -2
- package/packages/@monomind/cli/dist/src/commands/hooks-extended-commands.d.ts +0 -3
- package/packages/@monomind/cli/dist/src/commands/hooks-extended-commands.js +0 -307
- package/packages/@monomind/cli/dist/src/commands/hooks.js +1 -12
- package/packages/@monomind/cli/dist/src/commands/index.d.ts +3 -51
- package/packages/@monomind/cli/dist/src/commands/index.js +36 -184
- package/packages/@monomind/cli/dist/src/commands/init-wizard.js +2 -4
- package/packages/@monomind/cli/dist/src/commands/mcp.js +32 -4
- package/packages/@monomind/cli/dist/src/commands/memory-admin.d.ts +1 -2
- package/packages/@monomind/cli/dist/src/commands/memory-admin.js +1 -118
- package/packages/@monomind/cli/dist/src/commands/memory-transfer.d.ts +1 -2
- package/packages/@monomind/cli/dist/src/commands/memory-transfer.js +5 -171
- package/packages/@monomind/cli/dist/src/commands/memory.js +3 -6
- package/packages/@monomind/cli/dist/src/commands/neural-core.d.ts +3 -1
- package/packages/@monomind/cli/dist/src/commands/neural-core.js +145 -6
- package/packages/@monomind/cli/dist/src/commands/neural-optimize.js +4 -4
- package/packages/@monomind/cli/dist/src/commands/neural-registry.d.ts +1 -1
- package/packages/@monomind/cli/dist/src/commands/neural-registry.js +4 -4
- package/packages/@monomind/cli/dist/src/commands/neural.d.ts +1 -1
- package/packages/@monomind/cli/dist/src/commands/neural.js +6 -6
- package/packages/@monomind/cli/dist/src/commands/performance.js +68 -58
- package/packages/@monomind/cli/dist/src/commands/providers.js +2 -131
- package/packages/@monomind/cli/dist/src/commands/security-misc.d.ts +0 -1
- package/packages/@monomind/cli/dist/src/commands/security-misc.js +69 -45
- package/packages/@monomind/cli/dist/src/commands/security.js +2 -4
- package/packages/@monomind/cli/dist/src/commands/session.js +1 -285
- package/packages/@monomind/cli/dist/src/commands/start.js +2 -41
- package/packages/@monomind/cli/dist/src/commands/status.js +18 -29
- package/packages/@monomind/cli/dist/src/commands/swarm.js +1 -1
- package/packages/@monomind/cli/dist/src/commands/task.js +2 -49
- package/packages/@monomind/cli/dist/src/commands/workflow.js +2 -104
- package/packages/@monomind/cli/dist/src/index.js +7 -0
- package/packages/@monomind/cli/dist/src/init/executor.js +3 -14
- package/packages/@monomind/cli/dist/src/init/helpers-generator.js +2 -22
- package/packages/@monomind/cli/dist/src/init/settings-generator.js +0 -1
- package/packages/@monomind/cli/dist/src/init/types.d.ts +1 -3
- package/packages/@monomind/cli/dist/src/init/types.js +0 -2
- package/packages/@monomind/cli/dist/src/mcp-client.js +0 -6
- package/packages/@monomind/cli/dist/src/mcp-server.js +16 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/agent-tools.js +0 -17
- package/packages/@monomind/cli/dist/src/mcp-tools/coherence/causal-infer.d.ts +5 -5
- package/packages/@monomind/cli/dist/src/mcp-tools/coherence/causal-infer.js +32 -46
- package/packages/@monomind/cli/dist/src/mcp-tools/coherence/consensus-verify.d.ts +2 -3
- package/packages/@monomind/cli/dist/src/mcp-tools/coherence/consensus-verify.js +22 -20
- package/packages/@monomind/cli/dist/src/mcp-tools/coherence/memory-gate.d.ts +3 -2
- package/packages/@monomind/cli/dist/src/mcp-tools/coherence/memory-gate.js +32 -19
- package/packages/@monomind/cli/dist/src/mcp-tools/coherence/quantum-topology.d.ts +4 -4
- package/packages/@monomind/cli/dist/src/mcp-tools/coherence/quantum-topology.js +11 -17
- package/packages/@monomind/cli/dist/src/mcp-tools/coherence/spectral-analyze.d.ts +2 -3
- package/packages/@monomind/cli/dist/src/mcp-tools/coherence/spectral-analyze.js +51 -32
- package/packages/@monomind/cli/dist/src/mcp-tools/coherence/types.d.ts +5 -9
- package/packages/@monomind/cli/dist/src/mcp-tools/guidance-tools.js +2 -2
- package/packages/@monomind/cli/dist/src/mcp-tools/hive-mind-tools.js +25 -3
- package/packages/@monomind/cli/dist/src/mcp-tools/hooks-routing.d.ts +0 -3
- package/packages/@monomind/cli/dist/src/mcp-tools/hooks-routing.js +45 -159
- package/packages/@monomind/cli/dist/src/mcp-tools/hooks-tools.js +1 -4
- package/packages/@monomind/cli/dist/src/mcp-tools/index.d.ts +0 -2
- package/packages/@monomind/cli/dist/src/mcp-tools/index.js +0 -3
- package/packages/@monomind/cli/dist/src/mcp-tools/memory-tools.js +24 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/monograph-tools.js +452 -7
- package/packages/@monomind/cli/dist/src/mcp-tools/neural-tools.d.ts +4 -10
- package/packages/@monomind/cli/dist/src/mcp-tools/neural-tools.js +28 -54
- package/packages/@monomind/cli/dist/src/mcp-tools/performance-tools.js +5 -17
- package/packages/@monomind/cli/dist/src/mcp-tools/quality/coverage-analysis/prioritize-gaps.js +2 -2
- package/packages/@monomind/cli/dist/src/mcp-tools/quality/security-compliance/detect-secrets.d.ts +4 -4
- package/packages/@monomind/cli/dist/src/mcp-tools/quality-tools.d.ts +7 -2
- package/packages/@monomind/cli/dist/src/mcp-tools/quality-tools.js +7 -257
- package/packages/@monomind/cli/dist/src/memory/intelligence.d.ts +7 -8
- package/packages/@monomind/cli/dist/src/memory/intelligence.js +15 -16
- package/packages/@monomind/cli/dist/src/memory/memory-bridge.d.ts +1 -0
- package/packages/@monomind/cli/dist/src/memory/memory-bridge.js +37 -0
- package/packages/@monomind/cli/dist/src/services/worker-daemon.d.ts +3 -21
- package/packages/@monomind/cli/dist/src/services/worker-daemon.js +13 -80
- package/packages/@monomind/cli/dist/src/suggest.js +0 -5
- package/packages/@monomind/cli/package.json +1 -1
- package/packages/@monomind/guidance/README.md +49 -1153
- package/packages/@monomind/guidance/package.json +1 -74
- package/.claude/helpers/auto-memory-hook.mjs +0 -503
- package/packages/@monomind/cli/.claude/helpers/auto-memory-hook.mjs +0 -503
- package/packages/@monomind/cli/dist/src/commands/deployment.d.ts +0 -10
- package/packages/@monomind/cli/dist/src/commands/deployment.js +0 -706
|
@@ -49,11 +49,28 @@ function _suggestCacheSet(key, value) {
|
|
|
49
49
|
}
|
|
50
50
|
_suggestCache._map[key] = value;
|
|
51
51
|
}
|
|
52
|
+
function _isValidDb(p) {
|
|
53
|
+
try { return fs.statSync(p).size >= 100; } catch (_) { return false; }
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function _resolveDbPath() {
|
|
57
|
+
// monolean: try CWD first, then git root, so hooks work from any subdirectory
|
|
58
|
+
var candidate = path.join(CWD, '.monomind', 'monograph.db');
|
|
59
|
+
if (_isValidDb(candidate)) return candidate;
|
|
60
|
+
try {
|
|
61
|
+
var { execSync } = require('child_process');
|
|
62
|
+
var root = execSync('git rev-parse --show-toplevel', { cwd: CWD, encoding: 'utf-8', timeout: 2000 }).trim();
|
|
63
|
+
candidate = path.join(root, '.monomind', 'monograph.db');
|
|
64
|
+
if (_isValidDb(candidate)) return candidate;
|
|
65
|
+
} catch (_) {}
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
|
|
52
69
|
function _openMonographDb() {
|
|
53
70
|
if (_cachedMonographDb !== undefined) return _cachedMonographDb;
|
|
54
71
|
try {
|
|
55
|
-
var dbPath =
|
|
56
|
-
if (!
|
|
72
|
+
var dbPath = _resolveDbPath();
|
|
73
|
+
if (!dbPath) { _cachedMonographDb = null; return null; }
|
|
57
74
|
var mod = _requireMonograph();
|
|
58
75
|
if (!mod || !mod.openDb) { _cachedMonographDb = null; return null; }
|
|
59
76
|
_cachedMonographDb = mod.openDb(dbPath);
|
|
@@ -189,27 +206,30 @@ function _isGraphFresh() {
|
|
|
189
206
|
if (_graphFreshnessCache !== undefined) return _graphFreshnessCache;
|
|
190
207
|
try {
|
|
191
208
|
var db = _openMonographDb();
|
|
192
|
-
if (!db) { _graphFreshnessCache =
|
|
209
|
+
if (!db) { _graphFreshnessCache = false; return false; }
|
|
193
210
|
var row = null;
|
|
194
211
|
try {
|
|
195
212
|
row = db.prepare("SELECT value FROM index_meta WHERE key='last_commit_hash'").get() ||
|
|
196
213
|
db.prepare("SELECT value FROM index_meta WHERE key='lastCommit'").get();
|
|
197
214
|
} catch (_) {}
|
|
198
215
|
if (!row || !row.value) {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
try { nodeCount = db.prepare('SELECT COUNT(*) AS c FROM nodes').get().c; } catch (_) {}
|
|
202
|
-
_graphFreshnessCache = nodeCount > 0;
|
|
203
|
-
return _graphFreshnessCache;
|
|
216
|
+
_graphFreshnessCache = false;
|
|
217
|
+
return false;
|
|
204
218
|
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
219
|
+
if (!/^[0-9a-f]{7,40}$/i.test(row.value)) {
|
|
220
|
+
_graphFreshnessCache = false;
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
223
|
+
var { execFileSync } = require('child_process');
|
|
224
|
+
var out = execFileSync('git', ['rev-list', '--count', row.value + '..HEAD'], {
|
|
225
|
+
encoding: 'utf-8', timeout: 1500, stdio: ['pipe', 'pipe', 'pipe'], cwd: CWD
|
|
208
226
|
}).trim();
|
|
209
|
-
var behind = parseInt(out, 10)
|
|
227
|
+
var behind = parseInt(out, 10);
|
|
228
|
+
if (isNaN(behind)) { _graphFreshnessCache = false; return false; }
|
|
210
229
|
_graphFreshnessCache = behind <= 50;
|
|
211
230
|
} catch(e) {
|
|
212
|
-
|
|
231
|
+
// Don't cache transient errors — let next call retry
|
|
232
|
+
return false;
|
|
213
233
|
}
|
|
214
234
|
return _graphFreshnessCache;
|
|
215
235
|
}
|
|
@@ -369,21 +389,18 @@ function injectGodNodesContext(CWD) {
|
|
|
369
389
|
// Precompute degree via indexed edge lookups to avoid O(N) correlated subquery
|
|
370
390
|
var godNodes = db.prepare(
|
|
371
391
|
"WITH deg AS (" +
|
|
372
|
-
" SELECT id, cnt FROM (" +
|
|
392
|
+
" SELECT id, SUM(cnt) AS deg FROM (" +
|
|
373
393
|
" SELECT source_id AS id, COUNT(*) AS cnt FROM edges GROUP BY source_id " +
|
|
374
394
|
" UNION ALL " +
|
|
375
395
|
" SELECT target_id AS id, COUNT(*) AS cnt FROM edges GROUP BY target_id" +
|
|
376
396
|
" ) GROUP BY id" +
|
|
377
|
-
" HAVING SUM(cnt) > 0" +
|
|
378
|
-
"), ranked AS (" +
|
|
379
|
-
" SELECT d.id, SUM(d.cnt) AS deg FROM deg d GROUP BY d.id ORDER BY deg DESC LIMIT 50" +
|
|
380
397
|
") " +
|
|
381
|
-
"SELECT n.name, n.label, n.file_path,
|
|
382
|
-
"FROM
|
|
398
|
+
"SELECT n.name, n.label, n.file_path, d.deg " +
|
|
399
|
+
"FROM deg d JOIN nodes n ON n.id = d.id " +
|
|
383
400
|
"WHERE n.label NOT IN ('Concept') " +
|
|
384
401
|
"AND n.file_path IS NOT NULL AND n.file_path != '' " +
|
|
385
402
|
"AND n.file_path NOT LIKE '%/node_modules/%' AND n.file_path NOT LIKE '%node_modules%' " +
|
|
386
|
-
"ORDER BY
|
|
403
|
+
"ORDER BY d.deg DESC LIMIT 12"
|
|
387
404
|
).all();
|
|
388
405
|
|
|
389
406
|
// Staleness indicator: compare stored commit hash with current HEAD.
|
|
@@ -6,6 +6,21 @@ type: protocol-skill
|
|
|
6
6
|
|
|
7
7
|
# REPEAT POSTAMBLE
|
|
8
8
|
|
|
9
|
+
<EXTREMELY-IMPORTANT>
|
|
10
|
+
## MANDATORY EXECUTION — READ THIS FIRST
|
|
11
|
+
|
|
12
|
+
This postamble is **not optional**. You MUST execute every step below. You MUST call ScheduleWakeup unless a legitimate stop condition is met (stop file, empty round confirmed by git, or count reached).
|
|
13
|
+
|
|
14
|
+
**Anti-rationalization rules:**
|
|
15
|
+
- "I think the work is done" is NOT a reason to stop. Only the checks below decide.
|
|
16
|
+
- "The skill already handled everything" is NOT a reason to skip this postamble.
|
|
17
|
+
- "There's nothing more to do" is NOT your decision — the tillend check decides.
|
|
18
|
+
- For `--repeat N`: you MUST run all N iterations. The count is non-negotiable. You cannot stop at run 3 of 5 because you think 3 was enough.
|
|
19
|
+
- For `--tillend`: you MUST continue until git AND your assessment BOTH confirm an empty round. Your feeling that "it's probably clean" is not evidence.
|
|
20
|
+
|
|
21
|
+
If you are about to end your response without calling ScheduleWakeup and you have not hit a legitimate stop condition, **YOU ARE MAKING AN ERROR. Go back and call ScheduleWakeup.**
|
|
22
|
+
</EXTREMELY-IMPORTANT>
|
|
23
|
+
|
|
9
24
|
**If neither `tillend_mode = true` nor `repeat_count ≥ 2` was active in this invocation, stop immediately — this skill is a no-op.**
|
|
10
25
|
|
|
11
26
|
Otherwise execute all steps below before ending the response.
|
|
@@ -29,12 +44,22 @@ If the stop file exists:
|
|
|
29
44
|
|
|
30
45
|
**`LOOP_ASYNC_PENDING` escape hatch:** If the calling skill set `LOOP_ASYNC_PENDING=true` before invoking this postamble (because it spawned background agents whose results have not yet arrived), skip the empty-round check and go directly to Step 4 to schedule the next run. Output: `[tillend] Async work in flight — deferring empty-round check to run <next_rep>.`
|
|
31
46
|
|
|
32
|
-
|
|
47
|
+
**Step 2a — Machine verification (REQUIRED before any self-assessment):**
|
|
48
|
+
|
|
49
|
+
Run this command to get an objective signal of whether files changed during this run:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
GIT_CHANGES=$(git diff --stat HEAD 2>/dev/null; git diff --cached --stat 2>/dev/null; git status --porcelain 2>/dev/null | grep -v '^\?\?' | head -20)
|
|
53
|
+
echo "GIT_CHANGES_DURING_RUN: ${GIT_CHANGES:-NONE}"
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
If `GIT_CHANGES` is non-empty, files were modified — `TILLEND_EMPTY=false` regardless of your self-assessment. Skip to "Otherwise" below.
|
|
57
|
+
|
|
58
|
+
**Step 2b — Self-assessment (only if git shows no changes):**
|
|
33
59
|
|
|
34
|
-
|
|
35
|
-
- **Actions**: files edited, code fixed, commits made, tasks created, configs changed, content written
|
|
60
|
+
Only if `GIT_CHANGES` was empty, evaluate whether this run produced findings (issues identified, problems flagged) or actions (tasks created, content written, configs changed — anything not captured by git diff).
|
|
36
61
|
|
|
37
|
-
Set `TILLEND_EMPTY=true` **only if
|
|
62
|
+
Set `TILLEND_EMPTY=true` **only if git shows no changes AND your self-assessment confirms zero findings and zero actions**.
|
|
38
63
|
|
|
39
64
|
**Important**: If this round found things AND fixed them, `TILLEND_EMPTY=false` — the loop must continue to verify the fixes didn't introduce new issues.
|
|
40
65
|
|
|
@@ -251,22 +251,21 @@ _entry=${_entry:-.}
|
|
|
251
251
|
npx --yes madge --circular "$_entry/" 2>/dev/null; } | head -20
|
|
252
252
|
|
|
253
253
|
# 6. Find god files (imported by many others)
|
|
254
|
-
#
|
|
255
|
-
#
|
|
256
|
-
#
|
|
257
|
-
#
|
|
254
|
+
# PREFERRED: use monograph (pre-computed graph index, faster and more accurate)
|
|
255
|
+
# Call mcp__monomind__monograph_god_nodes({}) first.
|
|
256
|
+
# Only fall back to grep below if monograph returns 0 results or the DB is not built.
|
|
257
|
+
#
|
|
258
|
+
# FALLBACK (grep-based, JS/TS/Vue and Python only):
|
|
258
259
|
grep -rh "^[^/]*from ['\"]" . \
|
|
259
260
|
--include="*.ts" --include="*.tsx" --include="*.js" --include="*.jsx" --include="*.vue" \
|
|
260
261
|
--exclude-dir=node_modules --exclude-dir=dist --exclude-dir=.git \
|
|
261
262
|
2>/dev/null \
|
|
262
263
|
| perl -ne 'if (/from\s+['"'"'"]([^'"'"'"\s]+)['"'"'"]/) { print "$1\n" }' \
|
|
263
264
|
| sort | uniq -c | sort -rn | head -20
|
|
264
|
-
# Python: count imports separately (no quotes in Python import syntax)
|
|
265
265
|
grep -rh "^from \|^import " . --include="*.py" \
|
|
266
266
|
--exclude-dir=node_modules --exclude-dir=dist --exclude-dir=.git \
|
|
267
267
|
2>/dev/null \
|
|
268
268
|
| awk '{print $2}' | sed 's/,.*//' | sed 's/\..*//' | grep -v '^$' | sort | uniq -c | sort -rn | head -20
|
|
269
|
-
# Note: if monograph is built, prefer mcp__monomind__monograph_god_nodes — it uses the pre-computed graph index
|
|
270
269
|
```
|
|
271
270
|
|
|
272
271
|
For each finding, produce a **Deduplication Action Table**:
|
|
@@ -48,19 +48,22 @@ Default `count = 1`.
|
|
|
48
48
|
|
|
49
49
|
```bash
|
|
50
50
|
git log --oneline -30
|
|
51
|
-
find . -maxdepth 3 -type f \( -name "*.ts" -o -name "*.js" -o -name "*.py" -o -name "*.go" -o -name "*.md" \) \
|
|
52
|
-
! -path "*/node_modules/*" ! -path "*/.git/*" ! -path "*/dist/*" | head -80
|
|
53
51
|
cat package.json 2>/dev/null || cat pyproject.toml 2>/dev/null || cat go.mod 2>/dev/null || true
|
|
54
52
|
head -120 README.md 2>/dev/null || true
|
|
55
|
-
grep -rn "<PATTERNS>" --include="*.ts" --include="*.js" --include="*.py" --include="*.go" --include="*.md" \
|
|
56
|
-
. 2>/dev/null | grep -v node_modules | grep -v dist | head -40
|
|
57
53
|
```
|
|
58
54
|
|
|
59
|
-
Plus these MCP calls (also parallel):
|
|
55
|
+
Plus these MCP calls (also parallel — **preferred over grep for symbol/pattern search**):
|
|
56
|
+
- `mcp__monomind__monograph_query` — search for `<PATTERNS>` (see mode table below); replaces grep for symbol lookup
|
|
60
57
|
- `mcp__monomind__monograph_god_nodes` — high-centrality modules (hotspots / where new features plug in)
|
|
61
58
|
- `mcp__monomind__monograph_suggest` — query per mode below
|
|
62
59
|
- `mcp__monomind__memory_search` — namespace `"mastermind:autodev"`, to exclude already-built work
|
|
63
60
|
|
|
61
|
+
**Fallback only** (if monograph returns 0 results or DB not built):
|
|
62
|
+
```bash
|
|
63
|
+
grep -rn "<PATTERNS>" --include="*.ts" --include="*.js" --include="*.py" --include="*.go" --include="*.md" \
|
|
64
|
+
. 2>/dev/null | grep -v node_modules | grep -v dist | head -40
|
|
65
|
+
```
|
|
66
|
+
|
|
64
67
|
Mode-specific values:
|
|
65
68
|
|
|
66
69
|
| | Improvement loop | Feature pipeline |
|
|
@@ -148,11 +148,14 @@ Run the test suite and adversarial probes against the live monofence-ai detector
|
|
|
148
148
|
```
|
|
149
149
|
MONOFENCE INPUT BOUNDARY SCAN (monofence_deep flag):
|
|
150
150
|
|
|
151
|
-
Step 1 — Find LLM input boundary files
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
151
|
+
Step 1 — Find LLM input boundary files:
|
|
152
|
+
PREFERRED: monograph_query({ query: "detect isSafe prompt chat completion message" })
|
|
153
|
+
monograph_neighbors({ name: "detect" }) // trace call chains into LLM boundaries
|
|
154
|
+
FALLBACK (if monograph returns 0 results):
|
|
155
|
+
grep -rl "detect\|isSafe\|prompt\|chat\|completion\|message" src/ --include="*.ts" --include="*.js"
|
|
156
|
+
find . -name "*.ts" -path "*/routes/*" -o -name "*.ts" -path "*/handlers/*" \
|
|
157
|
+
-o -name "*.ts" -path "*/controllers/*" -o -name "*.ts" -path "*/api/*" \
|
|
158
|
+
-o -name "prompt*.ts" -o -name "*chat*.ts" -o -name "*completion*.ts"
|
|
156
159
|
|
|
157
160
|
Step 2 — For each boundary file found, extract string literals and template literals
|
|
158
161
|
that flow into LLM calls (look for openai/anthropic/fetch calls).
|
|
@@ -171,8 +174,15 @@ Step 4 — Report:
|
|
|
171
174
|
|
|
172
175
|
Also run /mastermind:do --board <board_id> to track execution.
|
|
173
176
|
|
|
174
|
-
STEP 4 —
|
|
175
|
-
|
|
177
|
+
STEP 4 — AUTO-FIX (mode = auto only, skip for mode = confirm)
|
|
178
|
+
When mode is auto: for each fixable finding from the review (code bugs, style issues, security vulnerabilities with clear fixes), apply the fix directly by editing the file. Do NOT ask the user for permission — auto mode means fix without asking. After fixing, output:
|
|
179
|
+
[review] Auto-fixed N issues. M issues remain (require manual intervention or are architectural).
|
|
180
|
+
Non-fixable findings (design questions, trade-offs, architectural concerns) are reported but left untouched.
|
|
181
|
+
|
|
182
|
+
When --tillend is active, this step is critical: without auto-fixing, the loop either finds the same issues every round (infinite loop) or falsely declares empty round. The tillend contract is: find → fix → verify (next round) → stop when clean.
|
|
183
|
+
|
|
184
|
+
STEP 5 — COLLECT AND RETURN
|
|
185
|
+
Synthesize all review findings and fixes applied. Return to caller:
|
|
176
186
|
|
|
177
187
|
domain: review
|
|
178
188
|
status: complete | partial | blocked
|
|
@@ -183,12 +193,14 @@ decisions:
|
|
|
183
193
|
- what: [critical findings and recommended actions]
|
|
184
194
|
why: [evidence from review]
|
|
185
195
|
confidence: [0.0-1.0]
|
|
186
|
-
outcome: pending
|
|
196
|
+
outcome: fixed | pending | manual
|
|
187
197
|
lessons:
|
|
188
198
|
- what_worked: [which review angles surfaced the most value]
|
|
189
199
|
- what_didnt: [gaps in review coverage]
|
|
200
|
+
fixes_applied: [count of auto-fixed issues]
|
|
201
|
+
fixes_remaining: [count of issues needing manual intervention]
|
|
190
202
|
next_actions:
|
|
191
|
-
- [e.g. "run
|
|
203
|
+
- [e.g. "re-run review to verify fixes" if tillend is active]
|
|
192
204
|
- [e.g. "run mastermind:release after fixes are confirmed"]
|
|
193
205
|
board_url: monotask://<project_name>/review
|
|
194
206
|
run_id: <ISO8601-timestamp>`,
|
|
@@ -203,8 +215,10 @@ run_id: <ISO8601-timestamp>`,
|
|
|
203
215
|
For simple tasks (single reviewer, single artifact):
|
|
204
216
|
|
|
205
217
|
1. Spawn one Task agent with the review request as a self-contained briefing
|
|
206
|
-
2. Collect
|
|
207
|
-
3.
|
|
218
|
+
2. Collect findings
|
|
219
|
+
3. **If mode = auto**: apply fixes for all fixable findings directly (do NOT ask the user). Output: `[review] Auto-fixed N issues.`
|
|
220
|
+
4. **If mode = confirm**: present findings and ask which to fix
|
|
221
|
+
5. Return unified output schema with `status: complete`
|
|
208
222
|
|
|
209
223
|
---
|
|
210
224
|
|
|
@@ -75,8 +75,17 @@ find .claude -name "*.md" \
|
|
|
75
75
|
|
|
76
76
|
### 0B — Naming Convention Extraction (from actual monomind code)
|
|
77
77
|
|
|
78
|
-
Extract the real conventions — not the stated ones — from the codebase itself
|
|
78
|
+
Extract the real conventions — not the stated ones — from the codebase itself.
|
|
79
79
|
|
|
80
|
+
**Step 1 — monograph-based extraction (preferred):**
|
|
81
|
+
```
|
|
82
|
+
# Use monograph for exported symbol discovery
|
|
83
|
+
monograph_query({ query: "export class interface" }) # all exported types
|
|
84
|
+
monograph_god_nodes({}) # high-centrality files (naming exemplars)
|
|
85
|
+
monograph_stats({}) # node counts by type
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**Step 2 — grep fallback (only if monograph returns 0 results or DB not built):**
|
|
80
89
|
```bash
|
|
81
90
|
BASE=packages/@monomind/cli/src
|
|
82
91
|
|
|
@@ -143,10 +152,20 @@ Domain vocab: Agent, Memory, Swarm, Config, Node, Graph, Session, Task, Wo
|
|
|
143
152
|
|
|
144
153
|
### 0C — Dependency Direction Constraints
|
|
145
154
|
|
|
155
|
+
**Preferred: monograph-based dependency analysis:**
|
|
156
|
+
```
|
|
157
|
+
# Use monograph for dependency direction mapping
|
|
158
|
+
monograph_community({}) # module clusters with import directions
|
|
159
|
+
monograph_context({ name: "types" }) # 360° view: importers vs imports
|
|
160
|
+
monograph_context({ name: "utils" })
|
|
161
|
+
monograph_context({ name: "core" })
|
|
162
|
+
monograph_context({ name: "commands" })
|
|
163
|
+
monograph_context({ name: "services" })
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**Fallback (only if monograph unavailable):**
|
|
146
167
|
```bash
|
|
147
168
|
BASE=packages/@monomind/cli/src
|
|
148
|
-
|
|
149
|
-
# Map import directions by directory layer
|
|
150
169
|
for dir in types utils core commands services; do
|
|
151
170
|
count=$(grep -rn "^import" "$BASE/$dir" --include="*.ts" 2>/dev/null | wc -l)
|
|
152
171
|
refs=$(grep -rn "from.*/$dir/" "$BASE" --include="*.ts" 2>/dev/null | wc -l)
|
|
@@ -160,6 +179,13 @@ Extract the implied layering from the import ratio. High `imported_by` → leaf/
|
|
|
160
179
|
|
|
161
180
|
### 0D — Build Monomind Vocabulary Name Set (for collision detection)
|
|
162
181
|
|
|
182
|
+
**Preferred: monograph-based symbol enumeration:**
|
|
183
|
+
```
|
|
184
|
+
monograph_query({ query: "export class interface function const type enum" })
|
|
185
|
+
# Extract names from results for collision checking
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**Fallback (only if monograph unavailable):**
|
|
163
189
|
```bash
|
|
164
190
|
grep -rhn "^export" packages/@monomind/cli/src \
|
|
165
191
|
--include="*.ts" | grep -v dist | \
|
|
@@ -200,6 +226,14 @@ Set `source_brand` to the PascalCase result (e.g., `Monomind`, `ClaudeFlow`, `So
|
|
|
200
226
|
|
|
201
227
|
### 1B — Repo-Map (Structural Index)
|
|
202
228
|
|
|
229
|
+
**If source project has a monograph index** (check with `monograph_health` against source_path):
|
|
230
|
+
```
|
|
231
|
+
monograph_query({ query: "export class interface function" }) # all exported symbols
|
|
232
|
+
monograph_god_nodes({}) # high-centrality files
|
|
233
|
+
monograph_community({}) # module structure
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
**Otherwise (foreign project without monograph — grep is expected here):**
|
|
203
237
|
```bash
|
|
204
238
|
# File tree
|
|
205
239
|
find "{source_path}" -maxdepth 4 \
|
|
@@ -16,15 +16,18 @@ Read `reference/document.md` from the monodesign skill directory for the full pr
|
|
|
16
16
|
|
|
17
17
|
## Discovery
|
|
18
18
|
|
|
19
|
-
**Extract from codebase:**
|
|
19
|
+
**Extract from codebase (monograph-first):**
|
|
20
|
+
```
|
|
21
|
+
# Preferred: monograph for design token discovery
|
|
22
|
+
monograph_query({ query: "CSS custom properties variables tokens" })
|
|
23
|
+
monograph_query({ query: "font-family font-face typography" })
|
|
24
|
+
monograph_query({ query: "color theme palette" })
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**Fallback (if monograph returns 0 results or DB not built):**
|
|
20
28
|
```bash
|
|
21
|
-
# Find CSS custom properties
|
|
22
29
|
grep -r "^--" src/ --include="*.css" --include="*.scss" -h | sort -u
|
|
23
|
-
|
|
24
|
-
# Find font declarations
|
|
25
30
|
grep -r "font-family\|@font-face\|@import.*font" src/ -h | sort -u
|
|
26
|
-
|
|
27
|
-
# Find color values
|
|
28
31
|
grep -rE "#[0-9a-fA-F]{3,8}|oklch\(|rgb\(|hsl\(" src/ -h | sort -u | head -50
|
|
29
32
|
```
|
|
30
33
|
|
|
@@ -17,7 +17,7 @@ Every codebase with more than a few pages has an implicit design system — inco
|
|
|
17
17
|
## Discovery Phase
|
|
18
18
|
|
|
19
19
|
**Color inventory**
|
|
20
|
-
- Collect all color values used in the codebase (grep for `#`, `rgb`, `hsl`, `oklch`)
|
|
20
|
+
- Collect all color values used in the codebase (use `monograph_query({ query: "color rgb hsl oklch" })` first; fall back to grep for `#`, `rgb`, `hsl`, `oklch` if monograph returns 0 results)
|
|
21
21
|
- Group by apparent purpose (backgrounds, text, accents, borders, shadows)
|
|
22
22
|
- Identify the brand anchor color(s)
|
|
23
23
|
- Spot inconsistencies (5 slightly different grays)
|
|
@@ -81,7 +81,7 @@ Decide by scanning first (Scan mode Step 1). If the scan finds no tokens, no com
|
|
|
81
81
|
|
|
82
82
|
Search the codebase in priority order:
|
|
83
83
|
|
|
84
|
-
1. **CSS custom properties**: grep for `--color-`, `--font-`, `--spacing-`, `--radius-`, `--shadow-`, `--ease-`, `--duration-` declarations in CSS files
|
|
84
|
+
1. **CSS custom properties**: use `monograph_query({ query: "color font spacing radius shadow ease duration CSS custom property" })` first; fall back to grep for `--color-`, `--font-`, `--spacing-`, `--radius-`, `--shadow-`, `--ease-`, `--duration-` declarations in CSS files if monograph returns 0 results. Record name, value, and the file it's defined in.
|
|
85
85
|
2. **Tailwind config**: if `tailwind.config.{js,ts,mjs}` exists, read the `theme.extend` block for colors, fontFamily, spacing, borderRadius, boxShadow.
|
|
86
86
|
3. **CSS-in-JS theme files**: styled-components, emotion, vanilla-extract, stitches; look for `theme.ts`, `tokens.ts`, or equivalent.
|
|
87
87
|
4. **Design token files**: `tokens.json`, `design-tokens.json`, Style Dictionary output, W3C token community group format.
|
|
@@ -364,7 +364,7 @@ The goal is the same: give the user three variants to choose from AND persist th
|
|
|
364
364
|
|
|
365
365
|
Use the error payload:
|
|
366
366
|
|
|
367
|
-
- `element_not_in_source` with `generatedMatch: "public/docs/foo.html"`: the served HTML is generated. Find the generator (
|
|
367
|
+
- `element_not_in_source` with `generatedMatch: "public/docs/foo.html"`: the served HTML is generated. Find the generator (use `monograph_query({ query: "build generate template" })` or `monograph_neighbors` to trace writers of that path; fall back to grep if monograph returns 0 results, e.g. `scripts/build-sub-pages.js`, an Astro/Next template) and locate the template or partial that emits this element.
|
|
368
368
|
- `element_not_found`: the element is runtime-injected. Look for the component that renders it (React/Vue/Svelte), the JS that assembles it, or the data source that feeds it.
|
|
369
369
|
- `file_is_generated` with `file: "..."`: user pointed at a generated file explicitly. Same resolution as `element_not_in_source`.
|
|
370
370
|
|
|
@@ -45,7 +45,7 @@ take the higher one and move on. The first lazy solution that works is the
|
|
|
45
45
|
right one — once you actually know what the change has to touch.
|
|
46
46
|
|
|
47
47
|
**Bug fix = root cause, not symptom.** A report names a symptom. Before you
|
|
48
|
-
edit,
|
|
48
|
+
edit, find every caller of the function you're about to touch (use `monograph_neighbors` or `monograph_impact` first; fall back to grep only if monograph returns 0 results). The lazy fix IS
|
|
49
49
|
the root-cause fix: one guard in the shared function is a smaller diff than a
|
|
50
50
|
guard in every caller — and patching only the path the ticket names leaves
|
|
51
51
|
every sibling caller still broken. Fix it once, where all callers route through.
|
|
@@ -97,7 +97,16 @@ async function handleMessage(message) {
|
|
|
97
97
|
|
|
98
98
|
try {
|
|
99
99
|
switch (message.method) {
|
|
100
|
-
case 'initialize':
|
|
100
|
+
case 'initialize': {
|
|
101
|
+
const roots = params.roots ?? params.workspaceFolders ?? [];
|
|
102
|
+
if (roots.length > 0 && !process.env.MONOMIND_CWD) {
|
|
103
|
+
const rootUri = typeof roots[0] === 'string' ? roots[0] : (roots[0].uri ?? roots[0].path ?? '');
|
|
104
|
+
const rootPath = rootUri.startsWith('file://') ? decodeURIComponent(rootUri.slice(7)) : rootUri;
|
|
105
|
+
if (rootPath) {
|
|
106
|
+
process.env.MONOMIND_CWD = rootPath;
|
|
107
|
+
console.error(`[${new Date().toISOString()}] INFO [monomind-mcp] Project root set to ${rootPath}`);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
101
110
|
return {
|
|
102
111
|
jsonrpc: '2.0',
|
|
103
112
|
id: message.id,
|
|
@@ -110,6 +119,7 @@ async function handleMessage(message) {
|
|
|
110
119
|
},
|
|
111
120
|
},
|
|
112
121
|
};
|
|
122
|
+
}
|
|
113
123
|
|
|
114
124
|
case 'tools/list': {
|
|
115
125
|
const tools = listMCPTools();
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Agent operational commands — metrics, pool, health
|
|
2
|
+
* Agent operational commands — metrics, pool, health
|
|
3
3
|
*/
|
|
4
4
|
import type { Command } from '../types.js';
|
|
5
5
|
export declare const metricsCommand: Command;
|
|
6
6
|
export declare const poolCommand: Command;
|
|
7
7
|
export declare const healthCommand: Command;
|
|
8
|
-
export declare const logsCommand: Command;
|
|
9
8
|
//# sourceMappingURL=agent-ops.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Agent operational commands — metrics, pool, health
|
|
2
|
+
* Agent operational commands — metrics, pool, health
|
|
3
3
|
*/
|
|
4
4
|
import { output } from '../output.js';
|
|
5
5
|
import { callMCPTool, MCPClientError } from '../mcp-client.js';
|
|
@@ -268,62 +268,4 @@ export const healthCommand = {
|
|
|
268
268
|
}
|
|
269
269
|
},
|
|
270
270
|
};
|
|
271
|
-
// ─── logs subcommand ─────────────────────────────────────────────────────────
|
|
272
|
-
function formatLogLevel(level) {
|
|
273
|
-
switch (level) {
|
|
274
|
-
case 'debug': return output.dim('[DEBUG]');
|
|
275
|
-
case 'info': return '[INFO] ';
|
|
276
|
-
case 'warn': return output.warning('[WARN] ');
|
|
277
|
-
case 'error': return output.error('[ERROR]');
|
|
278
|
-
default: return `[${level.toUpperCase()}]`;
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
export const logsCommand = {
|
|
282
|
-
name: 'logs',
|
|
283
|
-
description: 'Show agent activity logs',
|
|
284
|
-
options: [
|
|
285
|
-
{ name: 'id', short: 'i', description: 'Agent ID', type: 'string' },
|
|
286
|
-
{ name: 'tail', short: 'n', description: 'Number of recent entries', type: 'number', default: 50 },
|
|
287
|
-
{ name: 'level', short: 'l', description: 'Minimum log level', type: 'string', choices: ['debug', 'info', 'warn', 'error'], default: 'info' },
|
|
288
|
-
{ name: 'follow', short: 'f', description: 'Follow log output', type: 'boolean', default: false },
|
|
289
|
-
{ name: 'since', description: 'Show logs since (e.g., "1h", "30m")', type: 'string' },
|
|
290
|
-
],
|
|
291
|
-
examples: [
|
|
292
|
-
{ command: 'monomind agent logs -i agent-001', description: 'Show agent logs' },
|
|
293
|
-
{ command: 'monomind agent logs -i agent-001 -f', description: 'Follow agent logs' },
|
|
294
|
-
{ command: 'monomind agent logs -l error --since 1h', description: 'Show errors from last hour' },
|
|
295
|
-
],
|
|
296
|
-
action: async (ctx) => {
|
|
297
|
-
const agentId = ((ctx.args[0] || ctx.flags.id) ?? '').slice(0, 128);
|
|
298
|
-
const tail = ctx.flags.tail;
|
|
299
|
-
const level = ctx.flags.level?.slice(0, 32);
|
|
300
|
-
if (!agentId) {
|
|
301
|
-
output.printError('Agent ID is required. Use --id or -i');
|
|
302
|
-
return { success: false, exitCode: 1 };
|
|
303
|
-
}
|
|
304
|
-
try {
|
|
305
|
-
const result = await callMCPTool('agent_logs', { agentId, tail, level, since: ctx.flags.since });
|
|
306
|
-
if (ctx.flags.format === 'json') {
|
|
307
|
-
output.printJson(result);
|
|
308
|
-
return { success: true, data: result };
|
|
309
|
-
}
|
|
310
|
-
output.writeln();
|
|
311
|
-
output.writeln(output.bold(`Logs for ${agentId}`));
|
|
312
|
-
output.writeln(output.dim(`Showing ${result.entries.length} of ${result.total} entries`));
|
|
313
|
-
output.writeln();
|
|
314
|
-
for (const entry of result.entries) {
|
|
315
|
-
const time = new Date(entry.timestamp).toLocaleTimeString();
|
|
316
|
-
output.writeln(`${output.dim(time)} ${formatLogLevel(entry.level)} ${entry.message}`);
|
|
317
|
-
if (entry.context && Object.keys(entry.context).length > 0) {
|
|
318
|
-
output.writeln(output.dim(` ${JSON.stringify(entry.context)}`));
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
return { success: true, data: result };
|
|
322
|
-
}
|
|
323
|
-
catch (error) {
|
|
324
|
-
output.printError(error instanceof MCPClientError ? `Logs error: ${error.message}` : `Unexpected error: ${String(error)}`);
|
|
325
|
-
return { success: false, exitCode: 1 };
|
|
326
|
-
}
|
|
327
|
-
},
|
|
328
|
-
};
|
|
329
271
|
//# sourceMappingURL=agent-ops.js.map
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { output } from '../output.js';
|
|
6
6
|
import { spawnCommand, listCommand, statusCommand, stopCommand } from './agent-lifecycle.js';
|
|
7
|
-
import { metricsCommand, poolCommand, healthCommand
|
|
7
|
+
import { metricsCommand, poolCommand, healthCommand } from './agent-ops.js';
|
|
8
8
|
export const agentCommand = {
|
|
9
9
|
name: 'agent',
|
|
10
10
|
description: 'Agent management commands',
|
|
11
|
-
subcommands: [spawnCommand, listCommand, statusCommand, stopCommand, metricsCommand, poolCommand, healthCommand
|
|
11
|
+
subcommands: [spawnCommand, listCommand, statusCommand, stopCommand, metricsCommand, poolCommand, healthCommand],
|
|
12
12
|
options: [],
|
|
13
13
|
examples: [
|
|
14
14
|
{ command: 'monomind agent spawn -t coder', description: 'Spawn a coder agent' },
|
|
@@ -30,7 +30,6 @@ export const agentCommand = {
|
|
|
30
30
|
`${output.highlight('metrics')} - Show agent metrics`,
|
|
31
31
|
`${output.highlight('pool')} - Manage agent pool`,
|
|
32
32
|
`${output.highlight('health')} - Show agent health`,
|
|
33
|
-
`${output.highlight('logs')} - Show agent logs`,
|
|
34
33
|
]);
|
|
35
34
|
output.writeln();
|
|
36
35
|
output.writeln('Run "monomind agent <subcommand> --help" for subcommand help');
|