monomind 1.11.0 → 1.11.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monomind",
3
- "version": "1.11.0",
3
+ "version": "1.11.1",
4
4
  "description": "Monomind - Enterprise AI agent orchestration for Claude Code. Deploy 60+ specialized agents in coordinated swarms with self-learning, fault-tolerant consensus, vector memory, and MCP integration",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -127,4 +127,4 @@
127
127
  "access": "public",
128
128
  "tag": "latest"
129
129
  }
130
- }
130
+ }
@@ -1424,7 +1424,16 @@ const preTaskCommand = {
1424
1424
  output.writeln(output.bold('Recommendations'));
1425
1425
  output.printList(result.recommendations);
1426
1426
  }
1427
- // Enhanced model routing module was never shipped no recommendation to add.
1427
+ // Monograph graph-first reminder always surface before the agent starts grepping
1428
+ if (description) {
1429
+ output.writeln();
1430
+ output.writeln(output.bold('[MONOGRAPH] Graph-first protocol:'));
1431
+ output.printList([
1432
+ `mcp__monomind__monograph_suggest task="${description.slice(0, 80)}" — get relevant nodes ranked by task`,
1433
+ 'mcp__monomind__monograph_query — BM25 lookup before any grep/find via Bash',
1434
+ 'mcp__monomind__monograph_impact — blast radius before editing shared code',
1435
+ ]);
1436
+ }
1428
1437
  return { success: true, data: result };
1429
1438
  }
