@monoes/monomindcli 2.9.7 → 2.9.9
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/design/design-monodesign.md +1 -2
- package/.claude/agents/engineering/engineering-ai-data-remediation-engineer.md +1 -2
- package/.claude/agents/engineering/engineering-ai-engineer.md +1 -2
- package/.claude/agents/engineering/engineering-autonomous-optimization-architect.md +0 -1
- package/.claude/agents/engineering/engineering-backend-architect.md +1 -2
- package/.claude/agents/engineering/engineering-code-reviewer.md +1 -2
- package/.claude/agents/engineering/engineering-data-engineer.md +1 -2
- package/.claude/agents/engineering/engineering-database-optimizer.md +1 -2
- package/.claude/agents/engineering/engineering-devops-automator.md +1 -2
- package/.claude/agents/engineering/engineering-embedded-firmware-engineer.md +1 -2
- package/.claude/agents/engineering/engineering-feishu-integration-developer.md +1 -2
- package/.claude/agents/engineering/engineering-frontend-developer.md +1 -2
- package/.claude/agents/engineering/engineering-git-workflow-master.md +1 -2
- package/.claude/agents/engineering/engineering-incident-response-commander.md +0 -1
- package/.claude/agents/engineering/engineering-mobile-app-builder.md +1 -2
- package/.claude/agents/engineering/engineering-rapid-prototyper.md +1 -2
- package/.claude/agents/engineering/engineering-security-engineer.md +1 -2
- package/.claude/agents/engineering/engineering-senior-developer.md +1 -2
- package/.claude/agents/engineering/engineering-software-architect.md +1 -2
- package/.claude/agents/engineering/engineering-solidity-smart-contract-engineer.md +1 -2
- package/.claude/agents/engineering/engineering-sre.md +0 -1
- package/.claude/agents/engineering/engineering-technical-writer.md +1 -2
- package/.claude/agents/engineering/engineering-threat-detection-engineer.md +0 -1
- package/.claude/agents/engineering/engineering-wechat-mini-program-developer.md +1 -2
- package/.claude/agents/github/code-review-swarm.md +0 -1
- package/.claude/agents/github/github-modes.md +0 -1
- package/.claude/agents/github/issue-tracker.md +0 -1
- package/.claude/agents/github/multi-repo-swarm.md +0 -1
- package/.claude/agents/github/pr-manager.md +0 -1
- package/.claude/agents/github/project-board-sync.md +0 -1
- package/.claude/agents/github/release-manager.md +0 -1
- package/.claude/agents/github/repo-architect.md +0 -1
- package/.claude/agents/github/swarm-issue.md +0 -1
- package/.claude/agents/github/swarm-pr.md +0 -1
- package/.claude/agents/github/sync-coordinator.md +0 -1
- package/.claude/agents/github/workflow-automation.md +0 -1
- package/.claude/agents/marketing/marketing-competitive-content.md +1 -2
- package/.claude/agents/marketing/marketing-cro-specialist.md +1 -2
- package/.claude/agents/marketing/marketing-email-specialist.md +1 -2
- package/.claude/agents/marketing/marketing-launch-strategist.md +1 -2
- package/.claude/agents/marketing/marketing-pricing-strategist.md +1 -2
- package/.claude/agents/specialized/agentic-identity-trust.md +0 -1
- package/.claude/agents/specialized/agents-orchestrator.md +1 -2
- package/.claude/agents/specialized/automation-governance-architect.md +1 -2
- package/.claude/agents/specialized/blockchain-security-auditor.md +1 -2
- package/.claude/agents/specialized/compliance-auditor.md +1 -2
- package/.claude/agents/specialized/identity-graph-operator.md +0 -1
- package/.claude/agents/specialized/lsp-index-engineer.md +1 -2
- package/.claude/agents/specialized/mobile/spec-mobile-react-native.md +0 -1
- package/.claude/agents/specialized/specialized-cultural-intelligence-strategist.md +0 -1
- package/.claude/agents/specialized/specialized-developer-advocate.md +1 -2
- package/.claude/agents/specialized/specialized-document-generator.md +1 -2
- package/.claude/agents/specialized/specialized-mcp-builder.md +1 -2
- package/.claude/agents/specialized/specialized-model-qa.md +0 -1
- package/.claude/agents/specialized/specialized-workflow-architect.md +1 -2
- package/.claude/agents/specialized/zk-steward.md +1 -2
- package/.claude/agents/testing/production-validator.md +0 -1
- package/.claude/agents/testing/tdd-london-swarm.md +0 -1
- package/.claude/agents/testing/testing-accessibility-auditor.md +0 -1
- package/.claude/agents/testing/testing-api-tester.md +1 -2
- package/.claude/agents/testing/testing-evidence-collector.md +1 -2
- package/.claude/agents/testing/testing-performance-benchmarker.md +1 -2
- package/.claude/agents/testing/testing-test-results-analyzer.md +1 -2
- package/.claude/agents/testing/testing-tool-evaluator.md +1 -2
- package/.claude/agents/testing/testing-workflow-optimizer.md +1 -2
- package/.claude/commands/hooks/README.md +1 -1
- package/.claude/commands/memory/README.md +6 -7
- package/.claude/commands/monitoring/README.md +1 -1
- package/.claude/helpers/control-start.cjs +37 -8
- package/.claude/helpers/handlers/route-handler.cjs +22 -3
- package/.claude/helpers/handlers/session-handler.cjs +43 -0
- package/.claude/helpers/intelligence.cjs +27 -6
- package/.claude/helpers/statusline.cjs +45 -11
- package/.claude/skills/agentic-jujutsu/SKILL.md +17 -15
- package/.claude/skills/hive-mind-advanced/SKILL.md +212 -559
- package/.claude/skills/hooks-automation/SKILL.md +1 -1
- package/.claude/skills/mastermind-adapters/SKILL.md +0 -11
- package/.claude/skills/mastermind-agents/SKILL.md +0 -11
- package/.claude/skills/mastermind-backup/SKILL.md +0 -11
- package/.claude/skills/mastermind-bootstrap/SKILL.md +0 -11
- package/.claude/skills/mastermind-delegation/SKILL.md +14 -12
- package/.claude/skills/mastermind-idea/SKILL.md +0 -5
- package/.claude/skills/mastermind-monitor/SKILL.md +0 -15
- package/.claude/skills/mastermind-org-settings/SKILL.md +0 -11
- package/.claude/skills/mastermind-plugins/SKILL.md +0 -11
- package/.claude/skills/mastermind-protocol/SKILL.md +6 -124
- package/.claude/skills/mastermind-repeat/SKILL.md +0 -25
- package/.claude/skills/mastermind-review/SKILL.md +1 -1
- package/.claude/skills/mastermind-stoporg/SKILL.md +0 -19
- package/.claude/skills/memory-toolkit/SKILL.md +12 -11
- package/.claude/skills/monodesign/scripts/detector/engines/browser/drivers.mjs +8 -1
- package/.claude/skills/pair-programming/SKILL.md +1 -1
- package/.claude/skills/performance-analysis/SKILL.md +228 -484
- package/.claude/skills/specialagent/SKILL.md +31 -133
- package/.claude/skills/swarm-advanced/SKILL.md +2 -2
- package/.claude/skills/swarm-orchestration/SKILL.md +220 -150
- package/.claude/skills/verification-quality/SKILL.md +247 -571
- package/README.md +3 -3
- package/dist/src/commands/agent-lifecycle.js +3 -3
- package/dist/src/commands/agent-lifecycle.js.map +1 -1
- package/dist/src/commands/autopilot.d.ts.map +1 -1
- package/dist/src/commands/autopilot.js +7 -1
- package/dist/src/commands/autopilot.js.map +1 -1
- package/dist/src/commands/doc.d.ts.map +1 -1
- package/dist/src/commands/doc.js +14 -3
- package/dist/src/commands/doc.js.map +1 -1
- package/dist/src/commands/doctor-env-checks.d.ts +1 -1
- package/dist/src/commands/doctor-env-checks.d.ts.map +1 -1
- package/dist/src/commands/doctor-project-checks.d.ts.map +1 -1
- package/dist/src/commands/doctor-project-checks.js +3 -37
- package/dist/src/commands/doctor-project-checks.js.map +1 -1
- package/dist/src/commands/doctor.d.ts.map +1 -1
- package/dist/src/commands/doctor.js +30 -1
- package/dist/src/commands/doctor.js.map +1 -1
- package/dist/src/commands/hooks-coverage-commands.d.ts.map +1 -1
- package/dist/src/commands/hooks-coverage-commands.js +75 -67
- package/dist/src/commands/hooks-coverage-commands.js.map +1 -1
- package/dist/src/commands/hooks-workers.d.ts.map +1 -1
- package/dist/src/commands/hooks-workers.js +41 -10
- package/dist/src/commands/hooks-workers.js.map +1 -1
- package/dist/src/commands/hooks.js +1 -1
- package/dist/src/commands/index.d.ts +1 -1
- package/dist/src/commands/index.d.ts.map +1 -1
- package/dist/src/commands/index.js +20 -4
- package/dist/src/commands/index.js.map +1 -1
- package/dist/src/commands/init.d.ts.map +1 -1
- package/dist/src/commands/init.js +80 -7
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/mcp.d.ts.map +1 -1
- package/dist/src/commands/mcp.js +78 -2
- package/dist/src/commands/mcp.js.map +1 -1
- package/dist/src/commands/neural-optimize.d.ts.map +1 -1
- package/dist/src/commands/neural-optimize.js +27 -5
- package/dist/src/commands/neural-optimize.js.map +1 -1
- package/dist/src/commands/org-observe.d.ts.map +1 -1
- package/dist/src/commands/org-observe.js +37 -30
- package/dist/src/commands/org-observe.js.map +1 -1
- package/dist/src/commands/org.d.ts.map +1 -1
- package/dist/src/commands/org.js +129 -2
- package/dist/src/commands/org.js.map +1 -1
- package/dist/src/commands/performance.js +1 -1
- package/dist/src/commands/performance.js.map +1 -1
- package/dist/src/commands/security-cve.d.ts.map +1 -1
- package/dist/src/commands/security-cve.js +1 -11
- package/dist/src/commands/security-cve.js.map +1 -1
- package/dist/src/commands/security-misc.d.ts +0 -9
- package/dist/src/commands/security-misc.d.ts.map +1 -1
- package/dist/src/commands/security-misc.js +33 -54
- package/dist/src/commands/security-misc.js.map +1 -1
- package/dist/src/commands/security-scan.d.ts.map +1 -1
- package/dist/src/commands/security-scan.js +3 -11
- package/dist/src/commands/security-scan.js.map +1 -1
- package/dist/src/commands/swarm.d.ts.map +1 -1
- package/dist/src/commands/swarm.js +7 -2
- package/dist/src/commands/swarm.js.map +1 -1
- package/dist/src/commands/ui.d.ts +8 -0
- package/dist/src/commands/ui.d.ts.map +1 -0
- package/dist/src/commands/ui.js +94 -0
- package/dist/src/commands/ui.js.map +1 -0
- package/dist/src/init/claudemd-generator.d.ts.map +1 -1
- package/dist/src/init/claudemd-generator.js +7 -9
- package/dist/src/init/claudemd-generator.js.map +1 -1
- package/dist/src/init/executor.d.ts.map +1 -1
- package/dist/src/init/executor.js +13 -3
- package/dist/src/init/executor.js.map +1 -1
- package/dist/src/init/kimi-generator.d.ts +3 -2
- package/dist/src/init/kimi-generator.d.ts.map +1 -1
- package/dist/src/init/kimi-generator.js +45 -13
- package/dist/src/init/kimi-generator.js.map +1 -1
- package/dist/src/init/statusline-generator.d.ts +1 -1
- package/dist/src/init/statusline-generator.js +1 -1
- package/dist/src/init/write-capabilities.js +7 -7
- package/dist/src/init/write-capabilities.js.map +1 -1
- package/dist/src/knowledge/document-pipeline.d.ts.map +1 -1
- package/dist/src/knowledge/document-pipeline.js +1 -0
- package/dist/src/knowledge/document-pipeline.js.map +1 -1
- package/dist/src/knowledge/eval/golden-set.d.ts.map +1 -1
- package/dist/src/knowledge/eval/golden-set.js +21 -32
- package/dist/src/knowledge/eval/golden-set.js.map +1 -1
- package/dist/src/mcp-tools/embeddings-tools.js +2 -2
- package/dist/src/mcp-tools/embeddings-tools.js.map +1 -1
- package/dist/src/mcp-tools/hooks-intelligence.d.ts.map +1 -1
- package/dist/src/mcp-tools/hooks-intelligence.js +29 -3
- package/dist/src/mcp-tools/hooks-intelligence.js.map +1 -1
- package/dist/src/mcp-tools/hooks-routing.d.ts.map +1 -1
- package/dist/src/mcp-tools/hooks-routing.js +32 -19
- package/dist/src/mcp-tools/hooks-routing.js.map +1 -1
- package/dist/src/mcp-tools/monograph/query-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/monograph/query-tools.js +48 -18
- package/dist/src/mcp-tools/monograph/query-tools.js.map +1 -1
- package/dist/src/mcp-tools/performance-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/performance-tools.js +15 -10
- package/dist/src/mcp-tools/performance-tools.js.map +1 -1
- package/dist/src/memory/embedding-operations.d.ts +4 -0
- package/dist/src/memory/embedding-operations.d.ts.map +1 -1
- package/dist/src/memory/embedding-operations.js +125 -32
- package/dist/src/memory/embedding-operations.js.map +1 -1
- package/dist/src/memory/hnsw-operations.d.ts +1 -1
- package/dist/src/memory/hnsw-operations.js +1 -1
- package/dist/src/memory/memory-bridge.d.ts +8 -0
- package/dist/src/memory/memory-bridge.d.ts.map +1 -1
- package/dist/src/memory/memory-bridge.js +37 -8
- package/dist/src/memory/memory-bridge.js.map +1 -1
- package/dist/src/memory/memory-read.d.ts +1 -1
- package/dist/src/memory/memory-read.js +2 -2
- package/dist/src/memory/memory-read.js.map +1 -1
- package/dist/src/orgrt/antigravity-runner.d.ts.map +1 -1
- package/dist/src/orgrt/antigravity-runner.js +6 -6
- package/dist/src/orgrt/antigravity-runner.js.map +1 -1
- package/dist/src/orgrt/checkpoint-ops.d.ts +11 -1
- package/dist/src/orgrt/checkpoint-ops.d.ts.map +1 -1
- package/dist/src/orgrt/checkpoint-ops.js +18 -86
- package/dist/src/orgrt/checkpoint-ops.js.map +1 -1
- package/dist/src/orgrt/checkpoint.d.ts +1 -1
- package/dist/src/orgrt/checkpoint.d.ts.map +1 -1
- package/dist/src/orgrt/checkpoint.js +3 -3
- package/dist/src/orgrt/checkpoint.js.map +1 -1
- package/dist/src/orgrt/daemon.d.ts +9 -1
- package/dist/src/orgrt/daemon.d.ts.map +1 -1
- package/dist/src/orgrt/daemon.js +267 -139
- package/dist/src/orgrt/daemon.js.map +1 -1
- package/dist/src/orgrt/decisions.d.ts +13 -0
- package/dist/src/orgrt/decisions.d.ts.map +1 -1
- package/dist/src/orgrt/decisions.js +95 -0
- package/dist/src/orgrt/decisions.js.map +1 -1
- package/dist/src/orgrt/forwarder.d.ts.map +1 -1
- package/dist/src/orgrt/forwarder.js +148 -15
- package/dist/src/orgrt/forwarder.js.map +1 -1
- package/dist/src/orgrt/kimicode-runner.js +1 -1
- package/dist/src/orgrt/kimicode-runner.js.map +1 -1
- package/dist/src/orgrt/opencode-runner.js +1 -1
- package/dist/src/orgrt/opencode-runner.js.map +1 -1
- package/dist/src/orgrt/session.d.ts +27 -1
- package/dist/src/orgrt/session.d.ts.map +1 -1
- package/dist/src/orgrt/session.js +67 -6
- package/dist/src/orgrt/session.js.map +1 -1
- package/dist/src/orgrt/task-dag.d.ts +11 -1
- package/dist/src/orgrt/task-dag.d.ts.map +1 -1
- package/dist/src/orgrt/task-dag.js +93 -2
- package/dist/src/orgrt/task-dag.js.map +1 -1
- package/dist/src/orgrt/templates.d.ts.map +1 -1
- package/dist/src/orgrt/templates.js +26 -2
- package/dist/src/orgrt/templates.js.map +1 -1
- package/dist/src/orgrt/types.d.ts +77 -1
- package/dist/src/orgrt/types.d.ts.map +1 -1
- package/dist/src/orgrt/types.js +28 -2
- package/dist/src/orgrt/types.js.map +1 -1
- package/dist/src/orgrt/vercel-providers.d.ts.map +1 -1
- package/dist/src/orgrt/vercel-providers.js +9 -4
- package/dist/src/orgrt/vercel-providers.js.map +1 -1
- package/dist/src/orgrt/vercel-runner.d.ts +0 -23
- package/dist/src/orgrt/vercel-runner.d.ts.map +1 -1
- package/dist/src/orgrt/vercel-runner.js +38 -7
- package/dist/src/orgrt/vercel-runner.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/.claude/commands/mastermind/approvev1.md +0 -94
- package/.claude/commands/mastermind/architect.md +0 -52
- package/.claude/commands/mastermind/autodev.md +0 -28
- package/.claude/commands/mastermind/build.md +0 -23
- package/.claude/commands/mastermind/finish.md +0 -17
- package/.claude/commands/mastermind/runorgv1.md +0 -159
- package/.claude/commands/mastermind/taskdev.md +0 -23
- package/.claude/commands/mastermind/tdd.md +0 -19
- package/.claude/commands/mastermind/verify.md +0 -19
- package/.claude/skills/mastermind-approvev1/SKILL.md +0 -191
- package/.claude/skills/mastermind-architect/SKILL.md +0 -862
- package/.claude/skills/mastermind-autodev/SKILL.md +0 -360
- package/.claude/skills/mastermind-build/SKILL.md +0 -169
- package/.claude/skills/mastermind-companies/SKILL.md +0 -256
- package/.claude/skills/mastermind-content/SKILL.md +0 -197
- package/.claude/skills/mastermind-costs/SKILL.md +0 -151
- package/.claude/skills/mastermind-finance/SKILL.md +0 -166
- package/.claude/skills/mastermind-finish/SKILL.md +0 -251
- package/.claude/skills/mastermind-heartbeatv1/SKILL.md +0 -167
- package/.claude/skills/mastermind-instance-settings/SKILL.md +0 -315
- package/.claude/skills/mastermind-marketing/SKILL.md +0 -228
- package/.claude/skills/mastermind-marketing/references/copywriting-frameworks.md +0 -181
- package/.claude/skills/mastermind-marketing/references/persuasion-psychology.md +0 -158
- package/.claude/skills/mastermind-ops/SKILL.md +0 -168
- package/.claude/skills/mastermind-org-chart/SKILL.md +0 -209
- package/.claude/skills/mastermind-project-detail/SKILL.md +0 -249
- package/.claude/skills/mastermind-project-workspace/SKILL.md +0 -244
- package/.claude/skills/mastermind-projects/SKILL.md +0 -167
- package/.claude/skills/mastermind-runorgv1/SKILL.md +0 -731
- package/.claude/skills/mastermind-sales/SKILL.md +0 -170
- package/.claude/skills/mastermind-taskdev/SKILL.md +0 -377
- package/.claude/skills/mastermind-taskdev/code-quality-reviewer-prompt.md +0 -60
- package/.claude/skills/mastermind-taskdev/final-reviewer-prompt.md +0 -144
- package/.claude/skills/mastermind-taskdev/implementer-prompt.md +0 -114
- package/.claude/skills/mastermind-taskdev/spec-reviewer-prompt.md +0 -80
- package/.claude/skills/mastermind-tdd/SKILL.md +0 -424
- package/.claude/skills/mastermind-verify/SKILL.md +0 -196
- package/.claude/skills/mastermind-wiki/SKILL.md +0 -314
- package/.claude/skills/monolean-review/SKILL.md +0 -57
|
@@ -1,560 +1,304 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: performance-analysis
|
|
3
|
-
description:
|
|
4
|
-
Comprehensive performance analysis, bottleneck detection, and optimization recommendations for Monomind swarms
|
|
3
|
+
description: Comprehensive performance analysis, bottleneck detection, and optimization recommendations for Monomind swarms
|
|
5
4
|
---
|
|
6
5
|
|
|
7
|
-
#
|
|
8
|
-
|
|
9
|
-
Comprehensive performance analysis suite for identifying bottlenecks, profiling swarm operations, generating detailed reports, and providing actionable optimization recommendations.
|
|
6
|
+
# performance-analysis — Measure, Don't Guess
|
|
10
7
|
|
|
11
8
|
## Overview
|
|
12
9
|
|
|
13
|
-
This skill
|
|
14
|
-
|
|
15
|
-
- **Performance Profiling**: Real-time monitoring and historical analysis of swarm operations
|
|
16
|
-
- **Report Generation**: Create comprehensive performance reports in multiple formats
|
|
17
|
-
- **Optimization Recommendations**: AI-powered suggestions for improving performance
|
|
10
|
+
Performance work without measurement is superstition. This skill wires a disciplined
|
|
11
|
+
methodology to monomind's real `performance` and `analyze` command surfaces.
|
|
18
12
|
|
|
19
|
-
|
|
13
|
+
**Core principle:** ALWAYS measure before optimizing. ALWAYS confirm a bottleneck is
|
|
14
|
+
real before fixing it. Symptoms are not root causes.
|
|
20
15
|
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
npx monomind bottleneck detect
|
|
16
|
+
**Iron Law:**
|
|
24
17
|
```
|
|
25
|
-
|
|
26
|
-
### Generate Performance Report
|
|
27
|
-
```bash
|
|
28
|
-
npx monomind analysis performance-report --format html --include-metrics
|
|
18
|
+
NO OPTIMIZATION WITHOUT A MEASURED BOTTLENECK FIRST
|
|
29
19
|
```
|
|
30
20
|
|
|
31
|
-
|
|
21
|
+
## When to Use
|
|
22
|
+
|
|
23
|
+
- Something feels slow (swarm run, memory search, build, MCP tool call)
|
|
24
|
+
- Before/after a change that could affect performance
|
|
25
|
+
- A regression report or user complaint about latency
|
|
26
|
+
- Capacity planning — picking `maxAgents`, topology, or memory backend
|
|
27
|
+
- Token burn higher than expected
|
|
28
|
+
|
|
29
|
+
**Use ESPECIALLY when:** the fix "feels obvious". Obvious fixes without measurement
|
|
30
|
+
are the most common source of fake optimizations.
|
|
31
|
+
|
|
32
|
+
## The Real Command Surface
|
|
33
|
+
|
|
34
|
+
These are the ONLY performance/analysis commands. Anything else is wrong.
|
|
35
|
+
|
|
36
|
+
| Command | What it does |
|
|
37
|
+
|---|---|
|
|
38
|
+
| `monomind performance benchmark` | Run benchmarks (wasm/neural/memory/search) |
|
|
39
|
+
| `monomind performance profile` | Profile CPU/memory/IO over a window |
|
|
40
|
+
| `monomind performance metrics` | View/export metrics (1h/24h/7d/30d) |
|
|
41
|
+
| `monomind performance bottleneck` | Identify bottlenecks (quick or full) |
|
|
42
|
+
| `monomind analyze diff` | Git diff risk + change classification |
|
|
43
|
+
| `monomind analyze code` | Static code analysis |
|
|
44
|
+
| `monomind analyze deps` | Dependency analysis (`--security` for CVEs) |
|
|
45
|
+
| `monomind analyze ast` | AST analysis via tree-sitter |
|
|
46
|
+
| `monomind analyze complexity` | Code complexity metrics |
|
|
47
|
+
| `monomind analyze symbols` | Extract functions/classes/types |
|
|
48
|
+
| `monomind analyze imports` | Import dependency graph |
|
|
49
|
+
| `monomind doctor` | 28 health-check categories |
|
|
50
|
+
| `monomind hooks metrics` | Learning metrics dashboard |
|
|
51
|
+
| `monomind tokens dashboard` | Token usage (`today`/`week`/`30days`/`month`) |
|
|
52
|
+
|
|
53
|
+
> Use `npx monomind@latest ...` from outside the repo; inside the repo `node packages/@monomind/cli/bin/cli.js ...` works too. Never use `monomind@alpha`.
|
|
54
|
+
|
|
55
|
+
## The Four Phases
|
|
56
|
+
|
|
57
|
+
Complete each phase before moving on. Skipping a phase produces fake optimizations.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
### Phase 1: Establish a Baseline
|
|
62
|
+
|
|
63
|
+
Before changing anything, capture the current state so later comparison is honest.
|
|
64
|
+
|
|
32
65
|
```bash
|
|
33
|
-
|
|
66
|
+
# Benchmark the subsystems you care about
|
|
67
|
+
npx monomind@latest performance benchmark -s all -i 100 -o json > baseline-bench.json
|
|
68
|
+
|
|
69
|
+
# Snapshot current metrics for the relevant window
|
|
70
|
+
npx monomind@latest performance metrics -t 24h -f json > baseline-metrics.json
|
|
71
|
+
|
|
72
|
+
# Capture a profile so you know where time is going today
|
|
73
|
+
npx monomind@latest performance profile -t all -d 60 -o baseline-profile.json
|
|
34
74
|
```
|
|
35
75
|
|
|
36
|
-
|
|
76
|
+
**Success criteria:** you have numbers on disk for "before". No before, no after.
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
### Phase 2: Find the Bottleneck (don't guess, ask the system)
|
|
37
81
|
|
|
38
|
-
|
|
82
|
+
`performance bottleneck` answers the question "where is time being spent?".
|
|
39
83
|
|
|
40
|
-
#### Command Syntax
|
|
41
84
|
```bash
|
|
42
|
-
|
|
85
|
+
# Quick triage across the whole system
|
|
86
|
+
npx monomind@latest performance bottleneck
|
|
87
|
+
|
|
88
|
+
# Deep dive when quick confirms something is off
|
|
89
|
+
npx monomind@latest performance bottleneck -d full
|
|
90
|
+
|
|
91
|
+
# Scope to a suspected component (e.g. network, memory, search)
|
|
92
|
+
npx monomind@latest performance bottleneck -c memory
|
|
43
93
|
```
|
|
44
94
|
|
|
45
|
-
|
|
46
|
-
- `--swarm-id, -s <id>` - Analyze specific swarm (default: current)
|
|
47
|
-
- `--time-range, -t <range>` - Analysis period: 1h, 24h, 7d, all (default: 1h)
|
|
48
|
-
- `--threshold <percent>` - Bottleneck threshold percentage (default: 20)
|
|
49
|
-
- `--export, -e <file>` - Export analysis to file
|
|
50
|
-
- `--fix` - Apply automatic optimizations
|
|
95
|
+
**Map symptoms to components:**
|
|
51
96
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
97
|
+
| Symptom | First component to check |
|
|
98
|
+
|---|---|
|
|
99
|
+
| Slow swarm coordination | network (inter-agent messages) |
|
|
100
|
+
| Memory search slow | memory (SQLite vs. WASM fallback path) |
|
|
101
|
+
| Token burn surprise | cpu / model invocation |
|
|
102
|
+
| Boot/startup slow | io (file reads, graph load) |
|
|
103
|
+
| MCP tool latency | network (server round-trip) |
|
|
56
104
|
|
|
57
|
-
|
|
58
|
-
|
|
105
|
+
**If `bottleneck` reports nothing:** the problem may be code-level, not system-level.
|
|
106
|
+
Move to Phase 2b.
|
|
59
107
|
|
|
60
|
-
|
|
61
|
-
npx monomind bottleneck detect -t 24h -e bottlenecks.json
|
|
108
|
+
#### Phase 2b: Code-Level Analysis
|
|
62
109
|
|
|
63
|
-
|
|
64
|
-
npx monomind bottleneck detect --fix --threshold 15
|
|
110
|
+
When the system is healthy but the code is slow, switch to `analyze`:
|
|
65
111
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
112
|
+
```bash
|
|
113
|
+
# Riskiest recent change — most likely regression source
|
|
114
|
+
npx monomind@latest analyze diff --risk --classify -v
|
|
69
115
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
**Communication Bottlenecks:**
|
|
73
|
-
- Message queue delays
|
|
74
|
-
- Agent response times
|
|
75
|
-
- Coordination overhead
|
|
76
|
-
- Memory access patterns
|
|
77
|
-
- Inter-agent communication latency
|
|
78
|
-
|
|
79
|
-
**Processing Bottlenecks:**
|
|
80
|
-
- Task completion times
|
|
81
|
-
- Agent utilization rates
|
|
82
|
-
- Parallel execution efficiency
|
|
83
|
-
- Resource contention
|
|
84
|
-
- CPU/memory usage patterns
|
|
85
|
-
|
|
86
|
-
**Memory Bottlenecks:**
|
|
87
|
-
- Cache hit rates
|
|
88
|
-
- Memory access patterns
|
|
89
|
-
- Storage I/O performance
|
|
90
|
-
- Neural pattern loading times
|
|
91
|
-
- Memory allocation efficiency
|
|
92
|
-
|
|
93
|
-
**Network Bottlenecks:**
|
|
94
|
-
- API call latency
|
|
95
|
-
- MCP communication delays
|
|
96
|
-
- External service timeouts
|
|
97
|
-
- Concurrent request limits
|
|
98
|
-
- Network throughput issues
|
|
99
|
-
|
|
100
|
-
#### Output Format
|
|
101
|
-
```
|
|
102
|
-
🔍 Bottleneck Analysis Report
|
|
103
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
104
|
-
|
|
105
|
-
📊 Summary
|
|
106
|
-
├── Time Range: Last 1 hour
|
|
107
|
-
├── Agents Analyzed: 6
|
|
108
|
-
├── Tasks Processed: 42
|
|
109
|
-
└── Critical Issues: 2
|
|
110
|
-
|
|
111
|
-
🚨 Critical Bottlenecks
|
|
112
|
-
1. Agent Communication (35% impact)
|
|
113
|
-
└── coordinator → coder-1 messages delayed by 2.3s avg
|
|
114
|
-
|
|
115
|
-
2. Memory Access (28% impact)
|
|
116
|
-
└── Neural pattern loading taking 1.8s per access
|
|
117
|
-
|
|
118
|
-
⚠️ Warning Bottlenecks
|
|
119
|
-
1. Task Queue (18% impact)
|
|
120
|
-
└── 5 tasks waiting > 10s for assignment
|
|
121
|
-
|
|
122
|
-
💡 Recommendations
|
|
123
|
-
1. Switch to hierarchical topology (est. 40% improvement)
|
|
124
|
-
2. Enable memory caching (est. 25% improvement)
|
|
125
|
-
3. Increase agent concurrency to 8 (est. 20% improvement)
|
|
126
|
-
|
|
127
|
-
✅ Quick Fixes Available
|
|
128
|
-
Run with --fix to apply:
|
|
129
|
-
- Enable smart caching
|
|
130
|
-
- Optimize message routing
|
|
131
|
-
- Adjust agent priorities
|
|
132
|
-
```
|
|
116
|
+
# Flag high-complexity hotspots (default threshold 10)
|
|
117
|
+
npx monomind@latest analyze complexity src/ -t 15 -f json
|
|
133
118
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
#### Real-time Detection
|
|
137
|
-
Automatic analysis during task execution:
|
|
138
|
-
- Execution time vs. complexity
|
|
139
|
-
- Agent utilization rates
|
|
140
|
-
- Resource constraints
|
|
141
|
-
- Operation patterns
|
|
142
|
-
|
|
143
|
-
#### Common Bottleneck Patterns
|
|
144
|
-
|
|
145
|
-
**Time Bottlenecks:**
|
|
146
|
-
- Tasks taking > 5 minutes
|
|
147
|
-
- Sequential operations that could parallelize
|
|
148
|
-
- Redundant file operations
|
|
149
|
-
- Inefficient algorithm implementations
|
|
150
|
-
|
|
151
|
-
**Coordination Bottlenecks:**
|
|
152
|
-
- Single agent for complex tasks
|
|
153
|
-
- Unbalanced agent workloads
|
|
154
|
-
- Poor topology selection
|
|
155
|
-
- Excessive synchronization points
|
|
156
|
-
|
|
157
|
-
**Resource Bottlenecks:**
|
|
158
|
-
- High operation count (> 100)
|
|
159
|
-
- Memory constraints
|
|
160
|
-
- I/O limitations
|
|
161
|
-
- Thread pool saturation
|
|
162
|
-
|
|
163
|
-
#### MCP Integration
|
|
164
|
-
```javascript
|
|
165
|
-
// Check for bottlenecks in Claude Code
|
|
166
|
-
mcp__monomind__bottleneck_detect({
|
|
167
|
-
timeRange: "1h",
|
|
168
|
-
threshold: 20,
|
|
169
|
-
autoFix: false
|
|
170
|
-
})
|
|
171
|
-
|
|
172
|
-
// Get detailed task results with bottleneck analysis
|
|
173
|
-
mcp__monomind__task_results({
|
|
174
|
-
taskId: "task-123",
|
|
175
|
-
format: "detailed"
|
|
176
|
-
})
|
|
177
|
-
```
|
|
119
|
+
# Inspect import graph for accidental heavy dependencies
|
|
120
|
+
npx monomind@latest analyze imports src/ --external
|
|
178
121
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
{
|
|
182
|
-
"bottlenecks": [
|
|
183
|
-
{
|
|
184
|
-
"type": "coordination",
|
|
185
|
-
"severity": "high",
|
|
186
|
-
"description": "Single agent used for complex task",
|
|
187
|
-
"recommendation": "Spawn specialized agents for parallel work",
|
|
188
|
-
"impact": "35%",
|
|
189
|
-
"affectedComponents": ["coordinator", "coder-1"]
|
|
190
|
-
}
|
|
191
|
-
],
|
|
192
|
-
"improvements": [
|
|
193
|
-
{
|
|
194
|
-
"area": "execution_time",
|
|
195
|
-
"suggestion": "Use parallel task execution",
|
|
196
|
-
"expectedImprovement": "30-50% time reduction",
|
|
197
|
-
"implementationSteps": [
|
|
198
|
-
"Split task into smaller units",
|
|
199
|
-
"Spawn 3-4 specialized agents",
|
|
200
|
-
"Use mesh topology for coordination"
|
|
201
|
-
]
|
|
202
|
-
}
|
|
203
|
-
],
|
|
204
|
-
"metrics": {
|
|
205
|
-
"avgExecutionTime": "142s",
|
|
206
|
-
"agentUtilization": "67%",
|
|
207
|
-
"cacheHitRate": "82%",
|
|
208
|
-
"parallelizationFactor": 1.2
|
|
209
|
-
}
|
|
210
|
-
}
|
|
122
|
+
# Dependency audit (CVEs and bloat both hurt performance)
|
|
123
|
+
npx monomind@latest analyze deps --security
|
|
211
124
|
```
|
|
212
125
|
|
|
213
|
-
|
|
126
|
+
**Heuristic:** a regression that appeared in the last N commits is almost always
|
|
127
|
+
visible in `analyze diff --risk`. Start there before going deeper.
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
### Phase 3: Interpret the Metrics
|
|
132
|
+
|
|
133
|
+
Numbers without interpretation are noise. Read the dashboard, then explain it.
|
|
214
134
|
|
|
215
|
-
#### Command Syntax
|
|
216
135
|
```bash
|
|
217
|
-
|
|
136
|
+
# Pull a metrics view for the affected window
|
|
137
|
+
npx monomind@latest performance metrics -t 7d -f text
|
|
138
|
+
|
|
139
|
+
# Prometheus export for Grafana / long-term storage
|
|
140
|
+
npx monomind@latest performance metrics -t 30d -f prometheus > metrics.prom
|
|
141
|
+
|
|
142
|
+
# Cross-check learning hooks (these run in the background and affect timings)
|
|
143
|
+
npx monomind@latest hooks metrics
|
|
144
|
+
|
|
145
|
+
# Token spend — high burn often correlates with perf pain
|
|
146
|
+
npx monomind@latest tokens dashboard -p week --no-interactive
|
|
218
147
|
```
|
|
219
148
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
-
|
|
223
|
-
|
|
224
|
-
-
|
|
225
|
-
|
|
226
|
-
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
- Agent distribution
|
|
237
|
-
- Task statistics
|
|
238
|
-
|
|
239
|
-
3. **Performance Metrics**
|
|
240
|
-
- Execution times
|
|
241
|
-
- Throughput analysis
|
|
242
|
-
- Resource utilization
|
|
243
|
-
- Latency breakdown
|
|
244
|
-
|
|
245
|
-
4. **Bottleneck Analysis**
|
|
246
|
-
- Identified bottlenecks
|
|
247
|
-
- Impact assessment
|
|
248
|
-
- Optimization priorities
|
|
249
|
-
|
|
250
|
-
5. **Comparative Analysis** (when --compare used)
|
|
251
|
-
- Performance trends
|
|
252
|
-
- Improvement metrics
|
|
253
|
-
- Regression detection
|
|
254
|
-
|
|
255
|
-
6. **Recommendations**
|
|
256
|
-
- Prioritized action items
|
|
257
|
-
- Expected improvements
|
|
258
|
-
- Implementation guidance
|
|
259
|
-
|
|
260
|
-
#### Usage Examples
|
|
149
|
+
**Interpretation rules:**
|
|
150
|
+
|
|
151
|
+
- A single high number is not a bottleneck. A high number *with user-visible pain*
|
|
152
|
+
is. Always tie metrics back to a symptom.
|
|
153
|
+
- Compare like-for-like: same window, same load, same machine. A 7d average next to
|
|
154
|
+
a 1h spike is meaningless.
|
|
155
|
+
- Latency has tails. Always look at p95/p99, not just mean — means hide outliers.
|
|
156
|
+
- Cache hit rate below ~80% usually means the working set is bigger than the cache
|
|
157
|
+
OR the eviction policy is wrong. Both are fixable.
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
### Phase 4: Apply One Fix, Re-measure, Decide
|
|
162
|
+
|
|
163
|
+
One change. One measurement. Then decide.
|
|
164
|
+
|
|
261
165
|
```bash
|
|
262
|
-
#
|
|
263
|
-
npx monomind analysis performance-report --format html --include-metrics
|
|
264
|
-
|
|
265
|
-
# Compare current swarm with previous
|
|
266
|
-
npx monomind analysis performance-report --compare swarm-123 --format markdown
|
|
267
|
-
|
|
268
|
-
# Custom output with specific sections
|
|
269
|
-
npx monomind analysis performance-report \
|
|
270
|
-
--sections summary,metrics,recommendations \
|
|
271
|
-
--output reports/perf-analysis.html \
|
|
272
|
-
--format html
|
|
273
|
-
|
|
274
|
-
# Weekly performance report
|
|
275
|
-
npx monomind analysis performance-report \
|
|
276
|
-
--time-range 7d \
|
|
277
|
-
--include-metrics \
|
|
278
|
-
--format markdown \
|
|
279
|
-
--output docs/weekly-performance.md
|
|
280
|
-
|
|
281
|
-
# JSON format for CI/CD integration
|
|
282
|
-
npx monomind analysis performance-report \
|
|
283
|
-
--format json \
|
|
284
|
-
--output build/performance.json
|
|
285
|
-
```
|
|
166
|
+
# Apply the single fix you hypothesized from Phase 2/3 evidence
|
|
286
167
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
- **Analysis Period**: Last 24 hours
|
|
294
|
-
- **Swarms Analyzed**: 3
|
|
295
|
-
- **Critical Issues**: 1
|
|
296
|
-
|
|
297
|
-
## Key Metrics
|
|
298
|
-
| Metric | Value | Trend | Target |
|
|
299
|
-
|--------|-------|-------|--------|
|
|
300
|
-
| Avg Task Time | 42s | ↓ 12% | 35s |
|
|
301
|
-
| Agent Utilization | 78% | ↑ 5% | 85% |
|
|
302
|
-
| Cache Hit Rate | 91% | → | 90% |
|
|
303
|
-
| Parallel Efficiency | 2.3x | ↑ 0.4x | 2.5x |
|
|
304
|
-
|
|
305
|
-
## Bottleneck Analysis
|
|
306
|
-
### Critical
|
|
307
|
-
1. **Agent Communication Delay** (Impact: 35%)
|
|
308
|
-
- Coordinator → Coder messages delayed by 2.3s avg
|
|
309
|
-
- **Fix**: Switch to hierarchical topology
|
|
310
|
-
|
|
311
|
-
### Warnings
|
|
312
|
-
1. **Memory Access Pattern** (Impact: 18%)
|
|
313
|
-
- Neural pattern loading: 1.8s per access
|
|
314
|
-
- **Fix**: Enable memory caching
|
|
315
|
-
|
|
316
|
-
## Recommendations
|
|
317
|
-
1. **High Priority**: Switch to hierarchical topology (40% improvement)
|
|
318
|
-
2. **Medium Priority**: Enable memory caching (25% improvement)
|
|
319
|
-
3. **Low Priority**: Increase agent concurrency to 8 (20% improvement)
|
|
168
|
+
# Re-run the EXACT same baseline commands
|
|
169
|
+
npx monomind@latest performance benchmark -s all -i 100 -o json > after-bench.json
|
|
170
|
+
npx monomind@latest performance metrics -t 24h -f json > after-metrics.json
|
|
171
|
+
npx monomind@latest performance profile -t all -d 60 -o after-profile.json
|
|
172
|
+
|
|
173
|
+
# Diff before vs after. Did the targeted metric move? Did anything else regress?
|
|
320
174
|
```
|
|
321
175
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
**3. Concurrency Tuning**
|
|
340
|
-
- Adjust agent counts
|
|
341
|
-
- Optimize parallel execution
|
|
342
|
-
- Balance workload distribution
|
|
343
|
-
- Implement load balancing
|
|
344
|
-
|
|
345
|
-
**4. Priority Adjustment**
|
|
346
|
-
- Reorder task queues
|
|
347
|
-
- Prioritize critical paths
|
|
348
|
-
- Reduce wait times
|
|
349
|
-
- Implement fair scheduling
|
|
350
|
-
|
|
351
|
-
**5. Resource Optimization**
|
|
352
|
-
- Optimize memory usage
|
|
353
|
-
- Reduce I/O operations
|
|
354
|
-
- Batch API calls
|
|
355
|
-
- Implement connection pooling
|
|
356
|
-
|
|
357
|
-
#### Performance Impact
|
|
358
|
-
Typical improvements after bottleneck resolution:
|
|
359
|
-
|
|
360
|
-
- **Communication**: 30-50% faster message delivery
|
|
361
|
-
- **Processing**: 20-40% reduced task completion time
|
|
362
|
-
- **Memory**: 40-60% fewer cache misses
|
|
363
|
-
- **Network**: 25-45% reduced API latency
|
|
364
|
-
- **Overall**: 25-45% total performance improvement
|
|
365
|
-
|
|
366
|
-
## Advanced Usage
|
|
367
|
-
|
|
368
|
-
### Continuous Monitoring
|
|
176
|
+
**Decision rules:**
|
|
177
|
+
|
|
178
|
+
- Target metric improved, nothing regressed → ship it.
|
|
179
|
+
- Target metric improved, something else regressed → weigh tradeoffs explicitly.
|
|
180
|
+
Don't ship on hope.
|
|
181
|
+
- Target metric unchanged → the bottleneck was misdiagnosed. Return to Phase 2 with
|
|
182
|
+
new evidence. Do not apply a second fix on top of a failed one.
|
|
183
|
+
- 3+ fixes in a row with no movement → this is architectural (see below).
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## Methodology: Regression Detection
|
|
188
|
+
|
|
189
|
+
Performance regressions slip in through code changes. Catch them at the diff, not in
|
|
190
|
+
production.
|
|
191
|
+
|
|
369
192
|
```bash
|
|
370
|
-
#
|
|
371
|
-
npx monomind
|
|
372
|
-
|
|
373
|
-
#
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
sleep 3600
|
|
379
|
-
done
|
|
193
|
+
# Before merging any change that touches a hot path:
|
|
194
|
+
npx monomind@latest analyze diff --risk -v
|
|
195
|
+
|
|
196
|
+
# Classify the change so reviewers know what they're looking at
|
|
197
|
+
npx monomind@latest analyze diff --classify --reviewers
|
|
198
|
+
|
|
199
|
+
# Compare the current branch against main explicitly
|
|
200
|
+
npx monomind@latest analyze diff main..HEAD --risk --format json
|
|
380
201
|
```
|
|
381
202
|
|
|
382
|
-
|
|
383
|
-
```yaml
|
|
384
|
-
# .github/workflows/performance.yml
|
|
385
|
-
name: Performance Analysis
|
|
386
|
-
on: [push, pull_request]
|
|
203
|
+
**CI integration (GitHub Action):**
|
|
387
204
|
|
|
205
|
+
```yaml
|
|
206
|
+
name: Performance Gate
|
|
207
|
+
on: [pull_request]
|
|
388
208
|
jobs:
|
|
389
|
-
|
|
209
|
+
perf:
|
|
390
210
|
runs-on: ubuntu-latest
|
|
391
211
|
steps:
|
|
392
|
-
- uses: actions/checkout@
|
|
393
|
-
- name:
|
|
394
|
-
run:
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
- name: Check Performance Thresholds
|
|
399
|
-
run: |
|
|
400
|
-
npx monomind bottleneck detect \
|
|
401
|
-
--threshold 15 \
|
|
402
|
-
--export bottlenecks.json
|
|
403
|
-
- name: Upload Reports
|
|
404
|
-
uses: actions/upload-artifact@v2
|
|
212
|
+
- uses: actions/checkout@v4
|
|
213
|
+
- name: Risk-classify the diff
|
|
214
|
+
run: npx monomind@latest analyze diff main..HEAD --risk --format json > diff-risk.json
|
|
215
|
+
- name: Snapshot metrics
|
|
216
|
+
run: npx monomind@latest performance metrics -t 24h -f json > metrics.json
|
|
217
|
+
- uses: actions/upload-artifact@v4
|
|
405
218
|
with:
|
|
406
|
-
name:
|
|
219
|
+
name: perf-gate
|
|
407
220
|
path: |
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
```
|
|
411
|
-
|
|
412
|
-
### Custom Analysis Scripts
|
|
413
|
-
```javascript
|
|
414
|
-
// scripts/analyze-performance.js
|
|
415
|
-
const { exec } = require('child_process');
|
|
416
|
-
const fs = require('fs');
|
|
417
|
-
|
|
418
|
-
async function analyzePerformance() {
|
|
419
|
-
// Run bottleneck detection
|
|
420
|
-
const bottlenecks = await runCommand(
|
|
421
|
-
'npx monomind bottleneck detect --format json'
|
|
422
|
-
);
|
|
423
|
-
|
|
424
|
-
// Generate performance report
|
|
425
|
-
const report = await runCommand(
|
|
426
|
-
'npx monomind analysis performance-report --format json'
|
|
427
|
-
);
|
|
428
|
-
|
|
429
|
-
// Analyze results
|
|
430
|
-
const analysis = {
|
|
431
|
-
bottlenecks: JSON.parse(bottlenecks),
|
|
432
|
-
performance: JSON.parse(report),
|
|
433
|
-
timestamp: new Date().toISOString()
|
|
434
|
-
};
|
|
435
|
-
|
|
436
|
-
// Save combined analysis
|
|
437
|
-
fs.writeFileSync(
|
|
438
|
-
'analysis/combined-report.json',
|
|
439
|
-
JSON.stringify(analysis, null, 2)
|
|
440
|
-
);
|
|
441
|
-
|
|
442
|
-
// Generate alerts if needed
|
|
443
|
-
if (analysis.bottlenecks.critical.length > 0) {
|
|
444
|
-
console.error('CRITICAL: Performance bottlenecks detected!');
|
|
445
|
-
process.exit(1);
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
function runCommand(cmd) {
|
|
450
|
-
return new Promise((resolve, reject) => {
|
|
451
|
-
exec(cmd, (error, stdout, stderr) => {
|
|
452
|
-
if (error) reject(error);
|
|
453
|
-
else resolve(stdout);
|
|
454
|
-
});
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
analyzePerformance().catch(console.error);
|
|
221
|
+
diff-risk.json
|
|
222
|
+
metrics.json
|
|
459
223
|
```
|
|
460
224
|
|
|
461
|
-
|
|
225
|
+
> Don't fail CI on a raw number threshold unless you have a stable baseline. Prefer
|
|
226
|
+
> *risk classification* (qualitative) over *latency thresholds* (fragile) for the
|
|
227
|
+
> gate, and use metrics for trend analysis offline.
|
|
462
228
|
|
|
463
|
-
|
|
464
|
-
- Run bottleneck detection after major changes
|
|
465
|
-
- Generate weekly performance reports
|
|
466
|
-
- Monitor trends over time
|
|
467
|
-
- Set up automated alerts
|
|
229
|
+
---
|
|
468
230
|
|
|
469
|
-
|
|
470
|
-
- Start with default threshold (20%)
|
|
471
|
-
- Lower for production systems (10-15%)
|
|
472
|
-
- Higher for development (25-30%)
|
|
473
|
-
- Adjust based on requirements
|
|
231
|
+
## Methodology: Optimization Recommendations
|
|
474
232
|
|
|
475
|
-
|
|
476
|
-
- Always review before applying --fix
|
|
477
|
-
- Test fixes in development first
|
|
478
|
-
- Apply fixes incrementally
|
|
479
|
-
- Monitor impact after changes
|
|
233
|
+
When `performance bottleneck` reports findings, map them to actions in this order:
|
|
480
234
|
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
-
|
|
235
|
+
| Bottleneck type | First-action recommendation |
|
|
236
|
+
|---|---|
|
|
237
|
+
| network | Check topology (`hierarchical` vs `mesh`); reduce message round-trips |
|
|
238
|
+
| memory | Confirm SQLite bridge is up (not the WASM/JSON fallback); widen cache |
|
|
239
|
+
| cpu | Profile (`performance profile -t cpu`) to find the hot function |
|
|
240
|
+
| io | Batch file reads; lazy-load graphs; check for sync I/O on hot path |
|
|
241
|
+
| search | Rebuild monograph; verify BM25 index is current |
|
|
242
|
+
| coordination | Lower `maxAgents` if utilization is low; raise it if queue is deep |
|
|
486
243
|
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
- Build performance budgets
|
|
490
|
-
- Establish baselines
|
|
491
|
-
- Set improvement goals
|
|
244
|
+
**Always:** state the recommendation as a hypothesis, apply it as a single change,
|
|
245
|
+
and verify with Phase 4. Recommendations without re-measurement are guesses.
|
|
492
246
|
|
|
493
|
-
|
|
247
|
+
---
|
|
494
248
|
|
|
495
|
-
|
|
249
|
+
## Continuous Monitoring
|
|
496
250
|
|
|
497
|
-
**High Memory Usage**
|
|
498
251
|
```bash
|
|
499
|
-
#
|
|
500
|
-
npx monomind
|
|
252
|
+
# Weekly metrics snapshot for trend analysis
|
|
253
|
+
npx monomind@latest performance metrics -t 7d -f json > "perf-$(date +%Y%m%d).json"
|
|
501
254
|
|
|
502
|
-
#
|
|
503
|
-
npx monomind
|
|
255
|
+
# Doctor runs 28 health categories — include it in weekly review
|
|
256
|
+
npx monomind@latest doctor
|
|
504
257
|
|
|
505
|
-
#
|
|
506
|
-
npx monomind
|
|
258
|
+
# Hooks metrics show what the background workers are costing you
|
|
259
|
+
npx monomind@latest hooks metrics
|
|
507
260
|
```
|
|
508
261
|
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
# Identify slow tasks
|
|
512
|
-
npx monomind task status --detailed
|
|
513
|
-
|
|
514
|
-
# Analyze coordination overhead
|
|
515
|
-
npx monomind bottleneck detect --time-range 1h
|
|
516
|
-
|
|
517
|
-
# Check agent utilization
|
|
518
|
-
npx monomind agent metrics
|
|
519
|
-
```
|
|
262
|
+
For long-term storage, pipe `performance metrics -f prometheus` into a Prometheus
|
|
263
|
+
instance and let Grafana draw the trends.
|
|
520
264
|
|
|
521
|
-
|
|
522
|
-
```bash
|
|
523
|
-
# Analyze cache hit rates
|
|
524
|
-
npx monomind analysis performance-report --sections metrics
|
|
265
|
+
---
|
|
525
266
|
|
|
526
|
-
|
|
527
|
-
npx monomind cache manage --action analyze
|
|
267
|
+
## Red Flags — STOP and Return to Phase 1
|
|
528
268
|
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
269
|
+
| Thought / Action | What it means |
|
|
270
|
+
|---|---|
|
|
271
|
+
| "This is obviously slow, let me optimize it" | No measured bottleneck. Phase 1 first. |
|
|
272
|
+
| "I'll add a cache, that always helps" | Cache without a measured miss rate is bloat. |
|
|
273
|
+
| "Let me try a few optimizations together" | Can't isolate what worked. One change. |
|
|
274
|
+
| "Benchmark improved so we're done" | Did anything else regress? Check, don't assume. |
|
|
275
|
+
| "It feels faster now" | Feeling is not measurement. Re-run baseline. |
|
|
276
|
+
| 3+ fixes applied, no movement | Architectural problem. Stop, discuss design. |
|
|
532
277
|
|
|
533
278
|
## Integration with Other Skills
|
|
534
279
|
|
|
535
|
-
-
|
|
536
|
-
-
|
|
537
|
-
-
|
|
538
|
-
-
|
|
280
|
+
- **`mastermind-debug`** — Phase 1 root-cause methodology underpins this skill
|
|
281
|
+
- **`swarm-orchestration`** — topology decisions driven by bottleneck findings
|
|
282
|
+
- **`verification-quality`** — confirm the optimization actually held
|
|
283
|
+
- **`mastermind-verify`** — evidence-before-claims for "is it faster?"
|
|
539
284
|
|
|
540
|
-
##
|
|
285
|
+
## Quick Reference
|
|
541
286
|
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
- `
|
|
287
|
+
| Phase | Key command | Success criteria |
|
|
288
|
+
|---|---|---|
|
|
289
|
+
| 1. Baseline | `performance benchmark` + `metrics` | Numbers on disk |
|
|
290
|
+
| 2. Bottleneck | `performance bottleneck -d full` | Named component or code hotspot |
|
|
291
|
+
| 2b. Code-level | `analyze diff --risk`, `analyze complexity` | Risky change or hotspot file found |
|
|
292
|
+
| 3. Interpret | `performance metrics`, `tokens dashboard` | Metric tied to a symptom |
|
|
293
|
+
| 4. Fix + re-measure | same baseline commands | Target moved, nothing regressed |
|
|
547
294
|
|
|
548
295
|
## See Also
|
|
549
296
|
|
|
550
|
-
- [
|
|
551
|
-
- [
|
|
552
|
-
- [
|
|
553
|
-
- [Swarm Monitoring Documentation](../swarm-orchestration/SKILL.md)
|
|
554
|
-
- [Memory Management Documentation](../memory-management/SKILL.md)
|
|
297
|
+
- [Systematic Debugging](../mastermind-debug/SKILL.md)
|
|
298
|
+
- [Swarm Orchestration](../swarm-orchestration/SKILL.md)
|
|
299
|
+
- [Verification & Quality](../verification-quality/SKILL.md)
|
|
555
300
|
|
|
556
301
|
---
|
|
557
302
|
|
|
558
|
-
**Version**:
|
|
559
|
-
**Last Updated**:
|
|
560
|
-
**Maintainer**: Monomind Team
|
|
303
|
+
**Version**: 2.0.0
|
|
304
|
+
**Last Updated**: 2026-08-12
|