1430
1439
  catch (error) {
@@ -17,7 +17,9 @@ function behavioralRules() {
17
17
  - NEVER save working files, text/mds, or tests to the root folder
18
18
  - Never continuously check status after spawning a swarm — wait for results
19
19
  - ALWAYS read a file before editing it
20
- - NEVER commit secrets, credentials, or .env files`;
20
+ - NEVER commit secrets, credentials, or .env files
21
+ - ALWAYS call \`mcp__monomind__monograph_query\` BEFORE running grep/rg/find via Bash for code exploration — only fall back to Bash grep if monograph returns 0 results or the DB does not exist
22
+ - When starting any task that touches 3+ files: call \`mcp__monomind__monograph_suggest\` first to get relevant nodes ranked by task relevance`;
21
23
  }
22
24
  function codingPrinciples() {
23
25
  return `## Coding Principles
@@ -365,28 +367,50 @@ MONOMIND_MEMORY_PATH=./data/memory
365
367
  \`\`\``;
366
368
  }
367
369
  function graphifySection() {
368
- return `## Knowledge Graph (Monograph)
369
-
370
- Built into monomind since v1.8.0 — no separate install needed. Pure TypeScript, no Python required.
371
-
372
- ### MCP Tools (prefix: \`mcp__monomind__\`)
373
-
374
- | Tool | Description |
375
- |------|-------------|
376
- | \`monograph_build\` | Build or refresh knowledge graph from codebase |
377
- | \`monograph_report\` | Generate GRAPH_REPORT.md with community breakdown |
378
- | \`monograph_suggest\` | Get refactoring/architecture suggestions from graph |
379
- | \`monograph_health\` | Check graph quality score and experiment status |
380
-
381
- ### How It Works
382
-
383
- 1. **AST extraction** parses TypeScript/JS/Python/Go/Rust into nodes + edges
384
- 2. **Community detection** — Louvain algorithm finds logical clusters
385
- 3. **Quality metric** \`graphQuality = avgCohesion × ln(1 + avgDegree)\`
386
- 4. **Experiment loop** — tracks BASELINE/KEEP/DISCARD in \`results.tsv\`
387
- 5. **BFD chunking** efficient Anthropic API calls via bin-packing
388
-
389
- > If monograph tools are not available, run \`npx monomind@latest init --force\` then restart Claude Code.`;
370
+ return `## Knowledge Graph — Monograph (Use Before Codebase Exploration)
371
+
372
+ Built into monomind — no separate install. Pure TypeScript, parses TS/JS/Python/Go/Rust/C/C++/Java/Ruby/Swift into a SQLite graph with BM25 full-text search.
373
+
374
+ ### MANDATORY: Graph-First, Grep-Last
375
+
376
+ **Before ANY grep/rg/find via Bash for code navigation:**
377
+ 1. Call \`mcp__monomind__monograph_query\` first — returns file path + line number
378
+ 2. Only fall back to Bash grep if monograph returns 0 results or reports DB missing
379
+
380
+ **When starting any task touching 3+ files:**
381
+ 1. \`mcp__monomind__monograph_suggest\` relevant nodes ranked by task description
382
+ 2. \`mcp__monomind__monograph_context\` — 360° view of a symbol (callers, callees, imports)
383
+ 3. \`mcp__monomind__monograph_impact\` blast radius before changing anything
384
+
385
+ **If graph is empty:** call \`mcp__monomind__monograph_build\` (runs in background; proceed with grep while it builds).
386
+
387
+ ### Available Tools (prefix: \`mcp__monomind__\`)
388
+
389
+ | Tool | Use when |
390
+ |------|----------|
391
+ | \`monograph_suggest\` | **Start every multi-file task** ranked by task relevance |
392
+ | \`monograph_query\` | **Primary code lookup** — BM25 search, returns file + line |
393
+ | \`monograph_context\` | 360° symbol view: callers, callees, imports, community |
394
+ | \`monograph_impact\` | Blast radius before a change — transitive callers + risk score |
395
+ | \`monograph_build\` | Build/rebuild the index (codeOnly:true for code-only) |
396
+ | \`monograph_god_nodes\` | High-centrality files — find the most connected internal nodes |
397
+ | \`monograph_detect_changes\` | Git diff → affected symbols since base branch |
398
+ | \`monograph_rename\` | Dry-run multi-file rename — all reference sites, never writes |
399
+ | \`monograph_route_map\` | List all HTTP routes with handler info |
400
+ | \`monograph_api_impact\` | Blast radius of an API route |
401
+ | \`monograph_cypher\` | Single-hop MATCH query over the graph |
402
+ | \`monograph_staleness\` | Git commits since last index build |
403
+ | \`monograph_stats\` | Node/edge/community counts |
404
+ | \`monograph_health\` | Index freshness vs current HEAD |
405
+ | \`monograph_shortest_path\` | Shortest dependency path between two symbols |
406
+ | \`monograph_community\` | All nodes in a community cluster |
407
+ | \`monograph_export\` | Export graph: json, svg, graphml, cypher, obsidian |
408
+ | \`monograph_augment\` | Graph-RAG context block for AI prompts |
409
+ | \`monograph_doctor\` | Platform diagnostics (Node version, DB health) |
410
+ | \`monograph_list_repos\` | Global registry of indexed repos |
411
+
412
+ ### Skip monograph for
413
+ Single-file edits, doc/config changes, quick fixes where you already know the exact file.`;
390
414
  }
391
415
  function setupAndBoundary() {
392
416
  return `## Quick Setup
@@ -694,7 +694,25 @@ export async function injectAiContext(opts) {
694
694
  const { repoPath, targets = ['claude', 'agents-md'] } = opts;
695
695
  const SENTINEL_START = '<!-- monograph:start -->';
696
696
  const SENTINEL_END = '<!-- monograph:end -->';
697
- const block = `${SENTINEL_START}\n## Monograph Knowledge Graph\n\nMonograph provides code intelligence via graph-based search.\nTools: monograph_query, monograph_context, monograph_impact, monograph_route_map, monograph_cypher.\n${SENTINEL_END}`;
697
+ const block = `${SENTINEL_START}
698
+ ## Knowledge Graph — Monograph (Use Before Codebase Exploration)
699
+
700
+ **MANDATORY: Graph-First, Grep-Last.**
701
+ Before ANY grep/rg/find via Bash for code navigation, call \`mcp__monomind__monograph_query\` first.
702
+ Only fall back to Bash grep if monograph returns 0 results or the DB is missing.
703
+
704
+ When starting any task touching 3+ files:
705
+ 1. \`mcp__monomind__monograph_suggest\` — relevant nodes ranked by task description
706
+ 2. \`mcp__monomind__monograph_context\` — 360° view of a symbol (callers, callees, imports)
707
+ 3. \`mcp__monomind__monograph_impact\` — blast radius before changing anything
708
+
709
+ Key tools: monograph_query (BM25 search, file+line), monograph_context (symbol 360°),
710
+ monograph_impact (blast radius), monograph_detect_changes (git diff → symbols),
711
+ monograph_rename (dry-run multi-file rename), monograph_route_map (HTTP routes),
712
+ monograph_cypher (single-hop graph query), monograph_augment (graph-RAG context).
713
+
714
+ If graph is empty: call monograph_build (codeOnly:true) and proceed with grep while it builds.
715
+ ${SENTINEL_END}`;
698
716
  const updated = [];
699
717
  const fileMaps = {
700
718
  'claude': join(repoPath, 'CLAUDE.md'),
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monoes/monomindcli",
3
- "version": "1.11.0",
3
+ "version": "1.11.1",
4
4
  "type": "module",
5
5
  "description": "Monomind CLI - Enterprise AI agent orchestration with 60+ specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code",
6
6
  "main": "dist/src/index.js",
@@ -113,4 +113,4 @@
113
113
  "access": "public",
114
114
  "tag": "latest"
115
115
  }
116
- }
116
+ }